RSLogix 5000 MAVE instruction, NumberOfSamples

ZonD

Member
Join Date
Nov 2014
Location
Aarhus
Posts
2
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 little experience in PLC programming so please excuse me if I seem a bit lost. I am programming in structured text only and haven't quite understood the function block methodology.

I have a task that excutes every 10 seconds and the idea is to calculate a moving 10 minute average for a sampled signal (windspeed).

I have configured a storage array (Mave10MinSamples, REAL(60)) to hold the samples and NumberOfSamples is set to 60
I am not using weights.

The problem is that WindSpeedMAVE.out is set = WindSpeedMAVE.in every 10 seconds and only a single sample is inserted/updated in the storage array (Mave10MinSamples[59]).

I have tried inititalizing the MAVE instruction, changing NumberOfSamples, toggling EnableIn, SampleEnable, EnableOut and a lot of other stuff but nothing seems to do the trick.

What am I missing here?

The status of the MAVE instruction can be seen in the attached screen shot.

MAVE.jpg
 
How are you running the FBD? Is it in a continuous task? If you're only running the task once every ten seconds then it won't work properly. SampleEnable needs to be toggled for every sample, which means the instruction will have to run at least once with SampleEnable off and again with the SampleEnable on so the instruction sees the change of state. EnableIn needs to be held on. Only toggle Initialize if you want to reset all of the registers and start over.
 
First of all thanks for your replies.

I'm not sure why the MAVE did what it did, but I found out why it didn't do what I wanted it to do....

What I didn't mention is that my periodic (10 sec) task loops through a number of sensors, calling the MAVE for each sensor.

I had a storage array for each sensor but I didn't create an array of the MAVE so I called the same MAVE-instance for all sensors.

After changing the MAVE to a 1 dimensional array and addressing the corresponding MAVE for each sensor it all worked out fine.

BTW I don't have to toggle the SampleEnable in order to make it Work.

I hope it makes sense...
 

Similar Topics

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,495
Hi folks, in the alarm manager of Rslogix 5000, the tag-based alarm has been created. But when I tried to change the condition, it was found the...
Replies
2
Views
151
I am completely stuck on building a ladder program that requires a start button to be pressed 3 times to turn on motor 1. Then motor 2 starts...
Replies
20
Views
574
First off, I'm a hobbyist-level programmer, and this program isn't controlling anything anything that could even remotely be considered "life...
Replies
18
Views
513
Back
Top Bottom