Sunday, March 26, 2023

OpenModelica on Mac using Docker -- command line and GUI

"Modelica is a non-proprietary, object-oriented, equation based language to conveniently model complex physical systems."

(source)

"Modelica is the language for solving systems of ordinary differential, algebraic, continuous, and discrete equations."

(source)

https://modelica.org/tools.html
https://openmodelica.org/

Source code: https://github.com/OpenModelica/OpenModelica

Running Modelica using Docker

In a terminal on your Mac, run:

ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}') 
Xhost +$ip 
docker run -it -v ~/.Xauthority:/root/.Xauthority -e DISPLAY=$ip:0  openmodelica/openmodelica:v1.20.0-gui /bin/bash
Source: Docker instructions, which also had the commands for linux:
docker run -it --rm -e "HOME=$HOME" -e "DISPLAY=$DISPLAY" --network=host --user "$UID" -v "$HOME:$HOME" -v "$PWD:$PWD" -w "$PWD" openmodelica/openmodelica:v1.20.0-gui
From https://openmodelica.org/useresresources/userdocumentation/ see https://openmodelica.org/doc/OpenModelicaUsersGuide/OpenModelicaUsersGuide-latest.pdf After launching the Docker container, in the command prompt I ran
root@54d835361dc8:/# OMShell-terminal
OMShell Copyright 1997-2022, Open Source Modelica Consortium (OSMC)
Distributed under OMSC-PL and GPL, see www.openmodelica.org

To get help on using OMShell and OpenModelica, type "help()" and press enter
Set shortOutput flag: true

>>> x := 1:12
{1,2,3,4,5,6,7,8,9,10,11,12}

>>> quit()
I launched the GUI using
# OMEdit 
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

On Mac using XQuartz I see


Questions: https://stackoverflow.com/questions/tagged/openmodelica


Comment threads:

No comments:

Post a Comment