State Based Actions block

The State Based Actions block allows for the creation of two or more user defined states, each with an accompanying state script to execute when the state becomes active.

Return to Overview of blocks

State Based Actions block

Description

The State Based Actions block allows the user to create various states, and setup conditions using the internal scripting language to determine when these states must become active.  

Each user-defined state has an associated condition that the user must specify using the internal scripting language.  When the condition evaluates to true, the state is deemed to be active.

On every execution of the block, each state condition is evaluated to determine which state is the currently active state.  When a new state becomes active, it replaces the previously active state.  The newly active state’s associated state script is executed based on the user defined repeat and delay parameters.  Only one state can be active on any given execution of the block.  Should more than one state become active on any execution of the block, the state with the highest priority becomes the currently active state.

Should no state be active on any given execution, the default state becomes the active state.  The default state is an internal state with a fixed condition that always evaluates to true.  The user can modify the repeat and delay parameters for the default state, as well as the script to execute should the default state become active.  The default state will always have the lowest priority.    

State scripts have full access to all input and output fields and can manipulate these fields in the same manner as the scripting block. See the Scripting block for further information regarding the manipulation of fields using the internal scripting language.

Return to top

diagram showing the STATE-BASED ACTIONs block

Block Type

Rules & Models block

Input port

The input port can accept any number and any type of field(s).

Output port

The State Based Actions block contains the following three output ports:

Outputs

The number and type of output fields in this port are determined by the configuration.  If a field contains the same name as a field in the input port, it’s value, timestamp and quality is the same as the field in the input port on every execute, unless a script modifies the values.

Indicators

This port contains an integer output field for every state defined.  Each field name corresponds to a user-defined state name and the corresponding field value is either 1 (for a currently active state) or 0 (for an inactive state).  The default state will also appear in the port.  

Active Duration

The active duration port contains three fixed output fields.

  • The first of these is a string field named State_Name containing the name of the currently active state.

  • The second output field is an integer field named State_Id, and contains the state id for the currently active state.

  • The third field is an integer output field named Active_Seconds, indicating the duration in seconds that the currently active state has been active.

    Note : If no user defined state is active, these fields contain the active properties of the default state.

Return to top

Functions performed on tags

  • The value of a field stays unmodified if the script does not assign a value to it. In the first execution the output value is 0.

  • The time stamp of a field stays unmodified if the script does not assign a value to it. In the first execution the time stamp is a value that is before any other time stamp.

  • The quality of a field stays unmodified if the script does not assign a value to it. In the first execution the quality is bad.

See the Scripting block for further information on how fields and field properties are manipulated through the internal scripting language.

Return to top

Terminology

  • Script - See the help documentation for the Scripting block

  • State - A state is a user-defined condition that evaluates to either true or false.  A state has a name, a priority and several properties including a script to execute when the condition evaluates to true.  Other properties include repeat and delay parameters for the execution of the script.

  • Condition - A condition is a user-defined script that evaluates to true of false.  See the help documentation for Conditional Statements on how to write a conditional statement using the internal scripting language.

Return to top


Related topics:

  

CSense 2023- Last updated: June 24,2025