Opened 11 years ago
Closed 11 years ago
#2562 closed defect (duplicate)
Problem with code generation - array in record
Reported by: | Francesco Casella | Owned by: | Lennart Ochel |
---|---|---|---|
Priority: | critical | Milestone: | 1.9.1 |
Component: | Code Generation | Version: | trunk |
Keywords: | Cc: | Lennart Ochel |
Description
The compilation of model ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator in the testsuite fails due to incorrectly generated C code:
ThermoPower.Examples.BraytonCycle.OpenLoopSimulator_06inz.c:3762: error: '$Pplant$PPressDrop2$Pgas$Pstate$PX$lB5$rB' undeclared (first use in this function)
plant.PressDrop2.gas.state is a record, that contains the array X[4] - apparently the code generator doesn't like this.
Note that this problem shows up in all models using gas mixtures from Modelica.Media
Change History (13)
comment:1 by , 11 years ago
Status: | new → accepted |
---|
comment:2 by , 11 years ago
comment:3 by , 11 years ago
It seems that you point to two different examples:
- ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator
- ThermoPower.Examples.BraytonCycle.OpenLoopSimulator
I cannot find the second one in the test suite.
The first one produces the following error output:
ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator_functions.o: In function `omc_Modelica_Blocks_Types_ExternalCombiTable2D_destructor': ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator_functions.c:(.text+0x670): undefined reference to `ModelicaStandardTables_CombiTable2D_close' ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator_functions.o: In function `omc_Modelica_Blocks_Types_ExternalCombiTable2D_constructor': ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator_functions.c:(.text+0x6ed): undefined reference to `ModelicaStandardTables_CombiTable2D_init' ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator_functions.o: In function `omc_Modelica_Blocks_Tables_CombiTable2D_getTableValue': ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator_functions.c:(.text+0x75d): undefined reference to `ModelicaStandardTables_CombiTable2D_getValue' collect2: ld returned 1 exit status make: *** [omc_main_target] Error 1
comment:4 by , 11 years ago
Those are old total models in the testsuite... Not the new ones that we are considering. Get it from svn or by using make GITLIBRARIES=Yes
.
comment:6 by , 11 years ago
No, we cannot put all libraries in there :)
It's under https://test.openmodelica.org/libraries/ThermoPower/BuildModelRecursive.html
comment:7 by , 11 years ago
I get the follwoing Errors using omc 1.9.1+dev (r18989) (RML version) and the branch version of ThermoPower 3.0:
ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator
Simulation failed for model: ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator [ThermoPower/Gas.mo:100:5-102:11:writable] Error: Cannot resolve type of expression cardinality(in_X) == 0. The operands have types Integer[4], Integer in component plant.SourceP1. Error: Error occurred while flattening model ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator
ThermoPower.Examples.BraytonCycle.OpenLoopSimulator
Simulation failed for model: ThermoPower.Examples.BraytonCycle.OpenLoopSimulator [ThermoPower/Gas.mo:100:5-102:11:writable] Error: Cannot resolve type of expression cardinality(in_X) == 0. The operands have types Integer[4], Integer in component plant.SourceP1. Error: Error occurred while flattening model ThermoPower.Examples.BraytonCycle.OpenLoopSimulator
comment:10 by , 11 years ago
I see.
ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator
ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator_08bnd.c: In function ‘ThermoPower_Examples_BraytonCycle_ClosedLoopSimulator_eqFunction_730’: ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator_08bnd.c:496: error: ‘$Pplant$PPressDrop2$Pgas$Pstate$PX$lB5$rB’ undeclared (first use in this function) ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator_08bnd.c:496: error: (Each undeclared identifier is reported only once ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator_08bnd.c:496: error: for each function it appears in.) ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator_06inz.c: In function ‘ThermoPower_Examples_BraytonCycle_ClosedLoopSimulator_eqFunction_422’: ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator_06inz.c:3733: error: ‘$Pplant$PPressDrop2$Pgas$Pstate$PX$lB5$rB’ undeclared (first use in this function) ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator_06inz.c:3733: error: (Each undeclared identifier is reported only once ThermoPower.Examples.BraytonCycle.ClosedLoopSimulator_06inz.c:3733: error: for each function it appears in.)
ThermoPower.Examples.BraytonCycle.OpenLoopSimulator
ThermoPower.Examples.BraytonCycle.OpenLoopSimulator_08bnd.c: In function ‘ThermoPower_Examples_BraytonCycle_OpenLoopSimulator_eqFunction_705’: ThermoPower.Examples.BraytonCycle.OpenLoopSimulator_08bnd.c:449: error: ‘$Pplant$PPressDrop2$Pgas$Pstate$PX$lB5$rB’ undeclared (first use in this function) ThermoPower.Examples.BraytonCycle.OpenLoopSimulator_08bnd.c:449: error: (Each undeclared identifier is reported only once ThermoPower.Examples.BraytonCycle.OpenLoopSimulator_08bnd.c:449: error: for each function it appears in.) ThermoPower.Examples.BraytonCycle.OpenLoopSimulator_06inz.c: In function ‘ThermoPower_Examples_BraytonCycle_OpenLoopSimulator_eqFunction_413’: ThermoPower.Examples.BraytonCycle.OpenLoopSimulator_06inz.c:3762: error: ‘$Pplant$PPressDrop2$Pgas$Pstate$PX$lB5$rB’ undeclared (first use in this function) ThermoPower.Examples.BraytonCycle.OpenLoopSimulator_06inz.c:3762: error: (Each undeclared identifier is reported only once ThermoPower.Examples.BraytonCycle.OpenLoopSimulator_06inz.c:3762: error: for each function it appears in.)
comment:12 by , 11 years ago
Sorry, I should have been more precise in defining the test model, but I see Martin did a good job at that. My apologies.
Happy hacking!
comment:13 by , 11 years ago
Resolution: | → duplicate |
---|---|
Status: | accepted → closed |
Same bug reported in #2658
I created a new test for this ticket here:
testsuite/simulation/libraries/3rdParty/ThermoPower
.