RS Logix 5000 MAVE instruction

Greetings widelto ...



thanks for sharing that program with us ... to be honest, I think that's the most imaginative way of doing a "moving average" that I've ever seen ...



just a quick comment though - in case someone decides to use this in an actual application ... the "Reset" operation on Rung #0001 has a subtle flaw ... the placement of the OSR will keep S:1/15 from triggering the "Reset" operation in the following conditions ...



suppose that the processor is in the "Run Mode" ... suppose that the "Manual Reset" bit is set to a ONE condition ... (maybe an operator's button is "stuck on" or has been "taped down") ... suppose that the processor is now placed in the "Program Mode" ... (or that the power to the processor is cycled) ... when the processor eventually comes back into the "Run Mode" the "Reset" operation will NOT be automatically triggered by S:1/15 as intended ...



osr_wrong.JPG




the picture above shows the original rung construction - but slightly modified to demonstrate the use of an ADD to test the triggering operation ... I've done that in case anyone wants to experiment with these concepts ...



now ... here's a more reliable way of programming the condition side of the "Reset" rung ...



osr_right.JPG





yes, it takes an extra rung - but at least now the status of the "Manual Reset" bit won't be able to interfere with the "Reset" operation which was intended to be triggered by S:1/15 each time the processor first starts up ...



going further ... if the posted SLC-500 program is to be converted for a PLC-5 or ControlLogix processor, using the original rung construction will NEVER allow the "First Pass/Scan" bit to trigger the automatic "Reset" operation - REGARDLESS of the ON/OFF status of B3/0 ... of course the PLC-5 or ControlLogix platforms use ONS instructions instead of OSR instructions - and that's the point ... even though OSR and ONS instructions might SEEM to be identical, the processors handle them quite differently during "pre-scan" ...



ons_plc_right.JPG




the method shown above should work reliably for a PLC-5 or ControlLogix system ... note that this same "one rung" approach can't be used for the original SLC-500 program - because (unlike an ONS) an OSR cannot be placed within a "condition side" branch ...



one final note:



the posted program is titled "Running Average" ... this, of course, is mathematically different from the "Moving Average" that our original poster inquired about ... regardless of the title, the program DOES compute what is commonly called a "Moving Average" - so once again, Bill, thanks for sharing it as part of this particular discussion ...



DISCLAIMER: it looks like the posted program might have been intended as part of a PLC training course ... it is entirely possible that the original programmer intentionally left the "Reset" bug in place just to test the students' ability to find it ... personally I often include such "tests" in some of my own "classroom" programs ... even so, over the years I have personally been called upon to help debug a few "sometimes-it-works-sometimes-it-won't" problems which can be traced down to exactly this type of program construction ... in MANY cases, it's the result of the original programmer assuming (gosh I hate that word) that ALL Allen-Bradley platforms work the same way ...



they don't ...



moral of the story: once you get the program "working" don't forget to check - and then double-check - how it will respond under various "startup" conditions ... surprises in that particular area can be both exciting and expensive ...
 
Last edited:
Thanks Ron, I will change the first rung as you explained, you are right.

I found this tip several years ago and I´ve been using it since then, though I use it mainly for purposes other than running average. My applications are based on temperature and I need to know how the temperature has changed in the last hour, so my fifo has 60 positions and I enter a new temp every minute, so i know exactly every minute how the temp has change in the last hour. Every minute I make a substraction between actual temperature and the data coming out of the fifo, this is the change in the last hour. Degrees per hour.
My process takes up to 20 hours, begins at 70 degrees and finish at 18 degrees centigrade.
 
I've made one of those user defined instructions for v16 or later logix 5000. e-mail me john.paley@drmcontrols .com and i'll send it to you. It is a flexible thing where you can define number of samples (up to 500) and sample time. I use it as a filter for "nervous" analog inputs--works great.
 
Thanks for all of the help and I will work with this on Monday and give you all and update.
This was very helpful.
 

Similar Topics

I am trying to use the moving average instruction. Getting a little caught up on the details. What is the "Storage Array" and what type of tag...
Replies
2
Views
2,673
I have been averaging a number of values using the MAVE function and have been having good luck with them. The question I have is the time it...
Replies
3
Views
2,288
Hi all, First post in this forum. I am having trouble with a moving average (MAVE) instruction on an RSLogix 5000 controller. I have very...
Replies
3
Views
6,575
I am trying out the MAVE instruction to give me a 24 Hour Rolling Average and a 1 Hour rolling Average for the same Input. I have it in a periodic...
Replies
2
Views
4,525
Hello Friends, I am working on a new project to add in a NU-EP1 from Keyence to a 5069-L306ERS2. The EDS file registration goes just fine with no...
Replies
0
Views
27
Back
Top Bottom