Variable status bits
The Workbench Studio enables you to associate status bits to declared variables. Each variable may have, in addition to its real time value:
- 64 status bits
- a date and time stamp
Status bits and time stamps are generally set by input drivers taking care of hardware inputs, but may also be transported together with the value of the variable on some network protocols. In addition, the IEC 61131-3 programs may access to the status bits of variables.
|
|
|
Enabling status bits
In order to enable the management of status bits and time/date stamps by the Runtime Service, you must check the following option in the list of compiler options from the Project Settings wizard:
Allocate status flags for variables with embedded properties
Only variables having some properties defined (either a profile attached or embedded symbol) will get status bits. Status bits are available only for global scope variables (global, retain, IOs...) with a single data type (cannot be array or structure).
Reading and writing status from programs
The following function blocks are available for managing status information in the programs:
Parameter |
Description |
VSIGETBIT, SymbVSIGetBit |
get a status bit of a variable |
VSIGETDATE, SymbVSIGetDate |
get the date stamp of a variable |
VSIGETTIME, SymbVSIGetTime |
get the time stamp of a variable |
VSISETBIT, SymbVSISetBit |
set a status bit of a variable |
VSISETDATE, SymbVSISetDate |
set the date stamp of a variable |
VSISETTIME, SymbVSISetTime |
set the time stamp of a variable |
update the stamp of a variable according to the current time |
|
copys the value, the status bits and the stamp of a variable to another variable Hint: The compiler refuses, if you try to call the function for 2 variables with a different data type. Source and target variable must be of the same data type. |
Hint: Function blocks having more than one input @Any must be called using for alle these inputs the same data type.
Below is the syntax of the functions:
bBit := vsiGetBit ( variable, bitID );
iDate := vsiGetDate ( variable );
iTime := vsiGetTime ( variable );
bOK := vsiSetBit ( variable, bitID, bBit );
bOK := vsiSetDate ( variable, iDate );
bOK := vsiSetTime ( variable, iTime );
bOK := vsiStamp ( variable );
bBit := SymbVSIGetBit ( variableName, bitID );
iDate := SymbVSIGetDate ( variableName );
iTime := SymbVSIGetTime ( variableName );
bOK := SymbVSISetBit ( variableName, bitID, bBit );
bOK := SymbVSISetDate ( variableName, iDate );
bOK := SymbVSISetTime ( variableName, iTime );
The functions use the following arguments:
Argument |
Data type |
Description |
variable |
|
Variable having embedded profile or symbol. |
variableName |
STRING |
Name of variable having embedded profile or symbol. |
bitID |
DINT |
ID of a status bit (see list of IDs in the section below). |
bBit |
BOOL |
Value of the status bit. |
iDate |
DINT |
Date stamp according to real time clock functions conventions Hint: on Windows - days since 1 January 1970. |
iTime |
DINT |
Time stamp according to real time clock functions conventions. Hint: on Windows - milliseconds since midnight. |
bOK |
BOOL |
TRUE if successful. |
See the description of real time clock functions for further information about time and date stamps.
Drivers supporting status bits
Below are Runtime Service drivers taking care of status bits and date/time stamping:
Driver |
Description |
Variable binding (ETHERNET) |
Binding (spontaneous protocol) is used for real time exchange of variable values among Runtime Service over ETHERNET. The protocol takes care of carrying status bits. The protocol updates the date and time stamps of variables updated by the network. |
MODBUS Master |
The MODBUS master protocols (RTU / TCP / UDP) takes care of updating the date and time stamp of all variables updated by the network. The MODBUS stack also sets the _VSB_I_BIT status bits of received variables according to the exchange error status. |
MODBUS Slave |
The MODBUS slave protocols (RTU / TCP / UDP) takes care of updating the date and time stamp of all variables updated by the network. |
DNP3 Master |
The DNP3 protocol handles the time stamps and the following status bits: _VSB_SPONT, _VSB_I_BIT, _VSB_ST_M1, _VSB_ST_M3, _VSB_ST_M2, _VSB_OV_BIT, _VSB_SP_BIT |
DNP3 Slave |
The DNP3 protocol handles the time stamps and the following status bits: _VSB_SPONT, _VSB_I_BIT, _VSB_ST_M1, _VSB_ST_M3, _VSB_ST_M2, _VSB_OV_BIT, _VSB_SP_BIT |
IEC 60870 Slave |
The IEC 60870-5-101 and IEC 60870-5-104 slave protocols driver sends the _VSB_I_BIT, _VSB_OV_BIT, _VSB_BL_BIT, _VSB_SP_BIT, _VSB_NT_BIT and _VSB_T_INVAL in the ASDUs (telegrams) in monitoring direction. Driver supports Set functions for date/time stamps. |
IEC 60870 Master |
Driver supports Get functions for status bits of received data. Hint: typically relevant are _VSB_I_BIT, _VSB_OV_BIT, _VSB_BL_BIT, _VSB_SP_BIT ,_VSB_NT_BIT, _VSB_T_BIT and _VSB_T_INVAL. Driver supports Get functions for date/time stamps. |
IEC 61850 Server |
VSI functions are not supported by the IEC 61850 Server driver. The driver supports realtime stamping and data quality by meaning of IEC 61850 protocol. Hint: to set by program the status (quality) and time stamp you can use value of additional variables referring data attributes q and t. |
IEC 61850 Client |
Driver supports Get functions for status bits of received data. Hint: typically relevant are _VSB_I_BIT, _VSB_OV_BIT, _VSB_BL_BIT, _VSB_SP_BIT ,_VSB_NT_BIT, _VSB_T_BIT and _VSB_T_INVAL. Driver supports Get functions for date/time stamps. Hint: alternatively you can evaluate the status (quality) and time stamp received as value in additional variables referring data attributes q and t. |
Runtime Service to Service Engine connection |
The Runtime Service to Service Engine connection can read (Get) all 64 status bits. Driver supports Get functions for date/time stamps. |
Symbol representing variable in programmed simulation |
With the programmed simulation of a fieldbus driver the following status bits can be set: _VSB_ST_M1 until _VSB_ST_M8, _VSB_REV, _VSB_MVALUE, _VSB_ST_14 until _VSB_ST_16, _VSB_GR, _VSB_I_BIT, _VSB_NSORT, _VSB_DM_TR, _VSB_RM_TR, _VSB_INFO, _VSB_ACTUAL, _VSB_RES31, _VSB_TCB1 until _VSB_TCB5, _VSB_PN_BIT, _VSB_T_BIT, _VSB_BL_BIT, _VSB_SP_BIT, _VSB_NT_BIT, _VSB_OV_BIT, _VSB_SE_BIT, CB_TRIP, CB_TR_I and the status bits with the numers 52 and 55 until 63.
|
STRATON profile |
For zenon STRATONNG driver: The profile supports Set functions for date/time stamps. With the straton NG driver the following status bits can be set: _VSB_I_BIT, _VSB_TCB0, _VSB_TCB1, _VSB_TCB2, _VSB_TCB3, _VSB_TCB4, _VSB_TCB5, _VSB_PN_BIT, _VSB_T_BIT, _VSB_WR_SUC, _VSB_NORM, _VSB_ABNORM, _VSB_BL_BIT, _VSB_SP_BIT, _VSB_NT_BIT, _VSB_OV_BIT, _VSB_SE_BIT, CB_TRIP, CB_TR_I and the status bits with the numbers 52 and 54 until 63. |
Other topics in this chapter |
Variable status bits |
IEC 61131-3 Automation platform > Programming - Reference guide > Variable status bits |
Created with the Personal Edition of HelpNDoc: Experience the Power and Ease of Use of HelpNDoc for CHM Help File Generation