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

Can you provide also the models for the missing models?

conductor_power
initial_resistivity_v2

Jul-31-22 12:38:39
Add vanilla instructions for how to get OMEdit working under Mac from the Docker images that are...

It seems you solved the issue! Very good. Thank you for the howto. I now added a link to it to the Mac download page.

Unfortunately without some idea on how the code looks
like is really hard to know what the problem is.

Can you at least show just the line where this error appears?

I understand you cannot share the models publicly but maybe you
can send it via email to openmodelica@ida.liu.se and we will delete
them after we see what the problem is.

Jul-25-22 13:53:12
Category: Programming

How are you doing this? Can you post some code? It looks like you are using a class instead of a component:

Code:


model M
  Real x;
equation
  der(x) := -1*x;
end M;

model Test
  M m;
  Real x = M; // not correct, class M
  Real x = m.x; // correct, component m.x
equation
  x = m.x; // correct, component m.x
  x = M; // not correct, class M
end Test;

Jul-22-22 19:19:06
Having trouble installing ModelicaML


You can download an older eclipse with everything installed from here:
https://www.ida.liu.se/labs/pelab/model … caML/temp/

If you want to revive the project you can find the code here:
https://github.com/OpenModelica/MDT

See also:
https://www.openmodelica.org/forum/defa … modelicaml

You cannot make a standalone executable out of an FMU as it compiles to a shared library. You can however use OMSimulator executable to run the FMU.
Or if you want an executable you can just build it normally, not as an FMU.

Apr-21-22 07:48:15
Category: Developer

278067605 wrote:


I want to add OMC as a component to a project we are doing now. How can I implement it? Thank you.

How do you want to use it? Interactively like a server via ZMQ or Corba or direct calls via dlls/so?
Is also possible to call omc via your tool as a different process.

Apr-20-22 18:29:45
How to compile OpenModelica in QT?
Category: Developer

Did you setup Qt in OMDev?
If not, run C:\OMDev\SETUP_OMDEV_Qt5.bat

Then start mingw64 terminal, go to OpenModelica git repository clone and do:

Code:


make -f Makefile.omdev.mingw -j8 omedit > trace.txt 2>&1

Then paste the trace.txt file here.

Apr-18-22 15:34:32
This command git clone https://openmodelica.org/git/OMDev.git doesn't seem to work。
Category: Developer

Note that OMDev is rather huge, 15.2 GB so it might be that you run into network issues or space on the hdd?

This works fine for me, I just tried it:

[code
]git config --global core.eol lf
git config --global core.autocrlf input
git clone https://openmodelica.org/git/OMDev.git
[/code]

It takes 15 minutes for me to clone OMDev on Windows 10.

Code:


adrpo33@ida-0030 MINGW64 /e/dev
# time git clone https://openmodelica.org/git/OMDev.git
Cloning into 'OMDev'...
remote: Counting objects: 217072, done.
remote: Compressing objects: 100% (111943/111943), done.
remote: Total 217072 (delta 107664), reused 209070 (delta 99721)
Receiving objects: 100% (217072/217072), 4.96 GiB | 8.80 MiB/s, done.
Resolving deltas: 100% (107664/107664), done.
Updating files: 100% (235808/235808), done.
real    15m27.413s
user    0m0.078s
sys     0m0.171s

adrpo33@ida-0030 MINGW64 /e/dev
# cd OMDev/
adrpo33@ida-0030 MINGW64 /e/dev/OMDev
# ls
bin    compile-here           doc      INSTALL.txt  man              OpenModelicaTemplateProgramming.pdf  saved-hacked-files SETUP_OMDEV_Qt5.bat  util
build  COPYRIGHT-mmc+rml.txt  include  lib OpenModelicaMetaProgramming.pdf  README.txt SETUP_OMDEV.bat     tools

Apr-15-22 09:27:33
FMI:Cosimulation ::canGetAndSetFMUstate

We don't support canSerializeFMUstate yet.
Support canGetAndSetFMUstate was recently added: https://github.com/OpenModelica/OpenModelica/pull/8638


From version 1.18.0 you can also activate "Use static linking" in OMEdit->Tools->Options->Simulation. That will generate you an executable that does not need any extra dlls to run (well, except if you have some in your library).

https://pasteboard.co/3ufiTsk1mJMR.png

I am working on a new package OMCallPythonAdvanced which will send two variables to a Python function and get one back as an example.
Hopefully you will have it later this week. I will send you a message here when is available.

Mar-12-22 15:29:32
Simulation process failed. Exited with code 0xffffffffffffffff.

I also opened a bug about the crash, the simulation should not crash even if there is an error:
https://github.com/OpenModelica/OpenMod … ssues/8690

Mar-12-22 15:16:32
Simulation process failed. Exited with code 0xffffffffffffffff.

You first get a division by zero:

Code:


division by zero at time 0, (a=0) / (b=0), where divisor b expression is: sqrt(valveLiq.rhonom * valveLiq.dpnom) * FirstNewExperiment.valveLiq.FlowChar(valveLiq.thetanom)

I guess you need to see why the expression

Code:

sqrt(valveLiq.rhonom * valveLiq.dpnom) * FirstNewExperiment.valveLiq.FlowChar(valveLiq.thetanom)

is zero when the system initializes.

It might be because valveLiq.dpnom parameter is zero:

Code:

[4] 15:58:25 Translation Warning

[C:/home/adrpo33/dev/OpenModelica/build/lib/omlibrary/ThermoPower 3.1/Water.mo: 5615:7-5616:61]: Parameter valveLiq.dpnom has no value, and is fixed during initialization (fixed=true), using available start value (start=0.0) as default value.

So you need to give some value to the dpnom parameter in component valveLiq.
I have no idea about modeling so you need to read the documentation or see some other example on how to use ThermoPower.Water.ValveLiq properly.

Mar-12-22 13:23:29
Simulation process failed. Exited with code 0xffffffffffffffff.

Without seeing your model is really hard to find where the error is.
If you cannot share the model publicly maybe you can send it to us privately via email at
OpenModelica@ida.liu.se and we will use it for debugging and then delete it.

For sure it would be possible to do something like described here:
https://stackoverflow.com/questions/328 … turn-value
I will give it a try next week if I have time but it should be easy to do.

Seems like I had to add fflush to show the printouts. See the changes:
https://github.com/adrpo/OMCallPython.git

What do you want to send from Modelica to Python and back?

I would not include with the full path in the OMCallPython.h file as I don't think that would work.
But, you could give it a try with forward slashes:
#include <C:/Users/*Name*/AppData/Local/Programs/Python/Python310/include/Python.h>


I now added an image on how to set the compiler flags before compiling.
https://github.com/adrpo/OMCallPython.git
You could try to add there:
-I"C:/Users/*Name*/AppData/Local/Programs/Python/Python310/include/"
and then just include <Python.h>

Also, if you have special characters in the path to the Python.h that might be problematic. Basically if you user contains special chars åöä or so.

Another alternative is to add your include path to the Modelica code, basically change in OMCallPython/package.mo everywhere:

Code:


IncludeDirectory = "modelica://OMCallPython/Resources/C-Sources"

to:

Code:


IncludeDirectory =
  {"modelica://OMCallPython/Resources/C-Sources",
   "C:/Users/*Name*/AppData/Local/Programs/Python/Python310/include/"}

I think this is a bug so I opened a bug report about it:
https://github.com/OpenModelica/OpenMod … ssues/8640

You could you try this:

Code:


sudo cp /usr/include/omc/c/ModelicaUtilities.h /usr/include/omc/c/fmi/

and then try to build the FMU again.

What model from the Buildings library?

Are you trying to generate an FMU?

Sorry for this. The Windows installer script fix I did yesterday broke the installer by copying a lot of the things needed in /bin into bin/ffi. I have now fixed the issue:
https://github.com/OpenModelica/OpenMod … 0c265c2dd9
and started a new nightly build.

The Linux builds where not finished when you tried, they start at 02:00 Stockholm time and take 4-5 hours to build. You can update now and try.

Something like this.

Code:


package MyFirstPackage

model ReuseModel
Real x(start = 0, fixed = true); // change the start value if you need to
parameter Real a = 5;
equation
x = 0.5 * a * (time ^ 2);
end ReuseModel;


model RunSeveral
  ReuseModel f1(a = 5);
  ReuseModel f2(a = 10);
  ReuseModel f3(a = 15);
  ReuseModel f4(a = 20);
end RunSeveral;

end MyFirstPackage;

Then you can either simulate model ReuseModel, plot x, change a = 10 in the plot view, right click on the simulation results, say resimulate and simulates with a = 10, 15, 20.

Or you can simulate RunSeveral and plot f1.x, f2.x, f3.x, f4.x on the same plot.

https://paste.pics/7f3948ee0531f8eb470b46df86aa0d06

Jan-25-22 13:46:30
My simulation fails if the "target Build" is VS 2015.

I think the VS compilation is rather broken since some time now and we did not had resources to fix it yet.
Do you really need to compile the simulation models with Visual Studio? Maybe you can explain why. They should work fine with the OpenModelica installed gcc. Err, actually we use clang since version 1.17.

Jan-08-22 17:30:54
how to utilize the exe file that is compiled when i simulate a model?

See here for an example using -output:
https://github.com/OpenModelica/OpenMod … ssues/8384

Dec-29-21 11:42:34
how to utilize the exe file that is compiled when i simulate a model?

Note that you should also be able to use

Code:

val(var, time, "result_filename.mat|csv")

in case you use

Code:

system 

and not

Code:

simulate

