Due to PLC insufficient memory, I will have to totalize the flows on Ignition.
I found that I can use Hour Meter, but it’s insufficient for my purpose.
Totalizing the flow starting on specific time of the day.
Pause the totalizing if condition A is off, continue if condition A is On.
Reset totalizer at specific time of the day, before resetting the totalizer, move the current totalizer value to previous totalizer value, meanwhile also add the current totalizer value to lifetime totalizer value.
The hour meter can achieve the first requirement easily, but it won’t pause by condition, it can only reset by condition.
Is there anyway to achieve the above requirements on Ignition?
Or I will have to write SQL to calculate them from the database, which could be last solution.
It doesn’t make a huge difference for just two tags, particularly since this only runs once per day, but it might make a difference if there are going to be many totalizers all zeroing from this script.
The flow is a continuous process variable, for example 24m3/hr.
the delta increment of the flow totalizer will be the current flow/(elapsed time since last reading).
curTot = lastTot + PV/deltaTime
The script is triggered by value change, is there a way to capture the elapsed time since last value reading.
Can you explain a bit more on the currentValue and previousValue?
My understanding is that both values are from the same tag, for example, FIT0101.outPV
currentValue = FIT0101.outPV at current Scan,
previousValue = FIT0101.outPV at last Scan.
At current scan, I can get the current value and current timestamp by using the tag properties. But unless I saved the last scan value to a memory tag, how do I get the the timestamp of the tag from the previous scan?
If you use a tag change script, it is provided with the previous value. Except on tag startup. If using an expression tag, it isn’t available. If you must use an expression, I recommend using objectScript()'s state dictionary to capture it on tag startup and update as you go.
Just sorted it out with your help.
I built a data structure for it to be duplicated easily.
Just wondering, if there are 10 totalizers each project, running the same script every second, if there are 50 projects running at the same time, how is it going to affect the gateway performance.
If I assume you are sending the tag values to the history database, you may be able to calculate the total by querying the database asking for the flowrate between both times. Since you are just taking values every x hours or minutes, you will end up with a number values reading1, flow rate… so on.
Because the period is constant between the 2 times you can do:
Total_volume = TimePeriod * ( flowrate1, flowrate2… flowrate_n)/number of items.
note: the longer the period between readings, the less accurate the total is, no matter how you do it.
Also, doing it this way you can store the total in a separate table being a calculated value, you would not have to do it again.
Thanks
So there is not historical data being kept.
What is the user supposed to do with the Total-Flow calculated because if the gatway or the client workstation have a problem then you may lose the Total-Flow. This value should also be important for inventory calculations, so in my opinion the sensible thing to do is store it somewhere.
The idea was to create a live totalizer. It is not efficient to ask the historian for the previous value every time a new value comes. Even worst for 500 history requests at ones.
Nothings stops you to enable history for a particular tag.