Hello, I am wanting to make a totalizer for a few OPC float tags on ignition 8.1.40.
I was thinking about creating a memory tag and then writing an expression to sum the required tags to this one. Is this an ok way to do this or could it be done more efficiently.
The reason is due to needing to trend lots of these tags in the historian which sometimes doesn’t load or takes a substantial amount of time to do so.
If it's possible I'd build the totalizer in the PLC instead and then read the accumulated tags across into Ignition. The PLC can have a task set to a fixed scan rate so it more accurately accumulates the total. Otherwise trying to use Ignition's polling rate you're going to have a much greater degree of rounding errors.
I am wanting to make a totalizer for a few OPC float tags...
A totalizer is usually an instrument that measures or displays the cumulative total of a variable — such as fluid flow, volume, or mass—over a specific period. Is this really what you want, or do you mean you want to periodically log the sum of tag readings?
The reason is due to needing to trend lots of these tags in the historian ...
Historian doesn't do trends. The chart components do that.
... which sometimes doesn’t load or takes a substantial amount of time to do so.
Show your binding and describe in more detail what the problem is. Also, what is the frequency of logging to the historian?
In general, it's better to store the individual counts as they may prove useful in later analysis.
Ah ok I’m very new to the industry so figuring out exactly what I want based on process requirements has been a learning process. A sum of tag readings is what I’m looking for as its a total of multiple flows from different meters.
The trend is for the sum of total flows over the last month to be generated on the first of each month.
Also to note that you should not use floats for a totaliser. Due to how the datatype stores numbers in binary, once the value gets high enough, adding a small value to it may not actually change the value at all. This means that your totaliser might work till 65,000,000.0 litres then adding 1.0 litre to it does nothing at all, you would have to add maybe 5.0 litres to it in order for it to change value.
This is why totalisers are normally based on Integers, as they don't suffer this issue.
In summary, the suggestion is that you do the float totalisation on the PLC, then each time the totaliser reaches a whole number, increment a counter that shows the total whole values. If you need the part values, expose those as a float that never goes over the whole value and add the two values in the HMI/Ignition.