예제 #1
0
def create_AO(oid=1, pv=0, name="AO", units=None):
    aoo = AnalogOutputObject(
        objectIdentifier=("analogOutput", oid),
        objectName=name,
        presentValue=pv,
        units=units,
    )
    return aoo
예제 #2
0
def create_AO(oid=1, pv=0, name="AO", units=None, pv_writable=False):
    aoo = AnalogOutputObject(
        objectIdentifier=("analogOutput", oid),
        objectName=name,
        presentValue=pv,
        units=units,
    )
    aoo = _make_mutable(aoo, mutable=pv_writable)
    return aoo
예제 #3
0
def create_AO(oid=1, pv=0, name="AO", units=None, pv_writable=False):
    aoo = AnalogOutputObject(
        objectIdentifier=("analogOutput", oid),
        objectName=name,
        presentValue=pv,
        units=units,
        priorityArray=PriorityArray(),
        statusFlags=StatusFlags(),
    )
    aoo = _make_mutable(aoo, mutable=pv_writable)
    deprecate_msg()
    return aoo
예제 #4
0
 def __init__(self, **kwargs):
     if _debug: RandomAnalogOutputObject._debug("__init__ %r", kwargs)
     AnalogOutputObject.__init__(self, **kwargs)
예제 #5
0
def create_AO(oid=1, pv=0, name='AO', units=None):
    aoo = AnalogOutputObject(objectIdentifier=('analogOutput', oid),
                             objectName=name,
                             presentValue=pv,
                             units=units)
    return aoo
