Search code examples
modelicadymola

Error when using an inner variable of a component


I am using Thermal Power Library from Modelon. There is a condenser component in the Thermal Power Library which is used for the modeling of power plants. The default heat transfer area for the wall_2 in the condenser component is 0.8*A_heat_tot, the variable of A_heat_tot is an inner variable in the condenser component, but when I try to use this variable, there is an error showing that this variable isn’t defined.

My question is that If I can use the inner variable directly. If not, how should I use it?

enter image description here enter image description here enter image description here


Solution

  • Short answer: You need to address the variable with its full path, i.e. wall_2.A_heat_tot.

    A_heat_tot is define in StandardWall and can thus be referred to directly inside the class. However, when you are making changes to A_heat from outside the instance of StandardWall (i.e. outside wall_2) you must point to the origin of A_heat_tot since it is otherwise not known in the scope from which you are trying to use it.

    Likewise, if you are making the modification in you simulation model (Preheater_Model_Validation2) you must use the full path, i.e. hex.wall_2.A_heat = hex.A_heat_tot

    By the way, this has nothing to do with the inner qualifier in the Modelica language.