.ModelicaReference.'import'

Information

Import classes

Examples

class Lookup
  import SI = Modelica.Units.SI; // #1 (Try to avoid renaming imports!)
  import Modelica.Math.*; // #2 (Try to avoid wildcard imports!)
  import Modelica.Mechanics.Rotational; // #3
  import Modelica.Units.SI.{Molality, Molarity}; // #4

  SI.Torque torque; // due to #1 (Modelica.Units.SI.Torque)
  Rotational.Components.Inertia inertia; // due to #3 (Modelica.Mechanics.Rotational.Components.Inertia)
  Molarity c = 1; // due to #4 (Modelica.Units.SI.Molarity)
equation
  torque = sin(time); // due to #2 (Modelica.Math.sin)
  ...
end Lookup;

Syntax

See section on import_clause in the Modelica Grammar.

Description

Using import statements extends the static name lookup to additional import names. The generated import names are:

Note

Especially the renaming and wildcard import statements should be avoided since they might lead to name-lookup conflicts.


Generated at 2024-04-26T18:16:04Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos