Structuring an Evaluation Script
An evaluation script is simply an expression that when true will cause an event to fire. The script support all types of math operators to help define the exact behaviour you require.
There are many TilliT keywords that can be used in your script to substitute an Edge Data Tag value. These are shown below.
value: is replaced with the current value that was read by this tag
lastvalue: is replaced with the previous value that was read by this tag
tag['id']: is replaced with the current value that was read by the specified tag id
now: is replaced with the current unix time in milliseconds
dayOfWeek: is replaced with the current day of the week as a number (0-6)
hours: is replaced with the number of hours into the local day it is
minutes: is replaced with the number of minutes into the local day it is
day: is replaced with the number of days into the month
order.fieldName: is replaced with the corresponding fieldName of the current running order. See the bottom of this page for available fields
orderAttr.attrName: is replaced with the corresponding value of attrName of the current running order.
prevOrder.fieldName: is replaced with the corresponding fieldName of the previous running order.
prevOrderAttr.attrName: is replaced with the corresponding value of attrName of the previous running order.
So how would these be applied? Well for a simple use case where we want the script to evaluate true when the product count exceeds a theshold then we can use
When we need an event to occur every 500 bottles, we can use
But not every order is going to have the same size and it would be better to use a percentage of total bottles produced. To create an event at 50% of produced goods, we use two tags in an evaluation. Here is an example
Here we see value which is the current number of produced goods, we divide by quantityTarget, which is current running order target inside TilliT. This results in a percentage, and will create an event when it exceeds 50%.
To extend this, say we know that a specific equipment tag should always be increasing while the machine is operational, then we can do the following check to ensure an event is created whenever this is not true.
This will give the desired effect where when the machine is running(tag['15'] is true while running) AND the value read was less then the last value, then evaluate true and trigger an event. Use this with minimum duration to evaluate over more then one data point before firing. You can find the ID of a tag inside the edge configuration settings of the datasource. NOTE: The tag id can be from a seperate data source but not from a sperate edge device.
If your use case is quite advanced, take a look at this documentation of all available function and operators that are available to use
Available Order FieldNames
batchNumber
defaultRunRate
name
operation
orderDate
orderNumber
quantityTarget
quantityCompleted
quantityRejected
actualChangeoverDuration
currentRate (pass 3 hours)
quality (percentage from 0 - 1)
performance (percentage from 0 - 1)
availability (percentage from 0 - 1)
Last updated