OpenModelica


Forgot password? | Forgot username? | Register

how to utilize the exe file that is compiled when i simulate a model?

how to utilize the exe file that is compiled when i simulate a model?

i want to know whether i can get my model files directly packaged into exe format, which does not depend on OMEdit and can generate the simulation results? Thank you !!

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Yes, OpenModelica generates executables which do not depend on OMEdit. It is only on Windows that they are dependent on some odd files (the MinGW runtime), but you can add the dll's to the system PATH.

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Is  there some guide about this?thank you !

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Hi,

No, there is no guide.

However, is an Model.exe so you run it and the result will be a Model.mat file with the same name as your model.
The Model.mat file then can be opened with OMPlot or other programs.
Is also possible to generate Model.csv instead of Model.mat.

By default the .exe is generated in your temporary directory, which in Windows 7 is:
C:\Users\_YOUR_USERNAME_\AppData\Local\Temp\OpenModelica\OMEdit

You need the Model.exe, the Model_init.xml files.
By default Model.exe should not depend on any other .dlls or anything else so is self sufficient.

You run Model.exe from the command line to get Model.mat.
If you want Model.csv, edit Model_init.xml and change outputFormat   = "csv" or outputFormat   = "plt" (PtPlot format)
Run Model.exe -? for a list of command line parameters.
You can edit Model_init.xml to change the start values of the parameter before re-running Model.exe.
You can also use the script from here:
C:\OpenModelica1.8.1\share\omc\scripts\replace-startValue.bat variableName variableStartValue Model_init.xml > NewModel_init.xml

Hope this helps a bit.

Cheers,
Adrian Pop/

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Thank you so much!
but i cannot understand "You run Model.exe from the command line to get Model.mat."  when i just double-click to open the exe file,then a window flash and then disappear.and how i  can run Model.exe from the command line?  thank  you ! i am a beginner so  what i know is so little.

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Hi,

Double click on it works also. But is a console application so it doesn't display anything.
It just runs and creates Model.mat.

To run from command line (replace _YOUR_USERNAME_ with your Windows user name):
Start->cmd.exe
> c:
> cd \Users\_YOUR_USERNAME_\AppData\Local\Temp\OpenModelica\OMEdit
> Model.exe
> Model.exe -?
Like that you run from the command line.

Cheers,
Adrian Pop/

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Thank  you  so much!!!  you help me so much!

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

i would also like to ask a question,could the exe file can directly display the result ,for example the curve of the variable,it can pop out in the screen? I am a Chinese college students doing the graduateproject , I am very grateful for your help!

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Hi,

No.
The Model.exe  will not display/plot the results and will never do that.
You can use OMPlot from the OpenModelica installation for that.
These are the command line options for OMPlot:

Code:


Usage: OMPlot [OPTION] [--filename=NAME] [variable names]
OPTIONS
    --title=TITLE              Sets the TITLE of the plot window
    --filename=NAME            Sets the NAME of the file to plot
    --legend=[true|false]      Display a variable legend in the window
    --grid=[true|false]        Enable a grid in the window
    --logx=[true|false]        Use log scale for the x-axis
    --logy=[true|false]        Use log scale for the y-axis
    --xlabel=LABEL             Use LABEL as the label of the x-axis
    --ylabel=LABEL             Use LABEL as the label of the y-axis
    --plot                     Create a normal plot
    --plotAll                  Create a normal plot containing every variable in the result-file
    --plotParametric           Create a parametric plot (plot variables as functions of each other)
    --xrange=LEFT:RIGHT        Sets the initial range of the x-axis to LEFT:RIGHT
    --yrange=LEFT:RIGHT        Sets the initial range of the y-axis to LEFT:RIGHT
    --new-window=[true|false]  Create a MDI dialog in the plot-window

So, in the command line you can do something like this to plot all the variables:

Code:

> %OPENMODELICAHOME%\bin\OMPlot --filename=Model_res.mat --plotAll

or like this to plot only one (change VARIABLE_NAME to the name of your variable):

Code:

> %OPENMODELICAHOME%\bin\OMPlot --filename=Model_res.mat VARIABLE_NAME1 VARIABLE_NAME2

You can ship OMPlot.exe (take also all the .dlls from OpenModelicaX.Y.Z/bin) with your Model.exe if you don't want the user to install OpenModelica.

