Skip to content

Conversation

@FWuellhorst
Copy link
Contributor

Closes #123

@ebc-aixlib-bot
Copy link

Thank you for making a Pull Request to BESMod!

Our CI pipeline will help you finalize your contribution.
Here's what is typically checked:

  • HTML syntax of your models, primarily in your documentation.
  • Adherence to the naming convention in all changed files.
  • Ability to check all models.
  • Ability to simulate all models, if they are examples.
  • If your contribution changes existing reference results.

If HTML errors occur, I will fix the issues using a separate pull request.
For the other checks, I will post the results here: https://rwth-ebc.github.io/BESMod/123_bes-rules/index.html

Tips to fix possible naming violations:

  • Stick to the naming guidelines, e.g. Namespace Requirements
  • Do all paramaters, variables, models, etc. have a description?
  • Use absolute paths to classes! -> BESMod.Fluid.HeatExchangers.Radiator - Avoid: HeatExchangers.Radiator

If all CI stages pass and you have addressed possible naming violations, please consider the following:

  • Use "group" and "tab" annotations to achieve a good visualization window.
  • Use units consistently.
  • Instantiate the replaceable medium package as:
    replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium model";
    instead of using a full media model like BESMod.Media.Water directly.
  • Never using absolute paths to files (e.g., C: or D:). Replace them with modelica://BESMod/....
  • Ensure your documentation is helpful and concise.
  • Make sure icons are clear. Please avoid using images!
  • Stick to 80 characters per line, as long as it makes sense.
  • Add or modify examples for new or revised models.
  • Include a simulate-and-plot script as a regression test for new models.
    How? Follow the documentation here: https://github.com/ibpsa/modelica-ibpsa/wiki/Unit-Tests#how-to-include-models-as-part-of-the-unit-tests
    Tip: To create the initial script, you can use Dymolas script generator, explained here: https://www.claytex.com/tech-blog/how-to-use-a-plot-script/)

Once you have addressed these points, you can assign a reviewer.
Although this process may seem tedious, ensuring CI passes allows the reviewer to focus
their time on the actual modeling rather than syntax and unintended breakages caused by your changes.

If you have any questions or issues, please tag a library developer.
Once again, thank you for your valuable contribution!

Copy link
Contributor

@HvanderStok HvanderStok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making it public. I looked mostly over the aspects I use in my work and the examples. It would be nice if all examples were working. But mostly everything else looks good from my site.

Comment on lines +26 to +33
userProfiles(
fileNameIntGains=Modelica.Utilities.Files.loadResource(
"D:/00_temp/01_bes_rules/UseCase_TBivAndV/influence_user/data/InternalGainsHoliday.txt"),
gain={1,1,1},
use_TSetFile=true,
fileNameTSet=Modelica.Utilities.Files.loadResource(
"D:/00_temp/01_bes_rules/UseCase_TBivAndV/influence_user/data/TSetHoliday.txt"),
use_absIntGai=false));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add these to the Resources or remove them here? Then this example is running.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the models in PVAndHPDesignAndControl Optimization are not needed anymore, or are they? Remove them or add package.mo and add the package to the BESRules package.order.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if I fix the wrong path in MonoenergeticOptiHorst is not translating with the following error:
Failed to generate code for an algebraic loop
involving when equations or algorithms with when parts.
Unknowns:
hydraulic.generation.defCtrl.and1.u1
hydraulic.generation.defCtrl.andDefrost.y
hydraulic.generation.defCtrl.greater.u2
hydraulic.generation.defCtrl.greater.y
hydraulic.generation.defCtrl.orDef.y
hydraulic.generation.defCtrl.timer.entryTime
hydraulic.generation.defCtrl.timer.u
hydraulic.generation.defCtrl.timer.y
hydraulic.generation.heatPump.hys.y
hydraulic.generation.heatPump.refCyc.refCycHeaPumHea.nDTabQUse_flow.u[1]
hydraulic.generation.heatPump.refCyc.swiQEva.u2
hydraulic.generation.heatPump.safCtr.andCanOpe.u[1]
hydraulic.generation.heatPump.safCtr.swiErr.u2

Equations:
when hydraulic.generation.defCtrl.timer.u then
hydraulic.generation.defCtrl.timer.entryTime = time;
end when;
hydraulic.generation.defCtrl.timer.y = (if hydraulic.generation.defCtrl.timer.u then time-hydraulic.generation.defCtrl.timer.entryTime else 0.0);
hydraulic.generation.defCtrl.greater.y = hydraulic.generation.defCtrl.greater.u1 > hydraulic.generation.defCtrl.greater.u2;
hydraulic.generation.defCtrl.orDef.y = hydraulic.generation.defCtrl.orDef.u1 or hydraulic.generation.defCtrl.orDef.u2;
hydraulic.generation.defCtrl.and1.y = hydraulic.generation.defCtrl.and1.u1 and hydraulic.generation.defCtrl.and1.u2;
hydraulic.generation.defCtrl.andDefrost.y = hydraulic.generation.defCtrl.andDefrost.u1 and hydraulic.generation.defCtrl.andDefrost.u2;
hydraulic.generation.defCtrl.notHea.y = not hydraulic.generation.defCtrl.notHea.u;
hydraulic.generation.defCtrl.swi.y = (if hydraulic.control.priGenPIDCtrl.isOn then hydraulic.generation.defCtrl.swi.u1 else 1E+60);
hydraulic.generation.defCtrl.andIsOn.y = hydraulic.control.priGenPIDCtrl.isOn and hydraulic.generation.defCtrl.andIsOn.u2;
hydraulic.generation.heatPump.safCtr.swiErr.y = (if hydraulic.generation.heatPump.safCtr.swiErr.u2 then hydraulic.generation.heatPump.safCtr.swiErr.u1 else 0.0);
hydraulic.generation.heatPump.safCtr.andCanOpe.y = Modelica.Math.BooleanVectors.andTrue (hydraulic.generation.heatPump.safCtr.andCanOpe.u);
hydraulic.generation.heatPump.hys.y = not pre(hydraulic.generation.heatPump.hys.y) and hydraulic.generation.heatPump.hys.u > hydraulic.generation.heatPump.hys.uHigh or pre(hydraulic.generation.heatPump.hys.y) and hydraulic.generation.heatPump.hys.u >= 0.001;
hydraulic.generation.heatPump.safCtr.opeEnv.swiHeaCoo.y = (if hydraulic.generation.heatPump.safCtr.opeEnv.swiHeaCoo.u2 then hydraulic.generation.heatPump.safCtr.opeEnv.swiHeaCoo.u1 else hydraulic.generation.heatPump.safCtr.opeEnv.swiHeaCoo.u3);

You may be able to cut the loop
by putting 'pre' around some of the references to
unknown continuous time variables in when parts or when conditions.

Translation aborted.

WARNINGS have been issued.

ERRORS have been issued.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these tests work? They are not running.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these tests work? They are not running.

Comment on lines +284 to +297
INPUT_CONFIG = "TRY2015_541817120824_Jahr_B1918_standard_o0w2r1g0_SingleDwelling_M_0K-Per-IntGai"
INPUT_CONFIG = "TRY2045_474856110632_Somm_B2001_standard_o2w2r2g2_SingleDwelling_M_0K-Per-IntGai"

BASE = RESULTS_FOLDER.joinpath("UseCase_TBivAndV", "influence_heat_transfer_januar", "DesignOptimizationResults")
for M in [
"HeatTransferOnlyConduction",
"HeatTransferLambdaEffSmooth",
"HeatTransferBuoyancyWetter",
]:
for N in ["_NLayer", ""]:
for STO in [0, 3]:
for SCALE in [False, True]:
map_besmod_to_plot_function(
mat_file=BASE.joinpath(f"{INPUT_CONFIG}_{M}{N}", f"iterate_{STO}.mat"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are these results generated?

Comment on lines +14 to +19
buildings_per_year = boundary_conditions.building.get_all_tabula_sfh_buildings(as_dict=True)
if years_of_construction is None:
years_of_construction = buildings_per_year.keys()
buildings_to_simulate = [
buildings_per_year[f"{year}_standard"] for year in years_of_construction
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the dict buildings_per_year is used as in compare_onoff an error occurs because the keys already include "_standard".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the following error here:

pydantic_core._pydantic_core.ValidationError: 3 validation errors for configuration of agent 'mpc' / module 'mpc':
enable_deactivate_mpc
  Input should be a valid Field name. Field 'enable_deactivate_mpc' does not exist. Did you mean any of ['states', 'time_step', 'type', 'module_id', 'validate_incoming_values']? [type=literal_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.12/v/literal_error
control_values_when_deactivated
  Input should be a valid Field name. Field 'control_values_when_deactivated' does not exist. Did you mean any of ['controls', 'states', 'type', 'time_step', 'validate_incoming_values']? [type=literal_error, input_value={'TBufSet': 303.15, 'yVal... 'actExtBufCtrl': False}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.12/v/literal_error
outputs_to_send_when_activated
  Input should be a valid Field name. Field 'outputs_to_send_when_activated' does not exist. Did you mean any of ['outputs', 'set_outputs', 'inputs', 'states', 'type']? [type=literal_error, input_value={'actExtVal': True, 'actE..., 'actExtBufCtrl': True}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.12/v/literal_error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add BESRules

5 participants