Logic Machine Forum
Temperature tendency - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Temperature tendency (/showthread.php?tid=2279)



Temperature tendency - Thomas - 10.10.2019

Hello
Do you have any idea or experience how to calculate outside temperature tendency?
I'm thinking about linear regression for last 1 hr where the angle of the regression line is the tendency.
Or simply sum (dT) for the last 60 minutes (maybe it's the same value).

Have you found any better algorithm?


RE: Temperature tendency - admin - 11.10.2019

What is the use case for this? Why not use weather forecast for this? yr.no XML forecast has temperature values for each 6 hours which should be enough for most cases.


RE: Temperature tendency - Tokatubs - 11.10.2019

(11.10.2019, 07:14)admin Wrote: What is the use case for this? Why not use weather forecast for this? yr.no XML forecast has temperature values for each 6 hours which should be enough for most cases.
Is this what you refer to Admin?

https://forum.logicmachine.net/showthrea...1#pid11521


RE: Temperature tendency - admin - 11.10.2019

Yes, but it won't work over plain HTTP. Change socket.http to ssl.https and http to https.


RE: Temperature tendency - Thomas - 02.12.2019

The idea is to show the tendency in visu as simple as possible. Just arrow up or down. The question is about best low-pass filter setting.
What algorithm is mostly used?


RE: Temperature tendency - Erwin van der Zwart - 02.12.2019

Hi,

If you just need arrow up/down then comparing last value with new value is enough in my opinion, when last value is 19 and new is > then last value then tendency is "UP" and when new value is < last value then tendency is "DOWN", to make it more stable / less fluctuating you could make a average of last 5 values and compare it with new value.

BR,

Erwin


RE: Temperature tendency - admin - 03.12.2019

You can use simple IIR filter to calculate average values:
Code:
ALPHA = 0.1 -- between 0 and 1, adjust as needed

function iir_filter(val, avg)
  return val * ALPHA + avg * (1 - ALPHA)
end

avg = 0
for val = 1, 10 do
  avg = iir_filter(val, avg)
end

log(avg)