Hi everyone.
I have a temperature sensor, which is uploading data every minute, and I wanted to take the derivative of the temperature (°C/H) using a synthetic variable.
The idea I had was to first smooth the temperature curve making a moving average, and then take the difference of this moving average by itself 20 minutes in the past, just to smooth even more the values, making some kind of secant line.
The code I made is this:
It worked perfectly, and after clicking on accept it calculated the last 1000 dots.
The problem is that after that, the synthetic variable doesn’t update, some times after many hours.
I don’t know if the problem is the complexity of the calculation, which I doubt it, or something that i did wrong with my code.
Here is the code:
a0 = mean( , “2T”)
a1 = shift(a0, -1)
a2 = shift(a1, -1)
a3 = shift(a2, -1)
a4 = shift(a3, -1)
a5 = shift(a4, -1)
a6 = shift(a5, -1)
a7 = shift(a6, -1)
a8 = shift(a7, -1)
a9 = shift(a8, -1)
avg1 = (a0+a1+a2+a3+a4+a5+a6+a7+a8+a9)/10
avg2 = shift(avg1, -10)
(avg1-avg2)/(20/60)