Skip to content

Commit

Permalink
Made model C1 for #373
Browse files Browse the repository at this point in the history
  • Loading branch information
mwetter committed Mar 12, 2015
1 parent e405042 commit a5798bc
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 19 deletions.
40 changes: 33 additions & 7 deletions Buildings/Fluid/Chillers/BaseClasses/PartialElectric.mo
Expand Up @@ -27,7 +27,7 @@ partial model PartialElectric
Modelica.SIunits.Temperature TConEnt "Condenser entering temperature";
Modelica.SIunits.Temperature TConLvg "Condenser leaving temperature";

Real COP(min=0) "Coefficient of performance";
Real COP(min=0, unit="1") "Coefficient of performance";
Modelica.SIunits.HeatFlowRate QCon_flow "Condenser heat input";
Modelica.SIunits.HeatFlowRate QEva_flow "Evaporator heat input";
Modelica.Blocks.Interfaces.RealOutput P(final quantity="Power", unit="W")
Expand Down Expand Up @@ -90,6 +90,7 @@ protected

initial equation
assert(QEva_flow_nominal < 0, "Parameter QEva_flow_nominal must be smaller than zero.");
assert(Q_flow_small < 0, "Parameter Q_flow_small must be smaller than zero.");
assert(PLRMinUnl >= PLRMin, "Parameter PLRMinUnl must be bigger or equal to PLRMin");
assert(PLRMax > PLRMinUnl, "Parameter PLRMax must be bigger than PLRMinUnl");
equation
Expand All @@ -111,22 +112,42 @@ equation
// Available cooling capacity
QEva_flow_ava = QEva_flow_nominal*capFunT;
// Cooling capacity required to chill water to setpoint
QEva_flow_set = min(m2_flow*(hSet-inStream(port_a2.h_outflow)),0);
QEva_flow_set = Buildings.Utilities.Math.Functions.smoothMin(
x1= m2_flow*(hSet-inStream(port_a2.h_outflow)),
x2= Q_flow_small,
deltaX=-Q_flow_small/100);

// Part load ratio
PLR1 = min(QEva_flow_set/(QEva_flow_ava+Q_flow_small), PLRMax);
PLR1 = Buildings.Utilities.Math.Functions.smoothMin(
x1= QEva_flow_set/(QEva_flow_ava+Q_flow_small),
x2= PLRMax,
deltaX=PLRMax/100);
// PLR2 is the compressor part load ratio. The lower bound PLRMinUnl is
// since for PLR1<PLRMinUnl, the chiller uses hot gas bypass, under which
// condition the compressor power is assumed to be the same as if the chiller
// were to operate at PLRMinUnl
PLR2 = max(PLRMinUnl, PLR1);
// Cycling ratio
CR = min(PLR1/PLRMin,1.0);
PLR2 = Buildings.Utilities.Math.Functions.smoothMax(
x1= PLRMinUnl,
x2= PLR1,
deltaX= PLRMinUnl/100);

// Cycling ratio.
// Due to smoothing, this can be about deltaX/10 above 1.0
CR = Buildings.Utilities.Math.Functions.smoothMin(
x1= PLR1/PLRMin,
x2= 1,
deltaX=0.001);

// Compressor power.
P = -QEva_flow_ava/COP_nominal*EIRFunT*EIRFunPLR*CR;
// Heat flow rates into evaporator and condenser
QEva_flow = max(QEva_flow_set, QEva_flow_ava);
// Q_flow_small is a negative number.
QEva_flow = Buildings.Utilities.Math.Functions.smoothMax(
x1= QEva_flow_set,
x2= QEva_flow_ava,
deltaX= -Q_flow_small/10);

