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



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.

Not really. We need a libgc compiled with specific flags and we need to link some of the other libraries against specific versions because they either changed licenses or API.

The Modelica tool decides which parameters it needs to evaluate. The only thing you can do if you want to be able to change a parameter value is to make sure this value is not propagated to any array dimension, etc Evaluate=false is a hint that the compiler should not evaluate the parameter if possible. But if it is used in array dimensions, it will be evaluated anyway.

"After translation you can only set literal start-values and non-evaluated parameters. " implies this parameter was evaluated by the tool (perhaps it is the dimension of an array or needed for a condition in an if-equation). You cannot change all parameters in a Modelica model after translation (a design limitation that there is no concept of structural parameters or requiring constants to define array sizes).

OK, what errors do you get from ExternData? I guess that's your only choice, but since OpenModelica is MinGW-based on Windows, you might need to compile some libraries yourself to match MinGW rather than visual studio...

Can't you just export the time series from Excel as csv and use the CombiTimeTables from MSL or something similar?

You need to enable code generation of functions (slow, may cause crashes) if you want to call custom C-code in scripts:


>>> loadModel(Modelica)

>>> Modelica.Utilities.Files.exist("C:")

>>> setCommandLineOptions("-d=gen")
>>> Modelica.Utilities.Files.exist("C:")

Modelica_LinearSystems2 is a partially Dymola-specific library which is why some parts of it don't work in OpenModelica.

omlib-modelicareference needed or just remove the package from your OMEdit config. The translation error is just a warning for MSL 3.2.1; the Electrical.Digital icon contained an error and won't be rendered correctly. It's fixed in MSL 3.2.2.

