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
  • Index
  • » Users
  • »
  • » Profile



Aug-04-22 09:00:09
Error by running openmodelica on raspberry pi 3

Hassani22 wrote:

I wanted to install openmodelica on raspberry so that I could generate the fmu. but the problem that I can't install openmodelica on raspberry.
the error message I got:"Could not find package openlmodelica."

so I would like to know is there a possibility to install openmodelica on raspberry PI3.
If yes, how i do this.

thank you.

Did you follow the instructions to add the repository to apt so it could be found? If so, make sure to not make the typo above: openlmodelica = openmodelica

Aug-01-22 10:33:07
Add vanilla instructions for how to get OMEdit working under Mac from the Docker images that are...

For Linux, I would often run something like:


 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.18.0-gui

So the home directory is not filled with root-owned files.

Jul-01-22 09:17:18
Error by running openmodelica on raspberry pi 3

What architecture FMU did you try to import? What's the error message?

Which version of omc was this? And what does


ls ~/.openmodelica/libraries


It might also be that packages such as omlib-modelicareference need to be uninstalled in order for that to work.

We have started using our own package manager instead. You can install 1.16 with the --nodeps flag. I would also suggest installing the nightly and using the package manager from that to install the Modelica packages you need (either through command-line or OMEdit).

I will remove the omlib-all dependency from the spec-file since only Fedora has it as a suggests dependency and it's a hard dependency in RHEL.

May-06-22 13:58:41
OMPython store and load built models

TULU wrote:

The exe remains there but I do not know how to call it without building the model again.
How would this be done?

I tried with FMUs but they are much slower...

In Linux, you just call the executable. For Windows... You're better off running it through WSL than trying to figure out how to modify the PATH (although I guess someone will tell you how)

Apr-22-22 08:57:48
Category: Developer

278067605 wrote: wrote:

278067605 wrote:

i want to use dlls to use it ,it will be a part of my project

If you want to use it as a DLL, your whole project needs to become GPL-licensed though. You can see how OMEdit uses the OMC DLL if you want an example of how to use it in that way.

hi,if i want to use omc via  ZMQ or Corba what should i do?

For ZMQ/CORBA it depends on what language you are using. If it's a Python application, using OMPython is very simple. Otherwise, it's just starting the omc.exe with some flags:


$ omc --interactive=zmq --locale=C -z=myrandomstring

Created ZeroMQ Server.
Dumped server port in file: /tmp/openmodelica.martin.port.myrandomstring

and then reading that file for the settings to use in your ZMQ library to connect to the running server.

Apr-21-22 08:54:42
Category: Developer

278067605 wrote:

i want to use dlls to use it ,it will be a part of my project

If you want to use it as a DLL, your whole project needs to become GPL-licensed though. You can see how OMEdit uses the OMC DLL if you want an example of how to use it in that way.

Mar-28-22 06:27:11
How to start simulations from previously stored result file

You can use "Equation System Initialization File" and Initialization Method "none" to restart simulation with some values from a result-file to chain simulations.

But if you use an external state (external functions, external objects), delay functions, spatialDistribution or perhaps if you use a lot of events and need to preserve pre-values/etc, you might get some unexpected results.

You should have the license text somewhere in the documentation. I'm not sure it fits in the Python code itself. If it was me, I would put it in a COPYING or file (and mark which files fall under that license).

You are probably interested in the FMI export from OMEdit. See also:

If you cannot apt install clang, something is very broken indeed. Maybe you need to apt autoremove openmodelica followed by apt dist-upgrade or maybe you need to apt install --fix-broken first.

You need to apt install omc or something in this list to see why apt fails. It doesn't always produce very good error-messages

Are you using OMEdit? Tools -> Options -> Libraries can select MSL version (or removing it and loading the version expected by whatever library you want to open).

mahge wrote:

> I think the weird part is looking in /omc/ffi. The ffi directory doesn't exist for me. What OMC version was this on Linux?

What version of omc do you have? If it is not a nightly build from a few days back the omc/ffi directory should not be there. Otherwise it should.

