Page 1 of 1
Calculate solar production income with variable price
Posted: Friday 02 September 2022 13:05
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 (57.8 KiB) Viewed 177 times
Best Regards
Re: Calculate solar production income with variable price
Posted: Sunday 04 September 2022 11:17
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.