![]() |
|
Calculate Daily, Monthly, and Yearly Energy from Trend - Printable Version +- LogicMachine 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: Calculate Daily, Monthly, and Yearly Energy from Trend (/showthread.php?tid=6346) |
Calculate Daily, Monthly, and Yearly Energy from Trend - Fahd - 12.03.2026 Hi guys, I need your help with calculating today’s, weekly, monthly, and yearly energy values. I was not able to manage it using the Trends library: https://kb.logicmachine.net/libraries/trends/ Your help would be greatly appreciated. What I need is:
I would really appreciate your help in advance. RE: Calculate Daily, Monthly, and Yearly Energy from Trend - admin - 12.03.2026 Create scheduled scripts that run at required intervals. For monthly/yearly mode the current day data won't be included into calculation because the data has not been aggregated yet. Daily: Code: require('trends')Monthly: Code: require('trends')Yearly: Code: require('trends')RE: Calculate Daily, Monthly, and Yearly Energy from Trend - Fahd - 12.03.2026 Thank you for the great support and the clear solution. As always, very helpful! RE: Calculate Daily, Monthly, and Yearly Energy from Trend - Fahd - 10.04.2026 Hi again, I will need to apply this for around 40 meters, with values for today, yesterday, this month, last month, this year, and last year. Do you think there is any practical limit I should be careful not to exceed in terms of the number of scripts, trend queries, or objects to update? RE: Calculate Daily, Monthly, and Yearly Energy from Trend - admin - 10.04.2026 Instead of making one script per trend you can use a single script for multiple trends: Code: mapping = {RE: Calculate Daily, Monthly, and Yearly Energy from Trend - Fahd - 10.04.2026 (10.04.2026, 13:29)admin Wrote: Instead of making one script per trend you can use a single script for multiple trends: One trend per meter , so it will be 40 RE: Calculate Daily, Monthly, and Yearly Energy from Trend - admin - 10.04.2026 It should be ok since you don't need to run the script very often. |