Moving Median in Ladder code

hanziou

Member
Join Date
May 2005
Posts
111
Do anyone have a simple way to calculate a "moving median" value? Or am I stuck maintaining a FIFO array, sorting that and then picking from the sorted array.

Can anyone suggest an efficient sort routine?

I work with DirectSoft4 and am starting in RSLogix5k (Ladder editing only).

( I am looking for a filter for spikes in analog data. We are also looking at greater signal conditioning, but we still seem to need a 'software' filter.)
 
This is the way I always do:


F10:0 = your analog input
F10:1 = averaged value

Use CPT instruction

F10:1 = (F10:0 + (F10:1 * 100)/101)

In this example you average on 100 scans.
Simple and easy

Ragrads

Antoine.
 

Similar Topics

All, I am trying to reset timers when a Work Order change occurs. The Work Order comes in as a string and I am comparing it to a tag...
Replies
2
Views
101
I'm a Siemens person, and this is one of my first AB programs. The customer wants everything programmed in Ladder. I have a lot of data (3...
Replies
14
Views
253
Hello, I have a compact Logix plc and I have been task with configuring alarms into our SCADA when an Analog signal stops moving. The analog...
Replies
6
Views
265
Hello, i am a beginner with a Siemens Logo 8 PLC. I would determine the direction of an object if it passes a whole cycle of 2 input sensors. See...
Replies
2
Views
205
Can an AOP be removed from Logix? I seem to have some version weirdness from an E&H AOP and I need to see if reinstalling the AOP will correct it.
Replies
5
Views
1,011
Back
Top Bottom