我有以下问题:
我有超过 20 个不同的模型,我想一个接一个地模拟它们,但每次我都想更改模拟目录。
现在,我在每次模拟后手动更改目录(从 ./ModelOne 到 ./ModelTwo),我想知道是否有办法在初始化或转换新模型时自动更改它。
问候 内华达
最佳答案
我认为最好的方法是编写一个脚本:
pathOfSave = {"E:\\work\\modelica\\SimulationResult\\Model1\\","E:\\work\\modelica\\SimulationResult\\Model2\\"};
nbSim = 2;
pathOfMod = { "MyModel.",
"MyModel.};
modelsToSimulate = { ""Model1" ,
"Model2"};
//If equdistant=true: ensure that the same number of data points is written in all result files
//store variables at events is disabled.
experimentSetupOutput(equdistant=false, events=false);
//Keep in the plot memory the last nbSim results
experimentSetupOutput(equdistant=false, events=false);
for i in 1:nbSim loop
//delete the result file if it already exists
Modelica.Utilities.Files.removeFile(pathOfSave + modelsToSimulate[i]);
//translate models
translateModel(pathOfMod[i]+modelsToSimulate[i]);
// simulate
simulateModel(
pathOfMod[i]+modelsToSimulate[i],
method="dassl",
stopTime=186350,
numberOfIntervals=nbOfPoi,
resultFile=pathOfSave + modelsToSimulate[i]);
end for;
关于modelica - 有没有办法自动更改 Modelica/Dymola 中的目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22327762/