Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade OpenModelica #641

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions geojson_modelica_translator/modelica/lib/runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@ RUN apt update && apt --no-install-recommends install -y \
gfortran \
libpython3-dev \
curl \
cmake \
&& rm -rf /var/lib/apt/lists/*

# Duplicating code from OM Dockerfile: https://github.com/OpenModelica/OpenModelicaDockerImages/blob/v1.22.1/Dockerfile
# This allows us to use a different Ubuntu version than the OM Dockerfile
# tests/GMT_Lib/test_gmt_lib_des.py fails with jammy, works with focal.
ARG VERSION=1.22.1
ARG OM_VERSION=1.24.0

RUN export DEBIAN_FRONTEND="noninteractive" && echo "VERSION: $VERSION" && test ! -z "$VERSION" && apt update && apt upgrade -qy && apt dist-upgrade -qy \
RUN export DEBIAN_FRONTEND="noninteractive" && echo "OM VERSION: $OM_VERSION" && test ! -z "$OM_VERSION" && apt update && apt upgrade -qy && apt dist-upgrade -qy \
&& apt install -qy gnupg wget ca-certificates apt-transport-https \
&& echo "deb https://build.openmodelica.org/omc/builds/linux/releases/$VERSION/ `cat /etc/lsb-release | grep CODENAME | cut -d= -f2` release" > /etc/apt/sources.list.d/openmodelica.list \
&& echo "deb https://build.openmodelica.org/omc/builds/linux/releases/$OM_VERSION/ `cat /etc/lsb-release | grep CODENAME | cut -d= -f2` release" > /etc/apt/sources.list.d/openmodelica.list \
&& wget -q https://build.openmodelica.org/apt/openmodelica.asc \
&& apt-key add openmodelica.asc \
&& rm openmodelica.asc \
&& apt update && apt upgrade && apt dist-upgrade \
&& apt install --no-install-recommends -qy omc \
&& apt install --no-install-recommends -qy omc cmake \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
10 changes: 8 additions & 2 deletions geojson_modelica_translator/modelica/lib/runner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,33 @@
## Building and Pushing Docker Container

The OpenModelica docker container provides compilation and simulation capabilities without needing to install OpenModelica on a client computer. The container
includes Modelica Standards Library and a version of the Modelica Buildings Library. The table below shows the versions fo the dependencies.
includes Modelica Standards Library and a version of the Modelica Buildings Library. The table below shows the versions of the dependencies.

The GMT requires a locally built image or a version from Docker hub to run tests. The public use image is hosted on [Docker hub](https://hub.docker.com/r/nrel/gmt-om-runner).

To build the docker container locally, follow the below instructions:

1. If on the NREL network:
- Disable Netskope temporarily
- Disconnect from VPN
2. Then:

```bash
# <from gmt root directory>
cd geojson_modelica_translator/modelica/lib/runner

docker build -t nrel/gmt-om-runner:latest .
```

The default tag will be `nrel/gmt-om-runner:v2.0.1`, which is the default version used in the modelica_runner.py file.
The default tag will be `nrel/gmt-om-runner:v2.1.0`, which is the default version used in the modelica_runner.py file.

### Versioning

In GMT Runner Version 2.0.0 we detached the OM version from the GMT Runner version.

| GTM Runner Version | OM Version | MSL Version | MBL Version |
| ------------------ | ---------- | ----------- | ----------- |
| 2.1.0 | 1.24.0 | 4.0.0 | 10.0.0 |
| 2.0.1 | 1.22.1 | 4.0.0 | 10.0.0 |
| 2.0.0 | 1.22.1 | 4.0.0 | 10.0.0 |
| 1.22.1 | 1.22.1 | 4.0.0 | 9.1.1 |
Expand Down
2 changes: 1 addition & 1 deletion geojson_modelica_translator/modelica/modelica_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _subprocess_call_to_docker(self, run_path: Path, action: str) -> int:
os.chdir(run_path)
stdout_log = open("stdout.log", "w") # noqa: SIM115
model_name = run_path.parts[-1]
image_name = "nrel/gmt-om-runner:v2.0.1"
image_name = "nrel/gmt-om-runner:2.1.0"
mo_script = "compile_fmu" if action == "compile" else "simulate"
try:
# create the command to call the open modelica compiler inside the docker image
Expand Down
Loading