Buildings stock and heat demand migration - #1796
Conversation
67e57e6 to
5a8cb51
Compare
There was a problem hiding this comment.
Virtually this file causes no changes. It looks like this because Rails 8 now sorts fields alphabetically, and it did so when I ran the migration (it also adds a header comment explaining the file's purpose). The columns and indexes are identical. The only real addition is the explicit utf8mb4_0900_ai_ci collation, which is our MySQL 8 default and has no effect on a table with binary key/value columns (queue_schema.rb already has it).
Even though this change adds nothing, I think it's better to commit it once and for all rather than discard it, so we don't keep running into it every time we run a migration.
kndehaan
left a comment
There was a problem hiding this comment.
Overall, the migration is looking good! I have a three required changes, see listed below. Note that these changes requests also apply to the migration in the households sector.
1. Design change of insulation sliders
We decided that the insulation sliders (buildings_insulation_existing_buildings and buildings_insulation_new_buildings) will be set as a positive value instead of a negative value. So instead of "my heat demand changes with -5% due to improved insulation", it's rather "my heat demand reduces with 5% due to improved insulation". Could you process this in the migration as well?
2. Omit behaviour slider from migration
We discussed that overall it's quite tricky to set the behaviour slider based on the old sliders since it conceptually difficult to distinguish insulation and behavioural effects. Therefore, the behaviour slider can be left out of the migration. If a reduction in kWh/m2 was set, set the reduction in the insulation sliders. If an increase was set, do nothing. This effect will be lost in the new scenarios.
3. Apply rounding
Could we apply rounding of the values for the new inputs that is in line with the step_value of the input? Some inputs are currently set with a lot of decimals, see screenshot below, which doesn't look so neat. This would mean rounding to:
- 0 decimals for
buildings_number_of_buildings_demolishedandbuildings_number_of_buildings_new - 1 decimal for
buildings_insulation_existing_buildingsandbuildings_insulation_new_buildings
|
These changees sound good:
|
- Insulation is written as a positive reduction rather than a negative change. - The behaviour input is no longer set, so a demand increase above the default is dropped rather than carried over, which also removes the demand weighting the shared behaviour input needed (big simplification). - Values are rounded to the step value of their own input.
Every other migration in db/migrate deletes the keys of inputs that etsource has removed as soon as it processes a scenario; only the unknown-area guard stops it. This one returned before the delete when the area had no typical demand, leaving the scenario holding a key for an input that no longer exists.
Context
The sliders/inputs for the Buildings stock and heat demand are changing and therefore they need a migration to go along.
Implemented changes
db/migrate/20260804120000_simplified_buildings_heat_inputs.rbdb/schema.rb(And Rails 8 alphabetical order)db/cache_schema.rb(Only Rails 8 alphabetical order)Related
The etsource and etmodel changes are still a work in progress but this migration should never land (aka be merged to beta or pro) before the etsource changes do!
Checklist