Calculate solar production income with variable price

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Hellrazr
Posts: 7
Joined: Monday 10 May 2021 14:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Calculate solar production income with variable price

Post by Hellrazr »

Hi.
I'm looking for a way to calculate daily/monthly/yearly solar production income when the price varies every hour.

I have a counter in domoticz which gives me the daily solar production, it's called 'Solcelle produksjon'

And the device which gives me the price is called 'strøm pris denne time'
solar.jpg
solar.jpg (57.8 KiB) Viewed 176 times
Best Regards
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Calculate solar production income with variable price

Post by willemd »

Does the price change exactly at the hour (xx:00:00) ? Or does it change later but then should be applied to the solar production of the previous hour?

It would trigger a script every time the price changes. The calculation is simple of course price * production, but you need to have the correct production available for this calculation. Depending on the timing issues, you could store the production of a certain time internal in a persistent variable, or in a device (so you can also see what is happening).

Let's assume the price changes every hour but you only know the price 5 minutes after the hour and it should be applied to the production of the previous hour. Then you need to trigger the script by the price change, but you also need to trigger the script every hour. When it is triggered by the hourly timer, you close the production counting of the past hour and start the production counting of the new hour. When the price changes you apply the price to the production of the past hour, you store the outcome of the calculation in a dummy device (a counter for example), and you initiate the new production interval with the production level you recorded at xx:00:00 hours.
Post Reply

Who is online

Users browsing this forum: BarryT and 1 guest