Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#5873 closed discussion (invalid)

Partial model using undeclared variable in equation works with OF but not with NF

Reported by: Karim Adbdelhak Owned by: Per Östlund
Priority: high Milestone: Future
Component: New Instantiation Version:
Keywords: Cc: Francesco Casella, Karim Adbdelhak

Description

The model M from the following package was compilable in the old but not in the new frontend:

package partialstuff

partial model PM
equation
  v = 10;
end PM;

model M
  extends PM;
  Integer v;
end M;

end partialstuff;

The error message for the NF is

[1] 09:48:59 Translation Error
[partialstuff: 5:3-5:9]: Variable v not found in scope PM.

Is this expected behaviour? Does someone know what the specification says about this?

Change History (3)

comment:1 by Per Östlund, 5 years ago

Resolution: invalid
Status: newclosed

Yes, that's the expected behaviour, the OF handles extends incorrectly. If you try it with e.g. Dymola you'll get the same error as with the NF.

Version 0, edited 5 years ago by Per Östlund (next)

comment:2 by Karim Adbdelhak, 5 years ago

Thanks!

comment:3 by Francesco Casella, 5 years ago

The point of partial is to leave some behaviour (-> equations) unspecified, to be later filled in by child models.

To the contrary, writing equations with undeclared variables would be odd in a declarative language. Modelica is not Matlab :)

Note: See TracTickets for help on using tickets.