Here are some script examples:
Script 1
This script is calculating a total counter value. Where the sensor 'CO' is the calculated sensor. The current value is calculated based on the value of the previous timestamp and the value of sensor 'BA' is added to that:
Script 2
In this script multiple sensors are calculated at once. Also script variables are calculated to be used in this script only, like 'Bread' and 'Maxbread'.
Script 3
This script is calculating a virtual sensor based on the actual value of other virtual sensors. Also a variable is used in this script. The outcome of this script is a status, depending on the value of the variable.
Script 4
In this script the duration is calculated from the Batch sensor value 3. if the calculated variable gives a value below 0, it should be zero, else should be the calculated duration divided by 60, because the format of the outcome of the 'duration' is always in seconds and we want to represent it in minutes.
Script 5
This script is calculating the speed of the line, based on the total counter. And the maximum speed is calculated on top of the speed, with an random value added between 50 and 75.
Script 6
In this script the number of produced products per shift is calculated. When a new shift starts, the counter per shift is reset to zero.
Script 7
This script takes two physical sensors and calculates two virtual sensors out of that with frequency at one per second.
V1[t] = abs(S1[t]-S2[t])
V2[t] = (sqrt(800 + S1[t])) + 10
Script 8
This script counts the total value produced by adding the Carton counter value (Sensor S2) of the previous measurement (t-1) up to and including the current time (t), without evaluating the value of the Power sensor. This will be calculated every second. In the calculation of the second sensor, conditional counter, the value of the Power sensor S1 will be evaluated, whether it is equal to '1'. If it is, the total value produced by adding the Carton counter value (Sensor S2) of the previous measurement (t-1) up to and including current time (t). This will be calculated every second as well.
V1[t] = sum(S2[t-1,t])
V2[t] = sumif(S2[t-1,t], S1[t] == 1)
Script 9
This script counts the total value produced by adding up the input quantity (Sensor S1) of the previous measurement (t-1) up to and including current time (t). This will be calculated every second. The second calculation based on this outcome is calculating the sum over the Second quantity (Sensor V1) every 10 seconds. The time interval of the calculation is based on the frequency of the virtual sensor(s) which are the output of a script.
V1[t] = sum(S1[t-1,t])
V2[t] = sum(V1[t-1,t])
Script 10
This script calculates the average temperature as a virtual sensor, based on two physical temperature sensors in the machine. Both physical temperature sensors are measuring at a frequency of 1 second. The average temperature based on that is also calculated with the same frequency of 1 per second.
AverageTemperature[t] = (Temperature1[t] + Temperature2[t]) / 2
Script 11
This script calculates the production speed of the machine per minute as a virtual sensor, based on a physical cumulative counter sensor. Also calculates a virtual sensor for the threshold of the speed per minute, based on a physical sensor which indicates the type of product being produced. There is an extra calculation for the speed per minute to prevent the value dropping below 0 when the physical cumulative counter is reset by the machine operator, for example. All sensors are set at a frequency of 1 second.
Cartonslastminute[t] = Cartoncounter[t] - Cartoncounter[t-60]
if(Milkpercarton[t] == 2)
{
CartonThreshold[t] = 350
}
else
{
CartonThreshold[t] = 290
}
if(Cartonslastminute[t] < 2)
{
Cartonslastminute[t] = 0
}