.ModelicaReference.Operators.'getInstanceName()'

getInstanceName()

Information

Returns a string with the name of the model/block that is simulated, appended with the fully qualified name of the instance in which this function is called.

Syntax

getInstanceName()

Description

If this function is not called inside a model or block (e.g., the function is called in a function or in a constant of a package), the return value is not specified.

Examples

package MyLib
  model Vehicle
    Engine engine;
    ...
  end Vehicle;
  model Engine
    Controller controller;
    ...
  end Engine;
  model Controller
  equation
    Modelica.Utilities.Streams.print("Info from: " + getInstanceName());
  end Controller;
end MyLib;

If MyLib.Vehicle is simulated, the call of getInstanceName() returns Vehicle.engine.controller.


Generated at 2025-06-06T18:20:43Z by OpenModelicaOpenModelica 1.25.0 using GenerateDoc.mos