Opened 6 years ago

Closed 6 years ago

#5375 closed defect (invalid)

Command extend/redeclare for constants does not work properly OM 1.13.0 Linux

Reported by: jan.peter.axelsson@… Owned by: somebody
Priority: normal Milestone: Future
Component: *unknown* Version: v1.13.0
Keywords: Cc:

Description

Command extend/redeclare for constants does not work properly OM 1.13.0 Linux

See

https://stackoverflow.com/questions/54998306/modelica-how-to-extend-a-minimal-medium-package

Attachments (2)

DEMO_v9.mo (5.1 KB ) - added by jan.peter.axelsson@… 6 years ago.
Running "test" will give an error message
d9_app7_test.py (2.2 KB ) - added by jan.peter.axelsson@… 6 years ago.
Application code to be used together with library code DEMO_v9 you already got

Download all attachments as: .zip

Change History (3)

by jan.peter.axelsson@…, 6 years ago

Attachment: DEMO_v9.mo added

Running "test" will give an error message

comment:1 by Per Östlund, 6 years ago

Resolution: invalid
Status: newclosed

I can't reproduce the issue you describe in the link, the model flattens just fine using the latest version of OM. You might want to try OM 1.13.2, although I don't think we've fixed any redeclare issues since 1.13.0.

However, the model is not valid, because DEMO_v9.Equipment.PumpType extends from EquipmentMedium which is a replaceable class. Extending from a replaceable class is not allowed in Modelica, see section 6.2.1 (Transitively non-Replaceable) in the Modelica specification.

We've been working on a new instantiation for some time now, which will be the default instantiation in OM 2.0.0. Trying to compile the model with it (using the compiler flag -d=newInst) correctly gives the error:

[DEMO_v9.mo:59:15-61:22:writable] Notification: From here:
[DEMO_v9.mo:64:4-64:27:writable] Error: Class 'EquipmentMedium' in 'extends EquipmentMedium' is replaceable, the base class name must be transitively non-replaceable.

Our current frontend does not check this restriction, which can cause all sorts of weird behaviour.

I'm closing this ticket since there doesn't seem to be anything to fix here, but you can still ask questions about your model in this ticket if you so wish.

by jan.peter.axelsson@…, 6 years ago

Attachment: d9_app7_test.py added

Application code to be used together with library code DEMO_v9 you already got

Note: See TracTickets for help on using tickets.