Opened 11 years ago
Closed 10 years ago
#2658 closed defect (fixed)
Wrong C code generated in ThermoPower example case
Reported by: | Francesco Casella | Owned by: | Adrian Pop |
---|---|---|---|
Priority: | high | Milestone: | 1.9.1 |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: |
Description
The ThermoPower.Examples.BraytonCycle.OpenLoopSimulator model fails because the C code contains an undeclared identifier ‘$Pplant$PPressDrop2$Pgas$Pstate$PX$lB5$rB’
However, if the Plant.PressDrop2 component is removed and the compressor outlet is directly connected to the combustion chamber, the model gets compiled and simulates.
I haven't been able to understand what's wrong: the PressDrop model is fine (it is used in the very same Plan model without problems), and also the medium model should be fine, as it is yet another ideal gas model taken from Modelica.Media, and should be fundamentally not different from the one used in PressDrop1.
Attached you can find a Save Total file which contains both cases (the one in the library that fails, and the modified one that runs, named ThermoPower.Examples.BraytonCycle.OpenLoopSimulator).
Please help!
Attachments (1)
Change History (4)
by , 11 years ago
Attachment: | BraytonCycleTotal.mo added |
---|
comment:1 by , 11 years ago
This is a case of the bug (#2604) same type different component and different redeclares:
T c1(redeclare package Medium = Media.FlueGas); T c2(redeclare package Medium = Media.Air);
If you change the code like this:
package G1 = Gas; G1.PressDrop PressDrop1( redeclare package Medium = Media.FlueGas, FFtype=ThermoPower.Choices.PressDrop.FFtypes.OpPoint, wnom=102, rhonom=2, dpnom=26000, pstart=811000, Tstart=1370) annotation (Placement(transformation( origin={0,8}, extent={{-10,-10},{10,10}}, rotation=270))); package G2 = Gas; G2.PressDrop PressDrop2( pstart=8.3e5, FFtype=ThermoPower.Choices.PressDrop.FFtypes.OpPoint, A=1, redeclare package Medium = Media.Air, dpnom=0.19e5, wnom=100, rhonom=4.7, Tstart=600) annotation (Placement(transformation( origin={-104,10}, extent={{-10,-10},{10,10}}, rotation=90)));
Then you can simulate the model:
record SimulationResult resultFile = "ThermoPower.Examples.BraytonCycle.OpenLoopSimulator_res.mat", simulationOptions = "startTime = 0.0, stopTime = 1000.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'ThermoPower.Examples.BraytonCycle.OpenLoopSimulator', options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = '', simflags = ''", messages = "", timeFrontend = 9.120325330943549, timeBackend = 0.6625850167300298, timeSimCode = 0.3318439526293017, timeTemplates = 0.8013703534324663, timeCompile = 4.402345668746949, timeSimulation = 0.9040802641081193, timeTotal = 16.22345291493631 end SimulationResult;
A fix is on the way, I'm working now on pushing my local changes in svn.
Save Total file