开发者

Modelica - Specify simulation default parameters

I know I can change File_init.txt's definitions, but I was wondering if there is some way to do it in the class file (.mo) or in a directive to the comiler (omc).

In an attempt to alleviate myself of the lack of a 开发者_运维技巧'has-a' relationship in Modelica, I am writing a Perl wrapper that writes the highest level of my Modelica simulation (with my has-a's turned into if and when statements) and the compiles (omc +s then make) and simulates. This would work perfectly if I could specify such parameters as stop, step, outputFormat in some other way, rather than having to open the init file and do a regexp replace on them which is really clunky.

Long story short, is there some directive like the (pseudo-code) example below?

class MainSim
  extends BaseSim;
  ...
  simulation.stop = 1E-9;
  simulation.step = 1E-12;
  simulation.outputFormat = "csv";
  ...
equation
  ...
end MainSim;


Almost Joel, the correct way would be:

model Model annotation( experiment( StopTime=6.28 ) ); ... end Model;

You can also have at "example" models (normally placed in a .Examples subpackage) from the Modelica Standard Library. They all should have that annotation in place (and if not feel free to report it :)).


I don't know how OMC handles this, but there are standard annotations for experiment parameters. You can find the information in Section 17.7 of the specification (version 3.2).

Take a look at that and let me know if that addresses your question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