.ModelicaReference.'encapsulated'

Information

Break lookup in hierarchy

Examples

encapsulated model Test
  import Modelica.Mechanics.Rotational;

  Rotational.Components.Inertia inertia; // lookup successful
  Modelica.Mechanics.Translational.SlidingMass slidingMass; // lookup fails
equation
  ...
end Test;

Syntax

See section on class_definition in the Modelica Grammar.

Description

When an element, equation or algorithm is instantiated, any name is looked up sequentially in each member of the ordered set of parents until a match is found or a parent is encapsulated. In the latter case the lookup stops except for the predefined types, functions and operators defined in this specification. For these cases the lookup continues in the global scope, where they are defined. [E.g., abs is searched upwards in the hierarchy as usual. If an encapsulated boundary is reached, abs is searched in the global scope instead. The operator abs cannot be redefined in the global scope, because an existing class cannot be redefined at the same level.]


Generated at 2024-03-27T19:15:56Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos