# Best Practice for Continuous Calculated Value Write-Back to PLC for Control/

**URL:** <https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880>\
**Category:** Ignition\
**Created:** [May 31, 2025, 11:10pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880 "2025-05-31T23:10:02Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul.Allen](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@Paul.Allen](https://forum.inductiveautomation.com/u/Paul.Allen)\
**Post date:** [May 31, 2025, 11:10pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/1 "2025-05-31T23:10:02Z")

</div>

Hi everyone,

I'm using Ignition Edge and need some guidance on the best approach for a specific scenario.

**The Scenario:**

- We have 3 proprietary field devices that our main PLC can't directly communicate with
- Ignition Edge currently polls these devices for HMI display (Edge), but now 1 year later we have a new project requirement where we need to poll additional data from these 3 devices, perform calculations in Ignition Edge scripting using that data, then write two calculated values back to the PLC
- These calculated values will then be used for: 1 PID control loop + safety shutdowns/alarms (if above setpoint) within the PLC

**Questions:**

1. What's the recommended method for continuous write-back? (Ignition Edge)
2. For PID control what update rate makes sense? Thinking 1-2 seconds.
3. Any concerns with write conflicts when the PLC is actively reading these tags?
4. Best practices for handling communication failures or indicating when calculated values are valid/stale?

The decision was also made that we dont wan't to spend any extra money on new PLC Modules for Modbus comms so we are limited to doing this through Edge scripting.

I want to implement this correctly from the start rather than troubleshoot issues later. I'd be incredibly grateful for any insights or recommendations you're willing to share. Your knowledge and time are truly appreciated!

Thanks so much in advance to anyone who takes the time to help!!

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [June 1, 2025, 1:04am UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/2 "2025-06-01T01:04:08Z")

</div>

> [@Paul.Allen](#):
>
> safety shutdowns/alarms

This bit here tells me you have chosen the wrong path for integration.  
Never involve SCADA in safety.

---

<div class="post-metadata">

**Author:** ![ben.hutche](https://avatars.discourse-cdn.com/v4/letter/b/9fc348/32.png) [@ben.hutche](https://forum.inductiveautomation.com/u/ben.hutche)\
**Post date:** [June 1, 2025, 3:09am UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/3 "2025-06-01T03:09:01Z")

</div>

What PLC are you using? and what calculations are you performing in Ignition?

---

<div class="post-metadata">

**Author:** ![Paul.Allen](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@Paul.Allen](https://forum.inductiveautomation.com/u/Paul.Allen)\
**Post date:** [June 1, 2025, 8:22pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/4 "2025-06-01T20:22:51Z")

</div>

In this application there's no risk to personnel, its just for some batch processing if we go over our shutdown alarm we want to shutdown the operation. I should not have appended safety to shutdowns there but regardless i agree with you.... i do not want to be doing this through SCADA either but i was told to work with it.

---

<div class="post-metadata">

**Author:** ![Paul.Allen](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@Paul.Allen](https://forum.inductiveautomation.com/u/Paul.Allen)\
**Post date:** [June 1, 2025, 8:23pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/5 "2025-06-01T20:23:24Z")

</div>

CompactLogix and we are doing some calculations using pH levels on soil

---

<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:** [June 1, 2025, 8:28pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/6 "2025-06-01T20:28:47Z")

</div>

If you want to make Ignition behave a bit like a PLC, the most robust approach (IMNSHO) is to use a timer event script that runs like a PLC task. Use a single `system.tag.readBlocking()` to pull in a snapshot of all of the tag values that may be needed, run the logic to compute the values of all of the tags that would be written, and then assemble a single `system.tag.writeBlocking()` to efficiently update any of those that are not already at the desired value.

---

<div class="post-metadata">

**Author:** ![Paul.Allen](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@Paul.Allen](https://forum.inductiveautomation.com/u/Paul.Allen)\
**Post date:** [June 1, 2025, 9:13pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/7 "2025-06-01T21:13:07Z")

</div>

Thanks pturmel for sharing your input. Very appreciated!!

I will go this route and like i said i'm not happy at all about having to do this via Edge Scripting (will give one last push against it) but it is what it is.

Cheers

---

<div class="post-metadata">

**Author:** ![ben.hutche](https://avatars.discourse-cdn.com/v4/letter/b/9fc348/32.png) [@ben.hutche](https://forum.inductiveautomation.com/u/ben.hutche)\
**Post date:** [June 1, 2025, 10:39pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/8 "2025-06-01T22:39:14Z")

</div>

Assuming you could do the calculations in the PLC, have you considered the Modbus AOIs from Rockwell?

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [June 2, 2025, 5:28am UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/9 "2025-06-02T05:28:50Z")

</div>

The modbus AOIs from Rockwell are broken, and very limited on number of tags available.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [June 2, 2025, 2:03pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/10 "2025-06-02T14:03:03Z")

</div>

Also, RTAutomation ([https://www.rtautomation.com](https://www.rtautomation.com)) has some nice gateways, and it will probably be less than the time it'll take you to program this in Ignition.

---

<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:** [June 2, 2025, 2:24pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/11 "2025-06-02T14:24:33Z")

</div>

As I read this, you have a tag from one device that you're reading with Ignition. You now need to push this value into your process controls PLC?

Would an expression tag with a value change script to write to another tag that is bound to the PLC tag work for this?

---

<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:** [June 2, 2025, 2:26pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/12 "2025-06-02T14:26:28Z")

</div>

> [@amarks](#):
>
> value change script to write to another tag that is bound to the PLC tag work for this?

Dangerous! Tag writes can stall, so are not safe to use in tag valueChange events. (Except writes to memory tags, which isn't the case here.)

---

<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:** [June 2, 2025, 2:27pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/13 "2025-06-02T14:27:42Z")

</div>

> [@pturmel](#):
>
> Dangerous! Tag writes can stall

Dangerous how? What do you mean by "stall"? Is there not a thread/queue that would handle this?

---

<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:** [June 2, 2025, 2:33pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/14 "2025-06-02T14:33:51Z")

</div>

Oy! Easy to freeze **all** tag event scripting. Very small thread pool. Some reading for you:

[https://forum.inductiveautomation.com/search?q=valueChange%20missed%20gateway%20tag%20change%20event%20order%3Alatest](https://forum.inductiveautomation.com/search?q=valueChange%20missed%20gateway%20tag%20change%20event%20order%3Alatest)

---

<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:** [June 2, 2025, 2:50pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/15 "2025-06-02T14:50:40Z")

</div>

I see. Good to know. Thank you.

Do we know if there will be any work to expand this functionality/capability in the future? I think modern hardware could handle more than the 3/5 limits that currently exist.

---

<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:** [June 2, 2025, 3:15pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/16 "2025-06-02T15:15:36Z")

</div>

There is an option you can use in `ignition.conf` to increase the size of the thread pool, for very large applications where even disciplined single digit millisecond execution times may not be enough. But that is not a help for `system.*` calls that can block.

`system.tag.writeBlocking()` won't time out on comms hiccups for 60 seconds. Do very much of that in tag events and just a few hiccups will crush all tag events. Don't do it. Use `system.tag.writeAsync()` if you must use this pattern.

Same with DB operations and web API client operations. Use `system.db.runSFPrepUpdate()` for DB insert/updates if you must.

---

<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:** [June 2, 2025, 3:23pm UTC](https://forum.inductiveautomation.com/t/best-practice-for-continuous-calculated-value-write-back-to-plc-for-control/106880/17 "2025-06-02T15:23:27Z")

</div>

Thanks Phil. Good to know that I was using the correct call (async) in these events, in any case.