예제 #6
0
def run_application() -> str:
    '''
    Simulate and query the device.
    :return: Object query result.
    '''
    from bacpypes.object import AnalogInputObject, AnalogOutputObject, AnalogValueObject, BinaryInputObject, BinaryOutputObject, MultiStateInputObject
    from bacnet.local_device_applications import SimulateAndQueryDeviceApplication
    import bacpypes.basetypes

    analog_input_objects =\
        [
        AnalogInputObject(
        objectName='Temperature Sensor',
        objectIdentifier=('analogInput', 0),
        objectType='analogInput',
        presentValue=21,
        #statusFlags='inAlarm',
        eventState='normal',
        outOfService=False,
        units='degreesCelsius'
    ), AnalogInputObject(
        objectName='Setpoint Adjust',
        objectIdentifier=('analogInput', 1),
        objectType='analogInput',
        presentValue=259,
        #statusFlags='inAlarm',
        eventState='normal',
        outOfService=False,
        units='degreesCelsius'
    ), AnalogInputObject(
        objectName='Humidity Sensor',
        objectIdentifier=('analogInput', 2),
        objectType='analogInput',
        presentValue=27,
        #statusFlags='inAlarm',
        eventState='normal',
        outOfService=False,
        units='percent'
    ), AnalogInputObject(
        objectName='RI1',
        objectIdentifier=('analogInput', 3),
        objectType='analogInput',
        presentValue=20981,
        #statusFlags='inAlarm',
        eventState='normal',
        outOfService=False,
        units='ohms'
    ), AnalogInputObject(
        objectName='RI2',
        objectIdentifier=('analogInput', 4),
        objectType='analogInput',
        presentValue=12841,
        #statusFlags='inAlarm',
        eventState='normal',
        outOfService=False,
        units='ohms'
    ), AnalogInputObject(
        objectName='CO2 Sensor',
        objectIdentifier=('analogInput', 5),
        objectType='analogInput',
        presentValue=738,
        #statusFlags='inAlarm',
        eventState='normal',
        outOfService=False,
        units='partsPerMillion'
    ), AnalogInputObject(
        objectName='LUX Sensor',
        objectIdentifier=('analogInput', 6),
        objectType='analogInput',
        presentValue=1974,
        #statusFlags='inAlarm',
        eventState='normal',
        outOfService=False,
        units='luxes'
    )]

    analog_output_objets = [
        AnalogOutputObject(objectIdentifier=('analogOutput', 0),
                           objectName='Y1',
                           objectType='analogOutput',
                           presentValue=72,
                           eventState='normal',
                           outOfService=False,
                           units='percent'),
        AnalogOutputObject(objectIdentifier=('analogOutput', 1),
                           objectName='Y2',
                           objectType='analogOutput',
                           presentValue=21,
                           eventState='normal',
                           outOfService=False,
                           units='percent'),
        AnalogOutputObject(objectIdentifier=('analogOutput', 2),
                           objectName='Y3',
                           objectType='analogOutput',
                           presentValue=82,
                           eventState='normal',
                           outOfService=False,
                           units='percent')
    ]

    analog_value_objects = [
        AnalogValueObject(objectIdentifier=('analogValue', 0),
                          objectName='Temperature Setpoint',
                          objectType='analogValue',
                          presentValue=27,
                          eventState='normal',
                          outOfService=False,
                          units='degreesCelsius',
                          relinquishDefault=20),
        AnalogValueObject(objectIdentifier=('analogValue', 1),
                          objectName='Humidity Setpoint',
                          objectType='analogValue',
                          presentValue=12,
                          eventState='normal',
                          outOfService=False,
                          units='percent',
                          relinquishDefault=50),
        AnalogValueObject(objectIdentifier=('analogValue', 2),
                          objectName='CO2 Setpoint',
                          objectType='analogValue',
                          presentValue=502,
                          eventState='normal',
                          outOfService=False,
                          units='partsPerMillion',
                          relinquishDefault=500),
        AnalogValueObject(objectIdentifier=('analogValue', 3),
                          objectName='LUX Setpoint',
                          objectType='analogValue',
                          presentValue=1129,
                          eventState='normal',
                          outOfService=False,
                          units='luxes',
                          relinquishDefault=1500),
        AnalogValueObject(objectIdentifier=('analogValue', 4),
                          objectName='DI1 Pulse Count',
                          objectType='analogValue',
                          presentValue=8276491,
                          eventState='normal',
                          outOfService=False,
                          units='noUnits',
                          relinquishDefault=0),
        AnalogValueObject(objectIdentifier=('analogValue', 5),
                          objectName='DI2 Pulse Count',
                          objectType='analogValue',
                          presentValue=292384,
                          eventState='normal',
                          outOfService=False,
                          units='noUnits',
                          relinquishDefault=0),
        AnalogValueObject(objectIdentifier=('analogValue', 6),
                          objectName='LCD Backlight Brightness',
                          objectType='analogValue',
                          presentValue=7,
                          eventState='normal',
                          outOfService=False,
                          units='noUnits',
                          relinquishDefault=0),
    ]

    binary_input_objects = [
        BinaryInputObject(objectIdentifier=('binaryInput', 0),
                          objectName='DI1',
                          objectType='binaryInput',
                          presentValue=0,
                          eventState='normal',
                          outOfService=False,
                          polarity='normal',
                          activeText='on',
                          inactiveText='off'),
        BinaryInputObject(objectIdentifier=('binaryInput', 1),
                          objectName='DI2',
                          objectType='binaryInput',
                          presentValue=1,
                          eventState='normal',
                          outOfService=False,
                          polarity='normal',
                          activeText='on',
                          inactiveText='off'),
        BinaryInputObject(objectIdentifier=('binaryInput', 2),
                          objectName='Occupancy',
                          objectType='binaryInput',
                          presentValue=1,
                          eventState='normal',
                          outOfService=False,
                          polarity='normal',
                          activeText='on',
                          inactiveText='off'),
        BinaryInputObject(objectIdentifier=('binaryInput', 3),
                          objectName='Push Button 1',
                          objectType='binaryInput',
                          presentValue=0,
                          eventState='normal',
                          outOfService=False,
                          polarity='normal',
                          activeText='on',
                          inactiveText='off'),
        BinaryInputObject(objectIdentifier=('binaryInput', 4),
                          objectName='Push Button 2',
                          objectType='binaryInput',
                          presentValue=0,
                          eventState='normal',
                          outOfService=False,
                          polarity='normal',
                          activeText='on',
                          inactiveText='off')
    ]

    binary_output_objects = [
        BinaryOutputObject(objectIdentifier=('binaryOutput', 0),
                           objectName='DO1',
                           objectType='binaryOutput',
                           presentValue=0,
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off'),
        BinaryOutputObject(objectIdentifier=('binaryOutput', 1),
                           objectName='DO2',
                           objectType='binaryOutput',
                           presentValue=0,
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off'),
        BinaryOutputObject(objectIdentifier=('binaryOutput', 2),
                           objectName='SPA Reset',
                           objectType='binaryOutput',
                           presentValue=0,
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off')
    ]

    multistate_input_objects = [
        MultiStateInputObject(objectIdentifier=('multiStateInput', 0),
                              objectName='Alarm Level',
                              objectType='multiStateInput',
                              presentValue=1,
                              eventState='normal',
                              outOfService=False,
                              numberOfStates=3)
    ]

    objects = analog_output_objets + analog_input_objects + analog_value_objects + binary_input_objects + binary_output_objects + multistate_input_objects

    return SimulateAndQueryDeviceApplication.run_application(
        objectIdentifier=651000,
        objectName="CDR_001",
        objectType=8,
        systemStatus='operational',
        vendorName='SyxthSense',
        vendorIdentifier=651,
        modelName='CDR',
        protocolVersion=1,
        protocolRevision=10,
        maxapdulength=480,
        segmentationSupported="noSegmentation",
        apduTimeout=3000,
        numberOfApduRetries=3,
        maxMaster=127,
        maxInfoFrames=1,
        databaseRevision=0,
        objects=objects)
예제 #7
0
def run_application() -> str:
    '''
    Simulate and query the device.
    :return: Object query result.
    '''
    from bacpypes.object import AnalogInputObject, AnalogOutputObject, AnalogValueObject, BinaryInputObject, BinaryOutputObject, MultiStateInputObject
    from bacnet.local_device_applications import SimulateAndQueryDeviceApplication
    import bacpypes.basetypes

    analog_input_objects = [
        AnalogInputObject(objectName='Built-In Temperature Sensor',
                          objectIdentifier=('analogInput', 1),
                          objectType='analogInput',
                          presentValue=21,
                          eventState='normal',
                          outOfService=False,
                          units='degreesCelsius'),
        AnalogInputObject(objectName='External Temperature Sensor',
                          objectIdentifier=('analogInput', 2),
                          objectType='analogInput',
                          presentValue=87,
                          eventState='normal',
                          outOfService=False,
                          units='degreesCelsius'),
        AnalogInputObject(objectName='Calculated Setpoint',
                          objectIdentifier=('analogInput', 3),
                          objectType='analogInput',
                          presentValue=87,
                          eventState='normal',
                          outOfService=False,
                          units='degreesCelsius')
    ]

    analog_output_objets = [
        AnalogOutputObject(objectIdentifier=('analogOutput', 1),
                           objectName='Y1',
                           objectType='analogOutput',
                           presentValue=12,
                           eventState='normal',
                           outOfService=False,
                           units='percent'),
        AnalogOutputObject(objectIdentifier=('analogOutput', 2),
                           objectName='Y2',
                           objectType='analogOutput',
                           presentValue=88,
                           eventState='normal',
                           outOfService=False,
                           units='percent'),
        AnalogOutputObject(objectIdentifier=('analogOutput', 3),
                           objectName='Y3',
                           objectType='analogOutput',
                           presentValue=62,
                           eventState='normal',
                           outOfService=False,
                           units='percent'),
        AnalogOutputObject(objectIdentifier=('analogOutput', 4),
                           objectName='Thermic1_Position',
                           objectType='analogOutput',
                           presentValue=10,
                           eventState='normal',
                           outOfService=False,
                           units='percent'),
        AnalogOutputObject(objectIdentifier=('analogOutput', 5),
                           objectName='Thermic2_Position',
                           objectType='analogOutput',
                           presentValue=97,
                           eventState='normal',
                           outOfService=False,
                           units='percent'),
        AnalogOutputObject(objectIdentifier=('analogOutput', 6),
                           objectName='ThreePoint_Position',
                           objectType='analogOutput',
                           presentValue=62,
                           eventState='normal',
                           outOfService=False,
                           units='percent')
    ]

    analog_value_objects = [
        AnalogValueObject(objectIdentifier=('analogValue', 0),
                          objectName='Temperature Setpoint',
                          objectType='analogValue',
                          presentValue=18,
                          eventState='normal',
                          outOfService=False,
                          units='degreesCelsius',
                          relinquishDefault=20),
        AnalogValueObject(objectIdentifier=('analogValue', 1),
                          objectName='LCD Brightness',
                          objectType='analogValue',
                          presentValue=3.5,
                          eventState='normal',
                          outOfService=False,
                          units='percent',
                          relinquishDefault=50)
    ]

    binary_input_objects = [
        BinaryInputObject(objectIdentifier=('binaryInput', 0),
                          objectName='DI1',
                          objectType='binaryInput',
                          presentValue=0,
                          eventState='normal',
                          outOfService=False,
                          polarity='normal',
                          activeText='on',
                          inactiveText='off')
    ]

    binary_output_objects = [
        BinaryOutputObject(objectIdentifier=('binaryOutput', 0),
                           objectName='DO1',
                           objectType='binaryOutput',
                           presentValue=0,
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off'),
        BinaryOutputObject(objectIdentifier=('binaryOutput', 1),
                           objectName='DO2',
                           objectType='binaryOutput',
                           presentValue=0,
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off'),
        BinaryOutputObject(objectIdentifier=('binaryOutput', 2),
                           objectName='Night_Mode_Override',
                           objectType='binaryOutput',
                           presentValue=0,
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off'),
        BinaryOutputObject(objectIdentifier=('binaryOutput', 3),
                           objectName='Summer_Winter_Changeover',
                           objectType='binaryOutput',
                           presentValue=0,
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off'),
        BinaryOutputObject(objectIdentifier=('binaryOutput', 4),
                           objectName='Cooling_Disable',
                           objectType='binaryOutput',
                           presentValue=0,
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off')
    ]

    objects = analog_output_objets + analog_input_objects + analog_value_objects + binary_input_objects + binary_output_objects

    return SimulateAndQueryDeviceApplication.run_application(
        objectIdentifier=651000,
        objectName="SRC100_001",
        objectType='device',
        systemStatus='operational',
        vendorName='SyxthSense',
        vendorIdentifier=651,
        modelName='URD',
        protocolVersion=1,
        protocolRevision=10,
        maxapdulength=480,
        segmentationSupported="noSegmentation",
        apduTimeout=3000,
        numberOfApduRetries=3,
        maxMaster=127,
        maxInfoFrames=1,
        databaseRevision=0,
        objects=objects)
예제 #8
0
def run_application() -> str:
    '''
    Simulate and query the device.
    :return: Object query result.
    '''
    from bacpypes.object import AnalogInputObject, AnalogOutputObject, AnalogValueObject, BinaryValueObject, BinaryInputObject, BinaryOutputObject, MultiStateInputObject
    from bacnet.local_device_applications import SimulateAndQueryDeviceApplication
    from random import randint

    analog_input_objects = [
        AnalogInputObject(objectIdentifier=('analogInput', 0),
                          objectName='Sensor_Temperature',
                          objectType='analogInput',
                          presentValue=randint(0, 150),
                          eventState='normal',
                          outOfService=False,
                          units='degreesCelsius'),
        AnalogInputObject(objectIdentifier=('analogInput', 1),
                          objectName='Setpoint_Adjust',
                          objectType='analogInput',
                          presentValue=randint(0, 150),
                          eventState='normal',
                          outOfService=False,
                          units='degreesCelsius'),
        AnalogInputObject(objectIdentifier=('analogInput', 2),
                          objectName='Sensor_Humidity',
                          objectType='analogInput',
                          presentValue=randint(0, 100),
                          eventState='normal',
                          outOfService=False,
                          units='percent'),
        AnalogInputObject(objectIdentifier=('analogInput', 3),
                          objectName='RI1',
                          objectType='analogInput',
                          presentValue=randint(0, 50000),
                          eventState='normal',
                          outOfService=False,
                          units='ohms'),
        AnalogInputObject(objectIdentifier=('analogInput', 4),
                          objectName='User_Fan_Speed',
                          objectType='analogInput',
                          presentValue=randint(0, 100),
                          eventState='normal',
                          outOfService=False,
                          units='noUnits')
    ]

    analog_output_objects = [
        AnalogOutputObject(objectIdentifier=('analogOutput', 0),
                           objectName='Y1',
                           objectType='analogOutput',
                           presentValue=randint(0, 100),
                           eventState='normal',
                           outOfService=False,
                           units='percent')
    ]

    analog_value_objects = [
        AnalogValueObject(
            objectIdentifier=('analogValue', 0),
            objectName='Setpoint_Temperature',
            objectType='analogValue',
            presentValue=randint(0, 100),
            eventState='normal',
            outOfService=False,
            units='degreesCelsius',
        ),
        AnalogValueObject(
            objectIdentifier=('analogValue', 1),
            objectName='Fan_Speed',
            objectType='analogValue',
            presentValue=randint(0, 10),
            eventState='normal',
            outOfService=False,
            units='noUnits',
        ),
        AnalogValueObject(
            objectIdentifier=('analogValue', 2),
            objectName='Alarm_Code',
            objectType='analogValue',
            presentValue=randint(0, 100),
            eventState='normal',
            outOfService=False,
            units='noUnits',
        )
    ]

    binary_input_objects = [
        BinaryInputObject(objectIdentifier=('binaryInput', 0),
                          objectName='DI1',
                          objectType='binaryInput',
                          presentValue=randint(0, 1),
                          eventState='normal',
                          outOfService=False,
                          polarity='normal',
                          activeText='on',
                          inactiveText='off'),
        BinaryInputObject(objectIdentifier=('binaryInput', 1),
                          objectName='Operating_Mode',
                          objectType='binaryInput',
                          presentValue=randint(0, 1),
                          eventState='normal',
                          outOfService=False,
                          polarity='normal',
                          activeText='on',
                          inactiveText='off')
    ]

    binary_output_ojects = [
        BinaryOutputObject(objectIdentifier=('binaryOutput', 0),
                           objectName='DO1',
                           objectType='binaryOutput',
                           presentValue=randint(0, 1),
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off'),
        BinaryOutputObject(objectIdentifier=('binaryOutput', 1),
                           objectName='DO2',
                           objectType='binaryOutput',
                           presentValue=randint(0, 1),
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off'),
        BinaryOutputObject(objectIdentifier=('binaryOutput', 2),
                           objectName='Heating Symbol',
                           objectType='binaryOutput',
                           presentValue=randint(0, 1),
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off'),
        BinaryOutputObject(objectIdentifier=('binaryOutput', 3),
                           objectName='Cooling Symbol',
                           objectType='binaryOutput',
                           presentValue=randint(0, 1),
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off'),
        BinaryOutputObject(objectIdentifier=('binaryOutput', 4),
                           objectName='Open Arrow Symbol',
                           objectType='binaryOutput',
                           presentValue=randint(0, 1),
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off'),
        BinaryOutputObject(objectIdentifier=('binaryOutput', 5),
                           objectName='Close Arrow Symbol',
                           objectType='binaryOutput',
                           presentValue=randint(0, 1),
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off'),
        BinaryOutputObject(objectIdentifier=('binaryOutput', 6),
                           objectName='Day/Night Model',
                           objectType='binaryOutput',
                           presentValue=randint(0, 1),
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off'),
        BinaryOutputObject(objectIdentifier=('binaryOutput', 7),
                           objectName='SPA Reset',
                           objectType='binaryOutput',
                           presentValue=randint(0, 1),
                           eventState='normal',
                           outOfService=False,
                           polarity='normal',
                           relinquishDefault=0,
                           activeText='on',
                           inactiveText='off')
    ]

    objects = analog_input_objects + analog_output_objects + analog_value_objects + binary_input_objects + binary_output_ojects

    return SimulateAndQueryDeviceApplication.run_application(
        objectIdentifier=651000,
        objectName="RIU_001",
        objectType=8,
        systemStatus='operational',
        vendorName='SyxthSense',
        vendorIdentifier=651,
        modelName='RI',
        protocolVersion=1,
        protocolRevision=10,
        maxapdulength=480,
        segmentationSupported="noSegmentation",
        apduTimeout=3000,
        numberOfApduRetries=3,
        maxMaster=127,
        maxInfoFrames=1,
        objects=objects)