Skip to content

Docker container facilitating compilation of FMU files with embedded source code to JavaScript.

License

Notifications You must be signed in to change notification settings

fmi-tools/Bodylight.js-FMU-Compiler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bodylight.js FMU Compiler

This is a Docker container facilitating compilation of FMU files with embedded source code to JavaScript.

Currently supports FMUs exported from Dymola (with sources) and OpenModelica.

Windows instructions

  1. Install docker

  2. 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.

  1. Build the docker image
docker build -t bodylight.js.fmu.compiler .

This builds the Dockerfile as bodylight.js.fmu.compiler.

Usage

Put a name.fmu file into the input directory and run the following command in PowerShell inside the directory. Taking care to replace name.fmu at the end of the command with the name of your .fmu file.

docker run --rm --mount "type=bind,source=$(Get-Location)\input,target=/input" --mount "type=bind,source=$(Get-Location)\output,target=/output" bodylight.js.fmu.compiler:latest bash worker.sh name.fmu

After the compilation finishes, input/name.fmu is deleted and the resulting name.js file is copied to output. Along with the compilation log name.log.

Linux instructions

  1. Install docker

  2. Clone this repository and cd inside

  3. Build the docker image

docker build -t bodylight.js.fmu.compiler "$(pwd)"

This builds the Dockerfile as bodylight.js.fmu.compiler. You might need to run this command with root privileges.

Automatic compilation

Starting the compiler

docker run -d \
  --name bodylight.js.fmu.compiler \
  --mount type=bind,source="$(pwd)"/input,target=/input \
  --mount type=bind,source="$(pwd)"/output,target=/output \
  --rm bodylight.js.fmu.compiler:latest bash worker.sh

This starts the docker container and binds the input and output directories.

Stopping the compiler

docker stop bodylight.js.fmu.compiler

Usage

Put name.fmu files into the input directory. After the compilation finishes, input/name.fmu is deleted and the resulting name.js file is copied to output. Along with the compilation log name.log.

Files are processed sequentially in alphabetical order.

In case of error, only the compilation log will be present in the output directory.

Manual compilation

Put a name.fmu file into the input directory and run the following command inside the directory. Taking care to replace name.fmu at the end of the command with the name of your .fmu file.

docker run \
  --mount type=bind,source="$(pwd)"/input,target=/input \
  --mount type=bind,source="$(pwd)"/output,target=/output \
  --rm bodylight.js.fmu.compiler:latest bash worker.sh name.fmu

After the compilation finishes, input/name.fmu is deleted and the resulting name.js file is copied to output. Along with the compilation log name.log.

About

Docker container facilitating compilation of FMU files with embedded source code to JavaScript.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 78.3%
  • Shell 20.1%
  • Other 1.6%