Expression tag dependent on its prior value

If I want to have a tag that updates every second like so:
a_new = a_old + b
Can I do this in an expression tag?

No.

  1. Expressions can refer to themselves.
  2. There will be some jitter in the polling rate so it wouldn't be accurate.

What's the real problem you're trying to solve?

1 Like

I'm trying to set up a simulated system for a filling tank, where the tank's current level is set by 1 tag and the tank's flow rate is set by another tag.

I could move the level calculation into the simulated PLC, since that's scriptable, but I'd prefer to keep the sim inside ignition.

Use a timer event, not an expression tag. Do all of your simulation in the one event (call as many project library functions as needed).

4 Likes

Ah, yep, thanks!

There's also the programmable device simulator OPC device option.

If your real PLCs will be using IA's Logix driver, or Modbus driver, you might find my 3rd party modules helpful. (Allowing all your OPC Item Paths to remain unchanged between simulation and deployment.) Simply disable the simulation code's timer event when deploying.

1 Like

This is exactly what I do. It is extremely useful.

1 Like