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

Instead of this:

Code:


#!/bin/bash
rm *.o;
rm *.c;
rm *.h;

do:

Code:


system("rm -f *.o *.c *.h");

See here: https://stackoverflow.com/questions/569 … stem-codec
maybe this is your issue.

I wrote OMCallPython.h myself, you can change it as you want to add more functionality if you need to communicate data between python and Modelica,
see 1.3 from: https://docs.python.org/3/extending/embedding.html


I made a small package to call python from OM. See here:
https://github.com/adrpo/OMCallPython/

OpenModelica 1.14.1 has the new front-end on by default in OMEdit. It seems that is the issue.
You can select the old frontend via: Tools->Options->Simulation->Enable old frontend for code generation.

This is the log when running with the new front-end: https://libraries.openmodelica.org/bran … System.err

You shouldn't need to load the FMU dlls (or so) at every step. You could just use the same instance and run different simulations with if you want as they are thread safe. You can fmiReset it if is needed.

There are several targets for the FMU, you can see in OMEdit->Tools->Options->FMI
- static, all stuff is linked in, you can send the FMU to somebody and it will work
- dynamic, mostly no stuff linked in, the person you send the FMU to needs an OpenModelica installation and the libraries from it in the PATH (or LD_LIBRARY_PATH).
Most likely dynamic is smaller but it has the mentioned restrictions.

If your tool supports ME then you could also use the CPP runtime (OMEdit->Tools->Options->Simulation->choose "Cpp"). That would probably make a smaller FMU, but it might not work for all the models for which the C runtime work.

If comma is used as a decimal separator the FMU loading will crash. Set locale to en_US should fix it.

Code:


import locale
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')

Jan-14-20 10:55:54
How to use debug flags like bltdump in the openmodelica 1.14 version

Ouch. This seems to be a bug, -d=bltdump doesn't seem to produce output anymore, doesn't matter if is the new or the old front-end. I will check more.
Made a ticket for it: https://trac.openmodelica.org/OpenModelica/ticket/5787

Jan-13-20 18:11:32
How to use debug flags like bltdump in the openmodelica 1.14 version

Can you give more detail as what doesn't work as expected? Also, there is no space after the comma in:

Code:

–d=newInst,bltdump

.

Jan-10-20 10:51:29
How to use debug flags like bltdump in the openmodelica 1.14 version

To activate the new front-end you have:

Code:


-d=newInst

You can add more after it like this:

Code:


-d=newInst,bltdump,execstat

Jan-04-20 15:55:35
how to fix the problem

You need a 64bit computer with much more memory. It depends on how big the model is but I guess OMEdit needs 1-2GB to generate the C code and then we start GCC on several threads (as many cores as your computer has) to build the C code into an executable and this also takes some memory.
You can try to set: Number of Processors: in Simulation Setup to 1 to restrict how many GCCs are launched.

You can use setParameterValue or setComponentModifierValue to change the parameter in a model before building. See an example below.

Code:


