Average Value

MrCyrax

Member
Join Date
Mar 2011
Location
Vryheid Natal
Posts
11
How would I average a reading in a M340 over a period of time?

I'm reading amps from a power meter but the reading I think is too erratic.
I would like to make it more stable change gradually.
 
Unity has 2 moving average function blocks available. One uses a fixed number of samples the other is a weighted average
Not sure of the function names I think the names start with MAV
If someone else doesn't jump in with the names I will post again tomorrow
 
How would I average a reading in a M340 over a period of time?

I'm reading amps from a power meter but the reading I think is too erratic.
I would like to make it more stable change gradually.

It sounds like you really want to implement digital filtering. Search for that term on this site and you'll get lots of results.

I usually use the method attached, and use a timer to implement periodically. The period varies with the process variable fluctuations, but starting at 0.3 seconds works well often. The number of readings to averages also varies, but 10 is a good place to start.

Note on the downside that the increased stability comes at the price of slower response.
 
Unity has 2 moving average function blocks available. One uses a fixed number of samples the other is a weighted average
Not sure of the function names I think the names start with MAV
If someone else doesn't jump in with the names I will post again tomorrow


AVGMV and AVGMV_K
 
It sounds like you really want to implement digital filtering. Search for that term on this site and you'll get lots of results.

I usually use the method attached, and use a timer to implement periodically. The period varies with the process variable fluctuations, but starting at 0.3 seconds works well often. The number of readings to averages also varies, but 10 is a good place to start.

Note on the downside that the increased stability comes at the price of slower response.

Filtering methods have discussed many times, here is couple where code is converted to ladder which Tom mentioned:

http://www.plctalk.net/qanda/showthread.php?t=47235
http://www.plctalk.net/qanda/showthread.php?p=298656
 
Last edited:
It sounds like you really want to implement digital filtering. Search for that term on this site and you'll get lots of results.

I usually use the method attached, and use a timer to implement periodically. The period varies with the process variable fluctuations, but starting at 0.3 seconds works well often. The number of readings to averages also varies, but 10 is a good place to start.

Note on the downside that the increased stability comes at the price of slower response.

Thanks This is exactly what I need. Just need to figure out how.

AVGMV and AVGMV_K

Thanks
 
Yeah, it is same function:

http://www.schneider-electric.cn/downloads//85257689000007EE/All/0F15DC90FEAAD05A852576B2006BB1B5/$File/12-Unity-EN.pdf

page 227

I have earlier programmed my own filter block for Unity fot this.

o_O I could use avgmv block also, but then I would need int_to_real and real_to_int conversion in my program...
 
I dont know if you are using an AI to measure the amps but if yes then in the configuration of the analog card you can set a filter (See attached).
If the amps come from a fieldbus then I agree that the above mentioned blocks should be used.

M340.jpg
 
Further to my previous post pls find attached part of the manual discribing the filtering method used in the AI module. I think it is the same method proposed in the previous posts.

M340_AI.jpg
 

Similar Topics

Hi all-- I need to create code in a Micrologix 1400 project that requires minimum, maximum and running average calculated values (Flows and...
Replies
17
Views
3,758
Hello, I'm using a counter as a timer to get a time value to get the current cycle time and last cycle time. I need to put this "last cycle...
Replies
3
Views
2,825
I'm thinking about how to help a customer tonight and I've got an idea, but I don't know if it's possible. I've used the Data Logger on a Red...
Replies
2
Views
3,062
Hi! Currently I'm trying to implement an average calculator in a S5-95U. In order to do the job, I'm using the folowing equation: M(k) =...
Replies
16
Views
8,651
Hi, I want to find the moving average of the FTviewSE trend. Since it's not a built-in feature, can anyone help me with this, maybe using VBA...
Replies
3
Views
2,710
Back
Top Bottom