-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Battery forecast declinging with each MPC run #348
Comments
Could it be that as the SOC decreases, the MPC is still trying to reach the SOC target by the end of the period, but it assumes that it has a full hour remaining? For example, if the actual time is 14:30, the MPC might think it’s still 14:00 and that it has the full hour to discharge or charge the battery. As a result, it might reduce power output to a lower level, thinking there’s more time left to meet the SOC target by the end of the hour. In reality, since there’s only half an hour left, it should be discharging with higher power to hit the target. Since the MPC runs every 5 minutes, it could be recalculating as if the full hour is available each time, even when less time remains. This might cause the system to apply less power than needed, believing it has more time to reach the desired SOC. To resolve this, a few options come to mind:
Would anyone have suggestions on how to implement a time-aware approach in MPC or has anyone faced a similar issue? Also, would running the MPC only once per hour help prevent the model from mistakenly thinking it has more time left than it actually does? This might avoid scenarios where it reduces power output gradually to meet the SOC target, without realizing that the time remaining is less than it assumes. |
So I tried running MPC one a hour at 59th minute and publish data once hour on 00 minute. As you can see on the right is the whole hour was full sell to grid. So i think that the issue is reason i tried to explain in my prevoius post that every MPC run it sees that the soc has been decreased and thinks that it has the whole timestep to spend the energy, but in reality maybe only half an hour or less is to go and in lower power it cant spend the energy. So all in all there will be an issue when MPC run frequency is higher than the timestep configured. One option is to make the timestep same lenght as the MPC run frequency. I think it's possible to generate 5 minutes datapoints from Solcast and Nordpool. Other data should be alresdy there. @davidusb-geek , what are your thoughts? UPDATE: I have now 15 minute timestep and MPC run every 15 minutes and everything looks great. |
Can't say for sure it is related, only been playing with emhass for a day now. But, I have noticed that the MPC does not take soc_init as a truth, but rather just mixing it in with some weight. And alpha/beta parameters seem to not have any noticeable effect on it. Only way I could get the MPC to work with the actual SoC was to set "battery_target_state_of_charge", which seem a bit awkward to me. It sort of doubles for both initial and final state, but final state can then be overridden with soc_final. I found soc_init to be useless. I am sure there are some clever thinking behind this behaviour, would love to know what that is. |
I think that the Battery SOC number you see in the battery forecast is the SOC that will be by the end of this timestep. Fro example 14:00 SOC is actually the 14:59 SOC. So all in all the main issue is how the first timestep is handled. Would be nice if EMHASS could handle the first timestep in a better resolution and knows there in time the current time ise |
Quite sure that wasn't the problem, because the numbers were off by 70% of the battery capacity, and I can not pull that much from my mains in one hour. And it would have shown on the grid consumption number, I guess. So there is still something mysterious with the soc_init parameter. |
After a closer look, I think you are right. It seems emhass don't publish data for the current hour. So the sensor readings are actually for the next hour, and the same as the first element in the list provided in the attribute. Seem a bit weird to me, wonder if that is really intentional. I'll ask a question in the discussion group to see if I can get a clear answer. Thanks! |
Sorry to come late on this but definetly I would not run MPC to a higher frequency (and hence the overall timestep) to what your available data can manage. That may result in strange results. |
Setting SOC init and SOC final at runtime should work just fine, but that works only for passed data at runtime, ie via the curl template command. This has been well tested and approved. The "battery_target_state_of_charge" was originally intended to be used outside an MPC approach, for example just for a day-ahead optimization |
This makes a lot of sense, but documentation says multiple times that frequency should be high, i.e 5 minutes. Maybe better explanations needed in documentation?
|
I had problem, when published sensor data was off and not for current hour. Please see parameter But this is not for batter init soc. This works like @martinarva described. |
Describe the bug
I'm using ML Forecast for load forecast that I run daily and MPC that runs every five minutes, but facing issue that every time there is a max sell to grid hour, battery power forecast starts with max power and then every MPC run it decreases the power. Issue is that i'm not able to fully utilise the selling potential and the SOC is much higher by the end of the hour than in the optimisation plan.
Here is a screenshot from today
I have tried alpha 1, beta 0 and vice versa, but no effect on my issue.
Also iI don't understand the battery SOC forecast. At the moment my battery is 49% but in the EMHASS forecast it's showing 25.3%. Im feeding in soc_init with every MPC run every 5 minutes, so emhass should have the latest state. I could think that EMHASS will show the SOC for the end of hour, but here you can sxee that it's 21:02 and emhass thinks my battery is 20.6%, but it's 48%.
So actually two issues that may be related:
Home Assistant installation type
Your hardware
EMHASS installation type
The text was updated successfully, but these errors were encountered: