Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add unit conversions using Dymola

In Modelica Standard Library, the unit of SpecificEnergy and SpecificEnthalpy is "J/kg", but I'd like to use "kJ/kg" as the display unit, my first thought is to modify the Modelica Standard Library, but I am not sure if it will cause unexpectable issues, so I want to find a way to customize my own Modelica Standard Library. In this way, I could choose to use my own version or the standard one.

My question is: Is there some way like this?

enter image description here enter image description here

like image 276
Jack Avatar asked Dec 05 '25 04:12

Jack


1 Answers

In addition to using defineUnitConversion there is another possibility for prefixed units such as "kJ/kg" or "MJ/kg": just define a variable with that displayUnit in the model by creating e.g.,

  SpecificEnthalphy myEnthalpy(displayUnit="MJ/kg")=...;

and then simulating the model.

No need to specify a conversion factor in this case (it is found automatically).

like image 139
Hans Olsson Avatar answered Dec 07 '25 06:12

Hans Olsson