Automata & Timer Blocks
Blocks driven by discrete logic rather than differential equations: automata that switch on signal conditions, and timers that fire after a delay.
Finite State Automaton.
This block forces a set of algebraic equations. There are possible sets, each corresponding to a value of the discrete state . Transitions between sets occur when Boolean expressions evaluate to true.
Syntax
The block is specified via an inline example. For states and algebraic constraints per state:
& fsainitial_state# 1algebraic constraint No. 1algebraic constraint No. 2-> 2boolean expression C1# 2algebraic constraint No. 3algebraic constraint No. 4-> 1boolean expression C2-> 3boolean expression C3-> 3boolean expression C4# 3algebraic constraint No. 5algebraic constraint No. 6-> 1boolean expression C5##Internal states: none
Discrete variable: . The index of the currently active state
Syntax rules
| Token | Meaning |
|---|---|
# N | Begins the section for state . States must be numbered consecutively from 1 to in increasing order. |
## | Marks the end of the state list. |
-> N | Declares a transition to state . The following line is the Boolean expression that triggers the transition. |
| Second line | Integer specifying the initial state of the automaton. |
Notes
- The number of algebraic constraints must be identical across all states.
- Multiple transitions from the same state to the same target state are permitted (e.g., two separate conditions C3 and C4 both targeting state 3 in the example). Alternatively a single transition with the combined condition
C3 or C4may be used. - Transitions and algebraic constraints may involve any model states and parameters.
Two-state automaton with transitions based on signs of two inputs.
The output state can take two values: or . When , a positive triggers the transition to ; when , a positive triggers the return to .
Syntax
& 2saname of variable x_1 (trigger for transition to v_2)name of variable x_2 (trigger for transition to v_1)name of variable x_k (output)data/parameter/expression for v_1data/parameter/expression for v_2Internal States
None.
Discrete Variables
represents the automaton state.
Equations
Discrete Transitions
if z = 1 and x_1 > 0: z ← 2else if z = 2 and x_2 > 0: z ← 1Initialization
Timer with varying delay. The delay is a piecewise linear function of the monitored variable. Separate blocks exist for and characteristic points, named timer1 to timer5 and timer11.
If is smaller than a threshold , the output is zero. Otherwise, changes from zero to one at time , where is the time at which first exceeded and is a piecewise linear function of defined by the pairs.
Syntax
& timer1name of variable x_iname of variable x_jdata/parameter/expression for v_1data/parameter/expression for T_1For timer2 to timer5, append additional pairs up to the required . timer11 takes 11 pairs (22 parameters).
Internal States
(elapsed time counter)
Discrete Variables
Equations
Discrete Transitions
if z = -1: if x_i >= v_1: z ← 0else (z = 0 or 1): if x_i < v_1: z ← -1
if z = 0: if x_1 >= τ(x_i): z ← 1Initialization
Notes
- The values must be non-decreasing: .
- Typical use: approximating an inverse-time characteristic with .
- Non-decreasing values are also allowed (i.e., is permitted).
- If at , will trip to one after unless drops below first.
timersc
Section titled “timersc”Timer with varying delay. The delay is a staircase function of the monitored variable. Separate blocks exist for and characteristic points.
Identical behaviour to timer except that the delay function is a staircase (step) function instead of a piecewise linear interpolation.
Syntax
& timersc1name of variable x_iname of variable x_jdata/parameter/expression for v_1data/parameter/expression for T_1For timersc2–timersc6, append additional pairs up to the required .
Internal States
(elapsed time counter)
Discrete Variables
Equations
Discrete Transitions
if z = -1: if x_i >= v_1: z ← 0else (z = 0 or 1): if x_i < v_1: z ← -1
if z = 0: if x_1 >= τ(x_i): z ← 1Initialization
Notes
- The values must be non-decreasing: .
- The staircase characteristic is typically used to approximate an inverse-time protection curve.
- Non-decreasing values are also allowed.
- If at , trips to one after unless drops below first.
See Also
Section titled “See Also”- Block Index, all CODEGEN blocks by category
- CODEGEN Model Examples, complete models built from these blocks
- User-Defined Models, the DSL file format