fix: separate scenario from Model object and improve update of soil properties - #68
Open
nielsvharten-tennet wants to merge 10 commits into
Conversation
Signed-off-by: Harten-Antuma, Niels van <niels.van.harten-antuma@tennet.eu>
… model Signed-off-by: Harten-Antuma, Niels van <niels.van.harten-antuma@tennet.eu>
… and always update capacity_grid. Signed-off-by: Harten-Antuma, Niels van <niels.van.harten-antuma@tennet.eu>
Signed-off-by: Harten-Antuma, Niels van <niels.van.harten-antuma@tennet.eu>
…compatibility Signed-off-by: Harten-Antuma, Niels van <niels.van.harten-antuma@tennet.eu>
…rio-for-run Signed-off-by: Harten-Antuma, Niels van <niels.van.harten-antuma@tennet.eu>
Signed-off-by: Harten-Antuma, Niels van <niels.van.harten-antuma@tennet.eu>
Signed-off-by: Harten-Antuma, Niels van <niels.van.harten-antuma@tennet.eu>
…lidated internally) Signed-off-by: Harten-Antuma, Niels van <niels.van.harten-antuma@tennet.eu>
Signed-off-by: Harten-Antuma, Niels van <niels.van.harten-antuma@tennet.eu>
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.
Separate scenario from model
Rationale: The model should represent only the static environment and optional persistent configuration. A scenario is execution-specific data and should therefore be supplied per run rather than stored as part of the model state. Keeping
scenarioas a model attribute complicates state management.scenariois now passed as a parameter tomodel.run()and is no longer stored as an attribute ofModel.model.set_scenario()has been removed.scenarioto be passed tomodel.run()may be unvalidated. Scenario validation is done as first step ofmodel.run().temperature_resultis no longer stored as attribute ofModel; it is now part of thesimulation_run.Improve updates of soil properties
cable._update_capacity_grid()now always updatescapacity_gridand no longer checks whether the update is significant. No measurable runtime impact is expected because this operation is not part offinite_difference_matrix_diagonals.cable._update_rho_grid()now accepts either a scalar value or a NumPy array ofrhovalues, enabling more efficient updates fromcable_soil._update_soil_resistivity().cable_soil._update_soil_resistivity()now callsself._update_rho_grid()only once instead of twice. This significantly improves efficiency whensoil_drying=Trueand avoids invalidatingfinite_difference_matrix_diagonalsdue to intermediate partial updates.model_soil._check_if_daily_update_due(). The method obscured update behavior and provided only limited runtime benefits. Runtime impact is expected only for scenarios wheresoil_rhofluctuates by more than 1% within a 24-hour period. Users who wish to avoid per-timestepsoil_rhoupdates should preprocess or resample the input scenario accordingly.