loadString("
model M
  parameter Real a = 1;
  parameter Real x[2,2];
  parameter Real y[2,2];
end M;"); getErrorString();

list(M); getErrorString();
// use setParameterValue
setParameterValue(M, x, fill(a, 2, 2)); getErrorString();
list(M); getErrorString();

// use setComponentModifierValue
setComponentModifierValue(M, y, $Code(= fill(a, size(x, 1), size(x, 2)))); getErrorString();
list(M); getErrorString();
setComponentModifierValue(M, y.start, $Code(= fill(a, size(x, 1), size(x, 2)))); getErrorString();
list(M); getErrorString();

instantiateModel(M); getErrorString();

You shouldn't need to download MSL (Modelica Standard Library 3.2.3) from github.
Just install it for OpenModelica:

Code:


sudo apt-get install omlib-modelica-3.2.3

Is actually recommended to use this version as we have our own patches to it compared to the one from gihub.

What version of OpenModelica do you have?

Code:


omc --version

To update OpenModelica just do the usual:

Code:


apt-get update
apt-get upgrade

will update to the new OpenModelica release 1.14 for you if you have added OpenModelica to your apt sources.

See here how:
https://openmodelica.org/download/download-linux

I have remade the VMs. I also tested the 1.14 one and it seems OK.

Ouch, let me see if I can fix it.

Dec-05-19 15:53:03
Print only desired text in command prompt

The script echo.mos:

Code:


echo(false); getErrorString();
print("Some string\n"); getErrorString();
print("Some real:" + String(0.5)+"\n"); getErrorString();
print("Some integer:" + String(5)+"\n"); getErrorString();

The result

Code:


adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OMTesting
$ ~/dev/OpenModelica/build/bin/omc echo.mos
Some string
Some real:0.5
Some integer:5

Dec-05-19 15:47:23
Category: Programming

For that you don't need any weird stuff, you do:

Code:


parameter Integer ni=3;
parameter Integer nj=3;
parameter Integer nk=3;
parameter Real Tc_start=50;
Real Tc[ni,nj,nk](each start=Tc_start);

Dec-05-19 10:59:07
Loop over multiple commands with a for loop in a MOS script

Yeah, that's true, the for loop commands do not output as the top level ones. I think this is a bug and we should fix it.

Dec-05-19 10:40:59
Loop over multiple commands with a for loop in a MOS script

Yes is possible, you would do it as in a Modelica algorithm section.

Code:


for iterator in range loop
  command1;
  command2;
  command3;
end for;

For some examples see:
https://openmodelica.org/forum/default- … r-of-ports
https://openmodelica.org/forum/default- … eter-sweep
For more advanced examples see:
https://github.com/OpenModelica/OpenMod … ateDoc.mos
https://github.com/OpenModelica/OpenMod … ursive.mos
and I guess there are many more examples around.

Nov-28-19 13:01:34
Category: Programming

Yes, these are mostly all OpenModelica specific, i think loadFile is available in Dymola as well.
What I show you was a prof of concept done using OpenModelica scripting, you need to find from Dymola's manual and documentation if this is possible to do and how.

Nov-27-19 22:30:25
Category: Programming

I guess what you want is meta-programming. Write some scripting that builds the model for you.
As far as I know Dymola has a library for this called ModelManangement but I'm not really sure it it can be used to add new connections to classes.

I think the easiest would be to just generate the model file from some other language like python.

You can also do this in OpenModelica with a bit of scripting: buildModel.mos

Code:


// you can also load this via loadFile("File.mo"); if you already have the skeleton
loadString("
model TestConn
  connector C
    Real T;
  end C;
  model M
    C c_1;
    C c_2;
    C c_3;
    C c_4;
  end M;
  M m;
  Real Txn[4,1];
  equation
end TestConn;
"); // load the model skeleton

n := 4;
// build the connect commands as strings
connectStrings := "";
for i in 1:n loop
  connectStrings := connectStrings + "addConnection(m.c_"+String(i)+".T, Txn["+ String(i) + ",1], TestConn); getErrorString();\n";
end for;

// write the connect commands to a new .mos script
writeFile("addConnects.mos", connectStrings); getErrorString();
// run the script with the connect commands to be added to the model
runScript("addConnects.mos"); getErrorString();

str := list(TestConn); getErrorString();
"write the model file";
writeFile("TestConn.mo", str);
"--- read the model file ---";
readFile("TestConn.mo");

output of running this via omc:

Code:


adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OMTesting/
$ ~/dev/OpenModelica/build/bin/omc buildModel.mos
true
4
""

true
""
"Ok
\"\"
Ok
\"\"
Ok
\"\"
Ok
\"\"
"
""
"model TestConn
  connector C
    Real T;
  end C;

  model M
    C c_1;
    C c_2;
    C c_3;
    C c_4;
  end M;

  M m;
  Real Txn[4, 1];
equation
  connect(m.c_1.T, Txn[1, 1]);
  connect(m.c_2.T, Txn[2, 1]);
  connect(m.c_3.T, Txn[3, 1]);
  connect(m.c_4.T, Txn[4, 1]);
end TestConn;"
""
"write the model file"
true
"--- read the model file ---"
"model TestConn
  connector C
    Real T;
  end C;

  model M
    C c_1;
    C c_2;
    C c_3;
    C c_4;
  end M;

  M m;
  Real Txn[4, 1];
equation
  connect(m.c_1.T, Txn[1, 1]);
  connect(m.c_2.T, Txn[2, 1]);
  connect(m.c_3.T, Txn[3, 1]);
  connect(m.c_4.T, Txn[4, 1]);
end TestConn;"

Nov-25-19 19:04:47
Category: Developer

This is a known bug: https://trac.openmodelica.org/OpenModelica/ticket/5263
and we don't have a fix for it yet. On Windows we compile a static version of ModelicaExternalC, but not on Linux.
So if you have tables in your model, you will have this issue.

You could try to select the C++ runtime, maybe that one can compile a static version of the FMU without any dependencies but it might not work.

This is now in the nightly-builds (from tomorrow) and in the upcoming 1.14.0-dev.beta3 and the final 1.14.0.

I implemented this now, you can use both -override and -overrideFile and you get a warning if the same variable is used again.

Code:


adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OMTesting/override
$ cat override.txt
b=5
c=6

adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OMTesting/override
$ ./TestOverride.exe -override=stopTime=1,b=1 -overrideFile=override.txt -lv=LOG_ALL | grep overrid
LOG_SOLVER        | info    | using -override=stopTime=1,b=1 and -overrideFile=override.txt
LOG_SOLVER        | info    | read override values from file: override.txt
LOG_SOLVER        | info    | -override=stopTime=1,b=1
LOG_SOLVER        | info    | -overrideFile=b=5,c=6
stdout            | warning | You are overriding variable: b=1 again with b=5.
LOG_SOLVER        | info    | override b = 5
LOG_SOLVER        | info    | override c = 6
LOG_SOLVER        | info    | override done!

Thanks for your input, I will implement it as you suggested, it sounds good. I will also put your text in the Trac so we can follow it up there as well.

I think it should be an error if they set the same variable. Then we do not need to think about precedence.

I tested with OMEdit and it doesn't work because OMEdit already uses -override and you cannot combine -override and -overideFile.

Code:


C:/temp/TestOverride/TestOverride.exe -port=51307 -logFormat=xmltcp -override=startTime=0,stopTime=1,stepSize=0.002,tolerance=1e-6,solver=dassl,outputFormat=mat,variableFilter=.* -r=C:/temp/TestOverride/TestOverride_res.mat -w -lv=LOG_SOLVER,LOG_STATS -overrideFile=c:/home/adrpo33/dev/override.txt -inputPath=C:/temp/TestOverride -outputPath=C:/temp/TestOverride

This is a bug, I think we should solve it by allowing -overrideFile even if -override is already present.
I opened a ticket about it: https://trac.openmodelica.org/OpenModelica/ticket/5696



The model:

Code:


model TestOverride
  parameter Real a = 1;
  parameter Real b = 2;
  parameter Real c = 3;
  parameter Real d = 3;
  Real x(start=a, fixed=true);
equation
  der(x) = b*c*d*x;
end TestOverride;

The script to build the model:

Code:


loadFile("TestOverride.mo"); getErrorString();
buildModel(TestOverride); getErrorString();

Building the model:

Code:


adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OMTesting/override
$ ~/dev/OpenModelica/build/bin/omc -d=initialization t.mos
true
""
{"C:/home/adrpo33/dev/OMTesting/override/TestOverride","TestOverride_init.xml"}
""

Running some override tests using command line -override or -overrideFile
from the mingw64 terminal:

Code:


adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OMTesting/override
$ ./TestOverride.exe -override=b=5 -lv=LOG_ALL | grep override
LOG_SOLVER        | info    | read override values: b=5
LOG_SOLVER        | info    | override b = 5
LOG_SOLVER        | info    | override done!

adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OMTesting/override
$ cat > override.txt
b=5
c=6

adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OMTesting/override
$ ./TestOverride.exe -overrideFile=override.txt -lv=LOG_ALL | grep override
LOG_SOLVER        | info    | read override values from file: override.txt
LOG_SOLVER        | info    | read override values: b=5,c=6
LOG_SOLVER        | info    | override b = 5
LOG_SOLVER        | info    | override c = 6
LOG_SOLVER        | info    | override done!

Trying from some other directory:

Code:


adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OMTesting/override
$ cp override.txt ../../.

adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OMTesting/override
$ ./TestOverride.exe -lv=LOG_ALL -overrideFile=C:/home/adrpo33/dev/override.txt  | grep override
LOG_SOLVER        | info    | read override values from file: C:/home/adrpo33/dev/override.txt
LOG_SOLVER        | info    | read override values: b=5,c=6
LOG_SOLVER        | info    | override b = 5
LOG_SOLVER        | info    | override c = 6
LOG_SOLVER        | info    | override done!

Trying from Windows Command Line: cmd.exe

Code:


C:\home\adrpo33\dev\OMTesting\override>.\TestOverride.exe -lv=LOG_ALL -overrideFile=C:/home/adrpo33/dev/override.txt | more
LOG_SOLVER        | info    | read override values from file: C:/home/adrpo33/dev/override.txt
LOG_SOLVER        | info    | read override values: b=5,c=6
LOG_SOLVER        | info    | override b = 5
LOG_SOLVER        | info    | override c = 6
LOG_SOLVER        | info    | override done!
LOG_SIMULATION    | info    | read all the DefaultExperiment values:
|                 | |       | | startTime = 0
|                 | |       | | stopTime = 1
|                 | |       | | stepSize = 0.002
|                 | |       | | tolerance = 1e-006
|                 | |       | | solver method: dassl
|                 | |       | | output format: mat
|                 | |       | | variable filter: .*
|                 | |       | | OPENMODELICAHOME: c:/home/adrpo33/dev/OpenModelica/build
LOG_DEBUG         | info    | read xml file for real states
|                 | |       | | Real x(start=0, fixed=true, {nominal=1}, min=-1.79769e+308, max=1.79769e+308)
LOG_DEBUG         | info    | read xml file for real state derivatives
|                 | |       | | Real der(x)(start=0, fixed=false, {nominal=1}, min=-1.79769e+308, max=1.79769e+308)
LOG_DEBUG         | info    | read xml file for real algebraics
LOG_DEBUG         | info    | read xml file for integer variables
LOG_DEBUG         | info    | read xml file for boolean variables
LOG_DEBUG         | info    | read xml file for string variables
LOG_DEBUG         | info    | read xml file for real parameters
|                 | |       | | Real a(start=1, fixed=true, {nominal=1}, min=-1.79769e+308, max=1.79769e+308)
|                 | |       | | Real b(start=5, fixed=true, {nominal=1}, min=-1.79769e+308, max=1.79769e+308)
|                 | |       | | Real c(start=6, fixed=true, {nominal=1}, min=-1.79769e+308, max=1.79769e+308)
|                 | |       | | Real d(start=3, fixed=true, {nominal=1}, min=-1.79769e+308, max=1.79769e+308)
LOG_DEBUG         | info    | read xml file for integer parameters
LOG_DEBUG         | info    | read xml file for boolean parameters
LOG_DEBUG         | info    | read xml file for string parameters
LOG_DEBUG         | info    | read xml file for real alias vars
LOG_DEBUG         | info    | read xml file for integer alias vars
LOG_DEBUG         | info    | read xml file for boolean alias vars
-- More  --

Trying with backwards slashes:

Code:


C:\home\adrpo33\dev\OMTesting\override>.\TestOverride.exe -lv=LOG_ALL -overrideFile=C:\home\adrpo33\dev\override.txt | more
LOG_SOLVER        | info    | read override values from file: C:\home\adrpo33\dev\override.txt
LOG_SOLVER        | info    | read override values: b=5,c=6
LOG_SOLVER        | info    | override b = 5
LOG_SOLVER        | info    | override c = 6
LOG_SOLVER        | info    | override done!
LOG_SIMULATION    | info    | read all the DefaultExperiment values:
|                 | |       | | startTime = 0
|                 | |       | | stopTime = 1
|                 | |       | | stepSize = 0.002
|                 | |       | | tolerance = 1e-006
|                 | |       | | solver method: dassl
|                 | |       | | output format: mat
|                 | |       | | variable filter: .*
|                 | |       | | OPENMODELICAHOME: c:/home/adrpo33/dev/OpenModelica/build
LOG_DEBUG         | info    | read xml file for real states
|                 | |       | | Real x(start=0, fixed=true, {nominal=1}, min=-1.79769e+308, max=1.79769e+308)
LOG_DEBUG         | info    | read xml file for real state derivatives
|                 | |       | | Real der(x)(start=0, fixed=false, {nominal=1}, min=-1.79769e+308, max=1.79769e+308)
LOG_DEBUG         | info    | read xml file for real algebraics
LOG_DEBUG         | info    | read xml file for integer variables
LOG_DEBUG         | info    | read xml file for boolean variables
LOG_DEBUG         | info    | read xml file for string variables
LOG_DEBUG         | info    | read xml file for real parameters
|                 | |       | | Real a(start=1, fixed=true, {nominal=1}, min=-1.79769e+308, max=1.79769e+308)
|                 | |       | | Real b(start=5, fixed=true, {nominal=1}, min=-1.79769e+308, max=1.79769e+308)
|                 | |       | | Real c(start=6, fixed=true, {nominal=1}, min=-1.79769e+308, max=1.79769e+308)
|                 | |       | | Real d(start=3, fixed=true, {nominal=1}, min=-1.79769e+308, max=1.79769e+308)
LOG_DEBUG         | info    | read xml file for integer parameters
LOG_DEBUG         | info    | read xml file for boolean parameters
LOG_DEBUG         | info    | read xml file for string parameters
LOG_DEBUG         | info    | read xml file for real alias vars
LOG_DEBUG         | info    | read xml file for integer alias vars
LOG_DEBUG         | info    | read xml file for boolean alias vars
-- More  --

All seems to work for me, but I haven't tried yet from OMEdit, I will do that later today.

It should just work with "/" alternatively with "\\" for the path separator and with or without quotes for the whole path.

The syntax of inside of the file is just:
variable_name1=variable_value1
variable_name2=variable_value2


You could run with -lv=LOG_ALL to see what error are you getting.

Note that there are structural parameters evaluated during compilation time and you cannot override those. In this case you should get a warning.

I will give it a try myself and see if i can find any issues. I implemented this, and last time i checked it it worked fine.

Nov-13-19 09:21:27
Using OMPython ModelicaSystem to generate an outfile that avoids double entries at the same time...

I had a quick look at the python code and we don't support this yet.

I guess one could add a new constructor for simulate that supports named argument "simflags" and all the other options we have in the OMC simulate command:
https://build.openmodelica.org/Document … ulate.html

I will see if Arun has time to fix this.

Nov-13-19 08:34:31
please help why I see this command line error

The problem is that you're trying to load .txt models using loadFile. Command loadFile should only be used for .mo files.
Also, the System class doesn't seem to be in the Modelica file you loaded.

Oct-15-19 11:10:47
Category: Developer

This means Tm is a parameter and T4 or T5 are variables.
Depending on what you want to model you can make T4 and T5 parameters or Tm a variable.

I think the logs are send to /dev/null by default. You can specify a log file in the system command:
https://build.openmodelica.org/Document … ystem.html

Code:


system("ShoreBasedTestSystem.exe -nls=hybrid -lv=LOG_EVENTS,LOG_NLS_JAC", "LogFile.log");

Also, is strange that backward slash works (without the need to double it \\), please use forward slash instead for directories:
C:\Users\jcrabtree\Desktop\ShoreBasedDemonstratorTraining\High Fidelity\Run ->
C:/Users/jcrabtree/Desktop/ShoreBasedDemonstratorTraining/High Fidelity/Run

You can also just run build model once and then use -r to generate result files with new names.




This is most likely a bug. I made a ticket for it and we will fix it: https://trac.openmodelica.org/OpenModelica/ticket/5616

You can fix this by using:

Code:


A:=A+sum(test[i].Tc);

in Test22.

This is a  known bug (https://trac.openmodelica.org/OpenModelica/ticket/2858) that was fixed in the new front-end. Please use the latest nightly-build:
https://build.openmodelica.org/omc/buil … ly-builds/

Code:


// t.mos
loadFile("Structure.mo"); getErrorString();
simulate(Structure.Test1); getErrorString();
val(A, 1);
simulate(Structure.Test2); getErrorString();
val(A, 1);
simulate(Structure.Test3); getErrorString();
val(A, 1);

With current front-end:

Code:


adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OMTesting/iteration
$ ~/dev/OpenModelica/build/bin/omc t.mos
true
""
record SimulationResult
    resultFile = "C:/home/adrpo33/dev/OMTesting/iteration/Structure.Test1_res.mat",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'Structure.Test1', optio                                                ns = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
    messages = "LOG_SUCCESS       | info    | The initialization finished successfully without homotopy method.
LOG_SUCCESS       | info    | The simulation finished successfully.
",
    timeFrontend = 0.0288302,
    timeBackend = 0.0440066,
    timeSimCode = 0.0084861,
    timeTemplates = 0.0655039,
    timeCompile = 12.860871,
    timeSimulation = 0.53805,
    timeTotal = 13.548594
end SimulationResult;
""
15.0
record SimulationResult
    resultFile = "C:/home/adrpo33/dev/OMTesting/iteration/Structure.Test2_res.mat",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'Structure.Test2', optio                                                ns = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
    messages = "LOG_SUCCESS       | info    | The initialization finished successfully without homotopy method.
LOG_SUCCESS       | info    | The simulation finished successfully.
",
    timeFrontend = 0.0099308,
    timeBackend = 0.0031456,
    timeSimCode = 0.0007796,
    timeTemplates = 0.0563182,
    timeCompile = 12.5935838,
    timeSimulation = 0.4877127,
    timeTotal = 13.1526335
end SimulationResult;
""
10.0
record SimulationResult
    resultFile = "C:/home/adrpo33/dev/OMTesting/iteration/Structure.Test3_res.mat",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'Structure.Test3', optio                                                ns = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
    messages = "LOG_SUCCESS       | info    | The initialization finished successfully without homotopy method.
LOG_SUCCESS       | info    | The simulation finished successfully.
",
    timeFrontend = 0.0203584,
    timeBackend = 0.0046265,
    timeSimCode = 0.0013041,
    timeTemplates = 0.0546605,
    timeCompile = 13.1451636,
    timeSimulation = 0.5539768000000001,
    timeTotal = 13.7813722
end SimulationResult;
""
10.0

With new front-end: -d=newInst

Code:


adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OMTesting/iteration
$ time ~/dev/OpenModelica/build/bin/omc -d=newInst t.mos
true
""
record SimulationResult
    resultFile = "C:/home/adrpo33/dev/OMTesting/iteration/Structure.Test1_res.mat",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'Structure.Test1', optio                                                ns = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
    messages = "LOG_SUCCESS       | info    | The initialization finished successfully without homotopy method.
LOG_SUCCESS       | info    | The simulation finished successfully.
",
    timeFrontend = 0.0131841,
    timeBackend = 0.0043454,
    timeSimCode = 0.0012549,
    timeTemplates = 0.0418104,
    timeCompile = 10.5543462,
    timeSimulation = 0.5015408,
    timeTotal = 11.1178179
end SimulationResult;
""
15.0
record SimulationResult
    resultFile = "C:/home/adrpo33/dev/OMTesting/iteration/Structure.Test2_res.mat",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'Structure.Test2', optio                                                ns = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
    messages = "LOG_SUCCESS       | info    | The initialization finished successfully without homotopy method.
LOG_SUCCESS       | info    | The simulation finished successfully.
",
    timeFrontend = 0.0012632,
    timeBackend = 0.0126055,
    timeSimCode = 0.0008018,
    timeTemplates = 0.0412061,
    timeCompile = 10.63316,
    timeSimulation = 0.5010813,
    timeTotal = 11.1909594
end SimulationResult;
""
15.0
record SimulationResult
    resultFile = "C:/home/adrpo33/dev/OMTesting/iteration/Structure.Test3_res.mat",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'Structure.Test3', optio                                                ns = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
    messages = "LOG_SUCCESS       | info    | The initialization finished successfully without homotopy method.
LOG_SUCCESS       | info    | The simulation finished successfully.
",
    timeFrontend = 0.0043822,
    timeBackend = 0.0066643,
    timeSimCode = 0.0017293,
    timeTemplates = 0.0877218,
    timeCompile = 10.6279343,
    timeSimulation = 0.5973836,
    timeTotal = 11.326688
end SimulationResult;
""
15.0

Yes, we are only building new nightly builds if there are changes in the github repository.

Jul-18-19 14:41:35
Error when I try to simulate the model wih the standard values.

This model seems to work fine with 1.13:
https://libraries.openmodelica.org/bran … ysPro.html
and 1.14:
https://libraries.openmodelica.org/bran … ysPro.html

Do you have some special flags in OMEdit?
Do you have your own model that fails?

You could try the nightly builds:
https://build.openmodelica.org/omc/buil … ly-builds/

Cheers,
Adrian Pop//

Jul-02-19 10:27:50
I'm trying to allocate two large arrays that will be used as parameters within a model. The...
Category: Programming

This is most likely a bug. I opened a ticket about it:
https://trac.openmodelica.org/OpenModelica/ticket/5559

I suggest you use the latest nighlty-build and activate the new front-end:
https://build.openmodelica.org/omc/buil … ly-builds/

Buildings.Fluid.Boilers.Examples.BoilerPolynomial works with the new front-end but doesn't work with the current one:
The coverage of buildings with the new front-end is here:
https://libraries.openmodelica.org/bran … atest.html
The coverage of buildings with the current front-end is here:
https://libraries.openmodelica.org/bran … atest.html

To activate the new front-end you go in OMEdit->Tools->Options->Simulation->Additional Translation Flags: and add newInst to the existing flags or if none there just say: -d=newInst

Hi,

We tried to fix a bug (https://trac.openmodelica.org/OpenModelica/ticket/4504)
that did not allowed OpenModelica to be installed in C:\Program Files\OpenModelica
but it seems is only partially fixed.

Until we completely fix this issue, you need to uninstall OpenModelica and install it in a directory without a space, such as:
C:\OpenModelica\

Then it should work fine to build and simulate models.

Cheers,
Adrian Pop/

May-19-19 11:22:28
passing 'void *' to parameter of incompatible type 'modelica_real'

This is an issue with the current front-end. I suggest you use the latest nightly-build:
https://build.openmodelica.org/omc/buil … ly-builds/
and switch on the new front-end: Tools->Options->Simulation->Additional Translation flags: -d=initialization,newInst

You also need to restart OMEdit after setting the flags!

Hm, i will need to check if we put the entire library in the resource folder if is loaded into OMEdit, it might be that we do, but that seems like an overkill and we should change it.

If you use in Modelica URIs such as modelica://path/to/file.txt then the generated FMU will include the file.txt in the resource directory.

If you use the direct path to file then the FMU will not have that file included in the resource directory and it will read it from that local path. Note that in this case, if you send the FMU to somebody else, they will not have access to file.txt.

You can also include the table directly in the Modelica code but that might slow down the compilation (depending on how big the table is) and make the FMU bigger.

The solution above is fine but you can also drag and drop in your top model Modelica.Blocks.Interfaces.RealInput for input and Modelica.Blocks.Interfaces.RealOutput for output, then connect them to what you want in your model.

Thank you for your kind words. We're really sorry you got forced to use our tool. We'll go right ahead and remove it from the internet.

Feb-20-19 10:58:36
Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!

Follow:
https://trac.openmodelica.org/OpenModelica/ticket/5349
Please don't open both a bug ticket and a forum post. One of them is enough.

This is a bug. We will continue the discussions on the ticket you opened:
https://trac.openmodelica.org/OpenModelica/ticket/5340

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

Hi,

The answer to this is a bit complicated.
By default we cannot open any encrypted commercial libraries.

However, we do have a version of OpenModelica with encryption (for OSMC members) and library or model developers can use it to encrypt their models or libraries.
So, if library providers want to distribute a version of their encrypted libraries that can be used with OpenModelica, that is possible, but is not something we can push for.

Cheers,
Adrian Pop/


This modification is wrong:

Code:


MyMedium = Modelica.Media.Air.SimpleAir

It says that a variable MyMedium should be set to variable Modelica.Media.Air.SimpleAir.
Modelica.Media.Air.SimpleAir exists, but as a class, not a variable.
You cannot set replaceable classes or components like that.
Also note that MyMedium does not exist in Compressor. You should redeclare Medium.

If you want a redeclare of a class, then you need to use this syntax:

Code:


redeclare package Medium = Modelica.Media.Air.SimpleAir

Show me the entire model again.

I guess something like this will work:

Code:


ThermoPower.Gas.Compressor compressor1(redeclare package Medium = Modelica.Media.Air.SimpleAir, Ndesign = 150, Table = ThermoPower.Choices.TurboMachinery.TableTypes.matrix, Tdes_in = 300, allowFlowReversal = false, pout(start = 100));

There is a small client library here that you can inspire from:
https://github.com/OpenModelica/OMCompi … pp/omcCAPI

Can you post your full model? Otherwise is hard to guess what is wrong.
If the model is not public, you can send it to us at OpenModelica @ ida.liu.se and we will delete it after finding the issue.

You need to use \\ or / instead of \.

Yes. Sometimes it does happen. We are working on making it more robust and any bug reporting helps.

When is crashing it should ask you to send the logs to us. If it doesn't, you can just zip all files:
%TEMP%/OpenModelica/OMEdit/omedit*log (this is on Windows, on Linux they are in /tmp/username/OpenModelica/OMEdit).
and send them to openmodelica @ ida.liu.se.
Alternatively you can open a ticket on https://trac.openmodelica.org/OpenModelica (NewTicket) and attach the logs there.

You can report bugs here:
https://trac.openmodelica.org/OpenModelica/
click on New Ticket

The new front-end is work in progress to replace the current one. The front-end handles instantiation of models (removal of structure, applications of modifiers, inheritance, etc until you get to a flat DAE system). We also use the front-end to do query operations on the Modelica code such as getting information about annotations, etc. You can find some information here:
https://trac.openmodelica.org/OpenModelica/ticket/4138

In the case of your annotation, because you use constants declared in the model, an instantiation of the model is needed to evaluate the annotation. It seems that the current front-end somehow misses the modification in the extends and then you end up with the one declared in the model.

This should work, is a bug. It should be fixed when we start using the new front-end.

Oct-26-18 11:46:15
Pyfmi can't decode FMU

Yes. I installed PyFMI via conda and tested with an OM FMU.
I get crashes in the sundials solver on both Windows and Linux and could not find out why yet.
The FMUs work fine in fmiChecker but they crash in python.
I suspect it might have something to do with stack alignment.
I even ran this in valgrind in Linux but got no clear idea what the problem is.
I will continue debugging this.

As far as I can see from the OpenModelica v1.12 coverage here:
https://libraries.openmodelica.org/bran … 3.2.2.html
the PumpingSystem and HeatingSystem are failing.
I'm not sure if these models actually worked 1.12 or if they got broken by a library change.

You could use the nightly builds where these models are working:
For windows you can get them here:
https://build.openmodelica.org/omc/buil … ly-builds/

What OpenModelica version do you have? What Modelica Standard Library version do you use?
As far as I can see from our coverage testing:
https://libraries.openmodelica.org/bran … 3.2.2.html
This particular model works at least in versioni 3.2.2
Have you tried a restart of your computer?
Do you have some special flags in OMEdit?

Oct-17-18 15:16:04
Pyfmi can't decode FMU

Thanks for the info. I'll give it a try on my system, see how it goes.

Oct-17-18 13:53:58
Pyfmi can't decode FMU

Ok. The problem might be in PyFMI while loading the FMU.
More questions:
What system do you have? 32bit? 64bit?
How did you installed PyFMI and FMIL?

Oct-17-18 10:45:26
Pyfmi can't decode FMU

Is this on Windows or Linux? What do you mean by decoding the FMU?

Oct-16-18 20:46:07
How it works, how integrate in a infinite loop? FMU2.0

As far as I know you can simulate forever, for FMI CS, just call doStep with currentTime+stepSize. I guess the boundary is DBL_MAX (the max for double).

Oct-16-18 19:52:22
How it works, how integrate in a infinite loop? FMU2.0

You can have a look at fmuChecker:
https://github.com/modelica-tools/FMUCo … r/src/FMI2
which uses (as far as I know) FMIL library to load/simulate/check an FMU.

It seems you cannot write the executable in the %TEMP% folder, so it looks like an antivirus issue.
See if you can add some exception to your antivirus to let you write executable files to:
%TEMP%/OpenModelica/OMEdit

You could also try to change the working directory in OMEdit to c:\temp or other directory so that is not using the system %TEMP%.

Aug-24-18 11:43:58
After sucessful autoconf does make lead to the below error message
Category: Developer

The error is not here, we need the entire log just do:
make > trace.txt 2>&1
in the OpenModelica root directory and put the log here or send it via email to: OpenModelica @ ida.liu.se

I wouldn't say so. Not yet. While we are working on supporting requirements and automatic testing via simulation of these requirements is not so advanced yet.

Yes, depending on the library some models might open very slowly or even crash OMEdit.
In general models with a lot of redeclares have that issue.

We are working on a new front-end that should fix (some of) these issues, hopefully should be available in a couple of months.
You could already try it on your model from command line using -d=newInst, it might work better on your model (or not).

Jul-07-18 00:00:39
Directional derivatives error (FMU for model exchange)

Tool->Options->Simulation->OMC Flags. Add it to the flags there.

Jun-22-18 14:26:37
Performance regression in FMU's generated in OM 1.13
Category: Developer

We had not looked at the performance
difference with FMI between OM versions.
We have tests that check FMI export here:
https://libraries.openmodelica.org/bran … w-fmi.html
and at least we support much more models than before.

Would be good to have access to your Modelica code
so we can debug the performance issues. It might be
a corner case.

Jun-15-18 06:50:31
Set timeout from the GUI

Ah, you mean simulation flags. Then yes, you use -alarm=time or -alarm time.

See here: https://www.openmodelica.org/doc/OpenMo … flags.html

Jun-14-18 10:08:20
Set timeout from the GUI

Alarm should not work via OMEdit, it would mean killing the OMEdit process. It should only works via omc command line.

May-22-18 20:10:25
Is the openmodelica plugin for Eclipse still actively maintained ?

You can use it for text editing, should work fine but if you want graphical composition of models and simulation you should use OMEdit.

May-22-18 15:37:15
Is the openmodelica plugin for Eclipse still actively maintained ?

Eclipse MDT is kept working but not actively developed any more.
After you add the update site, you need to un-select "Group items by category" to show the latest version. See here:
https://trac.openmodelica.org/documents … ingMDT.pdf

You can also duplicate a class that is read only into one that you can edit and save.

Mar-10-18 08:07:48
e.g. parameter SI.HeatFlowRate Q_ST=5 "Heat transfer rate"...
Category: Programming

You know that Modelica supports quoted variables, maybe you can use those. Of course, this would make the model not so pretty to look at so a solution like you propose would work better but it needs to be implemented.

Code:


parameter SI.HeatFlowRate 'Q\textsubscript{ST}' = 5 "Heat transfer rate";

I changed now in the settings so that the system does not send the password via email again.

It should work to compile with GCC, it might even be possible to import it and run it in Simulink.
Yes, unfortunately for MSVC we only compile the 32bit dependencies and the FMU.
We should add support for 64bit MSVC. I opened a ticket about it:
https://trac.openmodelica.org/OpenModelica/ticket/4738
and we will try to fix this as soon as possible.

You can't install the 64bit OpenModelica? That would produce a 64bit FMU.

Jan-15-18 14:29:50
Category: Developer

You can find out if is a serial / parallel connection by analyzing the connections you have in a model.
So basically this is parallel:
connect(resistor1.n, a);
connect(resistor2.n, a);
connect(resistor1.p, b);
connect(resistor2.p, b);

But I guess you need to build a graph of the connections and analyze that.

See eclipse.ini where eclipse.exe is, i think you can change the path in there.
Have a look here: https://wiki.eclipse.org/Eclipse.ini#-v … ws_Example

Oct-17-17 15:19:44
Compressor model: want to inverse the model.
Category: Programming

Unfortunately not so many modelers read this forum and the compiler developers do not know the answers, so I suggest you post your question here:
https://stackoverflow.com/questions/tagged/modelica
to reach more modelers.

Sep-19-17 20:55:39
Errors in my code
Category: Programming

Should work, but you can put it inside: if noEvent(extrapointSurface_1==8 or extraPointSurface_2==8).
Note however that is not good to test Real for equality. You should test for an interval with an epsilon, see:
https://github.com/modelica/Modelica-Co … ce/Util.mo

Sep-19-17 20:38:07
Errors in my code
Category: Programming

This is an equation  (extraPointSurface_1=8) or a binding, not a relation!
It should be  (extraPointSurface_1==8)

We don't support this functionality yet. Is planned to support encryption and information hiding later this year.

Jul-24-17 23:06:19
OpenModelica: Translation Warning In component in relation on Real numbers is only allowed inside...
Category: Programming

Modelica Specification says that comparing 2 real numbers for equality is not a good idea as they will seldom be really equal (that's why you get a warning if you don't use it inside functions).
You can introduce an epsilon in the comparison to make it more robust and use =< >= instead of ==.
See for example this:
https://github.com/modelica/Modelica-Co … ce/Util.mo

Update your OMDev from SVN.

You could do:

Code:


buildModel(Model, outputFormat="csv"); getErrorString();

to output csv files.

Code:


Model.exe -override var1=val1 -r File1.csv
Model.exe -override var1=val2 -r File2.csv

It might work, I haven't tried it myself.

Hi,

We don't have Project Build in the sense that JDT or CDT has. The project build does nothing (there is just a builder that checks the syntax of the Modelica files).
The actual build is done by the OMC compiler when you call the simulate(Model) command.

Cheers,
Adrian Pop/

The code for the post above is this one:

Code:


model RevoluteCrash
  import SI = Modelica.SIunits;
  parameter SI.RotationalDampingConstant d(final min=0, start=1.5)
    "Damping constant";
   
  inner Modelica.Mechanics.MultiBody.World world(n = {0, 0, -1}) annotation(Placement(visible = true, transformation(origin = {-70, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Mechanics.MultiBody.Joints.Revolute revolute1(n = {0, 1, 0}, phi(displayUnit = "rad"), useAxisFlange = true) annotation(Placement(visible = true, transformation(origin = {-34, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Mechanics.MultiBody.Parts.Body body1(m = 0.5, r_CM = {0, 0, -1}) annotation(Placement(visible = true, transformation(origin = {6, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(revolute1.frame_b, body1.frame_a) annotation(
    Line(points = {{-24, 70}, {-4, 70}}, color = {95, 95, 95}));
  connect(world.frame_b, revolute1.frame_a) annotation(
    Line(points = {{-60, 70}, {-44, 70}, {-44, 70}, {-44, 70}}, color = {95, 95, 95}));
end RevoluteCrash;

Nasrou wrote:


hello,

I'm new to  OM, and i have maybe a stupid question.

I want to control a simulation of my model by doing several simulations. and I want to know how can I control that. I know, that with a mos script we can do such things, but i don't know how to create a .mos script.

My question is : how can I create mos file ?

thank you.

Hi,

A .mos script is just a file you can make with any editor that has the extension ".mos". You can create a "script.txt" with Notepad and then rename it to "script.mos".
You can see in this post how to do multiple simulations with different parameters:
https://openmodelica.org/forum/default- … eter-sweep

Cheers,
Adrian Pop/

As a workaround, you could manually add it to the fmu binaries/platform using 7zip or some other zip software for now.

Yeah, this is a feature we don't support yet.
We should collect all library dependencies and add them to the fmu.

Apr-17-17 23:02:21
Category: Programming

Hi,

Note that the scalable test suite needs special flags for DAE mode for some models.
You can find them here:
https://test.openmodelica.org/libraries … rsive.html

What OM do you have and which OS do you run it on?
If you have Windows then ScalableTestSuite should be part of the OM installation.

Just make a file script.mos containing:

Code:


// --- start --- script.mos
// load the Modelica library
loadModel(Modelica); getErrorString();
// load the ScalableTestSuite library
loadModel(ScalableTestSuite); getErrorString();
// or if you don't have ScalableTestSuite in the OM installation you need to load it via loadFile:
// uncomment this and comment the loadModel above
// loadFile("path/to/ScalableTestSuite/package.mo"); getErrorString();
// set special flags
setCommandLineOptions("--daeMode=dynamic"); getErrorString();
// build the model into an executable
buildModel(ScalableTestSuite.Mechanical.Strings.ScaledExperiments.StringModelica_N_64); getErrorString();
// run the executable with special flags
system("ScalableTestSuite.Mechanical.Strings.ScaledExperiments.StringModelica_N_64 -mei=4000 -daeMode -s=ida -idaLS=klu"); getErrorString();
// --- end --- script.mos

Then you run it via omc (i suggest you put script.mos in a separate directory as a lot of files will be generated when running the script):

Code:


path/to/omc script.mos

Apr-07-17 20:22:28
Could not load shared library to import a FMU into Simulink

cbertsch wrote:


adrpo wrote:

We are in the process of fixing this in several ways:
1. produce just one DLL
2. make the main dll load the dependencies
You can also send us your code, if you want (Adrian Pop: http://www.ida.liu.se/~adrpo33/ or to OpenModelica@ida.liu.se)
to see if we are on the right track.

We are also working on providing more FMUs for FMI Cross Check and we will check them with other tools as well.
By default we are checking them with the fmuChecker but that works fine.

This sounds good! I have sent you the example FMU calling an external DLL.
When you run the compliance checker on your FMUs: Do you do this on a PC without OpenModelica being installed?

Yes. No OM installed, and even if is installed we do not put anything in the path.
I think that the FMIL library loads the DLL with altered search path, that's why it works fine.

Apr-07-17 19:12:41
Could not load shared library to import a FMU into Simulink

cbertsch wrote:


In my opinion this is neither a problem of Simulink nor of the FMI-Kit, but of the exported FMU from OpenModelica.
I have an example of an FMU with a dependency on an additicional dll that can be simulated with FMIkit in Simulink and many other tools. On request I can provide it to the OpenModelica developers with source code as an example how to implement this.

I would recomment that OpenModelica participates at the FMI Cross Check (https://www.fmi-standard.org/tools) 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)

We are in the process of fixing this in several ways:
1. produce just one DLL
2. make the main dll load the dependencies
You can also send us your code, if you want (Adrian Pop: http://www.ida.liu.se/~adrpo33/ or to OpenModelica@ida.liu.se)
to see if we are on the right track.

We are also working on providing more FMUs for FMI Cross Check and we will check them with other tools as well.
By default we are checking them with the fmuChecker but that works fine.

Apr-07-17 08:43:31
Could not load shared library to import a FMU into Simulink

I'm glad it worked.

I wouldn't say the problem is solved because if you need to change the PATH and you need OM to be able to run the FMUs you cannot send the FMUs to other people that do not have OM installed (and your path settings).

Maybe you can report this to Simulink to tell them to load the dll with the flag given above as the FMU should not need anything from the running process directory but is arguable that more needed dlls are where the FMU is unpacked.

Apr-06-17 16:44:40
Could not load shared library to import a FMU into Simulink

Hm, it should work but it might be that Simulink does not load the FMU main dll in such a way that the extra dlls that we have in the FMU are found (see below).
You could try to add to PATH these paths (at the end): %OPENMODELICAHOME%/bin/;%OPENMODELICAHOME%/tools/msys/mingw64/bin; before starting Simulink.

The OM FMUs dll needs to be loaded with altered search path:
https://msdn.microsoft.com/en-us/librar … s.85).aspx
Alternate Search Order for Windows Store apps
If a module changes the standard search order by calling the LoadLibraryEx function with LOAD_WITH_ALTERED_SEARCH_PATH, the system searches the directory the specified module was loaded from instead of the directory of the calling process.

Apr-05-17 16:04:25
Could not load shared library to import a FMU into Simulink

What Simulink do you have, the 32 bit or 64 bit?
What version of OpenModelica do you have?
Note that the 64 bit makes a 64 bit FMU the 32 bit makes a 32 bit FMU.

Feb-23-17 16:04:07
Questions about using the scripting API via OMPython

Note that  1.11.0 32bit OMC has issues when building models.
The bug was fixed recently in 12.0-dev:
https://trac.openmodelica.org/OpenModelica/ticket/3894
We should port these fixes to 1.11.1 or so but it will take a while.

There are two alternatives for you:
1. use 64 bit 1.11.0
2. upgrade to 1.12.0-dev 32bit nigthly-builds:
    https://build.openmodelica.org/omc/buil … lds/32bit/

Feb-22-17 08:21:10
OMC is attempting to use dladdr but that call is not available on Windows

I also fixed it properly in the nightly builds:
https://build.openmodelica.org/omc/buil … lds/32bit/

You need to load the Modelica library also

Code:


omc -s ../ModelExample.mo Modelica

alternative with a script.mos containing;

Code:


loadModel(Modelica); getErrorString();
loadFile("../ModelExample.mo"); getErrorString();
translateModel(ModelExample); getErrorString();

then execute it via;

Code:


omc script.mos

Feb-18-17 02:18:30
OMC is attempting to use dladdr but that call is not available on Windows

It seems we're having issues generating C code in parallel. I'll need to debug more.

For now, to make it work you can add -n=1 to omc command:

Code:


omc -n=1 -s path/to/MyModel.mo

Feb-17-17 23:45:20
OMC is attempting to use dladdr but that call is not available on Windows

I will do some debugging of my own to fix this. I had no time to look too deep into this as I'm the one fixing Windows issues, but thanks for your investigation.
What I find really strange is that mingw64 works fine but mingw32 does not.

Your questions:
1) MINGW32 is defined in both mingw64 and mingw32
2) In general we try to keep the same Linux based interface and write small Windows layers to implement missing functions, but somehow this one escaped me.

Feb-17-17 17:15:17
OMC is attempting to use dladdr but that call is not available on Windows

This seems to be an error in 32bit OM. It works fine with the 64bit OM. Do you specifically need the 32bit one?

Feb-14-17 20:36:02
Simulation Process Failed, suspect Modelica_Synchronous

As far as i can see the simulation crashes with some assertion. Without the model is hard to debug.
If the model is not public you could send it to us at OpenModelica@ida.liu.se and we will delete it after debugging with it.
If the model is public open a ticket at:
https://trac.openmodelica.org/OpenModelica/
Click on New Ticket and then attach the model to the ticket.

Any reason for using version 1.9.7? Have you tried using 1.11.0?

Feb-10-17 13:02:41
Questions about using the scripting API via OMPython

I opened a ticket about this:
https://trac.openmodelica.org/OpenModelica/ticket/4262
and we should fix it.

Feb-10-17 12:59:57
Questions about using the scripting API via OMPython

Yeah, we should return the filename, not that message.
Basically it should be my_model.fmu in the current directory (you can get that with cd() command).

You can also have the model in the .mos:

script.mos:

Code:


// load the model as string, just make sure you escape " with \" inside the string.
loadString("
model HelloWorld \"A simple equation\"
  Real x(start=1);
  parameter Real a = -1;
equation
  der(x)= a*x;
end HelloWorld;"); getErrorString();

simulate(HelloWorld, stopTime = 2); getErrorString();
plot(x); getErrorString();

Then run omc from command line:

Code:


> omc +d=showStatement script.mos

See here, session example 3:
https://openmodelica.org/doc/OpenModeli … mmand-line

You can just make a script.mos containing:

Code:


loadModel(Modelica); getErrorString(); // load Modelica if you need it
loadFile("Model.mo"); getErrorString(); // load Model.mo that you edit
simulate(Model); getErrorString(); // simulate the model
plot({x, y}); getErrorString(); // plot any variables you need

then run omc from command line:

Code:


> omc script.mos

Hi,

Please send this question to OpenModelica@ida.liu.se.

Cheers,
Adrian Pop/

Feb-08-17 09:30:14
Category: Programming

foadsf, can you send us your model so we can debug what's the problem with it?
If is not public you can send it via email to OpenModelica@ida.liu.se and we'll delete it after debugging the issue.
If is public, just go to:
https://trac.openmodelica.org/OpenModelica/
click on New Ticket, create the ticket and attach your model to it.

You should not use Modelica_Noise library as is a bit outdated and we don't support it very well.
The Noise library was already included in the Modelica Standard Library (MSL) 3.2.2.
Just go to Modelica.Blocks.Noise or Modelica.Blocks.Examples.NoiseExamples to use those. To see what we support from the Noise library included in MSL go here:
https://test.openmodelica.org/libraries … rsive.html
and search for Noise. It seems all the example models are working.





It seems we have some issues with function inlining which generates undefined variables in the C code.
I opened a ticket about it and we'll have a look:
https://trac.openmodelica.org/OpenModelica/ticket/4239

For examples look into the Modelica Standard Libraries (MSL).

Have a look in Modelica.Mecanics.Translational.
Look inside:
- Modelica.Mecanics.Translational.Interfaces for connectors
- Modelica.Mecanics.Components for components (have a look how they extend the Interfaces)
- Modelica.Mecanics.Examples.Damper on how for example Mass and Spring are are connected together

You can read a bit more about Modelica, for example:
http://book.xogeny.com/



You can see some examples here:
http://spoken-tutorial.org/tutorial-sea … ge=English (also linked from our first www.openmodelica.org) page.

There are no API commands for substitution, is done automatically to evaluate expressions involving parameters or constants, basically to optimize the systems when calling buildModel or simulate.

In the front-end we only do this kind of things for structural parameters (array dimensions, etc), in the back-end depending on the the given flags there are more optimizations going on. I'm affraid we don't have too much documentation about the back-end so you'll have to look in the code:
https://github.com/OpenModelica/OMCompi … er/BackEnd
For a bit of outdated overview of the back-end you can look here:
https://openmodelica.org/svn/OpenModeli … r/BackEnd/
Some information about what the back-end does is here but is quite old too:
https://www.openmodelica.org/images/doc … ackend.pdf
I'll ask one of the back-end developers if there is anything newer and get back to you.


The code for the function evaluation interpreter is here:
https://github.com/OpenModelica/OMCompi … unction.mo
It basically goes over each function algorithm statement and interprets it in an environment with variables.

The compiler code is not that easy to understand, is written in MetaMoldelica (out own functional language).
You can find more about it here:
https://openmodelica.org/developersresources/courses
https://openmodelica.org/developersreso … umentation

An interpreter for Modelica language is surely possible and we have it partially as part of the OpenModelica compiler (for function interpretation).

However, I don't think any of the Modelica tools are following this path as you need access to numerical solver libraries (which are mostly in C or Fortran) and you need to link with them.

OpenModelica also does extensive symbolic manipulation and can solve some systems using substitutions but it highly depends on the system complexity.

Jan-13-17 17:32:08
Category: Programming

Only via modification on variable declaration:

Code:


MainClass001.SubClass001 subClass0011(phi(start = initial_condition));

Dec-27-16 21:26:21
The fmu export dont generate any file in he path

Ok. Let's try something else. Start your terminal and go someplace where you can write files like your home:

Code:


> cd ~
# create a testing directory
> mkdir testfmus
# change directory to the testing directory
> cd testfmus

Using any editor you want in the tesfmus directory we created, create a file called script.mos containing:

Code:


loadModel(Modelica); getErrorString();
translateModelFMU(Modelica.Electrical.Machines.Examples.AsynchronousInductionMachines.AIMC_withLosses);  getErrorString();

now back in the terminal:

Code:


> omc script.mos

See what files are generated in the ~/testfmus directory, especially .log files, also look into any directories inside.
If you can, zip ~/testfmus directory and attach it here. If you cannot attach them here just go to our Trac:
https://trac.openmodelica.org/OpenModelica
click on New Ticket and create a new ticket with your issue, then attach the zip file to the ticket.

Dec-27-16 21:10:55
the model pass the check but simulation has non graphic results

This seems to be a modeling error.
Your tank1 has height = 12, level_start = 12 which means that the tank1.level starts already at maximmum and if it goes beyond that an assertion in the Modelica code for the Tank is triggering and the simulation is failing. Are you sure you want to start the level at 12? If I change the tank1.level = 6 for example then the simulation works fine.

"What do you mean by we need components not record in Database.
Component is enumeration. enumeration cannot contain parameters and their values.
I have more parameters also which are not given in code. Some of them are array."

I was talking about "Comp". I mean that you need declare components which you can then assign in the functions, you tried to assign directly records to components and that does't work like that, it only works via a record constructor Record x = Record(var1=val1, var2=val2, etc).

In Modelica you can no longer modify only an array element, you can only modify the entire array that's why you cannot have a dialog for each array element.


Dec-27-16 12:17:47
The fmu export dont generate any file in he path

The warning is fixed in the latest revision.

There is no space missing. We generate a Model.fmutmp directory in which we put sources, binaries and so on which we then zip into Model.fmu.
Are you by any chance missing the "zip" utility? Write zip in a terminal to see if you have it.

Note that you need components not records in package Database. See below:

Code:


package Test1
  type Component = enumeration(Air, Argon, Bromine, Carbontetrachloride, Carbonmonoxide);

  package Database
    extends Modelica.Icons.VariantsPackage;
    record General_Properties
      Integer SN;
      String name;
      Real Tc;
      Real Pc;
      Real Vc;
      Real Cc;
      Real Tb;
      Real Tm;
      Real TT;
      Real TP;
      Real MW;
    end General_Properties;

    constant General_Properties Air(SN = 1, name = "Air", Tc = 132.45, Pc = 3774000, Vc = 0.09147, Cc = 0.313, Tb = 78.67, Tm = 59.15, TT = 59.15, TP = 5642.15, MW = 28.96);

    constant General_Properties Argon(SN = 2, name = "Argon", Tc = 150.86, Pc = 4898000, Vc = 0.07457, Cc = 0.291, Tb = 87.27, Tm = 83.8039, TT = 83.8, TP = 68906.1, MW = 39.948);

    constant General_Properties Bromine(SN = 3, name = "Bromine", Tc = 584.15, Pc = 1.03E+07, Vc = 0.135, Cc = 0.286, Tb = 331.9, Tm = 265.9, TT = 265.85, TP = 5853.37, MW = 10 /* adrpo: MW was missing, fix it! */);

    constant General_Properties Carbontetrachloride(SN = 4, name = "Carbontetrachloride", Tc = 556.3, Pc = 4557000, Vc = 0.276, Cc = 0.271, Tb = 349.79, Tm = 250.33, TT = 250.33, TP = 1122.46, MW = 153.822);

    constant General_Properties Carbonmonoxide(SN = 5, name = "Carbonmonoxide", Tc = 132.85, Pc = 3494000, Vc = 0.0931, Cc = 0.292, Tb = 81.66, Tm = 68.15, TT = 68.15, TP = 15400, MW = 28.01);
   
  end Database;

  function get_comp
    extends Modelica.Icons.Function;
    output Database.General_Properties Comp;
    input Component component;
  algorithm
    if component == Component.Air then
      Comp := Database.Air;
    elseif component == Component.Argon then
      Comp := Database.Argon;
    elseif component == Component.Bromine then
      Comp := Database.Bromine;
    elseif component == Component.Carbontetrachloride then
      Comp := Database.Carbontetrachloride;
    elseif component == component.Carbonmonoxide then
      Comp := Database.Carbonmonoxide;
    end if;
  end get_comp;

model MS
  extends Modelica.Icons.SourcesPackage;
  parameter Component component;
  Database.General_Properties comp;
 
equation
  comp = get_comp(component);
end MS;

  model Test
    MS mS1(component = Test1.Component.Argon)  annotation(Placement(visible = true, transformation(origin = {-2, 48}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  end Test;
end Test1;

We should support annotation choices for drop down list choices this but we don't yet. We're working on it.
You could also use replaceable and redeclares.

Dec-27-16 09:44:18
The fmu export dont generate any file in he path

Do you have any .log files in that directory? If so, it should tell you what went wrong.
Does the normal simulation works fine?

Dec-21-16 09:06:15
any model thate i have give the same error: component tank1 contains the definition of a partial...

You can read about redeclares in the Modelica Specification 3.x.

In your case you need to go into the Modelica source code for your model and for component tank1 just add:
redeclare Medium=Modelica.Media.Water.StandardWater to your components.

Code:


tank1(redeclare package Medium=Modelica.Media.Water.StandardWater);

You will need to add it for all the components that need it.

Dec-21-16 08:45:10
any model thate i have give the same error: component tank1 contains the definition of a partial...

What do you mean? If you're asking for the Modelica Language specification is here: https://www.modelica.org/documents/

Dec-21-16 08:28:48
any model thate i have give the same error: component tank1 contains the definition of a partial...

Unfortunately we don't yet support redeclares in the OMEdit dialogs  so you will have to write them it directly in the code.
I'm working on a solution which should be available soon. See:
https://trac.openmodelica.org/OpenModelica/ticket/2079

You cannot do that directly. You can call Modelica.Utilities.Streams.print to print internal function values to a file or stdout or stderr.
Alternatively you can run the model in algorithmic debug mode and put a breakpoint inside the function where you want to see the values.

We tried to make the installer smaller and we removed that library from the installer. I now fixed the issue.

Please re-download it and re-install it:
https://build.openmodelica.org/omc/buil … ta1/64bit/


Nov-23-16 17:42:56
Category: Developer

You need to run
OMDev\SETUP_OMDEV.bat
and
OMDev\SETUP_OMDEV_Qt5.bat
before you can compile qt clients.

Oct-11-16 19:15:42
it doesen't appear

We do not have yet support for choicesAllMatching and replaceable classes. Some work is under way to fix this in the near future.
See: https://trac.openmodelica.org/OpenModelica/ticket/2079

Oct-10-16 20:39:20
I need to run my model with a variety of input sets to get a variety of input cases

You could do something like:
https://openmodelica.org/forum/default- … eter-sweep

Another way is to create another model in which you have the current model several times as components with different inputs, that you can simulate once.

Oct-06-16 09:45:41
FMU export problems

What OpenModelica version are you using? If is 1.9.6 then is only 32 bit and can generate only 32 bit FMUs.
You need the 64bit nightly build to make a 64bit FMU:
https://build.openmodelica.org/omc/buil … lds/64bit/

You need to activate OMC Flags: +std=3.3 in OMEdit via Tools->Options->Simulation as these things are only available in Modelica Specification 3.3.

Aug-18-16 22:14:32
Deriving user class inheriting properties of base class

Should work like this:

Code:


model ReluctanceLinear
  extends Modelica.Magnetic.FluxTubes.Shapes.FixedShape.Cuboid(mu_rConst=5000);
end ReluctanceLinear;

Hm, I haven't run into these issues before, maybe see here:
http://stackoverflow.com/questions/3778 … repository


You might neeed to configure git or reinstall it. I use git from here:
https://git-scm.com/download/win

The path you have in Windows is not used in msys2 or eclipse.

For msys2 you need to give: ming64_shell.bat -use-full-path to use it. See OMDev\INSTALL.txt
You can also use:

Code:


> export PATH=$PATH:/c/path/to/git:/c/Program\ Files/Java/jre1.8.0_102/bin
> make ....

In eclipse, you need to edit the OMDev builder and set the PATH in the Environment tab.

Jul-26-16 17:25:14
1.11.x 64 bit appears to have changed something with how/where the results file is stored

What commands do you send to omc? How do you start omc?
The generated files should be in the directory where you start omc.

You can send:

Code:


cd("/some/path/you/want"); getErrorString();
simulate(Model);  getErrorString();

The Model_res.mat file should be in /some/path/you/want directory.

Jun-29-16 01:19:05
Some models take significant time to translate/compile

Tools->Options->Simulation->OMC Flags: +d=initialization,nogen,execstat
And then restart OMEdit.

Jun-28-16 23:34:31
Some models take significant time to translate/compile

I would say these things make compilation slower (in no particular order):
- unqualified paths (we need to search to the top to find the match), try to use fully qualified paths if possible
- components that have mutual modifications: Type1 a(b.x); Type2 b(a.y);
- redeclares: for this we need to generate unique types for all types that have redeclare in them for each different component prefixes down to the leafs
- global effects such as expandable connectors and inner outer
- package constants (we need to be able to evaluate them), especially those that have function calls as bindings which cannot be interpreted (dll generation)
- cardinality operator
- overconstrained connectors (we need to evaluate all branch, root, potentialRoot, connect and do a lot of analysis on connection sets)

I think by far the slowest part happens if we need during compilation to compile functions  as dlls and execute them to get the binding of a constant in a package.
You can try to compile your models with +d=nogen to disable dll generation during compilation to see if your models work that way.

Try to run the models with +d=execstat to see where the compiler spends the most time and let us know.

What version of OpenModelica are you using? The latest nightly or the 1.9.6 release?

Jun-27-16 16:24:33
The C code implementation conatins memory leaks
Category: Developer

That's just 4.3MB (4,399,090 bytes) which is basically almost nothing.
Please also give us the OMC version: omc -version or OMEdit -> Help -> About OMEdit.

Jun-27-16 15:33:45
The C code implementation conatins memory leaks
Category: Developer

Where have you uploaded the valgrind summary?
What OM version are you using?

Jun-24-16 11:54:00
I could not export classes with electrical ports

FMUs have fixed causality with clear inputs and outputs.
In general I create another model in which I add RealInput ports and RealOutput ports which you can connect to your internal model (via equations or connects).

Jun-20-16 17:43:34
since the 64b nightly builds, the donwload size grew to 1.8 GB and install size grew up to 7GB!
Category: Developer

Hi,

Yes, the size is rather large as we moved from msys + mingw32 to msys2 + mingw32 & mingw64.

Yes, we will do a cleanup as we are now including msys2 + mingw64 or mingw32 + a lot of libraries like Qt5 and so on.
I think the best would be to split up the installer into OpenModelica part (which is small and changes often) and msys2 part (which is big but does not change often).
We will look into this after Holidays (August or so).

Cheers,
Adrian Pop/

Jun-17-16 07:27:26
losing redeclare after any change in widget

This was a bug and was fixed:
https://trac.openmodelica.org/OpenModelica/ticket/3783
You can use one of the nightly builds:
https://build.openmodelica.org/omc/buil … ly-builds/
I suggest the 64 bit version as the 32 bit has some instability issues.

Jun-06-16 15:26:52
Category: Developer

You could try the latest nightly build:
https://build.openmodelica.org/omc/buil … lds/64bit/
as we now include the dlls I talked about above in the Windows FMUs.
See also ticket:
https://trac.openmodelica.org/OpenModelica/ticket/3946

Cheers,
Adrian Pop/

Jun-01-16 10:49:11
Category: Developer

@sjoelund.se, I don't think that building from source works on Windows, I have to check that.

@Giusto: you can try to include libhdf5-0.dll in the FMU yourself and see if is working.
The fmu is basically just a zip, you unzip it, you add these libraries to the binaries\win64 folder, then you zip it back again.
You need to add these libraries in the fmu:
OpenModelica\tools\msys\mingw64\bin\libhdf5-0.dll
OpenModelica\tools\msys\mingw64\bin\zlib1.dll
OpenModelica\tools\msys\mingw64\bin\libszip-0.dll

If you have a 32 bit FMU then you add to binaries\win32 folder:
OpenModelica\tools\msys\mingw32\bin\libhdf5-0.dll
OpenModelica\tools\msys\mingw32\bin\zlib1.dll
OpenModelica\tools\msys\mingw32\bin\libszip-0.dll

Cheers,
Adrian Pop/

Jun-01-16 10:10:10
Category: Developer

Maybe we could add libhdf5-0.dll to the fmu. Which example from the OpenHydraulics library gives you trouble? Or you have your own model based on that library?

May-24-16 14:27:27
Category: Developer

We're now supporting 64 and 32 bit OpenModelica and FMUs in the latest nightly-builds:
https://build.openmodelica.org/omc/buil … ly-builds/

The 1.9.6 release is using the same GCC 4.4 as 1.9.3. I would suggest trying the nightly builds which have been upgraded to GCC 5.3.0.
I remember for a previous forum post that one of the GCC DLLs we bundle with the FMI gfortran has issues with MATLAB:
https://www.openmodelica.org/forum/defa … fmu-export
but that was for GCC version 4.4. It might work fine with GCC 5.3.

What OpenModelica version did you used to create the FMUs?

May-24-16 08:23:22
How to build om with omdev package.
Category: Developer

Hi,

Can you do in the mingw64_shell.bat terminal?

Code:


> export OPENMODELICAHOME="d:\\Workplace\\Modelica\\OpenModelica\\build\\"
> make -f Makefile.omdev.mingw qtclients > trace.txt 2>&1

and paste trace.txt file here.

Do you follow this readme?
https://github.com/OpenModelica/OMCompi … v-MINGW.md

Cheers,
Adrian Pop/

May-24-16 07:11:45
How to build om with omdev package.
Category: Developer

The qwt sources are inside OMPlot!

If you start OMDev\tools\msys\mingw64_shell.bat and do:

Code:


git clone https://github.com/OpenModelica/OpenModelica --recursive
cd OpenModelica
make -f Makefile.omdev.mingw qtclients

it should build all the Qt clients.

Hi,

I don't quite get what you want, can you explain it a bit in more detail?

In the diagram level you can mark the components you want to copy and Right-Click + Duplicate.
In the text view you can copy text and paste it in another class.

Cheers,
Adrian Pop/

What error do you get?

As far as I  know this library is commercial and only comes with Dymola so you can only get it via Dymola demo download:
http://www.claytex.com/products/dymola/ … s-library/

Apr-24-16 12:00:41
Heap error in gcc or gdb avoids large size simulations

Try the 64bit nightly-build as it can access far more memory current/smile
https://build.openmodelica.org/omc/buil … lds/64bit/

Apr-24-16 11:33:17
Presumably a simple issue in equation handling

Hi again,

Very good you posted the entire model, the problem was in the component section current/smile
The problem is with SineValue = 0, it should be SineValue(start = 0) as if you have
SineValue = 0 it means an additional equation, that's why you have 76.

Code:


model BasicSinglePhaseDCACConverter
  Modelica.Electrical.Analog.Basic.Ground ground1 annotation(Placement(visible = true, transformation(origin = {-90, 4}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Basic.Capacitor UpperHalfCap annotation(Placement(visible = true, transformation(origin = {-36, 24}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Analog.Basic.Capacitor LowerHalfCap annotation(Placement(visible = true, transformation(origin = {-36, 4}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Analog.Ideal.IdealOpeningSwitch idealOpeningSwitchUpperHalf annotation(Placement(visible = true, transformation(origin = {-10, 34}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Ideal.IdealOpeningSwitch idealOpeningSwitchLowerHalf annotation(Placement(visible = true, transformation(origin = {-6, -6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Basic.Inductor FilterL(L = 0.01) annotation(Placement(visible = true, transformation(origin = {28, 34}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Basic.Capacitor FilterC(C = 0.001)  annotation(Placement(visible = true, transformation(origin = {52, 24}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Analog.Basic.Resistor Load(R = 10000)  annotation(Placement(visible = true, transformation(origin = {92, 24}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage1(V = 600) annotation(Placement(visible = true, transformation(origin = {-70, 24}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage2(V = 600) annotation(Placement(visible = true, transformation(origin = {-70, 4}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Analog.Sensors.VoltageSensor ACOutVSensor annotation(Placement(visible = true, transformation(origin = {118, 24}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
 
  parameter Real pi=2*Modelica.Math.asin(1.0);
  parameter Real Frequenz = 50;
  parameter Real A0 = 230;
  Real SineValue(start = 0); // NOTE HERE: it was SineValue = 0 which means an additional equation for SineValue!
equation
  connect(ACOutVSensor.n, Load.n) annotation(Line(points = {{118, 14}, {92, 14}, {92, 14}, {92, 14}}, color = {0, 0, 255}));
  connect(ACOutVSensor.p, Load.p) annotation(Line(points = {{118, 34}, {92, 34}, {92, 34}, {92, 34}}, color = {0, 0, 255}));
  connect(FilterC.p, Load.p) annotation(Line(points = {{52, 34}, {92, 34}, {92, 34}, {92, 34}}, color = {0, 0, 255}));
  connect(FilterC.n, Load.n) annotation(Line(points = {{52, 14}, {92, 14}, {92, 14}, {92, 14}}, color = {0, 0, 255}));
  connect(LowerHalfCap.p, FilterC.n) annotation(Line(points = {{-36, 14}, {52, 14}, {52, 14}, {52, 14}}, color = {0, 0, 255}));
  connect(FilterC.p, FilterL.n) annotation(Line(points = {{52, 34}, {38, 34}, {38, 34}, {38, 34}}, color = {0, 0, 255}));
  connect(idealOpeningSwitchUpperHalf.n, FilterL.p) annotation(Line(points = {{0, 34}, {18, 34}}, color = {0, 0, 255}));
  connect(idealOpeningSwitchLowerHalf.n, FilterL.p) annotation(Line(points = {{4, -6}, {18, -6}, {18, 34}}, color = {0, 0, 255}));
  connect(LowerHalfCap.n, idealOpeningSwitchLowerHalf.p) annotation(Line(points = {{-36, -6}, {-18, -6}, {-18, -6}, {-16, -6}}, color = {0, 0, 255}));
  connect(UpperHalfCap.p, idealOpeningSwitchUpperHalf.p) annotation(Line(points = {{-36, 34}, {-20, 34}, {-20, 34}, {-20, 34}}, color = {0, 0, 255}));
  connect(constantVoltage1.p, UpperHalfCap.p) annotation(Line(points = {{-70, 34}, {-36, 34}, {-36, 34}, {-36, 34}}, color = {0, 0, 255}));
  connect(constantVoltage2.n, LowerHalfCap.n) annotation(Line(points = {{-70, -6}, {-36, -6}, {-36, -6}, {-36, -6}}, color = {0, 0, 255}));
  connect(constantVoltage2.p, LowerHalfCap.p) annotation(Line(points = {{-70, 14}, {-36, 14}, {-36, 14}, {-36, 14}}, color = {0, 0, 255}));
  connect(ground1.p, constantVoltage2.p) annotation(Line(points = {{-90, 14}, {-70, 14}, {-70, 14}, {-70, 14}}, color = {0, 0, 255}));

algorithm
  SineValue:=sin(2 * 2*Modelica.Math.asin(1.0) / Frequenz * time);
// when SineValue>0 then
// if SineValue<ACOutVSensor.v then
//   idealOpeningSwitchUpperHalf.control := true;
// end if;
// elsewhen SineValue<0 then
// if SineValue>ACOutVSensor.v then
//   idealOpeningSwitchLowerHalf.control := true;
// end if;
// end when;

idealOpeningSwitchUpperHalf.control :=  if SineValue>0 and SineValue<ACOutVSensor.v then true else false;
idealOpeningSwitchLowerHalf.control :=  if SineValue<0 and SineValue>ACOutVSensor.v then true else false;

  annotation(uses(Modelica(version = "3.2.1")));
end BasicSinglePhaseDCACConverter;

Cheers,
Adrian Pop/

Apr-24-16 11:01:35
Presumably a simple issue in equation handling

Hmm, is a bit complicated to understand what you want to do without having the entire model.

Maybe you can try without the when equations:

Code:


idealOpeningSwitchUpperHalf.control :=  if SineValue>0 and SineValue<ACOutVSensor.v then true else false;
idealOpeningSwitchLowerHalf.control :=  if SineValue<0 and SineValue>ACOutVSensor.v then true else false;

Apr-24-16 10:26:29
Presumably a simple issue in equation handling


Try using elsewhen instead of having two separate mutual excluding equations.

Mar-29-16 14:55:44
Unable to open 64 bit OMEdit

Ok. I'll do more tests on different computers, maybe I can find out what the problem is.

Mar-29-16 12:54:46
Unable to open 64 bit OMEdit

Hi,

That is strange. It does work for me quite well. I sow your crash reports but unfortunately they don't point me to the error.
Does the 32 bit version works fine?
https://build.openmodelica.org/omc/buil … ly-builds/

Cheers,
Adrian Pop/

@bumino: you can pass arrays as given in the specification. You need to pass them as input in the external functions (C references).

By the way, you should use OpenModelica 1.9.6:
https://build.openmodelica.org/omc/buil … ses/1.9.6/

I opened a ticket about the broken C runtime for MSVC:
https://trac.openmodelica.org/OpenModelica/ticket/3790

Hi,

It seems the C MVSC runtime is a bit broken. I'll have a look at it.
You can try selecting the Cpp target language in Tools->Options->Simulation.

Cheers,
Adrian Pop/

Mar-22-16 21:03:14
Too many heap sections on trying to run a model

I'm still fighting to pushing my changes for 64 bit in. I hope to have them in tomorrow and then the builds will have 64 bit too.

@dietmarw: the installer will uninstall the already installed OpenModelica automatically.
@sjoelund.se: rsync is not very friendly on Windows.

Maybe we could have an Windows start menu item or a menu in OMEdit: "Update OpenModelica" which does the update automatically.

A lot of people use the nightly builds but I guess they just bookmark the page and click two times, one to download and one to install.

Is a bit complicated as the installer name is variable each day. I'll see what I can do.
Probably I can generate a DownloadAndInstall.bat and put it in the same place as the nightly-builds.

Mar-10-16 22:42:12
Too many heap sections on trying to run a model

We'll be running tests for 2-3 weeks with the new 64/32 bit OpenModelica based on msys2 and mingw64/mingw32 gcc 5.3 and then probably release 1.9.5.
The version which is currently there was manually build by me but it should be  available on in the automatically build nightly-builds soon.

Mar-10-16 16:41:35
Too many heap sections on trying to run a model
Feb-19-16 17:47:38
API call getExtendsModifierNames() returns Error

Hi,

I now opened a ticket about this:
https://trac.openmodelica.org/OpenModelica/ticket/3696
we should add an API for that as we need it also for OMEdit.

Feb-19-16 17:42:58
API call getExtendsModifierNames() returns Error


Ok, for that we don't have an API yet. We don't handle any redeclares in the query API.

Sorry, it seems that you put some wrong code in file translateMyFMU.mos.

We fixed the FMU generation for Windows in the last 1.9.2-dev.beta2 release, so you can now do it via OMEdit (OpenModelica Connection Editor).
Just install this version:
https://build.openmodelica.org/omc/buil … 9.4/beta2/
And then open your model in OMEdit and right click on it and say Export FMU.

Feb-19-16 17:20:38
API call getExtendsModifierNames() returns Error

Hi,

It works OK for me:

Code:


adrpo@ida-liu050 /f/dev/testing/scale
$ ../../OpenModelica/build/bin/omc iac.mos
true
""
{a.x, f}
""
= 1
""
(x = 2 * y)
""

iac.mos

Code:


loadFile("iac.mo"); getErrorString();
getExtendsModifierNames(D2,B2); getErrorString();
getExtendsModifierValue(D2,B2,f); getErrorString();
getExtendsModifierValue(D2,B2,a); getErrorString();

iac.mo

Code:


model Resistor
    Real r=1;
end Resistor;

model K
  extends Resistor(R.start=5);
end K;

model K2
  extends  Resistor(R(start=5,fixed=true)=2);
end K2;

model K3
  extends  Resistor(R(start=5,fixed=true));
end K3;

model K4
  extends Resistor(x(start=2,fixed=true)=1);
end K4;

model K5
  extends Resistor(x.fixed=true,x.start=2,x=1);
end K5;

model K6
  extends Resistor(final x.fixed=true,x.start=2,final x=1);
end K6;

model M
  Real x(start=2)=1;
end M;

model M2
  Real x=1;
end M2;

model M3
  Real x(start=2)=1;
end M3;

model M4
  Real x;
end M4;

model M5
  Real x;
end M5;


model M6
  Real x(start=1,fixed=false);
end M6;

model M7
  A a1(x.fixed=true);
end M7;

package Modelica
  package Blocks
    package Interfaces
      connector BooleanSignal = Boolean "Boolean port (both input/output possible)";
      connector BooleanInput =input  BooleanSignal "'input Boolean' as connector" annotation (defaultComponentName="u",Icon(coordinateSystem(extent={{-100.,-100.},{100.,100.}}),graphics={Polygon(points={{-100.,100.},{100.,0.},{-100.,-100.},{-100.,100.}},lineColor={255,0,255},fillColor={255,0,255},fillPattern=FillPattern.Solid)}),Diagram(coordinateSystem(extent={{-100.,-100.},{100.,100.}}),graphics={Polygon(points={{0.,50.},{100.,0.},{0.,-50.},{0.,50.}},lineColor={255,0,255},fillColor={255,0,255},fillPattern=FillPattern.Solid),Text(extent={{-140.,120.},{100.,60.}},textString="%name",fillColor={255,0,255})}));
  end  Interfaces;
end Blocks;
end Modelica;


model Q
    Real x=1;
end Q;


type T1 = Real;
type T2 = Real[4];

type Resistance
  extends Real(unit="ohm");
end Resistance;

package Types
  type T2 = T1(unit="foo");
  type T1 = Integer;
end Types;

model A
  parameter Integer p1=35;
  parameter Integer p2=32,p4;
end A;

model B
  A a1;
  A a2;
end B;

model C
  B b1(a1(p1=0,p2=0),a2.p2=3);
end C;

model A2
  parameter Real x=1;
  Real y=11;
end A2;

model B2
  parameter Real f=1;
  A2 a(x=3);
end B2;

model C2
  Real m = 1;
  parameter Real n=2;
end C2;

model D2
  Real y = 2;
  extends B2(a(x=2*y),f=1);
  extends C2(m=1,n=2);
end D2;

model E
  A a(p1=1,p2=2);
end E;

How did you tested?

Feb-12-16 00:18:46
How to communicate with OM from within visual basic application ?

You could try using the compiler dll directly the way OMEdit does.
What kind of things do you want the compiler to do? Load models, simulate files?

We do not have 1.0 co-simulation yet. Just FMI 2.0 and you need a specific version for Windows. Install this one:
https://build.openmodelica.org/omc/buil … 9d33ec.exe

Then you need to write a script to export the FMU. Create a new file translateMyFMU.mos containing:

Code:


loadModel(Modelica); getErrorString();
// load any other models you need
loadFile("MyModel.mo");  getErrorString();
// translate MyModel to FMU for co-simulation
translateModelFMU(Model, "2.0", "cs"); getErrorString();

Then you run omc.exe on the script from the command line:

Code:


> C:\OpenModelica\build\bin\omc.exe translateMyFMU.mos

Feb-10-16 10:38:31
Unable to load the SimForge graphical tool under Windows Vista 64-bit

SimForge no longer works with OpenModelica since some years now.
Use OMEdit (OpenModelica Connection Editor) which is distributed with OpenModelica installation.

Yes,  most of them should work but some of therm are there as partial components of the bigger examples.
Even if you use Dymola you cannot compile those models. For example this is what you get when you try to simulate Modelica.Media.Examples.Tests.Components.PortVolume:

Code:


Translation of Modelica.Media.Examples.Tests.Components.PortVolume:

Component type specifier BaseProperties is a partial type.
File: F:/bin/Dymola2015FD01/Modelica/Library/Modelica 3.2.1/Media/package.mo, line 3195
Component context: medium
Component declared as Medium.BaseProperties medium in Modelica.Media.Interfaces.PartialMedium

ERROR: 1 error was found

Hi,

You cannot use those models directly as they have a partial medium defined inside. You need to redeclare the Medium model when you use these models.

Cheers,
Adrian Pop/

If you have multiple elements with the same name that come from the local scope and the extends scope the have to be *identical* which is not the case in this particular example. The correct way to deal with changes is via modifications on the extends clause:

Code:


record ColorData
    parameter Real red = 0.2;
    parameter Real blue = 0.6;
    Real green;
end ColorData;

class ErrorColor
    extends ColorData(red=0.3, blue = 0.12);
equation
    red + blue + green = 1;
end ErrorColor;

The question is how does it look hierarchically. The inner should be defined somewhere at the top level and the outer somewhere inside the model.

Code:



// the test model
model M
  inner A a; // note that it should be at the top level not in another variable (model) at the top level.
  Y y;
end ;

model Y
  // or somewhere even deeper here
  Z z:
  outer A a;
end Y;

model Z
  // or somewhere even deeper here
  outer A a;
end Z;

Hi,

It should be something like this:

Code:


model EngineSpeed
  inner parameter SI.Conversions.NonSIunits.AngularVelocity_rpm rpm = 2000;
end EngineSpeed;

// in your bearing model you should add:
outer parameter SI.Conversions.NonSIunits.AngularVelocity_rpm rpm;

Note that inner / outer variables need to have *the same* name!
In your case the inner is rpm and the outer is DefEngineSpeed which is not correct.

Cheers,
Adrian Pop/

Dec-20-15 10:57:26
how to convert Modelica models with multiple top-level entities into models that can be opened by...

You can load them via scripts or command line in omc.

If you want them in OMEdit then you need to encapsulate them in a package:

Code:


within ;
package MyPackage
// contents of the other file
end MyPackage

Dec-17-15 08:34:00
getParameterValue()

BTW, what do you want to do with the API?

Dec-17-15 08:32:05
getParameterValue()

The doc is like this:

Code:


function getParameterValue
  input TypeName class_;
  input String parameterName;
  output String parameterValue;
end getParameterValue;

Which means you need to call it like this:

Code:


getParameterValue(BouncingBall,"e"); // no quotes for the first argument which is of TypeName

For more examples of the API you can have a look here:
https://github.com/OpenModelica/OpenMod … active-API
Begin with files interactive_*.mos

Cheers,
Adrian Pop/

Dec-16-15 14:05:45
Compiling a model with msvc

Ok, it seems we're not compiling and linking some runtime code for the MSVC C target. I'll open a ticket about it and have a look.

Maybe it works better with the C++ runtime: +simCodeTarget=Cpp.
In OMEdit try to choose Cpp from drop-down options of Target Language and msvc
from drop-down options of Target Compiler in Tools->Options->Simulation and try to
build again.

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