Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

model flattening error with Media type partial packages

model flattening error with Media type partial packages

Hi,
I get a flattening error message when using a Modelica.Media type partial package structure in combination with a replaceable partial record (thermodynamic state record).

A have the following structur in my Media models: (MyReplaceablePartialModelLevelOne corresponds to BaseProperties)

Code:



package Test

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 Test;

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!

In Dymola both versions work.

Is that worth a bug report? I think both versions a correct Modelica, or?

I am now on revision 11620.

Thanks!

Edited by: zav1984 - Apr-05-12 14:15:26
There are 0 guests and 0 other users also viewing this topic
You are here: