Search code examples
modelicadymola

decrease the mat file size of Dymola result


The result of Dymola simulation is .mat file, which might be very big. Here is a series of results of a Power plant model, the simulation time interval is 0-100000s, but I only need the data during 90000 to 100000s, so is there any way to let Dymola only output the data of 90000 to 100000s?

enter image description here


Solution

  • There is a section called "Variable frequency of output points" in the Dymola User manual. There you'll find an explanation on how Advanced.Simulation.VariableInterval=true and statements like

    when time >=… then
      Dymola.Simulation.SetOutputInterval(…);
    end when;
    

    will enable you to set the output interval depending on the simulation time.

    The example shown there is:

    model VariableOutputInterval "demonstrate the use of variable output interval in a model"
      Real x;
    equation
      x = sin(10*time);
      
      when initial() then
        Dymola.Simulation.SetOutputInterval(0.1);
      end when;
    
      when time >= 0.5 then
        Dymola.Simulation.SetOutputInterval(0.05);
      end when;
    
      when time >= 1.1 then
        Dymola.Simulation.SetOutputInterval(0.002);
      end when;
    end VariableOutputInterval;
    

    Also there are two notes:

    • The only way to “reset” the interval length to the one in the simulation setup is to explicitly set that interval, this is done in the last when statement above.
    • You must have a separate when statement for each time.