Temporal logic operators
Temporal logic operators are mechanisms that specify the moment when a finite automaton must execute certain Julia language operators and are set at transitions before/inside conditions and in states:

Where they are used |
Example |
On transitions, inside conditions, as well as inside actions specified in square brackets |
|
Inside states together with a group of operators on or inside the Julia code |
|
For example, using temporal logic operators and a group of operators on you can change the values of variables over time:

Here:
-
en, du: y = x— when entering state A and while it is active, the variableythe value is assignedx. This action is performed immediately and repeated while the state is active. -
on after(2.5, sec): y = 0— if state A is active2.5or more seconds, thenybecomes equal0. -
on after(5, sec): y = -1— if state A is active5or more seconds, thenybecomes equal-1.
The following temporal logic operators are available in Engee:
-
after— it is triggered after a set number of actions or time. For example,after(5, sec)activates the transition through5seconds after the start of the current state; -
at— it is triggered at a specific step. For example,at(10, tick)it will be true in the step when the associated state has a group of operatorsduringit will be performed for the tenth time (starting counting from one); -
before— remains true until a certain point in time or the number of clock cycles of the state machine is reached. For example,before(3, sec)It works until it has passed3seconds from the moment of activation of the associated state; -
count— counts the number of times the status block has been executed since the boolean expression in the parameter became true. For example, the commandon at(10, tick): y = count(true)assigns a variableymeaning10if the state is active during10steps of the state machine.; -
durationis an analog of the operatorcount, but instead of the number of steps, it returns the time during which the specified boolean expression remains true. For example, the commandon after(10, sec): y = duration(true, sec)will assign to a variableyvalues that are getting bigger10if the state remains active after10seconds after activation; -
elapsed, et— returns the time elapsed since entering the current state. For example,et >= 2will be true if the state has been active for two or more seconds.; -
every— is triggered after a set number of steps of the state machine, while the associated state remains active. For example, if the associated state is active10steps, thenon every(3, tick): y += 1increments the variable three times consecutivelyyper unit. -
t, getSimulationTime— returns the current simulation time. For example,t >= 10it will be true if the simulation time has reached10seconds; -
temporalCountis a counter that helps you keep track of how many steps the state machine has completed or how much time has passed while the state remained active. For example, the challengetemporalCount(tick)shows how many steps the state machine has been in this state. And the use oftemporalCount(sec)returns how many seconds have passed since this state was activated.
after
after is an operator that implements temporal logic on transitions. It has two call options:
| Syntax | Description | Example |
|---|---|---|
|
Returns |
Exit from the current state when the block has been activated at least three times since the state became active, provided that |
|
Returns |
For a better understanding of the examples given, consider:
If the value of the variable is |
at
at is an operator that checks whether an action has occurred at a certain point in time. It has the following syntax:
| Syntax | Description | Example |
|---|---|---|
|
Returns |
For a better understanding of the examples given, consider:
If, during the execution of the 4th clock cycle from the moment of activation of the associated state, the value of the variable |
before
before is an operator that checks whether the action occurred before the specified time. It has the following syntax:
| Syntax | Description | Example |
|---|---|---|
|
Returns |
The transition occurs if less than 3 seconds have passed since the activation of the state, provided that |
|
Returns |
For a better understanding of the examples given, consider:
The transition occurs if less time has passed. |
count
count is an operator that counts the number of executions of the associated status block from the moment when the passed boolean expression became true. The count operator has the following syntax:
| Syntax | Description | Example |
|---|---|---|
|
Returns the number of state machine clock cycles that have elapsed since the expression |
The transition occurs if the value of the variable |
duration
duration is an operator that checks how long a certain condition remains true. The duration operator has the following syntax:
| Syntax | Description | Example |
|---|---|---|
|
Returns the number of units of time that have passed since the moment when |
The transition occurs if more than |
elapsed, et
elapsed (et) is an operator that keeps track of how much time has passed since the state was activated. The elapsed operator has the following syntax:
| Syntax | Description | Example |
|---|---|---|
or
|
Returns the number of time units that have elapsed since the associated state became active. |
The transition occurs if 3 or more seconds have passed since the activation of the state. |
every
every is an operator that helps you perform actions with a specified frequency. It has the following syntax:
| Syntax | Description | Example |
|---|---|---|
|
Returns |
For a better understanding of the examples given, consider:
If every fourth clock cycle since the activation of the associated state, the value of the variable |
t, getSimulationTime
t (getSimulationTime) is an operator that keeps track of the current simulation time. It has the following syntax:
| Syntax | Description | Example |
|---|---|---|
or
|
Returns the time in seconds that has passed since the start of the simulation. |
The transition occurs if the current simulation time has reached 5 seconds or more. |
temporalCount
temporalCount is an operator that counts the number of clock cycles or the time elapsed since the activation of the associated state. The temporalCount operator has the following syntax:
| Syntax | Description | Example |
|---|---|---|
|
Returns the number of state machine clock cycles that have elapsed since the associated state was activated. |
|
|
Returns the number of specified time units that have elapsed since the associated state was activated. |
Returns the time elapsed since the associated state was activated, in milliseconds. |

