Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Compilation to fmu

Compilation to fmu

Hi,

I have installed openmodellica via docker image by using:

for deb in deb deb-src; do echo "$deb http://build.openmodelica.org/apt `lsb_release -cs` stable"; done | tee /etc/apt/sources.list.d/openmodelica.list
wget -q http://build.openmodelica.org/apt/openmodelica.asc -O- | apt-key add -
apt update
export DEBIAN_FRONTEND=noninteractive
apt install -y openmodelica

Now, I would like to compile my modelica models (in .mo format) to .fmu (both model exchange and cosimulation). I am afterwards using fmpy python package to run generated fmu's. But, I am facing problems in generation of fmu from .mo. It works fine if I do it via GUI (OMEdit), but would like to make it work via docker. Thanks in advance!

Best,
Anki

Re: Compilation to fmu

In a mos-script, lets say script.mos:

Code:


loadFile("MyModel.mo");getErrorString();
translateModelFMU(MyModel);getErrorString();

You may also need to loadModel(Modelica), etc. But it shouldn't take much more than that. Run the script using "omc script.mos"

Re: Compilation to fmu

Thank you for your reply. I have tried it. But, I am getting segmentation error. I am attaching the screenshot of the segmentation fault. I am attaching my modelica model, test.mos script and docker file here. Hope you can clarify what i am doing wrong. Is there anything wrong in my docker file? Environment variables, users?
Any help would be really appreciated. Thank you in advance!
testopenmodelica.mo

test.mos

Dockerfile.

Re: Compilation to fmu

The attached dockerfile, mo and mos-files produce an FMU for me without any crashes. You could try to install gdb in the docker image and run that on omc. Or maybe running memtest86+ to rule out problems from that.

What Linux kernel is running the image? Maybe bionic is too recent for the running kernel?

Re: Compilation to fmu

I am using this linux kernel: Linux 4.19.76-linuxkit. I have also tried with ubuntu:14.04 instead of bionic, but still experiencing the same issue. I will try with gdb and memtest86+ and would let you know, if I still experience it. But, quite strange that it is working for you but not for me (I am using docker version 2.3.0.2 on a windows machine). Which version of docker and linux kernels are you using?

Thanks!

Re: Compilation to fmu

I am using Ubuntu 18.04, kernel 4.15.0-112-generic, docker 18.03.1-ce

There are 0 guests and 0 other users also viewing this topic
You are here: