Creaging an avergage

sparkytex

Lifetime Supporting Member
Join Date
Jun 2013
Location
Port Hardy B.C.
Posts
354
Hey guys,

I Would like to create an average of an analog signal. I have a transducer feeding a 4-20mA signal to my Analog input channel for current read out of a motor. The problem is the signal fluctuates a lot as the Current Transformer isn't really meant for such a low amperage.

It's a .75HP motor and it only draws at max 2.0 amps when running and the CT is for between 2-25A. The signal fluctuates a lot so It's difficult for the operator to read the running feedback on the HMI. So I'd like to average the current over 5 seconds to "Slow It Down".

Would like to know the easiest way to accomplish this without having to use a timer, COP instruction, or FFL.

Any Idea's for rung logic? I'm using RSLogix 5000.
 
Well, you've got some strict limitations to deal with.

"Quote - without having to use a timer, COP instruction, or FFL - Quote"

Especially since your wanting this average over 5 seconds.

So without a timer I would create an "Array of let's say 100" - just place a counter on the rung and every time it is scanned it moves an (analog read) to the array and use the count as the array index. Once you get to 100 (Do the math for the average) and use that as the value displayed to the operator.

You can adjust the time by increasing the array size!

This is just an Idea!
 
Buy a transducer that meets your requirements.

I may have to because the signal just bounces below 0 to much and I'm unable to get a true running current feed back signal. I managed to create an average using a timer, FFL, and a counter for 10 seconds but that still doesn't help.

How I had it programmed was if the motor current was greater than .1 it would send a "running" signal to the HMI. And if the motor is not running, write a 0 into that signal. But since the signal bounces below zero, even with average, I need to most likely get another CT that has a finer range.
 
Buy a transducer that meets your requirements.


or increase the turns inside the current transducer.



assuming the cable only passed through the transducer once if you wrap it thought 12 times its the equivalent of 24Amps on the primary therefore will increase your resolution.


0 - 25 amps = 4 - 20Ma then scale your input accordingly
to value of 0 - 25000 where 2000 would equal 2.00 amps


if you find its saturating in overload condition then decrease turns on primary and rescale. its handy to set up for 0 - 150% of full load current so maybe 8 turns ( 2.0A FLC x 150% = 3amps, 25 amp transducers / 3amps = 8.33' turns primary)
 
Last edited:
Why not shift values into a shift register (say 5 shifts) every second but only if value is within a certain limit then add them up and divide by 5

Example:

Reg5 = 25
reg4 = 16
reg3 = 26
reg2 = 34
reg1 = 18

= 119 / 5 = Ave 23 Note: only used simple integers
Any outside of 10 or 34 are ignored
I have not got licences installed on this laptop for Rockwell but below is a stretched out version in GX works
It could give you some ideas, note this is updated every second you could update it at any time frame you require

Average.png
 
Ah geez - by the right gear in the first place. CTs are bloody cheap - your time is not.
 
I used a FIFO data buffer for this, when I have a new value I move the registers one position to the right then I enter the new value on the left and then I do the arithmetic mean of all the buffer.

It worked pretty well for me.

The larger the buffer, the more stable the result will be.
 
It's been mentioned a couple of times but analog input filters are there for exactly this reason. Having said that I also agree with using equipment that will work as the application needs (I.E. a correct current transformer) but filters should still be deployed on analog inputs where noise is a factor.
 
or increase the turns inside the current transducer.



assuming the cable only passed through the transducer once if you wrap it thought 12 times its the equivalent of 24Amps on the primary therefore will increase your resolution.


0 - 25 amps = 4 - 20Ma then scale your input accordingly
to value of 0 - 25000 where 2000 would equal 2.00 amps


if you find its saturating in overload condition then decrease turns on primary and rescale. its handy to set up for 0 - 150% of full load current so maybe 8 turns ( 2.0A FLC x 150% = 3amps, 25 amp transducers / 3amps = 8.33' turns primary)

+1

This is very common and probably documented in the manual for the transducer...
 
Back
Top Bottom