Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#4241 closed defect (invalid)

Replaceable and redeclare fails for complex structures

Reported by: Christian Kral <dr.christian.kral@…> Owned by: Adeel Asghar
Priority: high Milestone: 1.11.0
Component: OMEdit Version:
Keywords: partial redeclare Cc: a.haumer@…

Description

Consider ExampleA of the package Redeclaration

package Redeclaration
  extends Modelica.Icons.Package;
  model ExampleA
    extends PartialExample(
      redeclare parameter Redeclaration.Records.RecordA mainRecord);
  end ExampleA;

  model PartialExample "Partial example"
    extends Modelica.Icons.Example;
    replaceable parameter Redeclaration.Records.BaseRecord mainRecord;
  end PartialExample;

  package Records
    extends Modelica.Icons.Package;
    partial record BaseRecord
      extends Modelica.Icons.Record;
      replaceable parameter Redeclaration.SubRecords.BaseSubRecord subRecord "Sub record";
      parameter Integer i = 3 "Integer parameter";
      parameter Real r = 1.0  "Real parameter";
    end BaseRecord;

    record RecordA "Spezialization of record"
      extends Redeclaration.Records.BaseRecord(redeclare parameter Redeclaration.SubRecords.SubRecordA subRecord);
    end RecordA;
  end Records;

  package SubRecords
    extends Modelica.Icons.Package;
    record BaseSubRecord
      extends Modelica.Icons.Record;
      parameter Integer i_sub = 1 "Integer of sub record";
      parameter Real r_sub = 1.0 "Real of sub record";
    end BaseSubRecord;

    record SubRecordA "Specialization of sub record"
      extends Redeclaration.SubRecords.BaseSubRecord;
      parameter Real A_sub "Additional parameter of sub record";

    end SubRecordA;
  end SubRecords;
  annotation (uses(Modelica(version="3.2.2")));
end Redeclaration;

Run Redeclaration.ExampleA. The variable browser show reveal the following parameters:

  • mainRecord.A this parameter is missing but should appear
  • mainRecord.i
  • mainRecord.r
  • mainRecord.subRecord.A_sub
  • mainRecord.subRecord.i_sub
  • mainRecord.subRecord.r_sub

I discovered the problem already quite some time ago. However, I reduced the complexity of the original problem to demonstrate the issue here.

Possibly, tickets #4012, #4172, #4179 and #4235 are related with this issue.

Change History (3)

comment:1 by Christian Kral <dr.christian.kral@…>, 8 years ago

I have to revise the provided code...

comment:2 by Christian Kral <dr.christian.kral@…>, 8 years ago

Resolution: invalid
Status: newclosed

This ticket is invalid; OpenModelica simulates the model I intended to show with no issues.

comment:3 by Adeel Asghar, 8 years ago

Milestone: Future1.11.0
Note: See TracTickets for help on using tickets.