pythondymolasdf

How to save the results in sdf file format after simulation through python Api in Dymola


By default

dymola.simulateModel("Modelica.Mechanics.Rotational.Examples.CoupledClutches", 0.0, 1.0,0, 0.0,"Dassl",0.0001, 0.0, "res")

generates .mat file

Suppose if we want to generate txt file then below line is used

dymola.experimentSetupOutput(textual=True)

But if I want to save the result in sdf file format what should I do?


Solution

  • I may be wrong, but I think there is no such flag in Dymola to output the simulation result directly as sdf.

    The sdf file is generated after the simulation has finished with dsres2sdf.exe, found in the bin folder of the Dymola installation directory.

    So you can simply perform the simulation and then call the exe from python to convert your Dymola result file into a sdf file.

    Usage: dsres2sdf.exe <result.mat> <result.sdf>