JeremyM
Lifetime Supporting Member
As a small part of some machinery I'm working on, I needed to obtain some temperature readings from an RTD probe in a vessel. I derived a function to convert raw input from the signal conditioner to the actual temperature, then created this rung to compute it for each scan:
-----------------------------[MUL(RAW * SCALE)]---[SUB(Temp - OFFSET)]---
Mathematically, this *should* work, but the HMI polling for the tag containing the temperature revealed a spike in the value, leading me to think there was intermittent noise somewhere. Scoping the line revealed no issue, so I eventually figured out that the polling request was occasionally being answered by the PLC after the MUL, but before the SUB instruction, was executed (both instructions referenced the same temperature tag), thus revealing a "spike" of precisely the value of the offset.
I rolled the expression "(RAW * SCALE) - OFFSET" into a CPT instruction, guaranteeing an atomic value for the temperature. The PLC is a CompactLogix L33ER, running firmware 21.11. Also, I'm not sure how the LADDER tags work yet, so forgive me.
-----------------------------[MUL(RAW * SCALE)]---[SUB(Temp - OFFSET)]---
Mathematically, this *should* work, but the HMI polling for the tag containing the temperature revealed a spike in the value, leading me to think there was intermittent noise somewhere. Scoping the line revealed no issue, so I eventually figured out that the polling request was occasionally being answered by the PLC after the MUL, but before the SUB instruction, was executed (both instructions referenced the same temperature tag), thus revealing a "spike" of precisely the value of the offset.
I rolled the expression "(RAW * SCALE) - OFFSET" into a CPT instruction, guaranteeing an atomic value for the temperature. The PLC is a CompactLogix L33ER, running firmware 21.11. Also, I'm not sure how the LADDER tags work yet, so forgive me.
Last edited: