Repository navigation
feat: store an edited building as its BuEM blocks - #117
Merged
Merged
Conversation
A host that keeps a building edited in the 3D view needs to write it back to its saved model and reopen it later with the same state. The package gave it no way to do that without losing edits. withEdits folded only type, year, country, floor area, room height and storeys back into the BuildingState that onExit returns. The air change rates, c_m, thermal mass class and attached-neighbours code were dropped, so a host serialising that state reset them to defaults without any error. Going the other way, adaptBuemFeature read none of those fields, and surface names were replaced by generated labels. - toBuemBuilding(state) returns the BuEM building block a run of that building sends. runIdentity is shared with the run and the download, so the two cannot drift. - BuildingState gains an optional parameters field. withEdits writes it and adaptBuemFeature reads it from building.thermal and building.neighbour_status. - generalFrom seeds the editor from a BuildingState. It replaces the two copies in useBuildingModel, one of which ignored the building name when a new building loaded. - The serialiser writes building.name. The reader takes it as the label, and takes an envelope element's name as that surface's label. PV arrays and the battery are not part of the building block. A host keeps technologyState beside it; docs/installing.md says how.
The MILP toggle (general.use_milp) never reached BuEM. The building
run request had no solver field, so every run used BuEM's default
sparse solver whatever the user picked, and a stored building could
not say how it had been simulated.
- BuemBuildingRunRequest gains solver: { use_milp }, filled from the
serialised properties.buem.solver. A host transport forwards it to
BuEM's properties.buem.solver.
- toBuemBuilding becomes toBuem and returns { building, solver }, the
properties.buem shape a host stores and hands back to
adaptBuemFeature.
- BuildingParameters gains use_milp. withEdits writes it and
adaptBuemFeature reads it from properties.buem.solver.use_milp.
Adds toBuem for storing an edited building as its BuEM building and solver blocks, reopened with adaptBuemFeature, and sends the solver choice with each building run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A host that lets users edit a building in the 3D view can now store the edited building and reopen it with the same state.
What changes
toBuem(state)(new export) returns{ building, solver }: the BuEM blocks a run of that building sends. Store it, and reopen by passing it asproperties.buemof a Feature toadaptBuemFeature.c_m, thermal mass class, attached-neighbours code and MILP choice now surviveonExit(withEdits) and reopening (adaptBuemFeature). They used to reset to defaults with no error.BuemBuildingRunRequestgainssolver: { use_milp }. Until now the MILP toggle never reached BuEM. A host transport must forwardsolverto BuEM.PV arrays and the battery are not part of either BuEM block. A host keeps
technologyStatebeside them;docs/installing.mdshows how.Tests
src/app/lib/buemRun.test.tschecks thattoBuemequals what a run sends, that the run request carries the solver, and that storing and reopening gives back the same parameters, surfaces and blocks.npm test88/88,npm run typecheckclean.