text
stringlengths 1
4.74k
| code
stringlengths 69
637k
|
---|---|
Computes the index of a substance in the mass fraction vector Xi | within AixLib.Fluid.BaseClasses;
block IndexMassFraction
"Computes the index of a substance in the mass fraction vector Xi"
replaceable package Medium =
Modelica.Media.Interfaces.PartialCondensingGases "Medium model"
parameter String substanceName="" "Name of species substance";
protected
parameter Integer i_x = sum(
if Modelica.Utilities.Strings.isEqual(string1=Medium.substanceNames[i],
string2=substanceName,
caseSensitive=false) then i else 0
for i in 1:Medium.nXi) "Index of substance"
initial equation
assert(i_x > 0, "Substance '" + substanceName + "' is not present in medium '"
+ Medium.mediumName + "'.\n"
+ "Change medium model to one that has '" + substanceName + "' as a substance.");
end IndexMassFraction; |
Model that multiplies the mass flow rate. This model multiplies the mass flow rate so that
<code>0 = port_b.m_flow + gain * port_a.m_flow</code>
where <code>gain > 0</code> is either equal to
the input variable <code>u</code> if <code>use_input</code>
is set to <code>true</code>, or equal to
the parameter <code>k</code> if <code>use_input</code>
is set to <code>false</code>. | within AixLib.Fluid.BaseClasses;
model MassFlowRateMultiplier "Model that multiplies the mass flow rate"
extends AixLib.Fluid.Interfaces.PartialTwoPort;
parameter Boolean use_input=false
"Set to true for multiplier factor provided as an input instead of a parameter"
parameter Real k=1
"Gain for mass flow rate"
Modelica.Blocks.Interfaces.RealInput u(
final unit="1",
final min=Modelica.Constants.small) if use_input
"Multiplier factor"
Modelica.Blocks.Interfaces.RealOutput uInv if use_input
"Inverse of the multiplier factor"
protected
Modelica.Blocks.Interfaces.RealInput u_internal
"Connector for multiplier factor for internal use only"
Modelica.Blocks.Sources.Constant cst(
final k=k) if not use_input
"Constant gain value"
Modelica.Blocks.Math.Division div1 if use_input
"Compute the inverse"
Modelica.Blocks.Sources.Constant one(
final k=1) if use_input
"Constant 1"
initial equation
assert(k > Modelica.Constants.small,
"Gain must be strictly positive. Received k = " + String(k));
equation
assert(u_internal > Modelica.Constants.small,
"Gain must be strictly positive. Received u = " + String(u_internal));
// Pressure drop in design flow direction
port_a.p = port_b.p;
// Mass balance (mass is not conserved by this model!)
port_b.m_flow = -u_internal * port_a.m_flow;
// Specific enthalpy flow rate
port_a.h_outflow = inStream(port_b.h_outflow);
port_b.h_outflow = inStream(port_a.h_outflow);
// Transport of substances
port_a.Xi_outflow = inStream(port_b.Xi_outflow);
port_b.Xi_outflow = inStream(port_a.Xi_outflow);
port_a.C_outflow = inStream(port_b.C_outflow);
port_b.C_outflow = inStream(port_a.C_outflow);
connect(cst.y, u_internal)
connect(u_internal, div1.u2)
connect(one.y, div1.u1)
connect(div1.y, uInv)
connect(u, u_internal)
end MassFlowRateMultiplier; |
Package with base classes for AixLib.Fluid | within AixLib.Fluid;
package BaseClasses "Package with base classes for AixLib.Fluid"
extends Modelica.Icons.BasesPackage;
end BaseClasses; |
Partial model for a hydraulic resistance. Partial model for a flow resistance, possible with variable flow coefficient.
Models that extend this class need to implement an equation that relates
<code>m_flow</code> and <code>dp</code>, and they need to assign the parameter
<code>m_flow_turbulent</code>. | within AixLib.Fluid.BaseClasses;
partial model PartialResistance "Partial model for a hydraulic resistance"
extends AixLib.Fluid.Interfaces.PartialTwoPortInterface(
show_T=false,
dp(nominal=if dp_nominal_pos > Modelica.Constants.eps
then dp_nominal_pos else 1),
m_flow(
nominal=if m_flow_nominal_pos > Modelica.Constants.eps
then m_flow_nominal_pos else 1),
final m_flow_small = 1E-4*abs(m_flow_nominal));
constant Boolean homotopyInitialization = true "= true, use homotopy method"
parameter Boolean from_dp = false
"= true, use m_flow = f(dp) else dp = f(m_flow)"
parameter Modelica.Units.SI.PressureDifference dp_nominal(displayUnit="Pa")
"Pressure drop at nominal mass flow rate"
parameter Boolean linearized = false
"= true, use linear relation between m_flow and dp for any flow rate"
parameter Modelica.Units.SI.MassFlowRate m_flow_turbulent(min=0)
"Turbulent flow if |m_flow| >= m_flow_turbulent";
protected
parameter Medium.ThermodynamicState sta_default=
Medium.setState_pTX(T=Medium.T_default, p=Medium.p_default, X=Medium.X_default);
parameter Modelica.Units.SI.DynamicViscosity eta_default=
Medium.dynamicViscosity(sta_default)
"Dynamic viscosity, used to compute transition to turbulent flow regime";
final parameter Modelica.Units.SI.MassFlowRate m_flow_nominal_pos=abs(
m_flow_nominal) "Absolute value of nominal flow rate";
final parameter Modelica.Units.SI.PressureDifference dp_nominal_pos(
displayUnit="Pa") = abs(dp_nominal)
"Absolute value of nominal pressure difference";
initial equation
assert(homotopyInitialization, "In " + getInstanceName() +
": The constant homotopyInitialization has been modified from its default value. This constant will be removed in future releases.",
level = AssertionLevel.warning);
equation
// Isenthalpic state transformation (no storage and no loss of energy)
port_a.h_outflow = if allowFlowReversal then inStream(port_b.h_outflow) else Medium.h_default;
port_b.h_outflow = inStream(port_a.h_outflow);
// Mass balance (no storage)
port_a.m_flow + port_b.m_flow = 0;
// Transport of substances
port_a.Xi_outflow = if allowFlowReversal then inStream(port_b.Xi_outflow) else Medium.X_default[1:Medium.nXi];
port_b.Xi_outflow = inStream(port_a.Xi_outflow);
port_a.C_outflow = if allowFlowReversal then inStream(port_b.C_outflow) else zeros(Medium.nC);
port_b.C_outflow = inStream(port_a.C_outflow);
end PartialResistance; |
Flow splitter with partial resistance model at each port | within AixLib.Fluid.BaseClasses;
partial model PartialThreeWayResistance
"Flow splitter with partial resistance model at each port"
extends AixLib.Fluid.Interfaces.LumpedVolumeDeclarations(
final massDynamics=energyDynamics,
final mSenFac=1);
Modelica.Fluid.Interfaces.FluidPort_a port_1(
redeclare package Medium = Medium,
h_outflow(start=Medium.h_default, nominal=Medium.h_default),
m_flow(min=if (portFlowDirection_1 == Modelica.Fluid.Types.PortFlowDirection.Entering) then 0.0 else -Modelica.Constants.inf,
max=if (portFlowDirection_1== Modelica.Fluid.Types.PortFlowDirection.Leaving) then 0.0 else Modelica.Constants.inf))
"First port, typically inlet"
Modelica.Fluid.Interfaces.FluidPort_b port_2(
redeclare package Medium = Medium,
h_outflow(start=Medium.h_default, nominal=Medium.h_default),
m_flow(min=if (portFlowDirection_2 == Modelica.Fluid.Types.PortFlowDirection.Entering) then 0.0 else -Modelica.Constants.inf,
max=if (portFlowDirection_2 == Modelica.Fluid.Types.PortFlowDirection.Leaving) then 0.0 else Modelica.Constants.inf))
"Second port, typically outlet"
Modelica.Fluid.Interfaces.FluidPort_a port_3(
redeclare package Medium=Medium,
h_outflow(start=Medium.h_default, nominal=Medium.h_default),
m_flow(min=if (portFlowDirection_3==Modelica.Fluid.Types.PortFlowDirection.Entering) then 0.0 else -Modelica.Constants.inf,
max=if (portFlowDirection_3==Modelica.Fluid.Types.PortFlowDirection.Leaving) then 0.0 else Modelica.Constants.inf))
"Third port, can be either inlet or outlet"
parameter Modelica.Units.SI.Time tau=10
"Time constant at nominal flow for dynamic energy and momentum balance"
parameter Modelica.Units.SI.MassFlowRate mDyn_flow_nominal
"Nominal mass flow rate for dynamic momentum and energy balance"
parameter Boolean from_dp = true
"= true, use m_flow = f(dp) else dp = f(m_flow)"
parameter Modelica.Fluid.Types.PortFlowDirection portFlowDirection_1=Modelica.Fluid.Types.PortFlowDirection.Bidirectional
"Flow direction for port_1"
parameter Modelica.Fluid.Types.PortFlowDirection portFlowDirection_2=Modelica.Fluid.Types.PortFlowDirection.Bidirectional
"Flow direction for port_2"
parameter Modelica.Fluid.Types.PortFlowDirection portFlowDirection_3=Modelica.Fluid.Types.PortFlowDirection.Bidirectional
"Flow direction for port_3"
parameter Boolean verifyFlowReversal = false
"=true, to assert that the flow does not reverse when portFlowDirection_* does not equal Bidirectional"
parameter Modelica.Units.SI.MassFlowRate m_flow_small
"Small mass flow rate for checking flow reversal"
replaceable AixLib.Fluid.Interfaces.PartialTwoPortInterface res1
constrainedby AixLib.Fluid.Interfaces.PartialTwoPortInterface(
redeclare final package Medium = Medium,
allowFlowReversal=portFlowDirection_1 == Modelica.Fluid.Types.PortFlowDirection.Bidirectional)
"Partial model, to be replaced with a fluid component"
replaceable AixLib.Fluid.Interfaces.PartialTwoPortInterface res2
constrainedby AixLib.Fluid.Interfaces.PartialTwoPortInterface(
redeclare final package Medium = Medium,
allowFlowReversal=portFlowDirection_2 == Modelica.Fluid.Types.PortFlowDirection.Bidirectional)
"Partial model, to be replaced with a fluid component"
replaceable AixLib.Fluid.Interfaces.PartialTwoPortInterface res3
constrainedby AixLib.Fluid.Interfaces.PartialTwoPortInterface(
redeclare final package Medium = Medium,
allowFlowReversal=portFlowDirection_3 == Modelica.Fluid.Types.PortFlowDirection.Bidirectional)
"Partial model, to be replaced with a fluid component"
AixLib.Fluid.Delays.DelayFirstOrder vol(
redeclare final package Medium = Medium,
final nPorts=3,
final tau=tau,
final m_flow_nominal=mDyn_flow_nominal,
final energyDynamics=energyDynamics,
final p_start=p_start,
final T_start=T_start,
final X_start=X_start,
final C_start=C_start,
final allowFlowReversal=true,
final prescribedHeatFlowRate=false)
if have_controlVolume "Fluid volume to break algebraic loop"
protected
parameter Boolean have_controlVolume=
energyDynamics <> Modelica.Fluid.Types.Dynamics.SteadyState
"Boolean flag used to remove conditional components";
Modelica.Fluid.Interfaces.FluidPort_a port_internal(
redeclare package Medium = Medium) if not have_controlVolume
"Internal dummy port for easier connection of conditional connections"
initial equation
assert(portFlowDirection_1<>Modelica.Fluid.Types.PortFlowDirection.Leaving or
portFlowDirection_2<>Modelica.Fluid.Types.PortFlowDirection.Leaving or
portFlowDirection_3<>Modelica.Fluid.Types.PortFlowDirection.Leaving,
"In " + getInstanceName() + ": All ports are configured to
Modelica.Fluid.Types.PortFlowDirection.Leaving, which is non-physical.");
assert(portFlowDirection_1<>Modelica.Fluid.Types.PortFlowDirection.Entering or
portFlowDirection_2<>Modelica.Fluid.Types.PortFlowDirection.Entering or
portFlowDirection_3<>Modelica.Fluid.Types.PortFlowDirection.Entering,
"In " + getInstanceName() + ": All ports are configured to
Modelica.Fluid.Types.PortFlowDirection.Entering, which is non-physical.");
equation
if verifyFlowReversal then
if portFlowDirection_1==Modelica.Fluid.Types.PortFlowDirection.Entering then
assert(port_1.m_flow> -m_flow_small,
"In " + getInstanceName() + ":
Flow is leaving port_1 despite portFlowDirection_1=PortFlowDirection.Entering, since m_flow=" +
String(port_1.m_flow) + "<-"+String(m_flow_small));
end if;
if portFlowDirection_1==Modelica.Fluid.Types.PortFlowDirection.Leaving then
assert(port_1.m_flow< m_flow_small,
"In " + getInstanceName() + ":
Flow is entering port_1 despite portFlowDirection_1=PortFlowDirection.Leaving, since m_flow=" +
String(port_1.m_flow) + ">"+String(m_flow_small));
end if;
if portFlowDirection_2==Modelica.Fluid.Types.PortFlowDirection.Entering then
assert(port_2.m_flow> -m_flow_small,
"In " + getInstanceName() + ":
Flow is leaving port_2 despite portFlowDirection_2=PortFlowDirection.Entering, since m_flow=" +
String(port_2.m_flow) + "<-"+String(m_flow_small));
end if;
if portFlowDirection_2==Modelica.Fluid.Types.PortFlowDirection.Leaving then
assert(port_2.m_flow< m_flow_small,
"In " + getInstanceName() + ":
Flow is entering port_2 despite portFlowDirection_2=PortFlowDirection.Leaving, since m_flow=" +
String(port_2.m_flow) + ">"+String(m_flow_small));
end if;
if portFlowDirection_3==Modelica.Fluid.Types.PortFlowDirection.Entering then
assert(port_3.m_flow> -m_flow_small,
"In " + getInstanceName() + ":
Flow is leaving port_3 despite portFlowDirection_3=PortFlowDirection.Entering, since m_flow=" +
String(port_3.m_flow) + "<-"+String(m_flow_small));
end if;
if portFlowDirection_3==Modelica.Fluid.Types.PortFlowDirection.Leaving then
assert(port_3.m_flow< m_flow_small,
"In " + getInstanceName() + ":
Flow is entering port_3 despite portFlowDirection_3=PortFlowDirection.Leaving, since m_flow=" +
String(port_3.m_flow) + ">"+String(m_flow_small));
end if;
end if;
if portFlowDirection_1==Modelica.Fluid.Types.PortFlowDirection.Leaving then
if not have_controlVolume then
connect(res1.port_a, port_internal)
else
connect(res1.port_a, vol.ports[1])
end if;
connect(port_1, res1.port_b)
else
if not have_controlVolume then
connect(res1.port_b, port_internal)
else
connect(res1.port_b, vol.ports[1])
end if;
connect(port_1, res1.port_a)
end if;
if portFlowDirection_2==Modelica.Fluid.Types.PortFlowDirection.Leaving then
if not have_controlVolume then
connect(res2.port_a, port_internal)
else
connect(res2.port_a, vol.ports[2])
end if;
connect(port_2, res2.port_b)
else
if not have_controlVolume then
connect(res2.port_b, port_internal)
else
connect(res2.port_b, vol.ports[2])
end if;
connect(port_2, res2.port_a)
end if;
if portFlowDirection_3==Modelica.Fluid.Types.PortFlowDirection.Leaving then
if not have_controlVolume then
connect(res3.port_a, port_internal)
else
connect(res3.port_a, vol.ports[3])
end if;
connect(port_3, res3.port_b)
else
if not have_controlVolume then
connect(res3.port_b, port_internal)
else
connect(res3.port_b, vol.ports[3])
end if;
connect(port_3, res3.port_a)
end if;
end PartialThreeWayResistance; |
Flow models for pressure drop calculations | within AixLib.Fluid.BaseClasses;
package FlowModels "Flow models for pressure drop calculations"
extends Modelica.Icons.BasesPackage;
end FlowModels; |
Model that checks the correct implementation of the 1st order derivative of the flow function. This model validates the implementation of
<a href=\"modelica://AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp\">
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp</a>
and its first order derivative
<a href=\"modelica://AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der\">
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der</a>.
If the derivative implementation is wrong, the simulation will stop with an error. | within AixLib.Fluid.BaseClasses.FlowModels.Validation;
model BasicFlowFunction_dp_DerivativeCheck
"Model that checks the correct implementation of the 1st order derivative of the flow function"
extends Modelica.Icons.Example;
constant Real gain = 2 "Gain for computing the mass flow rate";
parameter Real k = 0.35 "Flow coefficient";
parameter Modelica.Units.SI.MassFlowRate m_flow_turbulent=0.36
"Mass flow rate where transition to turbulent flow occurs";
Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate";
Modelica.Units.SI.MassFlowRate m_flow_comp "Comparison value for m_flow";
Modelica.Units.SI.PressureDifference dp "Pressure drop";
Modelica.Units.SI.MassFlowRate err "Integration error";
initial equation
m_flow = m_flow_comp;
equation
dp = time*gain;
m_flow = AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp(
dp=dp,
k = k,
m_flow_turbulent=m_flow_turbulent);
der(m_flow) = der(m_flow_comp);
err = m_flow-m_flow_comp;
assert(abs(err) < 1E-3, "Error in implementation.");
end BasicFlowFunction_dp_DerivativeCheck; |
Model that checks the correct implementation of the 2nd order derivative of the flow function. This model validates the implementation of
<a href=\"modelica://AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp\">
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp</a>
and its second order derivative
<a href=\"modelica://AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der2\">
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der2</a>.
If the derivative implementation is wrong, the simulation will stop with an error. | within AixLib.Fluid.BaseClasses.FlowModels.Validation;
model BasicFlowFunction_dp_DerivativeCheck2
"Model that checks the correct implementation of the 2nd order derivative of the flow function"
extends Modelica.Icons.Example;
parameter Real k = 0.35 "Flow coefficient";
parameter Modelica.Units.SI.MassFlowRate m_flow_turbulent=0.36
"Mass flow rate where transition to turbulent flow occurs";
Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate";
Modelica.Units.SI.MassFlowRate m_flow_comp "Comparison value for m_flow";
Real der_m_flow(unit="kg/s2") "1st order derivative of mass flow rate";
Real der_m_flow_comp(unit="kg/s2")
"2nd order derivative of comparison value for m_flow";
Modelica.Units.SI.PressureDifference dp "Pressure drop";
Modelica.Units.SI.MassFlowRate err_m_flow "Integration error for m_flow";
Real err_der_m_flow(unit="kg/s2") "Integration error for der_m_flow";
initial equation
m_flow = m_flow_comp;
der_m_flow = der_m_flow_comp;
equation
// Multiply by 1 to avoid a warning due to unit mismatch,
// and raise to third power so that dp_der2 has positive and negative sign
// in AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp_der2
dp = 1*time^3;
m_flow = AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp(
dp=dp,
k = k,
m_flow_turbulent=m_flow_turbulent);
// Equate first and second order derivatives
der_m_flow = der(m_flow);
der_m_flow_comp = der(m_flow_comp);
der(der_m_flow) = der(der_m_flow_comp);
// Error control
err_m_flow = m_flow-m_flow_comp;
assert(abs(err_m_flow) < 1E-3, "Error in implementation.");
err_der_m_flow = der_m_flow-der_m_flow_comp;
assert(abs(err_der_m_flow) < 1E-3, "Error in implementation.");
end BasicFlowFunction_dp_DerivativeCheck2; |
Model that checks the correct implementation of the 1st order derivative of the flow function. This model validates the implementation of
<a href=\"modelica://AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow\">
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow</a>
and its first order derivative
<a href=\"modelica://AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der\">
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der</a>.
If the derivative implementation is wrong, the simulation will stop with an error. | within AixLib.Fluid.BaseClasses.FlowModels.Validation;
model BasicFlowFunction_m_flow_DerivativeCheck
"Model that checks the correct implementation of the 1st order derivative of the flow function"
extends Modelica.Icons.Example;
constant Real gain = 0.5 "Gain for computing the mass flow rate";
parameter Real k = 0.35 "Flow coefficient";
parameter Modelica.Units.SI.MassFlowRate m_flow_turbulent=0.36
"Mass flow rate where transition to turbulent flow occurs";
Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate";
Modelica.Units.SI.PressureDifference dp "Pressure drop";
Modelica.Units.SI.PressureDifference dp_comp "Comparison value for dp";
Modelica.Units.SI.PressureDifference err "Integration error";
initial equation
dp = dp_comp;
equation
m_flow = time*gain;
dp = AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow(
m_flow=m_flow,
k = k,
m_flow_turbulent=m_flow_turbulent);
der(dp) = der(dp_comp);
err = dp-dp_comp;
assert(abs(err) < 1E-3, "Error in implementation.");
end BasicFlowFunction_m_flow_DerivativeCheck; |
Model that checks the correct implementation of the 2nd order derivative of the flow function. This model validates the implementation of
<a href=\"modelica://AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow\">
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow</a>
and its second order derivative
<a href=\"modelica://AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der2\">
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der2</a>.
If the derivative implementation is wrong, the simulation will stop with an error. | within AixLib.Fluid.BaseClasses.FlowModels.Validation;
model BasicFlowFunction_m_flow_DerivativeCheck2
"Model that checks the correct implementation of the 2nd order derivative of the flow function"
extends Modelica.Icons.Example;
AixLib.Utilities.Diagnostics.CheckEquality cheEqu1(
threShold=1e-3)
"Block for checking integration error";
AixLib.Utilities.Diagnostics.CheckEquality cheEqu2(
threShold=1e-3)
"Block for checking integration error";
parameter Real k = 0.35 "Flow coefficient";
parameter Modelica.Units.SI.MassFlowRate m_flow_turbulent=0.36
"Mass flow rate where transition to turbulent flow occurs";
Modelica.Units.SI.PressureDifference dp "Pressure drop";
Modelica.Units.SI.PressureDifference dp_comp "Comparison value for dp";
Real der_dp(unit="Pa/s") "1st order derivative of pressure drop";
Real der_dp_comp(unit="Pa/s")
"2nd order derivative of comparison value for pressure drop";
Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate";
Modelica.Units.SI.PressureDifference err_dp "Integration error for dp";
Real err_der_dp(unit="Pa/s") "Integration error for der_dp";
initial equation
dp = dp_comp;
der_dp = der_dp_comp;
equation
// Divide by 8 to avoid a warning due to unit mismatch, and
// and raise to third power so that m_flow_der2 has positive and negative sign
// in AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow_der2
m_flow = time^3/8;
dp = AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow(
m_flow=m_flow,
k = k,
m_flow_turbulent=m_flow_turbulent);
// Equate first and second order derivatives
der_dp = der(dp);
der_dp_comp = der(dp_comp);
der(der_dp) = der(der_dp_comp);
// Error control
cheEqu1.u1 = dp;
cheEqu1.u2 = dp_comp;
err_dp = cheEqu1.y;
assert(abs(err_dp) < 1E-3, "Error in implementation.");
cheEqu2.u1 = der_dp;
cheEqu2.u2 = der_dp_comp;
err_der_dp = cheEqu2.y;
assert(abs(err_der_dp) < 1E-3, "Error in implementation.");
end BasicFlowFunction_m_flow_DerivativeCheck2; |
Test model for flow function and its inverse. This model tests the inverse formulation of the flow functions.
The pressure difference <code>dp</code> and <code>dpCalc</code> need to
be equal up to the solver tolerance, except for a small neighborhood
around the origin. In this neighborhood around the origin, the functions
<a href=\"modelica://AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp\">
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp</a>
and
<a href=\"modelica://AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow\">
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow</a>
are not invertible. | within AixLib.Fluid.BaseClasses.FlowModels.Validation;
model InverseFlowFunctions "Test model for flow function and its inverse"
extends Modelica.Icons.Example;
Modelica.Units.SI.MassFlowRate m_flow;
Modelica.Units.SI.PressureDifference dp(displayUnit="Pa")
"Pressure difference";
Modelica.Units.SI.PressureDifference dpCalc(displayUnit="Pa")
"Pressure difference computed by the flow functions";
Modelica.Units.SI.Pressure deltaDp(displayUnit="Pa")
"Pressure difference between input and output to the functions";
Modelica.Units.SI.Time dTime=2;
parameter Real k = 0.5;
parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=1 "Nominal flow rate";
equation
dp = (time-0.5)/dTime * 20;
m_flow=FlowModels.basicFlowFunction_dp(dp=dp, k=k, m_flow_turbulent=m_flow_nominal*0.3);
dpCalc=FlowModels.basicFlowFunction_m_flow(m_flow=m_flow, k=k, m_flow_turbulent=m_flow_nominal*0.3);
deltaDp = dp - dpCalc;
end InverseFlowFunctions; |
Test model that inverts basicFlowFunction_dp. This model tests whether the Modelica translator substitutes the
inverse function for
<a href=\"modelica://AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp\">
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp</a>.
Specifically, this function declares in its <code>annotation</code> section
that its inverse is provided by
<a href=\"modelica://AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow\">
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow</a>.
Translating this model should therefore give no nonlinear equations
after the symbolic manipulation. | within AixLib.Fluid.BaseClasses.FlowModels.Validation;
model InvertingBasicFlowFunction_dp
"Test model that inverts basicFlowFunction_dp"
extends Modelica.Icons.Example;
parameter Real k = 0.5 "Flow coefficient";
parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=1.5
"Nominal mass flow rate";
Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate";
Modelica.Units.SI.PressureDifference dp(displayUnit="Pa", start=0)
"Pressure difference";
equation
m_flow = 4*(time-0.5);
m_flow = FlowModels.basicFlowFunction_dp(dp=dp, k=k, m_flow_turbulent=m_flow_nominal*0.3);
end InvertingBasicFlowFunction_dp; |
Test model that inverts basicFlowFunction_m_flow. This model tests whether the Modelica translator substitutes the
inverse function for
<a href=\"modelica://AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow\">
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow</a>.
Specifically, this function declares in its <code>annotation</code> section
that its inverse is provided by
<a href=\"modelica://AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp\">
AixLib.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp</a>.
Translating this model should therefore give no nonlinear equations
after the symbolic manipulation. | within AixLib.Fluid.BaseClasses.FlowModels.Validation;
model InvertingBasicFlowFunction_m_flow
"Test model that inverts basicFlowFunction_m_flow"
extends Modelica.Icons.Example;
parameter Real k = 0.5 "Flow coefficient";
parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=0.5
"Nominal mass flow rate";
Modelica.Units.SI.MassFlowRate m_flow(start=0) "Mass flow rate";
Modelica.Units.SI.PressureDifference dp(displayUnit="Pa")
"Pressure difference";
equation
dp = 4*(time-0.5);
dp = FlowModels.basicFlowFunction_m_flow(m_flow=m_flow, k=k, m_flow_turbulent=m_flow_nominal*0.3);
end InvertingBasicFlowFunction_m_flow; |
Collection of validation models | within AixLib.Fluid.BaseClasses.FlowModels;
package Validation "Collection of validation models"
extends Modelica.Icons.ExamplesPackage;
end Validation; |
Validation model for the actuator filter. This example validates
<a href=\"modelica://AixLib.Fluid.BaseClasses.ActuatorFilter\">
AixLib.Fluid.BaseClasses.ActuatorFilter</a>.
The validation is done for different settings of <code>u_nominal</code> and for
different start values of the filter output. | within AixLib.Fluid.BaseClasses.Validation;
model ActuatorFilter "Validation model for the actuator filter"
extends Modelica.Icons.Example;
parameter Modelica.Units.SI.Time riseTime=10 "Cut-off frequency of filter";
final parameter Modelica.Units.SI.Frequency fCut=5/(2*Modelica.Constants.pi*
riseTime) "Cut-off frequency of filter";
AixLib.Fluid.BaseClasses.ActuatorFilter act_1(f=fCut, initType=Modelica.Blocks.Types.Init.InitialState)
"Filter with u_nominal not set"
AixLib.Fluid.BaseClasses.ActuatorFilter act_2(f=fCut, initType=Modelica.Blocks.Types.Init.InitialState)
"Filter with u_nominal set to 100"
Modelica.Blocks.Math.Gain gain(k=100) "Gain for input signal"
Modelica.Blocks.Sources.Step step(startTime=0)
AixLib.Fluid.BaseClasses.ActuatorFilter act_y_start05(
f=fCut,
initType=Modelica.Blocks.Types.Init.InitialOutput,
y_start=0.5) "Filter with initial start value for output"
AixLib.Fluid.BaseClasses.ActuatorFilter act_y_start1(
f=fCut,
initType=Modelica.Blocks.Types.Init.InitialOutput,
y_start=1) "Filter with initial start value for output"
equation
connect(act_2.u, gain.y)
connect(step.y, act_1.u)
connect(step.y, gain.u)
connect(act_y_start05.u, step.y)
connect(act_y_start1.u, step.y)
end ActuatorFilter; |
Example use of MassFlowRateMultiplier | within AixLib.Fluid.BaseClasses.Validation;
model MassFlowRateMultiplier "Example use of MassFlowRateMultiplier"
extends Modelica.Icons.Example;
package Medium = AixLib.Media.Water;
AixLib.Fluid.BaseClasses.MassFlowRateMultiplier
massFlowRateMultiplier(
redeclare package Medium = Medium,
k=5)
"Mass flow rate multiplier"
Modelica.Blocks.Sources.Ramp ram_m_flow(
height=10,
duration=10,
offset=0) "Mass flow rate ramp"
AixLib.Fluid.Sources.MassFlowSource_T sou(
redeclare package Medium = Medium,
use_m_flow_in=true,
nPorts=1) "Mass flow source"
AixLib.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
nPorts=2)
"Mass flow sink"
AixLib.Fluid.BaseClasses.MassFlowRateMultiplier
massFlowRateMultiplier1(
redeclare package Medium = Medium,
use_input=true,
k=5)
"Mass flow rate multiplier"
Modelica.Blocks.Sources.Ramp gaiMasFlo(
height=4.9,
duration=10,
offset=0.1) "Mass flow rate multiplier factor"
AixLib.Fluid.Sources.MassFlowSource_T sou1(
redeclare package Medium = Medium,
use_m_flow_in=true,
nPorts=1) "Mass flow source"
equation
connect(ram_m_flow.y, sou.m_flow_in)
connect(sou.ports[1], massFlowRateMultiplier.port_a)
connect(massFlowRateMultiplier.port_b, sin.ports[1])
connect(sou1.ports[1], massFlowRateMultiplier1.port_a)
connect(massFlowRateMultiplier1.port_b, sin.ports[2])
connect(gaiMasFlo.y, massFlowRateMultiplier1.u)
connect(ram_m_flow.y, sou1.m_flow_in)
end MassFlowRateMultiplier; |
Collection of validation models | within AixLib.Fluid.BaseClasses;
package Validation "Collection of validation models"
extends Modelica.Icons.ExamplesPackage;
end Validation; |
Boiler with internal and external control. | within AixLib.Fluid.BoilerCHP;
model Boiler "Boiler with internal and external control"
extends AixLib.Fluid.BoilerCHP.BaseClasses.PartialHeatGenerator(a=paramBoiler.pressureDrop,
vol(energyDynamics=energyDynamics,
V=paramBoiler.volume));
parameter AixLib.DataBase.Boiler.General.BoilerTwoPointBaseDataDefinition
paramBoiler
"Parameters for Boiler"
parameter
AixLib.DataBase.Boiler.DayNightMode.HeatingCurvesDayNightBaseDataDefinition
paramHC
"Parameters for heating curve"
parameter Real KR=1
"Gain of Boiler heater"
parameter Modelica.Units.SI.Time TN=0.1
"Time Constant of boiler heater (T>0 required)"
parameter Modelica.Units.SI.Time riseTime=30
"Rise/Fall time for step input(T>0 required)"
parameter Real declination=1.1
"Declination"
parameter Modelica.Units.SI.TemperatureDifference Tdelta_Max=2
"Difference from set flow temperature over which boiler stops"
parameter Modelica.Units.SI.TemperatureDifference Tdelta_Min=2
"Difference from set flow temperature under which boiler starts"
parameter Modelica.Units.SI.Time Fb=3600
"Period of time for increased set temperature"
parameter Real FA=0.2 "Increment for increased set temperature"
parameter Modelica.Fluid.Types.Dynamics energyDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial
"Type of energy balance: dynamic (3 initialization options) or steady state"
Modelica.Blocks.Interfaces.BooleanInput isOn
"Switches Controler on and off"
Modelica.Blocks.Interfaces.RealInput TAmbient(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
"Ambient air temperature"
Modelica.Blocks.Interfaces.BooleanInput switchToNightMode
"Connector of Boolean input signal"
replaceable model ExtControl =
AixLib.Fluid.BoilerCHP.BaseClasses.Controllers.ExternalControlNightDayHC
constrainedby
AixLib.Fluid.BoilerCHP.BaseClasses.Controllers.PartialExternalControl
"External control"
BaseClasses.Controllers.InternalControl internalControl(
final paramBoiler=paramBoiler,
final KR=KR,
final TN=TN,
final riseTime=riseTime,
final energyDynamics=energyDynamics)
"Internal control"
ExtControl myExternalControl(
final paramHC=paramHC,
final declination=declination,
final Tdelta_Max=Tdelta_Max,
final Tdelta_Min=Tdelta_Min,
final Fb=Fb,
final FA=FA)
"External control"
equation
connect(internalControl.QflowHeater, heater.Q_flow)
connect(senTCold.T, internalControl.TFlowCold)
connect(senTHot.T, internalControl.TFlowHot)
connect(senMasFlo.m_flow, internalControl.mFlow)
connect(isOn, myExternalControl.isOn)
connect(senTHot.T, myExternalControl.TFlowIs)
connect(myExternalControl.isOn_final, internalControl.isOn)
connect(myExternalControl.TFlowSet, internalControl.Tflow_set)
connect(TAmbient,myExternalControl.TOutside)
connect(myExternalControl.switchToNightMode,switchToNightMode)
end Boiler; |
Boiler model with physics only. | within AixLib.Fluid.BoilerCHP;
model BoilerNoControl "Boiler model with physics only"
extends AixLib.Fluid.BoilerCHP.BaseClasses.PartialHeatGenerator(a=paramBoiler.pressureDrop,
vol(energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
final V=V));
parameter AixLib.DataBase.Boiler.General.BoilerTwoPointBaseDataDefinition
paramBoiler "Parameters for Boiler"
parameter Modelica.Units.SI.ThermalConductance G=0.003*Q_nom/50
"Constant thermal conductance to environment(G=Q_loss/dT)";
parameter Modelica.Units.SI.HeatCapacity C=1.5*Q_nom
"Heat capacity of metal (J/K)";
parameter Modelica.Units.SI.Volume V=paramBoiler.volume "Volume";
parameter Modelica.Units.SI.Power Q_nom=paramBoiler.Q_nom
"Nominal heating power";
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor internalCapacity(
final C=C, T(start=T_start)) "Boiler thermal capacity (dry weight)"
Modelica.Thermal.HeatTransfer.Components.ThermalConductor ConductanceToEnv(
final G=G) "Thermal resistance of the boiler casing"
Modelica.Blocks.Math.Product QgasCalculation "Calculate gas usage"
Modelica.Blocks.Nonlinear.Limiter limiter(final uMax=1, final uMin=0)
"Limits the rel power between 0 and 1"
Modelica.Blocks.Sources.RealExpression NominalGasConsumption(final y=Q_nom/
max(etaLoadBased[:,2]*max(etaTempBased[:,2])))
"Nominal gas power"
Modelica.Blocks.Interfaces.RealOutput fuelPower
"Connector of Real output signal"
Modelica.Blocks.Interfaces.RealOutput thermalPower "Value of Real output"
Modelica.Blocks.Interfaces.RealInput u_rel "Relative gas power [0,1]"
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b T_amb "Heat port for heat losses to ambient"
Modelica.Blocks.Tables.CombiTable1Dv efficiencyTableLoadDepending(
final tableOnFile=false,
final table=etaLoadBased,
final columns={2},
final smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative)
"Table with efficiency parameters"
Modelica.Blocks.Math.Product QflowCalculation
"Calculation of the produced heatflow"
Modelica.Blocks.Interfaces.RealOutput T_out
"Outflow temperature of the passing fluid"
Modelica.Blocks.Interfaces.RealOutput T_in "Inflow temperature of the passing fluid"
parameter Real etaLoadBased[:,2]=paramBoiler.eta
"Table matrix for part load based efficiency (e.g. [0,0.99; 0.5, 0.98; 1, 0,97])";
parameter Real etaTempBased[:,2]=[293.15,1.09; 303.15,1.08; 313.15,1.05; 323.15,1.; 373.15,0.99]
"Table matrix for temperature based efficiency";
Modelica.Blocks.Math.Product etaCalculation
"calculates the efficiency of the boiler"
Modelica.Blocks.Tables.CombiTable1Dv efficiencyTableLoadDepending1(
final tableOnFile=false,
final table=etaTempBased,
final columns={2},
final smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative)
"Table with efficiency parameters"
equation
connect(vol.heatPort, ConductanceToEnv.port_a)
connect(vol.heatPort, internalCapacity.port)
connect(QgasCalculation.y, fuelPower)
connect(limiter.u, u_rel)
connect(ConductanceToEnv.port_b, T_amb)
connect(QgasCalculation.u1, NominalGasConsumption.y)
connect(limiter.y, QgasCalculation.u2)
connect(limiter.y, efficiencyTableLoadDepending.u[1])
connect(QflowCalculation.y, heater.Q_flow)
connect(QflowCalculation.y, thermalPower)
connect(QgasCalculation.y, QflowCalculation.u2)
connect(senTHot.T, T_out)
connect(senTCold.T, T_in)
connect(port_b, port_b)
connect(efficiencyTableLoadDepending.y[1], etaCalculation.u1)
connect(efficiencyTableLoadDepending1.y[1], etaCalculation.u2)
connect(senTCold.T, efficiencyTableLoadDepending1.u[1])
connect(QflowCalculation.u1, etaCalculation.y)
end BoilerNoControl; |
Table based CHP model. | within AixLib.Fluid.BoilerCHP;
model CHP "Table based CHP model"
extends AixLib.Fluid.BoilerCHP.BaseClasses.PartialHeatGenerator(a=1e10,
vol(V=param.vol[1]));
parameter AixLib.DataBase.CHP.CHPDataSimple.CHPBaseDataDefinition param
"CHP data set"
parameter Real minCapacity
"Minimum allowable working capacity in percent"
parameter Boolean electricityDriven = false
"If the CHP is controlled by electricity demand (external table required)"
parameter Boolean TSetIn = true
"Input temperature setpoint from outside (Otherwise max temp in database)"
parameter Boolean ctrlStrategy = true
"True for flow-, false for return- temperature control strategy"
parameter Modelica.Units.SI.TemperatureDifference minDeltaT=10
"Minimum flow and return temperature difference"
parameter Modelica.Units.SI.TemperatureDifference TFlowRange=2
"Range of allowable flow temperature"
parameter Modelica.Units.SI.Time delayTime=3600 "Shutdown/Startup delay"
parameter Real Kc = 1
"Gain of the controller"
parameter Modelica.Units.SI.Time Tc=60 "Time Constant (T>0 required)"
parameter Modelica.Units.SI.Time delayUnit=60
"Delay measurement of the controller output"
Modelica.Blocks.Interfaces.RealInput TSet(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC") if TSetIn
"Temperature setpoint"
Modelica.Blocks.Interfaces.RealInput elSet(
final quantity="Power",
final unit="kW") if electricityDriven
"Electrical power setpoint"
Modelica.Blocks.Interfaces.BooleanInput on
"False for shut down"
Modelica.Blocks.Interfaces.RealOutput TSource(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
"Combustion temperature"
Modelica.Blocks.Interfaces.RealOutput electricalPower(
final quantity="Power",
final unit="kW")
"Electrical power"
Modelica.Blocks.Interfaces.RealOutput thermalPower(
final unit="kW")
"Thermal power"
Modelica.Blocks.Interfaces.RealOutput fuelInput(
final unit="kW")
"Fuel input"
Modelica.Blocks.Interfaces.RealOutput fuelConsumption
"Fuel consumption"
BaseClasses.Controllers.DelayedOnOffController delayedOnOffController(
final maxTReturn=param.maxTReturn,
final minDeltaT=minDeltaT,
final TFlowRange=TFlowRange,
final delayTime=delayTime,
final delayUnit=delayUnit,
final minCapacity=minCapacity)
"OnOff controller to swicht between the modes"
BaseClasses.Controllers.PIController thControl(
final Kc=Kc,
final Tc=Tc,
final minCapacity=minCapacity)
"Thermal controller"
Modelica.Blocks.Math.Min min
"Determines the min value of both PI controllers"
Modelica.Blocks.Tables.CombiTable1Ds combiTable1Ds(
tableName="NoName",
fileName="NoName",
final table=param.data_CHP)
"Time table to read CHP performance data"
Modelica.Blocks.Continuous.LimPID elControl(
controllerType=Modelica.Blocks.Types.SimpleController.PI,
yMax=100,
yMin=0,
y_start=0,
final k=Kc,
final Ti=Tc)
"Electrical controller"
Modelica.Blocks.Sources.Constant constSetpoint(
final k=if ctrlStrategy then (param.maxTFlow) else (param.maxTReturn))
"Constant setpoint if utilized"
Modelica.Blocks.Sources.Constant const(final k=minCapacity + 10)
"Adds safety value on min capacity"
Modelica.Blocks.Logical.Switch ctrlSwitch
"Changes the measured temperature source"
Modelica.Blocks.Sources.BooleanConstant booleanConstant(k=ctrlStrategy)
"Determines control strategy"
Modelica.Blocks.Math.Gain gain(final k=1000)
"Conversion factor"
Modelica.Blocks.Sources.Constant exothermicTemperature(k=1783.4)
"Exothermic temperature"
equation
if electricityDriven then
connect(elSet, elControl.u_s);
else
elControl.u_s = 1e9;
end if;
if TSetIn then
connect(TSet,delayedOnOffController.flowTemp_setpoint);
connect(TSet,thControl.setpoint);
else
connect(constSetpoint.y,delayedOnOffController.flowTemp_setpoint);
connect(constSetpoint.y,thControl.setpoint);
end if;
connect(senTCold.T, ctrlSwitch.u3)
connect(senTHot.T, ctrlSwitch.u1)
connect(booleanConstant.y, ctrlSwitch.u2)
connect(delayedOnOffController.returnTemp, ctrlSwitch.u3)
connect(delayedOnOffController.flowTemp, ctrlSwitch.u1)
connect(const.y,delayedOnOffController.minCapacity_in)
connect(ctrlSwitch.y, thControl.measurement)
connect(delayedOnOffController.y,thControl.on)
connect(elControl.y, min.u1)
connect(thControl.y, min.u2)
connect(min.y, combiTable1Ds.u)
connect(min.y,delayedOnOffController.controllerOutput)
connect(combiTable1Ds.y[1],electricalPower)
connect(elControl.u_m,electricalPower)
connect(delayedOnOffController.externalOn,on)
connect(combiTable1Ds.y[2], gain.u)
connect(gain.y, heater.Q_flow)
connect(exothermicTemperature.y,TSource)
connect(combiTable1Ds.y[2],thermalPower)
connect(combiTable1Ds.y[3],fuelInput)
connect(combiTable1Ds.y[4],fuelConsumption)
end CHP; |
Table based CHP model without an internal controller. <b><span style=\"color: #008000;\">Overview</span></b> | within AixLib.Fluid.BoilerCHP;
model CHPNoControl
"Table based CHP model without an internal controller"
extends AixLib.Fluid.BoilerCHP.BaseClasses.PartialHeatGenerator(a=1e10, vol(
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial,
V=param.vol[1]));
parameter AixLib.DataBase.CHP.CHPDataSimple.CHPBaseDataDefinition param
"CHP data set"
parameter Real minCapacity = 0
"Minimum allowable working capacity (unit [-])"
parameter Modelica.Units.SI.ThermalConductance G=0.003*param.data_CHP[end, 3]
/50 "Constant thermal conductance to environment(G=Q_loss/dT)";
parameter Modelica.Units.SI.HeatCapacity C=1.5*param.data_CHP[end, 3]
"Heat capacity of metal (J/K)";
Modelica.Blocks.Interfaces.RealInput u_rel(
final unit="1") "Relative"
Modelica.Blocks.Interfaces.RealOutput electricalPower(
final quantity="Power", final unit="W")
"Electrical power"
Modelica.Blocks.Interfaces.RealOutput thermalPower(final unit="W")
"Thermal power"
Modelica.Blocks.Interfaces.RealOutput fuelInput(final unit="W")
"Fuel input"
Modelica.Blocks.Interfaces.RealOutput fuelConsumption
"Fuel consumption"
Modelica.Blocks.Tables.CombiTable1Ds combiTable1Ds(
tableName="NoName",
fileName="NoName",
final table=param.data_CHP)
"Time table to read CHP performance data"
Modelica.Blocks.Math.Gain gain(final k=1000) "Conversion factor"
Modelica.Blocks.Nonlinear.Limiter limiter(final uMax=1, final uMin=
minCapacity)
"Limits the rel power between 0 and 1"
Modelica.Blocks.Math.Gain gain4(final k=1000)
"Conversion factor"
Modelica.Blocks.Math.Gain gain1(final k=1000)
"Conversion factor"
Modelica.Blocks.Math.Gain gain2(final k=1000)
"Conversion factor"
Modelica.Blocks.Math.Gain gain3(final k=1000)
"Conversion factor"
Modelica.Blocks.Interfaces.RealOutput T_out
"Outflow temperature of the passing fluid"
Modelica.Blocks.Interfaces.RealOutput T_in "Inflow temperature of the passing fluid"
Modelica.Blocks.Math.Gain toPercent(final k=100) "Conversion factor"
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor internalCapacity(final C=C,
T(start=T_start)) "Boiler thermal capacity (dry weight)"
Modelica.Thermal.HeatTransfer.Components.ThermalConductor ConductanceToEnv(final G=G)
"Thermal resistance of the boiler casing"
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b T_amb "Heat port for heat losses to ambient"
equation
connect(combiTable1Ds.y[2], gain.u)
connect(gain.y, heater.Q_flow)
connect(combiTable1Ds.y[4], gain4.u)
connect(gain4.y, fuelConsumption)
connect(gain1.u, combiTable1Ds.y[1])
connect(gain2.u, combiTable1Ds.y[2])
connect(gain3.u, combiTable1Ds.y[3])
connect(senTHot.T,T_out)
connect(senTCold.T,T_in)
connect(limiter.u, u_rel)
connect(limiter.y, toPercent.u)
connect(toPercent.y, combiTable1Ds.u)
connect(vol.heatPort,internalCapacity. port)
connect(ConductanceToEnv.port_b,T_amb)
connect(ConductanceToEnv.port_a, vol.heatPort)
connect(gain1.y, electricalPower)
connect(gain2.y, thermalPower)
connect(gain3.y, fuelInput)
end CHPNoControl; |
Package with model parameters for combined heat and power systems | within AixLib.Fluid.BoilerCHP;
package Data
"Package with model parameters for combined heat and power systems"
extends Modelica.Icons.MaterialPropertiesPackage;
package ModularCHP "Data for the modular CHP model"
record EngineMaterialData
extends Modelica.Icons.Record;
constant Modelica.Units.SI.ThermalConductivity lambda=44.5
"Thermal conductivity of the engine block material (default value is 44.5)";
constant Modelica.Units.SI.Density rhoEngWall=7200
"Density of the the engine block material (default value is 72000)";
constant Modelica.Units.SI.SpecificHeatCapacity c=535
"Specific heat capacity of the cylinder wall material (default value is 535)";
end EngineMaterialData;
record EngineMaterial_CastIron "Cast iron as engine housing material"
extends Data.ModularCHP.EngineMaterialData(
lambda=44.5, rhoEngWall=7200, c=535);
end EngineMaterial_CastIron;
record EngineMaterial_SpheroidalGraphiteIron
"Spheroidal graphite iron as engine housing material"
extends Data.ModularCHP.EngineMaterialData(
lambda=36.2, rhoEngWall=7100, c=515);
end EngineMaterial_SpheroidalGraphiteIron;
record EngineMaterial_CastAluminium
"Cast aluminium as engine housing material"
extends Data.ModularCHP.EngineMaterialData(
lambda=140, rhoEngWall=2500, c=910);
//Source: https://www.makeitfrom.com/material-properties/EN-AC-43300-AISi9Mg-Cast-Aluminum
end EngineMaterial_CastAluminium;
end ModularCHP;
end Data; |
Simple heat generator without control. | within AixLib.Fluid.BoilerCHP;
model HeatGeneratorNoControl "Simple heat generator without control"
extends AixLib.Fluid.BoilerCHP.BaseClasses.PartialHeatGenerator(
a=coeffPresLoss, vol(V=V));
Modelica.Blocks.Interfaces.RealInput Q_flow(final unit="W")
"Prescribed heat flow"
Modelica.Blocks.Interfaces.RealOutput TCold(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
"Temperature of the passing fluid"
Modelica.Blocks.Interfaces.RealOutput THot(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
"Temperature of the passing fluid"
Modelica.Blocks.Interfaces.RealOutput massFlow(quantity="MassFlowRate",
final unit="kg/s")
"Mass flow rate from port_a to port_b"
parameter Modelica.Units.SI.Volume V
"Volume of the heat exchanger inside the heat generator";
parameter Real coeffPresLoss
"Pressure loss coefficient of the heat generator";
equation
connect(heater.Q_flow, Q_flow)
connect(senTCold.T,TCold)
connect(senTHot.T,THot)
connect(senMasFlo.m_flow, massFlow)
end HeatGeneratorNoControl; |
Package with boiler and CHP models | within AixLib.Fluid;
package BoilerCHP "Package with boiler and CHP models"
extends Modelica.Icons.VariantsPackage;
end BoilerCHP; |
Model for temperature depending efficiency of a condensing boiler. This model calculates the efficiency of a condensing boiler and is
based upon the literature <i><a href=
\"https://core.ac.uk/download/pdf/46816799.pdf\">Règles de modélisation
des systèmes énergétiques dans les bâtiments basse
consommation</a></i> | within AixLib.Fluid.BoilerCHP.BaseClasses;
model CondensingBoilerEfficiency
"Model for temperature depending efficiency of a condensing boiler"
parameter Real lambda=0.01 "Offset variable of weighting coefficients sigmas";
parameter Modelica.Units.SI.Temperature T_nom=343.15 "Nominal temperature";
parameter Modelica.Units.SI.Temperature T_part=308.15
"Intermediate temperature";
parameter Modelica.Units.SI.Efficiency eta_nom=1
"Nominal net heating value efficiency";
parameter Modelica.Units.SI.Efficiency eta_int=1
"Intermediate net heating value efficiency";
parameter Real eta_max=1.11
"Ratio gross (high) heating value / net (low) heating value defined according to the fuel";
parameter Real ak=-0.0002 "Sensible temperature depending efficiency decrease per K";
Real etaSens;
Real etaCond;
Real sigmaSens;
Real sigmaCond;
Real etaRP;
Modelica.Units.SI.Temperature Tc(
start=360,
max=380,
min=323,
nominal=360)
"Temperature of Sensitive and Latent characteristic intersection";
//start value is important: equation below has two solutions
Modelica.Blocks.Interfaces.RealInput T_in(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC") "Ambient air temperature"
Modelica.Blocks.Interfaces.RealOutput eta "Value of Real output"
algorithm
//The boiler is launched for partLoadRate (boilerBus.PLR) > PLR_min, if partLoadRate < PLR_min there is no combustion and the efficiency etaRP is zero
//Determination of the efficiency for the law without condensation
etaSens := eta_nom + ak*(T_in - T_nom);
//Determination of the efficiency for the law characterizing the condensation
etaCond := eta_int + (eta_max - eta_int)*(1 - AixLib.Utilities.Psychrometrics.Functions.saturationPressure(T_in)/AixLib.Utilities.Psychrometrics.Functions.saturationPressure(T_part)*T_part/T_in);
sigmaCond := 1/(1 + exp(T_in - Tc - lambda));
sigmaSens := 1 - 1/(1 + exp(T_in - Tc + lambda));
etaRP := sigmaSens*etaSens + sigmaCond*etaCond;
equation
//Calculation of Tc
eta_nom + ak*(Tc - T_nom) = eta_int + (eta_max - eta_int)*(1 - AixLib.Utilities.Psychrometrics.Functions.saturationPressure(Tc)/AixLib.Utilities.Psychrometrics.Functions.saturationPressure(T_part)*
T_part/Tc);
eta = etaRP;
end CondensingBoilerEfficiency; |
Package with base classes for Aix.BoilerCHP | within AixLib.Fluid.BoilerCHP;
package BaseClasses "Package with base classes for Aix.BoilerCHP"
extends Modelica.Icons.BasesPackage;
end BaseClasses; |
Partial model for heat generators | within AixLib.Fluid.BoilerCHP.BaseClasses;
partial model PartialHeatGenerator "Partial model for heat generators"
extends AixLib.Fluid.Interfaces.PartialTwoPortInterface;
parameter Modelica.Units.SI.Time tau=1
"Time constant of the temperature sensors at nominal flow rate"
parameter Modelica.Blocks.Types.Init initType=Modelica.Blocks.Types.Init.InitialState
"Type of initialization (InitialState and InitialOutput are identical)"
parameter Modelica.Units.SI.Temperature T_start=Medium.T_default
"Initial or guess value of output (= state)"
parameter Boolean transferHeat=false
"If true, temperature T converges towards TAmb when no flow"
parameter Modelica.Units.SI.Temperature TAmb=Medium.T_default
"Fixed ambient temperature for heat transfer"
parameter Modelica.Units.SI.Time tauHeaTra=1200
"Time constant for heat transfer, default 20 minutes"
parameter Modelica.Units.SI.AbsolutePressure dp_start=0
"Guess value of dp = port_a.p - port_b.p"
parameter Modelica.Units.SI.MassFlowRate m_flow_start=0
"Guess value of m_flow = port_a.m_flow"
parameter Modelica.Units.SI.AbsolutePressure p_start=Medium.p_default
"Start value of pressure"
parameter Modelica.Units.SI.PressureDifference dp_nominal=m_flow_nominal^2*a/
(rho_default^2) "Pressure drop at nominal mass flow rate"
parameter Boolean from_dp=false
"= true, use m_flow = f(dp) else dp = f(m_flow)"
parameter Boolean linearized=false
"= true, use linear relation between m_flow and dp for any flow rate"
parameter Real deltaM=0.3
"Fraction of nominal mass flow rate where transition to turbulent occurs"
parameter Real a "Coefficient of old approach from model Modelica.Fluid.Fittings.GenericResistances.VolumeFlowRate. Recalculated to dp_nominal based on IBPSA approach."
Sensors.TemperatureTwoPort senTCold(
redeclare final package Medium = Medium,
final tau=tau,
final m_flow_nominal=m_flow_nominal,
final initType=initType,
final T_start=T_start,
final transferHeat=transferHeat,
final TAmb=TAmb,
final tauHeaTra=tauHeaTra,
final allowFlowReversal=allowFlowReversal,
final m_flow_small=m_flow_small)
"Temperature sensor of cold side of heat generator (return)"
Sensors.TemperatureTwoPort senTHot(
redeclare final package Medium = Medium,
final tau=tau,
final m_flow_nominal=m_flow_nominal,
final initType=initType,
final T_start=T_start,
final transferHeat=transferHeat,
final TAmb=TAmb,
final tauHeaTra=tauHeaTra,
final allowFlowReversal=allowFlowReversal,
final m_flow_small=m_flow_small)
"Temperature sensor of hot side of heat generator (supply)"
Sensors.MassFlowRate senMasFlo(
redeclare final package Medium = Medium,
final allowFlowReversal=allowFlowReversal)
"Sensor for mass flwo rate"
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow heater
"Prescribed heat flow"
MixingVolumes.MixingVolume vol(
redeclare final package Medium = Medium,
final m_flow_nominal=m_flow_nominal,
final m_flow_small=m_flow_small,
final allowFlowReversal=allowFlowReversal,
final nPorts=2,
final p_start=p_start,
final T_start=T_start)
"Fluid volume"
FixedResistances.PressureDrop pressureDrop(
redeclare final package Medium = Medium,
final m_flow_nominal=m_flow_nominal,
final show_T=false,
final allowFlowReversal=allowFlowReversal,
final dp_nominal=dp_nominal)
"Pressure drop"
parameter Modelica.Units.SI.Density rho_default=Medium.density_pTX(
Medium.p_default,
Medium.T_default,
Medium.X_default) "Density used for parameterization of pressure curve"
equation
connect(port_a, senTCold.port_a)
connect(senTCold.port_b, vol.ports[1])
connect(vol.ports[2], pressureDrop.port_a)
connect(senMasFlo.port_b, port_b)
connect(pressureDrop.port_b, senTHot.port_a)
connect(senTHot.port_b, senMasFlo.port_a)
connect(heater.port, vol.heatPort)
end PartialHeatGenerator; |
On/Off controller for boiler models. | within AixLib.Fluid.BoilerCHP.BaseClasses.Controllers;
model ControllerOnOff "On/Off controller for boiler models"
Modelica.Blocks.Interfaces.BooleanInput onOffExtern
"On/Off signal"
Modelica.Blocks.Interfaces.BooleanInput THigh
"Medium temperature is too high"
Modelica.Blocks.Interfaces.BooleanInput TLow
"Medium temperature is too low"
Modelica.Blocks.Interfaces.BooleanOutput onOffFinal
"Output signal"
Modelica.Blocks.Logical.And onOff
equation
connect(onOffExtern,onOff. u1)
connect(onOff.y,onOffFinal)
algorithm
if TLow then
onOff.u2 :=true;
elseif THigh then
onOff.u2 :=false;
end if;
end ControllerOnOff; |
CHP engine data for calculations. Model of an easy on-off-controller for the modular CHP model. | within AixLib.Fluid.BoilerCHP.BaseClasses.Controllers;
model ControllerOnOffModularCHP
parameter
AixLib.DataBase.CHP.ModularCHPEngineData.CHPEngDataBaseRecord
CHPEngineModel=DataBase.CHP.ModularCHPEngineData.CHP_ECPowerXRGI15()
"CHP engine data for calculations"
parameter Modelica.Units.SI.Time startTimeChp=0
"Start time for discontinous simulation tests to heat the Chp unit up to the prescribed return temperature";
parameter Real modTab[:,2]=[0.0,0.8; 7200,0.8; 7200,0.93; 10800,0.93; 10800,
0.62; 14400,0.62; 14400,0.8; 18000,0.8; 18000,0.0]
"Table for unit modulation (time = first column; modulation factors = second column)";
Modelica.Blocks.Logical.Timer timerIsOff
Modelica.Blocks.Logical.Not not1
Modelica.Blocks.Logical.LessThreshold declarationTime(threshold=7200)
Modelica.Blocks.Logical.Or pumpControl
AixLib.Controls.Interfaces.CHPControlBus modCHPConBus
Modelica.Blocks.Sources.TimeTable modulationFactorControl(
startTime=startTimeChp, table=modTab)
Modelica.Blocks.Logical.GreaterThreshold greaterThreshold
equation
connect(timerIsOff.u,not1. y)
connect(timerIsOff.y,declarationTime. u)
connect(declarationTime.y,pumpControl. u1)
connect(pumpControl.y, modCHPConBus.isOnPump)
connect(modulationFactorControl.y, modCHPConBus.modFac)
connect(greaterThreshold.y, not1.u)
connect(pumpControl.u2, not1.u)
connect(greaterThreshold.y, modCHPConBus.isOn)
connect(greaterThreshold.u, modulationFactorControl.y)
end ControllerOnOffModularCHP; |
CHP On/Off controller. | within AixLib.Fluid.BoilerCHP.BaseClasses.Controllers;
model DelayedOnOffController "CHP On/Off controller"
parameter Modelica.Units.SI.Temperature maxTReturn
"Maximum return temperature";
parameter Modelica.Units.SI.ThermodynamicTemperature minDeltaT
"Minimum flow and return temperature difference";
parameter Modelica.Units.SI.ThermodynamicTemperature TFlowRange
"Range of the flow temperature";
parameter Modelica.Units.SI.Time delayTime "On/Off delay time";
parameter Boolean initialOutput=false
"Initial output";
parameter Real delayUnit
"Delay unit";
parameter Real minCapacity
"Minimum allowable working capacity in percent";
Modelica.Blocks.Interfaces.RealInput flowTemp(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
"Flow temperature"
Modelica.Blocks.Interfaces.RealInput returnTemp(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
"Return temperature"
Modelica.Blocks.Interfaces.BooleanOutput y
"Signal if controller is on or off"
Modelica.Blocks.Interfaces.RealInput controllerOutput
"Controller output"
Modelica.Blocks.Interfaces.RealInput minCapacity_in
"Minimal capacity"
Modelica.Blocks.Interfaces.BooleanInput externalOn
"False for shut down"
Modelica.Blocks.Interfaces.RealInput flowTemp_setpoint(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
"Flow temperature setpoint"
Modelica.Blocks.Logical.And and1
Modelica.Blocks.Logical.Pre pre2
Modelica.Blocks.Logical.OnOffController onOffController(
final bandwidth=minDeltaT)
"OnOff controller"
Modelica.Blocks.Logical.LessThreshold lessThreshold(
threshold=TFlowRange)
"Maximum allowable flow temperature variation"
Modelica.Blocks.Logical.Or or1
Modelica.Blocks.Logical.GreaterThreshold greaterThreshold(
threshold=maxTReturn)
"Max return temperature limit"
Modelica.Blocks.Discrete.UnitDelay unitDelay(final samplePeriod=delayUnit)
"Last value"
Modelica.Blocks.Math.Feedback feedback
Modelica.Blocks.Logical.Not not1
Modelica.Blocks.Logical.Not not2
Modelica.Blocks.Logical.LogicalSwitch logicalSwitch
Modelica.Blocks.Logical.Not not3
Modelica.Blocks.Logical.Or or3
Modelica.Blocks.Logical.LessThreshold lessThreshold1(
final threshold=minCapacity)
Modelica.Blocks.Logical.GreaterEqualThreshold greaterEqualThreshold(
threshold=130 + 273.15)
"Emergency measure"
Modelica.Blocks.Logical.Or or4
Modelica.Blocks.MathBoolean.OnDelay onDelay(
final delayTime=delayTime)
"On delay"
Modelica.Blocks.MathBoolean.OnDelay onDelay1(
final delayTime=delayTime)
"On delay"
Modelica.Blocks.Nonlinear.FixedDelay fixedDelay(
final delayTime=delayTime)
"Fixed delay"
initial equation
pre(y)=initialOutput;
equation
connect(onOffController.y, pre2.u)
connect(feedback.u2,flowTemp)
connect(pre2.y, and1.u2)
connect(lessThreshold.y, and1.u1)
connect(feedback.y, lessThreshold.u)
connect(and1.y, or1.u1)
connect(onOffController.u,controllerOutput)
connect(onOffController.reference,minCapacity_in)
connect(or1.u2, greaterThreshold.y)
connect(externalOn, not3.u)
connect(flowTemp_setpoint, feedback.u1)
connect(or3.u2, or1.y)
connect(not3.y, or3.u1)
connect(or3.y, not1.u)
connect(greaterThreshold.u,returnTemp)
connect(greaterEqualThreshold.u,flowTemp)
connect(greaterEqualThreshold.y, or4.u2)
connect(logicalSwitch.y, or4.u1)
connect(unitDelay.u,controllerOutput)
connect(lessThreshold1.y, logicalSwitch.u2)
connect(onDelay.u, not1.y)
connect(onDelay.y, not2.u)
connect(onDelay1.u, or3.y)
connect(onDelay1.y, logicalSwitch.u1)
connect(not2.y, logicalSwitch.u3)
connect(or4.y, y)
connect(unitDelay.y, fixedDelay.u)
connect(fixedDelay.y, lessThreshold1.u)
end DelayedOnOffController; |
With night and day modes, both with heating curves. | within AixLib.Fluid.BoilerCHP.BaseClasses.Controllers;
model ExternalControlNightDayHC
"With night and day modes, both with heating curves"
extends PartialExternalControl;
parameter
AixLib.DataBase.Boiler.DayNightMode.HeatingCurvesDayNightBaseDataDefinition
paramHC
"Parameters for heating curve"
parameter Real declination
"Declination"
parameter Modelica.Units.SI.TemperatureDifference Tdelta_Max
"Difference from set flow temperature over which boiler stops"
parameter Modelica.Units.SI.TemperatureDifference Tdelta_Min
"Difference from set flow temperature under which boiler starts"
parameter Modelica.Units.SI.Time Fb
"Period of time for increased set temperature"
parameter Real FA
"Increment for increased set temperature"
Modelica.Blocks.Logical.Switch switchDayNight
"Switch"
ControllerOnOff controlerOnOff
"On/Off controller"
Modelica.Blocks.Logical.Timer timer
"Timer"
Modelica.Blocks.Logical.LessEqualThreshold lessEqualThreshold(
final threshold=Fb)
"Threshold"
Modelica.Blocks.Logical.And and1
Modelica.Blocks.Logical.Switch switchIncreasedSetTemp
"Switch"
Modelica.Blocks.Math.Gain increase(
final k=1 + FA)
"Increase"
Modelica.Blocks.Math.Gain noIncrease(
final k=1)
"No increase"
Modelica.Blocks.Logical.Not not1
Modelica.Blocks.Sources.Constant declinationConst(
k=declination)
"Declination"
protected
Modelica.Blocks.Tables.CombiTable2Ds flowTempNight(final table=paramHC.varFlowTempNight)
"Table for setting the flow temperature during night according to the outside temperature"
Modelica.Blocks.Tables.CombiTable2Ds flowTempDay(final table=paramHC.varFlowTempDay)
"Table for setting the flow temperature druing day according to the outside temperature"
Modelica.Blocks.Math.UnitConversions.To_degC to_degC
Modelica.Blocks.Math.UnitConversions.From_degC from_degC
Modelica.Blocks.Logical.GreaterThreshold higher(
final threshold=Tdelta_Max)
"Higher"
Modelica.Blocks.Logical.LessThreshold lower(
final threshold=-Tdelta_Min)
"Lower"
Modelica.Blocks.Math.Feedback difference
"Difference"
equation
if cardinality(isOn) < 2 then
isOn = true;
end if;
connect(higher.y, controlerOnOff.THigh)
connect(lower.y, controlerOnOff.TLow)
connect(higher.u,difference. y)
connect(timer.y, lessEqualThreshold.u)
connect(lessEqualThreshold.y, and1.u2)
connect(switchDayNight.y,increase. u)
connect(increase.y, switchIncreasedSetTemp.u1)
connect(switchDayNight.y,noIncrease. u)
connect(noIncrease.y, switchIncreasedSetTemp.u3)
connect(and1.y, switchIncreasedSetTemp.u2)
connect(switchIncreasedSetTemp.y, from_degC.u)
connect(not1.y, timer.u)
connect(not1.y, and1.u1)
connect(to_degC.y,flowTempNight. u1)
connect(to_degC.y,flowTempDay. u1)
connect(declinationConst.y, flowTempNight.u2)
connect(declinationConst.y, flowTempDay.u2)
connect(flowTempNight.y, switchDayNight.u1)
connect(flowTempDay.y, switchDayNight.u3)
connect(difference.u1, TFlowIs)
connect(from_degC.y,difference. u2)
connect(difference.y,lower. u)
connect(switchToNightMode, not1.u)
connect(switchToNightMode, switchDayNight.u2)
connect(TOutside, to_degC.u)
connect(isOn, controlerOnOff.onOffExtern)
connect(controlerOnOff.onOffFinal,isOn_final)
connect(TFlowSet, from_degC.y)
end ExternalControlNightDayHC; |
Internal control model for boiler. | within AixLib.Fluid.BoilerCHP.BaseClasses.Controllers;
model InternalControl "Internal control model for boiler"
parameter AixLib.DataBase.Boiler.General.BoilerTwoPointBaseDataDefinition
paramBoiler
"Parameters for boiler"
parameter Real KR
"Gain of boiler heater";
parameter Modelica.Units.SI.Time TN
"Time constant of boiler heater (T>0 required)";
parameter Modelica.Units.SI.Time riseTime
"Rise/fall time for step input(T>0 required)";
parameter Modelica.Fluid.Types.Dynamics energyDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial
"Type of energy balance: dynamic (3 initialization options) or steady state"
Real outputPower
"Output power";
Modelica.Blocks.Interfaces.BooleanInput isOn
"On/Off switch for the boiler"
Modelica.Blocks.Interfaces.RealInput Tflow_set(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
"Target temperature of the controller"
Modelica.Blocks.Interfaces.RealInput TFlowHot(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
"Outgoing temperature"
Modelica.Blocks.Interfaces.RealOutput QflowHeater(
final unit="W")
"Connector of real output signal"
Modelica.Blocks.Interfaces.RealInput mFlow(
quantity="MassFlowRate",
final unit="kg/s")
"Mass flow through the boiler"
Modelica.Blocks.Interfaces.RealInput TFlowCold(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
"Temperature of the cold water"
Controls.Continuous.PITemp ControlerHeater(
final KR=KR,
final TN=TN,
final h=paramBoiler.Q_nom,
final l=paramBoiler.Q_min,
triggeredTrapezoid(final rising=riseTime, final falling=riseTime),
final rangeSwitch=false)
"PI temperature controller"
Utilities.Sensors.EnergyMeter eEnergyMeter_P(final energyDynamics=
energyDynamics)
"For primary energy consumption"
Utilities.Sensors.EnergyMeter eEnergyMeter_S(final energyDynamics=
energyDynamics)
"For secondary energy consumption"
Modelica.Blocks.Tables.CombiTable1Dv efficiencyTable(
final tableOnFile=false,
final table=paramBoiler.eta,
final columns={2},
final smoothness=Modelica.Blocks.Types.Smoothness.LinearSegments)
"Table with efficiency parameters"
Modelica.Blocks.Math.Gain QNormated(
final k=1/paramBoiler.Q_nom)
Modelica.Blocks.Math.Product product
Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature
prescribedTemperature
"Converts Tflow_hot real input to temperature"
equation
if cardinality(isOn) < 2 then
isOn = true;
end if;
outputPower =mFlow*4184*(TFlowHot - TFlowCold);
eEnergyMeter_S.p=outputPower;
connect(ControlerHeater.y, eEnergyMeter_P.p)
connect(ControlerHeater.y, QNormated.u)
connect(QNormated.y,efficiencyTable. u[1])
connect(ControlerHeater.y, product.u1)
connect(efficiencyTable.y[1], product.u2)
connect(product.y, QflowHeater)
connect(ControlerHeater.setPoint, Tflow_set)
connect(ControlerHeater.onOff, isOn)
connect(TFlowHot, prescribedTemperature.T)
connect(prescribedTemperature.port, ControlerHeater.heatPort)
end InternalControl; |
Package with controllers for boiler and CHP models | within AixLib.Fluid.BoilerCHP.BaseClasses;
package Controllers "Package with controllers for boiler and CHP models"
extends Modelica.Icons.VariantsPackage;
end Controllers; |
With measurement of primary and secondary energy consumption. | within AixLib.Fluid.BoilerCHP.BaseClasses.Controllers;
partial model PartialExternalControl
"With measurement of primary and secondary energy consumption"
Modelica.Blocks.Interfaces.RealInput TOutside(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
"Outside temperature [K]"
Modelica.Blocks.Interfaces.BooleanInput isOn
"On/Off switch for the boiler"
Modelica.Blocks.Interfaces.BooleanInput switchToNightMode
"Connector of boolean input signal"
Modelica.Blocks.Interfaces.BooleanOutput isOn_final
"On/Off output"
Modelica.Blocks.Interfaces.RealOutput TFlowSet(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
"Target temperature of the controller"
Modelica.Blocks.Interfaces.RealInput TFlowIs(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
"Actual outgoing temperature"
equation
if cardinality(isOn) < 2 then
isOn = true;
end if;
end PartialExternalControl; |
Two coupled PI controllers for CHP control. | within AixLib.Fluid.BoilerCHP.BaseClasses.Controllers;
model PIController "Two coupled PI controllers for CHP control"
parameter Real Kc
"Gain of the controller";
parameter Modelica.Units.SI.Time Tc "Time constant (T>0 required)";
parameter Real minCapacity
"Minimum controller output in load operation";
Modelica.Blocks.Logical.Switch switch1
Modelica.Blocks.Continuous.LimPID PI(
final controllerType=Modelica.Blocks.Types.SimpleController.PI,
yMax=100,
y_start=0,
final k=Kc,
final Ti=Tc,
final yMin=minCapacity)
"PI controller"
Modelica.Blocks.Continuous.LimPID PI1(
final controllerType=Modelica.Blocks.Types.SimpleController.PI,
yMax=100,
yMin=0,
final k=Kc,
final Ti=Tc)
"Limited PI controller"
Modelica.Blocks.Discrete.TriggeredSampler triggeredSampler(y_start=0)
Modelica.Blocks.Discrete.TriggeredSampler triggeredSampler2(y_start=0)
Modelica.Blocks.Logical.TriggeredTrapezoid triggeredTrapezoid(rising=100)
Modelica.Blocks.Logical.Switch switch3
Modelica.Blocks.Math.Product product
Modelica.Blocks.Logical.Switch switch2
Modelica.Blocks.Interfaces.RealOutput y
"Controller output signal"
Modelica.Blocks.Interfaces.RealInput setpoint
Modelica.Blocks.Interfaces.BooleanInput on
"Connector of boolean input signal"
Modelica.Blocks.Logical.Not not1
Modelica.Blocks.Interfaces.RealInput measurement
"Connector of second real input signal"
equation
connect(switch1.y, PI.u_m)
connect(PI1.u_m, PI.u_m)
connect(triggeredSampler.y, PI1.u_s)
connect(triggeredSampler2.y, PI.u_s)
connect(PI.y, switch3.u3)
connect(PI1.y, switch3.u1)
connect(product.u1, switch3.y)
connect(product.u2, triggeredTrapezoid.y)
connect(product.y, switch2.u3)
connect(switch2.u1, switch3.y)
connect(switch2.y, y)
connect(triggeredSampler2.trigger, triggeredTrapezoid.u)
connect(switch2.u2, triggeredTrapezoid.u)
connect(setpoint, triggeredSampler.u)
connect(triggeredSampler2.u, triggeredSampler.u)
connect(switch1.u1, triggeredSampler.u)
connect(switch3.u2, triggeredSampler.trigger)
connect(on, switch1.u2)
connect(triggeredSampler.trigger, switch1.u2)
connect(not1.y, triggeredTrapezoid.u)
connect(not1.u, switch1.u2)
connect(switch1.u3, measurement)
end PIController; |
Example that illustrates the use of the boiler model without control | within AixLib.Fluid.BoilerCHP.Examples;
model BoilerNoControlSystem
"Example that illustrates the use of the boiler model without control"
extends Modelica.Icons.Example;
package Medium = AixLib.Media.Water
Modelica.Fluid.Sources.MassFlowSource_T source(
use_m_flow_in=false,
redeclare package Medium = Medium,
use_T_in=true,
m_flow=0.2,
T=313.15,
nPorts=1)
"Source"
Modelica.Fluid.Pipes.StaticPipe pipe(
length=1,
diameter=0.025,
redeclare package Medium = Medium)
"Pressure drop"
inner Modelica.Fluid.System system(p_start=system.p_ambient,
p_ambient(displayUnit="Pa"))
"Pressure drop"
Modelica.Fluid.Sources.Boundary_pT sink(nPorts=1, redeclare package Medium =
Medium)
"Sink"
Modelica.Blocks.Sources.Ramp ramp(
height=1,
duration=360,
offset=0,
startTime=120)
"Ambient air temperature"
BoilerNoControl boilerNoControl(
redeclare package Medium = Medium,
m_flow_nominal=0.2,
paramBoiler=DataBase.Boiler.General.Boiler_Vitogas200F_18kW())
Modelica.Blocks.Sources.Ramp ramp1(
height=60,
duration=360,
offset=273.15,
startTime=520)
"Ambient air temperature"
equation
connect(pipe.port_b, sink.ports[1])
connect(source.ports[1], boilerNoControl.port_a)
connect(boilerNoControl.port_b, pipe.port_a)
connect(boilerNoControl.u_rel, ramp.y)
connect(source.T_in, ramp1.y)
end BoilerNoControlSystem; |
Example that illustrates use of boiler model | within AixLib.Fluid.BoilerCHP.Examples;
model BoilerSystem "Example that illustrates use of boiler model"
extends Modelica.Icons.Example;
Modelica.Fluid.Sources.MassFlowSource_T source(
use_m_flow_in=false,
nPorts=1,
redeclare package Medium =
AixLib.Media.Specialized.Water.TemperatureDependentDensity,
m_flow=0.05,
T=293.15)
"Source"
Modelica.Fluid.Pipes.StaticPipe pipe(
length=1,
diameter=0.025,
redeclare package Medium =
AixLib.Media.Specialized.Water.TemperatureDependentDensity)
"Pressure drop"
inner Modelica.Fluid.System system(p_start=system.p_ambient,
p_ambient(displayUnit="Pa"))
"Pressure drop"
Boiler boiler(
redeclare package Medium =
AixLib.Media.Specialized.Water.TemperatureDependentDensity,
m_flow_nominal=0.03,
redeclare model ExtControl =
BaseClasses.Controllers.ExternalControlNightDayHC,
declination=1.2,
FA=0,
paramHC=DataBase.Boiler.DayNightMode.HeatingCurves_Vitotronic_Day25_Night10(),
riseTime=0,
TN=0.05,
paramBoiler=DataBase.Boiler.General.Boiler_Vitogas200F_11kW())
"Boiler"
Modelica.Fluid.Sources.Boundary_pT sink(nPorts=1, redeclare package Medium =
AixLib.Media.Specialized.Water.TemperatureDependentDensity)
"Sink"
Modelica.Blocks.Sources.BooleanConstant on
"Boiler is always on"
Modelica.Blocks.Sources.Sine sine(
amplitude=5,
f=1/86400,
phase=4.7123889803847,
offset=273.15) "Ambient air temperature"
Modelica.Blocks.Sources.BooleanConstant isNight(k=false)
"No night-setback"
equation
connect(source.ports[1], boiler.port_a)
connect(boiler.port_b, pipe.port_a)
connect(pipe.port_b, sink.ports[1])
connect(on.y, boiler.isOn)
connect(sine.y, boiler.TAmbient)
connect(isNight.y,boiler.switchToNightMode)
end BoilerSystem; |
Example that illustrates use of CHP model | within AixLib.Fluid.BoilerCHP.Examples;
model CHPSystem "Example that illustrates use of CHP model"
extends Modelica.Icons.Example;
AixLib.Fluid.BoilerCHP.CHP combinedHeatPower(
redeclare package Medium =
Media.Specialized.Water.TemperatureDependentDensity,
m_flow_nominal=0.02,
TSetIn=true,
minCapacity=20,
delayTime=300,
param=DataBase.CHP.CHPDataSimple.CHP_FMB_65_GSK(),
vol(energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyStateInitial),
Kc=0.02,
Tc=100,
elControl(initType=Modelica.Blocks.Types.Init.InitialOutput))
"CHP"
Modelica.Fluid.Sources.MassFlowSource_T source(
redeclare package Medium =
Media.Specialized.Water.TemperatureDependentDensity,
use_T_in=true,
nPorts=1,
m_flow=0.1)
"Source"
Modelica.Fluid.Sources.Boundary_pT sink(
nPorts=1,
redeclare package Medium =
Media.Specialized.Water.TemperatureDependentDensity)
"Sink"
Modelica.Blocks.Sources.Trapezoid trapezoid(
rising=7200,
width=7200,
falling=7200,
period=28800,
offset=313.15,
amplitude=50,
startTime=7200)
"Source temperature"
Modelica.Blocks.Sources.BooleanConstant on
"CHP is always on"
Modelica.Blocks.Sources.Constant TSet(k=80 + 273.15, y(unit="K"))
"Set temperature"
equation
connect(source.ports[1],combinedHeatPower. port_a)
connect(combinedHeatPower.port_b, sink.ports[1])
connect(trapezoid.y, source.T_in)
connect(on.y,combinedHeatPower.on)
connect(TSet.y,combinedHeatPower. TSet)
end CHPSystem; |
Example that illustrates use of CHPNoControl model | within AixLib.Fluid.BoilerCHP.Examples;
model CHPSystemNoControl "Example that illustrates use of CHPNoControl model"
extends Modelica.Icons.Example;
package Medium = AixLib.Media.Water
AixLib.Fluid.BoilerCHP.CHPNoControl combinedHeatPower(
redeclare package Medium = Medium,
m_flow_nominal=0.02,
param=DataBase.CHP.CHPDataSimple.CHP_FMB_65_GSK()) "CHP"
Modelica.Fluid.Sources.MassFlowSource_T source(
redeclare package Medium = Medium,
use_T_in=true,
nPorts=1,
m_flow=0.5)
"Source"
Modelica.Fluid.Sources.Boundary_pT sink(
nPorts=1, redeclare package Medium = Medium)
"Sink"
Modelica.Blocks.Sources.Trapezoid trapezoid(
rising=7200,
width=7200,
falling=7200,
period=28800,
offset=313.15,
amplitude=50,
startTime=7200)
"Source temperature"
Modelica.Blocks.Sources.Ramp TSet(duration=200, startTime=10)
"Set temperature"
equation
connect(source.ports[1],combinedHeatPower. port_a)
connect(combinedHeatPower.port_b, sink.ports[1])
connect(trapezoid.y, source.T_in)
connect(TSet.y, combinedHeatPower.u_rel)
end CHPSystemNoControl; |
Example that illustrates use of heat generator without control | within AixLib.Fluid.BoilerCHP.Examples;
model HeatGeneratorNoControllSystem "Example that illustrates use of heat generator without control"
extends Modelica.Icons.Example;
Modelica.Fluid.Sources.MassFlowSource_T source(
redeclare package Medium =
Media.Specialized.Water.TemperatureDependentDensity,
use_T_in=true,
nPorts=1,
m_flow=0.03)
"Source"
Modelica.Fluid.Sources.Boundary_pT sink(
redeclare package Medium =
Media.Specialized.Water.TemperatureDependentDensity, nPorts=1)
"Sink"
HeatGeneratorNoControl heatGeneratorNoControll(
redeclare package Medium =
Media.Specialized.Water.TemperatureDependentDensity, m_flow_nominal=
0.03,
V=0.002,
coeffPresLoss=1e10)
"Heat generator without control"
Modelica.Blocks.Sources.Trapezoid trapezoid(
rising=7200,
width=7200,
falling=7200,
period=28800,
offset=313.15,
amplitude=50,
startTime=7200)
"Source temperature"
Modelica.Blocks.Sources.Constant const(k=5000)
"Prescribed heat flow"
equation
connect(source.ports[1], heatGeneratorNoControll.port_a)
connect(heatGeneratorNoControll.port_b, sink.ports[1])
connect(trapezoid.y, source.T_in)
connect(const.y, heatGeneratorNoControll.Q_flow)
end HeatGeneratorNoControllSystem; |
Example of the modular CHP power unit model inside a heating circuit | within AixLib.Fluid.BoilerCHP.Examples;
model ModularCHPSystem
"Example of the modular CHP power unit model inside a heating circuit"
extends Modelica.Icons.Example;
replaceable package Medium_Fuel =
AixLib.DataBase.CHP.ModularCHPEngineMedia.NaturalGasMixture_TypeAachen
constrainedby DataBase.CHP.ModularCHPEngineMedia.CHPCombustionMixtureGasNasa
"Fuel medium model used in the CHP plant"
replaceable package Medium_Coolant = Modelica.Media.Air.DryAirNasa
constrainedby Modelica.Media.Interfaces.PartialMedium
"Coolant medium model used in the CHP plant"
replaceable package Medium_HeatingCircuit =
Modelica.Media.CompressibleLiquids.LinearColdWater constrainedby Modelica.Media.Interfaces.PartialMedium
"Heating circuit medium model"
parameter
AixLib.DataBase.CHP.ModularCHPEngineData.CHPEngDataBaseRecord
CHPEngineModel=DataBase.CHP.ModularCHPEngineData.CHP_Kirsch_L4_12()
"CHP engine data for calculations"
parameter AixLib.Fluid.BoilerCHP.Data.ModularCHP.EngineMaterialData EngMat=
AixLib.Fluid.BoilerCHP.Data.ModularCHP.EngineMaterial_CastIron()
"Thermal engine material data for calculations"
parameter Modelica.Units.SI.Temperature T_amb=293.15
"Default ambient temperature"
parameter Modelica.Units.SI.AbsolutePressure p_amb=101325
"Default ambient pressure"
parameter Real s_til=abs((cHP_PowerUnit.cHP_PowerUnit.inductionMachine.s_nominal
*(cHP_PowerUnit.cHP_PowerUnit.inductionMachine.M_til/cHP_PowerUnit.cHP_PowerUnit.inductionMachine.M_nominal)
+ cHP_PowerUnit.cHP_PowerUnit.inductionMachine.s_nominal*sqrt(abs(((
cHP_PowerUnit.cHP_PowerUnit.inductionMachine.M_til/cHP_PowerUnit.cHP_PowerUnit.inductionMachine.M_nominal)
^2) - 1 + 2*cHP_PowerUnit.cHP_PowerUnit.inductionMachine.s_nominal*((
cHP_PowerUnit.cHP_PowerUnit.inductionMachine.M_til/cHP_PowerUnit.cHP_PowerUnit.inductionMachine.M_nominal)
- 1))))/(1 - 2*cHP_PowerUnit.cHP_PowerUnit.inductionMachine.s_nominal*((
cHP_PowerUnit.cHP_PowerUnit.inductionMachine.M_til/cHP_PowerUnit.cHP_PowerUnit.inductionMachine.M_nominal)
- 1)))
"Tilting slip of electric machine"
parameter Real calFac=0.94
"Calibration factor for electric power output (default=1)"
parameter Modelica.Units.SI.ThermalConductance GEngToCoo=33
"Thermal conductance of engine housing from the cylinder wall to the water cooling channels"
parameter Modelica.Units.SI.ThermalConductance GCooExhHex=400
"Thermal conductance of the coolant heat exchanger at nominal flow"
parameter Modelica.Units.SI.HeatCapacity CExhHex=50000
"Heat capacity of exhaust heat exchanger(default= 4000 J/K)"
parameter Modelica.Units.SI.Mass Cal_mEng=0
"Added engine mass for calibration purposes of the system´s thermal inertia"
parameter Modelica.Units.SI.Area A_surExhHea=100
"Surface for exhaust heat transfer"
parameter Modelica.Units.SI.MassFlowRate m_flow_Coo=0.4
"Nominal mass flow rate of coolant inside the engine cooling circle"
parameter Modelica.Units.SI.Thickness dInn=0.01
"Typical value for the thickness of the cylinder wall (between combustion chamber and cooling circle)"
parameter Modelica.Units.SI.ThermalConductance GEngToAmb=2
"Thermal conductance from engine housing to the surrounding air"
parameter Modelica.Units.SI.ThermalConductance GAmb=10
"Constant heat transfer coefficient of engine housing to ambient"
parameter Real modTab[:,2]=[0.0,0.8; 7200,0.8; 7200,0.93; 10800,0.93; 10800,0.62;
14400,0.62; 14400,0.8; 18000,0.8; 18000,0.0]
"Table for unit modulation (time = first column; modulation factors = second column)"
parameter Modelica.Units.SI.Temperature T_HeaRet=303.15
"Constant heating circuit return temperature"
parameter Boolean ConTec=true
"Is condensing technology used and should latent heat be considered?"
parameter Boolean useGenHea=true
"Is the thermal loss energy of the elctric machine used?"
parameter Boolean allowFlowReversalExhaust=true
"= false to simplify equations, assuming, but not enforcing, no flow reversal for exhaust medium"
parameter Boolean allowFlowReversalCoolant=true
"= false to simplify equations, assuming, but not enforcing, no flow reversal for coolant medium"
parameter Boolean VolCon=true "Is volume flow rate control used?"
parameter Modelica.Units.SI.MassFlowRate
mExh_flow_small=0.001
"Small exhaust mass flow rate for regularization of zero flow"
parameter Modelica.Units.SI.MassFlowRate
mCool_flow_small=0.005
"Small coolant mass flow rate for regularization of zero flow"
parameter Modelica.Units.SI.Efficiency eps=0.9 "Heat exchanger effectiveness"
Modelica.Units.SI.MassFlowRate m_flow_HeaCir=if not VolCon then
CHPEngineModel.m_floCooNominal else V_flow_HeaCir*senDen.d
"Nominal mass flow rate inside the heating circuit"
Modelica.Units.SI.VolumeFlowRate V_flow_HeaCir=0.3/3600
"Nominal volume flow rate inside the heating circuit"
Modelica.Fluid.Sources.MassFlowSource_T source(
use_T_in=true,
redeclare package Medium = Medium_HeatingCircuit,
nPorts=1,
use_m_flow_in=true) "Flow source of heating circuit"
Modelica.Fluid.Sources.FixedBoundary sink(redeclare package Medium =
Medium_HeatingCircuit, nPorts=1) "Sink of the heating circuit"
Modelica.Blocks.Sources.RealExpression tempFlowHeating(y=T_HeaRet)
AixLib.Fluid.Sensors.DensityTwoPort senDen(
m_flow_small=mCool_flow_small,
m_flow_nominal=CHPEngineModel.m_floCooNominal,
redeclare package Medium = Medium_HeatingCircuit)
"Density sensor for volume and mass flow calculation"
Modelica.Blocks.Sources.RealExpression massFlowHeating(y=m_flow_HeaCir)
AixLib.Fluid.BoilerCHP.ModularCHP.ModularCHPIntegrated cHP_PowerUnit(
redeclare package Medium_Fuel = Medium_Fuel,
CHPEngineModel=CHPEngineModel,
EngMat=EngMat,
T_amb=T_amb,
p_amb=p_amb,
ConTec=ConTec,
useGenHea=useGenHea,
allowFlowReversalExhaust=allowFlowReversalExhaust,
allowFlowReversalCoolant=allowFlowReversalCoolant,
mExh_flow_small=mExh_flow_small,
mCool_flow_small=mCool_flow_small,
A_surExhHea=A_surExhHea,
redeclare package Medium_Coolant = Medium_Coolant,
GCooExhHex=GCooExhHex,
CExhHex=CExhHex,
dInn=dInn,
GAmb=GAmb,
calFac=calFac,
GEngToCoo=GEngToCoo,
GEngToAmb=GEngToAmb,
m_flow_Coo=m_flow_Coo,
redeclare package Medium_HeatingCircuit = Medium_HeatingCircuit,
s_til=s_til,
Cal_mEng=Cal_mEng,
modTab=modTab,
cHP_PowerUnit(inductionMachine(s_til=cHP_PowerUnit.cHP_PowerUnit.s_til)),
coolantHex(eps=eps)) "Model of a CHP unit"
protected
replaceable package Medium_Air =
AixLib.DataBase.CHP.ModularCHPEngineMedia.EngineCombustionAir
constrainedby DataBase.CHP.ModularCHPEngineMedia.EngineCombustionAir
"Air medium model used in the CHP plant"
replaceable package Medium_Exhaust =
DataBase.CHP.ModularCHPEngineMedia.CHPFlueGasLambdaOnePlus constrainedby DataBase.CHP.ModularCHPEngineMedia.CHPCombustionMixtureGasNasa
"Exhaust gas medium model used in the CHP plant"
parameter Modelica.Units.SI.Mass mEng=CHPEngineModel.mEng + Cal_mEng
"Total engine mass for heat capacity calculation"
equation
connect(source.T_in, tempFlowHeating.y)
connect(source.ports[1], senDen.port_a)
connect(massFlowHeating.y, source.m_flow_in)
connect(cHP_PowerUnit.port_supHea, sink.ports[1])
connect(senDen.port_b,cHP_PowerUnit.port_retHea)
end ModularCHPSystem; |
Collection of models that illustrate model use and test models | within AixLib.Fluid.BoilerCHP;
package Examples "Collection of models that illustrate model use and test models"
extends Modelica.Icons.ExamplesPackage;
end Examples; |
Modular combined heat and power system model integrated into a heating circuit | within AixLib.Fluid.BoilerCHP.ModularCHP;
model ModularCHPIntegrated
"Modular combined heat and power system model integrated into a heating circuit"
import AixLib;
replaceable package Medium_Fuel =
AixLib.DataBase.CHP.ModularCHPEngineMedia.NaturalGasMixture_TypeAachen
constrainedby DataBase.CHP.ModularCHPEngineMedia.CHPCombustionMixtureGasNasa
"Fuel medium model used in the CHP plant"
replaceable package Medium_Coolant = Modelica.Media.Air.DryAirNasa
constrainedby Modelica.Media.Interfaces.PartialMedium
"Coolant medium model used in the CHP plant"
replaceable package Medium_HeatingCircuit =
Modelica.Media.CompressibleLiquids.LinearColdWater constrainedby Modelica.Media.Interfaces.PartialMedium
"Heating circuit medium model"
parameter
AixLib.DataBase.CHP.ModularCHPEngineData.CHPEngDataBaseRecord
CHPEngineModel=DataBase.CHP.ModularCHPEngineData.CHP_Kirsch_L4_12()
"CHP engine data for calculations"
parameter AixLib.Fluid.BoilerCHP.Data.ModularCHP.EngineMaterialData EngMat=
AixLib.Fluid.BoilerCHP.Data.ModularCHP.EngineMaterial_CastIron()
"Thermal engine material data for calculations"
parameter Modelica.Units.SI.Temperature T_amb=293.15
"Default ambient temperature"
parameter Modelica.Units.SI.AbsolutePressure p_amb=101325
"Default ambient pressure"
parameter Real s_til=abs((cHP_PowerUnit.inductionMachine.s_nominal*(
cHP_PowerUnit.inductionMachine.M_til/cHP_PowerUnit.inductionMachine.M_nominal)
+ cHP_PowerUnit.inductionMachine.s_nominal*sqrt(abs(((cHP_PowerUnit.inductionMachine.M_til
/cHP_PowerUnit.inductionMachine.M_nominal)^2) - 1 + 2*cHP_PowerUnit.inductionMachine.s_nominal
*((cHP_PowerUnit.inductionMachine.M_til/cHP_PowerUnit.inductionMachine.M_nominal)
- 1))))/(1 - 2*cHP_PowerUnit.inductionMachine.s_nominal*((cHP_PowerUnit.inductionMachine.M_til
/cHP_PowerUnit.inductionMachine.M_nominal) - 1)))
"Tilting slip of electric machine"
parameter Real calFac=0.94
"Calibration factor for electric power output (default=1)"
parameter Modelica.Units.SI.ThermalConductance GEngToCoo=33
"Thermal conductance of engine housing from the cylinder wall to the water cooling channels"
parameter Modelica.Units.SI.ThermalConductance GCooExhHex=400
"Thermal conductance of the coolant heat exchanger at nominal flow"
parameter Modelica.Units.SI.HeatCapacity CExhHex=50000
"Heat capacity of exhaust heat exchanger(default= 4000 J/K)"
parameter Modelica.Units.SI.Mass Cal_mEng=0
"Added engine mass for calibration purposes of the system´s thermal inertia"
parameter Modelica.Units.SI.Area A_surExhHea=100
"Surface for exhaust heat transfer"
parameter Modelica.Units.SI.MassFlowRate m_flow_Coo=0.4
"Nominal mass flow rate of coolant inside the engine cooling circle"
parameter Modelica.Units.SI.Thickness dInn=0.01
"Typical value for the thickness of the cylinder wall (between combustion chamber and cooling circle)"
parameter Modelica.Units.SI.ThermalConductance GEngToAmb=2
"Thermal conductance from engine housing to the surrounding air"
parameter Modelica.Units.SI.ThermalConductance GAmb=10
"Constant heat transfer coefficient of engine housing to ambient"
parameter Real modTab[:,2]=[0.0,0.8; 7200,0.8; 7200,0.93; 10800,0.93; 10800,0.62;
14400,0.62; 14400,0.8; 18000,0.8; 18000,0.0]
"Table for unit modulation (time = first column; modulation factors = second column)"
parameter Boolean ConTec=true
"Is condensing technology used and should latent heat be considered?"
parameter Boolean useGenHea=true
"Is the thermal loss energy of the elctric machine used?"
parameter Boolean allowFlowReversalExhaust=true
"= false to simplify equations, assuming, but not enforcing, no flow reversal for exhaust medium"
parameter Boolean allowFlowReversalCoolant=true
"= false to simplify equations, assuming, but not enforcing, no flow reversal for coolant medium"
parameter Modelica.Units.SI.MassFlowRate
mExh_flow_small=0.001
"Small exhaust mass flow rate for regularization of zero flow"
parameter Modelica.Units.SI.MassFlowRate
mCool_flow_small=0.005
"Small coolant mass flow rate for regularization of zero flow"
Modelica.Units.SI.Temperature T_Ret=temRetFlo.T "Coolant return temperature";
Modelica.Units.SI.Temperature T_Sup=temSupFlo.T "Coolant supply temperature";
Modelica.Units.SI.Power Q_Therm_th=cHP_PowerUnit.Q_Therm
"Thermal power output of the CHP unit to the coolant media";
Modelica.Units.SI.Power Q_Therm=coolantHex.Q2_flow
"Effective thermal power output of the CHP unit to the heating circuit";
Modelica.Units.SI.Power P_Mech=cHP_PowerUnit.P_Mech
"Mechanical power output of the CHP unit";
Modelica.Units.SI.Power P_El=cHP_PowerUnit.P_El
"Electrical power output of the CHP unit";
Modelica.Units.SI.Power P_Fuel=cHP_PowerUnit.P_Fuel "CHP fuel expenses";
Modelica.Units.SI.Power Q_TotUnused=cHP_PowerUnit.Q_TotUnused
"Total heat error of the CHP unit";
Modelica.Units.SI.MassFlowRate m_flow_CO2=cHP_PowerUnit.m_flow_CO2
"CO2 emission output rate";
Modelica.Units.SI.MassFlowRate m_flow_Fue=cHP_PowerUnit.m_flow_Fue
"Fuel consumption rate of CHP unit";
Real FueUtiRate = cHP_PowerUnit.FueUtiRate "Fuel utilization rate of the CHP unit";
Real PowHeatRatio = cHP_PowerUnit.PowHeatRatio "Power to heat ration of the CHP unit";
Real eta_Therm = cHP_PowerUnit.eta_Therm "Thermal efficiency of the CHP unit";
Real eta_Mech = cHP_PowerUnit.eta_Mech "Mechanical efficiency of the CHP unit";
Real eta_El = cHP_PowerUnit.eta_El "Mechanical efficiency of the CHP unit";
inner Modelica.Fluid.System system(p_ambient=p_amb, T_ambient=T_amb)
AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses.ModularCHP_PowerUnit
cHP_PowerUnit(
redeclare package Medium_Fuel = Medium_Fuel,
CHPEngineModel=CHPEngineModel,
EngMat=EngMat,
T_amb=T_amb,
p_amb=p_amb,
m_flow=m_flow_Coo,
GEngToCoo=GEngToCoo,
ConTec=ConTec,
useGenHea=useGenHea,
allowFlowReversalExhaust=allowFlowReversalExhaust,
allowFlowReversalCoolant=allowFlowReversalCoolant,
mExh_flow_small=mExh_flow_small,
mCool_flow_small=mCool_flow_small,
A_surExhHea=A_surExhHea,
mEng=mEng,
redeclare package Medium_Coolant = Medium_Coolant,
GCooExhHex=GCooExhHex,
CExhHex=CExhHex,
inductionMachine(J_Gen=1),
dInn=dInn,
GEngToAmb=GEngToAmb,
GAmb=GAmb,
calFac=calFac,
s_til=s_til)
"Model of the main heat and power generating components of a CHP unit"
AixLib.Fluid.HeatExchangers.ConstantEffectiveness coolantHex(
allowFlowReversal1=allowFlowReversalCoolant,
allowFlowReversal2=allowFlowReversalCoolant,
m2_flow_nominal=CHPEngineModel.m_floCooNominal,
m1_flow_small=mCool_flow_small,
m2_flow_small=mCool_flow_small,
redeclare package Medium1 = Medium_Coolant,
m1_flow_nominal=m_flow_Coo,
redeclare package Medium2 = Medium_HeatingCircuit,
dp1_nominal(displayUnit="kPa") = 10000,
dp2_nominal(displayUnit="kPa") = 10000,
eps=0.9) "Heat exchanger between inner cooling and outer heating circuit"
Modelica.Fluid.Sensors.TemperatureTwoPort temRetFlo(
m_flow_small=mCool_flow_small,
m_flow_nominal=CHPEngineModel.m_floCooNominal,
redeclare package Medium = Medium_HeatingCircuit)
"Heating circuit return flow temperature sensor"
Modelica.Fluid.Sensors.TemperatureTwoPort temSupFlo(
m_flow_small=mCool_flow_small,
m_flow_nominal=CHPEngineModel.m_floCooNominal,
redeclare package Medium = Medium_HeatingCircuit)
"Heating circuit supply flow temperature sensor"
AixLib.Fluid.BoilerCHP.BaseClasses.Controllers.ControllerOnOffModularCHP
ControllerCHP(
CHPEngineModel=CHPEngineModel,
startTimeChp=3600,
modTab=modTab) "On/Off control with modulation factor setting"
Modelica.Fluid.Interfaces.FluidPort_a port_retHea(redeclare package Medium =
Medium_Coolant)
"Fluid port for the return flow side of the heating circuit"
Modelica.Fluid.Interfaces.FluidPort_b port_supHea(redeclare package Medium =
Medium_Coolant)
"Fluid port for the supply flow side of the heating circuit"
Modelica.Fluid.Sources.FixedBoundary fixedPressureLevel(
nPorts=1,
redeclare package Medium = Medium_Coolant,
T(displayUnit="K"),
p=300000)
protected
replaceable package Medium_Air =
AixLib.DataBase.CHP.ModularCHPEngineMedia.EngineCombustionAir
constrainedby DataBase.CHP.ModularCHPEngineMedia.EngineCombustionAir
"Air medium model used in the CHP plant"
replaceable package Medium_Exhaust =
DataBase.CHP.ModularCHPEngineMedia.CHPFlueGasLambdaOnePlus constrainedby DataBase.CHP.ModularCHPEngineMedia.CHPCombustionMixtureGasNasa
"Exhaust gas medium model used in the CHP plant"
parameter Modelica.Units.SI.Mass mEng=CHPEngineModel.mEng + Cal_mEng
"Total engine mass for heat capacity calculation"
equation
connect(coolantHex.port_a2, temRetFlo.port_b)
connect(coolantHex.port_b2, temSupFlo.port_a)
connect(ControllerCHP.modCHPConBus, cHP_PowerUnit.sigBusCHP)
connect(coolantHex.port_b1,cHP_PowerUnit.port_retCoo)
connect(cHP_PowerUnit.port_supCoo, coolantHex.port_a1)
connect(temSupFlo.port_b, port_supHea)
connect(port_retHea, temRetFlo.port_a)
connect(fixedPressureLevel.ports[1], cHP_PowerUnit.port_retCoo)
end ModularCHPIntegrated; |
Modular and complex CHP model with physical calculation approaches. | within AixLib.Fluid.BoilerCHP;
package ModularCHP "Modular and complex CHP model with physical calculation approaches."
end ModularCHP; |
Model of a general induction machine working as a starter generator. Model of an electric induction machine that includes the calculation
of: | within AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses;
model CHP_ElectricMachine
"Model of a general induction machine working as a starter generator"
extends Modelica.Electrical.Machines.Icons.TransientMachine;
parameter
AixLib.DataBase.CHP.ModularCHPEngineData.CHPEngDataBaseRecord
CHPEngData=DataBase.CHP.ModularCHPEngineData.CHP_ECPowerXRGI15()
"Needed engine data for calculations"
parameter Modelica.Units.SI.Frequency n0=CHPEngData.n0
"Idling speed of the electric machine"
parameter Modelica.Units.SI.Frequency n_nominal=CHPEngData.n_nominal
"Rated rotor speed"
parameter Modelica.Units.SI.Frequency f_1=CHPEngData.f_1 "Frequency"
parameter Modelica.Units.SI.Voltage U_1=CHPEngData.U_1 "Rated voltage"
parameter Modelica.Units.SI.Current I_elNominal=CHPEngData.I_elNominal
"Rated current"
parameter Modelica.Units.SI.Current I_1_start=if P_Mec_nominal <= 15000 then
7.2*I_elNominal else 8*I_elNominal
"Motor start current (realistic factors used from DIN VDE 2650/2651)"
parameter Modelica.Units.SI.Power P_elNominal=CHPEngData.P_elNominal
"Nominal electrical power of electric machine"
parameter Modelica.Units.SI.Power P_Mec_nominal=P_elNominal*(1 + s_nominal/
0.22) "Nominal mechanical power of electric machine"
parameter Modelica.Units.SI.Torque M_nominal=P_Mec_nominal/(2*Modelica.Constants.pi
*n_nominal) "Nominal torque of electric machine"
parameter Modelica.Units.SI.Torque M_til=2*M_nominal
"Tilting torque of electric machine (realistic factor used from DIN VDE 2650/2651)"
parameter Modelica.Units.SI.Torque M_start=if P_Mec_nominal <= 4000 then 1.6*
M_nominal elseif P_Mec_nominal >= 22000 then 1*M_nominal else 1.25*
M_nominal
"Starting torque of electric machine (realistic factor used from DIN VDE 2650/2651)"
parameter Modelica.Units.SI.Inertia J_Gen=1
"Moment of inertia of the electric machine (default=1kg.m2)"
parameter Boolean useHeat=CHPEngData.useHeat
"Is the thermal loss energy of the elctric machine used?"
parameter Real s_nominal=abs(1-n_nominal*p/f_1) "Nominal slip of electric machine"
parameter Real s_til=abs((s_nominal*(M_til/M_nominal)+s_nominal*sqrt(abs(((M_til/M_nominal)^2)-1+2*s_nominal*((M_til/M_nominal)-1))))/(1-2*s_nominal*((M_til/M_nominal)-1)))
"Tilting slip of electric machine"
parameter Real p=CHPEngData.p
"Number of pole pairs"
parameter Real cosPhi=CHPEngData.cosPhi
"Power factor of electric machine (default=0.8)"
parameter Real calFac=1
"Calibration factor for electric power outuput (default=1)"
parameter Real gearRatio=CHPEngData.gearRatio
"Transmission ratio (engine speed / generator speed)"
Modelica.Units.SI.Frequency n=inertia.w/(2*Modelica.Constants.pi)
"Speed of machine rotor [1/s]";
Modelica.Units.SI.Current I_1 "Electric current of machine stator";
Modelica.Units.SI.Power P_E "Electrical power at the electric machine";
Modelica.Units.SI.Power P_Mec "Mechanical power at the electric machine";
Modelica.Units.SI.Power CalQ_Loss
"Calculated heat flow from electric machine";
Modelica.Units.SI.Power Q_Therm=if useHeat then CalQ_Loss else 0
"Heat flow from electric machine"
Modelica.Units.SI.Torque M "Torque at electric machine";
Real s=1-n*p/f_1 "Current slip of electric machine";
Real eta "Total efficiency of the electric machine (as motor)";
Real calI_1 = 1/(1+((k-1)/((s_nominal^2)-k))*((s^2)+rho1*abs(s)+rho0));
Boolean OpMode = (n<=n0) "Operation mode (true=motor, false=generator)";
Boolean SwitchOnOff=cHPGenBus.isOn
"Operation of electric machine (true=On, false=Off)";
Modelica.Mechanics.Rotational.Components.Inertia inertia( w(fixed=false), J=J_Gen)
"Inertia model of the electric machine"
Modelica.Blocks.Sources.RealExpression electricTorque1(y=M)
Modelica.Mechanics.Rotational.Sources.Torque torque
"Calculated torque of the electric machine"
Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_genIn
"Mechanical port to the output drive"
Modelica.Mechanics.Rotational.Components.IdealGear gearEngineToGenerator(
ratio=gearRatio)
"Model for mapping a possible transmission ratio between engine and generator"
AixLib.Controls.Interfaces.CHPControlBus cHPGenBus
"Signal bus of the electric machine"
Modelica.Blocks.Sources.RealExpression electricCurrent(y=I_1)
Modelica.Blocks.Sources.RealExpression electricTorque2(y=M)
Modelica.Blocks.Sources.RealExpression electricPower(y=P_E)
Modelica.Blocks.Sources.RealExpression generatorHeatLoss(y=Q_Therm)
Modelica.Blocks.Sources.RealExpression generatorEfficiency(y=eta)
protected
parameter Real rho0=s_til^2 "Calculation variable for analytical approach (Aree, 2017)"
parameter Real rho1=(M_start*(1+s_til^2)-2*s_til*M_til)/(M_til-M_start) "Calculation variable for analytical approach (Aree, 2017)"
parameter Real rho3=(M_til*M_start*(1-s_til)^2)/(M_til-M_start) "Calculation variable for analytical approach (Aree, 2017)"
parameter Real k=((I_elNominal/I_1_start)^2)*(((s_nominal^2)+rho1*s_nominal+rho0)/(1+rho1+rho0)) "Calculation variable for analytical approach (Aree, 2017)"
equation
if noEvent(SwitchOnOff) then
I_1=sign(s)*I_1_start*sqrt(abs((1+((k-1)/((s_nominal^2)-k))*(s^2)*(1+rho1+rho0))*calI_1));
P_E=if noEvent(s>0) then sqrt(3)*I_1*U_1*cosPhi elseif noEvent(s<0) then calFac*(P_Mec+CalQ_Loss) else 1;
// P_Mec=if noEvent(s>0) then 2*Modelica.Constants.pi*M*n else 2*Modelica.Constants.pi*n*M;
P_Mec=2*Modelica.Constants.pi*M*n;
CalQ_Loss= (calFac-1)*P_E + 2*Modelica.Constants.pi*M*(s*n0)/0.22;
M=sign(s)*(rho3*abs(s))/((s^2)+rho1*abs(s)+rho0);
eta=if noEvent(s>0) then abs(P_Mec/(P_E+1))
elseif noEvent(s<0) then abs(P_E/(P_Mec-1)) else 0;
else
I_1=0;
P_E=0;
P_Mec=0;
CalQ_Loss=0;
M=if noEvent(s<0) then sign(s)*(rho3*abs(s))/((s^2)+rho1*abs(s)+rho0) else 0;
eta=0;
end if;
connect(electricTorque1.y, torque.tau)
connect(torque.flange, inertia.flange_a)
connect(inertia.flange_b, gearEngineToGenerator.flange_b)
connect(gearEngineToGenerator.flange_a, flange_genIn)
connect(generatorHeatLoss.y, cHPGenBus.calThePowGen)
connect(electricPower.y, cHPGenBus.meaElPowGen)
connect(electricTorque2.y, cHPGenBus.meaTorGen)
connect(electricCurrent.y, cHPGenBus.meaCurGen)
connect(generatorEfficiency.y, cHPGenBus.calEtaGen)
end CHP_ElectricMachine; |
Exhaust gas heat exchanger for engine combustion and its heat transfer to a cooling circle | within AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses;
model ExhaustHeatExchanger
"Exhaust gas heat exchanger for engine combustion and its heat transfer to a cooling circle"
extends AixLib.Fluid.Interfaces.PartialFourPortInterface(
m1_flow_nominal=0.023,
m2_flow_nominal=0.5556,
m1_flow_small=0.0001,
m2_flow_small=0.0001,
show_T=true,
redeclare package Medium1 = Medium3,
redeclare package Medium2 = Medium4);
replaceable package Medium3 =
AixLib.DataBase.CHP.ModularCHPEngineMedia.CHPFlueGasLambdaOnePlus
constrainedby Modelica.Media.Interfaces.PartialMedium
"Exhaust gas medium model used in the CHP plant"
replaceable package Medium4 =
DataBase.CHP.ModularCHPEngineMedia.CHPCoolantPropyleneGlycolWater (
property_T=356, X_a=0.50) constrainedby Modelica.Media.Interfaces.PartialMedium
"Coolant medium model used in the CHP plant"
parameter
AixLib.DataBase.CHP.ModularCHPEngineData.CHPEngDataBaseRecord
CHPEngData=DataBase.CHP.ModularCHPEngineData.CHP_ECPowerXRGI15()
"Needed engine data for calculations"
parameter Modelica.Units.SI.Time tau=1
"Time constant of the temperature sensors at nominal flow rate"
parameter Modelica.Blocks.Types.Init initType=Modelica.Blocks.Types.Init.InitialState
"Type of initialization (InitialState and InitialOutput are identical)"
parameter Modelica.Units.SI.Temperature T1_start=T_Amb
"Initial or guess value of output (= state)"
parameter Modelica.Units.SI.Temperature T2_start=T_Amb
"Initial or guess value of output (= state)"
parameter Modelica.Media.Interfaces.Types.AbsolutePressure p1_start=p_Amb
"Start value of pressure"
parameter Modelica.Media.Interfaces.Types.AbsolutePressure p2_start=p_Amb
"Start value of pressure"
parameter Boolean transferHeat=false
"If true, temperature T converges towards TAmb when no flow"
parameter Boolean ConTec=false
"Is condensing technology used and should latent heat be considered?"
parameter Modelica.Units.SI.Temperature T_Amb=298.15
"Fixed ambient temperature for heat transfer"
parameter Modelica.Units.SI.Area A_surExhHea=50
"Surface for exhaust heat transfer"
parameter Modelica.Units.SI.Length d_iExh=CHPEngData.dExh
"Inner diameter of exhaust pipe"
parameter Modelica.Units.SI.ThermalConductance GAmb=5
"Constant thermal conductance of material"
parameter Modelica.Units.SI.ThermalConductance GCoo=850
"Constant thermal conductance of material"
parameter Modelica.Units.SI.HeatCapacity CExhHex=4000
"Heat capacity of exhaust heat exchanger(default= 4000 J/K)"
parameter Modelica.Media.Interfaces.Types.AbsolutePressure p_Amb=101325
"Start value of pressure"
parameter Modelica.Media.Interfaces.Types.AbsolutePressure dp_start=
CHPEngData.dp_Coo
"Guess value of dp = port_a.p - port_b.p"
parameter Modelica.Units.SI.Time tauHeaTra=1200
"Time constant for heat transfer, default 20 minutes"
parameter Modelica.Units.SI.MassFlowRate m_flow_start=0
"Guess value of m_flow = port_a.m_flow"
constant Modelica.Units.SI.MolarMass M_H2O=0.01802 "Molar mass of water";
//Antoine-Parameters needed for the calculation of the saturation vapor pressure xSat_H2OExhDry
constant Real A=11.7621;
constant Real B=3874.61;
constant Real C=229.73;
parameter Modelica.Units.SI.Length l_ExhHex=1
"Length of the exhaust pipe inside the exhaust heat exchanger"
parameter Modelica.Units.SI.PressureDifference dp_CooExhHex=CHPEngData.dp_Coo
"Pressure drop at nominal mass flow rate inside the coolant circle "
parameter Modelica.Units.SI.MolarMass M_Exh=1200
"Molar mass of the exhaust gas"
Real QuoT_ExhInOut=senTExhHot.T/senTExhCold.T
"Quotient of exhaust gas in and outgoing temperature";
//Variables for water condensation and its usable latent heat calculation
Real x_H2OExhDry
"Water load of the exhaust gas";
Real xSat_H2OExhDry
"Saturation water load of the exhaust gas";
Modelica.Units.SI.MassFlowRate m_H2OExh
"Mass flow of water in the exhaust gas";
Modelica.Units.SI.MassFlowRate m_ExhDry "Mass flow of dry exhaust gas";
Modelica.Units.SI.MassFlowRate m_ConH2OExh "Mass flow of condensing water";
Modelica.Units.SI.AbsolutePressure pExh
"Pressure in the exhaust gas stream (assuming ambient conditions)";
Modelica.Units.SI.AbsolutePressure pSatH2OExh
"Saturation vapor pressure of the exhaust gas water";
Modelica.Units.SI.SpecificEnthalpy deltaH_Vap
"Specific enthalpy of vaporization (empirical formula based on table data)";
Modelica.Units.SI.SpecificHeatCapacity meanCpExh=cHPExhHexBus.calMeaCpExh
"Calculated specific heat capacity of the exhaust gas for the calculated combustion temperature"
Modelica.Units.SI.HeatFlowRate Q_Gen=cHPExhHexBus.calThePowGen
"Calculated loss heat from the induction machine"
Modelica.Units.SI.Temperature T_LogMeanExh
"Mean logarithmic temperature of exhaust gas";
//Calculation of the thermodynamic state of the exhaust gas inlet used by the convective heat transfer model
Medium1.ThermodynamicState state1 = Medium1.setState_pTX(senTExhHot.port_b.p,T_LogMeanExh,senTExhHot.port_b.Xi_outflow);
Modelica.Units.SI.SpecificEnthalpy h1_in=Medium1.specificEnthalpy(state1);
Modelica.Units.SI.DynamicViscosity eta1_in=Medium1.dynamicViscosity(state1);
Modelica.Units.SI.Density rho1_in=Medium1.density_phX(
state1.p,
h1_in,
state1.X);
Modelica.Units.SI.Velocity v1_in=senMasFloExh.m_flow/(Modelica.Constants.pi*
rho1_in*d_iExh^2/4);
Modelica.Units.SI.ThermalConductivity lambda1_in=Medium1.thermalConductivity(
state1);
Modelica.Units.SI.ReynoldsNumber Re1_in=
Modelica.Fluid.Pipes.BaseClasses.CharacteristicNumbers.ReynoldsNumber(
v1_in,
rho1_in,
eta1_in,
d_iExh);
Modelica.Blocks.Sources.RealExpression machineIsOff(y=0)
"Calculated heat from generator losses"
AixLib.Controls.Interfaces.CHPControlBus cHPExhHexBus
"Signal bus of the exhaust gas heat exchanger"
AixLib.Utilities.Logical.SmoothSwitch switch2
Modelica.Blocks.Sources.RealExpression heatToCooling(y=pipeCoolant.heatPort_outside.Q_flow)
Modelica.Blocks.Sources.RealExpression condensingWater(y=m_ConH2OExh)
AixLib.Fluid.Sensors.TemperatureTwoPort senTExhHot(
redeclare final package Medium = Medium1,
final tau=tau,
final m_flow_nominal=m1_flow_nominal,
final initType=initType,
final T_start=T1_start,
final transferHeat=transferHeat,
final TAmb=T_Amb,
final tauHeaTra=tauHeaTra,
final allowFlowReversal=allowFlowReversal1,
final m_flow_small=m1_flow_small)
"Temperature sensor of hot side of exhaust heat exchanger"
AixLib.Fluid.Sensors.TemperatureTwoPort senTExhCold(
redeclare final package Medium = Medium1,
final tau=tau,
final m_flow_nominal=m1_flow_nominal,
final initType=initType,
final T_start=T1_start,
final transferHeat=transferHeat,
final TAmb=T_Amb,
final tauHeaTra=tauHeaTra,
final allowFlowReversal=allowFlowReversal1,
final m_flow_small=m1_flow_small)
"Temperature sensor of cold side of exhaust heat exchanger"
AixLib.Fluid.Sensors.MassFlowRate senMasFloExh(redeclare final package Medium =
Medium1, final allowFlowReversal=allowFlowReversal1)
"Sensor for mass flwo rate"
AixLib.Fluid.Sensors.TemperatureTwoPort senTCooCold(
redeclare final package Medium = Medium2,
final tau=tau,
final m_flow_nominal=m2_flow_nominal,
final initType=initType,
final T_start=T2_start,
final transferHeat=transferHeat,
final TAmb=T_Amb,
final tauHeaTra=tauHeaTra,
final allowFlowReversal=allowFlowReversal2,
final m_flow_small=m2_flow_small)
"Temperature sensor of coolant cold side of exhaust heat exchanger"
AixLib.Fluid.Sensors.TemperatureTwoPort senTCooHot(
redeclare final package Medium = Medium2,
final tau=tau,
final m_flow_nominal=m2_flow_nominal,
final initType=initType,
final T_start=T2_start,
final transferHeat=transferHeat,
final TAmb=T_Amb,
final tauHeaTra=tauHeaTra,
final allowFlowReversal=allowFlowReversal2,
final m_flow_small=m2_flow_small)
"Temperature sensor of coolant hot side of exhaust heat exchanger"
AixLib.Fluid.Sensors.MassFlowRate senMasFloCool(redeclare final package Medium =
Medium2, final allowFlowReversal=allowFlowReversal2)
"Sensor for mass flwo rate"
AixLib.Fluid.FixedResistances.Pipe pipeCoolant(
redeclare package Medium = Medium2,
isEmbedded=true,
Heat_Loss_To_Ambient=true,
withInsulation=false,
use_HeatTransferConvective=false,
eps=0,
hCon_i=GCoo/(pipeCoolant.perimeter*pipeCoolant.length),
diameter=0.03175,
redeclare model FlowModel =
Modelica.Fluid.Pipes.BaseClasses.FlowModels.NominalLaminarFlow (
m_flow_nominal=m2_flow_nominal, dp_nominal=10))
"Pipe model for heat transfer to the cooling circuit"
Modelica.Fluid.Vessels.ClosedVolume volExhaust(
redeclare final package Medium = Medium1,
final m_flow_nominal=m1_flow_nominal,
final p_start=p1_start,
final T_start=T1_start,
use_HeatTransfer=true,
redeclare model HeatTransfer =
Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.IdealHeatTransfer,
use_portsData=false,
final m_flow_small=m1_flow_small,
V=VExhHex,
nPorts=2) "Fluid volume of the exhaust gas inside the heat exchanger"
AixLib.Fluid.FixedResistances.HydraulicDiameter
pressureDropExhaust(
redeclare final package Medium = Medium1,
final show_T=false,
final allowFlowReversal=allowFlowReversal1,
final m_flow_nominal=m1_flow_nominal,
dh=d_iExh,
length=l_ExhHex) "Pressure drop of the exhaust gas"
AixLib.Utilities.HeatTransfer.HeatConvPipeInsideDynamic
heatConvExhaustPipeInside(
d_i=d_iExh,
A_sur=A_surExhHea,
rho=rho1_in,
lambda=lambda1_in,
eta=eta1_in,
c=cHPExhHexBus.calMeaCpExh,
m_flow=cHPExhHexBus.meaMasFloFueEng + cHPExhHexBus.meaMasFloAirEng)
"Heat transfer model using convection calculation"
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow additionalHeat
"Heat flow from water condensation in the exhaust gas and generator losses"
Modelica.Blocks.Sources.RealExpression latentAndGeneratorHeat(y=m_ConH2OExh*
deltaH_Vap + Q_Gen)
"Calculated latent exhaust heat from water condensation"
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCapacitor(C=
CExhHex, T(start=T_Amb, fixed=true))
"Thermal capacity of the exhaust gas heat exchanger"
Modelica.Thermal.HeatTransfer.Components.ThermalConductor ambientLoss(G=
GAmb)
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_amb
"Heat port to ambient"
protected
parameter Modelica.Units.SI.Volume VExhHex=l_ExhHex/4*Modelica.Constants.pi*
d_iExh^2 "Exhaust gas volume inside the exhaust heat exchanger"
equation
//Calculation of water condensation and its usable latent heat
if ConTec then
x_H2OExhDry=senTExhHot.port_a.Xi_outflow[3]/(1 - senTExhHot.port_a.Xi_outflow[3]);
xSat_H2OExhDry=if noEvent(M_H2O*pSatH2OExh/((pExh-pSatH2OExh)*M_Exh)>=0) then M_H2O*pSatH2OExh/((pExh-pSatH2OExh)*M_Exh) else x_H2OExhDry;
m_H2OExh=senMasFloExh.m_flow*senTExhHot.port_a.Xi_outflow[3];
m_ExhDry=senMasFloExh.m_flow-m_H2OExh;
m_ConH2OExh=if (x_H2OExhDry>xSat_H2OExhDry) then m_ExhDry*(x_H2OExhDry-xSat_H2OExhDry) else 0;
pExh=senTExhHot.port_a.p;
pSatH2OExh=100000*Modelica.Math.exp(A-B/(senTExhCold.T-273.15+C));
deltaH_Vap=2697400+446.25*senTExhCold.T-4.357*(senTExhCold.T)^2;
else
x_H2OExhDry=0;
xSat_H2OExhDry=0;
m_H2OExh=0;
m_ExhDry=0;
m_ConH2OExh=0;
pExh=0;
pSatH2OExh=0;
deltaH_Vap=0;
end if;
if (QuoT_ExhInOut-1)>0.0001 then
T_LogMeanExh=(senTExhHot.T-senTExhCold.T)/Modelica.Math.log(QuoT_ExhInOut);
else
T_LogMeanExh=senTExhHot.T;
end if;
connect(senTExhCold.port_b, senMasFloExh.port_a)
connect(port_a1, senTExhHot.port_a)
connect(senMasFloExh.port_b, port_b1)
connect(port_a2, senTCooCold.port_b)
connect(senTCooHot.port_a, senMasFloCool.port_a)
connect(senMasFloCool.port_b, port_b2)
connect(port_amb, ambientLoss.port_b)
connect(senTCooCold.port_a, pipeCoolant.port_a)
connect(senTCooHot.port_b, pipeCoolant.port_b)
connect(ambientLoss.port_a, heatCapacitor.port)
connect(heatCapacitor.port, pipeCoolant.heatPort_outside)
connect(volExhaust.heatPort, heatConvExhaustPipeInside.port_a)
connect(heatConvExhaustPipeInside.port_b, heatCapacitor.port)
connect(pressureDropExhaust.port_b, senTExhCold.port_a)
connect(additionalHeat.port, heatCapacitor.port)
connect(senTExhHot.port_b, volExhaust.ports[1])
connect(pressureDropExhaust.port_a, volExhaust.ports[2])
connect(switch2.y, additionalHeat.Q_flow)
connect(cHPExhHexBus.isOn, switch2.u2)
connect(latentAndGeneratorHeat.y, switch2.u1)
connect(machineIsOff.y, switch2.u3)
connect(senTCooHot.T, cHPExhHexBus.meaTemOutHex)
connect(senTCooCold.T, cHPExhHexBus.meaTemInHex)
connect(senTExhHot.T, cHPExhHexBus.meaTemExhHexIn)
connect(senTExhCold.T, cHPExhHexBus.meaTemExhHexOut)
connect(heatToCooling.y, cHPExhHexBus.meaThePowOutHex)
connect(condensingWater.y, cHPExhHexBus.meaMasFloConHex)
end ExhaustHeatExchanger; |
Thermal and mechanical model of an internal combustion engine with consideration of the individual mass flows | within AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses;
model GasolineEngineChp
"Thermal and mechanical model of an internal combustion engine with consideration of the individual mass flows"
replaceable package Medium_Fuel =
DataBase.CHP.ModularCHPEngineMedia.LiquidFuel_LPG constrainedby DataBase.CHP.ModularCHPEngineMedia.CHPCombustionMixtureGasNasa
"Fuel medium model used in the CHP plant"
replaceable package Medium_Air =
AixLib.DataBase.CHP.ModularCHPEngineMedia.EngineCombustionAir
constrainedby DataBase.CHP.ModularCHPEngineMedia.EngineCombustionAir
"Air medium model used in the CHP plant"
replaceable package Medium_Exhaust =
DataBase.CHP.ModularCHPEngineMedia.CHPFlueGasLambdaOnePlus constrainedby DataBase.CHP.ModularCHPEngineMedia.CHPCombustionMixtureGasNasa
"Exhaust gas medium model used in the CHP plant"
parameter
DataBase.CHP.ModularCHPEngineData.CHPEngDataBaseRecord
CHPEngineModel=AixLib.DataBase.CHP.ModularCHPEngineData.CHP_ECPowerXRGI15()
"CHP engine data for calculations"
parameter Data.ModularCHP.EngineMaterialData EngMat=
AixLib.Fluid.BoilerCHP.Data.ModularCHP.EngineMaterial_CastIron()
"Thermal engine material data for calculations"
parameter Modelica.Units.SI.Temperature T_amb=298.15
"Default ambient temperature"
parameter Modelica.Units.SI.Mass mEng=CHPEngineModel.mEng
"Total engine mass for heat capacity calculation"
parameter Modelica.Units.SI.Thickness dInn=0.005
"Typical value for the thickness of the cylinder wall (between combustion chamber and cooling circle)"
parameter Modelica.Units.SI.ThermalConductance GEngToAmb=0.23
"Thermal conductance from engine housing to the surrounding air"
AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses.BaseClassComponents.GasolineEngineChp_EngineModel
cHPCombustionEngine(
redeclare package Medium1 = Medium_Fuel,
redeclare package Medium2 = Medium_Air,
redeclare package Medium3 = Medium_Exhaust,
T_Amb=T_amb,
CHPEngData=CHPEngineModel,
inertia(phi(fixed=false), w(fixed=false, displayUnit="rad/s")),
T_logEngCool=T_logEngCoo,
T_ExhCHPOut=T_ExhCHPOut,
modFac=modFac,
SwitchOnOff=cHPEngBus.isOn)
"Mean value combustion engine model with mechanical and fluid ports"
AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses.BaseClassComponents.GasolineEngineChp_EngineHousing
engineToCoolant(
z=CHPEngineModel.z,
eps=CHPEngineModel.eps,
m_Exh=cHPCombustionEngine.m_flow_Exh,
T_Amb=T_amb,
redeclare package Medium3 = Medium_Exhaust,
dCyl=CHPEngineModel.dCyl,
hStr=CHPEngineModel.hStr,
meanCpExh=cHPCombustionEngine.meanCpExh,
cylToInnerWall(maximumEngineHeat(y=cHPCombustionEngine.Q_therm),
heatLimit(strict=true)),
T_Com=cHPCombustionEngine.T_Com,
nEng=cHPCombustionEngine.nEng,
lambda=EngMat.lambda,
rhoEngWall=EngMat.rhoEngWall,
c=EngMat.c,
EngMatData=EngMat,
mEng=mEng,
dInn=dInn,
T_ExhPowUniOut=T_ExhCHPOut,
GEngToAmb=GEngToAmb)
"A physikal model for calculating the thermal, mass and mechanical output of an ice powered CHP"
Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_eng
"Mechanical port of the engines output drive"
Modelica.Fluid.Interfaces.FluidPort_b port_exh(redeclare package Medium =
Medium_Exhaust)
"Fluid port of the exhaust gas comming from the combustion engine"
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_amb
"Heat port to ambient"
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_cooCir
"Heat port to cooling circuit"
AixLib.Controls.Interfaces.CHPControlBus cHPEngBus
"Signal bus of the combustion engine model"
protected
Real modFac=cHPEngBus.modFac
"Modulation factor for energy outuput control of the Chp unit "
Modelica.Units.SI.Temperature T_logEngCoo=(cHPEngBus.meaTemInEng + cHPEngBus.meaTemOutEng)
/2 "Logarithmic mean temperature of coolant inside the engine"
Modelica.Units.SI.Temperature T_ExhCHPOut=cHPEngBus.meaTemExhHexOut
"Exhaust gas outlet temperature of CHP unit"
Modelica.Units.SI.Temperature T_Exh=engineToCoolant.T_Exh
"Calculated mean temperature of the exhaust gas inside the cylinders"
equation
connect(port_exh, cHPCombustionEngine.port_exh)
connect(port_amb, engineToCoolant.port_amb)
connect(port_cooCir, engineToCoolant.port_coo)
connect(engineToCoolant.exhaustGasTemperature, cHPCombustionEngine.exhaustGasTemperature)
connect(cHPCombustionEngine.flange_a, flange_eng)
connect(cHPEngBus, cHPCombustionEngine.cHPEngineBus)
end GasolineEngineChp; |
Model of modular CHP power unit | within AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses;
model ModularCHP_PowerUnit "Model of modular CHP power unit"
import AixLib;
replaceable package Medium_Fuel =
AixLib.DataBase.CHP.ModularCHPEngineMedia.NaturalGasMixture_TypeAachen
constrainedby DataBase.CHP.ModularCHPEngineMedia.CHPCombustionMixtureGasNasa
"Fuel medium model used in the CHP plant"
replaceable package Medium_Coolant =
Modelica.Media.Air.DryAirNasa constrainedby Modelica.Media.Interfaces.PartialMedium
"Coolant medium model used in the CHP plant"
parameter
AixLib.DataBase.CHP.ModularCHPEngineData.CHPEngDataBaseRecord
CHPEngineModel=DataBase.CHP.ModularCHPEngineData.CHP_Kirsch_L4_12()
"CHP engine data for calculations"
parameter AixLib.Fluid.BoilerCHP.Data.ModularCHP.EngineMaterialData EngMat=
AixLib.Fluid.BoilerCHP.Data.ModularCHP.EngineMaterial_CastIron()
"Thermal engine material data for calculations"
parameter Modelica.Units.SI.Temperature T_amb=298.15
"Default ambient temperature"
parameter Modelica.Units.SI.AbsolutePressure p_amb=101325
"Default ambient pressure"
/* Modelica.SIunits.Temperature T_CoolRet=exhaustHeatExchanger_Experimental_New.senTCooCold.T
"Coolant return temperature";
Modelica.SIunits.Temperature T_CooSup=submodel_CoolingEASY_New.senTCooEngOut.T
"Coolant supply temperature";*/
parameter Real s_til=abs((inductionMachine.s_nominal*(inductionMachine.M_til/
inductionMachine.M_nominal) + inductionMachine.s_nominal*sqrt(abs(((
inductionMachine.M_til/inductionMachine.M_nominal)^2) - 1 + 2*
inductionMachine.s_nominal*((inductionMachine.M_til/inductionMachine.M_nominal)
- 1))))/(1 - 2*inductionMachine.s_nominal*((inductionMachine.M_til/
inductionMachine.M_nominal) - 1))) "Tilting slip of electric machine"
parameter Real calFac=1
"Calibration factor for electric power output (default=1)"
parameter Modelica.Units.SI.ThermalConductance GEngToCoo=33
"Thermal conductance of engine housing from the cylinder wall to the water cooling channels"
parameter Modelica.Units.SI.ThermalConductance GCooExhHex=400
"Thermal conductance of exhaust heat exchanger to cooling circuit"
parameter Modelica.Units.SI.Mass mEng=CHPEngineModel.mEng
"Total engine mass for heat capacity calculation"
parameter Modelica.Units.SI.HeatCapacity CExhHex=50000
"Heat capacity of exhaust heat exchanger(default= 4000 J/K)"
parameter Modelica.Units.SI.Thickness dInn=0.01
"Typical value for the thickness of the cylinder wall (between combustion chamber and cooling circle)"
parameter Modelica.Units.SI.ThermalConductance GEngToAmb=0.23
"Thermal conductance from engine housing to the surrounding air"
parameter Modelica.Units.SI.ThermalConductance GAmb=5
"Constant thermal conductance of material"
parameter Modelica.Units.SI.Area A_surExhHea=50
"Surface for exhaust heat transfer"
parameter Modelica.Units.SI.MassFlowRate m_flow=
CHPEngineModel.m_floCooNominal
"Nominal mass flow rate of coolant inside the engine cooling circle"
parameter Boolean ConTec=false
"Is condensing technology used and should latent heat be considered?"
parameter Boolean useGenHea=true
"Is the thermal loss energy of the elctric machine used?"
parameter Boolean allowFlowReversalExhaust=true
"= false to simplify equations, assuming, but not enforcing, no flow reversal for exhaust medium"
parameter Boolean allowFlowReversalCoolant=true
"= false to simplify equations, assuming, but not enforcing, no flow reversal for coolant medium"
parameter Modelica.Units.SI.MassFlowRate
mExh_flow_small=0.0001
"Small exhaust mass flow rate for regularization of zero flow"
parameter Modelica.Units.SI.MassFlowRate
mCool_flow_small=0.0001
"Small coolant mass flow rate for regularization of zero flow"
Modelica.Units.SI.Power Q_Therm=if (submodelCooling.heatPort_outside.Q_flow
+ exhaustHeatExchanger.pipeCoolant.heatPort_outside.Q_flow) > 10 then
submodelCooling.heatPort_outside.Q_flow + exhaustHeatExchanger.pipeCoolant.heatPort_outside.Q_flow
else 1 "Thermal power output of the CHP unit";
Modelica.Units.SI.Power P_Mech=gasolineEngineChp.cHPCombustionEngine.P_eff
"Mechanical power output of the CHP unit";
Modelica.Units.SI.Power P_El=-inductionMachine.P_E
"Electrical power output of the CHP unit";
Modelica.Units.SI.Power P_Fuel=if (gasolineEngineChp.cHPEngBus.isOn) then
m_flow_Fue*Medium_Fuel.H_U else 0 "CHP fuel expenses";
Modelica.Units.SI.Power Q_TotUnused=gasolineEngineChp.cHPCombustionEngine.Q_therm
- gasolineEngineChp.engineToCoolant.actualHeatFlowEngine.Q_flow +
exhaustHeatExchanger.volExhaust.heatPort.Q_flow
"Total heat error of the CHP unit";
Modelica.Units.SI.MassFlowRate m_flow_CO2=gasolineEngineChp.cHPCombustionEngine.m_flow_CO2Exh
"CO2 emission output rate";
Modelica.Units.SI.MassFlowRate m_flow_Fue=if (gasolineEngineChp.cHPCombustionEngine.m_flow_Fue)
> 0.0001 then gasolineEngineChp.cHPCombustionEngine.m_flow_Fue else
0.0001 "Fuel consumption rate of CHP unit";
type SpecificEmission=Real(final unit="g/(kW.h)", min=0.0001);
SpecificEmission b_CO2=if noEvent(abs(Q_Therm + P_El) > 0) then 3600000000.0 *
m_flow_CO2/(Q_Therm + P_El) else 0
"Specific CO2 emissions per kWh (heat and power)";
SpecificEmission b_e=if noEvent(abs(Q_Therm + P_El) > 0) then 3600000000.0 *
m_flow_Fue/(Q_Therm + P_El) else 0
"Specific fuel consumption per kWh (heat and power)";
Real FueUtiRate=(Q_Therm + P_El)/(m_flow_Fue*Medium_Fuel.H_U)
"Fuel utilization rate of the CHP unit";
Real PowHeatRatio = P_El/Q_Therm "Power to heat ration of the CHP unit";
Real eta_Therm=Q_Therm/(m_flow_Fue*Medium_Fuel.H_U)
"Thermal efficiency of the CHP unit";
Real eta_Mech=P_Mech/(m_flow_Fue*Medium_Fuel.H_U)
"Mechanical efficiency of the CHP unit";
Real eta_El=P_El/(m_flow_Fue*Medium_Fuel.H_U)
"Mechanical efficiency of the CHP unit";
inner Modelica.Fluid.System system(p_ambient=p_amb, T_ambient=T_amb)
Modelica.Fluid.Sources.FixedBoundary outletExhaustGas(
redeclare package Medium = Medium_Exhaust,
p=p_amb,
nPorts=1)
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature ambientTemperature(T=
T_amb) "Ambient temperature for thermal loss calculation"
Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heatFlowSensor
AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses.ExhaustHeatExchanger
exhaustHeatExchanger(
pipeCoolant(
p_a_start=system.p_start,
p_b_start=system.p_start,
use_HeatTransferConvective=false,
isEmbedded=true,
diameter=CHPEngineModel.dCoo,
allowFlowReversal=allowFlowReversalCoolant),
T_Amb=T_amb,
p_Amb=p_amb,
redeclare package Medium3 = Medium_Exhaust,
redeclare package Medium4 = Medium_Coolant,
d_iExh=CHPEngineModel.dExh,
dp_CooExhHex=CHPEngineModel.dp_Coo,
heatConvExhaustPipeInside(length=exhaustHeatExchanger.l_ExhHex),
CHPEngData=CHPEngineModel,
M_Exh=gasolineEngineChp.cHPCombustionEngine.MM_Exh,
allowFlowReversal1=allowFlowReversalExhaust,
allowFlowReversal2=allowFlowReversalCoolant,
m1_flow_small=mExh_flow_small,
m2_flow_small=mCool_flow_small,
ConTec=ConTec,
A_surExhHea=A_surExhHea,
m2_flow_nominal=m_flow,
CExhHex=CExhHex,
GCoo=GCooExhHex,
GAmb=GAmb) "Exhaust gas heat exchanger of a CHP power unit"
AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses.CHP_ElectricMachine
inductionMachine(
CHPEngData=CHPEngineModel,
useHeat=useGenHea,
calFac=calFac,
s_til=s_til)
"Induction machine working as a starter motor and generator inside the CHP power unit"
Modelica.Fluid.Interfaces.FluidPort_a port_retCoo(redeclare package Medium =
Medium_Coolant)
"Fluid port for the return flow side of the cooling circuit"
Modelica.Fluid.Interfaces.FluidPort_b port_supCoo(redeclare package Medium =
Medium_Coolant)
"Fluid port for the supply flow side of the cooling circuit"
AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses.GasolineEngineChp
gasolineEngineChp(
redeclare package Medium_Fuel = Medium_Fuel,
redeclare package Medium_Air = Medium_Air,
redeclare package Medium_Exhaust = Medium_Exhaust,
CHPEngineModel=CHPEngineModel,
EngMat=EngMat,
T_amb=T_amb,
mEng=mEng,
dInn=dInn,
GEngToAmb=GEngToAmb)
"Combustion engine with thermal and mechanical power output"
AixLib.Controls.Interfaces.CHPControlBus sigBusCHP
"Signal bus connector for the CHP power unit"
AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses.SubmodelCooling submodelCooling(
redeclare package Medium_Coolant = Medium_Coolant,
CHPEngineModel=CHPEngineModel,
m_flow=m_flow,
GEngToCoo=GEngToCoo,
allowFlowReversalCoolant=allowFlowReversalCoolant,
mCool_flow_small=mCool_flow_small)
"Model of the main fluid components inside the cooling circuit of a CHP power unit"
Modelica.Blocks.Sources.RealExpression specificFuelUse(y=b_e)
Modelica.Blocks.Sources.RealExpression specificCO2(y=b_CO2)
Modelica.Blocks.Sources.RealExpression thermalPowerCHP(y=Q_Therm)
Modelica.Blocks.Sources.RealExpression thermalEfficiencyCHP(y=eta_Therm)
Modelica.Blocks.Sources.RealExpression electricEfficiencyCHP(y=eta_El)
Modelica.Blocks.Sources.RealExpression fuelUtilizationRate(y=FueUtiRate)
protected
replaceable package Medium_Air =
AixLib.DataBase.CHP.ModularCHPEngineMedia.EngineCombustionAir
constrainedby DataBase.CHP.ModularCHPEngineMedia.EngineCombustionAir
"Air medium model used in the CHP plant"
replaceable package Medium_Exhaust =
DataBase.CHP.ModularCHPEngineMedia.CHPFlueGasLambdaOnePlus constrainedby DataBase.CHP.ModularCHPEngineMedia.CHPCombustionMixtureGasNasa
"Exhaust gas medium model used in the CHP plant"
equation
connect(ambientTemperature.port, heatFlowSensor.port_b)
connect(inductionMachine.flange_genIn, gasolineEngineChp.flange_eng)
connect(gasolineEngineChp.port_exh, exhaustHeatExchanger.port_a1)
connect(gasolineEngineChp.port_amb, heatFlowSensor.port_a)
connect(gasolineEngineChp.port_cooCir, submodelCooling.heatPort_outside)
connect(exhaustHeatExchanger.port_amb, heatFlowSensor.port_a)
connect(inductionMachine.cHPGenBus, sigBusCHP)
connect(exhaustHeatExchanger.cHPExhHexBus, sigBusCHP)
connect(gasolineEngineChp.cHPEngBus, sigBusCHP)
connect(port_supCoo, submodelCooling.port_b)
connect(exhaustHeatExchanger.port_b2, submodelCooling.port_a)
connect(submodelCooling.sigBus_coo, sigBusCHP)
connect(port_retCoo, exhaustHeatExchanger.port_a2)
connect(exhaustHeatExchanger.port_b1, outletExhaustGas.ports[1])
connect(thermalPowerCHP.y, sigBusCHP.meaThePowChp)
connect(specificCO2.y, sigBusCHP.calEmiCO2Chp)
connect(specificFuelUse.y, sigBusCHP.calFueChp)
connect(thermalEfficiencyCHP.y, sigBusCHP.calEtaTheChp)
connect(electricEfficiencyCHP.y, sigBusCHP.calEtaElChp)
connect(fuelUtilizationRate.y, sigBusCHP.calFueUtiChp)
end ModularCHP_PowerUnit; |
Package with base classes for AixLib.Fluid.BoilerCHP.ModularCHP | within AixLib.Fluid.BoilerCHP.ModularCHP;
package BaseClasses "Package with base classes for AixLib.Fluid.BoilerCHP.ModularCHP"
extends Modelica.Icons.BasesPackage
end BaseClasses; |
Coolant medium model used in the CHP plant | within AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses;
model SubmodelCooling
replaceable package Medium_Coolant =
DataBase.CHP.ModularCHPEngineMedia.CHPCoolantPropyleneGlycolWater (
property_T=356, X_a=0.50) constrainedby Modelica.Media.Interfaces.PartialMedium
"Coolant medium model used in the CHP plant"
parameter
DataBase.CHP.ModularCHPEngineData.CHPEngDataBaseRecord
CHPEngineModel=DataBase.CHP.ModularCHPEngineData.CHP_ECPowerXRGI15()
"CHP engine data for calculations"
parameter Modelica.Units.SI.MassFlowRate m_flow=
CHPEngineModel.m_floCooNominal
"Nominal mass flow rate of coolant inside the engine cooling circle"
parameter Modelica.Units.SI.ThermalConductance GEngToCoo=45
"Thermal conductance of engine housing from the cylinder wall to the water cooling channels"
parameter Boolean allowFlowReversalCoolant=true
"= false to simplify equations, assuming, but not enforcing, no flow reversal for coolant medium"
parameter Modelica.Units.SI.MassFlowRate
mCool_flow_small=0.0001
"Small coolant mass flow rate for regularization of zero flow"
outer Modelica.Fluid.System system
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort_outside
"Heat port to engine"
Modelica.Fluid.Interfaces.FluidPort_a port_a(redeclare package Medium =
Medium_Coolant)
"Fluid port for the return flow side of the cooling circuit model"
Modelica.Fluid.Interfaces.FluidPort_b port_b(redeclare package Medium =
Medium_Coolant)
"Fluid port for the supply flow side of the cooling circuit model"
AixLib.Controls.Interfaces.CHPControlBus sigBus_coo
"Signal bus of the cooling circuit components"
Movers.FlowControlled_m_flow coolantPump(
m_flow_small=mCool_flow_small,
redeclare package Medium = Medium_Coolant,
dp_nominal=CHPEngineModel.dp_Coo,
allowFlowReversal=allowFlowReversalCoolant,
addPowerToMedium=false,
m_flow_nominal=m_flow,
use_inputFilter=false) "Model of a fluid pump or fan"
AixLib.Utilities.Logical.SmoothSwitch switch1
Modelica.Blocks.Sources.RealExpression massFlowPump(y=m_flow)
Modelica.Blocks.Sources.RealExpression minMassFlowPump(y=mCool_flow_small)
Modelica.Fluid.Sensors.TemperatureTwoPort senTCooEngIn(
redeclare package Medium = Medium_Coolant,
allowFlowReversal=allowFlowReversalCoolant,
m_flow_nominal=m_flow,
m_flow_small=mCool_flow_small) "Temperature sensor of engine cooling inlet"
FixedResistances.Pipe engineHeatTransfer(
redeclare package Medium = Medium_Coolant,
redeclare model FlowModel =
Modelica.Fluid.Pipes.BaseClasses.FlowModels.NominalLaminarFlow (
dp_nominal=CHPEngineModel.dp_Coo, m_flow_nominal=m_flow),
Heat_Loss_To_Ambient=true,
eps=0,
isEmbedded=true,
use_HeatTransferConvective=false,
p_a_start=system.p_start,
p_b_start=system.p_start,
hCon_i=GEngToCoo/(engineHeatTransfer.perimeter*engineHeatTransfer.length),
diameter=CHPEngineModel.dCoo,
allowFlowReversal=allowFlowReversalCoolant)
Modelica.Fluid.Sensors.TemperatureTwoPort senTCooEngOut(
redeclare package Medium = Medium_Coolant,
allowFlowReversal=allowFlowReversalCoolant,
m_flow_nominal=m_flow,
m_flow_small=mCool_flow_small)
"Temperature sensor of engine cooling outlet"
equation
connect(engineHeatTransfer.port_b, senTCooEngOut.port_a)
connect(heatPort_outside, engineHeatTransfer.heatPort_outside)
connect(port_a, senTCooEngIn.port_a)
connect(port_b, senTCooEngOut.port_b)
connect(senTCooEngIn.port_b, coolantPump.port_a)
connect(engineHeatTransfer.port_a, coolantPump.port_b)
connect(switch1.y, coolantPump.m_flow_in)
connect(sigBus_coo.isOnPump, switch1.u2)
connect(massFlowPump.y, switch1.u1)
connect(minMassFlowPump.y, switch1.u3)
connect(senTCooEngIn.T, sigBus_coo.meaTemInEng)
connect(senTCooEngOut.T, sigBus_coo.meaTemOutEng)
end SubmodelCooling; |
Engine housing as a simple two layer wall. | within AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses.BaseClassComponents;
class GasolineEngineChp_EngineHousing
"Engine housing as a simple two layer wall."
replaceable package Medium3 =
DataBase.CHP.ModularCHPEngineMedia.CHPFlueGasLambdaOnePlus
constrainedby DataBase.CHP.ModularCHPEngineMedia.CHPCombustionMixtureGasNasa
"Exhaust gas medium model used in the CHP plant"
parameter Modelica.Units.SI.Thickness dInn=0.005
"Typical value for the thickness of the cylinder wall (between combustion chamber and cooling circle)"
parameter AixLib.Fluid.BoilerCHP.Data.ModularCHP.EngineMaterialData
EngMatData=AixLib.Fluid.BoilerCHP.Data.ModularCHP.EngineMaterial_CastIron()
"Thermal engine material data for calculations (most common is cast iron)"
constant Modelica.Units.SI.ThermalConductivity lambda=EngMatData.lambda
"Thermal conductivity of the engine block material"
constant Modelica.Units.SI.Density rhoEngWall=EngMatData.rhoEngWall
"Density of the the engine block material"
constant Modelica.Units.SI.SpecificHeatCapacity c=EngMatData.c
"Specific heat capacity of the cylinder wall material"
constant Real z
"Number of engine cylinders"
constant Modelica.Units.SI.Thickness dCyl "Engine cylinder diameter"
constant Modelica.Units.SI.Thickness hStr "Engine stroke"
constant Real eps
"Engine compression ratio"
parameter Modelica.Units.SI.Mass mEng "Total engine mass"
parameter Modelica.Units.SI.ThermalConductance GEngToAmb=0.23
"Thermal conductance from engine housing to the surrounding air"
parameter Modelica.Units.SI.Temperature T_Amb=298.15 "Ambient temperature"
Real nEng
"Current engine speed"
Modelica.Units.SI.ThermalConductance CalT_Exh
"Calculation variable for the temperature of the exhaust gas";
Modelica.Units.SI.Temperature T_Com
"Calculated maximum combustion temperature inside the engine"
Modelica.Units.SI.Temperature T_CylWall "Temperature of cylinder wall";
/* Modelica.SIunits.Temperature T_LogMeanCool
"Mean logarithmic coolant temperature" */
Modelica.Units.SI.Temperature T_Exh "Inlet temperature of exhaust gas"
Modelica.Units.SI.Temperature T_ExhPowUniOut
"Outlet temperature of exhaust gas"
type RotationSpeed=Real(final unit="1/s", min=0);
Modelica.Units.SI.MassFlowRate m_Exh "Mass flow rate of exhaust gas"
Modelica.Units.SI.SpecificHeatCapacity meanCpExh
"Mean specific heat capacity of the exhaust gas"
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_amb
"Heat port to ambient"
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor innerWall(
C=CEngWall,
der_T(fixed=false, start=0),
T(start=T_Amb,
fixed=true)) "Thermal capacity model of the cylinder wall"
Modelica.Blocks.Sources.RealExpression realExpr1(y=innerWall.T)
Modelica.Blocks.Sources.RealExpression realExpr2(y=T_CylWall)
Modelica.Thermal.HeatTransfer.Components.ThermalConductor innerThermalCond(G=
GInnWall/2)
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow actualHeatFlowEngine
"Heat flow from engine combustion"
AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses.BaseClassComponents.GasolineEngineChp_EngineHousing_CylToInnerWall
cylToInnerWall(
GInnWall=GInnWall,
dInn=dInn,
lambda=lambda,
A_WInn=A_WInn,
z=z) "Thermal model of the cylinder wall"
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_coo
"Heat port to cooling circuit"
Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor engHeatToCoolant
AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses.BaseClassComponents.GasolineEngineChp_EngineHousing_EngineBlock
engineBlock(
CEngBlo=CEngBlo,
GInnWall=GInnWall,
GEngBlo=GEngBlo,
dInn=dInn,
dOut=dOut,
lambda=lambda,
rhoEngWall=rhoEngWall,
c=c,
A_WInn=A_WInn,
z=z,
mEngBlo=mEngBlo,
mEng=mEng,
mEngWall=mEngWall,
GEngToAmb=GEngToAmb,
outerEngineBlock(T(start=T_Amb))) "Thermal model of the engine block"
Modelica.Blocks.Sources.RealExpression calculatedExhaustTemp(y=T_Exh)
Modelica.Blocks.Interfaces.RealOutput exhaustGasTemperature
"Calculated exhaust gas temperature output to the mechanical engine model"
protected
constant Modelica.Units.SI.Area A_WInn=z*(Modelica.Constants.pi*dCyl*(dCyl/2
+ hStr*(1 + 1/(eps - 1))))
"Area of heat transporting surface from cylinder wall to outer engine block"
parameter Modelica.Units.SI.Mass mEngWall=A_WInn*rhoEngWall*dInn
"Calculated mass of cylinder wall between combustion chamber and cooling circle"
parameter Modelica.Units.SI.Mass mEngBlo=mEng - mEngWall
"Calculated mass of the remaining engine body"
parameter Modelica.Units.SI.Thickness dOut=mEngBlo/A_WInn/rhoEngWall
"Thickness of outer wall of the remaining engine body"
parameter Modelica.Units.SI.HeatCapacity CEngWall=dInn*A_WInn*rhoEngWall*c
"Heat capacity of cylinder wall between combustion chamber and cooling circle"
parameter Modelica.Units.SI.HeatCapacity CEngBlo=dOut*A_WInn*rhoEngWall*c
"Heat capacity of the remaining engine body"
parameter Modelica.Units.SI.ThermalConductance GInnWall=lambda*A_WInn/dInn
"Thermal conductance of the inner engine wall"
parameter Modelica.Units.SI.ThermalConductance GEngBlo=lambda*A_WInn/dOut
"Thermal conductance of the remaining engine body"
equation
/* if EngOp and m_Exh>0.001 then
T_CylWall=0.5*(T_Com+T_Amb)*CalTCyl;
else
T_CylWall=T_Amb;
end if;*/
CalT_Exh = meanCpExh*m_Exh;
if noEvent(nEng*60<800) then
T_CylWall=innerWall.T;
T_Exh=innerWall.T;
else
T_CylWall=T_Amb+0.2929*(T_Com-T_Amb);
T_Exh=T_ExhPowUniOut + abs((cylToInnerWall.maximumEngineHeat.y-actualHeatFlowEngine.Q_flow)/CalT_Exh);
end if;
// T_CylWall=T_Amb+0.2929*(T_Com-T_Amb);
// T_CylWall=(T_Com-T_Amb)/Modelica.Math.log(T_Com/T_Amb);
/* if abs(QuoT_SupRet-1)>0.0001 then
T_LogMeanCool=(T_CoolSup-T_CoolRet)/Modelica.Math.log(QuoT_SupRet);
else
T_LogMeanCool=T_CoolRet;
end if; */
connect(actualHeatFlowEngine.port,innerWall. port)
connect(engineBlock.port_a, innerWall.port)
connect(cylToInnerWall.y, actualHeatFlowEngine.Q_flow)
connect(cylToInnerWall.T, realExpr2.y)
connect(realExpr1.y, cylToInnerWall.T1)
connect(engineBlock.port_a1, port_amb)
connect(innerThermalCond.port_a, innerWall.port)
connect(port_coo, engHeatToCoolant.port_b)
connect(innerThermalCond.port_b, engHeatToCoolant.port_a)
connect(calculatedExhaustTemp.y, exhaustGasTemperature)
end GasolineEngineChp_EngineHousing; |
Thermal conductance of the inner engine wall. | within AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses.BaseClassComponents;
model GasolineEngineChp_EngineHousing_CylToInnerWall
parameter Modelica.Units.SI.ThermalConductance GInnWall=lambda*A_WInn/dInn
"Thermal conductance of the inner engine wall"
parameter Modelica.Units.SI.Thickness dInn=0.005
"Typical value for the thickness of the cylinder wall (between combustion chamber and cooling circle)"
parameter Modelica.Units.SI.ThermalConductivity lambda=44.5
"Thermal conductivity of the engine block material"
parameter Modelica.Units.SI.Area A_WInn
"Area of heat transporting surface from cylinder wall to outer engine block"
parameter Real z=4
Modelica.Blocks.Interfaces.RealOutput y
Modelica.Blocks.Interfaces.RealInput T(unit="K")
Modelica.Blocks.Interfaces.RealInput T1(unit="K")
Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature meanTempCylWall
Modelica.Thermal.HeatTransfer.Components.ThermalConductor
innerThermalConductor1(G=GInnWall/2)
Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heatFlowEngine
Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature tempInnerWall
Modelica.Blocks.Nonlinear.VariableLimiter heatLimit(strict=true)
Modelica.Blocks.Sources.RealExpression maximumEngineHeat
Modelica.Blocks.Sources.Constant const(k=0)
equation
connect(heatFlowEngine.Q_flow,heatLimit. u)
connect(innerThermalConductor1.port_b,heatFlowEngine. port_a)
connect(heatFlowEngine.port_b, tempInnerWall.port)
connect(T, meanTempCylWall.T)
connect(heatLimit.y, y)
connect(meanTempCylWall.port, innerThermalConductor1.port_a)
connect(tempInnerWall.T, T1)
connect(maximumEngineHeat.y, heatLimit.limit1)
connect(const.y, heatLimit.limit2)
end GasolineEngineChp_EngineHousing_CylToInnerWall; |
Heat capacity of the remaining engine body. | within AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses.BaseClassComponents;
model GasolineEngineChp_EngineHousing_EngineBlock
parameter Modelica.Units.SI.HeatCapacity CEngBlo=dOut*A_WInn*rhoEngWall*c
"Heat capacity of the remaining engine body"
parameter Modelica.Units.SI.ThermalConductance GEngToAmb=0.23
"Thermal conductance from the engine block to the ambient"
parameter Modelica.Units.SI.ThermalConductance GInnWall=lambda*A_WInn/dInn
"Thermal conductance of the inner engine wall"
parameter Modelica.Units.SI.ThermalConductance GEngBlo=lambda*A_WInn/dOut
"Thermal conductance of the outer engine wall"
parameter Modelica.Units.SI.Temperature T_Amb=298.15 "Ambient temperature"
parameter Modelica.Units.SI.Thickness dInn=0.005
"Typical value for the thickness of the cylinder wall (between combustion chamber and cooling circle)"
parameter Modelica.Units.SI.Thickness dOut=mEngBlo/A_WInn/rhoEngWall
"Thickness of outer wall of the remaining engine body"
parameter Modelica.Units.SI.ThermalConductivity lambda=44.5
"Thermal conductivity of the engine block material"
parameter Modelica.Units.SI.Density rhoEngWall=72000
"Density of the the engine block material"
parameter Modelica.Units.SI.SpecificHeatCapacity c=535
"Specific heat capacity of the cylinder wall material"
parameter Modelica.Units.SI.Area A_WInn
"Area of heat transporting surface from cylinder wall to outer engine block"
parameter Real z
parameter Modelica.Units.SI.Mass mEngBlo=mEng - mEngWall
parameter Modelica.Units.SI.Mass mEng
parameter Modelica.Units.SI.Mass mEngWall=A_WInn*rhoEngWall*dInn
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_a
"Heat port to engine block"
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_a1
"Heat port to ambient"
Modelica.Thermal.HeatTransfer.Components.ThermalConductor innerThermalCond2(G=
GInnWall/2)
Modelica.Thermal.HeatTransfer.Components.ThermalConductor outerThermalCond(
G=GEngBlo/2)
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor outerEngineBlock(
der_T(fixed=false, start=0),
C=CEngBlo,
T(start=T_Amb,
fixed=true)) "Thermal capacity of the engine block"
Modelica.Thermal.HeatTransfer.Components.ThermalConductor outerThermalCond2(
G=GEngBlo/2)
Modelica.Thermal.HeatTransfer.Components.ThermalConductor toAmbient(G=GEngToAmb)
equation
connect(outerThermalCond.port_b,outerEngineBlock. port)
connect(outerThermalCond.port_a, innerThermalCond2.port_b)
connect(outerEngineBlock.port,outerThermalCond2. port_a)
connect(port_a, innerThermalCond2.port_a)
connect(port_a1, toAmbient.port_a)
connect(outerThermalCond2.port_b, toAmbient.port_b)
end GasolineEngineChp_EngineHousing_EngineBlock; |
Internal combustion engine model for CHP-applications. | within AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses.BaseClassComponents;
model GasolineEngineChp_EngineModel
"Internal combustion engine model for CHP-applications."
import AixLib;
replaceable package Medium1 =
DataBase.CHP.ModularCHPEngineMedia.NaturalGasMixture_TypeAachen
constrainedby DataBase.CHP.ModularCHPEngineMedia.CHPCombustionMixtureGasNasa
"Fuel medium model used in the CHP plant"
replaceable package Medium2 =
AixLib.DataBase.CHP.ModularCHPEngineMedia.EngineCombustionAir
constrainedby DataBase.CHP.ModularCHPEngineMedia.EngineCombustionAir
"Air medium model used in the CHP plant"
replaceable package Medium3 =
DataBase.CHP.ModularCHPEngineMedia.CHPFlueGasLambdaOnePlus constrainedby DataBase.CHP.ModularCHPEngineMedia.CHPCombustionMixtureGasNasa
"Exhaust gas medium model used in the CHP plant"
parameter
AixLib.DataBase.CHP.ModularCHPEngineData.CHPEngDataBaseRecord
CHPEngData=DataBase.CHP.ModularCHPEngineData.CHP_SenerTecDachsG5_5()
"Needed engine data for calculations"
constant Modelica.Units.SI.Volume VCyl=CHPEngData.VEng/CHPEngData.z
"Cylinder displacement";
type RotationSpeed=Real(final unit="1/s", min=0);
constant RotationSpeed nEngNominal = 25.583 "Nominal engine speed at operating point";
constant Modelica.Units.SI.Power P_mecNominal=CHPEngData.P_mecNominal
"Mecanical power output at nominal operating point";
parameter Modelica.Units.SI.Temperature T_Amb=298.15
"Ambient temperature (matches to fuel and combustion air temperature)";
type GasConstant=Real(final unit="J/(mol.K)");
constant GasConstant R = 8.31446 "Gasconstant for calculation purposes";
constant Real QuoDCyl = CHPEngData.QuoDCyl;
constant Boolean FuelType = Medium1.isGas "True = Gasoline fuel, False = Liquid fuel";
constant Modelica.Units.SI.MassFlowRate m_MaxExh=CHPEngData.P_FueNominal/H_U*
(1 + Lambda*L_St)
"Maximal exhaust gas flow based on the fuel and combustion properties";
constant Modelica.Units.SI.Mass m_FueEngRot=CHPEngData.P_FueNominal*60/(H_U*
CHPEngData.nEngMax*CHPEngData.i)
"Injected fuel mass per engine rotation(presumed as constant)";
constant Modelica.Units.SI.Pressure p_Amb=101325 "Ambient pressure";
constant Modelica.Units.SI.Pressure p_mi=p_mfNominal + p_meNominal
"Constant indicated mean effective cylinder pressure";
constant Modelica.Units.SI.Pressure p_meNominal=CHPEngData.p_meNominal
"Nominal mean effective cylinder pressure";
constant Modelica.Units.SI.Pressure ref_p_mfNominal=CHPEngData.ref_p_mfNominal
"Friction mean pressure of reference engine for calculation(dCyl=91mm & nEng=3000rpm & TEng=90°C)";
constant Modelica.Units.SI.Pressure p_mfNominal=ref_p_mfNominal*QuoDCyl^(-0.3)
"Nominal friction mean pressure";
constant Modelica.Units.SI.Temperature T_ExhOut=CHPEngData.T_ExhPowUniOut
"Assumed exhaust gas outlet temperature of the CHP unit for heat calculations";
constant Modelica.Units.SI.SpecificEnergy H_U=Medium1.H_U
"Specific calorific value of the fuel";
constant Real Lambda=CHPEngData.Lambda "Combustion air ratio";
constant Real L_St = Medium1.L_st "Stoichiometric air consumption per mass fuel";
constant Real l_Min = L_St*MM_Fuel/MM_Air "Minimum molar air consumption per mole fuel";
constant Modelica.Units.SI.MolarMass MM_Fuel=Medium1.MM
"Molar mass of the fuel";
constant Modelica.Units.SI.MolarMass MM_Air=Medium2.MM
"Molar mass of the combustion air";
constant Modelica.Units.SI.MolarMass MM_ComExh[:]=Medium3.data[:].MM
"Molar masses of the combustion products: N2, O2, H2O, CO2";
constant Real expFacCpComExh[:] = {0.11, 0.15, 0.20, 0.30} "Exponential factor for calculating the specific heat capacity of N2, O2, H2O, CO2";
constant Modelica.Units.SI.SpecificHeatCapacity cpRefComExh[:]={1000,900,1750,
840}
"Specific heat capacities of the combustion products at reference state at 0°C";
constant Modelica.Units.SI.Temperature RefT_Com=1473.15
"Reference combustion temperature for calculation purposes";
// Exhaust composition for gasoline fuels
constant Real n_N2Exh = if FuelType then Medium1.moleFractions_Gas[1] + Lambda*l_Min*Medium2.moleFractions_Air[1]
else Lambda*l_Min*Medium2.moleFractions_Air[1] "Exhaust: Number of molecules Nitrogen per mole of fuel";
constant Real n_O2Exh = (Lambda-1)*l_Min*Medium2.moleFractions_Air[2] "Exhaust: Number of molecules Oxygen per mole of fuel";
constant Real n_H2OExh = if FuelType then 0.5*sum(Medium1.moleFractions_Gas[i]*Medium1.Fuel.nue_H[i] for i in 1:size(Medium1.Fuel.nue_H, 1))
else 0.5*(Medium1.Fuel.Xi_liq[2]*Medium1.MM/Medium1.Fuel.MMi_liq[2]) "Exhaust: Number of molecules H20 per mole of fuel";
constant Real n_CO2Exh = if FuelType then sum(Medium1.moleFractions_Gas[i]*Medium1.Fuel.nue_C[i] for i in 1:size(Medium1.Fuel.nue_C, 1))
else Medium1.Fuel.Xi_liq[1]*Medium1.MM/Medium1.Fuel.MMi_liq[1] "Exhaust: Number of molecules CO2 per mole of fuel";
constant Real n_ComExh[:] = {n_N2Exh, n_O2Exh, n_H2OExh, n_CO2Exh};
constant Real n_Exh = sum(n_ComExh[j] for j in 1:size(n_ComExh, 1)) "Number of exhaust gas molecules per mole of fuel";
constant Modelica.Units.SI.MolarMass MM_Exh=sum(n_ComExh[i]*MM_ComExh[i] for
i in 1:size(n_ComExh, 1))/sum(n_ComExh[i] for i in 1:size(n_ComExh, 1))
"Molar mass of the exhaust gas";
constant Modelica.Units.SI.MassFraction X_N2Exh=MM_ComExh[1]*n_ComExh[1]/(
MM_Exh*n_Exh) "Mass fraction of N2 in the exhaust gas";
constant Modelica.Units.SI.MassFraction X_O2Exh=MM_ComExh[2]*n_ComExh[2]/(
MM_Exh*n_Exh) "Mass fraction of O2 in the exhaust gas";
constant Modelica.Units.SI.MassFraction X_H2OExh=MM_ComExh[3]*n_ComExh[3]/(
MM_Exh*n_Exh) "Mass fraction of H2O in the exhaust gas";
constant Modelica.Units.SI.MassFraction X_CO2Exh=MM_ComExh[4]*n_ComExh[4]/(
MM_Exh*n_Exh) "Mass fraction of CO2 in the exhaust gas";
constant Modelica.Units.SI.MassFraction Xi_Exh[size(n_ComExh, 1)]={X_N2Exh,
X_O2Exh,X_H2OExh,X_CO2Exh};
Boolean SwitchOnOff=true
"Operation switch of the CHP unit (true=On, false=Off)"
RotationSpeed nEng(min=0) "Current engine speed";
Modelica.Units.SI.MassFlowRate m_flow_Exh "Mass flow rate of exhaust gas";
Modelica.Units.SI.MassFlowRate m_flow_CO2Exh
"Mass flow rate of CO2 in the exhaust gas";
Modelica.Units.SI.MassFlowRate m_flow_Fue(min=0) "Mass flow rate of fuel";
Modelica.Units.SI.MassFlowRate m_flow_Air(min=0)
"Mass flow rate of combustion air";
Modelica.Units.SI.SpecificHeatCapacity meanCpComExh[size(n_ComExh, 1)]
"Calculated specific heat capacities of the exhaust gas components for the calculated combustion temperature";
Modelica.Units.SI.SpecificHeatCapacity meanCpExh
"Calculated specific heat capacity of the exhaust gas for the calculated combustion temperature";
Modelica.Units.SI.SpecificEnergy h_Exh=1000*(-286 + 1.011*T_ExhCHPOut - 27.29
*Lambda + 0.000136*T_ExhCHPOut^2 - 0.0255*T_ExhCHPOut*Lambda + 6.425*
Lambda^2) "Specific enthalpy of the exhaust gas";
Modelica.Units.SI.Power P_eff "Effective(mechanical) engine power";
Modelica.Units.SI.Power P_Fue(min=0) = m_flow_Fue*H_U
"Fuel expenses at operating point";
Modelica.Units.SI.Power H_Exh "Enthalpy stream of the exhaust gas";
Modelica.Units.SI.Power CalQ_therm "Calculated heat from engine combustion";
Modelica.Units.SI.Power Q_therm(min=0) "Total heat from engine combustion";
Modelica.Units.SI.Torque Mmot "Calculated engine torque";
Modelica.Units.SI.Temperature T_logEngCool=356.15
"Logarithmic mean temperature of coolant inside the engine"
Modelica.Units.SI.Temperature T_Com(start=T_Amb)
"Temperature of the combustion gases";
Modelica.Units.SI.Temperature T_ExhCHPOut=383.15
"Exhaust gas outlet temperature of CHP unit"
Real modFac=1 "Modulation factor for energy outuput control of the Chp unit"
// Dynamic engine friction calculation model for the mechanical power and heat output of the combustion engine
Real A0 = 1.0895-1.079*10^(-2)*(T_logEngCool-273.15)+5.525*10^(-5)*(T_logEngCool-273.15)^2;
Real A1 = 4.68*10^(-4)-5.904*10^(-6)*(T_logEngCool-273.15)+1.88*10^(-8)*(T_logEngCool-273.15)^2;
Real A2 = -4.35*10^(-8)+1.12*10^(-9)*(T_logEngCool-273.15)-4.79*10^(-12)*(T_logEngCool-273.15)^2;
Real B0 = -2.625*10^(-3)+3.75*10^(-7)*(nEng*60)+1.75*10^(-5)*(T_logEngCool-273.15)+2.5*10^(-9)*(T_logEngCool-273.15)*(nEng*60);
Real B1 = 8.95*10^(-3)+1.5*10^(-7)*(nEng*60)+7*10^(-6)*(T_logEngCool-273.15)-10^(-9)*(T_logEngCool-273.15)*(nEng*60);
Modelica.Units.SI.Pressure p_mf=p_mfNominal*((A0 + A1*(nEng*60) + A2*(nEng*60)
^2) + (B0 + B1*(p_meNominal/100000)))
"Current friction mean pressure at operating point";
Modelica.Units.SI.Pressure p_me=(modFac*p_mi) - p_mf
"Current mean effective pressure at operating point";
Real etaMec = p_me/p_mi "Current percentage of usable mechanical power compared to inner cylinder power from combustion";
Modelica.Fluid.Interfaces.FluidPort_b port_exh(redeclare package Medium =
Medium3)
Modelica.Fluid.Sources.MassFlowSource_T exhaustFlow(
use_m_flow_in=true,
use_T_in=true,
redeclare package Medium = Medium3,
X=Xi_Exh,
use_X_in=false,
nPorts=1) "Flow source of the exhaust gas from the engine combustion"
Modelica.Blocks.Sources.RealExpression massFlowExhaust(y=m_flow_Exh)
Modelica.Blocks.Sources.RealExpression effectiveMechanicalTorque(y=Mmot)
Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a
"Mechanical port of the engines output drive"
Modelica.Mechanics.Rotational.Sources.Torque engineTorque
"Calculated engine torque"
Modelica.Mechanics.Rotational.Components.Inertia inertia(J=0.5*CHPEngData.z/4)
"Inertia model of the engine"
Modelica.Blocks.Interfaces.RealInput exhaustGasTemperature
"Exhaust gas temperature calculated in the thermal engine model"
AixLib.Controls.Interfaces.CHPControlBus cHPEngineBus
"Signal bus of the mechanical combustion engine model"
Modelica.Blocks.Sources.RealExpression engineSpeed(y=nEng)
Modelica.Blocks.Sources.RealExpression fuelPower(y=P_Fue)
Modelica.Blocks.Sources.RealExpression thermalPower(y=Q_therm)
Modelica.Blocks.Sources.RealExpression outputTorque(y=Mmot)
Modelica.Blocks.Sources.RealExpression airFlow(y=m_flow_Fue)
Modelica.Blocks.Sources.RealExpression carbondioxideFlow(y=m_flow_CO2Exh)
Modelica.Blocks.Sources.RealExpression SpecificHeatCapExhGas(y=meanCpExh)
Modelica.Blocks.Sources.RealExpression fuelFlow(y=m_flow_Air)
equation
for i in 1:size(n_ComExh, 1) loop
meanCpComExh[i] = cpRefComExh[i]/(expFacCpComExh[i] + 1)/(T_Com/273.15 - 1)*(-1 + (T_Com/273.15)^(expFacCpComExh[i] + 1));
end for;
meanCpExh = sum(meanCpComExh[i]*Xi_Exh[i] for i in 1:size(n_ComExh, 1));
m_flow_Fue = modFac*m_FueEngRot*nEng*CHPEngData.i/60;
m_flow_Air = m_flow_Fue*Lambda*L_St;
// m_Exh = m_Fue + m_Air;
m_flow_CO2Exh = m_flow_Fue*(1 + Lambda*L_St)*X_CO2Exh;
H_Exh =h_Exh*m_flow_Fue*(1 + Lambda*L_St);
if inertia.w>=80 and SwitchOnOff then
Mmot = CHPEngData.i*p_me*CHPEngData.VEng/(2*Modelica.Constants.pi);
nEng = inertia.w/(2*Modelica.Constants.pi);
m_flow_Exh = m_flow_Fue + m_flow_Air;
elseif inertia.w>=80 and not
(SwitchOnOff) then
Mmot = -CHPEngData.i*p_mf*CHPEngData.VEng/(2*Modelica.Constants.pi);
nEng = inertia.w/(2*Modelica.Constants.pi);
m_flow_Exh = m_flow_Fue + m_flow_Air + 0.0001;
elseif inertia.w<80 and noEvent(inertia.w>0.1) then
Mmot = -CHPEngData.i*p_mf*CHPEngData.VEng/(2*Modelica.Constants.pi);
nEng = inertia.w/(2*Modelica.Constants.pi);
m_flow_Exh = m_flow_Fue + m_flow_Air + 0.0001;
else
Mmot = 0;
nEng = 0;
m_flow_Exh = 0.001;
end if;
CalQ_therm = P_Fue - P_eff - H_Exh;
Q_therm = if (nEng>1) and (CalQ_therm>=10) then CalQ_therm else 0;
T_Com = (H_U-(60*p_me*CHPEngData.VEng)/m_FueEngRot)/((1 + Lambda*L_St)*meanCpExh) + T_Amb;
P_eff = CHPEngData.i*nEng*p_me*CHPEngData.VEng;
/* if m_Fue>0 then
T_Com = (P_Fue - P_eff)/(m_Fue*(1 + Lambda*L_St)*meanCpExh) + T_Amb;
else
T_Com = T_Amb;
end if; */
connect(exhaustFlow.m_flow_in, massFlowExhaust.y)
connect(exhaustFlow.ports[1], port_exh)
connect(inertia.flange_b, flange_a)
connect(inertia.flange_a, engineTorque.flange)
connect(exhaustFlow.T_in, exhaustGasTemperature)
connect(engineTorque.tau, effectiveMechanicalTorque.y)
connect(engineSpeed.y, cHPEngineBus.meaRotEng)
connect(fuelPower.y, cHPEngineBus.meaFuePowEng)
connect(thermalPower.y, cHPEngineBus.meaThePowEng)
connect(SpecificHeatCapExhGas.y, cHPEngineBus.calMeaCpExh)
connect(carbondioxideFlow.y, cHPEngineBus.meaMasFloCO2Eng)
connect(airFlow.y, cHPEngineBus.meaMasFloAirEng)
connect(outputTorque.y, cHPEngineBus.meaTorEng)
connect(fuelFlow.y, cHPEngineBus.meaMasFloFueEng)
end GasolineEngineChp_EngineModel; |
Package with base classe components for AixLib.Fluid.BoilerCHP.ModularCHP | within AixLib.Fluid.BoilerCHP.ModularCHP.BaseClasses;
package BaseClassComponents "Package with base classe components for AixLib.Fluid.BoilerCHP.ModularCHP"
extends Modelica.Icons.BasesPackage
end BaseClassComponents; |
Chiller with prescribed evaporator leaving temperature and performance curve adjusted based on Carnot efficiency. This is a model of a chiller whose coefficient of performance COP changes
with temperatures in the same way as the Carnot efficiency changes.
The control input is the setpoint of the evaporator leaving temperature, which
is met exactly at steady state if the chiller has sufficient capacity. | within AixLib.Fluid.Chillers;
model Carnot_TEva
"Chiller with prescribed evaporator leaving temperature and performance curve adjusted based on Carnot efficiency"
extends AixLib.Fluid.Chillers.BaseClasses.PartialCarnot_T(
final COP_is_for_cooling = true,
final QCon_flow_nominal = -QEva_flow_nominal*(1 + COP_nominal)/COP_nominal,
PEle(y=-QEva_flow/COP),
redeclare HeatExchangers.HeaterCooler_u con(
final from_dp=from_dp1,
final dp_nominal=dp1_nominal,
final linearizeFlowResistance=linearizeFlowResistance1,
final deltaM=deltaM1,
final tau=tau1,
final T_start=T1_start,
final energyDynamics=energyDynamics,
final homotopyInitialization=homotopyInitialization,
final Q_flow_nominal=QCon_flow_nominal),
redeclare HeatExchangers.SensibleCooler_T eva(
final from_dp=from_dp2,
final dp_nominal=dp2_nominal,
final linearizeFlowResistance=linearizeFlowResistance2,
final deltaM=deltaM2,
final QMin_flow=QEva_flow_min,
final tau=tau2,
final T_start=T2_start,
final energyDynamics=energyDynamics,
final homotopyInitialization=homotopyInitialization));
parameter Modelica.Units.SI.HeatFlowRate QEva_flow_min(max=0) = -Modelica.Constants.inf
"Maximum heat flow rate for cooling (negative)";
Modelica.Blocks.Interfaces.RealInput TSet(unit="K")
"Evaporator leaving water temperature"
protected
Modelica.Blocks.Math.Gain yCon(final k=1/QCon_flow_nominal)
"Normalized condenser heat flow rate"
Modelica.Blocks.Math.Add QCon_flow_internal(final k1=-1)
"Heat added to condenser"
initial equation
assert(QEva_flow_nominal < 0, "Parameter QEva_flow_nominal must be negative.");
equation
connect(TSet, eva.TSet)
connect(eva.Q_flow, QEva_flow)
connect(QCon_flow_internal.y, yCon.u)
connect(yCon.y, con.u)
connect(QCon_flow_internal.y, QCon_flow)
connect(QCon_flow_internal.u1, eva.Q_flow)
connect(QCon_flow_internal.u2, PEle.y)
end Carnot_TEva; |
Chiller with performance curve adjusted based on Carnot efficiency. This is a model of a chiller whose coefficient of performance COP changes
with temperatures in the same way as the Carnot efficiency changes.
The input signal <i>y</i> is the control signal for the compressor. | within AixLib.Fluid.Chillers;
model Carnot_y
"Chiller with performance curve adjusted based on Carnot efficiency"
extends AixLib.Fluid.Chillers.BaseClasses.PartialCarnot_y(
final COP_is_for_cooling = true);
end Carnot_y; |
Package with chiller models | within AixLib.Fluid;
package Chillers "Package with chiller models"
extends Modelica.Icons.VariantsPackage;
end Chillers; |
= true, use homotopy method | within AixLib.Fluid.Chillers.BaseClasses;
partial model Carnot
extends AixLib.Fluid.Interfaces.PartialFourPortInterface(
m1_flow_nominal = QCon_flow_nominal/cp1_default/dTCon_nominal,
m2_flow_nominal = QEva_flow_nominal/cp2_default/dTEva_nominal);
constant Boolean homotopyInitialization = true "= true, use homotopy method"
parameter Modelica.Units.SI.HeatFlowRate QEva_flow_nominal(max=0)
"Nominal cooling heat flow rate (QEva_flow_nominal < 0)"
parameter Modelica.Units.SI.HeatFlowRate QCon_flow_nominal(min=0)
"Nominal heating flow rate"
parameter Modelica.Units.SI.TemperatureDifference dTEva_nominal(final max=0)
= -10 "Temperature difference evaporator outlet-inlet"
parameter Modelica.Units.SI.TemperatureDifference dTCon_nominal(final min=0)
= 10 "Temperature difference condenser outlet-inlet"
// Efficiency
parameter Boolean use_eta_Carnot_nominal = true
"Set to true to use Carnot effectiveness etaCarnot_nominal rather than COP_nominal"
parameter Real etaCarnot_nominal(unit="1") = 0.3
"Carnot effectiveness (=COP/COP_Carnot) used during simulation if use_eta_Carnot_nominal = true"
parameter Real COP_nominal(unit="1") = etaCarnot_nominal*TUseAct_nominal/
(TCon_nominal+TAppCon_nominal - (TEva_nominal-TAppEva_nominal))
"Coefficient of performance at TEva_nominal and TCon_nominal, used during simulation if use_eta_Carnot_nominal = false"
parameter Modelica.Units.SI.Temperature TCon_nominal=303.15
"Condenser temperature used to compute COP_nominal if use_eta_Carnot_nominal=false"
parameter Modelica.Units.SI.Temperature TEva_nominal=278.15
"Evaporator temperature used to compute COP_nominal if use_eta_Carnot_nominal=false"
parameter Real a[:] = {1}
"Coefficients for efficiency curve (need p(a=a, yPL=1)=1)"
parameter Modelica.Units.SI.Pressure dp1_nominal(displayUnit="Pa")
"Pressure difference over condenser"
parameter Modelica.Units.SI.Pressure dp2_nominal(displayUnit="Pa")
"Pressure difference over evaporator"
parameter Modelica.Units.SI.TemperatureDifference TAppCon_nominal(min=0) =
if cp1_default < 1500 then 5 else 2
"Temperature difference between refrigerant and working fluid outlet in condenser"
parameter Modelica.Units.SI.TemperatureDifference TAppEva_nominal(min=0) =
if cp2_default < 1500 then 5 else 2
"Temperature difference between refrigerant and working fluid outlet in evaporator"
parameter Boolean from_dp1=false
"= true, use m_flow = f(dp) else dp = f(m_flow)"
parameter Boolean from_dp2=false
"= true, use m_flow = f(dp) else dp = f(m_flow)"
parameter Boolean linearizeFlowResistance1=false
"= true, use linear relation between m_flow and dp for any flow rate"
parameter Boolean linearizeFlowResistance2=false
"= true, use linear relation between m_flow and dp for any flow rate"
parameter Real deltaM1(final unit="1")=0.1
"Fraction of nominal flow rate where flow transitions to laminar"
parameter Real deltaM2(final unit="1")=0.1
"Fraction of nominal flow rate where flow transitions to laminar"
parameter Modelica.Units.SI.Time tau1=60
"Time constant at nominal flow rate (used if energyDynamics1 <> Modelica.Fluid.Types.Dynamics.SteadyState)"
parameter Modelica.Units.SI.Time tau2=60
"Time constant at nominal flow rate (used if energyDynamics2 <> Modelica.Fluid.Types.Dynamics.SteadyState)"
parameter Modelica.Units.SI.Temperature T1_start=Medium1.T_default
"Initial or guess value of set point"
parameter Modelica.Units.SI.Temperature T2_start=Medium2.T_default
"Initial or guess value of set point"
parameter Modelica.Fluid.Types.Dynamics energyDynamics=
Modelica.Fluid.Types.Dynamics.SteadyState "Type of energy balance: dynamic (3 initialization options) or steady state"
Modelica.Blocks.Interfaces.RealOutput QCon_flow(
final quantity="HeatFlowRate",
final unit="W") "Actual heating heat flow rate added to fluid 1"
Modelica.Blocks.Interfaces.RealOutput P(
final quantity="Power",
final unit="W") "Electric power consumed by compressor"
Modelica.Blocks.Interfaces.RealOutput QEva_flow(
final quantity="HeatFlowRate",
final unit="W") "Actual cooling heat flow rate removed from fluid 2"
Real yPL(final unit="1", min=0) = if COP_is_for_cooling
then QEva_flow/QEva_flow_nominal
else QCon_flow/QCon_flow_nominal "Part load ratio";
Real etaPL(final unit = "1")=
if evaluate_etaPL
then AixLib.Utilities.Math.Functions.polynomial(a=a, x=yPL)
else 1
"Efficiency due to part load (etaPL(yPL=1)=1)";
Real COP(min=0, final unit="1") = etaCarnot_nominal_internal * COPCar * etaPL
"Coefficient of performance";
Real COPCar(min=0) = TUseAct/AixLib.Utilities.Math.Functions.smoothMax(
x1=1,
x2=TConAct - TEvaAct,
deltaX=0.25) "Carnot efficiency";
Modelica.Units.SI.Temperature TConAct(start=TCon_nominal + TAppCon_nominal)
= Medium1.temperature(staB1) + QCon_flow/QCon_flow_nominal*TAppCon_nominal
"Condenser temperature used to compute efficiency, taking into account pinch temperature between fluid and refrigerant";
Modelica.Units.SI.Temperature TEvaAct(start=TEva_nominal - TAppEva_nominal)
= Medium2.temperature(staB2) - QEva_flow/QEva_flow_nominal*TAppEva_nominal
"Evaporator temperature used to compute efficiency, taking into account pinch temperature between fluid and refrigerant";
protected
constant Boolean COP_is_for_cooling
"Set to true if the specified COP is for cooling";
parameter Real etaCarnot_nominal_internal(unit="1")=
if use_eta_Carnot_nominal
then etaCarnot_nominal
else COP_nominal/
(TUseAct_nominal / (TCon_nominal + TAppCon_nominal - (TEva_nominal - TAppEva_nominal)))
"Carnot effectiveness (=COP/COP_Carnot) used to compute COP";
// For Carnot_y, computing etaPL = f(yPL) introduces a nonlinear equation.
// The parameter below avoids this if a = {1}.
final parameter Boolean evaluate_etaPL=
not ((size(a, 1) == 1 and abs(a[1] - 1) < Modelica.Constants.eps))
"Flag, true if etaPL should be computed as it depends on yPL"
final parameter Modelica.Units.SI.Temperature TUseAct_nominal=if
COP_is_for_cooling then TEva_nominal - TAppEva_nominal else TCon_nominal
+ TAppCon_nominal
"Nominal evaporator temperature for chiller or condenser temperature for heat pump, taking into account pinch temperature between fluid and refrigerant";
Modelica.Units.SI.Temperature TUseAct=if COP_is_for_cooling then TEvaAct
else TConAct
"Temperature of useful heat (evaporator for chiller, condenser for heat pump), taking into account pinch temperature between fluid and refrigerant";
final parameter Modelica.Units.SI.SpecificHeatCapacity cp1_default=
Medium1.specificHeatCapacityCp(Medium1.setState_pTX(
p=Medium1.p_default,
T=Medium1.T_default,
X=Medium1.X_default))
"Specific heat capacity of medium 1 at default medium state";
final parameter Modelica.Units.SI.SpecificHeatCapacity cp2_default=
Medium2.specificHeatCapacityCp(Medium2.setState_pTX(
p=Medium2.p_default,
T=Medium2.T_default,
X=Medium2.X_default))
"Specific heat capacity of medium 2 at default medium state";
Medium1.ThermodynamicState staA1 = Medium1.setState_phX(
port_a1.p,
inStream(port_a1.h_outflow),
inStream(port_a1.Xi_outflow)) "Medium properties in port_a1";
Medium1.ThermodynamicState staB1 = Medium1.setState_phX(
port_b1.p,
port_b1.h_outflow,
port_b1.Xi_outflow) "Medium properties in port_b1";
Medium2.ThermodynamicState staA2 = Medium2.setState_phX(
port_a2.p,
inStream(port_a2.h_outflow),
inStream(port_a2.Xi_outflow)) "Medium properties in port_a2";
Medium2.ThermodynamicState staB2 = Medium2.setState_phX(
port_b2.p,
port_b2.h_outflow,
port_b2.Xi_outflow) "Medium properties in port_b2";
replaceable Interfaces.PartialTwoPortInterface con
constrainedby Interfaces.PartialTwoPortInterface(
redeclare final package Medium = Medium1,
final allowFlowReversal=allowFlowReversal1,
final m_flow_nominal=m1_flow_nominal,
final m_flow_small=m1_flow_small,
final show_T=false) "Condenser"
replaceable Interfaces.PartialTwoPortInterface eva
constrainedby Interfaces.PartialTwoPortInterface(
redeclare final package Medium = Medium2,
final allowFlowReversal=allowFlowReversal2,
final m_flow_nominal=m2_flow_nominal,
final m_flow_small=m2_flow_small,
final show_T=false) "Evaporator"
initial equation
assert(dTEva_nominal < 0,
"Parameter dTEva_nominal must be negative.");
assert(dTCon_nominal > 0,
"Parameter dTCon_nominal must be positive.");
assert(abs(AixLib.Utilities.Math.Functions.polynomial(
a=a, x=1)-1) < 0.01, "Efficiency curve is wrong. Need etaPL(y=1)=1.");
assert(etaCarnot_nominal_internal < 1, "Parameters lead to etaCarnot_nominal > 1. Check parameters.");
assert(homotopyInitialization, "In " + getInstanceName() +
": The constant homotopyInitialization has been modified from its default value. This constant will be removed in future releases.",
level = AssertionLevel.warning);
equation
connect(port_a2, eva.port_a)
connect(eva.port_b, port_b2)
connect(port_a1, con.port_a)
connect(con.port_b, port_b1)
end Carnot; |
Package with base classes for AixLib.Fluid.Chillers | within AixLib.Fluid.Chillers;
package BaseClasses "Package with base classes for AixLib.Fluid.Chillers"
extends Modelica.Icons.BasesPackage;
end BaseClasses; |
Partial model for chiller with performance curve adjusted based on Carnot efficiency. This is a partial model of a chiller whose coefficient of performance (COP) changes
with temperatures in the same way as the Carnot efficiency changes.
This base class is used for the Carnot chiller and Carnot heat pump
that uses the compressor part load ratio as the control signal. | within AixLib.Fluid.Chillers.BaseClasses;
partial model PartialCarnot_T
"Partial model for chiller with performance curve adjusted based on Carnot efficiency"
extends AixLib.Fluid.Chillers.BaseClasses.Carnot;
protected
Modelica.Blocks.Sources.RealExpression PEle "Electrical power consumption"
equation
connect(PEle.y, P)
end PartialCarnot_T; |
Partial chiller model with performance curve adjusted based on Carnot efficiency. This is a partial model of a chiller whose coefficient of performance (COP) changes
with temperatures in the same way as the Carnot efficiency changes.
This base class is used for the Carnot chiller and Carnot heat pump
that uses the leaving fluid temperature as the control signal. | within AixLib.Fluid.Chillers.BaseClasses;
partial model PartialCarnot_y
"Partial chiller model with performance curve adjusted based on Carnot efficiency"
extends Carnot(
final QCon_flow_nominal= P_nominal - QEva_flow_nominal,
final QEva_flow_nominal = if COP_is_for_cooling
then -P_nominal * COP_nominal
else -P_nominal * (COP_nominal-1),
redeclare HeatExchangers.HeaterCooler_u con(
final from_dp=from_dp1,
final dp_nominal=dp1_nominal,
final linearizeFlowResistance=linearizeFlowResistance1,
final deltaM=deltaM1,
final tau=tau1,
final T_start=T1_start,
final energyDynamics=energyDynamics,
final homotopyInitialization=homotopyInitialization,
final Q_flow_nominal=QCon_flow_nominal),
redeclare HeatExchangers.HeaterCooler_u eva(
final from_dp=from_dp2,
final dp_nominal=dp2_nominal,
final linearizeFlowResistance=linearizeFlowResistance2,
final deltaM=deltaM2,
final tau=tau2,
final T_start=T2_start,
final energyDynamics=energyDynamics,
final homotopyInitialization=homotopyInitialization,
final Q_flow_nominal=QEva_flow_nominal));
parameter Modelica.Units.SI.Power P_nominal(min=0)
"Nominal compressor power (at y=1)"
Modelica.Blocks.Interfaces.RealInput y(min=0, max=1, unit="1")
"Part load ratio of compressor"
protected
Modelica.Units.SI.HeatFlowRate QCon_flow_internal(start=QCon_flow_nominal) =
P - QEva_flow_internal "Condenser heat input";
Modelica.Units.SI.HeatFlowRate QEva_flow_internal(start=QEva_flow_nominal) =
if COP_is_for_cooling then -COP*P else (1 - COP)*P "Evaporator heat input";
Modelica.Blocks.Sources.RealExpression yEva_flow_in(
y=QEva_flow_internal/QEva_flow_nominal)
"Normalized evaporator heat flow rate"
Modelica.Blocks.Sources.RealExpression yCon_flow_in(
y=QCon_flow_internal/QCon_flow_nominal)
"Normalized condenser heat flow rate"
Modelica.Blocks.Math.Gain PEle(final k=P_nominal)
"Electrical power consumption"
equation
connect(PEle.y, P)
connect(PEle.u, y)
connect(yEva_flow_in.y, eva.u)
connect(yCon_flow_in.y, con.u)
connect(con.Q_flow, QCon_flow)
connect(eva.Q_flow, QEva_flow)
end PartialCarnot_y; |
Test model for chiller based on Carnot efficiency and evaporator outlet temperature control signal | within AixLib.Fluid.Chillers.Examples;
model Carnot_TEva
"Test model for chiller based on Carnot efficiency and evaporator outlet temperature control signal"
extends Modelica.Icons.Example;
package Medium1 = AixLib.Media.Water "Medium model";
package Medium2 = AixLib.Media.Water "Medium model";
parameter Modelica.Units.SI.TemperatureDifference dTEva_nominal=-10
"Temperature difference evaporator outlet-inlet";
parameter Modelica.Units.SI.TemperatureDifference dTCon_nominal=10
"Temperature difference condenser outlet-inlet";
parameter Real COPc_nominal = 3 "Chiller COP";
parameter Modelica.Units.SI.HeatFlowRate QEva_flow_nominal=-100E3
"Evaporator heat flow rate";
parameter Modelica.Units.SI.MassFlowRate m2_flow_nominal=QEva_flow_nominal/
dTEva_nominal/4200 "Nominal mass flow rate at chilled water side";
AixLib.Fluid.Chillers.Carnot_TEva chi(
redeclare package Medium1 = Medium1,
redeclare package Medium2 = Medium2,
dTEva_nominal=dTEva_nominal,
dTCon_nominal=dTCon_nominal,
m2_flow_nominal=m2_flow_nominal,
show_T=true,
QEva_flow_nominal=QEva_flow_nominal,
allowFlowReversal1=false,
allowFlowReversal2=false,
use_eta_Carnot_nominal=true,
dp1_nominal=6000,
dp2_nominal=6000) "Chiller model"
AixLib.Fluid.Sources.MassFlowSource_T sou1(nPorts=1,
redeclare package Medium = Medium1,
use_T_in=false,
use_m_flow_in=true,
T=298.15)
AixLib.Fluid.Sources.MassFlowSource_T sou2(nPorts=1,
redeclare package Medium = Medium2,
m_flow=m2_flow_nominal,
use_T_in=false,
T=295.15)
AixLib.Fluid.Sources.Boundary_pT sin1(
redeclare package Medium = Medium1,
nPorts=1)
AixLib.Fluid.Sources.Boundary_pT sin2(nPorts=1,
redeclare package Medium = Medium2)
Modelica.Blocks.Sources.Ramp TEvaLvg(
duration=60,
startTime=1800,
offset=273.15 + 6,
height=10) "Control signal for evaporator leaving temperature"
Modelica.Blocks.Math.Gain mCon_flow(k=-1/cp1_default/dTEva_nominal)
"Condenser mass flow rate"
Modelica.Blocks.Math.Add QCon_flow(k2=-1) "Condenser heat flow rate"
final parameter Modelica.Units.SI.SpecificHeatCapacity cp1_default=
Medium1.specificHeatCapacityCp(Medium1.setState_pTX(
Medium1.p_default,
Medium1.T_default,
Medium1.X_default))
"Specific heat capacity of medium 1 at default medium state";
equation
connect(sou1.ports[1], chi.port_a1)
connect(sou2.ports[1], chi.port_a2)
connect(sin2.ports[1], chi.port_b2)
connect(TEvaLvg.y, chi.TSet)
connect(chi.P, QCon_flow.u1)
connect(chi.QEva_flow, QCon_flow.u2)
connect(QCon_flow.y, mCon_flow.u)
connect(mCon_flow.y, sou1.m_flow_in)
connect(chi.port_b1, sin1.ports[1])
end Carnot_TEva; |
Test model for chiller based on Carnot_y efficiency | within AixLib.Fluid.Chillers.Examples;
model Carnot_y "Test model for chiller based on Carnot_y efficiency"
extends Modelica.Icons.Example;
package Medium1 = AixLib.Media.Water "Medium model";
package Medium2 = AixLib.Media.Water "Medium model";
parameter Modelica.Units.SI.Power P_nominal=10E3
"Nominal compressor power (at y=1)";
parameter Modelica.Units.SI.TemperatureDifference dTEva_nominal=-10
"Temperature difference evaporator outlet-inlet";
parameter Modelica.Units.SI.TemperatureDifference dTCon_nominal=10
"Temperature difference condenser outlet-inlet";
parameter Real COPc_nominal = 3 "Chiller COP";
parameter Modelica.Units.SI.MassFlowRate m2_flow_nominal=-P_nominal*
COPc_nominal/dTEva_nominal/4200
"Nominal mass flow rate at chilled water side";
parameter Modelica.Units.SI.MassFlowRate m1_flow_nominal=m2_flow_nominal*(
COPc_nominal + 1)/COPc_nominal
"Nominal mass flow rate at condenser water wide";
AixLib.Fluid.Chillers.Carnot_y chi(
redeclare package Medium1 = Medium1,
redeclare package Medium2 = Medium2,
P_nominal=P_nominal,
dTEva_nominal=dTEva_nominal,
dTCon_nominal=dTCon_nominal,
use_eta_Carnot_nominal=true,
dp1_nominal=6000,
dp2_nominal=6000,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
show_T=true,
T1_start=303.15,
T2_start=278.15) "Chiller model"
AixLib.Fluid.Sources.MassFlowSource_T sou1(nPorts=1,
redeclare package Medium = Medium1,
use_T_in=true,
m_flow=m1_flow_nominal,
T=298.15)
AixLib.Fluid.Sources.MassFlowSource_T sou2(nPorts=1,
redeclare package Medium = Medium2,
use_T_in=true,
m_flow=m2_flow_nominal,
T=291.15)
AixLib.Fluid.Sources.Boundary_pT sin1(
nPorts=1,
redeclare package Medium = Medium1)
AixLib.Fluid.Sources.Boundary_pT sin2(
nPorts=1,
redeclare package Medium = Medium2)
Modelica.Blocks.Sources.Ramp uCom(
height=-1,
duration=60,
offset=1,
startTime=1800) "Compressor control signal"
Modelica.Blocks.Sources.Ramp TCon_in(
height=10,
duration=60,
offset=273.15 + 20,
startTime=60) "Condenser inlet temperature"
Modelica.Blocks.Sources.Ramp TEva_in(
height=10,
duration=60,
startTime=900,
offset=273.15 + 15) "Evaporator inlet temperature"
equation
connect(sou1.ports[1], chi.port_a1)
connect(sou2.ports[1], chi.port_a2)
connect(chi.port_b1, sin1.ports[1])
connect(sin2.ports[1], chi.port_b2)
connect(TCon_in.y, sou1.T_in)
connect(TEva_in.y, sou2.T_in)
connect(uCom.y, chi.y)
end Carnot_y; |
Collection of models that illustrate model use and test models | within AixLib.Fluid.Chillers;
package Examples "Collection of models that illustrate model use and test models"
extends Modelica.Icons.ExamplesPackage;
end Examples; |
Reversible chiller using Carnot approach with losses (frost, heat, inertia). Model of a reversible chiller. | within AixLib.Fluid.Chillers.ModularReversible;
model CarnotWithLosses
"Reversible chiller using Carnot approach with losses (frost, heat, inertia)"
extends AixLib.Fluid.Chillers.ModularReversible.Modular(
QHea_flow_nominal=PEle_nominal*refCyc.refCycChiHea.COP_nominal,
redeclare model RefrigerantCycleChillerHeating =
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.ConstantCarnotEffectiveness
(
PEle_nominal=PEle_nominal,
redeclare
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.Frosting.NoFrosting
iceFacCal,
etaCarnot_nominal=etaCarnot_nominal,
use_constAppTem=true,
TAppCon_nominal=TAppCon_nominal,
TAppEva_nominal=TAppEva_nominal),
redeclare model RefrigerantCycleChillerCooling =
AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.ConstantCarnotEffectiveness
(
redeclare
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.Frosting.FunctionalIcingFactor
iceFacCal(redeclare function icingFactor =
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.Frosting.Functions.wetterAfjei1997),
TAppCon_nominal=TAppCon_nominal,
TAppEva_nominal=TAppEva_nominal,
etaCarnot_nominal=etaCarnot_nominal),
final allowDifferentDeviceIdentifiers=false,
redeclare model RefrigerantCycleInertia =
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.Inertias.VariableOrder
(
final refIneFreConst=1/refIneTimCon,
final nthOrd=1,
initType=Modelica.Blocks.Types.Init.InitialOutput));
parameter Real etaCarnot_nominal=0.3 "Constant Carnot effectiveness";
parameter Modelica.Units.SI.TemperatureDifference TAppCon_nominal=if
cpCon < 1500 then 5 else 2
"Temperature difference between refrigerant and working fluid outlet in condenser"
parameter Modelica.Units.SI.TemperatureDifference TAppEva_nominal=if
cpEva < 1500 then 5 else 2
"Temperature difference between refrigerant and working fluid outlet in evaporator"
parameter Modelica.Units.SI.Time refIneTimCon = 300
"Refrigerant cycle inertia time constant for first order delay"
parameter Integer nthOrd=1 "Order of refrigerant cycle interia"
end CarnotWithLosses; |
Large scale water to water chiller | within AixLib.Fluid.Chillers.ModularReversible;
model LargeScaleWaterToWater "Large scale water to water chiller"
extends Modular(
dpEva_nominal=datTab.dpEva_nominal*scaFac^2,
dpCon_nominal=datTab.dpCon_nominal*scaFac^2,
final dTEva_nominal=-QCoo_flow_nominal/cpEva/mEva_flow_nominal,
final dTCon_nominal=(PEle_nominal - QCoo_flow_nominal)/cpCon/mCon_flow_nominal,
redeclare replaceable package MediumCon = AixLib.Media.Water,
redeclare replaceable package MediumEva = AixLib.Media.Water,
final GEvaIns=0,
final GEvaOut=0,
final CEva=0,
final use_evaCap=false,
final GConIns=0,
final GConOut=0,
final CCon=0,
final TConHea_nominal=0,
final TEvaHea_nominal=0,
final use_conCap=false,
redeclare replaceable
AixLib.Fluid.HeatPumps.ModularReversible.Controls.Safety.Data.Wuellhorst2021 safCtrPar
constrainedby
AixLib.Fluid.HeatPumps.ModularReversible.Controls.Safety.Data.Generic(
final tabUppHea=datTab.tabLowBou,
final tabLowCoo=datTab.tabLowBou,
final use_TEvaOutCoo=datTab.use_TEvaOutForOpeEnv,
final use_TConOutCoo=datTab.use_TConOutForOpeEnv),
redeclare model RefrigerantCycleInertia =
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.Inertias.NoInertia,
redeclare model RefrigerantCycleChillerHeating =
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.NoHeating,
redeclare model RefrigerantCycleChillerCooling =
AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.TableData2D (
redeclare
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.Frosting.NoFrosting
iceFacCal, datTab=datTab),
final use_rev=false,
final QHea_flow_nominal=0,
final mCon_flow_nominal=autCalMasCon_flow,
final mEva_flow_nominal=autCalMasEva_flow,
final tauCon=autCalVCon*rhoCon/autCalMasCon_flow,
final tauEva=autCalVEva*rhoEva/autCalMasEva_flow);
final parameter Real scaFac=refCyc.refCycChiCoo.scaFac "Scaling factor of chiller";
extends AixLib.Fluid.HeatPumps.ModularReversible.BaseClasses.LargeScaleWaterToWaterDeclarations(
final autCalMasCon_flow=max(5E-5*abs(QCoo_flow_nominal) + 0.3161, autCalMMin_flow),
final autCalMasEva_flow=max(5E-5*abs(QCoo_flow_nominal) - 0.5662, autCalMMin_flow),
final autCalVCon=max(2E-7*abs(QCoo_flow_nominal) - 84E-4, autCalVMin),
final autCalVEva=max(1E-7*abs(QCoo_flow_nominal) - 66E-4, autCalVMin));
replaceable parameter
AixLib.Fluid.Chillers.ModularReversible.Data.TableData2D.Generic
datTab constrainedby Data.TableData2D.Generic "Data Table of Chiller"
end LargeScaleWaterToWater; |
Grey-box model for reversible and non-reversible chillers. Model of a reversible, modular chiller.
This models allows combining any of the available modules
for refrigerant heating or cooling cycles, inertias,
heat losses, and safety controls.
All features are optional. | within AixLib.Fluid.Chillers.ModularReversible;
model Modular
"Grey-box model for reversible and non-reversible chillers"
extends
AixLib.Fluid.HeatPumps.ModularReversible.BaseClasses.PartialReversibleRefrigerantMachine(
final use_COP=use_rev,
final use_EER=true,
con(preDro(m_flow(nominal=-QCoo_flow_nominal/1000/10))),
eva(preDro(m_flow(nominal=-QCoo_flow_nominal/1000/10))),
safCtr(redeclare
AixLib.Fluid.Chillers.ModularReversible.Controls.Safety.OperationalEnvelope
opeEnv),
final PEle_nominal=refCyc.refCycChiCoo.PEle_nominal,
mEva_flow_nominal=-QCoo_flow_nominal/(dTEva_nominal*cpEva),
mCon_flow_nominal=(PEle_nominal - QCoo_flow_nominal)/(dTCon_nominal*cpCon),
use_rev=false,
redeclare final AixLib.Fluid.Chillers.ModularReversible.BaseClasses.RefrigerantCycle refCyc(
redeclare model RefrigerantCycleChillerCooling = RefrigerantCycleChillerCooling,
redeclare model RefrigerantCycleChillerHeating = RefrigerantCycleChillerHeating,
final allowDifferentDeviceIdentifiers=allowDifferentDeviceIdentifiers));
parameter Modelica.Units.SI.HeatFlowRate QCoo_flow_nominal(max=0)
"Nominal cooling capcaity"
parameter Modelica.Units.SI.HeatFlowRate QHea_flow_nominal=0
"Nominal heating capacity"
replaceable model RefrigerantCycleChillerCooling =
AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses.PartialChillerCycle
(PEle_nominal=0)
constrainedby
AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses.PartialChillerCycle(
final useInChi=true,
final TCon_nominal=TConCoo_nominal,
final TEva_nominal=TEvaCoo_nominal,
final QCoo_flow_nominal=QCoo_flow_nominal,
final cpCon=cpCon,
final cpEva=cpEva)
"Refrigerant cycle module for the cooling mode"
replaceable model RefrigerantCycleChillerHeating =
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.NoHeating
(PEle_nominal=PEle_nominal)
constrainedby
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.PartialHeatPumpCycle(
final useInHeaPum=false,
final TCon_nominal=TEvaHea_nominal,
final TEva_nominal=TConHea_nominal,
final QHea_flow_nominal=QHea_flow_nominal,
final cpCon=cpCon,
final cpEva=cpEva)
"Refrigerant cycle module for the heating mode"
parameter Modelica.Units.SI.Temperature TEvaCoo_nominal
"Nominal temperature of the cooled fluid"
parameter Modelica.Units.SI.Temperature TConCoo_nominal
"Nominal temperature of the heated fluid"
parameter Modelica.Units.SI.Temperature TEvaHea_nominal
"Nominal temperature of the heated fluid"
parameter Modelica.Units.SI.Temperature TConHea_nominal
"Nominal temperature of the cooled fluid"
Modelica.Blocks.Interfaces.BooleanInput coo if not use_busConOnl and use_rev
"=true for cooling, =false for heating"
Modelica.Blocks.Sources.BooleanConstant conCoo(final k=true)
if not use_busConOnl and not use_rev
"Locks the device in cooling mode if designated to be not reversible"
Modelica.Blocks.Logical.Not notCoo "Not cooling is heating"
equation
connect(conCoo.y, sigBus.coo)
connect(coo, sigBus.coo)
connect(eff.QUse_flow, refCycIneEva.y)
connect(eff.hea, notCoo.y)
connect(notCoo.u, sigBus.coo)
end Modular; |
Package for reversible and non-reversible chillers using a modular model approach | within AixLib.Fluid.Chillers;
package ModularReversible "Package for reversible and non-reversible chillers using a modular model approach"
extends Modelica.Icons.VariantsPackage;
end ModularReversible; |
User's Guide for modular reversible heat pump and chiller models | within AixLib.Fluid.Chillers.ModularReversible;
package UsersGuide
"User's Guide for modular reversible heat pump and chiller models"
extends Modelica.Icons.Information;
end UsersGuide; |
Package with base classes for AixLib.Fluid.Chillers.ModularReversible | within AixLib.Fluid.Chillers.ModularReversible;
package BaseClasses "Package with base classes for AixLib.Fluid.Chillers.ModularReversible"
extends Modelica.Icons.BasesPackage;
end BaseClasses; |
Refrigerant cycle model of a chiller. Modular refrigerant cycle model for chiller applications used in
the model <a href=\"modelica://AixLib.Fluid.Chillers.ModularReversible.Modular\">
AixLib.Fluid.Chillers.ModularReversible.Modular</a> and extending models
of the modular approach. | within AixLib.Fluid.Chillers.ModularReversible.BaseClasses;
model RefrigerantCycle "Refrigerant cycle model of a chiller"
extends AixLib.Fluid.HeatPumps.ModularReversible.BaseClasses.PartialModularRefrigerantCycle;
parameter Boolean allowDifferentDeviceIdentifiers=false
"if use_rev=true, device data for cooling and heating need to entered. Set allowDifferentDeviceIdentifiers=true to allow different device identifiers devIde"
replaceable model RefrigerantCycleChillerCooling =
AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses.NoCooling(
useInChi=true)
constrainedby
AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses.PartialChillerCycle
"Replaceable model for refrigerant cycle of a chiller in main operation mode"
replaceable model RefrigerantCycleChillerHeating =
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.NoHeating(
useInHeaPum=true)
constrainedby
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.PartialHeatPumpCycle
"Replaceable model for refrigerant cycle of a chiller in reversed operation mode"
RefrigerantCycleChillerCooling refCycChiCoo
"Refrigerant cycle instance for cooling"
RefrigerantCycleChillerHeating refCycChiHea
"Refrigerant cycle instance for heating"
protected
parameter String devIde =
if use_rev then refCycChiHea.devIde else refCycChiCoo.devIde
"Data source for refrigerant cycle";
initial algorithm
if not allowDifferentDeviceIdentifiers then
assert(
devIde == refCycChiCoo.devIde,
"In " + getInstanceName() + ": Device identifiers devIde for reversible operation are not equal.
Cooling device identifier is '" + refCycChiCoo.devIde + "' but heating is '"
+ devIde + "'. To allow this, set 'allowDifferentDeviceIdentifiers=true'.",
AssertionLevel.error);
end if;
equation
connect(pasTrhModSet.u, sigBus.coo);
connect(sigBus,refCycChiHea.sigBus)
connect(sigBus,refCycChiCoo.sigBus)
connect(swiPEle.u2, sigBus.coo)
connect(swiQEva.u2, sigBus.coo)
connect(swiQCon.u2, sigBus.coo)
connect(refCycChiCoo.QEva_flow, swiQEva.u1)
connect(refCycChiCoo.QCon_flow, swiQCon.u1)
connect(refCycChiCoo.PEle, swiPEle.u1)
connect(refCycChiHea.PEle, swiPEle.u3)
connect(refCycChiHea.QCon_flow, swiQEva.u3)
connect(refCycChiHea.QEva_flow, swiQCon.u3)
end RefrigerantCycle; |
Package of control sequences | within AixLib.Fluid.Chillers.ModularReversible;
package Controls "Package of control sequences"
extends Modelica.Icons.Package;
end Controls; |
Indicates if the chiller operation is within a defined envelope. Model to check if the operating conditions of a chiller are inside
the given boundaries. If not, the heat pump or chiller will switch off. | within AixLib.Fluid.Chillers.ModularReversible.Controls.Safety;
model OperationalEnvelope
"Indicates if the chiller operation is within a defined envelope"
extends
HeatPumps.ModularReversible.Controls.Safety.BaseClasses.PartialOperationalEnvelope;
Modelica.Blocks.Logical.Not notCoo "=true for heating"
equation
if use_TEvaOutHea then
connect(bouMapHea.TUseSid, sigBus.TEvaOutMea)
else
connect(bouMapHea.TUseSid, sigBus.TEvaInMea)
end if;
if use_TConOutCoo then
connect(bouMapCoo.TAmbSid, sigBus.TConOutMea)
else
connect(bouMapCoo.TAmbSid, sigBus.TConInMea)
end if;
if use_TConOutHea then
connect(bouMapHea.TAmbSid, sigBus.TConOutMea)
else
connect(bouMapHea.TAmbSid, sigBus.TConInMea)
end if;
if use_TEvaOutCoo then
connect(bouMapCoo.TUseSid, sigBus.TEvaOutMea)
else
connect(bouMapCoo.TUseSid, sigBus.TEvaInMea)
end if;
connect(notCoo.y, swiHeaCoo.u2)
connect(notCoo.u, sigBus.coo)
end OperationalEnvelope; |
Contains typical safety controllers for chillers | within AixLib.Fluid.Chillers.ModularReversible.Controls;
package Safety "Contains typical safety controllers for chillers"
extends Modelica.Icons.Package;
end Safety; |
Package for data records | within AixLib.Fluid.Chillers.ModularReversible;
package Data "Package for data records"
extends Modelica.Icons.MaterialPropertiesPackage;
end Data; |
Package with two-dimensional data | within AixLib.Fluid.Chillers.ModularReversible.Data;
package TableData2D "Package with two-dimensional data"
extends Modelica.Icons.MaterialPropertiesPackage;
end TableData2D; |
Package for EN15411 data records | within AixLib.Fluid.Chillers.ModularReversible.Data.TableData2D;
package EN14511 "Package for EN15411 data records"
end EN14511; |
A2W Vitocal 251 by Viessmann. Data from the planning book (Planungshandbuch) from Viessmann. | within AixLib.Fluid.Chillers.ModularReversible.Data.TableData2D.EN14511;
record Vitocal251A08 "A2W Vitocal 251 by Viessmann"
extends AixLib.Fluid.Chillers.ModularReversible.Data.TableData2D.Generic(
tabLowBou=[283.15,280.15; 318.15,280.15],
dpEva_nominal=0,
dpCon_nominal=0,
use_TConOutForOpeEnv=false,
use_TEvaOutForOpeEnv=true,
tabQEva_flow=[
0, 293.15, 298.15, 300.15, 303.15, 308.15, 313.15, 318.15;
280.15, -8500, -7800, -7000, -6000, -4500, -3100, -1900;
291.15, -10300, -9900, -9700, -9300, -6900, -3400, -2800],
tabPEle=[
0, 293.15, 298.15, 300.15, 303.15, 308.15, 313.15, 318.15;
280.15, 1735, 1902, 1842, 1765, 1607, 1348, 1056;
291.15, 1493, 1707, 1764, 1860, 1725, 1259, 1037],
mEva_flow_nominal=5600/5/4184,
mCon_flow_nominal=2125/3600/1.204,
use_TConOutForTab=false,
use_TEvaOutForTab=true,
devIde="Vitocal251A08");
end Vitocal251A08; |
Example for reversible Carnot chiller model | within AixLib.Fluid.Chillers.ModularReversible.Examples;
model CarnotWithLosses
"Example for reversible Carnot chiller model"
extends Modelica.Icons.Example;
package MediumCon = AixLib.Media.Water "Medium model for condenser";
package MediumEva = AixLib.Media.Water "Medium model for evaporator";
AixLib.Fluid.Chillers.ModularReversible.CarnotWithLosses chi(
redeclare package MediumCon = MediumCon,
redeclare package MediumEva = MediumEva,
QCoo_flow_nominal=-30000,
redeclare
AixLib.Fluid.HeatPumps.ModularReversible.Controls.Safety.Data.Wuellhorst2021
safCtrPar(
minOffTime=100,
use_maxCycRat=false,
tabUppHea=[263.15,313.15; 333.15,313.15],
tabLowCoo=[263.15,283.15; 333.15,283.15],
use_TEvaOutCoo=true),
TConCoo_nominal=313.15,
dpCon_nominal(displayUnit="Pa") = 6000,
use_conCap=false,
CCon=0,
GConOut=0,
GConIns=0,
TEvaCoo_nominal=278.15,
dTEva_nominal(displayUnit="K") = 10,
dTCon_nominal(displayUnit="K") = 5,
dpEva_nominal(displayUnit="Pa") = 6000,
use_evaCap=false,
CEva=0,
GEvaOut=0,
GEvaIns=0,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
show_T=true,
QHea_flow_nominal=40000,
TConHea_nominal=293.15,
TEvaHea_nominal=303.15)
"Chiller instance with reversbile Carnot approach"
AixLib.Fluid.Sources.MassFlowSource_T souCon(
nPorts=1,
redeclare package Medium = MediumCon,
use_T_in=true,
m_flow=chi.mCon_flow_nominal,
T=298.15) "Condenser source"
AixLib.Fluid.Sources.MassFlowSource_T souEva(
nPorts=1,
redeclare package Medium = MediumEva,
use_T_in=true,
m_flow=chi.mEva_flow_nominal,
T=291.15) "Evaporator source"
AixLib.Fluid.Sources.Boundary_pT sinCon(nPorts=1, redeclare package Medium =
MediumCon) "Condenser sink"
AixLib.Fluid.Sources.Boundary_pT sinEva(nPorts=1, redeclare package Medium =
MediumEva) "Evaporator sink"
Modelica.Blocks.Sources.SawTooth ySet(
amplitude=-1,
period=500,
offset=1,
startTime=500) "Compressor control signal"
Modelica.Blocks.Sources.Ramp TConIn(
height=10,
duration=60,
offset=273.15 + 30,
startTime=60) "Condenser inlet temperature"
Modelica.Blocks.Sources.Ramp TEvaIn(
height=10,
duration=60,
startTime=900,
offset=273.15 + 15) "Evaporator inlet temperature"
equation
connect(souCon.ports[1], chi.port_a1)
connect(souEva.ports[1], chi.port_a2)
connect(chi.port_b1, sinCon.ports[1])
connect(sinEva.ports[1], chi.port_b2)
connect(TConIn.y, souCon.T_in)
connect(TEvaIn.y, souEva.T_in)
connect(ySet.y, chi.ySet)
end CarnotWithLosses; |
Example for large scale water to water chiller | within AixLib.Fluid.Chillers.ModularReversible.Examples;
model LargeScaleWaterToWater
"Example for large scale water to water chiller"
extends Modelica.Icons.Example;
package MediumCon = AixLib.Media.Water "Medium model for condenser";
package MediumEva = AixLib.Media.Water "Medium model for evaporator";
AixLib.Fluid.Chillers.ModularReversible.LargeScaleWaterToWater chi(
redeclare
AixLib.Fluid.Chillers.ModularReversible.Data.TableData2D.EN14511.Carrier30XWP1012_1MW
datTab,
redeclare AixLib.Fluid.HeatPumps.ModularReversible.Controls.Safety.Data.Wuellhorst2021
safCtrPar,
redeclare package MediumCon = MediumCon,
redeclare package MediumEva = MediumEva,
QCoo_flow_nominal=-1000000,
TConCoo_nominal=313.15,
dpCon_nominal(displayUnit="Pa") = 6000,
TEvaCoo_nominal=278.15,
dpEva_nominal(displayUnit="Pa") = 6000,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
"Large scale water to water chiller"
AixLib.Fluid.Sources.MassFlowSource_T souCon(
nPorts=1,
redeclare package Medium = MediumCon,
use_T_in=true,
m_flow=chi.mCon_flow_nominal,
T=298.15) "Condenser source"
AixLib.Fluid.Sources.MassFlowSource_T souEva(
nPorts=1,
redeclare package Medium = MediumEva,
use_T_in=true,
m_flow=chi.mEva_flow_nominal,
T=291.15) "Evaporator source"
AixLib.Fluid.Sources.Boundary_pT sinCon(nPorts=1, redeclare package Medium =
MediumCon) "Condenser sink"
AixLib.Fluid.Sources.Boundary_pT sinEva(nPorts=1, redeclare package Medium =
MediumEva) "Evaporator sink"
Modelica.Blocks.Sources.Ramp ySet(
height=-1,
duration=900,
offset=1,
startTime=1800) "Compressor control signal"
Modelica.Blocks.Sources.Ramp TConIn(
height=10,
duration=60,
offset=273.15 + 30,
startTime=60) "Condenser inlet temperature"
Modelica.Blocks.Sources.Ramp TEvaIn(
height=10,
duration=60,
startTime=900,
offset=273.15 + 15) "Evaporator inlet temperature"
equation
connect(souCon.ports[1], chi.port_a1)
connect(souEva.ports[1], chi.port_a2)
connect(chi.port_b1, sinCon.ports[1])
connect(sinEva.ports[1], chi.port_b2)
connect(TConIn.y, souCon.T_in)
connect(TEvaIn.y, souEva.T_in)
connect(ySet.y, chi.ySet)
end LargeScaleWaterToWater; |
Example for modular reversible chiller | within AixLib.Fluid.Chillers.ModularReversible.Examples;
model Modular
"Example for modular reversible chiller"
extends Modelica.Icons.Example;
package MediumCon = AixLib.Media.Air "Medium model for condenser";
package MediumEva = AixLib.Media.Water "Medium model for evaporator";
AixLib.Fluid.Chillers.ModularReversible.Modular chi(
redeclare package MediumCon = MediumCon,
redeclare package MediumEva = MediumEva,
use_rev=true,
allowDifferentDeviceIdentifiers=true,
QCoo_flow_nominal=-30000,
redeclare model RefrigerantCycleInertia =
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.Inertias.VariableOrder
(
refIneFreConst=1/300,
nthOrd=1,
initType=Modelica.Blocks.Types.Init.InitialState),
redeclare
AixLib.Fluid.HeatPumps.ModularReversible.Controls.Safety.Data.Wuellhorst2021
safCtrPar(minOffTime=100, use_opeEnv=false),
TConCoo_nominal=313.15,
dpCon_nominal(displayUnit="Pa") = 6000,
use_conCap=false,
CCon=0,
GConOut=0,
GConIns=0,
TEvaCoo_nominal=278.15,
dTEva_nominal=5,
dTCon_nominal=5,
dpEva_nominal(displayUnit="Pa") = 6000,
use_evaCap=false,
CEva=0,
GEvaOut=0,
GEvaIns=0,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
show_T=true,
QHea_flow_nominal=30000,
redeclare model RefrigerantCycleChillerCooling =
AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.ConstantCarnotEffectiveness
(etaCarnot_nominal=0.35),
redeclare model RefrigerantCycleChillerHeating =
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.TableData2D (
redeclare
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.Frosting.NoFrosting
iceFacCal, datTab=
AixLib.Fluid.HeatPumps.ModularReversible.Data.TableData2D.EN14511.Vitocal251A08()),
TEvaHea_nominal=303.15,
TConHea_nominal=298.15)
"Modular reversible chiller instance"
AixLib.Fluid.Sources.MassFlowSource_T souCon(
nPorts=1,
redeclare package Medium = MediumCon,
use_T_in=true,
m_flow=chi.mCon_flow_nominal,
T=298.15) "Condenser source"
AixLib.Fluid.Sources.MassFlowSource_T souEva(
nPorts=1,
redeclare package Medium = MediumEva,
use_T_in=true,
m_flow=chi.mEva_flow_nominal,
T=291.15) "Evaporator source"
AixLib.Fluid.Sources.Boundary_pT sinCon(nPorts=1, redeclare package Medium =
MediumCon) "Condenser sink"
AixLib.Fluid.Sources.Boundary_pT sinEva(nPorts=1, redeclare package Medium =
MediumEva) "Evaporator sink"
Modelica.Blocks.Sources.SawTooth ySet(
amplitude=-1,
period=500,
offset=1,
startTime=500) "Compressor control signal"
Modelica.Blocks.Sources.Ramp TConIn(
height=10,
duration=60,
offset=273.15 + 30,
startTime=60) "Condenser inlet temperature"
Modelica.Blocks.Sources.Ramp TEvaIn(
height=10,
duration=60,
startTime=900,
offset=273.15 + 15) "Evaporator inlet temperature"
Modelica.Blocks.Sources.BooleanStep chiCoo(startTime=2100, startValue=true)
"Chilling mode on"
equation
connect(souCon.ports[1], chi.port_a1)
connect(souEva.ports[1], chi.port_a2)
connect(chi.port_b1, sinCon.ports[1])
connect(sinEva.ports[1], chi.port_b2)
connect(TConIn.y, souCon.T_in)
connect(TEvaIn.y, souEva.T_in)
connect(ySet.y, chi.ySet)
connect(chiCoo.y, chi.coo)
end Modular; |
Collection of models that illustrate model use and test models | within AixLib.Fluid.Chillers.ModularReversible;
package Examples "Collection of models that illustrate model use and test models"
extends Modelica.Icons.ExamplesPackage;
end Examples; |
Carnot EER with a constant Carnot effectiveness. This model uses a constant Carnot effectiveness approach
to compute the efficiency of the chiller. | within AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle;
model ConstantCarnotEffectiveness "Carnot EER with a constant Carnot effectiveness"
extends
AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses.PartialChillerCycle(
useInChi=true,
PEle_nominal=-QCoo_flow_nominal/EER_nominal,
devIde="ConstantCarnotEffectiveness");
extends
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.PartialCarnot(
TAppCon_nominal=if cpCon < 1500 then 5 else 2,
TAppEva_nominal=if cpEva < 1500 then 5 else 2,
final useForChi=true,
final QEva_flow_nominal=QCoo_flow_nominal,
final QCon_flow_nominal=PEle_nominal-QCoo_flow_nominal,
constPEle(final k=PEle_nominal),
proQUse_flow(nu=4));
parameter Real EER_nominal(
min=0,
final unit="1") = etaCarnot_nominal*(TEva_nominal - TAppEva_nominal)/(
TCon_nominal + TAppCon_nominal - (TEva_nominal - TAppEva_nominal))
"Nominal EER";
Modelica.Blocks.Sources.Constant constNegOne(final k=-1)
"Negative one to negative evaporator heat flow rate"
equation
connect(swiQUse.u2, sigBus.onOffMea)
connect(swiPEle.y, redQCon.u2)
connect(swiPEle.y, PEle)
connect(swiPEle.u2, sigBus.onOffMea)
connect(pasThrYMea.u, sigBus.yMea)
if useInChi then
connect(pasThrTCon.u, sigBus.TConOutMea)
connect(pasThrTEva.u, sigBus.TEvaOutMea)
else
connect(pasThrTCon.u, sigBus.TEvaOutMea)
connect(pasThrTEva.u, sigBus.TConOutMea)
end if;
connect(swiQUse.y, proRedQEva.u2)
connect(constNegOne.y, proQUse_flow.u[4])
end ConstantCarnotEffectiveness; |
Package for chiller refrigerant cycle modules | within AixLib.Fluid.Chillers.ModularReversible;
package RefrigerantCycle "Package for chiller refrigerant cycle modules"
extends Modelica.Icons.MaterialPropertiesPackage;
end RefrigerantCycle; |
Performance data based on condenser outlet and evaporator inlet temperature. This model uses two-dimensional table data typically given
by manufacturers as required by e.g. European Norm 14511
or ASHRAE 205 to calculate
<code>QEva_flow</code> and <code>PEle</code>. | within AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle;
model TableData2D
"Performance data based on condenser outlet and evaporator inlet temperature"
extends
AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses.PartialChillerCycle(
final devIde=datTab.devIde,
PEle_nominal=Modelica.Blocks.Tables.Internal.getTable2DValueNoDer2(
tabIdePEle,
TEva_nominal,
TCon_nominal) * scaFac);
extends
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.PartialTableData2D(
final useInRevDev=not useInChi,
final use_TConOutForTab=datTab.use_TConOutForTab,
final use_TEvaOutForTab=datTab.use_TEvaOutForTab,
tabQUse_flow(final table=datTab.tabQEva_flow),
tabPEle(final table=datTab.tabPEle),
scaFac=QCoo_flow_nominal/QCooNoSca_flow_nominal,
mEva_flow_nominal=datTab.mEva_flow_nominal*scaFac,
mCon_flow_nominal=datTab.mCon_flow_nominal*scaFac,
final valTabQEva_flow = {{-tabQUse_flow.table[j, i] for i in 2:numCol} for j in 2:numRow},
final valTabQCon_flow = valTabQEva_flow .+ valTabPEle,
final mCon_flow_max=max(valTabQCon_flow) * scaFac / cpCon / dTMin,
final mCon_flow_min=min(valTabQCon_flow) * scaFac / cpCon / dTMax,
final mEva_flow_min=min(valTabQEva_flow) * scaFac / cpEva / dTMax,
final mEva_flow_max=max(valTabQEva_flow) * scaFac / cpEva / dTMin);
parameter Modelica.Units.SI.HeatFlowRate QCooNoSca_flow_nominal=
Modelica.Blocks.Tables.Internal.getTable2DValueNoDer2(
tabIdeQUse_flow,
TEva_nominal,
TCon_nominal)
"Unscaled nominal cooling capacity "
replaceable parameter AixLib.Fluid.Chillers.ModularReversible.Data.TableData2D.Generic datTab
"Data Table of Chiller"
equation
connect(scaFacTimPel.y, PEle)
connect(scaFacTimPel.y, redQCon.u2)
connect(scaFacTimQUse_flow.y, proRedQEva.u2)
connect(yMeaTimScaFac.u1, sigBus.yMea)
connect(reaPasThrTEvaOut.u, sigBus.TEvaOutMea)
connect(reaPasThrTEvaIn.u, sigBus.TEvaInMea)
connect(reaPasThrTConIn.u, sigBus.TConInMea)
connect(reaPasThrTConOut.u, sigBus.TConOutMea)
if useInChi then
connect(reaPasThrTConOut.y, tabPEle.u2)
connect(reaPasThrTConIn.y, tabPEle.u2)
connect(reaPasThrTConIn.y, tabQUse_flow.u2)
connect(reaPasThrTConOut.y, tabQUse_flow.u2)
connect(reaPasThrTEvaOut.y, tabQUse_flow.u1)
connect(reaPasThrTEvaIn.y, tabQUse_flow.u1)
connect(reaPasThrTEvaOut.y, tabPEle.u1)
connect(reaPasThrTEvaIn.y, tabPEle.u1)
else
connect(reaPasThrTConOut.y, tabPEle.u1)
connect(reaPasThrTConOut.y, tabQUse_flow.u1)
connect(reaPasThrTConIn.y, tabQUse_flow.u1)
connect(reaPasThrTConIn.y, tabPEle.u1)
connect(reaPasThrTEvaOut.y, tabPEle.u2)
connect(reaPasThrTEvaOut.y, tabQUse_flow.u2)
connect(reaPasThrTEvaIn.y, tabQUse_flow.u2)
connect(reaPasThrTEvaIn.y, tabPEle.u2)
end if;
end TableData2D; |
Placeholder to disable cooling. Using this model, the chiller will always be off.
This option is mainly used to avoid warnings about
partial model which must be replaced. | within AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses;
model NoCooling
"Placeholder to disable cooling"
extends PartialChillerCycle(
TEva_nominal=273.15,
TCon_nominal=273.15,
cpEva=4184,
cpCon=4184,
PEle_nominal=0,
redeclare final
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.Frosting.NoFrosting
iceFacCal,
devIde="NoCooling",
QCoo_flow_nominal=0);
Modelica.Blocks.Sources.Constant const(final k=0) "Zero energy flows"
equation
connect(const.y, redQCon.u2)
connect(const.y, PEle)
connect(const.y, proRedQEva.u2)
end NoCooling; |
Package with partial classes of performance Data | within AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle;
package BaseClasses "Package with partial classes of performance Data"
end BaseClasses; |
Partial model of refrigerant cycle used for chiller applications. Partial refrigerant cycle model for chillers.
It adds the specification for frosting calculation
and restricts to the intended choices under
<code>choicesAllMatching</code>. | within AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses;
partial model PartialChillerCycle
"Partial model of refrigerant cycle used for chiller applications"
extends
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.PartialRefrigerantCycle;
parameter Modelica.Units.SI.HeatFlowRate QCoo_flow_nominal
"Nominal cooling capacity"
parameter Boolean useInChi
"=false to indicate that this model is used as a heat pump";
equation
connect(iceFacCal.iceFac, sigBus.iceFacChiMea)
end PartialChillerCycle; |
Example using the Carnot model approach | within AixLib.Fluid.Chillers.ModularReversible.Validation;
model Carnot_y "Example using the Carnot model approach"
extends AixLib.Fluid.HeatPumps.ModularReversible.Validation.Comparative.BaseClasses.PartialComparison(
m1_flow_nominal=chi.m1_flow_nominal,
m2_flow_nominal=chi.m2_flow_nominal,
sin2(nPorts=1),
sou2(nPorts=1),
sin1(nPorts=1),
sou1(nPorts=1));
extends Modelica.Icons.Example;
AixLib.Fluid.Chillers.Carnot_y chi(
redeclare package Medium1 = Medium1,
redeclare package Medium2 = Medium2,
etaCarnot_nominal=etaCarnot_nominal,
TCon_nominal=TCon_nominal,
TEva_nominal=TEva_nominal,
tau1=tau1,
tau2=tau2,
P_nominal=QUse_flow_nominal/chi.COP_nominal,
dTEva_nominal=-dTEva_nominal,
dTCon_nominal=dTCon_nominal,
use_eta_Carnot_nominal=false,
dp1_nominal=dp1_nominal,
dp2_nominal=dp2_nominal,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
show_T=true,
T1_start=T1_start,
T2_start=T2_start)
"Chiller model"
equation
connect(sin2.ports[1], chi.port_b2)
connect(chi.port_a2, sou2.ports[1])
connect(chi.port_b1, sin1.ports[1])
connect(chi.port_a1, sou1.ports[1])
connect(chi.y, uCom.y)
end Carnot_y; |
Validation case for modular Carnot approach. Validation case for <a href=\"modelica://AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.ConstantCarnotEffectiveness\">
AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.ConstantCarnotEffectiveness</a>. | within AixLib.Fluid.Chillers.ModularReversible.Validation;
model ConstantCarnotEffectiveness
"Validation case for modular Carnot approach"
extends BaseClasses.PartialModularComparison(chi(redeclare model
RefrigerantCycleChillerCooling =
AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.ConstantCarnotEffectiveness
(etaCarnot_nominal=etaCarnot_nominal)));
extends Modelica.Icons.Example;
end ConstantCarnotEffectiveness; |
Package for model validation | within AixLib.Fluid.Chillers.ModularReversible;
package Validation "Package for model validation"
extends Modelica.Icons.ExamplesPackage;
end Validation; |
Validation case for table data approach. Validation case for <a href=\"modelica://AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.TableData2D\">
AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.TableData2D</a>. | within AixLib.Fluid.Chillers.ModularReversible.Validation;
model TableData2D "Validation case for table data approach"
extends BaseClasses.PartialModularComparison(
TEva_nominal=TEvaIn_nominal,
TCon_nominal=TConIn_nominal,
chi(redeclare model RefrigerantCycleChillerCooling =
AixLib.Fluid.Chillers.ModularReversible.RefrigerantCycle.TableData2D (
datTab(
tabPEle=[0,293.15,303.15; 288.15,14122.8,14122.8; 298.15,14122.8,14122.8],
mCon_flow_nominal=m1_flow_nominal,
mEva_flow_nominal=m2_flow_nominal,
dpCon_nominal=0,
dpEva_nominal=0,
devIde="CarnotTableData",
use_TEvaOutForTab=false,
use_TConOutForTab=false,
tabQEva_flow=[0,293.15,303.15; 288.15,-35499.7,-30000; 298.15,0,-36220.8],
tabLowBou=[273.15,273.15; 273.15,273.15],
use_TEvaOutForOpeEnv=false,
use_TConOutForOpeEnv=false))));
extends Modelica.Icons.Example;
end TableData2D; |
Package with partial validation models | within AixLib.Fluid.Chillers.ModularReversible.Validation;
package BaseClasses "Package with partial validation models"
extends Modelica.Icons.BasesPackage;
end BaseClasses; |
Partial model for comparison to the Carnot model | within AixLib.Fluid.Chillers.ModularReversible.Validation.BaseClasses;
partial model PartialModularComparison
"Partial model for comparison to the Carnot model"
extends AixLib.Fluid.HeatPumps.ModularReversible.Validation.Comparative.BaseClasses.PartialComparison(
m1_flow_nominal=chi.mCon_flow_nominal,
m2_flow_nominal=chi.mEva_flow_nominal,
sou1(nPorts=1),
sin2(nPorts=1),
sou2(nPorts=1),
sin1(nPorts=1));
Modular chi(
redeclare final package MediumCon = Medium1,
redeclare final package MediumEva = Medium2,
QCoo_flow_nominal=-QUse_flow_nominal,
redeclare final model RefrigerantCycleInertia =
AixLib.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.Inertias.NoInertia,
final use_rev=false,
final use_intSafCtr=false,
final tauCon=tau1,
final TConCoo_nominal=TCon_nominal,
final dTCon_nominal=dTCon_nominal,
final dpCon_nominal=dp1_nominal,
final use_conCap=false,
final CCon=0,
final GConOut=0,
final TEvaHea_nominal=0,
final TConHea_nominal=0,
final GConIns=0,
final tauEva=tau2,
final TEvaCoo_nominal=TEva_nominal,
final dTEva_nominal=dTEva_nominal,
final dpEva_nominal=dp2_nominal,
final use_evaCap=false,
final CEva=0,
final GEvaOut=0,
final GEvaIns=0,
final TCon_start=T1_start,
final TEva_start=T2_start,
final energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
"Modular chiller model"
equation
connect(chi.port_a1, sou1.ports[1])
connect(chi.port_b2, sin2.ports[1])
connect(chi.port_a2, sou2.ports[1])
connect(chi.port_b1, sin1.ports[1])
connect(chi.ySet, uCom.y)
end PartialModularComparison; |
Test model to verify the COP computation for non-zero approach temperatures | within AixLib.Fluid.Chillers.Validation;
model CarnotVerifyCOP
"Test model to verify the COP computation for non-zero approach temperatures"
extends Modelica.Icons.Example;
package Medium = AixLib.Media.Water "Medium model";
parameter Real COP_nominal = 3 "Coefficient of performance";
parameter Modelica.Units.SI.Temperature TCon_nominal=273.15 + 30
"Nominal condenser temperature";
parameter Modelica.Units.SI.Temperature TEva_nominal=273.15 + 5
"Nominal evaporator temperature";
parameter Modelica.Units.SI.HeatFlowRate QEva_flow_nominal=-10E3
"Nominal evaporator heat flow rate (QEva_flow_nominal < 0)";
parameter Modelica.Units.SI.HeatFlowRate QCon_flow_nominal=-QEva_flow_nominal
*(1 + 1/COP_nominal)
"Nominal condenser heat flow rate (QCon_flow_nominal > 0)";
parameter Modelica.Units.SI.TemperatureDifference dTEva_nominal=-10
"Temperature difference evaporator outlet-inlet";
parameter Modelica.Units.SI.TemperatureDifference dTCon_nominal=10
"Temperature difference condenser outlet-inlet";
parameter Modelica.Units.SI.MassFlowRate mCon_flow_nominal=QCon_flow_nominal/
cp_default/dTCon_nominal "Nominal mass flow rate at condenser";
parameter Modelica.Units.SI.MassFlowRate mEva_flow_nominal=QEva_flow_nominal/
cp_default/dTEva_nominal "Nominal mass flow rate of evaporator";
final parameter Modelica.Units.SI.SpecificHeatCapacity cp_default=
Medium.specificHeatCapacityCp(Medium.setState_pTX(
p=Medium.p_default,
T=Medium.T_default,
X=Medium.X_default))
"Specific heat capacity of medium 1 at default medium state";
Carnot_TEva chi_TEva(
dp1_nominal=0,
dp2_nominal=0,
redeclare package Medium1 = Medium,
redeclare package Medium2 = Medium,
QEva_flow_nominal=QEva_flow_nominal,
dTEva_nominal=dTEva_nominal,
dTCon_nominal=dTCon_nominal,
m1_flow_nominal=mCon_flow_nominal,
m2_flow_nominal=mEva_flow_nominal,
use_eta_Carnot_nominal=false,
COP_nominal=COP_nominal,
show_T=true,
TCon_nominal=TCon_nominal,
TEva_nominal=TEva_nominal,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState)
"Chiller with evaporator leaving water temperature as set point"
Sources.MassFlowSource_T bouCon(
nPorts=1,
redeclare package Medium = Medium,
m_flow=mCon_flow_nominal,
T=TCon_nominal - QCon_flow_nominal/cp_default/mCon_flow_nominal)
"Boundary condition for condenser"
Sources.MassFlowSource_T bouEva(
redeclare package Medium = Medium,
nPorts=1,
m_flow=mEva_flow_nominal,
T=TEva_nominal - QEva_flow_nominal/cp_default/mEva_flow_nominal)
"Boundary condition for evaporator"
Modelica.Blocks.Sources.Constant TEvaLvg(k=273.15 + 5)
"Leaving water temperature"
Sources.Boundary_pT bou(
nPorts=1,
redeclare package Medium = Medium)
"Pressure boundary condition"
Sources.Boundary_pT bou1(
nPorts=1,
redeclare package Medium = Medium)
"Pressure boundary condition"
Carnot_y chi_y(
dp1_nominal=0,
dp2_nominal=0,
redeclare package Medium1 = Medium,
redeclare package Medium2 = Medium,
dTEva_nominal=dTEva_nominal,
dTCon_nominal=dTCon_nominal,
m1_flow_nominal=mCon_flow_nominal,
m2_flow_nominal=mEva_flow_nominal,
use_eta_Carnot_nominal=false,
COP_nominal=COP_nominal,
show_T=true,
TCon_nominal=TCon_nominal,
TEva_nominal=TEva_nominal,
P_nominal=QEva_flow_nominal + QCon_flow_nominal,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState)
"Chiller with control signal as set point"
Sources.MassFlowSource_T bouCon1(
nPorts=1,
redeclare package Medium = Medium,
m_flow=mCon_flow_nominal,
T=TCon_nominal - QCon_flow_nominal/cp_default/mCon_flow_nominal)
"Boundary condition for condenser"
Sources.MassFlowSource_T bouEva1(
redeclare package Medium = Medium,
nPorts=1,
m_flow=mEva_flow_nominal,
T=TEva_nominal - QEva_flow_nominal/cp_default/mEva_flow_nominal)
"Boundary condition for evaporator"
Modelica.Blocks.Sources.Constant y(k=1) "Control signal"
Sources.Boundary_pT bou2(
nPorts=1,
redeclare package Medium = Medium)
"Pressure boundary condition"
Sources.Boundary_pT bou3(
nPorts=1,
redeclare package Medium = Medium)
"Pressure boundary condition"
equation
connect(bouCon.ports[1], chi_TEva.port_a1)
connect(TEvaLvg.y, chi_TEva.TSet)
connect(bou.ports[1], chi_TEva.port_b2)
connect(chi_TEva.port_a2, bouEva.ports[1])
connect(bou1.ports[1], chi_TEva.port_b1)
connect(bouCon1.ports[1], chi_y.port_a1)
connect(bou2.ports[1], chi_y.port_b2)
connect(chi_y.port_a2, bouEva1.ports[1])
connect(bou3.ports[1], chi_y.port_b1)
connect(y.y, chi_y.y)
end CarnotVerifyCOP; |
Test model to verify the Carnot effectiveness computation for non-zero approach temperatures | within AixLib.Fluid.Chillers.Validation;
model CarnotVerifyEtaCarnot
"Test model to verify the Carnot effectiveness computation for non-zero approach temperatures"
extends Modelica.Icons.Example;
package Medium = AixLib.Media.Water "Medium model";
parameter Real etaCarnot_nominal=0.315046
"Carnot effectiveness (=COP/COP_Carnot) used if use_eta_Carnot_nominal = true";
parameter Modelica.Units.SI.TemperatureDifference TAppCon_nominal=2
"Temperature difference between refrigerant and working fluid outlet in condenser";
parameter Modelica.Units.SI.TemperatureDifference TAppEva_nominal=2
"Temperature difference between refrigerant and working fluid outlet in evaporator";
parameter Real COP_nominal = etaCarnot_nominal * (TEva_nominal-TAppEva_nominal)/
(TCon_nominal + TAppCon_nominal - (TEva_nominal-TAppEva_nominal)) "Coefficient of performance";
parameter Modelica.Units.SI.Temperature TCon_nominal=273.15 + 30
"Nominal condenser temperature";
parameter Modelica.Units.SI.Temperature TEva_nominal=273.15 + 5
"Nominal evaporator temperature";
parameter Modelica.Units.SI.HeatFlowRate QEva_flow_nominal=-10E3
"Nominal evaporator heat flow rate (QEva_flow_nominal < 0)";
parameter Modelica.Units.SI.HeatFlowRate QCon_flow_nominal=-QEva_flow_nominal
*(1 + 1/COP_nominal)
"Nominal condenser heat flow rate (QCon_flow_nominal > 0)";
parameter Modelica.Units.SI.TemperatureDifference dTEva_nominal=-10
"Temperature difference evaporator outlet-inlet";
parameter Modelica.Units.SI.TemperatureDifference dTCon_nominal=10
"Temperature difference condenser outlet-inlet";
parameter Modelica.Units.SI.MassFlowRate mCon_flow_nominal=QCon_flow_nominal/
cp_default/dTCon_nominal "Nominal mass flow rate at condenser";
parameter Modelica.Units.SI.MassFlowRate mEva_flow_nominal=QEva_flow_nominal/
cp_default/dTEva_nominal "Nominal mass flow rate of evaporator";
final parameter Modelica.Units.SI.SpecificHeatCapacity cp_default=
Medium.specificHeatCapacityCp(Medium.setState_pTX(
p=Medium.p_default,
T=Medium.T_default,
X=Medium.X_default))
"Specific heat capacity of medium 1 at default medium state";
Carnot_TEva chi_TEva(
dp1_nominal=0,
dp2_nominal=0,
redeclare package Medium1 = Medium,
redeclare package Medium2 = Medium,
QEva_flow_nominal=QEva_flow_nominal,
dTEva_nominal=dTEva_nominal,
dTCon_nominal=dTCon_nominal,
m1_flow_nominal=mCon_flow_nominal,
m2_flow_nominal=mEva_flow_nominal,
show_T=true,
TCon_nominal=TCon_nominal,
TEva_nominal=TEva_nominal,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
etaCarnot_nominal=etaCarnot_nominal,
TAppCon_nominal=TAppCon_nominal,
TAppEva_nominal=TAppEva_nominal)
"Chiller with evaporator leaving water temperature as set point"
Sources.MassFlowSource_T bouCon(
nPorts=1,
redeclare package Medium = Medium,
m_flow=mCon_flow_nominal,
T=TCon_nominal - QCon_flow_nominal/cp_default/mCon_flow_nominal)
"Boundary condition for condenser"
Sources.MassFlowSource_T bouEva(
redeclare package Medium = Medium,
nPorts=1,
m_flow=mEva_flow_nominal,
T=TEva_nominal - QEva_flow_nominal/cp_default/mEva_flow_nominal)
"Boundary condition for evaporator"
Modelica.Blocks.Sources.Constant TEvaLvg(k=273.15 + 5)
"Leaving water temperature"
Sources.Boundary_pT bou(
nPorts=1,
redeclare package Medium = Medium)
"Pressure boundary condition"
Sources.Boundary_pT bou1(
nPorts=1,
redeclare package Medium = Medium)
"Pressure boundary condition"
Carnot_y chi_y(
dp1_nominal=0,
dp2_nominal=0,
redeclare package Medium1 = Medium,
redeclare package Medium2 = Medium,
dTEva_nominal=dTEva_nominal,
dTCon_nominal=dTCon_nominal,
m1_flow_nominal=mCon_flow_nominal,
m2_flow_nominal=mEva_flow_nominal,
show_T=true,
TCon_nominal=TCon_nominal,
TEva_nominal=TEva_nominal,
P_nominal=QEva_flow_nominal + QCon_flow_nominal,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
etaCarnot_nominal=etaCarnot_nominal,
TAppCon_nominal=TAppCon_nominal,
TAppEva_nominal=TAppEva_nominal)
"Chiller with control signal as set point"
Sources.MassFlowSource_T bouCon1(
nPorts=1,
redeclare package Medium = Medium,
m_flow=mCon_flow_nominal,
T=TCon_nominal - QCon_flow_nominal/cp_default/mCon_flow_nominal)
"Boundary condition for condenser"
Sources.MassFlowSource_T bouEva1(
redeclare package Medium = Medium,
nPorts=1,
m_flow=mEva_flow_nominal,
T=TEva_nominal - QEva_flow_nominal/cp_default/mEva_flow_nominal)
"Boundary condition for evaporator"
Modelica.Blocks.Sources.Constant y(k=1) "Control signal"
Sources.Boundary_pT bou2(
nPorts=1,
redeclare package Medium = Medium)
"Pressure boundary condition"
Sources.Boundary_pT bou3(
nPorts=1,
redeclare package Medium = Medium)
"Pressure boundary condition"
equation
connect(bouCon.ports[1], chi_TEva.port_a1)
connect(TEvaLvg.y, chi_TEva.TSet)
connect(bou.ports[1], chi_TEva.port_b2)
connect(chi_TEva.port_a2, bouEva.ports[1])
connect(bou1.ports[1], chi_TEva.port_b1)
connect(bouCon1.ports[1], chi_y.port_a1)
connect(bou2.ports[1], chi_y.port_b2)
connect(chi_y.port_a2, bouEva1.ports[1])
connect(bou3.ports[1], chi_y.port_b1)
connect(y.y, chi_y.y)
end CarnotVerifyEtaCarnot; |
Test model to verify that the 2nd law is not violated | within AixLib.Fluid.Chillers.Validation;
model Carnot_TEva_2ndLaw
"Test model to verify that the 2nd law is not violated"
extends Modelica.Icons.Example;
package Medium = AixLib.Media.Water "Medium model";
parameter Modelica.Units.SI.TemperatureDifference dTEva_nominal=-4
"Temperature difference evaporator outlet-inlet";
parameter Modelica.Units.SI.TemperatureDifference dTCon_nominal=4
"Temperature difference condenser outlet-inlet";
parameter Real COPc_nominal = 3 "Chiller COP";
parameter Modelica.Units.SI.HeatFlowRate QEva_flow_nominal=-100E3
"Evaporator heat flow rate";
final parameter Modelica.Units.SI.MassFlowRate m2_flow_nominal=
QEva_flow_nominal/dTEva_nominal/4200
"Nominal mass flow rate at chilled water side";
final parameter Modelica.Units.SI.MassFlowRate m1_flow_nominal=-
m2_flow_nominal/dTCon_nominal*dTEva_nominal
"Nominal mass flow rate at condenser water side";
Modelica.Blocks.Sources.Constant TEvaIn(k=273.15 + 20)
"Evaporator inlet temperature"
Modelica.Blocks.Sources.Constant dTEva(k=dTEva_nominal)
"Temperature difference over evaporator"
Modelica.Blocks.Math.Add TSetEvaLvg
"Set point for evaporator leaving temperature"
Modelica.Blocks.Sources.Ramp dTConEva(
duration=1,
offset=25,
height=-25)
"Temperature lift condenser inlet minus evaporator outlet"
Modelica.Blocks.Math.Add TConIn "Condenser inlet temperature"
Chiller chi_b(
redeclare final package Medium1 = Medium,
redeclare final package Medium2 = Medium,
final dTEva_nominal=dTEva_nominal,
final dTCon_nominal=dTCon_nominal,
final QEva_flow_nominal=QEva_flow_nominal,
final m2_flow_nominal=m2_flow_nominal,
final m1_flow_nominal=m1_flow_nominal)
"Chiller model that uses port_b to compute Carnot efficiency"
protected
model Chiller "Subsystem model with the chiller"
replaceable package Medium1 = Modelica.Media.Interfaces.PartialMedium
"Medium model";
replaceable package Medium2 = Modelica.Media.Interfaces.PartialMedium
"Medium model";
parameter Modelica.Units.SI.TemperatureDifference dTEva_nominal
"Temperature difference evaporator outlet-inlet";
parameter Modelica.Units.SI.TemperatureDifference dTCon_nominal
"Temperature difference condenser outlet-inlet";
parameter Modelica.Units.SI.HeatFlowRate QEva_flow_nominal
"Evaporator heat flow rate";
parameter Modelica.Units.SI.MassFlowRate m1_flow_nominal
"Nominal mass flow rate at condenser water side";
parameter Modelica.Units.SI.MassFlowRate m2_flow_nominal
"Nominal mass flow rate at chilled water side";
AixLib.Fluid.Sources.MassFlowSource_T sou1(
redeclare package Medium = Medium1,
nPorts=1,
use_m_flow_in=false,
use_T_in=true,
m_flow=m1_flow_nominal)
"Mass flow rate source"
AixLib.Fluid.Sources.Boundary_pT sin1(redeclare package Medium = Medium2, nPorts=1)
"Pressure source"
AixLib.Fluid.Chillers.Carnot_TEva chi(
redeclare package Medium1 = Medium1,
redeclare package Medium2 = Medium2,
dTEva_nominal=dTEva_nominal,
dTCon_nominal=dTCon_nominal,
m2_flow_nominal=m2_flow_nominal,
show_T=true,
QEva_flow_nominal=QEva_flow_nominal,
allowFlowReversal1=false,
allowFlowReversal2=false,
dp1_nominal=0,
dp2_nominal=0,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
use_eta_Carnot_nominal=true) "Chiller model"
AixLib.Fluid.Sources.MassFlowSource_T sou2(
redeclare package Medium = Medium2,
m_flow=m2_flow_nominal,
use_T_in=true,
T=293.15,
nPorts=1) "Mass flow rate source"
AixLib.Fluid.Sensors.EntropyFlowRate S_a1(
redeclare package Medium = Medium1,
m_flow_nominal=m1_flow_nominal,
tau=0) "Entropy flow rate sensor"
AixLib.Fluid.Sensors.EntropyFlowRate S_a2(
redeclare package Medium = Medium1,
m_flow_nominal=m1_flow_nominal,
tau=0) "Entropy flow rate sensor"
AixLib.Fluid.Sensors.EntropyFlowRate S_a3(
redeclare package Medium = Medium1,
m_flow_nominal=m1_flow_nominal,
tau=0) "Entropy flow rate sensor"
AixLib.Fluid.Sensors.EntropyFlowRate S_a4(
redeclare package Medium = Medium1,
m_flow_nominal=m1_flow_nominal,
tau=0) "Entropy flow rate sensor"
AixLib.Fluid.Sources.Boundary_pT sin2(redeclare package Medium = Medium2, nPorts=1)
"Pressure source"
Modelica.Blocks.Math.Add SIn_flow
"Entropy carried by flow that goes into the chiller"
Modelica.Blocks.Math.Add SOut_flow
"Entropy carried by flow that leaves the chiller"
Modelica.Blocks.Math.Add dS_flow(k1=-1)
"Change in entropy inflow and outflow"
Modelica.Blocks.Interfaces.RealInput TSetEvaLea(unit="K")
"Set point for evaporator leaving temperature"
Modelica.Blocks.Interfaces.RealOutput SGen_flow "Entropy generated"
Modelica.Blocks.Interfaces.RealInput TConIn(final unit="K", displayUnit=
"degC") "Condenser inlet temperature"
Modelica.Blocks.Interfaces.RealInput TEvaIn(final unit="K", displayUnit=
"degC") "Evaporator inlet temperature"
equation
assert(SGen_flow > 0, "Entropy generated is zero or negative, which violates the 2nd law.
This is because the model is configured to use the inlet temperatures
to compute the Carnot efficiency, which can lead to non-physical results.",
level = AssertionLevel.warning);
connect(SIn_flow.y, dS_flow.u1)
connect(sin1.ports[1],S_a2. port_b)
connect(sou1.ports[1],S_a1. port_a)
connect(S_a1.port_b,chi. port_a1)
connect(chi.port_b1,S_a4. port_a)
connect(S_a4.port_b,sin2. ports[1])
connect(S_a3.port_a,sou2. ports[1])
connect(S_a2.port_a,chi. port_b2)
connect(S_a3.port_b,chi. port_a2)
connect(S_a4.S_flow,SOut_flow. u2)
connect(S_a2.S_flow,SOut_flow. u1)
connect(S_a3.S_flow,SIn_flow. u2)
connect(S_a1.S_flow,SIn_flow. u1)
connect(SOut_flow.y,dS_flow. u2)
connect(TSetEvaLea, chi.TSet)
connect(SGen_flow, dS_flow.y)
connect(TConIn, sou1.T_in)
connect(TEvaIn, sou2.T_in)
end Chiller;
equation
connect(TSetEvaLvg.u1, TEvaIn.y)
connect(dTEva.y, TSetEvaLvg.u2)
connect(TSetEvaLvg.y, TConIn.u1)
connect(dTConEva.y, TConIn.u2)
connect(TEvaIn.y, chi_b.TEvaIn)
connect(TSetEvaLvg.y, chi_b.TSetEvaLea)
connect(chi_b.TConIn, TConIn.y)
end Carnot_TEva_2ndLaw; |
Test model for the part load efficiency curve with evaporator leaving temperature as input signal. This example extends from
<a href=\"modelica://AixLib.Fluid.Chillers.Examples.Carnot_TEva\">
AixLib.Fluid.Chillers.Examples.Carnot_TEva</a>
but has a part load efficiency that varies with the load. | within AixLib.Fluid.Chillers.Validation;
model Carnot_TEva_etaPL
"Test model for the part load efficiency curve with evaporator leaving temperature as input signal"
extends Examples.Carnot_TEva(
chi(a={0.7,0.3},
QEva_flow_min=-100000));
end Carnot_TEva_etaPL; |
Test model for Carnot_TEva with high evaporator temperature. This example extends from
<a href=\"modelica://AixLib.Fluid.Chillers.Examples.Carnot_TEva\">
AixLib.Fluid.Chillers.Examples.Carnot_TEva</a>
but increases the set point for the leaving evaporator temperature
to be above its inlet temperature, in which case the model provides no cooling.
Towards the end of the simulation, the inlet temperature of the evaporator is increased
to be above the condenser temperature. In this domain, the model requires cooling
again. While this is not a meaningful operating point for the model, the example
verifies that it robustly simulates this regime. | within AixLib.Fluid.Chillers.Validation;
model Carnot_TEva_HighTemperature
"Test model for Carnot_TEva with high evaporator temperature"
extends Examples.Carnot_TEva(TEvaLvg(height=34), sou2(use_T_in=true));
Modelica.Blocks.Sources.Ramp TEvaEnt(
startTime=3000,
height=38,
offset=273.15 + 22,
duration=60) "Control signal for evaporator entering temperature"
equation
connect(TEvaEnt.y, sou2.T_in)
end Carnot_TEva_HighTemperature; |