https://build.openmodelica.org/Documentation/OpenModelica.Scripting.val.html
So hopefully this might work fine (but I'm a bit unsure if we implemented it for csv files):

Code:

val(s,0,"twovariableaddition_res.csv");

Dec-29-21 11:34:39
how to utilize the exe file that is compiled when i simulate a model?

For this one:

Code:


system("C:/Users/amroa/AppData/Local/Temp/OpenModelica/Output/twovariableaddition -override extpar1="+String(6)+",extpar2="+String(6)+" -r=twovariableaddition" + "_res.csv")

I think you're missing a semicolon at the end:

Code:


system("C:/Users/amroa/AppData/Local/Temp/OpenModelica/Output/twovariableaddition -override extpar1="+String(6)+",extpar2="+String(6)+" -r=twovariableaddition" + "_res.csv");

I suggest to also add

Code:

getErrorString();

after each command so you can see if there are any errors.

Amro wrote:


adrpo wrote:


3. Are you running those commands in cmd.exe or some other shell like powershell?
If yes, then you need to run it like this:
& "$env:OPENMODELICAHOME\bin\omc.exe" script.mos

Yes, from powershell

my script is "run_twovariableaddition.mos":

Code:


cd("C:/Users/amroa/AppData/Local/Temp/OpenModelica");
mkdir("Output"); getErrorString();
cd("Output"); getErrorString();
loadModel(Modelica); getErrorString();
loadFile("C:/Users/amroa/AppData/Local/Temp/OpenModelica/twovariableaddition.mo")
readFile("C:/Users/amroa/AppData/Local/Temp/OpenModelica/twovariableaddition.mo")
buildModel(twovariableaddition);
system("C:/Users/amroa/AppData/Local/Temp/OpenModelica/Output/twovariableaddition -override extpar1="+String(6)+",extpar2="+String(6)+" -r=twovariableaddition" + "_res.csv")

and I am running it from powershell as below and gave me an error:

Code:


PS C:\Users\amroa\AppData\Local\Temp\OpenModelica> & "$env:OPENMODELICAHOME\bin\omc.exe" run_twovariableaddition.mos
Error processing file: run_twovariableaddition.mos
[C:/Users/amroa/AppData/Local/Temp/OpenModelica/run_twovariableaddition.mos:1:52-1:52:writable] Error: Missing token: ASSIGN

# Error encountered! Exiting...
# Please check the error message and the flags.

Execution failed!

Dec-29-21 11:29:37
how to utilize the exe file that is compiled when i simulate a model?

Note that you cannot do

Code:

system("./Model ")

and then get the results in the environment, however, if you run

Code:

simulate(Model)

you can then use

Code:

val(var, 0)

.

I will make an example with -output.

Dec-29-21 10:32:19
I'm using OMPython to test modelica model, Is there a way to save results in Csv format

I answered your question here, with some more info:
https://stackoverflow.com/questions/705 … -interface

Basically this is what you want:

Code:


loadFile("HePackage.mo"); getErrorString();
list(HePackage.Systems.Syslam_Q5); getErrorString();
setElementModifierValue(HePackage.Systems.Syslam_Q5, hlam.UCfile, $Code(="C:/some/other/file.txt")); getErrorString();
setElementModifierValue(HePackage.Systems.Syslam_Q5, hlam.A_HS_mod1, $Code(=1.0)); getErrorString();
setElementModifierValue(HePackage.Systems.Syslam_Q5, hlam.CSize_flag, $Code(=true)); getErrorString();
setElementModifierValue(HePackage.Systems.Syslam_Q5, hlam.A_HS_mod2, $Code(=2.0)); getErrorString();
setElementModifierValue(HePackage.Systems.Syslam_Q5, hlam.A_HS_mod3, $Code(=3.0)); getErrorString();
setElementModifierValue(HePackage.Systems.Syslam_Q5, hlam.A_HS_mod4, $Code(=4.0)); getErrorString();
list(HePackage.Systems.Syslam_Q5); getErrorString();

Dec-28-21 20:58:59
how to utilize the exe file that is compiled when i simulate a model?

There are alternatives to speed it up quite a bit if you only need for example just a few variables from a simulation run, you could skip the generation of the mat file entirely with -noemit: https://openmodelica.org/doc/OpenModeli … lag-noemit and using -output var1,var2,var3: https://openmodelica.org/doc/OpenModeli … lag-output
Then you would just read these variable values and use them for the next simulation.

Alternatively you could use FMI, generate an FMU from your model and use any FMI tool to run the FMU until a certain time, then read the values, then restart the FMU with the new values. No mat file is generated. I would suggest to use OMSimulator python interface for this: https://www.openmodelica.org/doc/OMSimu … ython.html
OMSimulator can run composite FMUs but you don't need that, one FMU should be enough, just load that and run it using stepUntil. I will try to make a python script example for this.

Dec-28-21 20:32:32
how to utilize the exe file that is compiled when i simulate a model?

1. can I see the entire script? you could try to log the system command and display the error

Code:


system(system("./Model -override x=4", "log.txt"); getErrorString();
readFile("log.txt");  getErrorString();

2. it doesn't really work like you want, there is no workspace as Matlab has.
Do you know how to code in something like python or Julia, it might be easier to handle what you want.
I guess you want some variables at certain times and use those values in the next iteration.

3. Are you running those commands in cmd.exe or some other shell like powershell?
If yes, then you need to run it like this:

Code:


& "$env:OPENMODELICAHOME\bin\omc.exe" script.mos

Dec-28-21 20:13:09
I'm using OMPython to test modelica model, Is there a way to save results in Csv format

I guess we would need to implement that functionality as I don't think we have it currently. Should be easy to add I think.

Dec-24-21 21:57:20
how to utilize the exe file that is compiled when i simulate a model?

Just creste a script.mos file containing:

Code:


// go to where you want
cd("path/to/directory/you/want"); getErrorString();
// create a new directory there
mkdir("someTempDirecoryName"); getErrorString();
// change to that directory
cd("someTempDirecoryName"); getErrorString();
// build your model
// load some libs first
loadModel(Modelica); getErrorString();
// load some model file
loadFile("path/to/Model.mo"); getErrorString();
// build model
buildModdl(Model); getErrorString();
// simulate model with some parameter change
system("./Model -override x=4"); getErrorString();

Then run omc from command line on it (Windows)

Code:


%OPENMODELICAHOME%\bin\omc script.mos

Or load and run the script jn OMShell.

See more here:
https://openmodelica.org/forum/default- … eter-sweep
https://build.openmodelica.org/Document … pting.html

OMShell dying on your command seems like a bug. I will check it out.

I think you can also set %APPDATA% to a different directory for each of the versions so that you don't need to copy the omedit.ini.

Oct-21-21 08:57:05
I'm trying to pass reference variable inside setParameters function but its throwing error.
Category: Programming

Maybe like this?

Code:


setParameters("Values = " + str(k))

See also alternatives here:
https://realpython.com/python-string-fo … -strformat

Code:


setParameters("Values = %g" % k)

Sep-22-21 08:14:12
Dynamics simulation using Monte Carlos simulation
Category: Programming

You can generate a Model.exe executable from your model then use -iif=file_with_initial_conditions.mat to run with different initial variables
https://openmodelica.org/doc/OpenModeli … imflag-iif
https://openmodelica.org/doc/OpenModeli … flags.html

I would do this in python or some other programming language (you can also use OpenModelica with mos files, see for example:
https://openmodelica.org/forum/default- … ter-sweep)

Basically you should generate N initialX.mat files with random values (i guess you could use python to do that) then call your model with that input.

Code:


Model.exe -iif=initial1.mat -r output1.mat
Model.exe -iif=initial2.mat -r output2.mat
...
Model.exe -iif=initialN.mat -r outputN.mat

Then just plot output*.mat on the same plot.

Another way would be to use setComponentModifierValue(className, componentName.modifierName, $Code(expression));
Write something like this in a script.mos file

Code:


loadFile("Model.mo"); getErrorString();

for i in 1:100 loop
  // set a random start value to the component you want
  // change these here to what you need
  setComponentModifierValue(ModelName, componentName.modifierName, $Code(randomExpression));
  // compile the model
  buildModel(Model);
  // run the model and generate the output into an unique mat file.
  system("./Model -r=output_file_" + String(i) + ".mat");
end for;

then just run omc script.mos where Model.mo file is.

You can also use OMPython to do this, see for example this paper:
https://www.ep.liu.se/ecp/142/103/ecp17142103.pdf

This seems like a bug. Do you by any chance still have OPENMODELICALIBRARY environment variable defined?

Jul-08-21 06:44:49
Compilation

No need to post it as you have all the executables built.
Just start OMEdit from build/bin.

Jul-07-21 12:55:46
Compilation

Things are getting messy, let's try again from the beginning. Lines that start with # are comments

Code:


cd /home/flembcke/Downloads/OpenModelica_Source/OpenModelica/
# clean everything
make gitclean
# autoconf
autoconf
# let's configure without prefix, maybe it has issues
./configure CC=clang CXX=clang++ QMAKE=/usr/bin/qmake-qt5 --with-cppruntime >> trace.txt 2>&1
# run make
make -j`nproc` >> trace.txt 2>&1
# let's see what we have in the build directory
ls -lah build/ >> trace.txt 2>&1
ls -lah build/bin >> trace.txt 2>&1

Paste the trace.txt here.

Jul-06-21 22:28:06
Compilation

The qt clients are build by default on make.
You don't need to configure in each directory, only in the top one, it would actually not work and you get issues like the ones you're having.

I will investigate why make install doesn't work properly for you. Until then you can use OpenModelica from:
/home/flembcke/Downloads/OpenModelica_Source/OpenModelica/build/bin
you should have the needed executables in there, omc, OMEdit, OMShell, OMSimulator, OMNotebook.
Just start OMEdit from
/home/flembcke/Downloads/OpenModelica_Source/OpenModelica/build/bin/OMEdit
if you don't have it there then the build didn't work properly.

Jul-03-21 07:49:06
Compilation

I see you configure with --with-omniORB=/usr/share/idl/omniORB
If you need Corba, you are missing the Corba libraries: -lomniORB4 -lomnithread
so libomniORB4.a (or .so) and libomnithread.a (or .so)
As far as I can see there are no prebuilt libraries for your system:
https://software.opensuse.org/package/omniORB
I will search a bit more and come back.

BUT, do you really need Corba? If you need to talk with OMC on the network you can do it via ZMQ.
If you don't need Corba you can just configure without it:

Code:


./configure QMAKE=/usr/bin/qmake-qt5 --with-cppruntime

Jul-02-21 22:58:06
Compilation

You need to install libexpat-devel, see the line from the other post.

Code:


sudo zypper install git-core autoconf automake clang11 gcc libexpat-devel gcc-fortran lapack libcurl-devel \
libqt5-qtbase libqt5-qtbase-devel libqt5-linguist libQt5WebKit5 libQt5WebKitWidgets-devel \
libQt5XmlPatterns5 libqt5-qtxmlpatterns-devel libqt5-qtsvg-devel readline-devel libtool \
ossp-uuid uuid-devel flex bison libboost*1_75*-devel libxml2-devel

Jul-02-21 19:20:57
Compilation

As far as I can tell you have not cloned OpenModelica recursively so you do not have the required things in some directories.

Code:


git clone https://github.com/OpenModelica/OpenModelica  --recursive

Delete OpenModelica directory and clone again from github with the line above.

Jul-02-21 13:20:08
Simulating a simple model resulting in clang error linker

I suggest you restart (to kill any process that might hold dlls or exe hostage) then uninstall OpenModelica then delete the directory, then install it again.

Jul-02-21 12:08:39
Simulating a simple model resulting in clang error linker

What version of OpenModelica do you have?

You seem to have a combination of some old OpenModelica and new OpenModelica version as I see there directory: "%OPENMODELICAHOME%\\tools\\msys\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\5.3.0"
which should NOT be there if you also have clang, it should be "%OPENMODELICAHOME%\\tools\\msys\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\10.2.0"!



I think you need to do "sudo make install" to actually install it as currently, via just "make" is just built in the OpenModelica/build directory.
I don't know what is the default prefix in the configure, but you can do:

Code:


./configure CC=clang CXX=clang++ QMAKE=/usr/bin/qmake-qt5 --with-cppruntime --prefix=/usr/
sudo make install

I need more info. Please do: make > trace.txt 2>&1
Then paste the trace.txt contents here.

I tried to compile it myself and found some small issues which are now fixed in the master.

This works for me:

Code:


sudo zypper install git-core autoconf automake clang11 gcc libexpat-devel gcc-fortran lapack libcurl-devel \
libqt5-qtbase libqt5-qtbase-devel libqt5-linguist libQt5WebKit5 libQt5WebKitWidgets-devel \
libQt5XmlPatterns5 libqt5-qtxmlpatterns-devel libqt5-qtsvg-devel readline-devel libtool \
ossp-uuid uuid-devel flex bison libboost*1_75*-devel libxml2-devel

git clone https://github.com/OpenModelica/OpenModelica.git --recursive
cd OpenModelica
./configure CC=clang CXX=clang++ QMAKE=/usr/bin/qmake-qt5 --with-cppruntime
make -j`nproc`

Have you tried to compile it from source? What are the issues?

Modelica is a quite complicated language and the Buildings library is one of the most complex libraries out there.
In general these things happen because our new frontend does not expand arrays (to be able to handle large models) and applying modifications and redeclares gets really complicated.

I will ask our frontend developer on this particular issue. Sometimes is possible to change the Modelica code to make it work, sometimes is not possible.

We are working with LBL to support as much as possible from the Buildings library but we're not at 100% yet. To check which models you can compile and simulate have a look at the coverage test we are doing each night:
https://libraries.openmodelica.org/bran … atest.html

Unfortunately the model you want, Buildings.Air.Systems.SingleZone.VAV.Examples.ChillerDXHeatingEconomizer doesn't work yet.

Jun-23-21 09:44:07
Compiler error when simulating a tank system

Nice! Victory current/smile

I'll find out why it doesn't work with mingw32-make.

Jun-23-21 06:34:14
Compiler error when simulating a tank system

Ok. I can reproduce this. Now I need to debug why it happens.

One thing you can try is to edit file:
C:/Program Files/OpenModelica1.17.0-64bit/share/omc/scripts/Compile.bat
and change all occurrences of "mingw32-make" to "make".

Jun-22-21 14:54:51
Compiler error when simulating a tank system

Strangely, I cannot reproduce this bug. Can you post the entire compilation log, not just the linking part, from the beginning?

Jun-22-21 14:11:22
Compiler error when simulating a tank system

We didn't but we updated msys2 and we use clang as compiler instead of gcc. You could try to change to gcc/g++ in OMEdit, via Tools->Options->Simulation but I have a feeling it won't help.

I will play a bit with it myself on my computer, something strange is going on.


Jun-22-21 09:25:09
Compiler error when simulating a tank system

I opened a bug report about this: https://github.com/OpenModelica/OpenMod … ssues/7598

Jun-22-21 09:08:48
Compiler error when simulating a tank system

Ah, that alone will not fix it. The problem is with this path given to the C compiler:
"-LC:/Users/ErikÅberg/AppData/Roaming/.openmodelica/binaries/Modelica"
and that comes from the place were we will install libraries when the package manager will be used and we will have a GUI for it.

In previous version including 1.16 we had OPENMODELICALIBRARY environment variable to point to the place where we had the Modelica libraries, basically:
C:\Program Files\OpenModelica1.17.0-64bit\lib\omlibrary\
From 1.17 we don't have OPENMODELICALIBRARY anymore, but is set internally to:
%APPDATA%\.openmodelica;C:\Program Files\OpenModelica1.17.0-64bit\lib\omlibrary\ which is in your case:
C:\Users\ErikÅberg\AppData\Roaming\.openmodelica\;C:\Program Files\OpenModelica1.17.0-64bit\lib\omlibrary\
and that's where this path comes from.

This is a bug, we will need to handle these paths in a better way using short names as if we have special chars in these paths make, gcc and clang will not like it.

To fix even this just define an environment variable OPENMODELICALIBRARY=C:\Program Files\OpenModelica1.17.0-64bit\lib\omlibrary\
and restart OMEdit.

Jun-22-21 08:54:39
Compiler error when simulating a tank system

You have a special character in your user name and that's on the path to %TEMP% where we generate the code and compile the executable.
It should work but somehow it doesn't. We know about this bug and we'll try to fix it.
For now, in OMEdit just go to Tools->Options->General and change Working Directory to c:\temp or something like that.

Did it work with 1.16.5 in the same setting with a user with special character?

In the AdsHeaderFile.h you have an ifdef

Code:


#if defined(_MSC_VER)

you need to change that to:

Code:


#if defined(_MSC_VER) || defined(__MINGW32__)

because we compile with GCC (__MINGW32__) and not with Visual Studio (_MSC_VER).


If you want to wrap your code as an FMU, see https://github.com/INTO-CPS-Association/unifmu

No to the code, to your user environment PATH variable. Say the directory of the DLL is:
C:\path\to\dll, edit your PATH variable and add this at the end: WhatWasThereAlready;C:\path\to\dll;

Windows 10
- In Search, search for and then select: System (Control Panel)
- Click the Advanced system settings link.
- Click Environment Variables. In the section System Variables find the PATH environment variable and select it. Click Edit.
- In the Edit System Variable window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.

You just need to put the 64bit TcAdsDll.dll in ModelicaADS\Resources\Library\win64
and OpenModelica will find it. If you have only the 32bit dll, you will need to install the
32bit OpenModelica and put the 32bit TcAdsDll.dll in ModelicaADS\Resources\Library\win32.

Note that you will need to add it to the PATH too as the generated
executable will need to find it. (This is a bug in OpenModelica, the
tool should automatically add it to the PATH).

@sjoelund yes and no, that .lib file only list the functions in the dll, is not a static library. If you have the DLL you should be able to compile the code.

Hopefully you know how to install the software that has TcAdsDll.dll because I don't.
Seems to be part of some commercial software:
https://infosys.beckhoff.com/english.ph … tm&id=

In OMEdit if you load the root package, ModelicaADS/pacakge.mo it loads the entire library, you don't need to load any subdirectories.

Wait, you only need to open ModelicaADS/package.mo, then in the left hand side tree navigate to ModelicaADS/Examples/ExampleAdsLoop then double click on ExampleAdsLoop.

https://pasteboard.co/K5VTXSa.png

Where did you put the library and how do you load it in OMEdit?

Jun-09-21 10:37:01
Simulation Process failed , Exited with Code -1

Works fine for me.

Code:


C:/temp/TestTables/TestTables.exe -port=50361 -logFormat=xmltcp -override=startTime=0,stopTime=1,stepSize=0.002,tolerance=1e-6,solver=dassl,outputFormat=mat,variableFilter=.* -r=C:/temp/TestTables/TestTables_res.mat -w -lv=LOG_STATS -inputPath=C:/temp/TestTables -outputPath=C:/temp/TestTables
... loading "tab1" from "C:/temp/Data.txt"

Code:


model TestTables
Modelica.Blocks.Sources.CombiTimeTable taba(columns = 2:3, fileName = "C:/temp/Data.txt", tableName = "tab1", tableOnFile = true);
equation
end TestTables;

What is your OS language and regionalization?

What ModelicaADS library version are you using?
Myself I got the latest master from here: https://github.com/TechnicalBuildingSystems/ModelicaADS

Jun-07-21 13:14:55
Problem in simulating FMUs using new frontend.

@sjoelund.se, we are generating the illegal code when we generate a Modelica model as a wrapper for the FMU.

I tried the example myself and I get:

Code:


C:/home/adrpo33/dev/OpenModelica/build/share/omc/scripts/Compile.bat ExampleAdsLoop gcc mingw64 parallel 8 0
PATH = "C:\OMDev\tools\msys\mingw64\bin;C:\OMDev\tools\msys\mingw64\bin\..\..\usr\bin;"
mingw32-make: Entering directory 'C:/temp/MODELI~1.EXA'
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop.o ExampleAdsLoop.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_functions.o ExampleAdsLoop_functions.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_records.o ExampleAdsLoop_records.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_01exo.o ExampleAdsLoop_01exo.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_02nls.o ExampleAdsLoop_02nls.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_03lsy.o ExampleAdsLoop_03lsy.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_04set.o ExampleAdsLoop_04set.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_05evt.o ExampleAdsLoop_05evt.c
ExampleAdsLoop_functions.c:41:14: warning: implicit declaration of function 'funAdsConstructor' is invalid in C99 [-Wimplicit-function-declaration]
  _ans_ext = funAdsConstructor(_port_ext, _AmsNetID1_ext, _AmsNetID2_ext, _AmsNetID3_ext, _AmsNetID4_ext, _AmsNetID5_ext, _AmsNetID6_ext);
             ^
ExampleAdsLoop_functions.c:73:14: warning: implicit declaration of function 'funAdsDestructor' is invalid in C99 [-Wimplicit-function-declaration]
  _ans_ext = funAdsDestructor();
             ^
ExampleAdsLoop_functions.c:94:16: warning: implicit declaration of function 'funAdsReceiveReal' is invalid in C99 [-Wimplicit-function-declaration]
  _state_ext = funAdsReceiveReal(&_recvData_ext, MMC_STRINGDATA(_varName));
               ^
ExampleAdsLoop_functions.c:118:14: warning: implicit declaration of function 'funAdsSendReal' is invalid in C99 [-Wimplicit-function-declaration]
  _ans_ext = funAdsSendReal(_sendData_ext, MMC_STRINGDATA(_varName));
             ^
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_06inz.o ExampleAdsLoop_06inz.c
4 warnings generated.
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_07dly.o ExampleAdsLoop_07dly.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_08bnd.o ExampleAdsLoop_08bnd.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_09alg.o ExampleAdsLoop_09alg.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_10asr.o ExampleAdsLoop_10asr.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_11mix.o ExampleAdsLoop_11mix.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_12jac.o ExampleAdsLoop_12jac.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_13opt.o ExampleAdsLoop_13opt.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_14lnz.o ExampleAdsLoop_14lnz.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_15syn.o ExampleAdsLoop_15syn.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_16dae.o ExampleAdsLoop_16dae.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_17inl.o ExampleAdsLoop_17inl.c
clang  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0  -c -o ExampleAdsLoop_18spd.o ExampleAdsLoop_18spd.c
clang -I. -o ExampleAdsLoop.exe ExampleAdsLoop.o ExampleAdsLoop_functions.o ExampleAdsLoop_records.o ExampleAdsLoop_01exo.o ExampleAdsLoop_02nls.o ExampleAdsLoop_03lsy.o ExampleAdsLoop_04set.o ExampleAdsLoop_05evt.o ExampleAdsLoop_06inz.o ExampleAdsLoop_07dly.o ExampleAdsLoop_08bnd.o ExampleAdsLoop_09alg.o ExampleAdsLoop_10asr.o ExampleAdsLoop_11mix.o ExampleAdsLoop_12jac.o ExampleAdsLoop_13opt.o ExampleAdsLoop_14lnz.o ExampleAdsLoop_15syn.o ExampleAdsLoop_16dae.o ExampleAdsLoop_17inl.o ExampleAdsLoop_18spd.o "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -L"C:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Examples"  "-LC:/home/adrpo33/dev/OpenModelica/build/lib//omc" "-LC:/home/adrpo33/dev/OpenModelica/build/lib/" "-LC:/Users/adrpo33/AppData/Roaming/.openmodelica/binaries/ModelicaADS" "-LC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Library/mingw64" "-LC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Library/win64" "-LC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Library" -lTcAdsDll "-LC:/Users/adrpo33/AppData/Roaming/.openmodelica/binaries/Modelica" "-Lc:/home/adrpo33/dev/OpenModelica/build/lib/omlibrary/Modelica 3.2.3/Resources/Library/mingw64" "-Lc:/home/adrpo33/dev/OpenModelica/build/lib/omlibrary/Modelica 3.2.3/Resources/Library/win64" "-Lc:/home/adrpo33/dev/OpenModelica/build/lib/omlibrary/Modelica 3.2.3/Resources/Library" -lModelicaExternalC  -Os -Wno-parentheses-equality -falign-functions -mstackrealign -msse2 -mfpmath=sse     "-IC:/home/adrpo33/dev/modelica/ModelicaADS/ModelicaADS/Resources/Include" -I"C:/home/adrpo33/dev/OpenModelica/build/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=ExampleAdsLoop -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -L"C:/home/adrpo33/dev/OpenModelica/build/lib//omc" -L"C:/home/adrpo33/dev/OpenModelica/build/lib" -Wl,--stack,16777216,-rpath,"C:/home/adrpo33/dev/OpenModelica/build/lib//omc" -Wl,-rpath,"C:/home/adrpo33/dev/OpenModelica/build/lib"  -fopenmp -Wl,-Bstatic -lregex -ltre -lintl -liconv -lexpat -lomcgc -lpthread -loleaut32 -limagehlp -lhdf5 -lz -lszip -Wl,-Bdynamic -Wl,-Bdynamic -lSimulationRuntimeC -Wl,-Bdynamic -Wl,-Bdynamic -lomcgc -lregex -ltre -lintl -liconv -lexpat -static-libgcc -luuid -loleaut32 -lole32 -limagehlp -lws2_32 -llis -lsundials_nvecserial -lsundials_sunmatrixdense -lsundials_sunmatrixsparse -lsundials_sunlinsoldense -lsundials_sunlinsolklu -lsundials_sunlinsollapackdense -lsundials_sunlinsolspbcgs -lsundials_sunlinsolspfgmr -lsundials_sunlinsolspgmr -lsundials_sunlinsolsptfqmr -lsundials_sunnonlinsolnewton -lsundials_cvode -lsundials_cvodes -lsundials_idas -lsundials_kinsol -lumfpack -lklu -lcolamd -lbtf -lamd -lsuitesparseconfig -lipopt -lcoinmumps -lpthread -lm  -lgfortran -lquadmath -lmingw32 -lgcc_eh -lmoldname -lmingwex  -luser32 -lkernel32 -ladvapi32 -lshell32 -lopenblas -lcminpack -Wl,-Bdynamic -lwsock32 -lstdc++
C:\OMDev\tools\msys\mingw64\bin\ld: cannot find -lTcAdsDll
clang: error: linker command failed with exit code 1 (use -v to see invocation)
mingw32-make: *** [ExampleAdsLoop.makefile:37: omc_main_target] Error 1
mingw32-make: Leaving directory 'C:/temp/MODELI~1.EXA'
Compilation process failed. Exited with code 0x00000002.

So the compilation works fine but I'm missing the TcAdsDLL.dll, I guess that comes from some other source.

I have looked in the library and it does contain the correct IncludeDirectory annotations.
Can you post the entire compilation log here?

The library should have an IncludeDirectory annotation for the external function which points inside the Modelica library, something like:
annotation(IncludeDirectory="modelica://ModelicaADS/Resources/Include")
See: https://specification.modelica.org/main … lude-files
which tells the tool what includes to give to the C compiler. I guess the library is missing this.

Seems we have issues copying the resource from the library inside the FMU. Looks like the path might be to long.
I suggest you change the OMEdit working directory from Tools->Options->General to something short like c:\omworkdir.
Then restart OMEdit and try again.

May-11-21 08:48:41
Process Crached
Category: Programming

What version of OpenModelica do you have? Works fine for me with the nightly-builds.
Does this happen for any model you try to simulate? Try MSL examples.

Looking for the error with Google:
https://www.google.com/search?q=%22-1073741819%22
seems you get File System Error which means you cannot
run the executable, or you don't have the permission to run it.
OpenModelica will generate C code, compile that C code to
an executable Model.exe and then run that to produce the
simulation results. It seems you have issues when running
Model.exe

It could be that you are not allowed to run things in the Temp
directory. You can change that via:
OMEdit->Tools->Options->General->Working Directory
Put there something like:
C:\OMWorkingDirectory
Restart OMEdit and try to simulate your model again.

May-10-21 18:13:56
Process Crached
Category: Programming

Without seeing the code that would be hard.

Does your model have external code like a DLL that it needs?

When you write:

Code:


Real T(start=T0, fixed=true);

It means that T has start value T0 at initialization. You cannot change that T0 in a for loop. If you have a for lopp in an algorithm or equation section that cannot affect the initialization anymore. Only start=value or initial algorithm or initial equation section can affect the initialization problem.

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

Apr-15-21 12:13:50
Cannot import and use Modelica.Units.SI

I forgot to ask, what OpenModelica version do you have?

Apr-15-21 12:11:15
Cannot import and use Modelica.Units.SI

Change line:

Code:


annotation(uses(Modelica(version="3.2.3")));

To:

Code:


annotation(uses(Modelica(version="4.0.0")));

If you want to use Modelica 4.0.0.

Apr-13-21 21:42:08
Function has more than one algorithm section or external declaration
Category: Programming

Modelica Spec says a function can have only one algorithm section.

https://specification.modelica.org/main … -functions
"• A function can have at most one algorithm section or one external function interface (not both), which, if present, is the body of the function."

In your case you inherited a second (empty) algorithm section.

Apr-13-21 20:58:51
Function has more than one algorithm section or external declaration
Category: Programming

Is there an algorithm section in BaseClasses.Capacity_partial?

Sorry, I didn't yet had time to look at them. I will try to look into this asap.

As far as I know we do have WITH_OSG on by default so it seems to be some configure issue when detecting how to use osg + qt.
Search in OMEdit/config.log for OSG and see where it fails to use OSG. There should be some compilation tries with OSG and one of them is failing.

No bother. Without seeing more of your model is impossible to tell why you get a warning about the redundant equations.
If your model simulate fine even with the warning then just ignore it.

If you can share your model with us we could probably tell you what is wrong.
You can send it via email to OpenModelica @ ida.liu.se and we will have a look
and then delete it after we found the problem. If you cannot send the model then
have a look at the declarations of components:
  a.Postiprenotabili, a.prenotabili0, a.PostiPrenotati, a.prenotati0, g.capienza, g.cap0
and see if they have a start value an what fixed attribute is set to and their use in initial
equation sections.

What Linux distro do you have?

If you do this:

Code:


  Boolean w(start = false, fixed = false);
initial equation
  w = false; // this is overspecified as you already have (start=false).

Then the compiler will detect that w is (fixed=true) during initialization as it has an equation with a constant value.

Basically:

Code:


  Boolean w(start = false, fixed = false);

is equivalent to:

Code:


  Boolean w(fixed = false);
initial equation
  w = false;

You should use x(fixed = false) only if you need to calculate "x" during initialization from the values of other variables, i.e.

Code:


Boolean x(fixed = false);
initial equation
  x = y and b;

Basically in your case I would do:

Code:


  Boolean w(start = false, fixed = true);

and remove the initial equation w = false;

You can read more here:
https://specification.modelica.org/main … -algorithm

Is not "m.w" that is set as "true" is its "fixed" attribute that is set to true. Which means it cannot change during initialization.

For example

Code:


// non fixed parameter, can change during initialization, starts at 1 but if the solver can find a better value from the other equations it will use that one.
parameter Real a(start = 1, fixed = false);
// fixed parameter, it will fixed during initialization, basically equivalent to: parameter Real a = 1;
parameter Real a(start = 1, fixed = true);

In OMEdit go Tools->Options->Simulation->Additional Translation Flags: -d=initialization
It seems we forgot to change the warning text after we changed the name of the label in OMEdit, I'll fix it.

There are several options:

Code:


omc -d=initialization run.mos

or in your script run.mos add it as the first line:

Code:


// --- start run.mos script
setCommandLineOptions("-d=initialization"); getErrorString();
// ...
// --- end run.mos script

This is not posibile yet. We are working on implementing it.

Apr-06-21 07:32:56
Calling an external function in C from modelica
Category: Programming

This seems like a bug, what version of OpenModelica are you using?
Are you using the new or the old front-end?
Are you compiling in OMEdit or via command line?

Apr-05-21 18:16:27
Building 1.14.x on a Linux Mint 20

Don't bother, I tried building this myself on Linux Mint 20.1 and found and issue. SuiteSparse has issues when linking, is missing -lm.

Please take the attached patch and patch the SuiteSparse cmake files.
SuiteSparse.zip
Download and unzip the SuiteSparse.patch and place it in OpenModelica/OMCompiler/3rdParty

Code:


cd ~/OpenModelica/OMCompiler/3rdParty
# patch SuiteSparse
patch < SuiteSparse.patch
# clean 3rdParty
git clean -fdx
# return to top OpenModelica directory
cd ~/OpenModelica/
make -j4

Let me know if this works.


Apr-04-21 19:20:24
Building 1.14.x on a Linux Mint 20

Ok, I need some more info.

Code:


# clean third party
cd ~/OpenModelica/OMCompiler/3rdParty
git clean -fdx
# build with trace
cd ~/OpenModelica/
make -j4 > trace.txt 2>&1

Then paste here the trace.txt.
kinsol is build from source in 3rdParty: OMCompiler\3rdParty\sundials
As far as I can tell sundials can't detect SuiteSparse build but I need the trace.txt to see exactly what the issue is.

Apr-02-21 14:47:35
Building 1.14.x on a Linux Mint 20

Why do you need 1.14.x? 1.17.0 is way better current/smile

First you need to install git:
https://linuxhint.com/install-git-linux-mint/

Then you need to install the OpenModelica dependencies

Code:


for deb in deb deb-src; do echo "$deb http://build.openmodelica.org/apt `lsb_release -cs` nightly"; done | sudo tee /etc/apt/sources.list.d/openmodelica.list
wget -q http://build.openmodelica.org/apt/openmodelica.asc -O- | sudo apt-key add -
sudo apt update
sudo apt build-dep openmodelica

Then you need to clone the OpenModelica repository and checkout that specific version:

Code:


cd ~
git clone https://github.com/OpenModelica/OpenModelica.git --recursive
cd OpenModelica
git checkout v1.14.2
git submodule update --force --init --recursive

Then you configure OpenModelica

Code:


cd ~/OpenModelica
autoconf
./configure

Then you build the compiler and OMEdit:

Code:


cd ~/OpenModelica
# where NN is the number of cores your computer has
# if you have 4 cores write -j4 below
make -jNN

If all is fine you should have OpenModelica omc and OMEdit compiler in: ~/OpenModelica/build/
"~" is your home directory.

Then you need to install some Modelica libraries:

Code:


for PKG in `apt-cache search "omlib-.*" | cut -d" " -f1`; do sudo apt-get install -y "$PKG"; done

Then just start OMEdit in the terminal via:

Code:


~/OpenModelica/build/bin/OMEdit

Mar-31-21 10:46:48
I try to follow...
Category: Developer

There you can give targets to make or variables to consider when building. Just leave it empty (press Enter) if you just want to build the OpenModelica compiler (omc).
If you have more CPU cores, write -jNumberOfCores, so if you have 4 write -j4. The compilation will be faster if you have more cores. Write omedit in there if you want to build OMEdit.

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

You almost got it current/smile

Code:


model sample1
  parameter Real x[5] = 1:5; //So this line should create a file column 1 row array. from 1,2,3,4,5
  parameter Real p=5;
  Real y[5]; // here i am telling OpenModelica that this y-array is also 5 columns wide
  Real z;
equation
  y = p * x; // here i should multiply the array by the the real value, unfortunatelly this is not happening, in fact the code is not working it all.
  z = sum(y); //here i should be able to add the all of the columns of y-array to get my sum.
end sample1;

Mar-25-21 10:59:27
How to have choice between two models in modelica

Code:


package TestChoices

model M1
  parameter Real T ;
  Real f;
equation
  f = 1. + time;
end M1;

model M2
  parameter Real T ;
  Real f;
equation
  f = 2. + time;
end M2;

model fullmodel
  parameter Integer I = 1;
  parameter Real x = 5. ;
  Real y ;
  M1 m1;
  M2 m2;
//
equation

if 1 == I then
  y = m1.f;
elseif  1 == 2  then
y = m2.f;
end if;

end fullmodel;

  model Essai
   fullmodel full2(I = 2, x = 2.5)  annotation(
      Placement(visible = true, transformation(origin = {-20, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  equation

  end Essai;


end TestChoices;

Not sure what you need, if it is an if equation or a when equation.
You can also use conditional components but that is a bit more
involved as you need connectors and connects to handle the
various choices:
https://specification.modelica.org/main … eclaration
https://mbe.modelica.university/compone … nt_models/

Mar-23-21 08:57:19
I try to follow...
Category: Developer

Note that OMDev repository from the SVN is old, you need the new one form GIT: https://openmodelica.org/git/OMDev.git

Read here how to clone the repository:
https://github.com/OpenModelica/OpenMod … v-MINGW.md

There is some work ongoing to fix ExternalMedia to work with OpenModelica:
https://github.com/modelica-3rdparty/Ex … .3.3.0-dev
Myself I managed to compile the C library but I haven't tested if anything works:
https://build.openmodelica.org/omc/Mode … 03.2.1.zip
I will do some testing later on with this.

However, about the Hydrogen-Fuelling-Station library, seems it not working even in Dymola:

Code:


For equation
if (pressureLoss.Vdot <> 0) then
pressureLoss.ReynoldsNumber = pressureLoss.d_in*abs(pressureLoss.Vdot/ pressureLoss.A)*pressureLoss.Diameter/pressureLoss.mu_in;
else
pressureLoss.ReynoldsNumber = 1;
end if;
found in class HydrogenFuelingStationLibrary.PressureLosses.PressureLoss, C:/home/adrpo33/dev/modelica/Hydrogen-Fuelling-Station/HydrogenFuelingStationLibrary.mo at line 3153, and used in component pressureLoss.

The DAE has 337 scalar unknowns and 337 scalar equations.

The initial conditions are not fully specified.
Dymola has selected default initial conditions.

Assuming fixed default start value for the continuous states:
compressor.E_D(start = 0.0)
compressor.EA(start = 0.0)
compressor.EB(start = 0.0)
compressor.W(start = 0.0)
heatExchangerFixedTemperature.EA(start = 0.0)
heatExchangerFixedTemperature.EB(start = 0.0)
heatExchangerFixedTemperature.EQ(start = 0.0)
heatExchangerFixedTemperature.EQ1(start = 0.0)
heatExchangerFixedTemperature.EQ2(start = 0.0)
heatExchangerFixedTemperature.Q(start = 0.0)
heatExchangerFixedTemperature.Q1(start = 0.0)
heatExchangerFixedTemperature.Q2(start = 0.0)
pressureLoss.E_D(start = 0.0)
pressureLoss.EA(start = 0.0)
pressureLoss.EB(start = 0.0)
tank1_1.E_stream(start = 0.0)
tank1_1.E_tank(start = 0.0)
tank1_1.Q(start = 0.0)
tank1_2.E_stream(start = 0.0)
tank1_2.E_tank(start = 0.0)
tank1_2.Q(start = 0.0)

Statistics

Selected continuous time states

Some variables are iteration variables of the initialization problem:
but they are not given any explicit start values. Zero will be used.

Iteration variables:
compressor.mediumB.phase
compressor.mediumIS.phase
heatExchangerFixedTemperature.mediumA.h
heatExchangerFixedTemperature.mediumA.phase
heatExchangerFixedTemperature.mediumB.phase
pressureLoss.medium1.phase
pressureLoss.medium2.phase

Error detected when generating code.

Translation aborted.

WARNINGS have been issued.

Which model are you trying to run?

Mar-10-21 09:38:33
version recommended for 32-bit FMI using OMEdit (MSL 3.2.3.)

I assume you're on Windows. If you don't manage with docker then the easiest is to install the 32bit OpenModelica and use that.
We should be able to compile a 32bit version from the 64bit OpenModelica but we haven't implemented that yet.

Mar-08-21 14:41:13
Fluid library to complicated for OMC?
Mar-08-21 14:35:13
Fluid library to complicated for OMC?

This seems like a bug. Compiling this with the new front-end gets you:

Code:


[1] 14:52:43 Symbolic Warning
The model contains alias variables with redundant start and/or conflicting nominal values. It is recommended to resolve the conflicts, because otherwise the system could be hard to solve. To print the conflicting alias sets and the chosen candidates please use -d=aliasConflicts.

[2] 14:52:43 Translation Error
Jacobian StateSetJac0 contains non-linear components. This indicates a singular system or internal generation errors.

This is the errors you're getting when compiling? Also there are some errors during simulation:

Code:


C:/temp/FluidTest/FluidTest.exe -port=56775 -logFormat=xmltcp -override=startTime=0,stopTime=1,stepSize=0.002,tolerance=1e-6,solver=dassl,outputFormat=mat,variableFilter=.* -r=C:/temp/FluidTest/FluidTest_res.mat -w -lv=LOG_STATS -inputPath=C:/temp/FluidTest -outputPath=C:/temp/FluidTest
Matrix singular!
The initialization finished successfully with 3 homotopy steps.
Error solving nonlinear system 260 at time 0.366001
Error solving nonlinear system 260 at time 0.366001
nonlinear system 260 fails: at t=0.366001
[1] Real pid.limiter.u(start=0, nominal=1)
[2] Real pump.medium.p(start=160000, nominal=100000)
[3] Real pump.s(start=0, nominal=1)
Simulation process failed. Exited with code -1.

The old frontend seems to simulate this fine. I will make a bug report with this.

The Cpp runtime generates just a json file it seems with the profiling.

You could use the C runtime

Code:


adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OpenModelica/build/bin/temp
# cat t.mos
setCommandLineOptions("--profiling=blocks+html"); getErrorString();
loadModel(Modelica, {"3.2.3"}); getErrorString();
buildModel(Modelica.Blocks.Examples.PID_Controller); getErrorString();

adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OpenModelica/build/bin/temp
# ../omc t.mos
true
""
true
{"C:/home/adrpo33/dev/OpenModelica/build/bin/temp/Modelica.Blocks.Examples.PID_Controller","Modelica.Blocks.Examples.PID_Controller_init.xml"}
""

adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OpenModelica/build/bin/temp
# ./Modelica.Blocks.Examples.PID_Controller.exe
LOG_SUCCESS       | info    | The initialization finished successfully with 3 homotopy steps.
LOG_SUCCESS       | info    | The simulation finished successfully.
stdout            | info    | Time measurements are stored in Modelica.Blocks.Examples.PID_Controller_prof.html (human-readable) and Modelica.Blocks.Examples.PID_Controller_prof.xml (for XSL transforms or more details)

Then open Modelica.Blocks.Examples.PID_Controller_prof.html in the browser.

After you run the executable an html report should be generated, at least this is what happens using the C runtime. I will check now with Cpp runtime and let you know.

Mar-02-21 11:16:55
Failed to open file (null)/BouncingBall_info.json for reading: No such file or directory
Category: Developer

You need to unpack the FMU at a certain location and set the resource folder.

See the spec:
https://github.com/modelica/fmi-standar … -2.0.2.pdf

Code:


fmi2Component fmi2Instantiate(fmi2String instanceName,
fmi2Type fmuType,
fmi2String fmuGUID,
fmi2String fmuResourceLocation,    // <----- this needs to point to the place where you unpacked the FMU
const fmi2CallbackFunctions* functions,
fmi2Boolean visible,
fmi2Boolean loggingOn);

You need to unpack the fmu to a directory and then give that directory as an URI via the fmuResourceLocation parameter when you call fmi2Instantiate.

Or you could use an existing C library that can load your FMU properly such as FMILIB: https://github.com/modelon-community/fmi-library

Mar-02-21 08:50:49
How do install the olders versions?

What examples do not work in current version and work in 1.9.5?

If you look here in our coverage testing:
https://libraries.openmodelica.org/bran … rview.html
1.9.x versions can simulate way less examples than master (or 1.16).

If you still want 1.9.5 you can have a look here:
https://openmodelica.org/download/download-linux
"Install Older Releases"

Code:


deb https://build.openmodelica.org/omc/builds/linux/releases/1.9.5/

I am rebuilding 1.17.0-dev.beta2 on Windows now, seems to have been a glitch in the upload or the installer build. I will try to do a md5 checksum before the upload and then after to see if there was any issue during upload.

You can use the nightly-build until we build the ones I talked about above.

You hit this bug:
https://trac.openmodelica.org/OpenModelica/ticket/6394
We will make a 1.16.5 and 1.17.0-dev.beta2 asap.

Feb-24-21 10:43:08
Category: Programming

Paste your image to https://pasteboard.co/ and link it here.

Feb-23-21 18:35:28
Category: Developer

Thanks for reporting this. Is my fault. I tagged 1.16.4 but forgot to change the version number in the Windows install script. I'll fix it.
You can use the 1.16.4 even if is reported as 1.16.3.

I would suggest to use 1.17 (or nightly) to work with MSL 4.0.0.
We are in the process of handling the switch, see the discussion here:
https://trac.openmodelica.org/OpenModelica/ticket/6379
https://github.com/OpenModelica/OpenModelica/pull/7211

The full switch to MSL4.0.0 with conversion scripts will happen in 1.18
but you can already work with MSL 4.0.0 using 1.17 or master (nightly).




OMOptim doesn't really work in the latest releases. I think the last release in which it did work was 1.10 or 1.11. You could try those
We don't have the resources to fix it yet, hopefully we'll do in the future.

Which version are you using? If is 1.16.2 then you have found this bug:
https://trac.openmodelica.org/OpenModelica/ticket/6307
I would suggest to use 1.16.1.

See the debug flags here:
https://www.openmodelica.org/doc/OpenMo … ug-section
I guess you use this one:
https://www.openmodelica.org/doc/OpenMo … tialsystem
Just go to OMEdit->Tools->Options->Simulation: Additional translation flags: -d=initializtion,dumpinitialsystem

That is the correct location. Point your Eclipse to it and it will work. See this document:
https://trac.openmodelica.org/documents … ingMDT.pdf

You need to copy-paste your model in here.

Jan-14-21 15:30:13
Problem with initialisation of the values of an array

Then use an initial algorithm section:

Code:


initial algorithm // only called at initialization
  // in algorithm sections the order is kept and these are assignments
  // fill everything with zero
  nu_aq := fill(0,nbr_reaction, nbr_espece_aq);
  // set some elements to some other values
  nu_aq[1,1] := -1 ;
  nu_aq[1,2] := -1 ;
equation
  ...

Jan-14-21 12:59:32
Problem with initialisation of the values of an array

You really need to learn more about Modelica, see a tutorial: https://openmodelica.org/images/M_image … OD2020.pdf
or an online book: http://mbe.modelica.university/

You need to do it in an "initial equation" section or using (start=value) for the component if you want the array to have certain values at initialization.
Note that fill(0,nbr_reaction, nbr_espece_aq) is a binding equation for the array.

Code:


model Test
  parameter Integer nbr_reaction = 3;
  parameter Integer nbr_espece_aq = 7;
  Integer nu_aq[nbr_reaction, nbr_espece_aq] = fill(0,nbr_reaction, nbr_espece_aq);
initial equation
  nu_aq[1,1] = -1 ;
  nu_aq[1,2] = -1 ;
end Test;

Code:


model Test
  parameter Integer nbr_reaction = 3;
  parameter Integer nbr_espece_aq = 7;
  Integer nu_aq[nbr_reaction, nbr_espece_aq](each start = -1);
equation
  ....
end Test;

Dec-24-20 15:03:14
tested Linux models fail on Windows 64bit version

I think you are hitting this bug:
https://trac.openmodelica.org/OpenModelica/ticket/6099
that is fixed in OpenModelica 1.17.0 (master).

You can use the latest nightly build from here:
https://build.openmodelica.org/omc/buil … ly-builds/

If you are already using the latest master then is some other issue, let me know.

Dec-23-20 23:59:45
Some graphical objects have no more visible port B connector

Thanks for reporting this. It seems to be a new bug introduced in 1.16.2 and master.
It has been reported here (I guess by you):
https://trac.openmodelica.org/OpenModelica/ticket/6310
and here:
https://github.com/OpenModelica/OpenMod … ssues/7060
https://trac.openmodelica.org/OpenModelica/ticket/6307

I'll try to fix it as soon as possible.

Dec-19-20 23:53:06
I am trying to simulate an OpenModelica example model using ModelicaSystem python module. But I...

You always load the full Modelica library via loadModel(Modelica), you cannot load parts of it.

Seems the ModelicaSystem interface needs a file as the first argument, that is weird, it should not be need in some cases.
You can just do like this:

Code:


model_path = omc.sendExpression("getInstallationDirectoryPath()") + "/share/doc/omc/testmodels/"
mod = ModelicaSystem(model_path + "HelloWorld.mo","Modelica.Electrical.Machines.Examples.AsynchronousInductionMachines.AIMC_Inverter",["Modelica"]);

Basically load HelloWorld.mo but don't use it and also request Modelica library to be loaded (3rd argument).

It should work also with installPackage, try:

Code:


installPackage(ModelicaReference);
getErrorString();

to also display what the error was.

Ah, you have Linux from the form of MODELICAPATH.
I guess you need to do this: https://openmodelica.org/download/download-linux

Code:


for PKG in `apt-cache search "omlib-.*" | cut -d" " -f1`; do sudo apt-get install -y "$PKG"; done

to install the Modelica libraries.

What OM version do you have? What operating system are you running on?

Nov-30-20 19:29:29
I would like to translate OpenModelica User's guide into Japanese.

Should be no problem to translate it. The only problem might be the GPL v3 license which is not that suitable for the documentation.

The OSMC board has decided last year that the license for the documentation should be the creative-commons license, with attribution requirement:
https://creativecommons.org/licenses/by/4.0/
but we didn't had time to update it.

I guess it should be OK if you use the same license CC BY 4 for the translated documentation.

Sorry. This happens sometimes as unfortunately we are not modelers and you seem to have an issue with modeling.

You might get some answers about the modeling issues if you ask the question on:
https://stackoverflow.com/questions/tagged/modelica
or Discord:
https://discord.gg/yVPckG5N

Your description of the problem is rather vague. You seem to also have some FMUs in your model.
Are you simulating with OMSimulator? With OpenModelica? What version? I guess your OS is Windows but I'm not sure.

Can you send us your model so we can debug with it? If is not public you can send it to us via email at OpenModelica@ida.liu.se.

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

I remember when I tried to compile OMEdit with qtcreator you need to set a lot of paths and stuff. Hopefully @adeas31 can answer this.

Nov-17-20 08:50:31
Compile OMedit in QT
Category: Developer

That is just a notice. See ticket:
https://trac.openmodelica.org/OpenModelica/ticket/6179

Nov-14-20 14:27:33
Compilation problems
Category: Developer

I need more info. Do:

Code:


make -f Makefile.omdev.mingw > trace.txt 2>&1

then paste the trace.txt file here.

Nov-10-20 12:19:54
How to build omedit on windos?
Category: Developer
Nov-06-20 15:51:27
Is it possible to get the name and type or the annotation of a class variable

For getElements you also get locally declared classes that are replaceable.

Nov-06-20 14:00:33
Is it possible to get the name and type or the annotation of a class variable

What you want is:

Code:

getComponents(Some.ModelicalPath.Here);

or

Code:

getElements(Modelica.Blocks.Examples.PID_Controller, useQuotes = true);

{{"co", "-", "Modelica.SIunits.Angle", "driveAngle", "Reference distance to move", "public", "false", "false", "false", "false", "parameter", "none", "unspecified", "$Any", "{}"},{"co", "-", "Modelica.Blocks.Continuous.LimPID", "PI", "", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified", "$Any", "{}"},{"co", "-", "Modelica.Mechanics.Rotational.Components.Inertia", "inertia1", "", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified", "$Any", "{}"},{"co", "-", "Modelica.Mechanics.Rotational.Sources.Torque", "torque", "", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified", "$Any", "{}"},{"co", "-", "Modelica.Mechanics.Rotational.Components.SpringDamper", "spring", "", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified", "$Any", "{}"},{"co", "-", "Modelica.Mechanics.Rotational.Components.Inertia", "inertia2", "", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified", "$Any", "{}"},{"co", "-", "Modelica.Blocks.Sources.KinematicPTP", "kinematicPTP", "", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified", "$Any", "{}"},{"co", "-", "Modelica.Blocks.Continuous.Integrator", "integrator", "", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified", "$Any", "{}"},{"co", "-", "Modelica.Mechanics.Rotational.Sensors.SpeedSensor", "speedSensor", "", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified", "$Any", "{}"},{"co", "-", "Modelica.Mechanics.Rotational.Sources.ConstantTorque", "loadTorque", "", "public", "false", "false", "false", "false", "unspecified", "none", "unspecified", "$Any", "{}"}}

To see what this all means you can look at how we parse it.
This is how we parse the result of getComponents:
https://github.com/OpenModelica/OpenMod … t.cpp#L156
This is how we parse the result of getElements:
https://github.com/OpenModelica/OpenMod … t.cpp#L249

For Icon or Diagram annotations use getIconAnnotation and getDiagramAnnotation.

For any other annotations use:

Code:

getComponentAnnotations(Modelica.Blocks.Examples.PID_Controller);

Code:

getElementAnnotations(Modelica.Blocks.Examples.PID_Controller);

{{},{Placement(true,-,-,-56.0,-20.0,-36.0,0.0,-,-,-,-,-,-,-,)},{Placement(true,-,-,2.0,-20.0,22.0,0.0,-,-,-,-,-,-,-,)},{Placement(true,-,-,-25.0,-20.0,-5.0,0.0,-,-,-,-,-,-,-,)},{Placement(true,-,-,32.0,-20.0,52.0,0.0,-,-,-,-,-,-,-,)},{Placement(true,-,-,60.0,-20.0,80.0,0.0,-,-,-,-,-,-,-,)},{Placement(true,-,-,-92.0,20.0,-72.0,40.0,-,-,-,-,-,-,-,)},{Placement(true,-,-,-63.0,20.0,-43.0,40.0,-,-,-,-,-,-,-,)},{Placement(true,-,-,22.0,-50.0,2.0,-30.0,-,-,-,-,-,-,-,)},{Placement(true,-,-,98.0,-15.0,88.0,-5.0,-,-,-,-,-,-,-,)}}

See in Windows: %TMP%\OpenModelica\OMEdit\omeditcommunication.log what kind of API calls you can make. In Linux is /tmp/user/OpenModelica/....
Some of them ar documented here:
https://build.openmodelica.org/Document … pting.html

Good luck!

Strangely it seems is not possible to send arguments to convertMo2Fmu. There is a bug report about it here:
https://trac.openmodelica.org/OpenModelica/ticket/6084
I guess that one is from you as well.

The "easy fix" until we properly fix it is to:
1. First make a copy of C:\Program Files\OpenModelica1.16.0-64bit\lib\omc\*.mo files someplace else.
2. Edit:
C:\Program Files\OpenModelica1.16.0-64bit\lib\omc\ModelicaBuiltin.mo
and
C:\Program Files\OpenModelica1.16.0-64bit\lib\omc\NFModelicaBuiltin.mo
locate translateModelFMU Modelica function in there and make the line:

Code:


input String fmuType = "me"

into:

Code:


input String fmuType = "cs" // or "cs_me"

Then when you call convertMo2Fmu with no arguments it will build you a "cs" or "cs_me" FMU.

We don't support serialization of state yet in our exported FMUs.

Can you just do all the analysis after the call to ModelicaSystem? That way it will only be compiled once.
I will open a ticket for OMPython to have a flag for ModelicaSystem to just build if needed.

Sep-06-20 14:49:12
I have difficulty in importing this library into OM.

These are just warnings, what happens if you try to run a model from the library?
Which models do you need working for your research?

You can also use .mol (is a zip file), export the library as that. "Export" -> Read-only Package - Exports a zipped Modelica library with file extension .mol
https://openmodelica.org/doc/OpenModeli … #file-menu
If you load .mol in OMEdit they will be read only.

Jul-27-20 19:07:51
Running simulation within IDE that load DLL requiring special environment variables

Currently is not possible but it seems to be an easy addition to OMEdit.
Well, it is possible but you need to manually write or paste stuff in the OpenModelica CLI in OMEdit.
Would be nice to have "Pre simulation script" and "Post simulation script" in which advanced users can write anything they want.

Also, it seems calling
> OMEdit Result.mat
will not open the result file in the plotting perspective.

I'll open some tickets about these and we'll implement them.

Jul-27-20 15:24:43
Running simulation within IDE that load DLL requiring special environment variables

You can use these functions in a .mos script:
https://build.openmodelica.org/Document … ntVar.html
https://build.openmodelica.org/Document … ntVar.html

Code:


// -- script.mos
// save PATH
savedPath := getEnvironmentVar("PATH"); getErrorString();
// set PATH, note that the path separator is ";" in Windows and ":" in Linux
setEnvironmentVar("PATH", savedPath + "some;other:paths:here"); getErrorString();
// simulate
simulate(SHCControls.TSModel.Test); getErrorString();
// set back the PATH
setEnvironmentVar("PATH", savedPath); getErrorString();
// -- end script.mos

Then you just do omc script.mos
Of course, you would need to load you library via loadModel(Lib); or loadFile("Lib/package.mo"); before simulating the model.

See other scripting command here:
https://build.openmodelica.org/Document … pting.html




Jul-17-20 14:58:15
Using ida for the integration method and totalpivot for the linear solver

You can tell OMEdit to save the simulation settings inside the model. When you have the model opened press "S" on the tool bar for Simulation Setup and down below you have: "Save simulation flags inside model", you can click that.

You can also manually use:

Code:


annotation(__OpenModelica_simulationFlags("-s=ida -ls=totalpivot"));

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

Jul-17-20 14:49:32
Found a component with same name when looking for type %

The problem is that you have a model with name "lineNew" and a component with the same name "lineNew". Change model lineNew to "model LineNew ... end LineNew". Modelica doesn't like the name of the types to be the same as the name of the variable so:
As a convention start model/types names with big letter and variables with small letter to avoid this problem

Code:


typeName typeName; // this is wrong
TypeName typeName; //this is fine

Jul-08-20 18:23:33
'simulate" command creates many build files in working directory
Category: Programming

You can just do:

Code:


mkdir("tmpdir1"); cd("tmpdir1");
simulate(Model);
cd(".."); remove("tmpdir1");

Alternative you can use filename prefix to generate these file with a specific name that you can easily delete later.

Code:


stimulate(Model, filenamePrefix="tmpFile");
system("rm tmpFile*");

How does your Modelica function that calls the C looks like?
Did you give the library name via the external annotation?

You cannot have IF in the component section in a Modelica model (well, except for conditional components). You can only use if inside equations. However, what you want can be done via if expressions:

Code:


parameter Real A;
Real y1(start=if A ==1 then 0.2 else 2.2),
         y2(start=if A ==1 then 3.5 else 1.5),
         y3(start=if A ==1 then 0.5 else 0.3);

Jun-10-20 15:34:57
OMEdit quits upon startup splash screen after "creating widgets" stage

Sorry, my mistake in the email, it should be %TEMP%\OpenModelica\OMEdit\

If you write %TEMP% in Windows Explorer you should get to a directory like: C:\Users\USER_NAME\AppData\Local\Temp
and then navigate to OpenModelica\OMEdit\ and see what files are there. Zip that entire directory and send the zip to us
via email to OpenModelica or directly to me.

You can skip the initialization even now via -iif=initial_file.mat and -iim=none and -iit=initTime (if you need that):
https://www.openmodelica.org/doc/OpenMo … flags.html

It seems that currently, the only way to properly get the initial values is LOG_SOTI.
If you simulate to stopTime=0 *and* you have events at time zero the initial values will change.

I will open a ticket about it to add a new flag, something like "-iof=file.csv" that one can use to dump the initial values instead of relying on LOG_SOTI.

I guess you can simulate with stopTime=0.0 and with format "csv" you will get the initial values.
I'll ask one of our runtime developers if there is another way.

Works fine for me with -overideFile=c:/dev/o.txt
Note that OMEdit is strange and will display in the variable browser the value 2 for b, but click on it and the graph will show 10!
OMEdit takes the value from the Model_init.xml file, which is what is loaded and set before doing the override.

Code:


C:/temp/TestOverride/TestOverride.exe -port=64260 -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_STATS
-overrideFile=c:/dev/o.txt
-inputPath=C:/temp/TestOverride -outputPath=C:/temp/TestOverride

See:
https://pasteboard.co/Jbqs9zW.png

I think it exits because you need the latest nightly, before the simulation executable didn't run if you used both -override and -overrideFile.

Also, I strongly suggest you use the nightly builds 1.16 as we will do a release from it soon.
Version 1.15 will be discontinued and we will move directly to 1.16.
I just had a look now and it seem we didn't even ported the fix in #5696 to 1.15.

I get it. It should work with simulation flags for the simulation executable.
The problem is that OMEdit is already using -override to override some of the flags, you can see this in simulation window:

Code:


C:/temp/Modelica.Blocks.Examples.PID_Controller/Modelica.Blocks.Examples.PID_Controller.exe
-port=55479 -logFormat=xmltcp
-override=startTime=0,stopTime=4,stepSize=0.008,tolerance=1e-06,solver=dassl,outputFormat=mat,variableFilter=.*
-r=C:/temp/Modelica.Blocks.Examples.PID_Controller/Modelica.Blocks.Examples.PID_Controller_res.mat
-w -lv=LOG_STATS -inputPath=C:/temp/Modelica.Blocks.Examples.PID_Controller
-outputPath=C:/temp/Modelica.Blocks.Examples.PID_Controller

Your problem is that we don't allow several override flags for the executable, just one.
Is on my TODO list to allow it, I will open a ticket about this.

We however do allow both -override and -overrideFile so for now you can use the -overrideFile=c:/path/to/override_file.txt
See: https://trac.openmodelica.org/OpenModelica/ticket/5696


In OMEdit, to resimulate you don't need to do any of that, is done automatically.

After first simulation, in the Plotting perspective, in the Variable Browser on the right hand side change
any of the parameters you want using the edit box, then right click on the top of the tree, the name of the
model and say Resimulate.

Is this command line? Or via OMEdit?

Is not possible yet.
I'm working on getting my support for redeclares in so that you can change those as well.
Hopefully should be available later this week in the nightly builds.

May-31-20 14:36:41
Error when trying to link OSG debug libraries even if installed
Category: Developer

Just edit: OpenModelica\OMEdit\OMEditGUI\OMEditGUI.win.config.pri and change the osg libs to the ones not using "d" at the end:

These:

Code:


LIBS += -llibosgd.dll -llibosgViewerd.dll -llibOpenThreadsd.dll -llibosgDBd.dll -llibosgGAd.dll

to these:

Code:


LIBS += -llibosg.dll -llibosgViewer.dll -llibOpenThreads.dll -llibosgDB.dll -llibosgGA.dll

I guess you don't need to debug the OSG part in OMEdit (3D visualization).

May-26-20 18:56:45
I can't make it work.
Category: Workshops

It might already be fixed in the new MUMPS, what we include in OpenModelica is an older version. You can check if the new one works to build and if it doesn't, then report a bug.

May-26-20 14:26:10
Erreur de Simulation basée sur FMI

From what i could translate using google I think this is your problem:

The new front-end which is the default does not allow to use reinit in algorithms as that is conform with the Modelica specification.
You can select to use the old front-end before you import the FMU: Options->Tools->Simulation->Enable old frontend for code generation.

May-24-20 21:47:25
I can't make it work.
Category: Workshops

According to the gcc 10.1 page:
https://gcc.gnu.org/gcc-10/porting_to.html
it might work if you configure with:

Code:


/configure FC="gfortran --std=legacy" --with-cppruntime

to force gfortran 10 to work as previous versions.

May-24-20 21:32:04
I can't make it work.
Category: Workshops

We are not testing so high version of gfortran / gcc. The highest version we test is gfortran / gcc 9.3.0 on Ubuntu 20.04.
It seem that there are some issues with it.

You could maybe try to configure with an older gfortran via:

Code:


./configure FC=gfortran-9.3.0 --with-cppruntime

if you have an older gfortran available until they fix this in mumps.

May-24-20 11:51:08
I can't make it work.
Category: Workshops

If you search for *** in the trace you will see that it dies trying to compile Mumps for Ipopt. Basically it seems that the fortran compiler has issues:

Code:


Error: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1)
MUMPS/src/dmumps_comm_buffer.F:2670:23:

what version of gfortran do you have?
Run the command above to find out.

Code:


> gfortran --version

May-22-20 22:08:20
I can't make it work.
Category: Workshops

I need to see the *entire* build log. Because you are compiling with "make -j8" the build error can be anywhere in the log and seeing only the last commands where make tells it fails it doesn't help.

Edit PKGBUILD and change "make -j8" to "make -j8 > trace.txt 2>&1" run it again and upload the trace file.

It might be the new dependency to libcurl that is the problem (apt-get install libcurl4-gnutls-dev to install it on ubuntu or add it to the PKGBUILD dependencies section) but i have no way of knowing if I don't see the full build log, not just parts of it.

May-21-20 22:45:51
I can't make it work.
Category: Workshops

Seems you did the make command in some other directory where there is no Makefile, or you did git clean and did not autoconf / configure again.

May-21-20 20:58:29
I can't make it work.
Category: Workshops

I need more of the output. Run with:
make -j8 > trace.txt 2>&1 and then upload trace.txt.

May-21-20 20:46:51
I can't make it work.
Category: Workshops

Your network seems to go down during the build when trying to fetch Modelica libraries from github, see:

Code:


error: RPC failed; curl 56 OpenSSL SSL_read: Connection timed out, errno 110
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
fatal: unable to access 'https://github.com/modelica/Modelica.git/': Could not resolve host: github.com
fatal: unable to access 'https://github.com/modelica/Modelica.git/': Could not resolve host: github.com

Try with make -j4 or lower. How many cores your computer CPU has?
You will also need to install subversion to have svn as some Modelica libraries are checked out from svn repos.

May-16-20 20:57:32
Error while initializing

What OM version are you running?

Can you share the model? If you want to keep it private you can send it to us for debugging via email to OpenModelica@ida.liu.se and we will delete it after we find the issue.

May-14-20 22:25:35
Return a record from an external C funciton cal
Category: Programming

Why do you want to use records if you only have one value?

Anyhow, you might hit this bug:
https://trac.openmodelica.org/OpenModelica/ticket/5774
pointed out by (you also have an example there):
https://www.openmodelica.org/forum/defa … c-function

May-14-20 13:26:45
Error while initializing

Just edit the model text and change to:

Code:


Modelica.Fluid.Sources.FixedBoundary Sink(nPorts = 1, redeclare package Medium = Medium)

May-13-20 10:04:25
Error while initializing

passas wrote:


When simulating your model testje2, I have the scripting error:
Internal error: no tokens left to replace %s with.
Given message was: System.launchParallelTasks: Failed to create thread: %s

How to solve that problem.

Press on "S" to simulate the model and change "Number of Processors" to 1.

What computer do you have? How much RAM? What CPU? What OS: Windows? Linux? Mac?


Learn Modelica please:
https://mbe.modelica.university/

Complex is part of the MSL.
https://github.com/modelica/ModelicaSta … Complex.mo

Code:


Complex c[10];
// c[1] is the complex
// c[1].im is the im part
// c[1].re is the real part

May-07-20 09:01:56
ModelicaML isn't working anymore?

kamali wrote:


Hello every Body
I'm new to modelica. i try to install and use MDT  but i face many problems.
shall we use older version of eclipse?(i use 2019 version)

This is not about ModelicaML, however, I'll answer.
MDT doesn't work so well with Modelica projects (we mostly use it for compiler development with MetaModelica), I would suggest using OMEdit instead. Also we had no time to develop MDT further so there are still bugs and issues with it.

May-03-20 18:58:14
Installation from OM-v1.160-dev316-g3188ef6bb
May-02-20 14:31:35
Installation from OM-v1.160-dev316-g3188ef6bb

Ouch, there are plenty! I'll fix this.

Code:


adrpo33@ida-0030 MINGW64 /e/OMDev/tools/msys/mingw64/bin
$ /c/OMDev/bin/ntldd/mingw64/ntldd.exe -R libcurl-4.dll | grep -v WINDOWS | grep -v "not found"
        LIBEAY32.dll (0x0000000001310000)
        libidn-11.dll (0x00000000006f0000)
         libiconv-2.dll (0x0000000000f50000)
         libintl-8.dll (0x00000000001d0000)
        librtmp-1.dll (0x00000000001d0000)
         libgmp-10.dll (0x0000000000f50000)
         libgnutls-30.dll (0x0000000000f50000)
          libwinpthread-1.dll (0x0000000000020000)
          libp11-kit-0.dll (0x00000000006f0000)
           libffi-6.dll (0x0000000000020000)
          libtasn1-6.dll (0x00000000006f0000)
         libhogweed-4-1.dll (0x00000000006f0000)
         libnettle-6-1.dll (0x0000000001080000)
        libssh2-1.dll (0x00000000006f0000)
        SSLEAY32.dll (0x0000000000f50000)
        zlib1.dll (0x00000000006f0000)

May-01-20 23:51:22
Installation from OM-v1.160-dev316-g3188ef6bb

Yes, it seems we forgot to copy it as is now needed due to new functionality.
Copy libcurl-4.dll to:
C:\Program Files\OpenModelica1.16.0-dev-64bit\bin
until I will fix this properly in a new nightly.

Thanks for reporting this.

You can use Right Click->Duplicate. Sometimes it doesn't work fully, you might need to edit some component types to make it work.

Apr-24-20 19:25:19
Errors when trying to override start values

Did you by any chance have "Evaluate all parameters" checked in OMEdit->Tools->Option->Simulation?

What variability has component "controlValve.C1.P"? Is it parameter, constant or variable?

Apr-23-20 14:04:04
Model includes call to extern C function with dynamic link library which can export to FMU, but...
Category: Developer

The best solution would be to compile *all* the FMU dependencies as static libraries (if possible).
If is not possible, you can ask the people you send the FMU to to install the dependencies.

You should try to get rid of as many dependencies as possible, to get rid of libstdc++ use g++ to link and flags "-static-libstdc++".

As to the fact that platform dynamic does not change  -Wl,-Bstatic part to  -Wl,-Bdynamic this seems to be a bug. I will open a ticket about it.

For now I think you can just:

Code:


export MODELICAUSERCFLAGS=-Wl,-Bdynamic -lnmpc

before running OMEdit or omc to build the FMU (or add it to compiler flags in OMEdit).

You could also, after building the FMU, unzip it, use "ldd -r" on the generated .so file and then copy all the dependencies in the directory where the generated libnpmc.so is, the repack the zip into an FMU again. This way it should work to send it to somebody BUT it highly depends on how the FMI tool loads the FMU and what is the search path for the dependent .so files, some might add the path where the FMU is unpacked to the search others might not. For example see how windows loads dlls if the LOAD_WITH_ALTERED_SEARCH_PATH is given.

Apr-22-20 19:08:57
Model includes call to extern C function with dynamic link library which can export to FMU, but...
Category: Developer

What do you have set in the FMU export setting in OMEdit in Tools->Options->FMI: "Platforms"?
Is it static? Is it dynamic?

Note that if you have an .so which is used in the FMU you will need to copy that one manually inside the generated FMU.
Can you compile this library as a static library .a?

As far as I can see from these paths below it should find the "nmpc" library.

Code:


-Wl,-Bstatic
"-L/usr/bin/../lib/x86_64-linux-gnu/omc" -Wl,-rpath="/usr/bin/../lib/x86_64-linux-gnu/omc" "-L/usr/bin/../lib/"
-Wl,-rpath="/usr/bin/../lib/" "-L/home/johannes/.openmodelica/binaries/MPC" -Wl,-rpath="/home/johannes/.openmodelica/binaries/MPC"
"-L/home/johannes/01_cstr_introduction/models/MPC/Resources/Library/x86_64-linux"
-Wl,-rpath="/home/johannes/01_cstr_introduction/models/MPC/Resources/Library/x86_64-linux"
"-L/home/johannes/01_cstr_introduction/models/MPC/Resources/Library/linux64"
-Wl,-rpath="/home/johannes/01_cstr_introduction/models/MPC/Resources/Library/linux64" "
-L/home/johannes/01_cstr_introduction/models/MPC/Resources/Library"
-Wl,-rpath="/home/johannes/01_cstr_introduction/models/MPC/Resources/Library"
-lnmpc
-Wl,-Bdynamic

Probably it does find it, but because we force a static link for it via -Wl,-Bstatic it doesn't use it.

To fix this i suggest you try to make a static library as otherwise you will nee to copy *ALL* the dependent dlls (.so) inside the generated FMU.
If you don't do that and sen the FMU to somebody they will not be able to use it if they don't have the same .so installed.

Apr-19-20 04:46:04
could not find DLL (built using VS 2015) in modelica

This seems like a bug but I'm not sure.
The Modelica Specification say:
"The Library name and the LibraryDirectory name in the function annotation are mapped to a linkage directive in a compiler-dependent way thereby selecting the object library suited for the respective computer platform."
It doesn't say anything about what to do when running the executable but I guess these paths should be added to the PATH?

For now, to fix this, I guess you need to put in the PATH environment variable the directory where the DLL is.
I will open a bug about this to clarify what to do.

You can use any algorithm section in a function with no issues, including loops.

You cannot have an expression on the left hand side in algorithm sections! Only:

Code:


// component reference on the left hand side is fine
a := some_expression;
// this is not allowed by the grammar:
a + b := c:

In you case in while you have:

Code:


x ^ 2 + y ^ 2 := L ^ 2;

which is not allowed, you can write that as:

Code:


x := sqrt(L ^ 2 -  y ^ 2);

As far as I know, you don't, but that depends on your model. In the MSL they are using "acceptable" values in types and then use these types.

Modelica tools will prioritize start values that are set via modifications close to the top level in the instance hierarchy.
So, if you have issues set the start values via variable modifications in your top model.
Also, most tools can tell you which variables are used as iteration variabels via some flags.

To make matters worse tools use different variables as iteration variables so models working in one tool (because of proper start values) will not initialize in another.

OpenModelica 1.14.1 and up has the new frontend on by default for both OMEdit API and code generation.

To remove the usage of the new frontend for OMEdit API do:
    OMEdit->Tools->Options->Simulation
    unclick: Enable new frontend use the OMC API (faster GUI response)

If you have issues with model compilation, you can use the old frontend for that as well (might work better or not)
    OMEdit->Tools->Options->Simulation
    click: Enable old frontend for code generation

   

This is not possible on Windows. You need Linux with cross compilers installed.
Either use WSL Windows subsystem for Linux or our Vitual Machine.

Mar-24-20 16:12:24
Category: Developer

Do you have file
%OPENMODELICAHOME%lib\omlibrary\Arduino 0.1.0\Resources\Library\win64\libModelicaArduino.lib
after running the cmd commands?

Hm, after looking at your message a bit better it seems you have omlibrary\Arduino\ instead of omlibrary\Arduino 0.1.0?!
Did you downloaded the library yourself? If so, you will need to run the commands in for omlibrary\Arduino\, change:

Code:


cd "lib\omlibrary\Arduino 0.1.0\Resources\Source\Arduino"

to

Code:


cd "lib\omlibrary\Arduino\Resources\Source\Arduino"

in the script above.

Also, you need to edit lib\omlibrary\Arduino\Resources\Source\Arduino/build_mingw.bat instead of the one in lib\omlibrary\Arduino 0.1.0\Resources\Source\Arduino.

Mar-23-20 16:21:07
Category: Developer

You need to build the library source code into ModelicaArduino.lib using the GCC in the OpenModelica installer. To do that:

It seems the buld_mingw.bat script in directory:
%OPENMODELICAHOME%lib\omlibrary\Arduino 0.1.0\Resources\Source\Arduino
is missing some cpp files. You will need to edit it and make it look like this:

Code:


gcc -c -std=c++11 -I. -I"..\..\Include" -I"..\..\Sketches" -D"ARDUINO=100" PID_v1.cpp Servo.cpp ModelicaArduino.cpp Print.cpp Sketch.cpp SoftArduino.cpp WMath.cpp ModelicaUtilities.cpp
ar rcs ..\..\Library\win64\ModelicaArduino.lib *.o
ar rcs ..\..\Library\win64\libModelicaArduino.lib *.o

Then do Windows Start->cmd.exe and type in:

Code:


cd /D %OPENMODELICAHOME%
REM convert from long path %OPENMODELICAHOME% to short path %OM%
set OM=
for %A in ("%OPENMODELICAHOME%") do SET OM=%~sA
set PATH=%OM%\tools\msys\mingw64\bin\;%PATH%
cd "lib\omlibrary\Arduino 0.1.0\Resources\Source\Arduino"
call build_mingw.bat

This will create libModelicaArduino.lib in this directory:
%OPENMODELICAHOME%lib\omlibrary\Arduino 0.1.0\Resources\Library\win64\

Then try to build your model again.

If "n" is a parameter then it should work fine and this seems like a bug.
We should do loop unroll to generated all the statements but maybe the evaluation of the if condition during that is failing.

As a workaround until we fix this, you can remove the if statement and connect the cell to itself as connect(A, A) is ignored and a warning is given.


I guess that should be:

Code:


for i in 1: N-1 loop
  connect(const[i].y, source_T_cell[i].Temperature); // note that you have i instead of N
end for;

You could also do it via he slice operator and without the for loop:

Code:


connect(const[1:N-1].y, source_T_cell[1:N-1].Temperature);

Not sure if you are saying that you don't know how to instantiate the model or if the total model after edit and save is not loading.
If the file is not loading if OMShell probably you have made a mistake (syntax or semantic). Do you get true from loadFile?
The file will not load in OMEdit as OMEdit wants to just one class per file.

Anyhow, to instantiate the model in OMShell, just type:
instantiateModel(Path.To.Your.Model.Name);

Code:


        if initType == .Modelica.Blocks.Types.Init.SteadyState then
          der(y) = 0;
        elseif initType == .Modelica.Blocks.Types.Init.InitialState or initType == .Modelica.Blocks.Types.Init.InitialOutput then
          y = y_start;
        end if;

I guess it might work to translate it to this:

Code:


        0 = if initType == .Modelica.Blocks.Types.Init.SteadyState then
          der(y)
        elseif initType == .Modelica.Blocks.Types.Init.InitialState or initType == .Modelica.Blocks.Types.Init.InitialOutput then
          y_start - y
        else 0;

What kind of optimization software are you using?

I guess the easiest would be do save the model using save total model in OMEdit.
Then edit the function in the new file to change the if equation to an if expression and then instantiate the model again.

Mar-14-20 14:21:14
ModelicaML isn't working anymore?

You might try with an older eclipse. I have one here, hopefully it will work for you:
https://www.ida.liu.se/~adrpo33/ModelicaML/

If you know Java and Eclipse you can try to update the existing ModelicaML to work with the latest Acceleo.
You can find the source code here:
https://github.com/OpenModelica/MDT

That is because we do not have support for redeclares in the GUI yet.
Is work in progress to be part of 1.15 soon.

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