OpenModelica


Forgot password? | Forgot username? | Register

Running a set of simulations with different parameter inputs

Running a set of simulations with different parameter inputs

I'm quite new to Modelica here so hopefully this is an easy one. I have a simulation created in OMEdit that works well when I simulate it. I'd like to move on to simulating this model with a variety of different inputs while logging data automatically.

For example, I have a sine wave input force going into the system. I'd like to see the system's response to 10-100 Hz input sine waves in 10 Hz increments. Right now I can manually change the value, run the sim, then export the CSV to my analysis program, but that seems quite inefficient- I'd rather update my model, then hit "go" and get results for 10 different frequencies, or 10 different phases, or whatever. Just a constant input parameter evenly spaced over a predetermined range.

I've been looking at OMOptim but I don't see a way to specify input values, and I don't see a way to run it without trying to optimize anything. The results I'm looking at have to be post-processed and there aren't really good ways to define them as "optimized" anyway; I just need to know some frequency response information.

Is there a way within OMEdit, OMOptim, or the OM Shell to do something like this? I haven't done any scripting with Modelica yet, but if that's the way to go I'd be happy to learn.

Thanks for the help.

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

Re: Running a set of simulations with different parameter inputs

You could do something like:
https://openmodelica.org/forum/default- … eter-sweep

Another way is to create another model in which you have the current model several times as components with different inputs, that you can simulate once.

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

Re: Running a set of simulations with different parameter inputs

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

Re: Running a set of simulations with different parameter inputs

Thanks for the tips. One more question that I'm fairly embarrassed to ask... how do you write and run scripts? I can get things going from OMShell but obviously I'd rather write the script once then run it later. Do I just write the script in any old text editor, then run it using runScript(filepath)? Or is there an integrated script writing environment?

It looks like OMNotebook is what I need but I haven't gotten super deep into it yet and I'd rather avoid a false start if possible.

(I'm coming from Scilab, where there's a built-in editor with syntax checking, highlighting, that kind of thing, so I'm wondering what my best option is here in OpenModelica).

Thanks again all, sorry for the newb questions!

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

Re: Running a set of simulations with different parameter inputs

For scripts, we usually just use a text editor and save as something.mos, then run omc something.mos. Just call getErrorString() a lot to see error-messages.

Something like:
https://github.com/OpenModelica/OpenMod … erter2.mos

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: