Opened 11 years ago
Closed 6 years ago
#2660 closed defect (fixed)
Lookup bug with replaceable models
Reported by: | Francesco Casella | Owned by: | Per Östlund |
---|---|---|---|
Priority: | blocker | Milestone: | 2.0.0 |
Component: | New Instantiation | Version: | trunk |
Keywords: | Cc: | andrea.bartolini@… |
Description
The model ThermoPower.Examples.HRB.Simulators.OpenLoopSimulatorHtc
gives this compilation error:
Examples.mo:1439:26-1439:45:writable Error: Variable gamma_nom not found in scope ThermoPower.Gas.Flow1DFV.
The offending code reads:
model HeatExchanger ... parameter CoefficientOfHeatTransfer gamma_nom=150 "Nominal heat transfer coefficient"; ... Gas.Flow1DFV GasSide( ... redeclare ThermoPower.Thermal.HeatTransfer.FlowDependentHeatTransferCoefficient heatTransfer(gamma_nom=gamma_nom, alpha=0.6), ...
As far as I understand, there is a gamma_nom defined in the scope of HeatExchanger, whose value is then passed to the gamma_nom parameter defined in the scope of FlowDependentHeatTransferCoefficient model.
Why does OMC complain about gamma_nom not being defined in the scope of the Flow1DFV model?
Change History (11)
comment:1 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 10 years ago
Cc: | added |
---|---|
Milestone: | 1.9.1 → 1.9.2 |
Resolution: | fixed |
Status: | closed → reopened |
We have slightly changed the implementation of the heat transfer, from a replaceable component to a replaceable class from which a model is instatiated (as in the Volume model of Modelica.Fluid). The model now reads:
model HeatExchanger "Base class for heat exchanger fluid - gas" ... parameter SI.CoefficientOfHeatTransfer gamma_nom=150 "Nominal heat transfer coefficient"; ... Gas.Flow1DFV GasSide( .... redeclare model HeatTransfer = ThermoPower.Thermal.HeatTransferFV.FlowDependentHeatTransferCoefficient( gamma_nom=gamma_nom, alpha=0.6), ... end HeatExchanger;
Unfortunately, a similar problem has popped up again and is still there in r22966:
Error: Variable gamma_nom not found in scope ThermoPower.Gas.Flow1DFV$Plant$Boiler$GasSide. Error: Error occurred while flattening model ThermoPower.Examples.HRB.Simulators.OpenLoopSimulatorHtc
The the actual parameter gamma_nom is defined in the scope of HeatExchanger, and the formal parameter gamma_nom is defined in the scope of FlowDependentHeatTransferCoefficient. It is not clear why does the front-end complains about gamma_nom not being in the scope of GasSide, but I guess it is looking in the wrong place...
comment:3 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:7 by , 8 years ago
Milestone: | 1.10.0 → 2.0.0 |
---|---|
Priority: | high → blocker |
comment:8 by , 7 years ago
Component: | Frontend → New Instantiation |
---|
comment:9 by , 7 years ago
This is the report with the NF:
[Modelica 3.2.2/Media/Water/package.mo:126:22-126:33:writable] Error: Type mismatch in binding start = 100000.0, expected subtype of Real[11], got type Real.
I'm not sure if this issue is coming before or after the reported one. I added a comment to#4921 on this topic.
comment:10 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | reopened → assigned |
The NF report is now:
[OpenModelica/OMCompiler/build/lib/omlibrary/ThermoPower 3.1/Gas.mo:1166:7-1166:73:writable] Error: Internal error NFScalarize.scalarizeEquation could not expand rhs Plant.Boiler.GasSide.Xtilde[1, 1:Plant.Boiler.GasSide.nXi]
so I can't still see the flat model and check if the NF processes this model correctly.
comment:11 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The model now passess the front-end successfully. It later fails in the back-end because of #5163, but that is not related to this issue.
The model compiles and simulates successfully in r21001 and has been doing that for a while.