classConventions
Conventions
Extends from Modelica.Icons.Information (Icon for general information packages).
Information
The Buildings library uses the following conventions,
which largely are based on the conventions of the Modelica Standard Library.
Package structure
Packages have usually the following subpackages:
-
UsersGuidecontaining an overall description of the library and how to use it. -
Examplescontaining models demonstrating the usage of the library. -
Validationcontaining typically small models that validate a certain behavior of a model. -
Interfacescontaining connectors and partial models. -
Typescontaining type, enumeration and choice definitions.
Naming
-
Class names of models, blocks and packages should start with an upper-case letter and be a
noun or a noun with a combination of adjectives and nouns.
Use camel-case notation to combine multiple words, such as
HeatTransfer. Don't repeat higher level package names, for example, rather thanChillers.CarnotChiller, useChillers.Carnot. -
Instance names should be a combination of the first three
characters of a word, such as
preDrofor pressure drop model. Where applicable, a single character can be used if this is generally understood, such asTfor temperature,pfor pressure,ufor control input andyfor control output signal. As needed, these can be augmented, for example a controller that outputs a control signal for a valve and a damper may outputyValandyDam. -
The following variables are frequently used for physical quantities:
Tfor temperature,pfor pressure,dpfor pressure difference,Pfor power,Efor energy (orQfor thermal energy),Xfor mass fraction,Q_flowfor heat flow ratem_flowfor mass flow rate andH_flowfor enthalpy flow rate.
-
The nomenclature used in the package
Buildings.Utilities.Psychrometrics
is as follows,
-
Uppercase
Xdenotes mass fraction per total mass. -
Lowercase
xdenotes mass fraction per mass of dry air. -
The notation
z_xydenotes that the function or block has outputzand inputsxandy. -
The symbol
pWdenotes water vapor pressure,TDewPoidenotes dew point temperature,TWetBuldenotes wet bulb temperature, andTDryBul(or simplyT) denotes dry bulb temperature.
-
Uppercase
-
Control input signals usually start with
uand control output signals usually start withy, unless use of the physical quantity is clearer. -
The following strings are frequently used:
-
Prefix
use_for conditionally enabled input signals, such asuse_T_infor enabling an input connector for temperature in Buildings.Fluid.Sources.Boundary_pT, or asuse_enthalpyin Buildings.Controls.OBC.ASHRAE.G36.AHUs.MultiZone.VAV.Economizers.Subsequences.Enable to flag if it should evaluate outdoor air enthalpy in addition to temperature. -
Prefix
have_if a controller has a certain input, such ashave_CO2Senin Buildings.Controls.OBC.ASHRAE.G36.TerminalUnits.Reheat.Controller if the zone has a CO2 sensor. -
Suffix
_flowfor a flow variable, such asQ_flow,m_flowandV_flow. See Buildings.Fluid.Sensors.VolumeFlowRate. -
Suffix
_nominalfor the design or nominal capacity, i.e.,Q_flow_nominalis the capacity of a device that it has at full load, andm_flow_nominalis the design mass flow rate. See Buildings.Fluid.HeatExchangers.HeaterCooler_u. -
Suffix
_smallfor a small value which is typically used for regularization (to ensure a numerically robust implementation). -
Suffix
Setfor set point. -
Suffix
_min(_max) for minimum (maximum), such asTSupCoo_minfor the lowest cooling supply air temperature setpoint in Buildings.Controls.OBC.ASHRAE.G36.AHUs.MultiZone.VAV.SetPoints.SupplyTemperature.
-
Prefix
-
The two connectors of a domain that have identical declarations
and different icons are usually distinguished by
_a,_bor_p,_n. Examples are fluid portsport_aandport_bor electrical connectorsterminal_pandterminal_n.
Documentation
-
In the html documentation, start additional headings with
h4. (The headingsh1, h2, h3must not be used, because they are utilized from the automatically generated documentation.) - Comments must be added to each class (package, model, function etc.).
- The first character should be upper case.
- For one-line comments of parameters, variables and classes, no period should be used at the end of the comment.
Graphical display
- The instance name of a component is always displayed in its icon (using the text string "%name") in blue color.
- A connector class has the instance name definition in the diagram layer and usually not in the icon layer, unless this helps with usability.
- The value of main parameters, such as nominal capacity, are displayed in the icon in black color in a smaller font size as the instance name if this helps with usability.
Miscellaneous
- Where applicable, all variable must have units, also if the variable is protected.
- Each class (i.e., model, block and function) must be used in an example or validation case.