The TagForceValueFB Function Block forces the value of a Data Point Tag to a fixed constant value.
The function block forces the value by sending an ForceValue Tag Command to the tag. The function block provides status information to:
Note: The forced tag value is only applied in the Fernhill SCADA Tag Database. After forcing the actual value is still read from the data source, but is placed in a set-aside area. If you want to write a value to a data source consider using the TagWriteValue Function Block.
The TagForceValueFB Function Block is intended for use with:
Use the TagRemoveForce Function Block to undo the action of the TagForceValue Function Block.
The TagForceValueFB Function Block is intended for use in a Program Tag that runs on the Fernhill SCADA Server. A Program Tag uses a continuous execution model, where the program code runs at a fixed interval. A program uses the function block to sample the state of the tag command as it executes.
If you want to force the value of a tag from an Operator Action, use the TagForceValueFB Function.
The TagForceValueFB Function Block has this syntax:
TagForceValueFB( REQ:=Expression, TAGNAME:=Expression, VALUE:=Expression, BUSY=>Variable-Reference, DONE=>Variable-Reference, ERROR=>Variable-Reference, ERRORMSG=>Variable-Reference );
Note: All parameters are optional.
The TagForceValueFB Function Block has these parameters:
Parameter | Type | Direction | Description |
---|---|---|---|
REQ | BOOL R_EDGE | Input | A rising edge starts the ForceValue Tag Command. |
TAGNAME | STRING | Input | The name of the tag to send the ForceValue Tag Command to. This can be an absolute tag name, or a relative tag name. Relative tag names are resolved relative to the full name of the host program. |
VALUE | ANY | Input | The fixed value to apply to the tag. |
BUSY | BOOL | Output | Set to TRUE while the ForceValue Tag Command is in progress. |
DONE | BOOL | Output | Set to TRUE for 1 execution after the ForceValue Tag Command has completed. |
ERROR | BOOL | Output | Set to TRUE if the ForceValue Tag Command failed. |
ERRORMSG | WSTRING | Output | If ERROR is TRUE, the reason why the ForceValue Tag Command failed. |
Once the ForceValue Tag Command begins, additional requests from the input signal REQ are ignored until the tag command completes.
These timing diagrams show the relationship of the REQ, BUSY, DONE, and ERROR signals processing two requests. The first request completes with an error, the second request completes normally:
+--------+ +-+ +------+ REQ | | | | | | --+ +-----+ +-+ +------ +------+ +------+ BUSY | | | | --+ +-------+ +---------- ++ ++ DONE || || ---------++-------------++--------- +-------+ ERROR | | ---------+ +-----------------
The BUSY signal is TRUE while the tag command is in progress. The DONE signal is TRUE for 1 execution after the completion of the tag command.
The following IEC 61131-3 Program shows:
Program MAIN VAR (* The function block declaration *) ForceFB : TagForceValueFB; (* The tag used to trigger the tag force Note: Uses a relative tag reference to 'Digital Trigger Tag' located in the same folder as this program *) TriggerTag AT %".Digital Trigger Tag" : BOOL; END_VAR (* Call the TagForceValueFB function block *) ForceFB( REQ:=TriggerTag, TAGNAME:="Tag to force the value to FALSE", VALUE:=FALSE ); (* The DONE output is active for one cycle when the function block completes *) IF ForceFB.DONE THEN (* Was there an error ? *) IF ForceFB.ERROR THEN (* Handle any error *) ELSE (* Any additional work on successful completion *) END_IF; END_IF; END_PROGRAM
To learn about the ForceValue Tag Command.
To learn about other tag command function blocks.
To learn about the different types of expression to use as function parameters.
To learn about the different types supported by Fernhill SCADA.
To learn about other IEC 61131-3 Common Elements.
For the meaning of terms used in Fernhill SCADA.