Ignition Edge - How to script a Tag Totalizer without Gateway Scripts or Tag Change Scripts

I need to create a fuel totalizer in an Ignition Edge Installation.

Let’s say I have 3 tags:

  1. Sequence Step Number (Int)(OPC Tag)
  2. Total Fuel (Float)(Memory Tag)
  3. Current Fuel Usage (Float)(OPC Tag)

When the Sequence Step Number reaches 200 I want to add the value of the Current Fuel Usage to the Total Fuel.

The place for this script would be on the Gateway so that no matter whether any clients are open or not there is still totalizing happening. This is causing the problem as Gateway Event Scripts and Tag Change Scripts are disabled in Ignition Edge.

I’ve tried to use an Expression Tag with the runScript Function calling a project script that does this totalizing. I haven’t been successful with this option yet. Maybe it’s a limitation on the runScript Expression or maybe I’m not using it correctly.

The other option I’ve though of would be to us a Client Event Script or a Root Container Script tied to a window that is always open. Again this runs the risk of duplicating the script if more than one client is open so it would need to be conditioned to only run on the first client that is open.

If anybody can shed any light on this it would be greatly appreciated.

This will be easy to do in PLC than on Ignition. I have done this on PLC and getting the totalizer on HMI and can reset also from HMI.

*If its in Ignition, cant you create an expression tag with condition *
*If(Sequence Step Number =200), *
Total Fuel = Total Fuel (memory tag) + Current Fuel Usage
This syntax may not be correct.
Did you try that?.

Thanks shibubalaji.

I agree that the totalizing would be more ideal in the PLC, however for this application it needs to be at the Ignition level.

The reason are a few reasons:

  • This is a system with 20 valves that share a single flow meter
  • The total flow recorded on each 20 valve cycle is stored in the RTAC (PLC)

**The client has the ability to configure 40 pieces of equipment and assign up to 20 of them to valves 1
through 20. Then if the client wants to disconnect a piece of equipment and connect it to another
valve, we would like the fuel total for the unit to be maintained and start using the new valves usage to
add to the unit total. The information about which unit is configured to which valve is only available at
the Ignition scope and the RTAC doesn’t know anything about that. All the RTAC knows is the cycle
cycle total for each of the 20 valves.

[ If(Sequence Step Number =200), *
Total Fuel = Total Fuel (memory tag) + Current Fuel Usage]

What you described here would work on a scripting object however to my knowledge there isn’t a tag write function available in the Expression Language. It is more about reading in tags.

Project scripts are not available to tag scripting, and tag scripting is not available in Edge. Edge simply does not provide a compute platform that can replace your PLC. If you must use Edge, with variant totalizing requirements, you will need to totalize in your PLC. Whatever hardware variations are possible will have to be structured so that the PLC is in fact aware of everything.


I would even go so far as to say even if it was full blown Ignition, I would do it in the PLC. Just no way to completely guarantee that you’re not going to miss an event (Gateway issues, network issues, etc…)


Thanks for your feedback. Not what I was hoping to hear but it was the same conclusion that I was arriving at. They’ve obviously taken steps to remove this type of functionality from Edge.

I would like to take the client tag change script option a bit further. Perhaps you could speak to how I could condition a Client scope script so that it only executes on on the first client if there is more than one open.

lrose I agree with you. This is being done as a last resort in order to have a nice to have totalizing feature that isn’t used for billing or anything more important than general operator info.

If I understood correctly, there are 20 valves and each of them may be crisscrossed to 40 different equipment. If there is no information about the valves and instruments are in PLC, there could be a human error which valve that the operator is connecting to . Isnt it.
Anyways, Expression tag is not only ready only and it has both read and write, as far as I know.


Taken from the the manual “Expressions don’t do anything, other than return a value”
There is no tagwrite “Expression Function” to allow you to write a value into a different tag, that is a “Scripting Function” which isn’t available in an Expression Tag.

1 Like