How can I easily read what a channel value was 5 seconds ago?

Nick Rawson

Posted on 24.10.2017 10:33

Hi,

I want to read historic channel values so I can perform comparisons in math channels. I thought this would be easy to find but I'm struggling to locate it.

For example:

if(Temp1 5 seconds ago > Temp1 now, 1, 0)

which would detect is Temp1 is higher than it was 5 seconds ago and give me a rising edge.

Is there an easy way to do this? In something like Labview I would use a shift register or similar. Can arrays do this - if so can you give an example?

Thanks.

DEWESoft Support
Technical support
Posted on 24.10.2017 12:03

Hi,

DEWESoft has an easy way to do this. In math, simply search for delay and you'll be able to access the "Delay channel setup". I've attached a picture that shows you this option. There you can define your delay in terms of samples or milliseconds.

If you'd like to avoid an additional channel, then you can also define the delay in terms of samples directly in a formula. Simply add an .data(i) extension to a channel, where i will be the sample number in reference to the current time. The sample index of each moment is 0, so you would need to write in -XXX, depending on your sample rate to access previous samples.

Let me know if you need anything else.


Attached files:
Login to reply to this topic. If you don't have account yet, you can signup for free account .
This website uses cookies to ensure you get the best experience on our website. Learn more