Use of ReadPropertyMultiple

If several properties are to be read from a connected BACnet device, it is recommended to use the service ReadPropertyMultiple (RPM). In contrast to the use of the ReadProperty service, which can only read individual properties, ReadPropertyMultiple combines several queries into one telegram and therefore works considerably more efficiently.

The following example shows the use of RPM. However, it requires that connected devices support this service. The three read commands shown in this example are combined into a single RPM.

Variables

    {attribute 'TcLinkTo' := '.BACnet_AmsNetId := TIID^Device 1 (BACnet MSTP)^Inputs^AmsNetId'}
    fbMstpDevice_1 : FB_BACnet_Adapter;

    fbClient : FB_BACnet_Client := (Adapter := fbMstpDevice_1,nDeviceInstance := 116005, tReadCycleTime:=T#10S, nMaxParallelRequests:=20);
    fbDevice : FB_BACnetRM_Device := (Client:=fbClient);

    fbTon : TON;

    fbReadEx1 : FB_BACnetRM_ReadPropertyEx := (Client := fbClient);
    fbReadEx2 : FB_BACnetRM_ReadPropertyEx := (Client := fbClient);
    fbReadEx3 : FB_BACnetRM_ReadPropertyEx := (Client := fbClient);

    bRead : BOOL;

    fPVSupplyTemp : REAL;
    fPVReturnTemp : REAL;
    fDesignFlow : REAL;

Code

fbMstpDevice_1();
fbClient();
fbDevice();

fbTon( IN:= NOT fbTon.Q, PT:= T#5S );
IF fbTon.Q THEN
    bRead := TRUE;
END_IF

fbReadEx1.bExecute := bRead;
fbReadEx2.bExecute := bRead;
fbReadEx3.bExecute := bRead;

IF bRead THEN
    bRead := FALSE;

    fbReadEx1.pData:= ADR( fPVSupplyTemp );
    fbReadEx1.nData:= SIZEOF( fPVSupplyTemp );
    fbReadEx1.ePropID:= E_BACnet_PropertyIdentifier.PropPresentValue;
    fbReadEx1.nObjInst:= 1;
    fbReadEx1.eObjType:= E_BACnet_ObjectType.ObjAnalogInput;

    fbReadEx2.pData:= ADR( fPVReturnTemp );
    fbReadEx2.nData:= SIZEOF( fPVReturnTemp );
    fbReadEx2.ePropID:= E_BACnet_PropertyIdentifier.PropPresentValue;
    fbReadEx2.nObjInst:= 2;
    fbReadEx2.eObjType:= E_BACnet_ObjectType.ObjAnalogInput;

    fbReadEx3.pData:= ADR( fDesignFlow );
    fbReadEx3.nData:= SIZEOF( fDesignFlow );
    fbReadEx3.ePropID:= E_BACnet_PropertyIdentifier.PropPresentValue;
    fbReadEx3.nObjInst:= 0;
    fbReadEx3.eObjType:= E_BACnet_ObjectType.ObjAnalogValue;
END_IF

fbReadEx1();
fbReadEx2();
fbReadEx3();