If it is missing for Youth then it is probably the package not including everything in /lib/x86_64-linux-gnu/omc/. Maybe it is including only /lib/x86_64-linux-gnu/*.a and /lib/x86_64-linux-gnu/*.so?

I did upgrade today, but maybe I forgot to use /usr/bin/omc. If you change any file installed, you need to update the installer or you will break everyone's Linux install... … ter/debian

I think the weird part is looking in /omc/ffi. The ffi directory doesn't exist for me. What OMC version was this on Linux?

Feb-11-22 14:33:08
OMEdit quits upon startup splash screen after "creating widgets" stage

You could also run a conversion script from TransiEnt 1.3.0 to 2.0.0: … _2.0.0.mos

No, that won't work because the flat code is not valid Modelica and only top-level inputs are inputs to the system. Any blocks with inputs must be used or connected.

You can override top-level inputs as well. If you want to connect them, they need to not be parameters. If you want them to be parameters, don't make them connectors (just Real, and write an equation instead of the connection).

If you check the flat code it should be easy to see the error:


class sumDummy

  parameter input Real var1;
  parameter input Real var2;
  output Real y;
  Real add.u1 "Connector of Real input signal 1";
  Real add.u2 "Connector of Real input signal 2";
  Real add.y "Connector of Real output signal";
  parameter Real add.k1 = 1.0 "Gain of input signal 1";
  parameter Real add.k2 = 1.0 "Gain of input signal 2";
  assert(abs(var1 - add.u1) <= 0.0, "Connected constants/parameters must be equal");
  assert(abs(var2 - add.u2) <= 0.0, "Connected constants/parameters must be equal");
  add.y = y;
  add.y = add.k1 * add.u1 + add.k2 * add.u2;
end sumDummy;

Because var1 and var2 are parameters, connecting them adds assertions instead of alias equations. Remove the parameter keyword from them and the model works.

Dec-23-21 17:06:06
static glib_c dependencies in FMU

You can use docker to force an older Linux distribution to be used for compiling the source-code. If you are using the nightly builds, OMEdit should have improved options for selecting a docker image.

Dec-16-21 05:17:52
Says expired certificate when doing the apt update step of the Linux install on Focal (Ubuntu...

I think most people press the upgrade button so the system will be up to date, but it takes some time before a new install is upgraded. New installs should have the newer ca-certificates package unless you have an older focal USB-stick, etc.

I would run it with "docker run -it ..." and then start OMEdit from inside. Then there's a chance to look at logs, etc

It looks like the models are included in the appendix. Seems like a bad way to distribute libraries and I couldn't find a copy of the actual code online...

Dec-15-21 05:00:35
Says expired certificate when doing the apt update step of the Linux install on Focal (Ubuntu...

You need to update the ca-certificates package

Nov-29-21 06:53:34
Category: Developer

Yes, we don't run the testsuite when building our packages. So flex is not listed as a dependency.

On WSL, I can do this since the xserver knows the IP:


docker run -v /home:/home -it --rm --user 1000 -e DISPLAY=$DISPLAY -e HOME=$HOME -w "$PWD" openmodelica/openmodelica:v1.18.0-gui OMEdit

You can also add --network=host to avoid some xauth problems. It's much easier when everything is local.

Nov-25-21 15:18:09
Category: Developer

This question appears quite often. Debian Testing is not a suitable target for packages since it allows major changes (including libc) for more than 1 more year. Once it gets closer to the soft freeze (2023), building packages makes more sense as they have a chance of working.

Docker works quite well though.

Nov-02-21 10:22:46
I don’t know where to download and install it in openmodelica

Arinomo23 wrote:

thanks @sjoelund,  i'm not aware of this change,so my reply was based on V1.18.

On the side note: How does this effect user w/o an internet connection? I assume, it was down to make it easier for user to mange package based on its version on github etc?

It's possible to copy a cache folder (of zip-files) and the index.json file to a local computer and install through that (or copying .openmodelica/libraries/ from one computer to another). But yes, you will need an internet connection to download packages in the first place. It doesn't make sense to wait 40 minutes for the slow Windows filesystem to install several gigabytes of packages that you don't need and didn't change since the last OM install. And it doesn't make much sense for OpenModelica to package everyone's libraries when the package manager can be used to download directly from the source.

Edit: And it's now possible to install different versions of a package (like the latest master of a package if you need that, or an older release of a package if you need that).

Nov-02-21 09:37:35
I don’t know where to download and install it in openmodelica

Note that the latest OM nightly comes with a package manager instead of a fixed set of pre-installed libraries. In OMEdit, File -> Install Library

Oct-28-21 18:53:06
Category: Programming … rview.html … aryTesting

You need to run this on Linux. You can use reference result files to verify that the simulation generates expected trajectories

You need to make the input not be a constant or OMC evaluates the function at compile-time. If you pass x*time to square, the results are printed.

Did you sudo apt install omsimulator?

(I will add it to the openmodelica meta-package for 1.19.0, but for 1.18.0 it's not included)

Sep-27-21 05:33:02
Trying to setup a dynamic Simulation model
Category: Programming

If these are parameters, passing them is easy: just list all scalar variables and the corresponding values in an overrideFile: … erridefile

nimoror wrote:

Maybe it would be possible to store the packages and models in individual code files to give a better overview?

AnHeuermann wrote:

So for developing your own library you can save libraries in multiple files (In OMEdit: File->New->New Modelica Class; a dialog opens where you choose package and uncheck "Save contents in one file"), have packages in packages and with that getting a well structured system of .mo-files you can work with.

Also, look at the structure of the Buildings library: … /Buildings

Over 3000 files to store the package.

It uses OPENMODELICALIBRARY, which by default will be nothing and then we grab libraries from the installation directory + your home directory. In the Modelica specification, MODELICAPATH is used as a concept, but in order to avoid clashes with other tools we don't use that as env.var.

Tools -> Options -> Libraries you can set libraries to launch on startup.
Otherwise you could load a model with uses-annotations on each of the libraries, which would load them all automatically provided they are on the MODELICAPATH or the model is in the same directory as all of the libraries.

Aug-17-21 18:10:57
OMEdit partially ran model and then process crashed

The simulations don't use exit codes other than 0, 1, -1. Any other exit code comes from the OS itself.

Aug-12-21 12:31:15
Problem in simulating FMUs using new frontend.

rasc5 wrote:

What if the reinit is inside an Algorithm part?
OMPython is not allowing me to load a Model I built from scratch having this struct. I can run it perfectly in OpenModelica but not from Python (3.8).
Any ideas why?
Thank you in advance

reinit is only allowed in equations: … tml#reinit

Jul-28-21 19:53:01
Mac support

The Mac we had for the builds died. It should still be possible to compile OpenModelica.
We used to run an older OSX version and MacOS/XCode versions don't have good backwards and forwards compatibility, so you might need to create some patches though.

(Judging by how well MacOS is designed, I'm surprised NIST allows it on machines at all. The M1 is very good hardware though. For what it's worth, future Windows versions of OpenModelica might run on WSL since it runs a lot faster than native Windows versions.)

Jul-02-21 19:18:08

Did you git clone --recursive or did you forget to update git submodules?

If you have it built, the symlink or just launching OMEdit directly from the directory should work. If there is a problem, you need to use ldd to figure out what is going wrong. Perhaps


find build -name "*.so*"

would be helpful, too.

That trace suggested everything worked fine, right? Was the exit-status not 0?

Jun-21-21 11:51:13
Compiler error when simulating a tank system

So with no changes to Modelica.Fluid.Examples.Tanks.TanksWithOverflow ?

Jun-21-21 10:43:31
Compiler error when simulating a tank system

We won't be able to tell if it's going to work or not without an example model. OM 1.16.5 allowed a lot of invalid code that has now been resolved in the newer OM versions. In newer versions you can still change to the old frontend for old behaviour, but this will probably disappear in the future.

If it says skipping incompatible it probably means the dll is a 32-bit dll and you need a 64-bit version (or installing 32-bit OpenModelica instead).

You'd still need to find a 64-bit DLL, right?

That error is because ModelicaADS only comes with that library for 32-bit Windows: … rary/win32

Jun-08-21 18:56:15
Question regarding FMU specification

I think you'd be better off with a solver that converges quicker. Runge-Kutta isn't very complicated. Reducing the communication could help, but then try to profile it so you know that this is the case before you implement the change.

Jun-07-21 12:53:30
Problem in simulating FMUs using new frontend.

Well, you could use the command setCommandLineOptions("-d=-newInst") through OMPython. But a better solution would be to fix the code since it is not legal Modelica code.

The FMU itself doesn't have a timestep. The importing tool decides the time step to take. If that is successful or not is reported by the FMU.

May-31-21 09:17:11
Category: Developer

Hmm.... All of our source entries seem to be empty. I wonder when that happened. Probably when the OS was upgraded a month or so ago.

The control file is here: … an/control
And you can create a package for the dependencies: … ntrol-file

I'm not sure when we would have time to fix this.

May-31-21 08:52:49
Category: Developer

Which deb-src lines does your system use?

Tools -> OMC CLI for accessing in the GUI

Or look for logs in your tmp-directory (on Linux: /tmp/OpenModelica_$USER/OMEdit/)

You can look into OMEdit's logs to see which commands it uses. Some of these commands work out of the box in OMPython, some need to be called with parsed=False as far as I remember.

_omcQ_24cse2 would be a variable called $cse2 (which is introduced by OpenModelica). So most likely a tool bug:

adrpo wrote:

What you want seems to be like starting the same model with different T0 in a for loop. If this is what you want let us know and we'll give you some solutions for that.

Having an array instead would probably be the easiest way of doing that.


  for ... loop
    T := ...;

Apr-22-21 04:58:47
Question about how der() operator calculates the derivative
Category: Programming

The closest match would be adding a solver for a discrete (clocked) system: … er-methods

Apr-21-21 14:32:34
Question about how der() operator calculates the derivative
Category: Programming … unc_annos/

Regarding the derivative, dassl will probably want the derivative of der(y) to create its polynomials.
For inlining, OpenModelica will not inline complicated functions even if you add the annotation.

Apr-21-21 13:43:00
Question about how der() operator calculates the derivative
Category: Programming

If you have a function call like that, I assume you don't have a derivative or inline annotation. If that's the case, a numerical Jacobian will be calculated instead of a symbolic one. This will be somewhat slower as you experience.

Apr-21-21 12:22:44
Question about how der() operator calculates the derivative
Category: Programming

As far as I remember if you are using dassl, it internally has some polynomial expression for what the derivative is estimated to be at each point. You won't be able to reconstruct the actual values from the derivatives alone.

If you change solver to Euler you should have better luck.

Apr-21-21 12:22:43
Question about how der() operator calculates the derivative
Category: Programming

As far as I remember if you are using dassl, it internally has some polynomial expression for what the derivative is estimated to be at each point. You won't be able to reconstruct the actual values from the derivatives alone.

If you change solver to Euler you should have better luck.

Apr-16-21 07:39:45
Cannot import and use Modelica.Units.SI

I would put the annotation at the end of the class. Other places in a class were removed in the Modelica 3 grammar many years ago.

I thought this was enabled by default in our 2.0 FMUs. Do you have some example that it doesn't work for?

Start looking here: …
You can also look in OMEdit/config.log to see what is happening there.

Mar-30-21 12:08:57
I am trying to summ the first 100 values of a fourier function
Category: Programming

You need to use the element-wise operators .^ .- and ./ instead of ^ - and /.

Mar-30-21 07:03:17
Looking to use in parallel multiple OMCSessionZMQ instances on single machine

You always get a new session (you can see each omc process in your OS process list). This is the case also if you use the same Python session for OMCSessionZMQ.

Try using a more recent version of OpenModelica. 1.17.0 (to be released soon, I think contains the fixes for that) or the nightly builds should resolve that particular issue.

Edit: 1.17.0 (Windows) was uploaded yesterday: … nal/64bit/ . Linux builds are still being compiled.

You can only have the vector on the left side of a multiplication (x*A1 is OK, A1*x is not). … ric-arrays

The following should work (I made y a vector)


model TestRead

  "Demonstrate usage of function Streams.readRealMatrix"
  import Modelica.Utilities.Streams.print;
  extends Modelica.Icons.Example;
   final parameter String file1 = Modelica.Utilities.Files.loadResource("modelica://Modelica/Resources/Data/Utilities/Test_RealMatrix_v4.mat") "File name of check matrix 1";

  final parameter String matrixName1 = "Matrix_A" "Names of check matrices";
  final parameter Integer dim1[2] = Modelica.Utilities.Streams.readMatrixSize(file1,matrixName1) "Dimension of check matrix 1";

  final parameter Real A1[:,:] = Modelica.Utilities.Streams.readRealMatrix(file1,matrixName1,dim1[1],dim1[2]) "Data of check matrix 1";

  Real x[dim1[1]] (each fixed = false)  "Dummy state" ;
  Real y[dim1[2]];
  initial equation
  x = fill(1.,dim1[1]) ;

y  = -x*A1;

end TestRead;

Mar-23-21 07:35:59
I try to follow...
Category: Developer

Did you skip step 1? …

OMDev is where you installed it. Clone into C:\OMDev and set the OMDev environment variable to that location and you should get further.

The easiest way would be something like:


$ docker run --network=host -it openmodelica/openmodelica:v1.16.2-minimal

$ docker ps
CONTAINER ID   IMAGE                                       COMMAND       CREATED         STATUS         PORTS     NAMES
2290fa2e1fa6   openmodelica/openmodelica:v1.16.2-minimal   "/bin/bash"   8 seconds ago   Up 6 seconds             eager_easley
$ python3
>>> import OMPython
>>> omc=OMPython.OMCSessionZMQ(dockerContainer="2290fa2e1fa6")
>>> omc.sendExpression("getVersion()")
'OpenModelica 1.16.2'

Mar-12-21 13:54:51
Only getting errors by trying to simulate the Arduino Uno model

gela wrote:

Oh, that's what you meant.

I think you have misunderstood my request with the Arduino Uno a little bit or I have expressed myself there probably inaccurately: My goal is to run the Arduino model with different scripts (as one can do that on the real Arduino too). In Dymola I can select the script I want to run on the Arduino in its block parameters.
Soon I have no access to Dymola anymore so I need the same functionality in OpenModelica with the Arduino model there. I had mentioned the "Blink" only as an example, so that I can test the function.

Unfortunately I can't upload a screenshot of my model with the Arduino right now, because an error happens when uploading the image in my post. I hope you can see it here.

In my modelica model I run a script which I created with the Arduino Uno block. For this, the Arduino needs the different analog inputs and digital outputs. Because of this I tried it with the model from Github, since it had worked with this in Dymola everything.

Is there really no chance to simulate a working model in OpenModelica with the library from Github?

In Modelica_DeviceDrivers you can choose which AVR chip to target (but only a few different AVR microcontrollers are available). The Modelica model is what you compile for the Arduino.

As for the CATIA library, it might work. You just need to run some commands manually (look at all the Dymola-specific annotations in the model). Read the documentation and run everything special it is doing manually. For example: When a model that contains the ArduinoUno block is translated the external object is automatically re-built through the preInstantiate=Arduino.Internal.buildSketch(...) directive in its annotation.

Mar-12-21 12:15:36
Only getting errors by trying to simulate the Arduino Uno model


Mar-04-21 13:53:41
Only getting errors by trying to simulate the Arduino Uno model

You'll need to look into that library to see which commands are being run to compile that library automatically in Dymola. If you compile it, I think it might work.

Otherwise, try the Modelica_DeviceDrivers library. It has worked in OpenModelica in the past at least.

OpenModelica can export FMUs as C or C++ (with C bindings, not C++). OMSimulator is written in C++ and can import and simulate FMUs.

Mar-02-21 07:21:19
Hi, I need to implement an external C function in Modelica.

Where did you put the file? The only location that is searched is Teste26-02/Resources/Include

Feb-25-21 06:30:08
Category: Developer

Default just means the latest installed version. It's the same for all libraries; no special case for the standard library.

Feb-23-21 17:06:30
Category: Programming

1. You can't. You need to rewrite the code (or use the demo version of some Modelica tool that supports the conversion scripts, which will give you an updated model using MSL 4.0.0)

2. Go to Options | Libraries (I think) and change the version of Modelica you want to load by default (or don't load Modelica by default)

3. I'm unsure about this as I don't actually use tables myself current/big_smile

Feb-23-21 08:40:31
Category: Programming

The plot would still say seconds, but you would know it is in hours. I'd recommend scaling it for proper models though

Feb-23-21 07:48:29
Category: Programming

As for time steps, the unit in the specification is time as seconds. In OMEdit, you can change the displayed unit to be days. And you could create conversion variables 


Real timeInDays(unit="d") = time / 86400;

and use those in your code if necessary.

You could also pretend the unit is in hours instead of seconds, but then your model might not work correctly with other tools.

If it's the stopTime you are concerned with, I am sure that could be added to the GUI as an enhancement in the future.

Feb-23-21 07:41:11
Category: Programming

The instructions are for Windows (using OMShell or OMEdit to access the command line). Otherwise, the libraries are here: … /OM/master

Feb-22-21 10:12:35
Category: Programming

ModelicaTest has a lot of examples for tables if you want to see example code

Feb-22-21 07:51:27
Category: Programming

The documentation is part of the library (you can browse it in OMEdit). You will need the latest OM nightly and also use the package manager to install the master version of the standard library:


installPackage(Complex, "4.0.0-master");
installPackage(ModelicaServices, "4.0.0-master");
installPackage(Modelica, "4.0.0-master");


>>> loadModel(Modelica, {"4.0.0-master"})


>>> getSourceFile(Modelica)
"/home/martin/.openmodelica/libraries/Modelica 4.0.0-master/"

>>> getSourceFile(ModelicaServices)
"/home/martin/.openmodelica/libraries/ModelicaServices 4.0.0-master/"

>>> getSourceFile(Complex)
"/home/martin/.openmodelica/libraries/Complex 4.0.0-master/"

Feb-22-21 06:59:40
Category: Programming

If you are using a CSV-file, you need a version of MSL from the master branch as it has been very recently added: … 9b5d317e35

Otherwise, you need to convert your txt-file into one of the supported formats (read the documentation).

Feb-17-21 07:58:42
Category: Programming

People do. I just don't understand it.

Feb-17-21 07:22:00
Category: Programming

You mentioned Medium in the title, so I won't even bother reading the body text

Give gen1.Syn1.Sn a start-value different from 0? Or an equation that can be satisfied?

Jan-20-21 14:51:28
Is it possible to simulate the movement of a cam follower? If so, who can explain to me how?

The Modelica standard library does not do things like collision detection, and will only use a 3D model for visualization. So you would need to manually (or create some software) create all those constraints from the CAD model.

Dec-22-20 07:16:56
How to compile OpenModelica in QT?
Category: Developer

You need to compile all the dependencies first (including omc). The linked image suggests you didn't do that. make -f Makefile.omdev.mingw in the top-level directory and you should have build/bin/OMEdit.exe

Dec-17-20 13:46:39
Searching for a 3D LuT-block or function for trilinear interpolation. Is it possible to use...

a) Yes, but I'm not at liberty to discuss that particular implementation. You can read … ssues/1153 as well...
b) You need to write your own C library most likely, or maybe you can use /opt/dymola-2021x-x86_64/source/matrixop.c, but I have never looked at that. The readMatrix function is a builtin function of Dymola and doesn't work in standard Modelica tools. But why not spend time to extend the standard library to have ND-tables instead? (You know, that ticket above)

You could perhaps chown /usr/bin/omc to a non-root user and then chmod 4755 /usr/bin/omc

But still, running omc as the root user is a bad idea.

Nov-19-20 12:00:48
Cannot install omlib

Yes, if I copy-paste what you put in the forums or on the download page, it starts installing. It seems you didn't put a pipe, but rather quoted something causing you to search for some string that contains | cut -d" " -f1 instead of piping the output of apt-cache search into the cut command...

Nov-19-20 06:37:13
Cannot install omlib

Do you have the apt repository and did you call "apt update" ? I'm on focal and this is my output:


[martin@mega ~]$ apt-cache search "omlib-.*"

omlib-advancednoise-1.0.1 - AdvancedNoise 1.0.1 is a Modelica library
omlib-aixlib-0.4.0 - AixLib 0.4.0 is a Modelica library
omlib-aixlib-0.9.1 - AixLib 0.9.1 is a Modelica library

Nov-17-20 08:05:52
Compile OMedit in QT
Category: Developer

If it's missing the header, you didn't compile it or it failed halfway through and you need to restart.

Nov-17-20 07:58:27
Compile OMedit in QT
Category: Developer

You need to have bootstrapped omc, too. I guess the make target you were looking for is "all" (or "omc" before qt clients)

I would suggest using


docker run -d -p -p dersh/om-desktop-nightly

To not let outside machines connect to the exposed VNC port.

This is quite cool. You could have made them in the same repository sand different tags though. At least this avoids the need of an X server or virtual machine.

Although I didn't test the images myself, it seems like it would listen to external connections. It would be safer to not expose the port and instead just connect to the container directly. But MacOS and Windows have some limitations in that regard...
Keep in mind that docker is a pretty big security risk.

OMShell is a Qt application. OMShell-terminal is a shell application.

It seems I forgot to activate the libraries (should be added during the night). If you want the libraries sooner, you could try to install the libraries locally. Create a file installLib.mos with contents:

installPackage(Modelica, "3.2.3");getErrorString();

And then run omc installLib.mos

Nov-10-20 12:47:05
How to build omedit on windos?
Category: Developer

You need a JRE in order to run ANTLR. The JDK should be optional though.

Nov-09-20 18:16:23
ways to debug script?

Call getErrorString() to get messages

Yes, until the builds succeed. It's not just updating which OS distributions to compile for. We need to fix bugs in third-party source code when gcc versions change current/smile

No, you would install openmodelica-1.14, I believe. The exec older versions don't compile on newer Fedora

I suppose we should add a build for fc33. There is no repository for Fedora 33 yet. Which one did you copy?

SudhakarK wrote:

Now, I wish to modify the code such that x generates a random value at each instant. Accordingly, I will read those values from the client end and change the values of x that will ultimately affect the value of y. Could you please provide some insights on this?

That's not possible. Impure functions may only be called at event instants. So you need to use when sample(...) or something similar.

That's just a warning, right? We won't compile new packages just for Ulyana when the packages are the same as focal current/smile

Oct-07-20 05:40:50
rpm issue on fedora 32

I'll try updating these to the last 3 releases (30-32). The problem for us, none of us use Fedora so we don't remember to update the list of Fedora OSes we build for.

You could just use the corresponding Ubuntu name (focal) and that will usually work. I have now symlinked it on the webserver so it should update using the existing files. but I can't remember what happened to it

I'm guessing somewhere in all that C-code there's the assumption that if it's an ARM system, pointers are 32-bit. You could run gdb on the executable so see where it crashes but the actual line of code that needs changing might be nowhere near that line of code...

There are two ways to load a package:

* It is stored in the MODELICAPATH and you use it as a system library. Then we load it read-only and it cannot be modified.
* You load a .mo-file by opening it. OMEdit then assumes you want to be able to edit it.

If you have access to the paid version, encrypted models cannot be modified either.

Aug-20-20 09:35:43
Problems facing in compilation of .mo to .fmu
Category: Developer

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

Aug-20-20 08:37:52
Problems facing in compilation of .mo to .fmu
Category: Developer

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?

Mota wrote:

Or are there any problems/disadvantages I havn´t thought about?

You need to install an X server to use docker.

Aug-13-20 14:22:23
Problems facing in compilation of .mo to .fmu
Category: Developer

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



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

Aug-10-20 05:43:50
Topic: noEvent
How does it work? Downsides?

Take a simple model like the following for example:


model M

  Real x = sin(5*time);
  Real y = if x >= 0 then x else -x;
end M;

It will cross from positive to negative at around time=0.6238. At this time, y may be negative despite that if-condition guarding against negative numbers. Why? Because the zero-crossing function is not exact and there will be a time event at a time that is not exactly when the condition triggers.

On the other hand, the following will generate a trajectory where y is always >= 0. But there is no event triggered at the time of the zero-crossing, so some other values might be affected if you actually need some calculation to update at this point.


model M

  Real x = sin(5*time);
  Real y = if noEvent(x >= 0) then x else -x;
end M;

There is no such output at the moment, and you won't ever be able to get a pure ODE system out of it since Modelica contains hybrid parts, the clocked system, and non-linear systems, dynamic state selection, etc. But for some models you might be able to get an ODE system out of OpenModelica. If you write an exporter for it or perhaps parse the info.json file to get the equations you want (for even more limited models).

Jul-28-20 13:40:17
Running simulation within IDE that load DLL requiring special environment variables

OMEdit Result.mat will not open the result file in the plotting perspective. But File -> Open result file (or whatever it was called)... should work. Of course, you can't script that.

Call getErrorString and you should see why. I guess that's Dymola syntax for a mos-script and the functions you try to call don't exist either. We don't have simulateExtendedModel

Jun-30-20 11:42:29
Category: Programming

Try to resample the mat-file using: … ionresults

See for example: … e-and-hold … /sampling/

Basically, inside a when-statement is the only time you really know in what state the solver is (because it needs to reset after discrete events)

No, there is no way to know this because the solver may not even solve the model time step by time step (Modelica makes very few assumptions on the solver that is used).

The only way to know what mode you are in is to use a sampled system and call your external function at these points (because then you know you are at a time or state event).

Jun-22-20 06:58:15
I need help diagnosing a compile error.

It says missing "each", right?


model M

  Real r[3](start = 3.0) = {1,2,3};
end M;

vs. valid model:


model M

  Real r[3](each start = 3.0) = {1,2,3};
end M;

May-26-20 15:47:14
Querying current step size

There is no step size in a variable-step solver. Modelica intentionally does not allow you to query this information because you don't even know if the simulation will rely on the concept of time (e.g. using QSS).

If you must know step sizes, export as FMI for Model Exchange and implement the solver yourself.

If you don't want to be portable, write an external C-function and #include the necessary headers from the OpenModelica simulation runtime and start querying the internal state for information. You'll need to implement this differently for each numerical solver you want to access the internals for since most of this information is not used by OpenModelica. You won't know the "current" step size until it's done though; you can probably access the previous step at best since external functions must always give the same output regardless of input (except during discrete events, but at discrete events there is no step size since time does not progress).

May-18-20 12:30:29
Return a record from an external C funciton cal
Category: Programming

So your issue is that code such as the following should work, but does not - right?


model M

record R
   Real x,y;
end R;

function sample_model
    input R r;
    output R res;

    external "C" sample_solver(r, res);
  end sample_model;
  R r = sample_model(R(time,time));
end M;

If so it should be possible to fix it.

May-18-20 12:22:38
Return a record from an external C funciton cal
Category: Programming

Never mind, I'm stupid. It says further down if it's lhs, it is passed by value instead of reference...

May-18-20 12:17:33
Return a record from an external C funciton cal
Category: Programming … ml#records

You cannot pass a record by value.

The .mat-file should always be exported with double precision unless you explicitly passed it



. Open it in Matlab/Scilab/Octave and you should see the full precision.

There is a simulation flag ( … lags.html) for that:


$ ./M -lv LOG_STATS

LOG_SUCCESS       | info    | The initialization finished successfully without homotopy method.
LOG_STATS         | info    | ### STATISTICS ###
|                 | |       | | timer
|                 | |       | | |  0.000294868s          reading init.xml
|                 | |       | | |   4.1369e-05s          reading info.xml
|                 | |       | | |  0.000147484s [  3.6%] pre-initialization
|                 | |       | | |   7.5327e-05s [  1.8%] initialization
|                 | |       | | |    5.107e-06s [  0.1%] steps
|                 | |       | | |    2.627e-05s [  0.6%] solver (excl. callbacks)
|                 | |       | | |  0.000536842s [ 13.1%] creating output-file
|                 | |       | | |            0s [  0.0%] event-handling
|                 | |       | | |  0.000217657s [  5.3%] overhead
|                 | |       | | |   0.00303205s [ 73.8%] simulation
|                 | |       | | |   0.00417501s [100.0%] total
|                 | |       | | events
|                 | |       | | |     0 state events
|                 | |       | | |     0 time events
|                 | |       | | solver: euler
|                 | |       | | |   500 steps taken
|                 | |       | | |   500 calls of functionODE
|                 | |       | | |     0 evaluations of jacobian
|                 | |       | | |     0 error test failures
|                 | |       | | |     0 convergence test failures
|                 | |       | | | 0s time of jacobian evaluation
LOG_SUCCESS       | info    | The simulation finished successfully.

Gabri wrote:

basically what I want to implement in my code is the following logic:

when a variable reaches a determined value, then stop the simulation.
In the case in the example is when F=20 then stop the simulation.


model M

  Real F = ...;
  when F < 20 then
    terminate("F successfully reached <20");
  end when;
end M;

If you want to see slightly better error-messages, call


OpenModelica.Scripting.loadModel("xxx"); getErrorString()


[model.mos:1:1-1:39:writable] Error: Failed to elaborate "xxx" as a code expression of type OpenModelica.Code.TypeName.

Mar-03-20 08:28:15
Installation of Open Modelica on Linux Debian 10

You don't seem to have the lsb_release command installed. Install the lsb-release package first - it's usually installed in any desktop or server version, but not in minimal versions.

Feb-27-20 09:55:46
Modeling of an anti-fall valve

Many of us have no experience in modeling as we are in computer science. A minimal model showing the problem is very important to get good help. Also, it seems this error message does not come from OpenModelica, so it would be even harder to help you...

If you have a variable x that has start-value 0 and is part of a non-linear system, we need to know if x is expected to be a very large or very small value in order for the non-linear system solver to scale better. These are files in the simulation runtime using the attribute:


$ grep -RI nominal OMCompiler/SimulationRuntime/c | cut -d: -f1 | uniq


The workaround is to input it using radians instead (Modelica.Constants.pi / 2 for example), until there is a new nightly build (where I output full precision scientific format). I'll let Adeel (the OMEdit maintainer) fix this properly when he is back.

There is no GasConvection class in the standard library; what library are you using?

OMEdit uses command-line options to set the output log format to xmltcp and then uses a TCP client to read the messages, including status information. I believe they include the progress information.

I believe you can also send the SIGUSR1 signal and the simulation prints out some status message.

Call /bin/rm to remove some files?

Jan-23-20 07:48:49
The OMEdit/Options Libraries dialog tab display the Modelica library, which is...

"default" means the latest released version of the library which might change next time you open OMEdit.

You are not limited to the MODELICAPATH. Either modify the env.variable OPENMODELICALIBRARY to append to MODELICAPATH.

Or add it to the "User libraries" part of the same settings page to add any library's (or a top-level *.mo file) to add any library you prefer.

You indeed input 3.2.3 if you want version 3.2.3. Just remember to restart OMEdit for the changes to apply.

Env.variable OPENMODELICALIBRARY can be used

I believe this is a bug in OpenModelica. You probably want to open a ticket. Since it works if the record has more than 1 member, it is working in most useful cases and the compiler probably has some odd edge case for records with only 1 element ...

The OpenModelica simulation runtime system already has a different license from the rest of OpenModelica: the code provided by us is BSD-licensed as an option ( … time.txt). Some third-party code in it is LGPL-licensed though.

I can't remember what year the runtime license was introduced, but I suspect this thread is older current/smile

Dec-06-19 16:07:50
Category: Developer

If you get an error from your standard library, that stdlib.h does not exist I suggest creating a bug with gcc current/smile

I also would not compile OMOptim - we don't as it's not maintained.

Nov-29-19 10:14:19
Category: Developer

git checkout maintenance/v1.14 for a branch with few changes coming to it. master has more development, new features, support for newer OSes, etc. The master branch is usually quite stable (as in: it often works, especially on Linux).

Nov-29-19 06:45:11
Category: Developer

Xwang1976 wrote:

I would like to now:
1) is it necessary or useful to have a working  --with-cppruntime option?
2) are those filed test something I have to worry about?
3) analysing the resulting arch linux package with namcap (, I see that there are a lot of "Unused shared library" messages. Should I worry about it and in case is there any compilation option I can use to reduce/avoid them?

1. Not needed
2. The failed tests usually happen because you don't use the same numerical solvers as the test system (an Ubuntu 18.04 docker image)
3. There are also many libraries not found, etc. It's probably because the tool does not know about our rpath settings (used so we don't conflict with OS versions of the same libraries)

Nov-28-19 15:32:19
Category: Programming

You could also use a Python script or whatever to generate this file. Then open it in Dymola.

There are docker images of OpenModelica. They work just fine even with GUIs according to my testing current/smile

As far as I remember, AppImage is only 1 application - OpenModelica is many different applications and depends on having things like entire development toolchains installed.

Nov-28-19 08:01:58
Category: Developer

Seems your OpenBLAS does not support these lapack routines. I wonder if it's related to: … enModelica

Nov-22-19 08:39:05
How can I see which variables are chosen as state variables, and which initial values, for a...

Well, you could look in the result file: If there is a der(x), x is a state variable.

You could also look in the _init.xml file:



    name = "x"
    valueReference = "1000"
    variability = "continuous" isDiscrete = "false"
    causality = "internal" isValueChangeable = "true"
    alias = "noAlias"
    classIndex = "0" classType = "rSta"
    isProtected = "false" hideResult = "false"
    fileName = "/home/marsj/tmp/" startLine = "2" startColumn = "3" endLine = "2" endColumn = "9" fileWritable = "true">
    <Real fixed="false" useNominal="false" />

classType = "rSta" is a state variable.

Nov-18-19 07:37:43
Simulation freezes at around 8%

Follow the guidelines given above. The error message tells you that your system is switching very fast between two states. This forces the integrator (dassl, etc) to restart frequently, killing performance.

Using some hysteresis is probably best. And sometimes noEvent() can help you in if-statements.

Nov-07-19 15:32:05
partial models need all declaraions
Category: Developer

It's not necessarily going to be (much) longer. You simply declare the variable in the partial model and modify it in the extends clause.

Nov-04-19 15:04:22
Category: Developer

That is because you have


package Enu=EnumerationBase1(option=Options.B);

. Options is not available in the scope of ModelicaTests2.EnumerationTest2. It works if you have it as option=EnumerationBase1.Options.B

Nov-04-19 13:03:45
OMC EL8 repository is broken

That's easy to answer: because the CentOS8 docker image was not released last I checked (24 September) and the RH free images don't have access to most useful packages. I'll see if it can be enabled.

Choose csv as the output format when you simulate:


marsj@marsj-Precision-5510:~/tmp$ ./wurf -override outputFormat=csv

LOG_SUCCESS       | info    | The initialization finished successfully without homotopy method.
LOG_SUCCESS       | info    | The simulation finished successfully.
marsj@marsj-Precision-5510:~/tmp$ head -2 wurf_res.csv

Oct-31-19 16:49:00
No logfile after running the exe-file

It's in the stdout - it's output in the console when you run the executable.

Oct-31-19 08:46:53
No logfile after running the exe-file

Of course OpenModelica will not output a dslog.txt (Dassault Systemes log dot txt)... We produce the log on stdout like normal Unix tools current/smile



if (abs(relVel) < eps)

solve it?

As far as I can tell it simply uses the communicationStepSize sent to it by the master algorithm. It will not try to take smaller steps than that.

You would need to create one input file for each run . Of course you could have it as a matrix in a mos-script and create the 140 input files. Then use -overrideFile fileNameXXX where the file contains one line for each parameter on the form PARAMETER=VALUE. It is also possible with -override=p1=1,p2=2,p3=3,...,p20=20

Simply use command-line git from the operating system. It is really simple to use. No git integration only means you need to remember to add new or moved files, etc.

Use git

The only integration method you can set for co-simulation FMUs is Euler. Dassl is not supported.

I am guessing you are sampling something every 1000s so you have event points at these steps. Use the simulation flag -noEventEmit
to not store those in the file.

That's made with a script called BuildModelRecursive.mos (which is included in your OpenModelica installation).

We have a newer version used at:

That is generated by a script in … aryTesting

You will need to run getErrorString() afterwards to see what the error is.

The way the official builds compile OpenModelica, we rm -rf OMOptim before the ./configure command to skip compiling it current/smile

1) Yes, they are. In the latest nightly we also set the SourceFiles parts in the XML so the importer knows which files to compile. You still need to set predefined values using -DXXX if you need to tweak something for the target (usually done by a configure script).

May-30-19 10:19:39
An independent subset of the model has imbalanced number of equations
Category: Programming

Check only does a quick check that things might work, but it will not detect things like:


model M

  Real x,y;
  y = 1.0;
  3.0 = 2.0;
end M;

In some cases at least the latest OpenModelica will give a hint that things are a bit off. But in many cases no analysis of the possible cause of the error is given.

So you mean that you want to save io11 for each iteration of the array? That you could do also with a for equation and using an array for each iteration index:


  Real io11[np];
  io11[1] = 0;
  for i in 2:np loop
    io11[i] = io11[i-1] + 1;
  end for;

You will want to use an algorithm section instead of an equation: a loop such as:


for i in 1:2 loop

  i = i + 1;
end for;

Is expanded into:


1 = 1 + 1;

2 = 2 + 1;

In an algorithm section the values are kept during the loop (note that I and Iph also need to be part of the same algorithm section or you will have double assignments):


for i in 1:2 loop

  i := i + 1;
end for;

Yeah, that path looks a bit messed up and needs a ticket for one of our windows developers to have a look.

I tested using Linux and OMSimulator and added some debug print to see that it's doing what it should:


path to load: /home/marsj/tmp/tmp2/KS_Tables/LookUp/myTable.txt

Resources dir: /home/marsj/tmp/tmp2/model-ca9vdzfd/temp/fmu/resources
Result: /home/marsj/tmp/tmp2/model-ca9vdzfd/temp/fmu/resources/home/marsj/tmp/tmp2/KS_Tables/LookUp/myTable.txt

With Linux and fmuCheck.linux64:


path to load: /home/marsj/tmp/tmp2/KS_Tables/LookUp/myTable.txt

Resources dir: /tmp/fmucktmp1H9wDU/resources
Result: /tmp/fmucktmp1H9wDU/resources/home/marsj/tmp/tmp2/KS_Tables/LookUp/myTable.txt

So it should work fine... I suppose if you use Windows, the long paths aren't particularly helpful though

Apr-03-19 14:53:19
Distributing a binary executable o FMU model to be used in commercial environments

Yes, the OSMC-PL 1.2 runtime license applies to the runtime system we use. Note that third-party code (such as uthash.h) might also exist in there.

Yes, might be good to open a ticket. I not only want to fix the problem, but give a diagnostic message when we fallback to copying all the files into the FMU...

Apr-03-19 14:46:05
Is the Free Vehicle Dynamics Library available

I should note that it's a very old library and probably won't work very well in OpenModelica as many things were not standardized at this time.

We do that if we have a call to uriToFileName(xxx) where xxx is not a constant string that we can resolve at compile-time. And for the MSL, it seems that the loadResource function is not marked with Inline=true.

I think the best fix would be for us to change ModelicaServices.ExternalReferences.loadResource to be marked Inline=true.

Apr-02-19 16:10:14
Distributing a binary executable o FMU model to be used in commercial environments

Yes, you can strip out the source code from a generated FMU and redistribute only the binary provided that you add a text to the FMU documentation regarding the license: "[...] Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. [...]" (along with the licenses of any Modelica libraries you used to generate the binary, given their licensing terms).

Mar-29-19 10:19:25
Conversion of Matlab Code into Openmodelica
Category: Programming

Of course it's possible. I recommend doing it by hand.

It's just that the default loaded MSL is 3.2.3 and the model you load has a uses-annotation for MSL 3.2.2. It is possible to change the default MSL in OMEdit if you want to use the old library (Tools->Options->Libraries.

I have never seen any Linux distribution enable auto-run since it's a huge security risk. The image will automatically mount the CD-ROM and it will open up the directory where the installer exists. Just right-click and open a terminal to run the shell-script (which is not marked executable, so you can't double-click it and expect it to run). Just type: "sh" and it installs fine.

The base disk image was created in VirtualBox (manually). OpenModelica is then installed using chroot and vdi-image is created from this; for this reason grub is not updated during the installation. We could include the virtualbox additions in the image, but I think this is not a great idea due to different virtualbox versions out there.

Mar-01-19 09:54:39
Integarting FMU model from OMEdit to dSpace ConfigurationDesk

That's up to the FMU importer to implement. OMSimulator had some experimental real-time synchronization before its API changed current/smile

Mar-01-19 08:46:43
Integarting FMU model from OMEdit to dSpace ConfigurationDesk

Arinomo23 wrote:

why was it not
#include "include/fmi2/fmu2_model_interface.h"

Because we have multiple ways of compiling the FMU; you can compile against the library and include files in the OpenModelica directory directly in some cases.

Mar-01-19 06:35:42
Integarting FMU model from OMEdit to dSpace ConfigurationDesk

I would strongly suggest using the provided configure script and makefiles inside the FMU. The Makefile will contain things like:



Which is different for different generated models. Note that the makefiles listed above says the prefix is KS_TA_HiL_Internal_SignalScaling, but the linking error has a different expected name...

Also note that you have -Wl,--output-def=KS_TA_HiL_Internal_SignalScaling.def in CPPFLAGS, which are preprocessor flags. It is a linker flag and might not be present when linking since it's not in LDFLAGS.

You FMU importer decides how to deal with time. If you want real-time synchronization you implement this in the master. If you want the simulation time to be different in different connected FMUs, you can implement this as well. The FMU itself has very little knowledge about this.

Feb-07-19 07:17:40
Is it possible to open Dymola-encrypted models or commercial libraries with OpenModelica ?

Both the library developer and you need access to the OpenModelica encryption/decryption tool. It should not matter if the library was developed in Dymola, but you will not be able to access encrypted libraries targeting Dymola's private encryption keys and the library develop will not be able to enforce license restrictions (anyone with the encrypted library can use it; but with access annotations won't be able to see everything). … ption.html

As for the membership level, if the library developer is a level 2 member, they could distribute the encryption/decryption tool to you as far as I know. If both of the companies have a level 1 membership, you can both have access to the encryption/decryption tool.

Note that the encryption/decryption support is still quite recent work and being tested by some OSMC members and library developers. It might be that decryption support becomes free in the future when license restrictions are supported. But I don't know our plans.

Jan-18-19 05:57:42
VirtualBox VM with OpenModelica and guest additions and more

Yes, the VM is generated by vagrant because it was convenient to script using it. But it seems the image has changed such that only serialport communication is used. When I get a little more time I will setup new VM builds. Until then, just take any Ubuntu image and follow the Linux installation instructions

You could look at
I haven't tried it myself, but it has some basic battery functionality

In OMEdit, basically any image format supported by Qt should work as far as I know. For other Modelica tools, it might not work. SVG support is staged to be part of a future Modelica specification version: … issues/174

Dec-19-18 13:41:44
File not found: kinsol/kinsol_sparse.h

gcc works fine as well (but only some versions of gcc; especially some recent gcc versions broke backwards compatibility)

Dec-13-18 06:26:31
Is there a way to have an FMU export performed on a windows machine include the Darwin64 binaries...

It might be if you specify the platform as:
"x86_64-apple-darwin15 docker run"

You would need docker installed, Hyper-V enabled and virtualization in the BIOS. You probably need to run a mos-script or modify your omedit.ini:

Platforms=none, x86_64-apple-darwin15 docker run

Note that this has not been tested on Windows and has no nice GUI in OMEdit.

A complete copy of Sundials is included in OpenModelica; the OS-provided version should not be used. If it somehow is used, please provide a pull request fixing linking order.

Nov-20-18 06:45:08
Cannot instantiate a OMPython.OMCSessionZMQ()

My guess would be that the OS version you use and the OS version omc was compiled on do not match, because it crashes during initialization of ZeroMQ. It could also be that you are using an older version of OMC before the ZeroMQ fixes.

  • Index
  • » Users
  • »
  • » Profile
You are here: