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
  • » Ben
  • » Profile

Posts

Posts

Hi again Adrian,

I work on Dymola 2012.
I've ticked the "Warn about parameters with no default" box in Simulation tab->Simulation->Setup->Translation (I imagine it is the closest to "Pedantic mode for checking Modelica semantics"  on Dymola 2012). Then I simulated my model with Dymola, and I got "true", therefore the model is working well.
Nevertheless, before simulating,  Dymola needs to be given a script containing guess values for some of the variables of the sytem, in order to be able to calculate the final state of the system. I don't succeed in doing that with OpenModelica. It is possible to do it through a .mos file, isn't it?

When I write in the Shell:
runScript("script_init.mos")
I get:
"Failed"
Without further explanation.

The commands I use before runnig my Script are:
loadModel(Modelica,{"3.1"});
loadFile("file_name")
checkModel(model_name)
translateModel(model_name)

Before running my script, when I write:
listVariables()
I get:
{}
Therefore, I imagine the problem is that my variables do not exist when I try to give them a value.

What do you think about it ?
What should I do?
Thank you for all your answers,

Cheers,
Julien

Ok Adrian, thank you very much !

And how could I get the names of the variables which need to be given a start value so that the simulation could work ?
I think that my problem is that OpenModelica has not the same "initialization variables" as Dymola.

Thanking you in advance,
Julien

My file .txt is excatly like yours.

When I write :

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

OpenModelica does not write anything, whereas when I write :

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

I get lots of warnings. Are you sure of this syntax ?

Thank you very much : I didn't know this "simflags = "-overrideFile=fileName"" technique !
I get "" when I write :
getErrorString()

Is it possible to integrate this "getErrorString" command in the simulate one ?
I've tried :
simulate(model_name,simflags = "-overrideFile=Script.mos",getErrorString)
but I didn't work.

The simulation still does not work.
It may be because OpenModelica doesn't need initialization values for the same variables as Dymola.
How could I get the names of the variables which need to be given a start value so that the simulation could work ?

Hi,

I am a beginner with OpenModelica, so sorry if my question is a stupid one.

I am working with a Dymola model. I have a .mos file, which contains the values of variables that have to be given to OpenModelica so that it could simulate (initialization values).
I'm working with OpenModelicaShell.
I've read it was possible to run a Script  with : runScript("script_name").
Yet, when I do it, I get "failed".
I think it is because the variables of my model are not created when I run the script (because when I write getParameterNames(model_name), I get "{ }" ), but I do not know how to create them, without simulating.

To sum up, here are the commands I use :
loadModel(Modelica,{"3.1"});
loadFile("file_name")
checkModel(model_name)
translateModel(model_name)
runScript("script_name").

What do I do wrong ?

Thank you very much for your help !
Ben

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