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

OM scripts and OMEdit

OM scripts and OMEdit

Is there a way to run a modelica script (mos file) from OMEdit?
I mean a script in which I use scripting functions from the following link?
https://build.openmodelica.org/Document … pting.html


Thanks.

Re: OM scripts and OMEdit

Start OMEdit using the command "OMEdit --OMCLogger=true". Then Tools->OMC CLI will allow you to send commands instead of just reading them.

runScript("file.mos") will run the given mos-script.

Edited by: sjoelund.se - Feb-28-15 16:21:32

Re: OM scripts and OMEdit

Thank you.
that usage is useful for me and straightforward.

I will use this to make a Fourier analysis of some of the output waveforms.
All I have to do is to translate into OM mos the mos I wrote some years ago for Dymola.
The language is modelica, but the functions to call are different.

My first obstacle is how to use  readSimulationResult().
I got some info about it in:
https://build.openmodelica.org/Document … esult.html

I have to pass to it as one of the inputs "variables" that is of VariableNames type.
Where can I find the description of this type? I suppose it is something like a string list, butI cannot envisage how exactly it is to be used.
Maybe there is an example of readSimulationResult() usage somewhere to look at.

MC

Edited by: ceraolo - Mar-01-15 12:23:21

Re: OM scripts and OMEdit

Just in case anyone had read my previous message and is curious about the solution.
I found the explanation of the type "VariableNames" in section 2.3 of OpenModelicaSystem.pdf. I read as follows:

VariableName – variable name, e.g. v1, v2, vars1[2].x, etc.

I tried... it  works!

Re: OM scripts and OMEdit

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

Re: OM scripts and OMEdit

Try reading http://www.ep.liu.se/ecp_article/index. … rticle=049 and you will see how some parameters affect compilation and simulation times.

There are 0 guests and 0 other users also viewing this topic