Skip to content

Update test cases to Modelica 4.0 and compilation toolchain#799

Open
EttoreZ wants to merge 77 commits intomasterfrom
issue422_om_msl4
Open

Update test cases to Modelica 4.0 and compilation toolchain#799
EttoreZ wants to merge 77 commits intomasterfrom
issue422_om_msl4

Conversation

@EttoreZ
Copy link
Copy Markdown
Contributor

@EttoreZ EttoreZ commented Oct 9, 2025

This PR refers to various issues #422, #539, #612, #775, #791, #800, #802, and #806 is meant to:

  1. Update (BESTEST Air, BESTEST Hydronic, BESTEST Hydronic Heat Pump, Single Zone Commercial Hydronic
    Two Zone Apartment Hydronic, Multizone Residential Hydronic, Multizone Office Simple Air Modelica Models) cases to Modelica 4.0 and newer version of the libraries.
  2. Update test cases FMUs to Dymola FMUs using the latest models.
  3. Add the possibility to compile test cases with OpenModelica.
  4. Streamline compilation OpenModelica using Docker containers inheriting from worker container to ensure FMUs are compiled in running enviroment.
  5. Update unit tests to remove JModelica compilation and add OpenModelica for some test cases.

Below is reported a list to dos to finalize this PR:

Test cases update

  • Update test cases Modelica code to Modelica 4.0.
  • Update test cases utility files (compile_fmu.py, library_version.json, etc..).
    • compile_fmu.py
    • library_version.json
  • Export FMUs using Dymola.
  • Compare scenarios results with previous models.
  • Compare scenarios results with OpenModelica and Dymola.

Compilation toolchain

  • Remove JModelica from compilation options (Dockerfile, Makefile).
  • Create Dockerfile for OpenModelica.
  • Update makefile compilation commands to execute with Dymola.
  • Update makefile compilation commands to execute with OpenModelica.
  • Test compilation functionality with all test cases with Dymola.
  • Test compilation functionality with all test cases with OpenModelica.

Unit test update

  • Update makefile to remove compilation for most test cases, only keep example with OpenModelica.
  • Update all unit tests results.

Misc

  • compile_fmu.py tool argument in parser.export_fmu(tool) should be made into a input argument to allow flexibility in the makefile. Furthermore, optional arguments solver and tolerance should be properly handled by the parser depending on the tool with warnings and errors.
  • OpenModelica does not support break statements (in theory by the end of 2025). IDEAS uses them and breaks compilation (also with Ubuntu 20.0, current worker OS, we can use up to OM 1.21). Workaround is to use custom branch for compilation for now.
  • Add multizone_office_complex_air points to compare_references.py script.
  • Update all READMEs

Copy link
Copy Markdown
Collaborator

@dhblum dhblum left a comment

Choose a reason for hiding this comment

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

@EttoreZ Thanks for this PR. Please see my inline comments and address? This does not yet finish my review, but it will let you start addressing a few things.

Comment thread testing/makefile
Comment thread parsing/parser.py Outdated
Comment thread parsing/parser.py Outdated
Comment thread testing/test_data.py
from data.find_days import find_days

testing_root_dir = os.path.join(utilities.get_root_path(), 'testing')
testing_root_dir = os.path.join(utilities.get_root_path())
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why remove "testing" from testing_root_dir and then add in back in all the subsequent lines that use testing_root_dir? Just don't want to make changes if don't have to.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is due to new OM container pathing being different, so testing is added to the reference, while scripts are executed from parent folder.

Comment thread testing/test_parser.py
Comment thread .travis.yml Outdated
Comment thread .travis.yml Outdated
Comment thread .travis.yml Outdated
Comment thread data/find_days.py
Comment thread testing/makefile Outdated
Copy link
Copy Markdown
Collaborator

@dhblum dhblum left a comment

Choose a reason for hiding this comment

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

@EttoreZ I added some additional review comments and questions.

Comment thread parsing/parser.py
Comment thread parsing/parser.py
Comment thread testcases/bestest_air/models/compile_fmu.py Outdated
Comment thread testcases/bestest_hydronic/models/compile_fmu.py Outdated
Comment thread parsing/parser.py Outdated
Comment thread parsing/parser.py Outdated
Comment thread parsing/parser.py Outdated
Comment thread parsing/parser.py
@ibpsa ibpsa deleted a comment from Ye-Chuang Mar 17, 2026
Comment thread testing/makefile
@echo "Usage: make build_compiler_image VERSION=<x.x.x>"
@echo ""
@echo "Options:"
@echo " VERSION=<1.21.1> - OpenModelica version"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Lines 15 and 18 indicate the VERSION argument needs < >, but lines 4 and 21 don't use <>. @EttoreZ Can you clarify/fix what the argument needs to include?

This module compiles the defined test case model into an FMU using the
BOPTEST parser.

The tool cli argument is the FMU compilation tool. "OCT" or "dymola" or "openmodelica" supported.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@EttoreZ Is this true? If tool = openmodelica in the command line, algorithm is still hardcoded as 'Cvode' so I don't think export_fmu will work. I think it makes sense to make the algorithm argument in export_fmu as a sys arg also, agree?

Comment thread .travis.yml
- python: 3.9
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 requests==2.25.1
script: cd testing && make build_jm_image && make test_testcase2
script: cd testing && make test_testcase2
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@EttoreZ Does testcase2 fmu compilation work with openmodelica? If not, then _no_compile is needed here. Otherwise, build_compiler_image is needed here.

&& . miniconda/bin/activate \
&& conda update -n base -c defaults conda \
&& conda activate pyfmi3 \
&& python -m pip install -U https://github.com/OpenModelica/OMPython/archive/master.zip
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would better to tag this to a version of OMPython rather than use the master so that we make updates in the version we use explicit.

@@ -1 +1 @@
{"peak_heat_day": 23, "typical_heat_day": 115}
{"peak_heat_day": 27, "typical_heat_day": 58} No newline at end of file
Copy link
Copy Markdown
Collaborator

@dhblum dhblum Apr 9, 2026

Choose a reason for hiding this comment

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

Realizing do we need to update the days.json for all the models that had significant model changes? For example twozone_apartment_hydronic. I don't see changes in the PR for those. Will need to change days.json and documentation of scenarios.

annotation (Placement(transformation(extent={{70,130},{90,150}})));
Modelica.Blocks.Math.Gain fanGai(k=mAir_flow_nominal) "Fan gain"
annotation (Placement(transformation(extent={{-40,-50},{-20,-30}})));
Buildings.Fluid.Movers.FlowControlled_m_flow fan(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@EttoreZ to change this model to use pre-configured mover model from Buildings 12.1.0.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants