Archived OpenModelica forums. Posting is disabled.

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


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

Posts

Posts

Dec-16-15 08:14:56
Compiling a model with msvc
Dec-15-15 18:58:32
Simulating a model

It could be that a process got stuck while writing or executing that file. Have a look in task manager to see. I would suggest also a computer restart.

Dec-15-15 14:00:45
Simulating a model

That messages says that "ld" cannot open Modelica.Mechanics.Translational.Examples.Accelerate.exe for writing (the C code was generated and now the  linker ld wants to build the executable) which means something is blocking it.
What kind of antivirus do you have?

Dec-15-15 09:34:58
Simulating a model

You do not need OMDev folder. Remove that and also remove OMDEV environment variable if you have it.

You could also try the nightly-builds:
https://build.openmodelica.org/omc/buil … ly-builds/
as we fixed a lot of issues in the compiler since 1.9.3.

Nov-19-15 13:02:24
Error in FMU export: Cannot find .log

Hi,

The FMU export is currently broken on Windows, please install this nightly-build:
https://build.openmodelica.org/omc/buil … d87aeb.exe
which should work fine.

We will fix it next week and then new nightly-builds should work fine.

Cheers,
Adrian Pop/

It depends if they are time events (i.e. sample) or state events. When you have time events you know when the next event is.
If you have state events you only know when the event indicators change.

Model exchange does not integrate anything internally. The integration is done by the external solver.

I suggest you have a look inside fmuChecker on how simulation of model exchange FMUs is implemented:
https://trac.fmi-standard.org/browser/b … ce-Checker
download the source code and look into file fmi2_me_sim.c.

Cheers,
Adrian Pop/

Oct-28-15 09:18:58
OMC v.1.9.4 build 139 work good with converters of buildings library, OMC v.1.9.4 build 295 no

When we fixed some issues in the Annex60 library some models in Buildings started to fail. There is a ticket about it:
https://trac.openmodelica.org/OpenModelica/ticket/3506
Hopefully we'll have some time to look into it soon.

You can use the C++ runtime for the FMUs for better performance (flag +simCodeTarget=Cpp), see here:
https://www.modelica.org/events/modelic … chmann.pdf

Cheers,
Adrian Pop/

That's easy. Just simulate the Model in OMEdit then load the generated Model_res.mat in Matlab.
The Model_res.mat is generated in your temp folder/OpenModelica/OMEdit.

Oct-21-15 06:26:41
Category: Developer

Very weird that  libgfortran-3.dll is to blame.
The library is copied from the mingw gcc 4.4.0 suite that we have.
dchneric, do you have more details about what dependency issues are there?

In the meantime we worked on reducing the FMU dependencies and we can now build a source code FMU that can be compiled on mostly any platform that has a C compiler. This is not yet integrated with OMEdit but we will do that soon.
You can use this with the latest nightly-build:
https://build.openmodelica.org/omc/buil … ly-builds/
via a script.mos containing:

Code:


setCommandLineOptions("-d=buildStaticSourceFMU"); getErrorString();
loadModel(YourLibrary); getErrorString(); // load the library needed
loadFile("Model.mo"); getErrorString(); // load the .mo file with the model if needed
translateModelFMU(Model); getErrorString(); // generate the FMU

Then call omc on the script.mos

Code:


C:\OpenModelica\bin\omc.exe script.mos

Cheers,
Adrian Pop/

Not yet. The biggest size has the C compiler that we need to distribute. If we don't distribute that then the installer is pretty small.
The problem is that you need a C compiler to compile the code generated from a model for simulation.
Do  you have issues with space?

On Windows:
1. everything is needed from the OpenModelica installation, except /bin/OMEdit, OMShell, OMPlot, OMOptim, Qt*.dll
2. OPENMODELICAHOME and OPENMODELICALIBRARY environment variables have to be set

Cheers,
Adrian Pop/

For the static .a (trace-v6.txt) seems it needs -lstdc++. Try this:

Code:


> export MODELICAUSERCFLAGS=-ldl -lstdc++
> omc script.mos

Hi,

In case of .so (trace-v5.txt) you have this issue:

Code:


ExternalMedia_Test_TestMedium_GenericModels_CompleteThermodynamicState$completeState2_Medium_getMolarMass
{"Error: OMC unable to load `./ExternalMedia_getMolarMass_54.so': /usr/lib/x86_64-linux-gnu/omc/libExternalMediaLib.so.3: undefined symbol: _ZN20CoolPropStateClassSI2hLEv.", "RUNTIME", "Error", "-1"}

Can you tell me where did you get ExternalMedia and CoolProp and which versions?
I need to try this myself as otherwise we're just playing in the dark current/smile

Cheers,
Adrian Pop/

Sep-28-15 20:57:42
how to utilize the exe file that is compiled when i simulate a model?

You need some dlls from C:\OpenModelica....\bin\ in order to be able to run your model.
Copy all dlls but the Qt ones to the folder you have Model.exe in.

Cheers,
Adrian Pop/


Thanks sjoelund.se, you're right, we need to add it when linking the libExternalMediaLib.a to our the dlls we generate during compilation.
I wonder if we can use MODELICAUSERCFLAGS for this.

PG you could try this:

Code:


> export MODELICAUSERCFLAGS=-ldl
> omc script.mos

Cheers,
Adrian Pop/



Hi,

Seems you need to add -ldl together with -fPIC.
http://stackoverflow.com/questions/2406 … find-dlsym

Cheers,
Adrian Pop/

The problem is that we don't put parameters inside the csv as it would have the same value and waste space. We only put parameters inside inside the .mat file.

You can do what you want using scripting and the setComponentProperties API, see https://www.openmodelica.org/download/OMC_API-HowTo.pdf

Code:


loadFiles({"Alpha.mo", "Beta.mo", "Gamma.mo"}); getErrorString();
// make c a parameter
setComponentProperties(Gamma, c, {false,false,false,false,false},{"parameter"},{false,false},{""}); getErrorString();
// remove c as parameter
setComponentProperties(Gamma, c, {false,false,false,false,false},{""},{false,false},{""}); getErrorString();

Cheers,
Adrian Pop/

Do you want this only at the beginning (initialization) or you want something like this?

Code:


class Gamma
  parameter Real c = alpha.a + beta.b;
  parameter Alpha alpha;
  parameter Beta beta;
end Gamma;

I suggest you edit these lines:

Code:


ifeq ($(LIBRARYEXTENSION),.a)
  install         : install_static
  LIBFLAGS        =-fPIC -static
endif

to:

Code:


install         : install_static
LIBFLAGS  =-fPIC -static

and run make again. Then run make install to push it system wide.

Strangely it has:

Code:


ifeq ($(LIBRARYEXTENSION),.a)
  install         : install_static
  LIBFLAGS        =-fPIC -static
endif

which should add -fPIC because the variable LIBRARYEXTENSION is set to ".a"

Can you run make for ExternalMedia?

Code:


make clean
make > trace-externalmedia.txt 2>&1

and then let me know what is inside trace-externalmedia.txt?

Cheers,
Adrian Pop/

Hi,

The problem seems to be this:

Code:


