Modelica - set default simulation parameters

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

In an attempt to alleviate the lack of a has-a relationship in Modelica , I write a Perl shell that records the highest level of my Modelica Modeling (with mine has-aturned into ifand operators when) and compilation ( omc +sthen make) and it simulates. It would be great if I could specify parameters such as stop, step, outputFormatin some other way, instead of having to open the initialization file and attempt to replace the regexp to them that really awkward.

In short, is there any directive like the one below (pseudo-code)?

class MainSim
  extends BaseSim;
  ...
  simulation.stop = 1E-9;
  simulation.step = 1E-12;
  simulation.outputFormat = "csv";
  ...
equation
  ...
end MainSim;
+3
source share
2 answers

Almost Joel, the correct way:

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

You can also have β€œsample” models (usually placed in a subpackage .Examples) from the Modelica standard library. All of them should have this annotation in place (and if you cannot report it :).

+4
source

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

Take a look at this and let me know if it concerns your question.

+3
source

Source: https://habr.com/ru/post/1790781/


All Articles