Tag change by percentage over rolling minute

1stank1

Member
Join Date
Sep 2010
Location
Washington
Posts
7
Hello all,
I need a little help. I have a process that automatically changes a tag value if conditions are met. I have been tasked with keeping track of the automatic tag change and if that value exceed 5% over the last minute then alarm the operator.
I am using Contrologix V19 with a 1756-L61 processor. Any ideas are greatly appreciated. I am versed in ladder, STL and FB. So any suggestion on a certain type of programming or certain blocks for this are greatly appreciated.
 
Welcome to the forum.

How often do you have to check? If you have to check every second then a 60 element FIFO would do the trick. Once every second execute an FFU/FFL pair and then compare it to the stored values.

edit to add:
Something else you could do is copy the FIFO to a second array and then sort the array with a sort instruction (don't sort the FIFO itself). Then the minimum and maximum values are at the top and bottom so you only need to compare just the two to see if you have exceeded the allowed change limit.
 
Last edited:
You want to monitor the tag every minute in that if it the old value changes by over 5% compare to its new value within a one minute duration you want to trigger an alarm. Have a self resetting timer set for one minute and every minute compare the old and the new value and compute if the new value is above the old value by 5%, if it is then trigger an alarm.

So if you did this in ladder create a self resetting one minute timer. Create two registers call one New value and call the other Old value, calculate using a CPT instruction 0.05* old value and store it as a variable in the destination tag. Then when the timer is done compare to see if the new value is greater than the value stored in the destination tag, if it is latch on an alarm.
 
Last edited:
dbh6 I agree with the method but not with your multiplication.

100 x 0.05 = 5 :unsure:

and
100 x 1.05 = 105 🍻
 
Got it

First thank you all for your input. Amazing amount of information from people wanting to help others, KUDOS to all.

TConnolly-
I did what you suggested and it works beautifully. Thank you very much.

Most of the other suggestions would look from minute to minute but not a rolling minute. The tag could change out of bounds and back in within the minute. The resolution is not there.

Everyone have a wonderful day.
 
This method works, but it relies upon two single snapshots of the variable's value. A lot could happen undetected within the one minute sample window.


that is not the case. The Tag Value is the Value being changed automatically. So it's Always Alive. Only one snap shot after condition met to get percent allowed. Then any time during the 1 minute duration if you exceed the 5% then Alarm. After one minute then allow next condition met to get new percent allowed.

Any Way... OP glad you found a solution that works for you.
Good Luck and Welcome to the Forum.
 
I believe the OP was referring to a total change (lowest to highest) during the course of the last minute. cwal61's example compares two samples which are 60 seconds apart. And it only alarms if the latter sample is more than 5% greater than the previous minute's sample. What if it dropped by more than 5%?

Granted that repeated large changes, even if they aren't 1 minute apart may eventually trigger an alarm. But excursions which take place over the span of less than a minute will be more difficult to catch. Let's say a short variation went 3% below then, a few seconds later, went 3% above the average steady state reading (a total variation of 6%). This is disallowed but it would not be caught by this method.

But looking through all samples which occurred during the previous minute each second will alarm as soon as the disallowed change takes place.
 
that is not the case. The Tag Value is the Value being changed automatically. So it's Always Alive. Only one snap shot after condition met to get percent allowed. Then any time during the 1 minute duration if you exceed the 5% then Alarm. After one minute then allow next condition met to get new percent allowed.


Yes. My mistake. Taking a closer look at your logic, I see that you are continuously comparing the stored sample to the live variable, rather than merely comparing it to the previous minute's sample. Still, this method arbitrarily assumes that the stored sample represents a "normal" condition.

A better rate of change alarm (and that is what I believe is being described in the top post) would compare numerous samples to one another in order to detect either positive or negative deviation.

Were I going to use your method, I would replace the snapshot comparison sample with the mean value of the live variable taken from the previous minute. Although the top post doesn't specify doing so, I would also test for negative deviation, in addition to positive deviation.
 

Similar Topics

Basically I have created a bunch of local tags, is it possible to convert all of these to a global tag? Or would I need to re-add everything all...
Replies
5
Views
1,156
I have a Red Lion G09 scanning 8 Invertek P2 VFDs via modbus RTU - I've setup necessary comms and tags and all works well. I have a 'Settings'...
Replies
3
Views
1,872
Hello all, wondering if there's a simple way to detect when a tag's value has changed. I have some tags whose values get updated every so often...
Replies
4
Views
1,652
Is it possible to dynamically change Tag Names (in real-time) on these PLCs? I'm guessing the answer is "NO", right? Just externally, then...
Replies
10
Views
3,865
Hi All. I have been tasked with the HMI aspect of a PLC 5 to Logix 5000 upgrade. The plc code has been completed by others, it's up to me to...
Replies
6
Views
2,192
Back
Top Bottom