- Index
- » Programming
- » Modelica Language
- » inner / outer verifcation issue
inner / outer verifcation issue
inner / outer verifcation issue
Hello,
I'm reproducing the simple example of Modelica Specification 3.4, given in section 5.4 «Instance Hierarchy Name Lookup of Inner Declarations», adding few dummy equations to have it ballanced:
Code:
model simple
class A
outer Real T0;
Real u ;
equation
u=T0 ;
end A;
class B
inner Real T0;
A a1, a2; // B.T0, B.a1.T0 and B.a2.T0 is the same variable
equation
T0= 45;
end B;
end simple;
checking the whole thing under OpenModelica [1.17.0] leads to the following error for test of class A:
Error Buffer:
[simple:3:4-3:17:writable] Error: The model can't be instantiated due to top-level outer component ‘T0‘, it may only be used as part of a simulation model.
[simple:3:4-3:17:writable] Warning: An inner declaration for outer component T0 could not be found and was automatically generated.
The flat model seems however correct and compiles and run OK. Model tests Ok in Dymola [2021].
it is not clear to me why the simple model from the Modelica Specification generates an error in the checking. Is it me doing it the wrong way ?
Re: inner / outer verifcation issue
If you use the "Check All Models" button in OMEdit it'll check all nested models, including simple.A which would give the messages you get. The messages are not really an error as such, they just tell you that simple.A can't be simulated since it contain a top-level outer element and thus can only be used as part of another model (like simple.B in this case).
If you just want to check simple.B you can use the "Check Model" button instead with simple.B selected.
- perost
- 114 Posts
Re: inner / outer verifcation issue
- perost
- 114 Posts
- Index
- » Programming
- » Modelica Language
- » inner / outer verifcation issue