Can Anyone tell me if this is correct in RsLogix 5000 for averaging...

Well, use FFU when DN bit of FIFO_CTRL.dn and Timer_1DN.dn are both set, instead of zeroing FIFO_CTRL.pos. Average should be executed when the queue is full not before.
 
Once the FIFO is full it won't load any more values, so if FIFO_CNTRL.DN then first do an FFU (use same control tag) and discard the unloaded value before loading a new value. In your AVE instruction the length should be FIFO_CNTRL.POS to have a correct average when the FIFO contains less than 30 samples.

XIO Timer_1.DN TON Timer_1 1000 0

XIC Timer_1.DN XIC FIFO_CNTRL.DN FFU FIFO[0] DISCARD_ME FIFO_CNTRL 30 0

XIC Timer_1.DN FFL MAX_S_CURRENT_SCALED FIFO[0] FIFO_CNTRL 30 0

XIC Timer_1.DN AVE FIFO[0] 0 DATA_AVERAGE AVE_CNTRL FIFO_CNTRL.POS 0

Here is an example that shows two ways to do a running average but its written for a micrologix so you'll need logix500 to open it.
http://www.plctalk.net/qanda/showpost.php?p=260919&postcount=5
 
Look at this file, it must be the same as the one from Tconnolly but in pdf format so you do not have to use rslogix 500, hope it helps.
 
Last edited:
I will like to use AVE instruction. Does anyone knows if that PDF file posted (SLC_running_average.pdf) has been updated for RsLogix 5000? I have a project coming up with 40 analog signals I need to average all of them. Doing Average in less than 3 rungs will be nice?

Is there any Add-On instruction that will do all this without writing so many rungs?
 
I will like to use AVE instruction. Does anyone knows if that PDF file posted (SLC_running_average.pdf) has been updated for RsLogix 5000?

The mnemonic code I posted in post #3 is for RSLogix5000 rungs and uses the AVE function.

If you are having difficulty following mnemonic programming you can paste the mnemonic rungs into Logix5000 and see it graphically.
  1. Insert a blank rung in Logix5000 and double click the rung number.
  2. At the top of your ladder editor a text entry field will appear.
  3. Copy and paste the first line of the mnemonic code into that field and press enter.
  4. Repeat for each line of code to see all four rungs.

Is there any Add-On instruction that will do all this without writing so many rungs?
I'm not aware of any. I'm sure that one could be constructed.
 
Last edited:
The FFL instruction requires an address to which the value being removed from the queue is copied. In your application this value is no longer of any concern so it is unloaded into a tag and ignored. DISCARD_ME is what I named the tag, you can name it whatever you like.

In hindsight it may be advisable to rename it to FFL_DISCARD_VALUE or something like that because a future programmer might think DISCARD_ME means to delete the tag, not the value in the tag.
 
You could skip all of the timing and FIFO load and unload hassle and all the data shifting that happens behind the scenes as a result with one rung in a one second periodic task.

TC0208121226.GIF
 
You could skip all of the timing and FIFO load and unload hassle and all the data shifting that happens behind the scenes as a result with one rung in a one second periodic task.

I was going to post something similar - I like your CPT with MOD for keeping the pointer within bounds....
 
You could skip all of the timing and FIFO load and unload hassle and all the data shifting that happens behind the scenes as a result with one rung in a one second periodic task.

If you can run Function Block Diagrams you could use the MAVE. It takes care of all the data and behind the scenes stuff. If your array is large enough it is simple to change the averaging time as well.
 

Similar Topics

What does the term IEEEFP mean when used at the end of a PV source address on Honeywell's Experion system? Me and a friend have a bet going on...
Replies
2
Views
1,914
I've had this happen a few times, but I've never really sussed out why or when. As you can see, in the main AND structure, all the conditions...
Replies
10
Views
2,057
Can anybody tell me if there is a PLC practice software anywhere on the internet that i can download.If not is there one i can buy.
Replies
18
Views
8,861
I have an old Sentry Palletizer (S/O Number 3007 / Serial Number 1172) that has lost its program as the backup battery died years ago. I can...
Replies
0
Views
173
Back
Top Bottom