annotationsmodelicaopenmodelicadymola

Experiment annotation in Dymola/Modelica


I am trying to change the simulation settings(startTime,stopTime,Interval) for an experiment based on the size of the external file that is presented to the model.

Experiment annotation allows one to set these simulation settings like this,

annotation(Experiment(startTime=0,stopTime=10,Interval=500));

Now I am trying to set these values based on a parameter declared in the same model. This parameter basically scans the external file to find its size. Modelica doesn't recognize the following declaration of the same annotation?

model ExperimentAnnotation
parameter Integer start = 0;
parameter Integer stop = 10;
parameter Integer size = 100;
equation
annotation(Experiment(startTime=start,stopTime=stop,Interval=size));
end ExperimentAnnotation;

Is there a work around for this? Kindly advise.

Thanks.


Solution

  • Using non-literal values for the startTime-annotation etc is not legal Modelica - according to section 18.4; and not supported in Dymola.

    As I understand it the parameter doesn't have a literal value in the model, but the parameter-value is based on reading some file.

    In Dymola you could use "Add Command" to add a script-command that reads the external file and then calls simulateModel with the correct values.