Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
Column
width7

Implementation

Column
width93
Code Block
themeConfluence
// Numeric simulation
IF xSwitch then
    lrValue := lrValue + 0.01;
    IF lrValue >= 5.0 THEN
        xSwitch := False;
    END_IF
ELSE
    lrValue := lrValue - 0.01;
    IF lrValue <= -5.0 THEN
        xSwitch := True;
    END_IF
END_IF


BACnet_Analog_Value.PresentValue := lrValue;

...

Requirements for the BACnet client (As of BACnet-Version 1.2.0.0)

  • Create a "Standard project" and select "CODESYS Control Win V3" as the device.
  • Define the target system by means of the network scan (see BACnet server).
  • Insert a "BACnet Server" object and rename it to "BACnet_Client"

    Image Added


  • Adapt the "PLC_PRG" POU as follows:



    Section
    Column
    width7

    Declaration

    Column
    width93

    VAR

    fbReadProperty : BACnet.BACnetClientReadProperty;
    xReadExecute : BOOL;
    lrReadValue : LREAL;
    xInitDone : BOOL := FALSE;
    END_VAR




    Section
    Column
    width7

    Declaration

    Column
    width93
    Code Block
    themeConfluence
    VAR
    	fbReadProperty	: BACnet.BACnetClientReadProperty;
    	xReadExecute	: BOOL;
        lrReadValue		: LREAL;
    	
    	xInitDone 		: BOOL := FALSE;
    END_VAR




    Section
    Column
    width7

    Implementation

    Column
    width93
    Code Block
    themeConfluence
    IF NOT xInitDone THEN
    	fbReadProperty.RegisterToServer(BACnet_Client);
    	fbReadProperty(dwTargetDeviceNumber := 718,
        				objType := BACnet.CmpBACnet.IEC_BACNET_OBJECT_TYPE.OBJ_ANALOG_VALUE, objInst := 1,
        				propID := BACnet.CmpBACnet.IEC_BACNET_PROPERTY_ID.PROP_PRESENT_VALUE);
    	xInitDone := TRUE;
    ELSE
    	fbReadProperty(xExecute := xReadExecute);
    	IF fbReadProperty.xDone THEN
    		xReadExecute := FALSE;
    		lrReadValue := BACnet.GetRealFromContents(fbReadProperty.result);
    	END_IF
    END_IF





Requirements for the BACnet client (Up to BACnet-Version 1.2.0.0)

...