//QEva_flow = max(QEva_flow_set, QEva_flow_ava);
QCon_flow = -QEva_flow + P*etaMotor;
// Coefficient of performance
COP = -QEva_flow/(P-Q_flow_small);
Expand Down Expand Up @@ -308,6 +329,11 @@ The function value needs to be assigned to <code>EIRFunPLR</code>.
revisions="<html>
<ul>
<li>
March 12, 2015, by Michael Wetter:<br/>
Refactored model to make it once continuously differentiable.
This is for issue <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/373\">373</a>.
</li>
<li>
Jan. 10, 2011, by Michael Wetter:<br/>
Added input signal to switch chiller off, and changed base class to use a dynamic model.
The change of the base class was required to improve the robustness of the model when the control
Expand Down
3 changes: 1 addition & 2 deletions Buildings/Fluid/Chillers/Carnot.mo
Expand Up @@ -2,8 +2,7 @@ within Buildings.Fluid.Chillers;
model Carnot
"Chiller with performance curve adjusted based on Carnot efficiency"
extends Interfaces.FourPortHeatMassExchanger(
vol1(
final prescribedHeatFlowRate = true),
vol1(final prescribedHeatFlowRate = true),
redeclare final Buildings.Fluid.MixingVolumes.MixingVolume vol2);

parameter Buildings.Fluid.Types.EfficiencyInput effInpEva=
Expand Down
11 changes: 9 additions & 2 deletions Buildings/Fluid/Chillers/ElectricEIR.mo
Expand Up @@ -39,8 +39,10 @@ equation
// Since the regression for capacity can have negative values (for unreasonable temperatures),
// we constrain its return value to be non-negative. This prevents the solver to pick the
// unrealistic solution.
capFunT = max(0,
Buildings.Utilities.Math.Functions.biquadratic(a=per.capFunT, x1=TEvaLvg_degC, x2=TConEnt_degC));
capFunT = Buildings.Utilities.Math.Functions.smoothMax(
x1= 1E-6,
x2= Buildings.Utilities.Math.Functions.biquadratic(a=per.capFunT, x1=TEvaLvg_degC, x2=TConEnt_degC),
deltaX= 1E-7);
/* assert(capFunT > 0.1, "Error: Received capFunT = " + String(capFunT) + ".\n"
+ "Coefficient for polynomial seem to be not valid for the encountered temperature range.\n"
+ "Temperatures are TConEnt_degC = " + String(TConEnt_degC) + " degC\n"
Expand Down Expand Up @@ -220,6 +222,11 @@ Component Models. <i>ASHRAE Transactions</i>, AC-02-9-1.
revisions="<html>
<ul>
<li>
March 12, 2015, by Michael Wetter:<br/>
Refactored model to make it once continuously differentiable.
This is for issue <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/373\">373</a>.
</li>
<li>
Jan. 9, 2011, by Michael Wetter:<br/>
Added input signal to switch chiller off.
</li>
Expand Down
11 changes: 9 additions & 2 deletions Buildings/Fluid/Chillers/ElectricReformulatedEIR.mo
Expand Up @@ -40,8 +40,10 @@ equation
// Since the regression for capacity can have negative values (for unreasonable temperatures),
// we constrain its return value to be non-negative. This prevents the solver to pick the
// unrealistic solution.
capFunT = max(0,
Buildings.Utilities.Math.Functions.biquadratic(a=per.capFunT, x1=TEvaLvg_degC, x2=TConLvg_degC));
capFunT = Buildings.Utilities.Math.Functions.smoothMax(
x1= 1E-6,
x2= Buildings.Utilities.Math.Functions.biquadratic(a=per.capFunT, x1=TEvaLvg_degC, x2=TConLvg_degC),
deltaX= 1E-7);
/* assert(capFunT > 0.1, "Error: Received capFunT = " + String(capFunT) + ".\n"
+ "Coefficient for polynomial seem to be not valid for the encountered temperature range.\n"
+ "Temperatures are TConLvg_degC = " + String(TConLvg_degC) + " degC\n"
Expand Down Expand Up @@ -217,6 +219,11 @@ Component Models. <i>ASHRAE Transactions</i>, AC-02-9-1.
revisions="<html>
<ul>
<li>
March 12, 2015, by Michael Wetter:<br/>
Refactored model to make it once continuously differentiable.
This is for issue <a href=\"https://github.com/lbl-srg/modelica-buildings/issues/373\">373</a>.
</li>
<li>
Jan. 9, 2011, by Michael Wetter:<br/>
Added input signal to switch chiller off.
</li>
Expand Down

0 comments on commit a5798bc

Please sign in to comment.