So you should be able to "dnf install omlib-systemdynamics" and "dnf install omlib-modelica-3.2.2" rather than downloading them manually (don't know what you could have gotten wrong or which standard library version you are using). Is it the 32 or 64-bit version?

How did you install OpenModelica? OM version? 32-bit or 64-bit?

Aug-09-17 18:09:43
Category: Programming

Modelica native visualization is rather limited (you mostly visualize the position of simulated objects, and this might skip visualizing terrain, etc; or being simplified). Most people doing nicer looking visualization use external tools to augment the simulated data (as far as I know). The OpenModelica license is free of charge.

Aug-09-17 18:05:45
FORTRAN code interface

You need to create a library to call it, use the Library annotation to choose a name and compile the library as a .lib or .dll file. Make sure the file is mingw-compatible and uses the same integer/etc lengths as OpenModelica expects (as well as calling convention).

Does it work if you use the equivalent "reboiler.mixMolFrac := {0, 0}"? If so it's probably just an internal error and OMC can't handle the model and it would be good to have the model attached to a new ticket at

Jul-28-17 20:06:18
Category: Developer

cryogenic wrote:

omc_embedded_server_init done, state=0x8315550, server=0x8312f28. Pause run=0 step=0

What went wrong? User, server or both?

Debug message in an older release is all.

Read up on either OPC-UA or FMI.

Apr-12-17 05:58:33
Category: Programming

If it's large nonlinear equations, performance should be expected to be slow in the backend. It means many equations are related to each other, which means any sort of dependency analysis or change in an equation will affect many other equations. What can sometimes improve performance is if common subexpression elimination can move parts of the nonlinear system outside of the algebraic loop. You can try it with some of: --preOptModules+=introduceDerAlias --postOptModules+=wrapFunctionCalls.

Otherwise, sending the model to us via a ticket (or, or directly to a developer encrypted if it's sensitive information) and we could perform a more detailed profiling of the model and see if any support function can be improved to get better performance for some detail in the model.

Apr-12-17 05:51:39
Could not load shared library to import a FMU into Simulink

I would recomment that OpenModelica participates at the FMI Cross Check ( by submitting FMUs, then such porblems would be detected. What I see there currenty: only OpenModelica reports successful simulation of FMUs exported by OpenModelica (FMI 1.0)

It's not only OpenModelica able to import the OM 1.9.1 win32 FMUs, but 14 different tools...

We have test FMUs for: win32, win64, linux32, linux64, arm-linux-gnueabi, darwin64 and C-code for FMI 2.0 ME and CS using OpenModelica 1.11. As far as I know, no other vendor tested any of them (and we didn't upload new FMUs for FMI 1.0 since FMI 1.0 doesn't really work for numerical integration).

You don't get entries in the main page unless people actually test things, and why would a commercial vendor test a free software and thus give advertisement to it if they only need to test against 3 tools to get their "import" stamp? (We mainly do linux64 export and no import in OpenModelica itself; only 3 tools tested linux64 import and none of them on a recent OM FMU..).

When the OM FMI simulator is available, it will be a separate tool in the list and we'll setup scripts to try it against many tools.

Apr-03-17 16:28:25
Category: Programming

You wouldn't want to do it in OpenModelica, but a Modelica library. The standard library comes with lookup tables capable of linear interpolation, such as: … Table.html

Apr-03-17 16:24:54
How to start an OPC UA server generated with Open Modelica for Ubuntu system

For Ubuntu, you do the same as in Windows, except the executable does not have the .exe suffix and ./ is probably not on the PATH. So ./xxx ...

Mar-22-17 07:07:49
problem with TimeScale

That's just a compiler warning, not an error.

Feb-28-17 12:22:25
Application has Requested the Runtime to terminate in an unusual way.

I suggest with more details on your simulation settings (the experiment annotation doesn't contain the settings). Default settings with stopTime=120e-6 simulates in 0.05s of wall time.

Feb-28-17 11:04:19
Simulating FMU created with OM requires to install OM. Is it possible to produce standalone FMU?

Works for me when not using className=className, just passing className using positional arguments.

Feb-28-17 10:44:20
Simulating FMU created with OM requires to install OM. Is it possible to produce standalone FMU?

So you use the default, which is platforms={"dynamic"} (depend on OM being installed). Using platforms={"static"} builds the same FMU as for cross-compilation (try to statically link as much as possible; this is much slower in general, but the FMU should work on more systems).

Feb-28-17 10:15:24
Simulating FMU created with OM requires to install OM. Is it possible to produce standalone FMU?

Yes, use the "static" target of the FMU. Also check the cross compilation options if you want to create FMUs that work on multiple platforms: … ompile.mos

Perhaps if you contribute to these tickets it will be added in the next MSL release:

I assume you use a locale that uses comma instead of dots for the decimal separator? Might be that OMEdit puts some wrong characters in there...

You can, but not in the Ubuntu/Debian packages shipped by us. You can unzip all files into a single directory and call /path/to/openmodelica32/usr/bin/omc. But you need the 386 dependencies for that and Ubuntu doesn't allow lapack, sundials, etc non-native packages. So you need to provide them as well. Annoying current/sad

I usually use debootstrap / schroot to install a 32-bit Ubuntu on top of 64-bit Ubuntu when I want to play with the 32-bit OS. It's more light-weight than a virtual machine; essentially it is a second Ubuntu installation in some directory of your filesystem. So it's convenient; you can use the pre-built binaries and use the same home directory as your regular Linux installation.

Feb-10-17 12:24:51
Questions about using the scripting API via OMPython

You have misunderstood the documentation. You always get all messages. What warningsAsErrors does is similar to -Werror in gcc (it makes warnings into errors) if you want a more pedantic mode (we use this when developing OM). You can use countMessages or perhaps even getMessagesStringInternal if you want to do something similar to what OMEdit uses.

Feb-03-17 11:36:47
Category: Programming

Post the model (mos-script, not onb) to

It seems even with Inline=false, in this instance the function is inlined and this causes a bad equation to be generated:

x := $_signNoNull($TMP$VAR$3$0X$ABS) * abs(y ^ 0.5)

Should probably have been abs(y)^0.5 that should have been automatically generated...

Feb-03-17 11:03:17
Category: Programming

No, there really is an error in your original post. You have x_to_y mapping y:=x and y_to_x mapping x:=-y. So it is not an inverse function.

When I try your other functions, OM also solves them just fine.

Feb-03-17 10:20:19
Category: Programming

The inverse annotation is not used by OpenModelica. It solves the function numerically instead (your x_to_y function has the error; fix it and you get the expected result). If you use Inline=true, the generated code does not contain any non-linear system to solve at run-time.

Feb-03-17 05:47:21
Failed Tests after building OpenModelica from source for Fedora 24
Category: Developer

The C++ runtime is requested using "--with-cppruntime". You should typically have a different line saying it failed to find omniidl if it doesn't find CORBA (but this has no impact on the tests).

Sundials is detected in the OMCompiler configure. It first looks for headers and then tries to link. If it says it fails to find sundials, read the config.log carefully to see what is missing. I think you need all of cvode, kinsol and the ida solver installed (which are separate packages on Ubuntu; don't know about Fedora).

./configure --without-cppruntime or figure out how to solve it manually with the newer Sundials version

Feb-02-17 12:42:06
Failed Tests after building OpenModelica from source for Fedora 24
Category: Developer

Most (all?) of those are from optional dependencies. The C++ runtime is needed for cppruntime and hpcom tests. The sundials suite needs to be installed in order to run IDA / Radau / etc solvers (need to ./configure again after installing those packages).

(Or at least make clean in OMEdit; if your omc executable works fine there should be no need to clean that. Just make sure the same C++ compiler is used for OMEdit as for OMC)

I suspect you need a make clean and then re-compiling. The errors seem related to using different C++ compilers for different parts of the code.

It's a compiler debug-flag. If you use mos-scripts, you pass it when calling omc, so "omc -d=-noinlineFunctions script.mos". In OMShell, you can use setCommandLineOptions("-d=-noinlineFunctions"). In OMEdit, it is hidden under Options->Simulation->OMC Flags

The AdvancedNoise library contains the parts of the Noise library that didn't make it into MSL due to the above mentioned issues in OpenModelica (and some other issues in other tools).

Jan-26-17 06:32:57
Debian jessie; nightly build; upgrade fetches and installs new library but OMedit opens old one

As an alternative, you can File->Open /usr/lib/omlibrary/PowerSystems latest/ and it will appear in the recent libraries list.

Jan-26-17 06:32:07
Debian jessie; nightly build; upgrade fetches and installs new library but OMedit opens old one

OMEdit is a bit stupid if you load libraries using the File menu (you can't choose which version to load there).

If you go to Options->Libraries, you can add PowerSystems and manually put latest as the version and it will load the correct PowerSystems (on every startup though).

Jan-18-17 14:55:08

As far as I know, no FCSys version works with any OpenModelica version.

Jan-18-17 13:43:44
functionality … FCSys.html says FCSys does not work in OpenModelica at the moment.

Yes, you have created an algebraic loop saying basically dio_out = not dio_out, which cannot be solved. Make dio_out a discrete variable:


when sample(0, 0.01) then

  dio_out = not pre(dio_out);
end when;

Jan-13-17 13:57:49
Category: Programming

You cannot access variable attributes by dot-notation

Jan-05-17 12:28:22
for continuous integration
Category: Developer

We have a 100 Mbit/s connection and the OMC package is small. I would assume travis-ci fetches through an apt cacher (proxy) anyway (I do when building, and my build machine is connected to the same switch as the maching hosting the packages).

Jan-05-17 11:56:10
for continuous integration
Category: Developer

You need to check the output of the OMC commands and call exit(1) if you want an exit code. For example, this fails because loadString is commented out:


//loadString("model M end M;");getErrorString();

res:=simulate(M); getErrorString();
if res=="" then
end if;

Jan-04-17 11:59:55
for continuous integration
Category: Developer

The latest OMC release for 16.04 LTS is also 1.9.7... For 12.04, we will not build anything anymore. There were too many changes to Ubuntu to bother supporting it. 14.04 we still build the release tag (release), maintenance branch (stable) and master branch (nightly). Use "stable" instead of "release" if you want to use 1.11.0 beta and release candidates (there is no 1.10.0 release).

Jan-02-17 11:09:50
Error porting code accepted by modelicac

"in" is a keyword and cannot be used for identifiers.

I guess you don't have pkg-config installed

A better place to start is looking at the profiler output. Often it is a non-linear system that is the bottleneck, and not DASSL.

On Raspberry Pi 2/3, there are pre-built packages. Install them the same way you installed your Linux packages for x86 (Debian Jessie, Ubuntu trusty/xenial/yakkety have packages).

Dec-06-16 17:49:04
generated class file won't translate to C

In order to follow the Modelica specification and define the variable to be an input (that can somehow be controlled externally):


model M

  InPutPort p(vi=r);
  input Real r;
end M;

Only inputs in the top-level model are kept. Any other input variables need to be connected. (This is a change from Modelica 2.x, in which some tools allowed these sort of models)

Dec-06-16 13:38:50
generated class file won't translate to C

(Current) OMC generates FMI 2.0 by default as far as I remember. Look in your model closer and you see why vi is not assigned. As far as I can see, you have


// input vi

vo := vi;
inpu := vo;

Dec-06-16 12:12:47
generated class file won't translate to C

The model is not very useful, but I suspect modelicac allowed input variables not on the top level class to count as inputs to the simulation. lacks an equation in your model, which is not allowed in Modelica.

Dec-06-16 11:46:42
generated class file won't translate to C

It might just be something that changed in the Modelica specification (modelicac does not follow recent standards). I can't really say without seeing the model in question, but you could try with --std=1.x or --std=2.x to see if that makes a difference.

Did you do a git clean of all repositories? The Windows build is working, so a git clean should solve the problem...

rm /e/OpenModelica.git/build/bin/omc.exe and try again (or do git clean). There was a change to the bootstrapping interface recently, which causes this issue if you have an old omc that you compile through.

Dec-02-16 17:09:33
generated class file won't translate to C

That's not a Modelica file, but a "flat Modelica" file. They cannot be used as input to the compiler.

From command-line or OMEdit additional simulation flags (-overrideFile=...) or in OMShell simFlags="-overrideFile=...". … erridefile

Given that OpenModelica is also case-sensitive, can you check if you have a file or HPcomponents/ that contains a class HPComponents (could be that Windows OpenModelica ignores the error in that file and Dymola silently renames the class)? Otherwise, I am really unsure what could be wrong and would have liked to see a zip of the library...

Nov-18-16 06:47:56
How to integrate a model designed in OpenModelica to a custom app ?

It is also possible to use the OPC-UA interface to control a simulation.

Nov-18-16 06:47:10
How to integrate a model designed in OpenModelica to a custom app ?

Did you try exporting a source-code FMU? It doesn't depend on any external libraries... … ompile.mos

Well, your functions starts the loop with n=1, so the n=0 case is undefined. You don't initialize y, so it gets random data (possibly 0). You then recursively call the function to multiply i by fac(i-1), which again ends with the undefined y (possibly 0).

You are mixing iterative and recursive styles. Choose one:

For a recursive factorial: …

Or iterative: …

Correct syntax is: if (n==0)

Nov-04-16 11:30:39
Unable to get the output from System() C on a Linux Machine

It's output to the console, which in OMShell's case is redirected to a log-file...

You can check env.vars using: … ronmentvar

If you open OMEdit from a console window the env.vars might be preserved. It depends on where you set them as well (bashrc / /etc/profile, etc)

Nov-04-16 07:48:21
Unable to get the output from System() C on a Linux Machine

You can use OMShell, OMNotebook, mos-script or like me "omc -s" followed by make and running the executable yourself.

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