Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • »
  • » Profile



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.

Oct-22-18 06:21:50
frost@frost-virtual-machine:~$ for deb in deb deb-src; > do echo

You typed wget -0- (zero), but should have used wget -O- (the letter O as in output).

Jun-25-18 06:14:24
Topic: .h error
error: operator "defined" requires an identifier #if !defined(1D__MODEL_H)

C identifiers may not start with numbers. Neither may Modelica identifiers, but I guess you set a custom fileNamePrefix? Please report the bug at

Jun-12-18 04:37:33
Write simulation for different initial values.
May-25-18 04:58:04
Category: Programming

I don't really know thermal modeling, but these are all physical connectors with potential and flow. So if you want to make the flow different to the different components, don't you simply add the equivalent of a resistor to do this? Then the temperature will naturally flow towards the least resistance.

May-23-18 20:01:33
Category: Programming

You need to use connect-statements on connectors. If you manually set them equals, zero-flow equations will automatically be generated for unconnected components.

May-16-18 05:12:48
I'm trying to implement a double action piston using SweptVolumes but I obtain an...

Note that if you do not use connect() statements, you get implicit flow=0.0 added. So always connect connectors instead of manually adding equations for them.

May-16-18 05:11:26
I'm trying to implement a double action piston using SweptVolumes but I obtain an...

Did you try to simulate the model? That should give the following message:


Error: Too many equations, over-determined system. The model has 116 equation(s) and 114 variable(s).

[/home/marsj/tmp/] Warning: Equation 93 (size: 1) flange.f = p1.flange.f - p2.flange.f is not big enough to solve for enough variables.
  Remaining unsolved variables are:
  Already solved: flange.f, p1.flange.f, p2.flange.f
  Equations used to solve those variables:
    Equation 94 (size: 1): flange.f = 0.0
    Equation 97 (size: 1): p1.flange.f = 0.0
    Equation 104 (size: 1): p2.flange.f = 0.0

May-14-18 05:49:46
How to access Solution of initialization? … ile-format

You can also choose CSV output if you prefer a textual format. Or you can use the OM API to read result-files, for example using: … tionresult

You start the simulation by writing to the step or run variables in the OPC interface.

OpenModelica can only simulate with time as the x-axis. You can plot with another variable on the x-axis using "New parametric plot windows" in OMEdit though.

May-02-18 04:53:08
pbuilder can't create debian packages on testing distribution
Category: Developer

You can find the libraries here:

You can build your own deb-files from (`make debian` once you setup the locations of the deb-packages and files for apt-ftparchive).

Apr-26-18 05:53:27
pbuilder can't create debian packages on testing distribution
Category: Developer

