Skip to content

Quick Tips

Scott G edited this page Aug 14, 2020 · 12 revisions

Dymola Flags

  • If large Dymola models are bogging you down, try putting Hidden.CachedImagePaint=true in the command line.

Dymola Python Interface

Anaconda

Windows

  • In Explorer, go to your Anaconda path.
    • e.g., C:\Users\USERNAME\AppData\Local\Continuum\anaconda3\Lib\site-packages
    • AppData is a "hidden" folder and can be seen by going to View and checking Hidden Items
  • Create a text file and rename to a reasonable name
    • e.g., dymola-python-interface.pth
    • When changing the text file extension you should see .txt. If that is not visible go to View and check File name extensions.
  • Open up dymola-python-interface.pth and add the path to the dymola.egg file. Save and close.
    • e.g., C:\Program Files\Dymola 2021\Modelica\Library\python_interface\dymola.egg
  • Open a new anaconda tool (e.g., jupyter notebook, terminal, or spyder) and dymola should not be able to be loaded.
    • import dymola

Dymola Scripting

Looping

d={.2,.4,.6,.8};
openModel("TRANSFORM.Blocks.Examples.EasingRamp_Test");
for i in 1:4 loop
  easingRamp.duration = d[i];
  translateModel("TRANSFORM.Blocks.Examples.EasingRamp_Test");
  simulate();
  //simulateExtendedModel("TRANSFORM.Blocks.Examples.EasingRamp_Test",initialNames={"easingRamp.duration"},initialValues={d[i]},finalNames={"easingRamp.y"});
  system("copy dsres.mat results"+String(i) +".mat");
end for;
Clone this wiki locally