Recommended Posts

Hello again

The data we get back from an accoustic transducer measuring tank levels is quite accurate but has occasional glitches probably caused by external noise. I can implement a mode filter in software on the modbus slave device but its slows everthing down, is it possible within DAQFactory to say take the last 25 readings from a channel and add the value of the reading that occured most to a test channel without resorting to sequences(apart from the Addvalue part).

Your support is really appreciated.

Many thanks

Steve Lawrence

Link to comment
Share on other sites

First, you probably should figure out the source of your noise rather than just covering it up. That said....:

Yes. You'll probably want it in the Event on your input channel. Basically you'll use the histogram function:

private histo = histogram(myChannel[0,24], seqAdd(-10,1,20))

The second part of this function defines the bins, in this case the bins go from -10 to +10 in increments of 1. You can do it much finer if you want and of course a different range. Then, you'll need to use a trick to determine which index is the max:

histo = insertTime(histo, -10, 1)

-10 matches the first value in seqAdd(), and 1 the second value. Then you can do:

private maxvalue = getTime(max(histo))

This works because max() will set the time component of its result to the the time stamp of the max data point. We made the time = to the bin, so this gives us the bin. Finally:

maxvalue.time = systime()


That all said, also consider using the smooth() function. That may clean up your data as well.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.