Package for base classes.
This model computes the pinch points and the energy exchange,
and interfaces with the input and output variables.
The evaporating temperature is fixed as a parameter.
See the documentation of
Buildings.Fluid.CHPs.OrganicRankine.ConstantEvaporation
for more details.
model FixedEvaporating
extends Buildings.Fluid.CHPs.OrganicRankine.BaseClasses.InterpolateStates(
TEva=TWorEva,
TCon=TWorCon);
parameter Modelica.Units.SI.TemperatureDifference dTPinEva_set(
final min = 0)
;
parameter Modelica.Units.SI.SpecificHeatCapacity cpHot
;
parameter Modelica.Units.SI.ThermodynamicTemperature TWorEva
;
parameter Modelica.Units.SI.TemperatureDifference dTPinCon
;
parameter Modelica.Units.SI.SpecificHeatCapacity cpCol
;
parameter Boolean useLowCondenserPressureWarning = true
;
parameter Modelica.Units.SI.MassFlowRate mWor_flow_max(
final min = 0)
;
parameter Modelica.Units.SI.MassFlowRate mWor_flow_min(
final min = 0)
;
parameter Modelica.Units.SI.MassFlowRate mWor_flow_hysteresis(
final min = 0)
;
Modelica.Blocks.Interfaces.RealInput THotIn(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC") ;
Modelica.Blocks.Interfaces.RealInput mHot_flow(
final quantity="MassFlowRate",
final unit="kg/s") ;
Modelica.Blocks.Interfaces.RealInput TColIn(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC") ;
Modelica.Blocks.Interfaces.RealInput mCol_flow(
final quantity="MassFlowRate",
final unit="kg/s") ;
Modelica.Blocks.Interfaces.BooleanInput ena
;
Modelica.Blocks.Interfaces.RealOutput QEva_flow(
final quantity="HeatFlowRate",
final unit="W") ;
Modelica.Blocks.Interfaces.RealOutput QCon_flow(
final quantity="HeatFlowRate",
final unit="W") ;
Modelica.Blocks.Interfaces.RealOutput PExp(
final quantity="Power",
final unit="W") ;
Modelica.Blocks.Interfaces.RealOutput PPum(
final quantity="Power",
final unit="W")
;
Modelica.Blocks.Interfaces.BooleanOutput on_actual = ena
and hys.y
;
Modelica.Units.SI.ThermodynamicTemperature THotOut(
start = TWorEva + dTPinEva_set)
;
Modelica.Units.SI.ThermodynamicTemperature THotPin(
start = TWorEva + dTPinEva_set)
;
Modelica.Units.SI.TemperatureDifference dTPinEva(start = dTPinEva_set)
;
Modelica.Units.SI.ThermodynamicTemperature TWorCon
;
Modelica.Units.SI.ThermodynamicTemperature TColOut
;
Modelica.Units.SI.ThermodynamicTemperature TColPin(
start = 300)
;
Modelica.Units.SI.MassFlowRate mWor_flow
;
Modelica.Blocks.Logical.Hysteresis hys(
uLow = mWor_flow_min,
uHigh = mWor_flow_min + mWor_flow_hysteresis,
u = mWor_flow_internal,
y(start = false))
;
protected
Modelica.Units.SI.MassFlowRate mWor_flow_internal(
start = (mWor_flow_max + mWor_flow_min) / 2)
;
Modelica.Units.SI.ThermodynamicTemperature THotPin_internal
;
Modelica.Units.SI.ThermodynamicTemperature THotOut_internal
;
Modelica.Units.SI.HeatFlowRate QEva_flow_internal
;
equation
assert(
not (TWorCon > TWorEva - 1
and ena),
"*** In " +
getInstanceName() +
": Working fluid condensing temperature is too high and close to evaporating temperature.
This is likely caused by the flow rate of cold fluid in the condenser being too low
when the ORC is on.");
assert(
not (pCon < 101325 - 1
and ena
and useLowCondenserPressureWarning),
"*** In " +
getInstanceName() +
": Working fluid condensing pressure is lower than 101325 Pa.
If this is intended, set useLowCondenserPressureWarning = false to turn off this warning.",
level=AssertionLevel.warning);
if ena
then
QEva_flow = mHot_flow * cpHot * (THotOut - THotIn);
QEva_flow = mWor_flow * (hPumOut - hExpInl);
(THotPin - THotOut) * (hExpInl - hPumOut)
= (hPinEva - hPumOut) * (THotIn - THotOut);
QCon_flow = mCol_flow * cpCol * (TColOut - TColIn);
QCon_flow = mWor_flow * (hExpOut - hPumInl);
(TColPin - TColIn) * (hExpOut - hPumInl)
= (hPinCon - hPumInl) * (TColOut - TColIn);
else
QEva_flow = 0;
THotOut = THotIn;
THotPin = THotOut;
QCon_flow = 0;
TColOut = TColIn;
TColPin = TColIn;
end if;
dTPinEva = THotPin - TWorEva;
dTPinCon = TWorCon - TColPin;
QEva_flow_internal = mHot_flow * cpHot * (THotOut_internal - THotIn);
QEva_flow_internal = mWor_flow_internal * (hPumOut - hExpInl);
(THotPin_internal - THotOut_internal) * (hExpInl - hPumOut)
= (hPinEva - hPumOut) * (THotIn - THotOut_internal);
dTPinEva_set = THotPin_internal - TWorEva;
PExp = mWor_flow * (hExpOut - hExpInl);
PPum = mWor_flow * (hPumOut - hPumInl);
mWor_flow =
if on_actual
then
Buildings.Utilities.Math.Functions.smoothMin(
x1=mWor_flow_internal,
x2=mWor_flow_max,
deltaX=mWor_flow_min*1E-2)
else 0;
end FixedEvaporating;
model InterpolateStates
replaceable parameter Buildings.Fluid.CHPs.OrganicRankine.Data.Generic pro
;
parameter Modelica.Units.SI.SpecificEnthalpy h_small =
(
max(pro.hSatVap) -
min(pro.hSatLiq)) * 1E-4
;
input Modelica.Units.SI.ThermodynamicTemperature TEva
;
input Modelica.Units.SI.ThermodynamicTemperature TCon
;
input Modelica.Units.SI.Efficiency etaExp
;
input Modelica.Units.SI.Efficiency etaPum
;
Modelica.Units.SI.AbsolutePressure pEva(
displayUnit = "kPa") =
Buildings.Utilities.Math.Functions.interpolate(
u = TEva,
xd = pro.T,
yd = pro.p,
d = pDer_T)
;
Modelica.Units.SI.AbsolutePressure pCon(
displayUnit = "kPa") =
Buildings.Utilities.Math.Functions.interpolate(
u = TCon,
xd = pro.T,
yd = pro.p,
d = pDer_T)
;
Modelica.Units.SI.Density rhoLiq =
Buildings.Utilities.Math.Functions.interpolate(
u = TCon,
xd = pro.T,
yd = pro.rhoLiq,
d = rhoLiqDer_T)
;
Modelica.Units.SI.SpecificEntropy sPumInl =
Buildings.Utilities.Math.Functions.interpolate(
u = TCon,
xd = pro.T,
yd = pro.sSatLiq,
d = sSatLiqDer_T)
;
Modelica.Units.SI.SpecificEnthalpy hPumInl(
displayUnit = "kJ/kg") =
Buildings.Utilities.Math.Functions.interpolate(
u = TCon,
xd = pro.T,
yd = pro.hSatLiq,
d = hSatLiqDer_T)
;
Modelica.Units.SI.SpecificEnthalpy hPinEva(
displayUnit = "kJ/kg") =
Buildings.Utilities.Math.Functions.interpolate(
u = TEva,
xd = pro.T,
yd = pro.hSatLiq,
d = hSatLiqDer_T)
;
Modelica.Units.SI.SpecificEnthalpy hPinCon(
displayUnit = "kJ/kg") =
Buildings.Utilities.Math.Functions.interpolate(
u = TCon,
xd = pro.T,
yd = pro.hSatVap,
d = hSatVapDer_T)
;
Modelica.Units.SI.SpecificEntropy sSatVapCon(
start =
max(pro.sSatVap) * 0.1 +
min(pro.sSatVap) * 0.9) =
Buildings.Utilities.Math.Functions.interpolate(
u = TCon,
xd = pro.T,
yd = pro.sSatVap,
d = sSatVapDer_T)
;
Modelica.Units.SI.SpecificEntropy sRefCon =
Buildings.Utilities.Math.Functions.interpolate(
u = pCon,
xd = pro.p,
yd = pro.sRef,
d = sRefDer_p)
;
Modelica.Units.SI.SpecificEntropy sSatVapEva =
Buildings.Utilities.Math.Functions.interpolate(
u = TEva,
xd = pro.T,
yd = pro.sSatVap,
d = sSatVapDer_T)
;
Modelica.Units.SI.SpecificEnthalpy hSatVapEva(
displayUnit = "kJ/kg") =
Buildings.Utilities.Math.Functions.interpolate(
u = TEva,
xd = pro.T,
yd = pro.hSatVap,
d = hSatVapDer_T)
;
Modelica.Units.SI.SpecificEntropy sRefEva =
Buildings.Utilities.Math.Functions.interpolate(
u = pEva,
xd = pro.p,
yd = pro.sRef,
d = sRefDer_p)
;
Modelica.Units.SI.SpecificEnthalpy hSatVapCon(
displayUnit = "kJ/kg") =
Buildings.Utilities.Math.Functions.interpolate(
u = TCon,
xd = pro.T,
yd = pro.hSatVap,
d = hSatVapDer_T)
;
Modelica.Units.SI.SpecificEnthalpy hRefCon(
displayUnit = "kJ/kg") =
Buildings.Utilities.Math.Functions.interpolate(
u = pCon,
xd = pro.p,
yd = pro.hRef,
d = hRefDer_p)
;
Modelica.Units.SI.SpecificEnthalpy hRefEva(
displayUnit = "kJ/kg") =
Buildings.Utilities.Math.Functions.interpolate(
u = pEva,
xd = pro.p,
yd = pro.hRef,
d = hRefDer_p)
;
Modelica.Units.SI.SpecificEnthalpy hPumOut(displayUnit = "kJ/kg") =
hPumInl + wPum
;
Modelica.Units.SI.SpecificEnthalpy hExpInl(displayUnit = "kJ/kg") =
Buildings.Utilities.Math.Functions.regStep(
x = h_reg,
y1 = hSatVapEva,
y2 = hExpInlWet,
x_small = h_small)
;
Modelica.Units.SI.SpecificEnthalpy hExpOut(displayUnit = "kJ/kg") =
Buildings.Utilities.Math.Functions.regStep(
x = h_reg,
y1 = hExpOutDry,
y2 = hSatVapCon,
x_small = h_small)
;
Modelica.Units.SI.TemperatureDifference dTSup =
max(0, dTSupWet)
;
Modelica.Units.SI.SpecificEnergy qEva = hPumOut - hExpInl
;
Modelica.Units.SI.SpecificEnergy qCon = hExpOut - hPumInl
;
Modelica.Units.SI.SpecificEnergy wExp = hExpOut - hExpInl
;
Modelica.Units.SI.SpecificEnergy wPum = (pEva - pCon) / (rhoLiq * etaPum)
;
Modelica.Units.SI.Efficiency etaThe(min=0) =
(wExp + wPum) / qEva ;
protected
Modelica.Units.SI.SpecificEnthalpy h_reg = hExpOutDry - hSatVapCon
;
Modelica.Units.SI.SpecificEntropy sExpOutDryIse = sSatVapEva
;
Modelica.Units.SI.SpecificEnthalpy hExpOutDryIse(
displayUnit = "kJ/kg") =
if sExpOutDryIse > sSatVapCon
then (hRefCon - hSatVapCon) * (sExpOutDryIse - sSatVapCon)
/ (sRefCon - sSatVapCon) + hSatVapCon
else (hSatVapCon - hPumInl) * (sExpOutDryIse - sPumInl)
/ (sSatVapCon - sPumInl) + hPumInl
;
Modelica.Units.SI.SpecificEnthalpy hExpOutDry(
displayUnit = "kJ/kg") =
hSatVapEva - (hSatVapEva - hExpOutDryIse) * etaExp
;
Modelica.Units.SI.SpecificEntropy sExpInlWetIse = sSatVapCon
;
Modelica.Units.SI.SpecificEnthalpy hExpInlWetIse(
displayUnit = "kJ/kg") =
(hRefEva - hSatVapEva) * (sExpInlWetIse - sSatVapEva)
/ (sRefEva - sSatVapEva) + hSatVapEva
;
Modelica.Units.SI.SpecificEnthalpy hExpInlWet(
displayUnit = "kJ/kg") =
(hExpInlWetIse - hSatVapCon) * etaExp + hSatVapCon
;
Modelica.Units.SI.TemperatureDifference dTSupWet(
displayUnit = "K") =
(hExpInlWet - hSatVapEva) * pro.dTRef / (hRefEva - hSatVapEva)
;
final parameter Real pDer_T[pro.n]=
Buildings.Utilities.Math.Functions.splineDerivatives(
x = pro.T,
y = pro.p,
ensureMonotonicity = true)
;
final parameter Real rhoLiqDer_T[pro.n]=
Buildings.Utilities.Math.Functions.splineDerivatives(
x = pro.T,
y = pro.rhoLiq,
ensureMonotonicity = true)
;
final parameter Real sSatLiqDer_T[pro.n]=
Buildings.Utilities.Math.Functions.splineDerivatives(
x = pro.T,
y = pro.sSatLiq,
ensureMonotonicity = true)
;
final parameter Real sSatVapDer_T[pro.n]=
Buildings.Utilities.Math.Functions.splineDerivatives(
x = pro.T,
y = pro.sSatVap,
ensureMonotonicity = false)
;
final parameter Real sRefDer_p[pro.n]=
Buildings.Utilities.Math.Functions.splineDerivatives(
x = pro.p,
y = pro.sRef,
ensureMonotonicity = false)
;
final parameter Real hSatLiqDer_T[pro.n]=
Buildings.Utilities.Math.Functions.splineDerivatives(
x = pro.T,
y = pro.hSatLiq,
ensureMonotonicity = true)
;
final parameter Real hSatVapDer_T[pro.n]=
Buildings.Utilities.Math.Functions.splineDerivatives(
x = pro.T,
y = pro.hSatVap,
ensureMonotonicity = false)
;
final parameter Real hRefDer_p[pro.n]=
Buildings.Utilities.Math.Functions.splineDerivatives(
x = pro.p,
y = pro.hRef,
ensureMonotonicity = false)
;
end InterpolateStates;