Opened 12 years ago
Closed 12 years ago
#1952 closed defect (fixed)
SCodeDependency removes necessary classes in some cases
Reported by: | Adrian Pop | Owned by: | somebody |
---|---|---|---|
Priority: | high | Milestone: | 1.9.0 |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: | Per Östlund, Adrian Pop |
Description
Run this:
loadModel(Modelica, {"3.2.1"}); getErrorString(); saveTotalSCode("BranchingDynamicPipes.mo", Modelica.Fluid.Examples.BranchingDynamicPipes); getErrorString();
Have a look at file BranchingDynamicPipes.mo.
It contains inside SingleGasNasa:
function T_h extends Modelica.Icons.Function; input SpecificEnthalpy h; output Temperature T; protected package Internal extends Modelica.Media.Common.OneNonLinearEquation; redeclare function extends solve end solve; end Internal; algorithm T := Internal.solve(h, 200, 6000, 100000.0, {1}, data); end T_h;
Now have a look at the real code of SingleGasNasa.T_h:
function T_h "Compute temperature from specific enthalpy" extends Modelica.Icons.Function; input SpecificEnthalpy h "Specific enthalpy"; output Temperature T "Temperature"; protected package Internal "Solve h(data,T) for T with given h (use only indirectly via temperature_phX)" extends Modelica.Media.Common.OneNonLinearEquation; redeclare record extends f_nonlinear_Data "Data to be passed to non-linear function" extends Modelica.Media.IdealGases.Common.DataRecord; end f_nonlinear_Data; redeclare function extends f_nonlinear algorithm y := Modelica.Media.IdealGases.Common.Functions.h_T( f_nonlinear_data,x); end f_nonlinear; // Dummy definition has to be added for current Dymola redeclare function extends solve end solve; end Internal; algorithm T := Internal.solve(h, 200, 6000, 1.0e5, {1}, data); end T_h;
As you can see some rather important parts were removed:
redeclare record extends f_nonlinear_Data ... redeclare function extends f_nonlinear ...
Change History (3)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
It might be that SCodeDependency.analyseClassExtends does not do its job fully or it does but those parts of the environment are actually build on the fly during lookup and are not retained for later stages.
Note:
See TracTickets
for help on using tickets.
I think that redeclare [restriction] extends BaseClass should never be removed.