You should learn more about .bat files if you want to automate this.
You can create a .bat that runs your model, then plots the variables automatically.

Cheers,
Adrian Pop/

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

hi, when i script like "> %OPENMODELICAHOME%\bin\OMPlot --filename=helloworld_res.mat --plotAll" it  says helloworld_res.mat is not existent. is there some requirement for the path of the .mat file?
"

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Write full absolute path of the file or put the file where OMPlot is located.

Adeel.

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

adrpo wrote:


Hi,

No, there is no guide.

However, is an Model.exe so you run it and the result will be a Model.mat file with the same name as your model.


Cheers,
Adrian Pop/

Hi, Adrian. Could you help me? When I tried to open Model.exe which is created by OpenModelica, I saw a message "there is no the libsundials_kinsol.dll". And nothing happen after that. What shoul I do to fix the error?
P.S. Sorry for double message, I didn't see where I could delete my message.

Edited by: Ascold - Sep-28-15 14:22:42
Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

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

Cheers,
Adrian Pop/


Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

adrpo wrote:


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

Cheers,
Adrian Pop/



Big thanks, Adrian!
You are really help me!

Edited by: Ascold - Oct-02-15 11:59:49
Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Hello everyone,

I have a model named "test.mo" and I am trying to simulate this model with omc command from cmd window. When I use the omc command I receive an error which says "Failed to build model: test". But I simulate the model with OMEdit without any problem. There is nothing wrong with the model and I do not understand why when I try to simulate it with omc command it says model cannot be built. I would be extremely grateful if you could help me out.

Best,
Pouya

Edited by: PJS - Nov-25-15 09:47:42
Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Are you using the Modelica standard library, but did not load it in your command-line omc?

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Thanks for your attention,

I have loaded the library that I am using. This is my .mos file:

loadModel(Modelica);
loadFile("TResLib.mo");
loadFile("test.mo");   
simulate(test, outputFormat="csv");

and it gives :
True
True
True

which meanse that it has loaded the library but then it cannot build the model !!!!

I will appreciate your help.

Best,
Pouya


Edited by: PJS - Nov-25-15 11:03:37
Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Hi Everyone,

I have another question regarding compiling a model from cmd using OMC command. It seems like it takes more time to compile and simulate the model using OMC. I just wanted to ask if anyone knows the parameters affecting the time that it takes to compile the model. I increased the number of the elements in my model and it takes approximately the same time to be compiled. So, I was wondering what parameters of the model affect the time consumption for simulation.


Thanks for your attention,
Pouya

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Loading MSL probably takes most of the time for smaller models (especially on Windows as OMC is not multi-threaded on Windows). There is also some overhead in launching the make and gcc processes on Windows, and linking the run-time, which makes small simulation have a somewhat large cost in time.

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Dear all,

I am in trouble with the execution of the .exe created by OMedit.
I followed the steps described in this post (I copied the code.exe, the code_init.xml, the code_res.mat, the .dll requested in the same folder of the executable).

When I try to execute the executable, the follow error is displayed:
The application was unable to start correctly (0xc000007b).

Can someone help me?
Am I missing some flags or something when I try to execute? Is the executable compiled correctly?

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

In regard to pierluigiRossi, I also have problems when trying to run the executable generated by OMEdit. When I try to run it at command line, there is no response at all.

With the executable generated directly by omc.exe, I have no problems.

Edited by: brunoleos - Sep-27-16 16:17:20
Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

Dear all,

Is there any way to get the executable file for ubuntu? I need to connect my model with Ua expert and then to connect with OpenModelica OPC UA server.

For windows we could use as--> xxx.exe -embeddedServer=opc-ua -rt=1

Is there anything similar for Ubuntu?

Thanking you in Anticipation.

Kind regards,
Maria

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

It is exactly the same for Ubuntu.

Adeel.

Administrator has disabled public posting. Please login or register in order to proceed.

Re: how to utilize the exe file that is compiled when i simulate a model?

while running the exe through python the terminal window with the stdout msg pops up and consumes a lot of the time. is it possible to stop the terminal from appearing using some flags.
Request your kind help pls

Administrator has disabled public posting. Please login or register in order to proceed.
There are 0 guests and 0 other users also viewing this topic
You are here: