Search code examples
modelicadymola

What is the difference between check a model and tranlate a model in Dymola


I am using Dymola, but I am not sure about the difference between check a model and translate a model. So I did a test.

Here is the code of the connector and the model file

connector Port
  flow Real Q;
  Real P;
  Real T;
end Port;
model Inlet
  parameter Real Q = 1;
  parameter Real P = 2;
  parameter Real T = 3;
  Port a;
equation 
  a.Q = Q;
  a.P = P;
  a.T = T;
end Inlet;

If I check the model, Dymola would generate a .mof file:

model lab.Inlet
parameter Real Q = 1;
parameter Real P = 2;
parameter Real T = 3;

Real a.Q;
Real a.P;
Real a.T;

// Equations and algorithms

  // Component 
  // class lab.Inlet
  equation
    a.Q = Q;
    a.P = P;
    a.T = T;

end lab.Inlet;

If I translate the model, the .mof file is like the following:

model lab.Inlet
parameter Real Q = 1;
parameter Real P = 2;
parameter Real T = 3;

Real a.Q;
Real a.P;
Real a.T;

// Equations and algorithms

  // Component 
  // class lab.Inlet
  equation
    a.Q = Q;
    a.P = P;
    a.T = T;
    a.Q = 0.0;

end lab.Inlet;

I could see that in the .mof file generated by translation there is one more line: a.Q = 0.0;.

So, my question is what is the detailed difference between check and translation? Is there a detailed document for this topic?


Solution

  • Checking a model should just create a small intermediate model that can be checked for logical errors (#eqs == #unknowns, etc.) but is not used for symbolic manipulations afterwards.

    Instantiating a model should create a flat model that can be used for symbolic manipulations.

    Translating a model should first run instantiation and afterwards perform symbolic manipulations (BLT, etc.) and actually create simulation code.

    OpenModelica kind of does it this way, i can't for sure tell what dymola does, but i guess this gives you an idea. I don't know if there is any further documented explanation for this.