Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

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.

Re: inner / outer verifcation issue

Perost, my goal is to check all models including nested models. The message states «Error», which I understand «something is wrong in the code». I would understand a «warning» message instead rather than «error».

Re: inner / outer verifcation issue

You're right, it should just be a warning when checking a model. I've changed it in PR 7532.

Re: inner / outer verifcation issue

check. thanks Perost.

There are 0 guests and 0 other users also viewing this topic
You are here: