How do you find the mean of a FIFO array discarding extremes?

Well it is a bit difficult, not knowing what you are measuring with your laser, is this a fixed mechanical setup, where you will never get a reading off target ?

Averaging the middle will only work if you have extremes in both end of the scale, so you will need to filter the values coming in, so they fit within a range to start with.

/Holm
 
My periodic task is not functioning. The following is what I have. I have made sure everything is set right in the periodic task.

I also put a GSV instruction in to see last scan time and it is reflecting a good result.

I am trying to trigger the OTL coil to fill the FFL upon each scan at 100ms. Any ideas.

Pg6dVSn


https://ibb.co/Pg6dVSn
 
Last edited:
Why you think that periodic task isn't running.


Since you have latch on first rung and unlatch and last, it won't make difference if you have OT contact or not on 3rd rung.


OT bit is on true state allways on 3rd rung, animation maybe show still false state bacuse of 5th rung.
 
Last edited:
One SRT instruction puts the elements into ascending order, just need to average the "middle" elements, another single instruction, AVE


Yes, the SRT is one instruction in your ladder code and so is the AVE. But don't let that deceive you: for a significant number of elements both the SRT and the AVE take a huge amount more time to complete than a line of ladder code with just contacts and coils. Your PLC (or the compiler) hides this fact from us. Nevertheless the huge amount of work for the single ladder instruction is still happening beneath the surface. There is no way around it for a conventional processor architecture, computer science says sorting is a lengthy operation as soon as the number of elements goes up. PLC processors are very conventional.



The OP mentioned 10 elements in the FIFO, so it is probably not too bad after all and no need to go for faster solutions.
 
How extreme are your extremes? You could push your values thru a bit mask and never add them to the array if they're too large.
 
My periodic task is not functioning. The following is what I have. I have made sure everything is set right in the periodic task.

I also put a GSV instruction in to see last scan time and it is reflecting a good result.

I am trying to trigger the OTL coil to fill the FFL upon each scan at 100ms. Any ideas.

Pg6dVSn


https://ibb.co/Pg6dVSn

I normally have 2 arrays, one to collect the raw input, without any interruptions and another rutine to convert the raw input and place it in my result array in it's own pace.

This is also very simple to simulate :)

/Holm
 
So, I have a analog input from the laser coming in. I was unable to get the get the FIFO to fill without putting a timer. It is working and logging. Maybe not efficiently, but for testing is working. I am getting 10 samples which the laser stores every revolution. I wanted the periodic task to run every 100 ms. then at the beginning trigger the fill to the FFL. After, It would dump any that were extreme low of high but at least 5 samples of the ten. We are using the laser for real-time diameter measuring for a tension system. In turn the array of number need to be calculated fast and as accurately as possible.

What I meant by extremes was we were worried about noise and or a skewed reading. So one of the senior engineers wanted me to get samples and do a comparison against a percentage of the mean. Like excel, "TRIMMEAN(x,Precentage) or LabVIEW, "Trimmed mean". trimmed—Computes the arithmetic mean of x array after removing the percentage of potential outliers that percent (trim) specifies.

I have attached the ladder that I am currently using.

Holmox, I like the idea of the 2 arrays. Would it be faster? Could you simulate for me? Thanks.

https://ibb.co/9HNdCMG
https://ibb.co/ypg14Fj
 

Similar Topics

Hi , Where i can find Mitsubishi PLC Card end of line & replacement model details. i am looking for Q02CPU replacement model. Please advice. thanks
Replies
2
Views
128
I have tested every screen and no single screen individually has this fault pop up, but when I compile and send to the PanelView it comes up. If I...
Replies
4
Views
186
Hi, One of my customers has an old fabric tensile testing machine. The IC # AD7501KN of its controller has malfunctioned. This IC is related to...
Replies
1
Views
85
Hello everyone, I am a student and would like to take the next step and learn FactoryTalk (Batch preferably) and how to create HMIs etc. Would...
Replies
4
Views
495
Hi, Have a look at this picture... How can I find out the memory address of this tag? It was created by adding it to DB "Data_block_1", but I...
Replies
6
Views
1,068
Back
Top Bottom