Problem Importing Functions from Subpackages in a encapsulated Model
The OpenModelica fails to import the function in a subpackage (c.f. EncapsulatedError.MainModel). Model without "encapsulated" keyword works (c.f. EncapsulatedError.MainModelNotEncapsulated) and an "encapsulated" model can import a function at the same level (c.f. EncapsulatedError.MainModelSameLevel) .
The model is also attached in the ticket.
The error message for simulating EncapsulatedError.MainModel is the following:
[1] 16:53:16 Translation Error
[EncapsulatedError: 8:5-8:34]: Class Functions.myFunction not found in scope EncapsulatedError.MainModel (looking for a function or record).
[2] 16:53:16 Translation Error
Error occurred while flattening model EncapsulatedError.MainModel
package EncapsulatedError
encapsulated model MainModel
import Modelica.Blocks.Sources.Ramp;
import EncapsulatedError.Functions.myFunction;
Ramp ramp;
Real myOutput;
equation
myOutput = myFunction(ramp.y);
end MainModel;
model MainModelNotEncapsulated
import Modelica.Blocks.Sources.Ramp;
import EncapsulatedError.Functions.myFunction;
Ramp ramp;
Real myOutput;
equation
myOutput = myFunction(ramp.y);
end MainModelNotEncapsulated;
encapsulated model MainModelSameLevel
import Modelica.Blocks.Sources.Ramp;
import EncapsulatedError.myFunctionSameLevel;
Ramp ramp;
Real myOutput;
equation
myOutput = myFunctionSameLevel(ramp.y);
end MainModelSameLevel;
function myFunctionSameLevel
input Real u;
output Real y;
algorithm
y := 3 * u;
end myFunctionSameLevel;
package Functions
function myFunction
input Real u;
output Real y;
algorithm
y := 3 * u;
end myFunction;
end Functions;
annotation(
uses(Modelica(version = "3.2.2")));
end EncapsulatedError;