How can I easily read what a channel value was 5 seconds ago?
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.
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?
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.