This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

Temperature tendency
#1
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?
LM5Lp, firmware: 2018.08.22, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151
Reply
#2
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.
Reply
#3
(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
Reply
#4
Yes, but it won't work over plain HTTP. Change socket.http to ssl.https and http to https.
Reply
#5
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?
LM5Lp, firmware: 2018.08.22, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151
Reply
#6
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
Reply
#7
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)
Reply


Forum Jump: