Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mos code to take screenshot automatically after simulation in dymola

I am using Dymola, and I want a Modelica script that enables to capture the diagram of my model after simulation: example

I know how to do it manually in Dymola, so if I click "Tools" - " Image", then I can export the image. That's why I think there would be a way to do it with a Modelica script.

I tried to look into the "Dymola User Manual","commands window" in Dymola and google it, but I couldn't find out the solution so far.

Does anyone know whether it is possible or not? If your answer is yes, then could you help me with this topic?

Thanks in advance!

*Maybe previous picture was confusing, so I updated the picture. My goal is to take screenshots with updated number. (eg. 5K of subcooling and 6000W of condenser performance)

like image 397
y.min Avatar asked Nov 19 '25 17:11

y.min


1 Answers

Seems it should be documented in a better way, but there is:

function exportDiagram "Export the diagram layer to file"
  input  String path  "File path. Supported file formats are PNG and SVG.";
  input  Integer width  := 400 "Width";
  input  Integer height  := 400 "Height";
  input  Boolean trim  := true "Remove unnecessary space around the image.";
  input  String modelToExport  := "" "Model path. Empty means model active one.";
  input  Boolean evaluate  := false "Evaluate default values of parameters.";
  output  Boolean result  "true if successful";
end exportDiagram;

e.g., exportDiagram("Test.png", modelToExport="Modelica.Mechanics.Rotational.Examples.CoupledClutches")

In this specific case there are some rests of disabled parts, you can reduce it with the argument evaluate=true (not to be confused with other Evaluate-flags).

like image 198
Hans Olsson Avatar answered Nov 22 '25 05:11

Hans Olsson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!