This is because some newer Java versions fail to compile the files. The latest nightly build does not have this problem and you can resolve the issue by removing the offending line from omc-java.install (you usually don't need the jar-file and you could use instead if you do need it)

Apr-26-18 05:51:27
WheelsAndTires-release & MultiBondLib & MotorcycleLib can't open

You should just need to install the latest nightly build. Otherwise you can do File->Open and browse to /usr/lib/omlibrary/XXX/ and open that to load the library (it's only the libraries entries that are a bit broken with newer Qt; before the fix).

Apr-24-18 04:33:51
WheelsAndTires-release & MultiBondLib & MotorcycleLib can't open

This is fixed in (broke due to change in the Qt library)

Undefined symbols for architecture x86_64:
  "_ATL_dger", referenced from:
      _ATL_dgetf2 in liblapack.a(ATL_dgetf2.o)
  "_ATL_xerbla", referenced from:
      _atl_f77wrap_dgesv_ in liblapack.a(ATL_f77wrap_dgesv.o)

You have libatlas installed and not lapack. Atlas doesn't link with the standard lapack flags.

There are many expected errors in the config.log. I would need to see the whole file (preferably uploaded somewhere like on

OMPython and OMShell are the same. You use the same commands with them.

murrayE wrote:

What would the actual name of that log be?


If you don't want to use buildModel and run the simulation yourself (or ModelicaSystem to wrap around that):


omc.sendExpression('simulate(HelloWorld, simflags="-override a=3.0")'

(Or using -overrideFile if you have many overrides, especially on Windows)

Apr-09-18 08:59:13
What is the best method to run co-simulation between Adams model and OpenModelica - it's an external tool for FMI co-simulation

The OMCompiler config.log probably contains the linker error for lapack/blas

Apr-09-18 04:58:53
What is the best method to run co-simulation between Adams model and OpenModelica

If you're not using the TLM method, you are probably better off using Adams- and OpenModelica-generated FMI 2.0 FMUs with OMSimulator.

Mar-20-18 10:25:34
Building on Ubuntu 17.10 (git nightly) fails (Mumps autoconf error?)
Category: Developer
Mar-19-18 05:38:05
Building on Ubuntu 17.10 (git nightly) fails (Mumps autoconf error?)
Category: Developer

I suppose the error might be higher up in the logs (try with git clean in 3rdPartyand then make  -j1 ipopt). I had no problems with Ubuntu 17.10 myself.

You could try the older OMC versions using the older repositories: (Installing older releases or using a specific OpenModelica version). Or changing the CFLAGS ( … etcflags).

I will see if I can remove the march=native flag (it anyway does not make much sense for FMUs), but it seems slightly odd that on the build system clang does support -march=native and on your system it doesn't. Anyway, that would only change OM 1.13 and not 1.11 or 1.12.

Mar-12-18 05:51:01
Calling from default library directory make the simulation fail on start

I suppose OMEdit doesn't add the found library directories to the PATH? Alternatively, OMC doesn't copy dll dependencies from the library directory to the directory of the executable?

Mar-06-18 13:06:13
Category: Developer

For OpenModelica scripting: … l#loadfile
For OMEdit: no

The model should work fine with -d=noscodeDep, but I would avoid such unorthodox naming. I added a ticket for this problem:

It's also possible in Options->Libraries, but then Buildings latest would be loaded every time OMEdit starts

Feb-01-18 14:51:59
Model/Solver C-file hiearchy

The configure script is usually called when cross-compiling (on the machine generating the FMU) automatically by OMC. But if you don't have a cross-compilation toolchain, it would be done manually by the user who wants to compile the FMU on a different machine before trying to import the FMU in some other tool.

Feb-01-18 06:15:48
Model/Solver C-file hiearchy

If you don't have an ARM compiler installed on your computer, the easy solution is to install the toolchain. On Ubuntu, "sudo apt install gcc-arm-linux-gnueabihf". The other alternative is to only export source-code (or static), and just send the FMU to the other machine. Then do:

unzip M.fmu -d M.fmutmp
cd M.fmutmp/sources
make -j4

This should overwrite the original FMU with an FMU that supports both machines. No OpenModelica necessary on the second machine.

64-bit Windows OM exports 64-bit MINGW FMUs. 32-bit Windows OM exports 32-bit MINGW FMUs. Linux OM can export MSVC-compatible FMUs. If possible export using FMI for Model Exchange 2.0 as it works a lot better than Co-simulation or FMI 1.0.

Jan-17-18 13:11:49
when the path contains Chinese characters, OpenModelica can't load the models

What Operating System are you using? As far as I know this works on Linux and OSX.

No. Conditional components use structural parameters which cannot be changed after model translation.

Jan-15-18 06:00:34
Probably OpenModelica does not find my c-compiler

The OpenModelica installer tells you to not install into a path containing a space for good reason; it doesn't work if you do that.

Jan-11-18 17:08:27
Model/Solver C-file hiearchy

The code can be compiled without pthreads; use the define OMC_MINIMAL_RUNTIME. You might want to check … for how the Unix systems configure and/or cross-compile the FMU.

Modelica.Blocks.Math.MinMax: Output the minimum and the maximum element of the input vector

Dealing with CSV/Excel files is easiest done by converting them to mat-files and using Modelica.Blocks.Tables to read them.

Jan-08-18 07:11:59
Model/Solver C-file hiearchy calls these files; note that you could simply run OpenModelica on a raspberry pi or similar; the entire compiler runs on ARM. You can also create ARM FMUs directly from OpenModelica; see for example … ompile.mos which generates the FMU in … MUs.tar.xz

Dec-30-17 06:50:03
SUNDIALS include not found
Category: Developer

OpenModelica uses its own version of Sundials.

Dec-13-17 12:17:29
Category: Developer

Unlikely. The co-simulation interface sucks for co-simulation and we focus on model exchange instead. Only forward Euler is supported in the co-simulation FMUs. Luckily, it is much easier to use the solver you want with ME FMUs.

Dec-13-17 05:37:55
Category: Developer

You need to make a recursive clone or initialize and update all the submodules.

Dec-05-17 09:05:46
amended porttile - to make it work
Category: Developer

Adding such a change to the portfile would break it for anyone who did not install atlas (most users)

Try asking your Dymola support (it's a commercial product so I assume you get support)

Nov-16-17 15:44:27
Time variable in algorithm section loses its value between cycles
Category: Programming

You are changing the values according to 11.1.2 Execution of an algorithm in a model current/smile And the rules for initialization only apply before the first step.

I think you're a bit confused about how Modelica connections work. If your pump is sending 9 l/min from pump.C.Q, then from the cylinder's perspective, cylinder.C1.Q must be -9 l/min (it is receiving 9 l/min from some other component); because connections are zero-sum. If you check for example a simple electrical circuit in the standard library, and connect a constant source of 1V to a 1Ohm resistor, then one port of the resistor will be -1A and the other port will be 1A; but the component will also calculate an internal parameter i which is 1A and is the actual flow through the resistor. You could naturally calculate such a flow for the component itself if you'd like and think that's more natural than "+ is outgoing, - is incoming".

Nov-15-17 15:36:52
Time variable in algorithm section loses its value between cycles
Category: Programming

Yes, if an algorithm section assigns to a variable, this variable is always re-initialized at every entry of the algorithm section according to the Modelica specification. For non-discrete variables this is the start-value, for discrete variables it is pre(v). If you simply declare "discrete Modelica.SIunits.Time timeVar(start = 0);" I think you get the behavior that you are after (or perhaps some more variables need to be declared discrete).

Nov-10-17 05:21:45
Reason for using CORBA over sockets

zmq would probably work better than CORBA. There are many things you cannot do with the TCP interface such as sending multi-line models or strings. The interface is also unsafe as it listens for incoming non-local connections: anyone can connect to the port and run any command on your computer when using the interface.

Do some research on FMI: then you can control each step yourself and intergrate multiple tools. Or use the Modelica_DeviceDrivers library to communicate via some protocol in the simulation itself. Or simply use external "C" functions to communicate with the other process.

If you run a Linux copy of OpenModelica, it is possible to cross-compile for RPi. There are also packages available so you can run OpenModelica on your RPi 2+ (which is much simpler). … ceive.html and … tSend.html might be easier to use, but as far as I remember, they require sending data packets of the same size all the time and just keep the last received packet in the buffer (or some other odd behavior).

So you want a simulation using OMEdit to send some data to the Arduino? If you just send data on the serial port, you would trigger the interrupt on the Arduino and the other way around...

I'm a bit unsure exactly what you want to accomplish, but you could certainly setup an interrupt handler using external "C" in Modelica; as far as I know the DeviceDrivers library does not expose interrupts to the user.

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