-
Notifications
You must be signed in to change notification settings - Fork 34
Type Declarations
Guidelines regarding the declaration of types, i.e. default values, value range or units.
Declare variables and final parameters that are not of interest to users as protected.
If a parameter value can range over a large region, do not provide a default value, i.e. nominal mass flow rates.
If a parameter value does not vary significantly, provide a default by using its start attribute. Use
parameter Real eps(start=0.8)"Heat exchanger effectiveness";
instead of
parameter Real eps = 0.8 "Heat exchanger effectiveness";
.
Providing default values for all parameters can lead to errors that are difficult to detect, since a modeller may have forgotten to provide a meaningful value (the model simulates, but gives wrong results due to wrong parameter values).
If a parameter value can be precomputed based on other parameters, set its default value to this equation. Use
parameter Medium.MassFlowRate m_flow_small(start = 1E-4*m_flow_nominal);
.
If a parameter value should not be changed by a user, use the final
keyword.
For parameters and variables, provide values for the min
and max
attribute where applicable.
Be aware, that these bounds are not enforced by the simulator.
If the min
and max
attribute are set, each violation of these bounds
during the simulation may raise a warning. (Simulators may allow to suppress these warnings.)
For any variable or parameter that may need to be solved numerically, provide a value for the start
attribute
All variables that have a physical correspondence, including physical ratios, must have a unit. Use (derived) SI units, and where possible, use types from Modelica.SIunits
. Non-SI units are to be kept at an absolute minimum, and they must be declared as protected
.
Declare all public parameters before protected ones.