/usr/bin/ld: /usr/lib/x86_64-linux-gnu/omc/libExternalMediaLib.a(externalmedialib.o): relocation R_X86_64_32S against `_ZNSs4_Rep20_S_empty_rep_storageE' can not be used when making a shared object; recompile with -fPIC
/usr/lib/x86_64-linux-gnu/omc/libExternalMediaLib.a: error adding symbols: Bad value

You will need to recompile libExternalMediaLib.a with -fPIC. Do you know how to do that?

Cheers,
Adrian Pop/

See here: https://openmodelica.org/forum/default- … eter-sweep
You can run omc from command line from python, do buildModel and then use Model --overide to run it with different start values.

Sep-23-15 21:45:09
Category: Developer

Unfortunately I have no access to Simulink with FMI Toolbox to test this.
The import doesn't work or the actual simulation?
Is it the 64bit version of Simulink?

What version of OpenModelica are you using?

Code:


> omc --version

Can you run omc via command line using this script scrip.mos and let me know what errors you get:

Code:


loadModel(Modelica); getErrorString();
loadFile("/path/to/ExternalMedia 3.2.1/package.mo"); getErrorString();  // note that you need to change the path to where you have the library
simulate(ExternalMedia.Test.TestMedium.TestStatesSat); getErrorString();

Run via:

Code:


> omc --showErrorMessages --d=failtrace,dynload script.mos > trace.txt 2>&1

Then please paste or attach the contents of trace.txt here.

Cheers,
Adrian Pop/

Sep-23-15 10:24:42
Category: Developer

Hi,

What version of OpenModelica are you using?
If you take the latest nightly-build this should be fixed:
https://build.openmodelica.org/omc/buil … ly-builds/

Note that some of the commits comments are for the CPP runtime that you can activate with +simCodeTarget=Cpp.
By default we use the C runtime in which we fixed this issue.

Cheers,
Adrian Pop/

Sep-10-15 10:06:16
Unable to set the input parameters of my FMU


FMI-CoSimulation export is on the way, I'm testing it now and hopefully we'll have it next week.


We would need to do some changes to OMEdit to support export of FMI for CoSimulation as currently there is only support for ModelExchange.

Hi,

This is not currently possible.
We could probably make an enhancement in OMEdit to filter out what we display in the browser.
Note that if you delete all the other packages in OMEdit and leave only MultiBody it will not work
anymore as this package depends on some of the others.

You could add an enhancement ticket about this to our Trac:
https://trac.openmodelica.org/OpenModelica/newticket

Cheers,
Adrian Pop/

Aug-25-15 23:57:03
I cant open .mo files and save in W10

Try to write the models in a path without spaces. I think that's the problem.
Also OpenMdoelica needs to be installed in a path without spaces.

Please try this and let us know how it goes.
We haven't tried OpenModelica on Windows 10 yet.

As far as I know we do support (maybe partially) Modelica Device Drivers but I'm not sure.
You could give it a try and we can help you with specific issues.

Aug-25-15 14:41:42
how to provide the right regex to variableFilter?
Category: Programming

Alternatively you can use -overrideFile fileWithOverrideValues.txt which you can generate to contain:

Code:


startTime=243
stopTime=391
outputFormat=csv
variableFilter=mixer21.Out.*|mixer22.Out.*|effluentsink1.Out.*|sludgesink1.Out.*

Then you don't run into issues with command line escaping or the max size of the command line.

Aug-25-15 14:37:33
how to provide the right regex to variableFilter?
Category: Programming

You can use quote sign inside quotes using \", example: "some text \"quoted text\" some more text".
You could also try to escape the pipe use \\| instead of |.

Aug-25-15 14:33:04
-override option seems to fail
Category: Programming

Hi,

I don't know why it returns -34.
Can you post the model so I can test with it?
If is not public you might send it to us via email at OpenModelica [at] ida.liu.se
and we'll only use it for debugging and delete it afterwards.

How about if you do without -r:

Code:


buildModel(mymodel);
system("mymodel -override startTime=250,stopTime=260");

Also, have you tried to use forward slash instead of backward slash for paths -r D:/path/to/output.mat

Yes, you cannot use the same file for input and output at the same time.


What version of OpenModelica are you using? Go to Help->About OMEdit [Connected to OpenModelica ...] Copy the text from there and paste it here.

To post the model you go to the text view (The third icon followed by the (i) icon) and copy the text and paste it here.

Note that you do not need to copy the model by building it from components. You can right click on for example TanksWithOverflow and say "Duplicate".
Then give a name say "MyTanks" and no path. It will be copied at the top level (scroll down in the left side browser) and you can edit whatever you want in it.

Aug-25-15 02:19:11
Hi All, I am drafting a Brayton Cycle model for simulation in OpenModelica, I have used...
Category: Developer

The warnings are just because the library .mo files are not encoded in UTF8. They do not prevent the loading of the library files.
You can open the wrongly encoded files in NotePad++ and go Encoding->UTF without BOM and press save.

As far as I can tell this library depends on ExternalMedia so you need to have that library present also.
You can put the library in any of these directories:
C:\Users\Jeet\Desktop\Project Work\
or
C:/OpenModelica1.9.3Nightly/lib/omlibrary

You can download the library from the same place where you downloaded ThermoCycle library:
http://www.thermocycle.net/download/externalmedia/
or from github:
https://github.com/modelica/ExternalMedia
Also see here:
https://github.com/modelica/ExternalMed … lation.txt
Note that external media depends on other external software like CoolProp.

Cheers,
Adrian Pop/

Aug-25-15 01:04:42
Hi All, I am drafting a Brayton Cycle model for simulation in OpenModelica, I have used...
Category: Developer

We have not tried this library with OpenModelica yet so it might not work.
As to your errors, in general you cannot compile packages, only models inside them.
See if there is an Examples package in the library and see if you can simulate the models in it.

Unfortunately I don't know of any such open-source library available.
It should be possible to make your own library using external C code to connect to the board.

Can you post the model?
Flattening error means we could not translate the model to DAE form (system of equations).
The compiler has 2 phases front-end flattening (removing object orientation and generate the DAE system) and back-end (compiling the DAE system to C code).

Aug-24-15 21:16:29
I'm working with the latest version, and when I try to run a model I get an out of memory...

Windows 64bit is on the way hopefully available next week.
BTW, which version of OpenModelica are you using?

Hi,

I used --locale=C because my Windows locale is in Swedish and omc has translations. If you set it to C then is the default English.
.mat files can be opened by Matlab or Octave (Matlab open-source clone).
You can also use python with the matplotlib package:
http://stackoverflow.com/questions/2078 … ith-python

I think .csv are easier to read than .plt but maybe that's subjective current/smile

Cheers,
Adrian Pop/

Hi,

Yes, I use:

Code:


res[size(res, 1), size(res, 2)]

to get the last value of the variable x as in this case I build a matrix: time, x.

I don't know if is a common way to get the value regardless of time but it works in this case as I know the matrix.
If you don't know how many variables are in the matrix then is better to use val(variable, time).

Cheers,
Adrian Pop/

Hi,

You can run the generated executable with:

Code:


> K -help

to get the list of options or you can run:

Code:


> omc --locale=C --help=simulation

for more info you can use

Code:


> omc --locale=C --help
> omc --locale=C --help=topics

You can use -override to set the startTime,stopTime and outputFormat.

Code:


str_cmd := "K.exe -override a=4,b=5,c=6,d=7,startTime=0.0,stopTime=10.0,outputFormat=plt";

As far as I know if you select outputFormat to plt some things might not work like val or readSimulationResult.
The best supported result file is .mat.

Why do you need .plt? You can also have .csv (comma separated values file which you can open in Excel or OpenOffice).

Cheers,
Adrian Pop/

You can generate .csv files instead of .mat files and open them in Excel.
In OMEdit: Simulation->Simulation Setup->Output tab->Output Format.

Alternatively you can use a script, say script.mos file containing:

Code:


// start script.mos
loadModel(Modelica); getErrorString();
// loadFile("YourModel.mo");  getErrorString();
// loadModel(YourModel); getErrorString();
simulate(YourModel, stopTime=5);  getErrorString();
val(variable_name, 0);
val(variable_name, 0.2);
val(variable_name, 0.3);
// end script.mos

Then run omc from command line and give script.mos as a parameter:

Code:


c:\OpenModelicaX.Y.Z\bin\omc script.mos

Hi again,

I made a script that does parameter sweep:

Code:


loadString("
class Model
  parameter Real a=-1;
  Real x(start=1);
equation
  der(x) = a*x;
end Model;
"); getErrorString();
buildModel(Model); getErrorString();
results := "time,x,\n";
for a in {-2, -1, 1, 2} loop
  str_a := String(a); getErrorString();
  str_cmd := "Model.exe -override a=" + str_a;
  print(str_cmd + "\n"); getErrorString();
  system(str_cmd, "output.txt"); getErrorString();
  res := readSimulationResult("Model_res.mat", x); getErrorString();
  results := results + str_a + "," + String(res[size(res, 1), size(res, 2)]) + ",\n";
  closeSimulationResultFile();
end for;
print(results); getErrorString();
writeFile("results.csv", results);
plot(x, true, "results.csv");

Running the script from command line gets you:

Code:


adrpo@ida-liu050 ~/dev/OMTesting/forum/1670
$ /f/OpenModelica1.9.3-v1.9.3-dev-523-g1d963ac/bin/omc +locale=C sweep.mos
true
""
{"c:/bin/cygwin/home/adrpo/dev/OMTesting/forum/1670/Model","Model_init.xml"}
"Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
"
"time,x,
"
Model.exe -override a=-2
Model.exe -override a=-1
Model.exe -override a=1
Model.exe -override a=2

time,x,
-2,0.135336,
-1,0.367879,
1,2.71829,
2,7.38909,

""
true
true

I used the values of a as the time variable and plotted x at the end of the simulation for each a.


https://openmodelica.org/images/agorapro/attachments/118/mini_plot.png

Do you mean you want to variate parameter a and gather all the results for x at the end of each simulation with the new value of a?

Jul-24-15 22:08:27
problem while passing a struct output of an external function as input of an other one.

We do evaluate the functions during compilation if they are not declared impure and they have constant inputs.
An alternative is to use +d=nogen,noevalfunc but is better to declare them impure as you did if you don't want them to be evaluated during compile time.

This should not be a problem at all:

Code:


u1=Chirp();
u2 = mafonction(u1);

It does work fine in the zip i attached and not have things in reverse.

Jul-24-15 21:51:07
problem while passing a struct output of an external function as input of an other one.

It seems I really don't get what you're saying current/smile
So, is the problem solved now?

The values are reversed when in the .mo file you have out = f(in) and in the C code you have f(in, out)
I guess because the stack is somehow corrupted when the function expects 2 parameters and gets only one.

Jul-24-15 21:29:02
problem while passing a struct output of an external function as input of an other one.

The C code was wrong. you took the address of the pointer when doing memcpy.
And:

Code:


external u1 = mafonction(u) annotation(Library = "Chirp");

is not equivalent to:

Code:


external mafonction(u1, u2) annotation(Library = "Chirp", LibraryDirectory="modelica://ChirpSignal");

are not equivalent!

in the first case we generate u1 = mafonction(u) in the C code and in the second mafonction(u, &u1).
So if your C function is given as having 2 parameters you need to have the second style!
Do a diff of your code and the code in the zip i attached before to see what i changed!

Cheers,
Adrian Pop/

Jul-24-15 20:10:12
problem while passing a struct output of an external function as input of an other one.

Hi,

Your code is wrong both in the C file and in the .mo file. See the attached zip.
Model.zip

Code:


  function mafonction
    input Rec u1;
    output Rec u2;
    // send BOTH u1 and u2 to the external function as that is the way is defined!
    external mafonction(u1, u2) annotation(Library = "Chirp", LibraryDirectory="modelica://ChirpSignal");
  end mafonction;

Code:


rec* mafonction(rec test, rec* test1)
{
  memcpy ( test1, &test, sizeof(rec) );  // no addres of test1, is already a pointer
  return test1;
}

Running model.mos gets you:

Code:


adrpo@ida-liu050 ~/dev/OMTesting/forum/1665
$ /f/OpenModelica1.9.3-v1.9.3-dev-523-g1d963ac/bin/omc +locale=C model.mos
true
""
true
0
""
record SimulationResult
    resultFile = "c:/bin/cygwin/home/adrpo/dev/OMTesting/forum/1665/ChirpSignal_res.mat",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'ChirpSignal', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
    messages = "",
    timeFrontend = 0.7343596380537807,
    timeBackend = 1.148104848302405,
    timeSimCode = 0.006371707033899545,
    timeTemplates = 0.03741838078879516,
    timeCompile = 3.829548752874621,
    timeSimulation = 0.1699746779308428,
    timeTotal = 5.926586016890105
end SimulationResult;
""
"u1"
7.0
""
6.0
""
5.0
""
4.0
""
15.0
""
"u2"
7.0
""
6.0
""
5.0
""
4.0
""
15.0
""

Cheers,
Adrian Pop/

Jul-24-15 18:26:49
for application in complex wastewater systems

Hi,

This should be possible but I don't know if we have an easy way to do it.
You can use variableFilter when you call the simulate command in a script:

Code:


simulate(Model, variableFilter="x1|x2|x3");

to only keep the variables you want in the .mat file.
Then you can use the generated .mat file for initialization via:

Code:


simulate(Model, simflags="-iif=file.mat");

Se more here:
https://build.openmodelica.org/Document … ulate.html

Also call omc --help=simulation for more about the command line parameters for the generated Model[.exe] executable.

I suggest you do something like this in a script.mos file:

Code:


// load your libs
loadModel(Modelica); getErrorString();
loadModel(YourLib); getErrorString();
// generate the executable for your model
buildModel(Model); getErrorString();
// run the model to get the .mat file
system("Model -override stopTime=value,variableFilter="x1|x2|x3"); getErrorString();
// run the model again with the previous .mat file as input and direct the results to a new .mat file
system("Model -iif Model_res.mat -r NewResults.mat");

Then run the script.mos via command line:

Code:


> omc +locale=C script.mos

Cheers,
Adrian Pop/

Jul-24-15 18:15:35
buildModel call from OMShell-terminal or OMEdit fails with template error
Category: Developer

Hi,

I now opened a ticket about this:
https://trac.openmodelica.org/OpenModelica/ticket/3390
and hopefully we'll get to the bottom of this.

Cheers,
Adrian Pop/

I got it. I'll see if I can change the library to work better with OpenModelica.

Cheers,
Adrian Pop/

You can try with the latest nightly build:
https://build.openmodelica.org/omc/buil … ly-builds/
it seems to work fine to load the library.

Cheers,
Adrian Pop/

Hi,

OpenModelica comes with WasteWater 2.1.0, why do you need an older version?


Cheers,
Adrian Pop/

Jul-19-15 13:43:51
Where is the improvement

That is strange. According to our library coverage 1.9.2 is way better than 1.9.0, but it depends a lot on what libraries you're trying to use.
It could be the case that for some old libraries 1.9.0 is better.
Do you have a list of what libraries work better in 1.9.0 and not in 1.9.2? If so, let us know so we can look into it.

Jul-19-15 13:41:42
It is changing the flow direction even if I folow the sign convention for incoming and leaving flow

The forum is still active but most of our developers are in holidays. I'm glad you found a solution.

Also, this is a modeling questions and maybe is better to ask these kind of questions on:
http://stackoverflow.com/questions/tagged/modelica
as we're mostly into compiler development and don't know that much about modeling.

Cheers,
Adrian Pop/

Jul-19-15 13:39:07
development OMEdit
Category: Developer

Unfortunately, there is no development guide for OMEdit except the source code.
Basically all communication with the OpenModelica compiler happens via an API call inside the omc DLL.
Previously we had a CORBA communication with the omc.exe process but we changed that to C API calls from a DLL.
All calls were routed via OMCProxy.cpp.

What kind of API does your compiler has?

OMEdit in general does calls to APIs like loadModel, getClasses, getComponents, getAnnotations, simulate, instantiateModel, etc.
Some documentation of the API you can find here:
https://build.openmodelica.org/Document … pting.html

Cheers,
Adrian Pop/

The main problem seems to be that our lookup doesn't seem to work properly in some cases where you have model X = A.B.C.D and the function numEvents is in package B. This is a bug. When I fully qualify the uses of function numEvents to .DESLib.DEVSLib.SRC.numEvents then it goes further until it cannot find function RandomUniform which doesn't seem to be defined anywhere and is not part of the Modelica Standard. Maybe RandomUniform is a function that is (or was) defined in Dymola but is not part of the Modelica standard.

Can you use the library with Dymola? It doesn't work for me with version 2015 FD 01. I get a lot of errors.

Jul-19-15 12:36:36
No visualization window popping up

Hi,

This seems to be a bug newly introduced. I suggest you try an older nighly build:
https://build.openmodelica.org/omc/buil … lds/older/
from beginning of June.

I opened a bug ticket about this and I'll debug a bit more:
https://trac.openmodelica.org/OpenModelica/ticket/3385
and hopefully fix it soon.

Cheers,
Adrian Pop/

Jul-19-15 11:46:50
Saving causes new tab stop on annotations in /* operator

Unfortunately this happens for all code. The white spaces and formatting is not preserved.
We are working on fixing this, see bug: https://trac.openmodelica.org/OpenModelica/ticket/2905

Hi,

What example do you try to run? Let me know and I can see if I can find the issue.

Cheers,
Adrian Pop/

Jul-11-15 19:14:50
build from souce cross compile
Category: Developer

Yes, you can build from the source on Windows. This is how we do it in Hudson: https://test.openmodelica.org/hudson/job/OM_Win/
You need to have OMDev in C:\OMDev and a lot of stuff in your PATH, see below on export PATH current/smile
You don't need the source code, just git and this script will get it.
You can put this in a .bat script and run it.
For the msvc parts you need to have Visual Studio Express installed current/smile
For the QT clients you need to have Qt 4.8.0 SDK installed.
TortoiseSVN + command line clients is needed to update OMDev.

Code:


set OMDEV=C:\OMDev
REM WORKSPACE is where the source code will be downloaded and build. It needs to exist!
set WORKSPACE=C:\dev\
echo on
(
echo #!/bin/sh -xe
echo #
echo # script to build the OpenModelica windows build
echo # expects to have these things installed:
echo #   python 2.7.x - you need to run easy_install joblib simplejson requests in the cmd line in python/Scripts
echo #   nsis installer
echo #   TortoiseSVN command line tools
echo #   Qt 4.8.0
echo #   jdk
echo #   git - put it last in the path
echo #   OMDev in c:/OMDev
echo #
echo #
echo # set the path to our tools
echo export PATH=/c/bin/python273:/c/Program\ Files/TortoiseSVN/bin/:/c/bin/jdk170/bin:/c/bin/nsis/:/c/bin/QtSDK/Desktop/Qt/4.8.0/mingw/bin:$PATH:/c/bin/git/bin
echo #
echo # set the OPENMODELICAHOME and OPENMODELICALIBRARY
echo export OPENMODELICAHOME="${WORKSPACE}\\OM\\build"
echo export OPENMODELICALIBRARY="${WORKSPACE}\\OM\\build\\lib\\omlibrary"
echo # have OMDEV in Msys version
echo export OMDEV=/c/OMDev/
echo # update OMDev
echo cd /c/OMDev/
echo svn up . --accept theirs-full
echo # get back to our workspace
echo cd ${WORKSPACE}/
echo # check if we have OM already
echo if test ! -d OM; then
echo git clone --recursive https://github.com/OpenModelica/OpenModelica.git OM
echo fi
echo # update OM
echo cd OM
echo git reset --hard origin/master ^&^& git checkout master ^&^& git pull --recurse-submodules ^&^& git fetch --tags || exit 1
echo # checkout the specific revision given to us
echo git checkout $REVISION
echo git submodule update --init --recursive --force || exit 1
echo git submodule foreach --recursive  "git fetch --tags && git clean -fdxq -e /git -e /svn" || exit 1
echo git clean -fdxq || exit 1
echo git submodule status --recursive
echo cd ${WORKSPACE}/OM
echo make -r -f Makefile.omdev.mingw -j3 clean clean-qtclients
echo cd ${WORKSPACE}/OM
echo make -f Makefile.omdev.mingw -j2
echo cd ${WORKSPACE}/OM
echo make -f Makefile.omdev.mingw -j2 omlibrary-core
echo cd ${WORKSPACE}/OM
echo make -r -f Makefile.omdev.mingw -j2 qtclients
echo cd ${WORKSPACE}/OM
echo make -f Makefile.omdev.mingw simulationruntimecmsvc
echo cd ${WORKSPACE}/OM
echo make -f Makefile.omdev.mingw runtimeCPPmsvcinstall
echo cd ${WORKSPACE}/OM
echo make -f Makefile.omdev.mingw runtimeCPPinstall
echo cd ${WORKSPACE}/OM
echo make -f Makefile.omdev.mingw -j5 testlogwindows
echo cd ${WORKSPACE}/OM
echo # delete the libraries as Hudson is stupid
echo #rm -rf build/omc/omlibrary
) > buildWindows.sh

%OMDEV%\tools\msys\bin\sh --login -i -c "cd ${WORKSPACE} && chmod +x buildWindows.sh && ./buildWindows.sh && rm -f ./buildWindows.sh"

I think you misunderstand.
You cannot possibly disable the garbage collector without exhausting the memory in 1 minute of using OMEdit/OMC.
The GC is needed to collect unused memory and there is no other way to do that.
I'm fighting to get the 64 bit omc for Windows ready and it will get rid of these kind of problems.

Cheers,
Adrian Pop/

I suggest you use dygraph-combined.js from http://dygraphs.com/download.html for that.
You generate .csv files via: simulate(Model, outputFormat="csv") then you plot them using dygraph-combined.js.
You get interactive plots like these:
https://test.openmodelica.org/libraries … .diff.html
click on javascript.

Alternatively you could use python to plot the .mat file:
http://www.j-raedler.de/projects/dymat/

Alternatively you can use gnuplot to plot the csv files to png:
https://blogs.it.ox.ac.uk/networks/2011 … h-gnuplot/

Alternatively you could use octave to plot the mat file to png.

I don't think is possible (yet) from command line.
Why do you want the png file?

This seems like a bug in the OpenModelica compiler. If your model is public you could create a ticket in our Trac and attach it there:
https://trac.openmodelica.org/OpenModelica (New Ticket)
If the model is not public you can send it to us privately via OpenModelica@ida.liu.se and we'll only use it for
debugging and then delete it.
If you cannot send your model then maybe you can do a minimal model which has this issue which is public.

I think that there are several things here:
1. OpenModelica should support DFT via an API so you can plot these kind of things as many people are asking for it.
2. OMEdit should support some sort of scripting for ploting so you can plot using OMC API.

I think we should open 2 Trac tickets about this. ceraolo, can you do that?

Because you need to append the variable as string:

Code:


system("./BouncingBall -override stopTime=" + String(myStop) + ",outputFormat = csv");

Also, you again have a space after comma and before outputFormat. Be careful.

You can generate new result files using:

Code:


system("./BouncingBall -override stopTime=" + String(myStop) + ",outputFormat = csv -r file_" + String(i) + ".csv");

where i is an index variable for example.

At the end you could concatenate the csv files i guess.

I guess it should work with: ./Model -override outputFormat=csv

Apr-10-15 19:56:04
Category: Developer


Seems to be working OK with revision r25481 which I installed from here:
https://build.openmodelica.org/omc/buil … ly-builds/
https://www.openmodelica.org/images/agorapro/attachments/118/mini_VehicleInterfaces-OMEdit.png

What revision are you using?

You also seem to have a space here:

Code:


buildModel(Bouncing Ball);

should be:

Code:


buildModel(BouncingBall);

This is wrong:

Code:


system("BouncingBall -override startTime = 2, stopTime = 10");

It should be WITH NO spaces:

Code:


system("BouncingBall -override startTime=2, stopTime=10");

Right click on the model in the Libraries Browser and say Duplicate and then give it a name, say MyModel and put it at the top level (no path).
Then you can change it as you want.

I now updated the CDAC zip to contain the external C code:
https://openmodelica.org/openmodelicawo … s-examples

Apr-09-15 21:58:27
import record or class from file

Is possible using external functions, See an example here:
https://openmodelica.org/openmodelicawo … s-examples
CDAC Real Time Application.zip
I now update it to contain the C code.

The filtering works. If you give Simulation->Output->Variable Filter: body.a_0[1]
then it will NOT put these variables in the .mat file, that's why you cannot find it in the Variable Browser.

Note also the the Variable Filter is an regular expression which if it matches it will NOT put these variables in the .mat file.

What kind of file?

Apr-09-15 21:09:30
Loading parameter values from a file.
Apr-09-15 21:06:08
On a win32 system, the visualization gives me a new(?) error

There was a problem with initialization that was fixed a while back:
https://trac.openmodelica.org/OpenModelica/ticket/3209

Apr-09-15 21:01:40
On a win32 system, the visualization gives me a new(?) error

There was a problem with initialization that was fixed a while back:
https://trac.openmodelica.org/OpenModelica/ticket/3209

This is a bug. I added a ticket about it and we'll fix it:
https://trac.openmodelica.org/OpenModelica/ticket/3269

You could do:

Code:


buildModel(Model);

to get the Model.exe executable and then use from some external program of your choice or using system in .mos:

Code:


Model.exe -override var1=val1,var2=val2,startTime=x,stopTime=y -output oval1,oval2 -r unique_file_name.mat

if you don't want the .mat file you could use -noemit

Alternatively you could generate and FMU and then use your own dassl.

As I said, the old interactive simulation is not available anymore.

There is a new one if you simulate with outputFormat="ia" but I don't know exactly how it works.
I'll ask somebody else to give you some hints.

Apr-09-15 16:36:33
I would like to change the color in an animation dynamically.

Hi, I could change the color using this:

Code:


model tst
  inner ModelicaServices.Modelica3D.Controller m3d_control;
  inner Modelica.Mechanics.MultiBody.World world;
  Integer clr[3];
  Modelica.Mechanics.MultiBody.Visualizers.FixedArrow fa(color = clr);
equation
  connect(world.frame_b, fa.frame_a);
  clr = if time < 0.5 then {250, 0, 0} else {0, 250, 0};
  ModelicaServices.Modelica3D.setAmbientColor(m3d_control.conn, m3d_control.context, fa.arrowHead.mat, fa.arrowHead.color[1] / 255.0, fa.arrowHead.color[2] / 255.0, fa.arrowHead.color[3] / 255.0, 1.0, time);
  ModelicaServices.Modelica3D.setSpecularColor(m3d_control.conn, m3d_control.context, fa.arrowHead.mat, 0.00392156862745098 * fa.arrowHead.specularCoefficient * fa.arrowHead.color[1], fa.arrowHead.specularCoefficient * fa.arrowHead.color[2] / 255.0, fa.arrowHead.specularCoefficient * fa.arrowHead.color[3] / 255.0, 1.0, time);
  ModelicaServices.Modelica3D.applyMaterial(m3d_control.conn, m3d_control.context, fa.arrowHead.id, fa.arrowHead.mat);
end tst;

Hopefully you can do what you want with this.

Apr-09-15 16:18:16
I would like to change the color in an animation dynamically.

It seems that our Modelica3D doesn't have a Modelica3D.SetMaterialColor function but it does have some other functions.

Apr-09-15 15:53:06
I would like to change the color in an animation dynamically.

Yes. There were. I'm looking into this presentation:
http://www.modprod.liu.se/modprod2012/1 … lica3D.pdf
And it seems there is something like:

Code:


Modelica3D.SetMaterialColor(fluidMaterialVis3D[i].id, rVis3D, gVis3D, bVis3D, update3d.frame);

which means that you specifically need to signal a color change via a Modelica3D function call inside the when equation, you cannot just change the clr variable.

The trouble is I don't know yet how to adapt this to the model given above by Bas.

I'll play with it a bit and hopefully I'll find out how to do it current/smile

Apr-09-15 15:46:21
I would like to change the color in an animation dynamically.

Hmm, I don't know if we have support for that. I need to check a bit in the Modelica3D library. I'll let you know as soon as possible.

Where in the user's guide? If you are referring to the interactive simulation that was discontinued a while back I think 1.8.1 was the last release to have it.

You can communicate via tcp/ip with Model.exe but you need to do that using external functions in which you write the communication.

What exactly do you want to achieve?

No. We don't have such facilities.
If you have such an external program that can extract data from an Excel file,
you could use

Code:


system("program excel_file");

Can you tell us a bit more why do you need such facilities in the scripting environment?

Apr-09-15 15:32:25
Some models in the library needs to be redeclared to used properly but, the redeclaration...

Hi,

Unfortunately, in some weird cases with redeclare we have some issues.
Either we don't apply all the modifiers, we apply them in a bad order, or we lose some of them.
Please add a ticket about it in our trac:
https://trac.openmodelica.org/OpenModelica
and if possible attach a (total) model which has this issue so we can debug it.

Cheers,
Adrian Pop/

If you use:
Model.exe -override stopTime=0.2 -output R1.v
Model_res.mat will be affected.
To not generate any .mat (so is not affected) add -noemit:
Model.exe -override stopTime=0.2 -output R1.v -noemit

You can do this in OMShell (or script.mos and run it via omc script.mos)

Code:


simulate(Model);
val(R1.v, 0.2); // get the value at 0.2
val(R1.v, 0.4); // get the value at 0.4
plot(R1.v); // plot the variable

simulate command will always recompile the model.
Yes, with override you can reuse the same model model.
From command line you could do:

Code:


# override stopTime
> Model.exe -override stopTime=0.2 -output R1.v
# plot R1.v
> path\to\openmodelica\bin\OMPlot --filename=Model_res.mat R1.v

You can use buildModel(Model) to just build Model.exe.
With simulation(Model, stopTime=XX) it will simulate the model from 0 to XX seconds.
You can use val(variable, time) after simulate command in OMShell.

From command line you can use Model.exe directly or from OMShell via system("Model.exe");

Code:


> Model.exe -override var1=value1,var2=value2 -output outvariable1,outvariable2

- output variable1 will show variable1 value at the end of the simulation

You could also use simulate(Model, outputFormat="csv") and will get you a Model_res.csv with the values of variables at all time steps.

Apr-08-15 12:39:50
Any recommendations on IDE? Can I use Eclipse for the development of custom extensions?
Category: Developer

You can use the MDT extension of Eclipse:
https://openmodelica.org/?id=49:modelic … n-category
See how to install it here:
https://trac.openmodelica.org/documents/MDT/install/

If you want to change the compiler code you will need to add +g=MetaModelica +d=nogen
for omc command line parameters in Window->Preferences->Modelica

Update your OpenModelica source folder via "svn up" and try again. I now added -fPIC flag so compilation should go further.

For make clean "make -C 3rdParty/OpenBLAS-0.2.8 clean > " remove also ">" and then try again.

For "./meta/meta_modelica_bulletin.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status" we need to add -fPIC for ARM.
I'll ask Martin how to do that.

For "syntax error near unexpected token 'ATOMIC_OPS' "  you need to install pkg-config.
As for openblas-clean edit /home/student/openmodelica/Makefile.common in the top directory and remove this part "> /dev/null 2>&1" to see what's going on.

Mar-30-15 08:38:33
Need a command-line option for plot() (call under OMSHELL) to directly save the graph as...

Just one notice. The cvs file does not contain the parameters. The mat file has those too.

Mar-28-15 06:59:47
Need a command-line option for plot() (call under OMSHELL) to directly save the graph as...

I suggest you stay in Java and make your own plot.
When you run simulate it will create a Model_res.mat so you can read that using for example:
http://sourceforge.net/projects/jmatio/
and plot the variables.

Alternatively you could use simulate(Model, outputFormat="csv") to get a Model_res.csv (comma separated values file)

Cheers,
Adrian Pop/

Mar-25-15 09:41:06
Category: Developer

Start with a tutorial:
https://openmodelica.org/images/docs/us … torial.pdf
Then you can also read the online interactive Modelica book:
http://book.xogeny.com/

Then you can write your model in OMEdit (OpenModelica Connection Editor) and simulate it there.
You can also use OMNotebook to write models.

You can also see more documentation here:
https://openmodelica.org/useresresource … umentation

Cheers,
Adrian Pop/

If your external function is blocking then it will wait until a result.
You can also use:

Code:


when sample(0, 10)  then
  reinit(variable, externalFunctionCall(time)); // the externalFunctionCall will return the new variable value
end when;

For some code examples have a look at:
https://openmodelica.org/openmodelicawo … s-examples
CDAC Real Time Application.zip
Is quite old and uses SimForge as graphical editor but the idea should work fine.
Unfortunately the code is missing the external library.

Hi,

There are several ways of dealing with this:
1. use OpenModelica 1.8.1 which still has the interactive stuff
2. use external functions in when equations to set the values of the variables you're interested in
3. use FMI, export your model in an FMU and load it and then you can change the values of variables.

For 3 you will need an FMI library to load the fmu in your process.


Mar-16-15 06:11:57
Internal error BackendDAE.adjacencyRowEnhanced failed for eqn: algorithm
Category: Developer

Unfortunately nothing can be seen in the image as it is too small. Would be better to copy the text and paste it here in between

Code:

 text  

.

Well, we don't have overrideFile with several files. You could append the files into one and it should work fine.

Now why on earth does one override file is not enough?
Just append the files to a third one and use that. Windows type a.txt b.txt > c.txt. Linux cat a.txt b.txt > c.txt.

Mar-14-15 03:22:47
For loop bug
Category: Developer

No problem.

Yes, if you put it in a function then is treated differently and it works.
In a model algorithm section we need to find the inputs and outputs of the algorithm,
sort the statements as we do with equations, etc. and it seems there is an error in
that handling.

Mar-14-15 02:32:14
While loop seems to give weird result
Category: Developer

Depends who. From my side I'm watching some tennis current/smile

Mar-14-15 01:45:12
While loop seems to give weird result
Category: Developer

You are missing an noEvent(count < 10)

Code:


model WhileLoopBug
  Real count;
  Real countks;
algorithm
  count := 0;
  while noEvent(count < 10) loop
    count := count + 1;
  end while;
  countks := count;
  count := 0;
end WhileLoopBug;

Mar-14-15 01:21:16
For loop bug
Category: Developer

Thanks for reporting this. I added a bug ticket about it:
https://trac.openmodelica.org/OpenModelica/ticket/3220

As a workaround for now until we fix it you can use equation instead of algorithm ( and replace := with = ).

Cheers,
Adrian Pop/

You will need to add visualization elements to your model similarly to what is done in the Modelica.MultiBody
See some documentation here:
http://simulationresearch.lbl.gov/model … isualizers
See how is done for body:
http://simulationresearch.lbl.gov/model … Parts.Body
this part:

Code:


  // Declarations for animation
  Visualizers.Advanced.Shape cylinder ....

Then you will need to extend your model similar to this (put this in a script.mos):

Code:


// load the modelica 3d
loadModelica3D(); getErrorString();
// extend the model
loadString("model MyModelExtended
extends MyModel;
inner ModelicaServices.Modelica3D.Controller m3d_control;
end MyModelExtended;");getErrorString();
// simulate your model
simulate(MyModelExtended);

Then run omc on script.mos.

Mar-12-15 04:55:05
Topic: OMShell
CombiTimeTable get filename

It might work with -override fileName=new_filename on the simulation executable.
So you do buildModel first, then you use system("Model -override fileName=new_filename) from OMShell or directly from command line:
Model -override fileName=new_filename

Mar-12-15 04:52:30
Topic: OMShell
execute from win7

Unfortunately that's not yet possible. You can however run omc directly on the mos script:

Code:


c:\OpenModelica\bin\omc  c:/test/a.mos

What version of svn client do you have? Do:

Code:


> svn --version

If is 1.8 you could try to downgrade it to 1.7.

I fixed this issue in r25016. You can take the nightly-build from tomorrow morning and it should work:
https://build.openmodelica.org/omc/buil … ly-builds/

Ouch, it seems this is broken since a long time now. In 1.9.1 is because of some other reason but still.
We're investigating the issue now and hopefully we'll find a solution soon:
https://trac.openmodelica.org/OpenModelica/ticket/3209

I'll let you know how it goes.

Cheers,
Adrian Pop/

Mar-10-15 11:22:08
Topic: OMPython
no result file

Hi,

1. the file is generated in the current directory, not in c:/loop.
use cd("c:/loop") before running simulate if you want the files there.

2. Use: simulate(Model, outputFormat="csv") to generate a comma separated values file.

3. Use val(meter.v, 33) to get the value of meter.v at time 33

See also:
https://build.openmodelica.org/Document … pting.html
and the user's guide.

Cheers,
Adrian Pop/

You could try version 1.9.1 until we fix this issue.

You can use "ar" to archive .o files inside a library:

Code:


ar -ru  libext_lib.a ext_lib.o

Hi,

I just installed the same version (OM 1.9.2 r24863) and for me the simulation goes fine.

Code:


stdout | OMEditInfo | <p>C:/Users/adrpo/AppData/Local/Temp/OpenModelica/OMEdit/Modelica.Mechanics.MultiBody.Examples.Elementary.DoublePendulum.exe -port=24366 -logFormat=xml -override=startTime=0,stopTime=3,stepSize=0.006,tolerance=0.0001,solver=dassl,outputFormat=mat,variableFilter=.* -dasslJacobian=coloredNumerical -w -lv=LOG_STATS</p>
LOG_STATS | info | <p>### STATISTICS ###</p>
stdout | OMEditInfo | <p>Simulation process finished successfully.</p>

You could try to logoff and logon (or restart) after installation if you haven't done so.
Let me know if that works.

Cheers,
Adrian Pop/

Feb-11-15 19:53:09
Issues on Setup Visual Studio Compiler in OMEdit instead of mingw in windows

Hi,

The +target=msvc should work again now.
The ticket:
https://trac.openmodelica.org/OpenModelica/ticket/3137
is now fixed.

Take the nightly build tomorrow (at least revision https://trac.openmodelica.org/OpenModel … et/24538):
https://build.openmodelica.org/omc/buil … ly-builds/

Cheers,
Adrian Pop/

Yes, the forum is in operation but sometimes we are too busy to answer or we really don't know the answer.

Some of these are known bugs and we're working on them.

See: https://trac.openmodelica.org/OpenModelica/ticket/3095
for missing class modifiers:

Code:


stodolaturbine1(Cst(fixed = false), Ps(fixed = true, start = 4.7e6))

For the saving issue, does OMEdit saves your model inside package.mo or it is not saved anywhere?
Maybe you can open a ticket about it and give all the information you have:
https://trac.openmodelica.org/OpenModelica

Cheers,
Adrian Pop/

Feb-06-15 00:29:50
Issues on Setup Visual Studio Compiler in OMEdit instead of mingw in windows

Unfortunately the Visual Studio compilation of model code is broken since  while now.
I opened a ticket about it and we'll fix it:
https://trac.openmodelica.org/OpenModelica/ticket/3137

You can use print or this:
https://build.openmodelica.org/Document … print.html

print seems to work fine: (see messages="message")

Code:


adrpo@ida-liu050 ~/dev/OpenModelica/build/bin/
$ cat > msg.mo
model msg
  Real x, y;
equation
  x = time;
  when time > 0.5 then
    print("message");
    y = time;
  end when;
end msg;

adrpo@ida-liu050 ~/dev/OpenModelica/build/bin/
$ cat > msg.mos
loadFile("msg.mo"); getErrorString();
simulate(msg); getErrorString();

adrpo@ida-liu050 ~/dev/OpenModelica/build/bin/
$ ../omc msg.mos
true
""
record SimulationResult
    resultFile = "c:/bin/cygwin/home/adrpo/dev/OpenModelica/build/bin/msg_res.mat",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'msg', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
    messages = "message",
    timeFrontend = 0.02278212030280691,
    timeBackend = 0.008754299484735505,
    timeSimCode = 0.001498251334356035,
    timeTemplates = 0.04028148031235384,
    timeCompile = 3.071980736768558,
    timeSimulation = 0.1831265795253099,
    timeTotal = 3.329325806147373
end SimulationResult;
"Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
"
adrpo@ida-liu050 ~/dev/OpenModelica/build/bin/
$ ./msg.exe
message

Jan-26-15 13:21:56
OpenModelica interactive simulation example

No idea if they have this in Dymola.

You could make a bigger model in which your model is a component and then use when equations to change values of
variables at different times during the simulation. The only problem with this is that it doesn't work for parameters, just
variables.

Oct-30-14 19:42:59
The examples in the Modelica_synchronous library won't run

Hi,

OpenModelica does not fully support synchronous features from Modelica Specification 3.3.
We're working on it but it will take a while.

Cheers,
Adrian Pop/

Oct-25-14 16:38:19
Links to download the 1.9.1 Source.
Category: Developer

Hi,

There is no tar.gz source for OpenModelica 1.9.1. Just take it from Suversion:
> svn co https://openmodelica.org/svn/OpenModeli … LICA_1_9_1 OpenModelica-1.9.1
> tar -zcf OpenModelica-1.9.1.tar.gz OpenModelica-1.9.1

Cheers,
Adrian Pop/

ThermoPower is currently in a process of redesign and the coverage is not that good:
https://test.openmodelica.org/libraries/trend.html

As far as I've heard from Francesco Casella they will be ready with the changes this week and it will be much better.

Cheers,
Adrian Pop/

Oct-12-14 13:09:48
parameter dialog popup in OMEdit is extremely slow for Fluid componenets

Hi,

This is a bug and we will fix it. I added a ticket about it here:
https://trac.openmodelica.org/OpenModelica/ticket/2882
Please add further details to the ticket, like what model, which component you right click, etc.

Cheers,
Adrian Pop/

Oct-09-14 01:29:27
Lots of errors when trying to simulate examples in OMEdit.

Hi,

Unfortunately not all the models can currently be simulated.
There are still some issues in the back-end and the runtime system but we're working on fixing them.
You can always see the current status of the library coverage (what compiles and what simulates ) here:
https://test.openmodelica.org/libraries/trend.html
so you know what to expect.

You can click on any image to get to an overview of the library coverage run.

Cheers,
Adrian Pop/

Oct-07-14 20:03:34
Lots of errors when trying to simulate examples in OMEdit.

Hi again,

I now fixed the bug and if you get the nightly builds tomorrow, they should work fine.

Cheers,
Adrian Pop/

Oct-07-14 13:25:10
Lots of errors when trying to simulate examples in OMEdit.

Hi,

This is a bug that needs to be fixed. Somehow simulation works fine in command line but it fails in OMEdit.
I added a ticket for it and I started looking into it:
https://trac.openmodelica.org/OpenModelica/ticket/2871

Cheers,
Adrian Pop/

Hi,

The link is not invalid, see here:
https://trac.openmodelica.org/documents … ingMDT.pdf
You need to uncheck "Group items by category".

Cheers,
Adrian Pop/

Oct-06-14 10:55:52
Lots of errors when trying to simulate examples in OMEdit.

Some of the errors are not really errors (even if they are reported as such), the model works to simulate.

What problems did you had with nightly builds? I think they are far better than the stable releases.

Cheers,
Adrian Pop/

Oct-01-14 00:23:07
Alternative OpenModelica Output Files

Sorry, I made a confusion regarding hummod.org, I thought it was a website for some model we played with (which was also called HumMod).
Anyhow, you can also have a look at the Physiolibrary.

Cheers,
Adrian Pop/

Oct-01-14 00:18:20
Alternative OpenModelica Output Files

Select outputFormat="csv" in the simulate command or in OMEdit: Simulation->Simulation Setup->Output tab->Output Format.
You will get a csv (comma separated values) file as output which you can open in Excel or any text editor.

We run coverage tests on this library and you can see which models are working here:
https://test.openmodelica.org/libraries … rsive.html

Cheers,
Adrian Pop/

Probably OpenModelica compiler acting up and missing some modifiers or redeclares someplace.
I will have a quick look later this week.

Cheers,
Adrian Pop/

Sep-21-14 17:17:03
Topic: error
thermo power ,Rankine cycle

Can you post your model? That would help us debug the issue.
Seems you either forgot to redeclare a medium and it ends up inside PartialMedium or you discovered an OMC bug with redeclares.

I think from command line you can try +n=1 to set the number of processors:

Code:


C:\OpenModelica1.9.1Nightly\bin\omc.exe +n=1 script.mos

I don't see anything wrong with it either.
The only thing I can think of is that the installation went wrong and
gcc is not found in the PATH we are setting in Compile.bat.

From what I can see we set this:
C:\OpenModelica1.9.1Nightly>set PATH=C:/OpenModelica1.9.1Nightly/\bin;C:/OpenMod
elica1.9.1Nightly/\lib;C:/OpenModelica1.9.1Nightly/\mingw\bin;C:/OpenModelica1.9
.1Nightly/\mingw\libexec\gcc\mingw32\4.4.0\;
Can you please check that gcc.exe exists in C:/OpenModelica1.9.1Nightly/\mingw\bin?

I suggest you edit:
C:\OpenModelica1.9.1Nightly\share\omc\scripts\Compile.bat
and remove echo off so you can see the commands while they happen.

Also I suggest you run from command line (cmd.exe):

Code:


// create a file script.mos containing:
loadModel(Modelica); getErrorString();
simulate(Modelica.Electrical.Machines.Examples.AsynchronousInductionMachines.AIMC_DOL); getErrorString();
// end script.mos

Then run in cmd.exe

Code:


> cd path/to/script.mos
> C:\OpenModelica1.9.1Nightly\bin\omc script.mos

and let us know what you get.

Jun-03-14 19:09:34
Modifying openModelica compiler (written in metaModelica)
Category: Programming

You will need to do some processing of the DAE variables because they are already flattened (no structure present anymore) when they reach the XML dump.
You will need to merge the variables based on their types (if they have connector type) then you put them in the same struct in the XML file as  you want.
It might not be easy if you're not familiar with the compiler code and structures but is possible to do.

Cheers,
Adrian Pop/

May-22-14 01:06:12
Where can I get OMCppSimulation.exe and fmigenerator.exe?
Category: Developer

OMCppSimulation.exe is not longer used. Was left by mistake in the installation since a long time. It won't be present in the next nightly build.

Hi,

I suggest you try one of the latest nightly-builds:
https://build.openmodelica.org/omc/buil … ly-builds/
Also, the messages about missing start values were added because we do more checks for the initialization. They are mostly warnings.
To get rid of them you need to have (start = value, fixed = true) to fix the start values at initialization.
Read the Modelica specification 3.2 revision 2.

Cheers,
Adrian Pop/

May-13-14 10:08:41
How to setup Variable Initial Value?
Category: Programming

You can probably do this using bindings and maybe you need reinit and when equations.
It depends if you have continuous variables or discrete ones.

Code:


Real C0 = somevalue;
Real C[N] = fill(C0, N) ;
equation
when time > 10 then
  reinit(C0, someothervalue);
end when;
// for loop ...

OpenModelica does not (yet) add automatically and inner component. You have to add the inner component yourself in the top model!

Cheers,
Adrian Pop/

May-07-14 10:01:43
C-Code implementation in an unknown embedded system

I don't know if you can even do this with commercial Modelica software at the moment.
Generating code for embedded systems is not an easy task.

You need to know a lot about the what kind of system it is, what sort of architecture it has and you need
to compile the code on that platform or cross-compile it on a different system but with the embedded
system as target.

Cheers,
Adrian Pop/

Apr-19-14 05:11:24
problems with getting a bode plot/ cannot get import to work in OMShel

Hi,

I now added a ticket:
https://trac.openmodelica.org/OpenModelica/ticket/2670
so that we can investigate if is even possible to support
this library sometime in the future.

We do have most of the functionality used in the library
but is different (the API is different, the plotting is different, etc).

Cheers,
Adrian Pop/

Apr-18-14 19:35:06
problems with getting a bode plot/ cannot get import to work in OMShel

Hi,

I had a look inside the library and this library will never work with any other tool but Dymola.
Is full of special Dymola annotations and Dymola API calls which are not standardized.

I downloaded this one: https://github.com/modelica/Modelica_LinearSystems2
Had to rename the directory inside from Modelica_LinearSystems 2.3.1 to Modelica_LinearSystems2 2.3.1
but the loading went fine after that.

Cheers,
Adrian Pop/

For the modeling issue, I have no idea.
As for why r_0 starts at 0:
If you use r_0(start = ...) and you want to force it to remain like that during initialization then use r_0(start = ..., fixed = true).

Apr-02-14 15:26:18
Category: Programming

You could probably use redeclares or inner outer.
Read more about those in the Modelica specification.

Cheers,
Adrian Pop/

Mar-26-14 15:36:29
Ability to compile 64 bit executables and FMUs
Category: Developer

I guess you're asking about Windows.
On Linux we already have it.

The answer is yes, we already compiled OpenModelica in Windows using 64 bit gcc
but there are some issues to resolve before we build a 64 bit release package.

Cheers,
Adrian Pop/

Well, if making it a parameter (with fixed=false) instead of a constant doesn't help then the
only way I can think of is to make 2 executables, one with the constant set to true and one
with it set to false and call them with -override for the other values.

Cheers,
Adrian Pop/

No. Constants are replaced in the model with their value during compilation.
You have to make it a parameter. And even so, if is a structural parameter it might not be possible to change.

Hi,

You could use -override var=value or -overrideFile=file arguments to the simulation executable.
instead of setInitXmlStartValue.

Another way is to give a .mat file to the simulation executable to be use as initial conditions
using -iif=mat_file_with_initial_values.mat

The idea is to first use buildModel(Model) to generate the executable,
then run the executable with different flags several times.

Cheers,
Adrian Pop/

Feb-22-14 20:00:13
Category: Programming

Hi,

You can put your model (as a submodel) inside another model which has inputs/outputs at the top level which you then connect to the submodel via connect or equations.
Read more about inputs/outputs at top level in a model in the Modelica specification:
https://www.modelica.org/documents/Mode … ision2.pdf
Section 4.4.2.2 Prefix Rules.

Cheers,
Adrian Pop/

Feb-22-14 19:52:55
Category: Programming

Hi,

I don't know of such functionality being available except in Dymola were you can export a model to an S-function (as far as i know).
Can Simulink import an FMI?

Cheers,
Adrian Pop/

Feb-17-14 19:00:18
Building model fails on a new xp installation

Unfortunately, I have no idea if the python installation broke the Windows XP handling. Maybe.
Anyway, I'm glad that you found out what the problem was with OpenModelica.

Cheers,
Adrian Pop/

Feb-17-14 15:20:36
Building model fails on a new xp installation

Maybe .exe and .bat file associations are corrupted somehow.
You could run a tool like this (or search google for something else):
https://support.kaspersky.com/viruses/disinfection/3732
to get them back.

Cheers,
Adrian Pop/

Feb-17-14 14:04:54
Building model fails on a new xp installation

Hi,

Have you tried a restart after installing? Or at least logout/login.

To test more I would suggest to run omc from command line:

Code:


> c:\OpenModelica1.9.0\bin\omc script.mos

where script.mos contains:

Code:


loadModel(Modelica); getErrorString();
simulate(Modelica.Blocks.Examples.Filter); getErrorString();

Then see what the output is and let us know.

sjoelund.se, i think OMShell runs getErrorString() automatically after each command.

I would also suggest to install the latest nightly build:
https://build.openmodelica.org/omc/buil … ly-builds/
as is far better than 1.9.0.

Cheers,
Adrian Pop/

runScript("path/to/script");

Jan-16-14 19:43:23
Why my model, well "check" by Dymola, chrash OMedit when "checking"?

Hi,

The omc process probably ran out of memory.
I assume you did this in Windows. If so, omc is a 32 bit process which can only allocate 4G of memory.
You could try in Linux as omc is 64 bit there and you can use more memory.
We will provide a 64 bit omc in Windows sometime in the future.

The problem is that if you cannot sent us the model is hard to debug.
If is possible, sent the model to OpenModelica <at> ida.liu.se and that way
it will not be public, will be used just by the OpenModelica developers for
debugging and not shared with anyone else.

Cheers,
Adrian Pop/

Hi,

Not really. You don't debug a model. You debug the compiler which flattens (instantiates) and optimizes and compiles a model to C code.
And you will need to compile OpenModelica for that. If you want to play with this (debugging the compiler compiling a model) see here:
https://openmodelica.org/documents/

Cheers,
Adrian Pop/

Hi,

You cannot Run models from MDT Eclipse (that is used only for compiler development and via Debug not Run).
The only way you can run a model is to simulate it from the MDT console.
However, I would suggest using command line or OMShell or OMEdit to simulate a model.

Cheers,
Adrian Pop/

Jan-07-14 14:37:13
Using the MDT console in Eclipse to simulate a model

Hi,

I assume you do this in the MDT console. If so, the command is simulate(Model) not simulateModel(Model).

Cheers,
Adrian Pop/

Hi,

Just say simulate(Model, stopTime=8760, numberOfIntervals=8760)
Or if you use OMEdit set it there.

Marry Christmas!

Cheers,
Adrian Pop/

Nov-25-13 11:31:11
Where is the winmosh console?

There is no winmosh.
That was a really old OpenModelica Shell. Use OMShell (OpenModelica Shell instead).

If you want to see the output of system commands you need to redirect them to files:

Code:


system("command > file.txt 2>&1");
readFile("file.txt");

but I would really suggest you use command line instead.

Code:


> command
> omc script.mos
> command

Cheers,
Adrian Pop/

Nov-15-13 14:52:09
Using Modelica to solve algebraic equation in C or Scala programm.

Hi,

From what I guess what you want to do is model the system in Modelica, generate code for it and then call it from C or Scala.
Or is it something else?

You could use:
- FMI (and call the dll via some jni)
- interactive (tcp/ip with the simulation process)

Cheers,
Adrian Pop/

Oct-27-13 21:29:17
how to declare array in modelica language
Category: Programming

Hi,

I suggest you read these things:
Modelica specification (Chapter 10 is about arrays):
https://modelica.org/documents/ModelicaSpec33.pdf

Some more stuff about Modelica:
https://www.openmodelica.org/images/doc … torial.pdf
Some OpenModelica documentation:
https://www.openmodelica.org/index.php/ … umentation

Cheers,
Adrian Pop/

Oct-25-13 11:24:34
Not clear how to select a valid initType in a PI block

Hi,

Modelica Specification is clear when it says that you cannot bind Integers to Enumerations.
Dymola supports it, but is not really conform to the Modelica Specification!
Use enumerations when you bind/compare enumerations and use Integer(Enumeration) when you want to convert enumerations to Integers.
See more here:
https://trac.openmodelica.org/OpenModel … tLibraries

Cheers,
Adrian Pop/

Hi again,

Do you have Dymola 2014?
Have you run Dymola in pedantic mode? Simulation tab->Simulation->Setup->Translation->"Pedantic mode for checking Modelica semantics"
It will tell you which variables are not fully initialized and then you have to add (start = Value, fixed = true) for them until you have a fully initialized model.
Then try the model in OpenModelica.

You cannot use -overrideFile to set values for initialization (that can only be used to set bindings, not start values for parameters and variables).
For initialization you have to edit your model and add (start = Value, fixed = true).

Cheers,
Adrian Pop/

Hi,

If you use OMShell to write these commands then getErrorString() is not needed as OMShell will sent it after each command.
I usually use omc directly from command line via:

Code:


omc script.mos

and when using it from command line you need getErrorString().

Cheers,
Adrian Pop/

Code:


simulate(ModelName, simflags="-overrideFile=file.txt"); getErrorString();

The file.txt should looks like

Code:


variable1=value1
variable2=value2

Oct-22-13 18:53:07
Matrix inductance

Hi,

Congratulations! You discovered a bug current/smile
It seems we're missing the declaration for the index s in the for loop in the algorithm for the zero crossing given by z>=s.
As a workaround for now use this line instead (add noEvent in the if condition here):

Code:


Lm[z,s]:= if noEvent(z>=s) then L[(s-1)*N+z-div((s-1)*s,2)] else Lm[s,z];

Cheers,
Adrian Pop/

Hi,

As far as I know CoolProp is now part of ExternalMediaLibrary:
https://svn.modelica.org/projects/Exter … rary/trunk
Is a bit of work in progress to make ExternalMedia work with OpenModelica.
There are some models that work (I've tried these):

Code:


loadModel(Modelica); getErrorString();
loadFile("ExternalMedia 3.2.1/package.mo"); getErrorString();

simulate(ExternalMedia.Test.TestMedium.TestStatesSat); getErrorString();
simulate(ExternalMedia.Test.TestMedium.TestBasePropertiesExplicit); getErrorString();
simulate(ExternalMedia.Test.TestMedium.TestBasePropertiesImplicit); getErrorString();
simulate(ExternalMedia.Test.TestMedium.TestBasePropertiesDynamic); getErrorString();
simulate(ExternalMedia.Test.TestMedium.TestBasePropertiesDynamic); getErrorString();

but you will need to put externalmedia.h in
c:\OpenModelica\include\omc
and libExternalMedia.a in:
c:\OpenModelica\lib\omc

Cheers,
Adrian Pop/

Hi,

Enclosed where?
Maybe it would be easier to report this as a bug in our trac as there you can attach files:
https://trac.openmodelica.org/OpenModelica/wiki
Just click on New Ticket.
Alternatively you can send me an email at the address you can find here:
http://www.ida.liu.se/~adrpo/

Cheers,
Adrian Pop/

Hi,

Please give a complete example if you have one as is not very clear how your redeclare in exends looks like.
Is it a component redeclaration? Is it a class redeclaration?
This might be a bug but to debug it we need a complete model.

Cheers,
Adrian Pop/

Oct-20-13 15:35:14
How to give an initial value
Category: Programming

Hi,

Start values are just  a hint. You have to add (start = value, fixed = true) if you want them to be fixed.
But in your case h is a parameter, not a variable so I would say to have: parameter Real h = 2.1;

Cheers,
Adrian Pop/

Oct-19-13 22:59:24
Adding a Modelica Library to my model
Category: Programming

That's because is sqrt with small caps. Try that.

Cheers,
Adrian Pop/

Oct-16-13 22:18:33
What are the means by which Modelica handles file i/o?

There is also an example function in the Modelica Standard Library on how to read from file.
See  for example:
https://build.openmodelica.org/Document … meter.html

Cheers,
Adrian Pop/

Oct-14-13 16:04:44
Compiler runs out of memory and quits

Hi,

We are looking into using mingw64 on Windows to compile OpenModelica
and that would make it able to use more memory (than 4G) for compiling
models. It will take a while thou. You could try the latest nightly build:
https://build.openmodelica.org/omc/buil … ly-builds/
as this one splits the generated C code into several files so it should
get the memory consumption for gcc down.

Cheers,
Adrian Pop/

We should really update the User's guide as is quite wrong. +g=MetaModelica will only accept MetaModelica programs.

Hi,

Not really, depends on what you want to debug. If you want to debug Modelica code your HelloWorld model should contain a call to a function that you have defined in your model. Also the mos script is wrong. For normal Modelica code (not MetaModelica code) should be:

Code:


setCommandLineOptions({"+d=gendebugsymbols"});
setEnvironmentVar("MODELICAUSERCFLAGS","-g");
loadFile("HelloWorld.mo"); getErrorString();
buildModel(HelloWorld); getErrorString();

Then you use HelloWorld.exe in Eclipse to do the debugging.

Cheers,
Adrian Pop/

Hi,

These are known issues. Check the library coverage here:
https://test.openmodelica.org/~marsj/MS … rsive.html
We're working on solving them but it will take a while.

Cheers,
Adrian Pop/

Hi,

If you use (start = ...) add also (fixed = true) to make sure the initialization uses that value.
So (start = ..., fixed = true).

The back-end developers can tell you more.

Cheers,
Adrian Pop/

Oct-02-13 12:02:25
unable to access to buildNightly.bat file
Category: Developer

Hi,

Yeah, we disabled the access to the Windows workspace as some weird people tried to get everything as zip and that killed all our job.
You can get BuildWindowsRelease.sh here:
https://openmodelica.org/svn/OpenModeli … licaSetup/
and then use MSYS sh from OMDev to run it.
You can look into the job build console how is done:
https://test.openmodelica.org/hudson/jo … ld/console
search for buildWindows.sh

Cheers,
Adrian Pop/

Sep-15-13 20:23:36
problems with simulation result intervals. Streaming wrong values

Hi,

Well, besides the OpenModelica user's guide and system guide (you have them as .pdf in OpenModelica installation) you can have a look here:
https://build.openmodelica.org/Documentation/
https://build.openmodelica.org/Document … pting.html
Some things are not very well documented, we're trying to solve that, but it will take some time.

Cheers,
Adrian Pop/

Sep-15-13 19:59:21
problems with simulation result intervals. Streaming wrong values

Hi,

What i mean is that in the script file you have a simulation or a buildModel command. I.e.

Code:


simulate(Model, stopTime= X, numberOfIntervals = Y); getErrorString();

so is it for the .mos scripts.

Yes, it should just pass the parameters you send via simulate or buildModel commands.
We do some calculation: stepSize = (stopTime - startTime) / numberOfIntervals;
So if you play with stepSize and not with the others we will calculate numberOfIntervals
from it as far as I know.

I suggest you install the latest nightly build:
https://build.openmodelica.org/omc/buil … ly-builds/
as a lot of fixes and improvements are in there and see if this still happens.

Cheers,
Adrian Pop/

Sep-15-13 19:05:26
problems with simulation result intervals. Streaming wrong values

Hi,

This should not happen. default numberOfIntervals is 500 and it should
not change if you don't change it via the simulation/buildModel command.

Do you have, by any chance, and Experiment annotation in your Model?
That would change how things are handled but not if you specify both
stopTime = X and numberOfIntervals = Y

What do you mean by very recent version? Any revision number?
Did you got the latest nightly build from here?
https://build.openmodelica.org/omc/buil … ly-builds/

Chees,
Adrian Pop/

Aug-05-13 17:37:37
Cannot be solved. To few equations, under-determined system.

Hi,

This might be a bug either in the flattening (or in the back-end/runtime system).

I suggest you do instantiateModel and see what kind of equations you're getting.
Also, run omc from command line with +d=dumpindxdae and see how the variables are calculated (from which equation).
See here in the README how to write the script and give command line options:
https://build.openmodelica.org/omc/buil … ly-builds/

Let us know which version/revision of OpenModelica you're using (and what OS).

Cheers,
Adrian Pop/

Jul-12-13 18:26:39
Is the implementation of algorithms in OpenModelica faulty?

Yes, it looks like a bug as far as I can tell (x should not be 0, especially if x = 1 from the initialization).
Lennart will have a closer look at it on Monday.

Cheers,
Adrian Pop/

Jul-12-13 17:55:38
Is the implementation of algorithms in OpenModelica faulty?

Hi,

Things are not very clear in the specification when it comes to first simulation step.
See the discussion here:
https://trac.modelica.org/Modelica/ticket/1195

Running your models with debugging of initialization gives me:

Code:


adrpo@ida-liu050 ~/dev/OpenModelicaNoChanges/build/bin
$ ./Why.exe -lv LOG_INIT
LOG_INIT          | info    | ### START INITIALIZATION ###
LOG_INIT          | info    | updating start-values
LOG_INIT          | info    | initialization method: symbolic        [solves the initialization problem symbolically - default]
LOG_SOTI          | info    | ### SOLUTION OF THE INITIALIZATION ###
|                 | |       | | states variables
|                 | |       | | | [1] Real $dummy(start=0, nominal=1) = 0 (pre: 0)
|                 | |       | | derivatives variables
|                 | |       | | | [2] Real der($dummy) = 0 (pre: 0)
|                 | |       | | other real variables
|                 | |       | | | [3] Real x(start=0, nominal=1) = 1 (pre: 0)
|                 | |       | | integer variables
|                 | |       | | boolean variables
|                 | |       | | | [1] Boolean stop(start=false) = true (pre: false)
|                 | |       | | string variables
LOG_INIT          | info    | ### END INITIALIZATION ###

Which means that at the start of simulation stop is true and x is 1 and the algorithm part is never ran.

I'll ask Lennart (one of our back-end/runtime system developers) to give more information about this issue.

Cheers,
Adrian Pop/

WSM uses an older OpenModelica front-end with their own back-end. That's why you don't get the warnings for missing each. Or maybe they ignore that warning.

What do you mean by annotations being corrupted in OpenModelica? Report a bug if there are issues with the annotations:
https://trac.openmodelica.org/OpenModelica/
Note that OpenModelica only supports 3.x annotations and not 2.x or older.
We do save them (the annotations) at the end of the model as that's what the Modelica Specification says.

Also conform to the Modelica Specification all the models should be UTF8, but as you can see most of the tools do not abide by that (mostly Windows encoding).

Cheers,
Adrian Pop/

Also, I suggest you add getErrorString(); after all commands to find out if there are any issues and what they are.

Cheers,
Adrian Pop/

Hi,

See here:
http://www.3ds.com/fileadmin/PRODUCTS/C … _Notes.pdf
Section 11.5

And in the Modelica Specification:
https://modelica.org/documents/ModelicaSpec33.pdf
18.9 Annotations for Access Control to Protect Intellectual Property

I think it depends on tools but I guess decryption happens during library loading.

Cheers,
Adrian Pop/

May-20-13 20:49:27
Want to change the axis from time to other variables?

You can also do the second part by extending your model and
using when equations to change the variables as you want.
Note that you'll have to change the parameters to variables
as parameters are constant during simulation.

Cheers,
Adrian Pop/

May-14-13 20:41:40
all example involving pipe component are not runnable

Hi,

You will need to define a proper medium (not PartialMedium) with coding as far as I know.
OMEdit does not yet handle replaceable classes.

Cheers,
Adrian Pop/

May-14-13 20:07:37
all example involving pipe component are not runnable

Hi,

Try the latest nightly build:
https://build.openmodelica.org/omc/buil … ly-builds/
Media & Fluid libraries required a special flag +d=scodeInstShortcut to work but that need was removed since yesterday.

Cheers,
Adrian Pop/

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