.Dynawo.UsersGuide.NamingConventions

Information

This section contains the naming and style guidelines for the Dynawo library development. If you want to contribute to the library, please make sure you follow them strictly, to ensure a consistent style throughout the whole library.

When writing a Modelica model, please respect the general Modelica conventions and follow the recommendations below.

Please always use the English language for the code and comments.

Electrical conventions

For currents and powers, the receptor convention is normally followed, i.e. the value is positive when entering the device. It is recommended to draw a small scheme indicating the conventions.

The name of the electrical connector should be terminal for an injector type model, and terminal1 and terminal2 for a branch type model.

Package structure conventions

Each dynamic model should have a .mo file. These models can extend base models. All base models should be gathered in a specific base package.

Each init model should have a .mo file. These models can extend base models that should be gathered in a specific base package.

In package.order, the package containing the base models should be indicated first, followed by each pair of dynamic and initialization models.

Naming conventions

Generalities

Use package namespaces as much as possible to avoid naming conflicts. Do not duplicate parent namespaces in the children model names.

Please follow the Modelica naming conventions.

The names of component instances of a base model should not be used again in the models which extend the base model.

In addition to this, please follow the additional naming conventions below (in that order):

Example: UMax0Pu.

Exceptions for physical variables

There are some exceptions for the physical variables. Please refer to the list below:

Exceptions for initialization models

Initialization models name should end with _INIT. There can be several initialization models for one dynamic model.

The initialization models variables are the parameters of the dynamic models so they should start with an upper case letter.

In an initialization model, the names of component instances should end in "Init", and this ending should never be used for instances of dynamic models.

Types conventions

Preferably use the types defined in the Dynawo.Types package and avoid using plain Real variables.

Model structure conventions

Generalities

Respect the following order while writing or updating a model:

Public/Protected conventions

NB: initial parameters can be public if the model is used in an OpenModelica test case. 

Comments and documentation conventions

Comments should start with a capital letter.

In addition to comments, always fill the documentation part of your model (available in the documentation browser) by explaining what are the hypothesis done in the model and for which simulation the model could be used. If it is relevant, also include graphical views helping to understand the model's behavior.  

Model implementation

Graphical view

Try to use one of the Modelica icons or Dynawo icons when creating a model.

Preferred view

Always set a preferred view to your model such as it will be opened by default in this view by Modelica-based environments:

Blank lines and indentation

Follow these rules regarding blank lines and indentation:
Two spaces must be used for indentation.


Generated at 2024-12-03T19:25:34Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos