RTLE
EVALUATE(EXPRESSION)
EXPRESSION: A string that can be evaluated to a result. This expression can reference other tags' current or previous values and can return any type (string, number, boolean, null, etc.).
Examples:
EVALUATE('5 + 5')
will always return10
.EVALUATE('tag['5'] * 100')
will multiply the value of the tag with ID5
by100
.
How to Use EVALUATE
The Simulator can use the EVALUATE()
tag address to perform simple operations. This acts as a separate tag and helps to create reliable real-time logic expressions (RTLE) to transform raw data without changing PLC programming.
Key Points
Current Value: Use the
value
keyword to reference a tag's current value.Previous Value: Use the
lastvalue
keyword to reference a tag's previous value.
Evaluation Process
TilliT Edge first evaluates data tags not connected to a simulator, ensuring they are up-to-date.
Then, simulator tags are evaluated one by one.
Tags in the simulator cannot reference other simulator tags because of the evaluation order.
Examples
Current Value:
Using Previous Value:
We have a machine tag with ID 67
that represents the machine's state as an integer. The goal is to convert this integer tag into multiple boolean tags compatible with the EQUIPMENT_STATUS_ template*, which expects boolean values instead of integers.
1
Equipment Running
2
Equipment Faulted
3
Equipment Blocked
4
Equipment Stopped
5
Equipment Starved
Trigger Setup:
Set up triggers for events, such as when the machine is running (value = 1
).
Conversion Using RTLE: Use RTLE to create new tags that convert the integer machine state into boolean tags. This is done using a ternary operator to evaluate the integer state as a boolean value.
Extra Logic for Equipment Stopped: Add logic to treat both "machine fault" and "machine stopped" states as a "stopped" event.
Assigning Tags: Each boolean tag is linked to a trigger for
value > 0
, which activates the respective event type.
This approach allows the creation of multiple boolean tags from a single integer tag, ensuring compatibility with templates and providing a clear representation of the machine's state.
Last updated