Opened 6 years ago

Closed 6 years ago

#5020 closed defect (fixed)

Issue with NFInst.instantiate

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

Description

Please check ThermoPower.Test.WaterComponents.WaterPump. The NFInst.instantiate module fails immediately with

[ThermoPower 3.1/Water.mo:4340:5-4341:71:writable] Error:
Expected Pump to be a class, but found component instead.

I find this quite weird; the offending code is:

model PumpNPSH
  extends Pump(redeclare replaceable package Medium = StandardWater
        constrainedby Modelica.Media.Interfaces.PartialTwoPhaseMedium);

and the Pump model definition immediately preceds the PumpNPSH definition inside the Water package - why is it interpreted as a component and not as a class?

Change History (2)

comment:1 by Per Östlund, 6 years ago

Component: *unknown*New Instantiation
Owner: changed from somebody to Per Östlund

comment:2 by Per Östlund, 6 years ago

Resolution: fixed
Status: newclosed

Fixed in 3bf72eb (with a slightly better fix incoming). The issue was the Water.PumpNPSH Pump component in the WaterPump model, which extended from Pump. The extends ended up being looked up with the Pump component as scope, and the lookup saw that the scope had the same name as it was looking for and returned it.

That's not the correct behaviour when starting the lookup from a component scope, so the fix is simply to make sure that the lookup uses the name of the component's class and not the component's name.

Note: See TracTickets for help on using tickets.