# Expression tag dependent on its prior value

**URL:** <https://forum.inductiveautomation.com/t/expression-tag-dependent-on-its-prior-value/102607>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [February 20, 2025, 5:13am UTC](https://forum.inductiveautomation.com/t/expression-tag-dependent-on-its-prior-value/102607 "2025-02-20T05:13:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [February 20, 2025, 5:13am UTC](https://forum.inductiveautomation.com/t/expression-tag-dependent-on-its-prior-value/102607/1 "2025-02-20T05:13:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [February 20, 2025, 10:05am UTC](https://forum.inductiveautomation.com/t/expression-tag-dependent-on-its-prior-value/102607/2 "2025-02-20T10:05:09Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [February 20, 2025, 2:32pm UTC](https://forum.inductiveautomation.com/t/expression-tag-dependent-on-its-prior-value/102607/3 "2025-02-20T14:32:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 20, 2025, 2:37pm UTC](https://forum.inductiveautomation.com/t/expression-tag-dependent-on-its-prior-value/102607/4 "2025-02-20T14:37:19Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [February 20, 2025, 3:27pm UTC](https://forum.inductiveautomation.com/t/expression-tag-dependent-on-its-prior-value/102607/5 "2025-02-20T15:27:22Z")

</div>

Ah, yep, thanks!

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [February 20, 2025, 3:34pm UTC](https://forum.inductiveautomation.com/t/expression-tag-dependent-on-its-prior-value/102607/6 "2025-02-20T15:34:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 20, 2025, 3:55pm UTC](https://forum.inductiveautomation.com/t/expression-tag-dependent-on-its-prior-value/102607/7 "2025-02-20T15:55:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [February 20, 2025, 4:31pm UTC](https://forum.inductiveautomation.com/t/expression-tag-dependent-on-its-prior-value/102607/8 "2025-02-20T16:31:38Z")

</div>

> [@Expression tag dependent on its prior value](https://forum.inductiveautomation.com/t/expression-tag-dependent-on-its-prior-value/102607/7):
>
> 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.

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