Repository navigation
Conversation
…ing horizon # Conflicts: # dao/prog/day_ahead.py
|
@JoostBaltissen But now a get an error message that I don't understand. Can you help me with some tips? |
|
The traceback is a bug in the scenario harness: when a solve finds no solution, it crashes instead of reporting it. I'll fix that. |
|
Shall I sent you a snapshot. Helps that? |
|
I fixed the test runner, #1083. Now we are able to see the log. Boiler direct opwarmen staat uit MIP has 6396 rows; 8910 cols; 27144 nonzeros; 2819 integer variables (2816 binary) I don't directly know what the Columns are, but the values 48 and 45 suggest lowerbound and actual temp. Maybe the warning "geen speelruimte" also gives it away. This scenario has no boiler config specified, therefore the values come from options_example.json. |
|
@JoostBaltissen Is that expected? Edit |
…st-hours" set hysteresis to 10K in base_states.json
|
@JoostBaltissen wrote:
This is from the log:
The value of the hysteresis is to low: I shall:
|
|
Sounds like a good plan! |
set hysteresis to 10K in base_states.json
|
@storeman |
…1086) This is to support the development of the new boiler model and to ensure that the solver behaves as expected in these edge cases.
…1098) and the check reads the limit there. boiler_stook_grens is just a constant in a constraint, so the check took heating_allowed_below from the config. When day_ahead.py raises it to floor + 1, the check flagged valid starts.
|
@JoostBaltissen @storeman |
| extension=0 | ||
| ) | ||
| if horizon_extension > 0: | ||
| if len(fixed_price_data) > 10 and horizon_extension > 0: |
There was a problem hiding this comment.
What happens when there are 8 fixed prices? Then only the fixed_price_data is used without the extension. The exit on line 294 does not break with 8 prices.
There was a problem hiding this comment.
Fix would be setting horizon_extension = 0 in the else branch?
There was a problem hiding this comment.
That is indeed the intention. When there are at 15 o'clock no prices for tomorrow available then and the user calculates with 1hour-interval then there 9 values and calculation goes on until there are 5 values (19:00).
There was a problem hiding this comment.
Okay. But this block defines the pred_price_data var, which is used after the check. So with 6 to 10 fixed prices it will result in an issue with this var.
There was a problem hiding this comment.
But why would you ignore the extension when there are only a few prices available? The optimizer could detect that warming up the boiler is better tomorrow (in the extension), when there are a few prices, the extension is ignored and warming the boiler is started immediately. I think it would make sense to always use the extension when available.
A general rule to stop the optimizer if the actual window is to small would make sense, but that could checked at the very beginning of the run.
Also, within this block, horizon_extension is assigned the value of really available prices in the extension, while before the if, the var has the configured extension in it. In the else-block, the configured-extension value stays assigned to horizon_extension.
There was a problem hiding this comment.
Shall I try to resolve it in this way:
- when period of fixed_prices <= 10 hours: warning and continue
- when period of fixed_prices <= 5 hours; error and stop
- when "extension" in config > 0: get predicted prices
- when hours of get_predicted_prices < expected: warning
There was a problem hiding this comment.
Sounds good! I don't fully understand how this would work with 15minutes interval, but you undoubtedly have given it your thoughts, so just saying, in case you might have forgotten.
| if self.hp_adjustment == "on/off": | ||
| hp_hours = 0 | ||
| interval_avail = U - boiler_int - 1 | ||
| # interval_avail = U - boiler_int - 1 |
There was a problem hiding this comment.
boiler_int is gone so the solver does not correct for hours the hp produces DHW instead of heating.
There was a problem hiding this comment.
You are right. I fixed this with an update
There was a problem hiding this comment.
fixed: added correction for the heating time
| "x-validation-hint": "Must be > 0, use 1.0 for resistive, 2.5-4.0 for heat pump", | ||
| }, | ||
| ) | ||
| cop_temperature_curve: list[CopTemperaturePoint] = Field( |
There was a problem hiding this comment.
Maybe add validation to check for valid stage configuration? Could be a near copy-paste from the heating validate_stages
There was a problem hiding this comment.
Is indeed the same as with the heatpump, but the boiler has no stages. Only one cop that may change with the outdoor temperature.
I moved the model of CopTemperaturePoint] to the base.py. Now heating and boiler use the same model.
I added the validation in the boiler-model
There was a problem hiding this comment.
added validation in boiler-config
| for u in range(U): | ||
| model += ( | ||
| boiler_temp[u + 1] | ||
| >= boiler_max_temp - M * (1 - boiler_finish[u]) |
There was a problem hiding this comment.
Bij boiler_finish = 0 dwingt deze regel al na het eerste interval boiler_min_temp af, ondanks de soepelere lb bij het aanmaken van boiler_temp. Repro met een elektrische boiler van 1,5 kW, 38 °C gemeten en een ondergrens van 40 °C. Na het eerste kwartier op vol vermogen is ongeveer 39,4 °C haalbaar. Daardoor wordt de hele planning infeasible. Kunnen we bij een start onder de ondergrens direct verwarmen en per interval een haalbare tijdelijke ondergrens gebruiken, zowel bij lb als in deze voorwaarde? Eventueel een scenario/fixture toevoegen om dit te testen.
There was a problem hiding this comment.
Snelle aanpassing aan test case "boiler-below-floor" met "states": {
"sensor.boiler_gemeten": "30"
},
bevestigt bovenstaande.
There was a problem hiding this comment.
Een lege of 0 waarde uit Home assistant leidt ook direct tot een probleem.
There was a problem hiding this comment.
fixed with:
variable boiler_min_temp:
variable boiler_max_temp
big M dependent of boiler-min and boiler_max
| for u in range(U): | ||
| model += ( | ||
| boiler_temp[u + 1] | ||
| >= boiler_max_temp - M * (1 - boiler_finish[u]) |
There was a problem hiding this comment.
Snelle aanpassing aan test case "boiler-below-floor" met "states": {
"sensor.boiler_gemeten": "30"
},
bevestigt bovenstaande.
| for u in range(U): | ||
| model += ( | ||
| boiler_temp[u + 1] | ||
| >= boiler_max_temp - M * (1 - boiler_finish[u]) |
There was a problem hiding this comment.
Een lege of 0 waarde uit Home assistant leidt ook direct tot een probleem.
| + total_low_soc_cost | ||
| + battery_storage | ||
| + boiler_storage | ||
| + boiler_end_value.x |
There was a problem hiding this comment.
in the model at line 3411 it's a minus sign.
| extension=0 | ||
| ) | ||
| if horizon_extension > 0: | ||
| if len(fixed_price_data) > 10 and horizon_extension > 0: |
There was a problem hiding this comment.
Fix would be setting horizon_extension = 0 in the else branch?
|
I'm not following much this PR but it's very important so can someone please ping me once you think it's ready to merge, so I have it reviewed to add another pair of virtual eyes? |
|
By the way, so that you can focus on the infeasible runs: Wrong sign of the boiler term in the cost summary
|
|
@storeman @JoostBaltissen |
| hours_avail = math.floor(interval_avail * self.interval_s / 3600) | ||
| hours_avail = min(48, sum(hour_fraction)) | ||
| if boiler_heated_by_heatpump: | ||
| boiler_heating_hours = math.ceil(boiler_cooling[1] * hours_avail / boiler_heating_rate[1]) |
There was a problem hiding this comment.
Does this fix not also apply if self.hp_adjustment != "on/off"?
| # is boiler_max_temp - boiler_min_temp voldoende als Big-M. | ||
| M = boiler_max_temp - boiler_min_temp | ||
| M = max(boiler_max_temp, boiler_act_temp) - min(boiler_min_temp, boiler_act_temp) | ||
| for u in range(U): |
There was a problem hiding this comment.
boiler_temp[u + 1] is the end of interval u, so the cooling of interval u counts: [:u + 1].
There was a problem hiding this comment.
After second thought: I think you are right:
sum(boiler_cooling[:u+1]) count from 0 up to and including u.
Fixed
|
Since it's getting closer, and most bugs were fixed, the LLM review.
A commented-out line remains N1. New: no plan at all when 5 h or less of day-ahead prices are left (regression vs main)
N2. Minor: heat pump hours capped at 48
Why was it capped at 48, actually? Performance? |

This is a complete rewrite of the boiler part of DAO.
It takes into account the horizon extension and allows more than one reheat action in the planning period.