FB_BACnet_Program_EX

FB_BACnet_Program_EX 1:

Application

The function block FB_BACnet_Program_EX can be used for reading and write access to a BACnet object of type Program.

The function block FB_BACnet_Program contains the State Transitions described in the BACnet specification and maps them to the FB interface using the structures: stDoneFlags, stFailedFlags and stRequestFlags (see Transition diagram Fig. 1).

VAR_INPUT

bRelease            : BOOL;
bCommonError        : BOOL;
bWaitForSomething   : BOOL;
stDoneFlags         : ST_BACnet_ProgramHandshakeRequests;
stFailedFlags       : ST_BACnet_ProgramHandshakeRequests;
bModeUnloadComplex  : BOOL:=TRUE;

bRelease: Enables processing of requests. If bRelease = FALSE is set, the program waits in state HALTED.

bCommonError: Error during execution of a Program_Change requests from the structure stRequestFlags. Setting the input while a Program_Change requests is running leads to an abort condition (see Transition diagram Fig. 1).

bWaitForSomething: If the BACnet object is in state RUNNING, setting the input to TRUE switches to state WAITING, so that the BACnet object is blocked for further requests except Unload and Halt (see Transition diagram Fig. 1).
To return to state RUNNING set the input back to FALSE.

stDoneFlags: The flags within the input structure are used to acknowledge pending Program_Change requests from the output structure stRequestFlags. A signal change of one of the flags from FALSE to TRUE acknowledges execution of the corresponding Program_Change request.

stFailedFlags: The flags within the input structure are used to report cancellation of the pending Program_Change request from the output structure stRequestFlags. A signal change of one of the flags from FALSE to TRUE cancels execution of the corresponding Program_Change request.

bModeUnloadComplex: If the mode "Unload Complex" was activated via the input, the BACnet object status changes from UNLOADING to IDLE once the request Unload has been executed (see Transition diagram Fig. 1). If the input is set to FALSE, the BACnet object remains in state UNLOADING after the request Unload has been executed.

VAR_OUPUT

bReady              : BOOL;
bOverridden         : BOOL;
bOutOfService       : BOOL;
bFault              : BOOL;
bInAlarm            : BOOL;
bProcessError       : BOOL;
bCommFailure        : BOOL;
bOtherFault         : BOOL;
stRequestFlags      : ST_BACnet_ProgramHandshakeRequests;
stActiveStateFlags  : ST_BACnet_ProgramHandshakeStates;
tObjectID           : T_BACnet_ObjectIdentifier:=16#FFFFFFFF;
bError              : BOOL;
nErrorId            : UINT;

bReady: Notification of general readiness. If this output is set, the other status outputs are valid (PresentValue, Overridden ...). If the output is FALSE, the corresponding function block FB_BACnet_Device does not report "Operational", or the block instance was not linked correctly in the TwinCAT System Manager.

bOverridden, bOutOfService, bFault, bInAlarm: See BACnet specification DIN EN ISO 16484-5 for BACnet object Program and property Status_Flags.

bProcessError, bCommFailure, bOtherFault: See BACnet specification DIN EN ISO 16484-5 for BACnet object Program and property Reliability.

stRequestFlags: Contains the flags for the corresponding Program_Change requests. If a flag is set to TRUE, a change in status of the program object is requested by the PLC program. If the change was successful, this is acknowledged with a signal change from FALSE to TRUE of the corresponding flags in the input structure stDoneFlags. If the corresponding PLC program is unable to execute the request or if the process is aborted, this must be reported via the corresponding flag in the input structure stFailedFlags. The termination is then shown in the status of the BACnet object.

stActiveStateFlags: Contains flags that reflect the current state of the BACnet program object (see Transition diagram Fig. 1).

tObjectID: Object ID of the BACnet object (object type and object instance).

bError: An error is pending.

nErrorId: see global constants BACnet_Globals.

VAR_IN_OUT

Device          : FB_BACnet_Device;

Device: Specification of the instance of the local corresponding BACnet server block. For each BACnet adapter one BACnet server is possible. See FB_BACnet_Adapter and FB_BACnet_Device for further information.

 

Transition diagram

FB_BACnet_Program_EX 2:
Fig. 1: from BACnet specification DIN EN ISO 16484-5 for BACnet object Program, Fig. 12-3 "State Transitions for the program object"