Using the Real Time Logic Engine (RTLE)
Last updated
Last updated
As previously explained for datasource addressing, the Simulator is able to utilise a tag address of EVALUATE() to define simple operations that can act as a completely seperate tag. Here we will discuss how this can be used to achieve a reliable and effective RTLE. This allows you to create simple transformations of raw data, without the need to change PLC programming. This document will start with a basic guide on the options that are available to the EVALUATE tag, then some examples of their usages.
Any tag current value can be referenced using the `value` keyword. TilliT Edge will evaluate all dataTags that are not connected to a simulator first, and then evaluate each simulator tag one by one. What this means is that when referencing values outside of you simulator, they will always be up to date. But any subsequent tags in the simulator cannot be referenced. An example is the following where both tags are in the same simulator datasource
Any tag previous value can be reference using the `lastvalue` keyword.
For a scenario, we have a machine tag of id 67 which represents the state of a machine via an integer. See the below guide
1 | Equipment Running |
2 | Equipment Faulted |
3 | Equipment Blocked |
4 | Equipment Stopped |
5 | Equipment Starved |
It is trivial to setup triggers for the events, where an evaluation expression for equipment running would be value = 1. But we need to be able to assign templates to these tags. The EQUIPMENT_STATUS_* template expects a boolean to represent the state of the machine, not an integer. We can utilise the RTLE to create new tags that convert this one integer tag into multiple boolean tags. See below for the configuration.
Here you can see we utilise a Ternary operator to evaluate what the value of our machine state is when converted to a boolean. We have also added extra logic for the Equipment Stopped state, where both the machine faulted and machine stopped state will be processed as a stopped event. Each tag is then hooked up to a trigger of value > 0 with the respective event type.