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

Posts

Posts

Hello,

I know that there is the possiblity to save the result file in csv instead of mat. So I can plot my results in Excel or somewhere else. But the OMEditor is able to handle the mat files. Is it possible to implement something in the OMEditor to open the res.mat files without compiling and simulation the model?
That would be a great feature!

Regards

Jul-18-12 12:13:24
Command doesn't work

My fault....

The secret is to write it without a blank...
Works:
system("Model -override stepSize=0.01,startTime=0.2,stopTime=0.3")
Works not:
system("Model -override stepSize=0.01, startTime=0.2, stopTime=0.3")

Jul-18-12 12:07:53
Command doesn't work

Okay override works only for one Command!!!

system("Model -override stopTime=0.3") works...

Is there a way to manipulate more than one command...

Thanks

Jul-18-12 11:07:43
Command doesn't work

Hello,

you have implemented the command override to change the start  values and to modify the simulation settings.
If I use this command the Model.exe is simulated, but with the default values for startTime etc...

I tried several versions:

Code:


system("cmd Model.exe -override startTime=0, stopTime=0.03, numberOfIntervals=3");
system("cmd Model.exe -override startTime=0, stopTime=0.03,  stepSize=0.01");
system("Model -override, startTime=0, stopTime=0.1, stepSize=0.01")
system("Model -override, startTime=0, stopTime=0.1, numberOfIntervals=3")

Regards,

Marco

Jul-05-12 13:52:04
Restart the simulation with different initial values

Hello Developers,

I tried to use the override command in different ways now and it doesn't work.
To run the simulation by the call system("Modelname"), works fine of course.
To run the simulation by the call  system("Modelname -override startTime=0, stopTime=0.1, numberofIntervals=5"); will make a new result file with the default startTime, stopTime, numberofintervalls.

The intended changes are not executed!!!
startTime, stopTime, numberofintervalls is on default!!

By the way to change the Variables by replace start Value works more or les fine.
I have to define the Variable in the model as Input to make a usefull change.
Else the value of the variable is changed in the Result file, but the equation which uses this variable will be compute with the original value of the Variable defined in the model.

Skript2 is my modelname.
o:=2;
system("cmd /C C:/OpenModelica1.8.1/share/omc/scripts/replace-startValue.bat X" + String(o) + " Skript2_init.xml > new_Skript2_init.xml");
system("cp new_Skript2_init.xml Skript2_init.xml");
system("Skript2")
And this solution doesn't work for the simulation command because it will compile again (It took a little to get that)

Regards,

Marco

Thank you for the fast reply!

Dear Developer,

in OM Edit the Interactive Simulation is grey and so it's not possible to run it.
Now I have tried to run the interactive simulation as described in chapter 5 of the User Guide!
To run the old model in the Zip file worked!
Afterwards I have loaded the model in OMshell and called buildModel.
The new compiled Model doesnt work!
There are changes in the file-format. E.g. the Init file is now a XML-file and was in the old Model a txt-file.

Is it possible to run interactive simulations in the new version of OM?

I'm working in windows.

Regards,

Marco

Jun-27-12 17:43:04
Restart the simulation with different initial values

Hello,

unfortunately I'm still working on this Problem.

How to set new Initial Values?
Your suggestion doesn't work, I think there's a problem with the replace-startValue.sh.

In the Documentary is the script descriped by:
#usage: ./replace-startValue.sh variableName variableStartValue Model_init.xml

Now an Example with your Model:

Code:


loadString("model M

  parameter Real p = 3.0;

end M;

");

buildModel(M);
system("sh C:/OpenModelica1.8.1/share/omc/scripts/replace-startValue.sh p 10 M_init.xml");

This should be enough to set the initial value of p=10 or not? In OMNotebook it doesn't work, even your original Code doesn't work.

Thank you very much for Informations.

Jun-21-12 11:16:05
Restart the simulation with different initial values

Thanks Hero :-)

Now I get it with system, very usefull !!

Jun-21-12 10:49:25
Restart the simulation with different initial values

Thanks a lot, I see, I still have a long way to go!

For example the $TypeName and the system() Command are not easy to understand. Even with the examples in Dr.Modelica and with the Book of P.Fritzen it's pretty hard to get all the symantics of the Language.

So if you are working with the script you are using a lot of stuff which isn't obvious for me.
It seems to me you are working a lot with the API system(). But where can I find the Commands which I can use with this expression? They are not documented.
And which meaning has the $ in front of Typename?

Excuse me for this annoying questions but like I said it's not easy to get from the Documentation..

Jun-20-12 14:53:45
Restart the simulation with different initial values

That's kind of awesome :-)
Thanks, but what for Commands are you using? I don't find them in the help()?

Jun-20-12 14:36:53
Restart the simulation with different initial values

Hello,

is there a way to call an API function like simulate() or setComponentModifierValue() in a loop?
My aim is to restart a simulation in OMNotebook with different initial Values.

Example:
j:=5;
for i in 1:j loop
setComponentModifierValue(Modelname, VariableInitial, Code(=i);
simulate(Modelname);
end for;

Thanks in advance,

Regards,

Marco

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