This is a docker container with OpenModelica compiler, which produces Bodylight.js compatible FMU files
-
Install docker
-
Download this repository and open PowerShell in the top directory
If you decide to clone this repository, take care to disable automatic line ending conversion in git.
- Build the docker image
docker build -t bodylight.js.om.compiler .- Put required Modelica libraries into the
librariesfolder. The name of the folder specifies the name of the library to load. The compiler looks for apackage.mofile inside thelibraries\library\folder. - The
inputdirectory accepts a single filename.mowherenameis the name of the model for compilation. In case of error, only the compilation log will be present in the output directory. - Run the following command in PowerShell inside the directory, take care to replace
name.moat the end of the command with your filename.
docker run --rm --mount "type=bind,source=$(Get-Location)\input,target=/input" --mount "type=bind,source=$(Get-Location)\output,target=/output" bodylight.js.om.compiler:latest bash worker.sh name.moAfter the compilation finishes, input/name.mo is deleted and the resulting name.fmu file is copied to the output directory, along with the compilation log name.log
- Install docker
- Clone this repository and cd inside
- Build the docker image
docker build -t bodylight.js.om.compiler "$(pwd)"This builds the Dockerfile as bodylight.js.om.compiler. You might need to run this command with root privileges.
docker run -d \
--name bodylight.js.om.compiler \
--mount type=bind,source="$(pwd)"/libraries,target=/libraries \
--mount type=bind,source="$(pwd)"/input,target=/input \
--mount type=bind,source="$(pwd)"/output,target=/output \
--rm bodylight.js.om.compiler:latest bash worker.shThis starts the docker container and binds the input, output and libraries directories.
docker stop bodylight.js.om.compiler- Put required Modelica libraries into the
librariesfolder. The name of the folder specifies the name of the library to load. The compiler looks for apackage.mofile inside thelibraries\library\folder. - The
inputdirectory accepts a single filename.mowherenameis the name of the model for compilation. Files are processed sequentially in alphabetical order. In case of error, only the compilation log will be present in the output directory.