Opened 13 years ago

Last modified 4 years ago

#1729 closed defect

Flattening error with modelica media type redeclaration of a record — at Version 1

Reported by: Fritz Zaversky Owned by: Fritz Zaversky
Priority: high Milestone: 1.16.0
Component: Frontend Version: trunk
Keywords: Cc: Fritz Zaversky

Description (last modified by Martin Sjölund)

Here the test model: 

When I redeclare the record in level two it doesnt work. Following message: Error: Error occurred while flattening model Test.TestModel

When I do it on level three it works!

package RedeclareRecordTest

partial package MyPartialPackageLevelOne

  constant String level = "LevelOne";

  replaceable partial record MyRecord
     //record variable to be defined a level higher
  end MyRecord;

replaceable partial model MyReplaceablePartialModelLevelOne 

    Real variableOne;
    Real variableTwo;
    Real variableThree;
    Real variableFour;

    MyRecord myRecord;

    equation
     variableThree = 3;
     variableFour = 4;
  end MyReplaceablePartialModelLevelOne;

end MyPartialPackageLevelOne;

partial package MyPartialPackageLevelTwo

  extends MyPartialPackageLevelOne(level = "LevelTwo");

  redeclare record extends MyRecord
    Real recordVariable;
  end MyRecord;

end MyPartialPackageLevelTwo;

////finally used package

package MyUsedPackage

  extends MyPartialPackageLevelTwo(final level = "LevelThree");

  /* this works!
    redeclare record extends MyRecord
      Real recordVariable;
    end MyRecord;
  */
    redeclare model extends MyReplaceablePartialModelLevelOne
    equation
     myRecord.recordVariable = variableOne;
    end MyReplaceablePartialModelLevelOne;

end MyUsedPackage;

  model TestModel

  package MyPackage = MyUsedPackage;

  MyPackage.MyReplaceablePartialModelLevelOne modelFromPackage;

  equation

    modelFromPackage.variableOne =1;
    modelFromPackage.variableTwo =2;

end TestModel; 

end RedeclareRecordTest;

Change History (1)

comment:1 by Martin Sjölund, 12 years ago

Cc: zav1984, → zav1984
Component: Backend
Description: modified (diff)
Note: See TracTickets for help on using tickets.