I have an interesting problem with a gateway and reliability of expression tags.
The gateway is not overloaded running 40-50% CPU with sawtooth RAM use.
I have access to the windows server.
I will try to explain clearly:
Ignition 8.1.17
OS = Windows Server 2016
Tag Provider Group = default 1000mS
I am using an expression tag to calculate seconds of production time in a shift. The tag name is "Shift Production Time Duration", type = integer.
Seperate tags contain a shift name and shift status. For example: Shift = "First" Status = "Production" or Status = "Lunch"
The expression tag named "Shift Production Duration" watches for shift status to equal "Production", if equal increment by one second.
Not important but shift name and shift status are fed from a gateway event script containing shift definition lookup at 1000mS.
I will refer to the above tag as "exp01"
exp01 has a value change script.
exp01 value change script writes to another tag documenting an integer number of seconds a shift status = "Production".
When status changes from Production to Break (or any other status) exp01 turns to 0 and value change script stops executing. As a result tag "Shift Production Time" stops climbing.
When status changes from anything to "Production" the status counter exp01 should increment by 1. The value change script should only trigger once exp01 = 1 (and previousValue = 0)
However, sometimes exp01 will add the none Production status seconds to the total. For example Shift Production Time = 3700 and status will be "Break" for 300 seconds.
When status goes from "Break" to "Production" Shift Production time will change to 4000 when its broken. When it works the next value will be 3701.
I have a copy of the above setup I will call exp02. The only difference is exp02 is working from Reference tags (reference of shift name and shift status). The reference tags point at the same tags exp01 is using.
How can I have 2 identical expressions driven from the same source of truth on the same gateway evaluate differently (sometimes) and other times the same?
I have noticed on gateway startup exp01 is frequently broken. I think it could be related to previousValue being "None"? If the gateway restarts I have to modify and resave exp01 to get it working properly. When exp01 does work it could be for days and randomly stop.
I am looking to understand why the expressions evaluate differently sometimes, and if Ive done something wrong.
I would like to also understand how to handle previousValue use on gateway startup as effective as possible.
Open to criticism on the entire process really.
Here are the other tags: