I have recently started using Modelica (OpenModelica) as a modeling tool and I am facing a problem regarding the use of inner/outer functionalities. I am trying to create an environment model containing values for ambient temperature and pressure, so that other models can use this values. I have tried to do so with inner and outer keywords but I keep receiving the following warning:
No corresponding 'inner' declaration found for component .Real component.T0 declared as 'outer '. The existing 'inner' components are: .Real ambient.T0; defined in scope: Test.Ambient. Check if you have not misspelled the 'outer' component name. Please declare an 'inner' component with the same name in the top scope. Continuing flattening by only considering the 'outer' component declaration.
Below these lines you can see a simplification of the code I am trying.
The three models below these lines are contained in a package named Test.
The model for ambient in which a temperature T0 is defined as inner:
within Test;
model Ambient
inner Real T0;
equation
T0 = 300;
end Ambient;
The model of a component that tries to call T0 via outer operator:
within Test;
model Component
Real T;
outer Real T0;
parameter Real k = 2;
equation
T = k * time + T0;
end Component;
Both models ambient and component are dragged and dropped in the combined model:
within Test;
model System
Test.Ambient ambient annotation(
Placement(visible = true, transformation(origin = {-30, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Test.Component component annotation(
Placement(visible = true, transformation(origin = {30, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
end System;
When running System I get the aforementioned warning. Also, there is one variable more than equations (which makes sense since it is not being able to connect Component.T0 with Ambient T0)