Flattening error with modelica media type redeclaration of a record
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;
Seems to work fine in both the old and the new frontend now.