Skip to content

Commit ef07fe5

Browse files
added : LMTD heat exchange function, LMTDfuelHeater componenent and u… (#266)
* added : LMTD heat exchange function, LMTDfuelHeater componenent and unit test * Update CHANGELOG.md * added : LMTD heat exchange function, LMTDfuelHeater componenent and unit test * mise à jour du LMTDFuelHEater * modif related to PEP PR comment * changing : test to check QCpmin < QCmax raises warning instead of an error * adding heat loss for flue gases * adding start values to LMTDFuelHeater Signed-off-by: Helene Vernier <helene.vernier@metroscope.tech> * last modif on LMTD Signed-off-by: Helene Vernier <helene.vernier@metroscope.tech> * Failure mode in LMTFuelHeater Signed-off-by: Helene Vernier <helene.vernier@metroscope.tech> * changing fluegases heat loss icon Signed-off-by: Helene Vernier <helene.vernier@metroscope.tech> * Update CHANGELOG.md Co-authored-by: pepmts <97044708+pepmts@users.noreply.github.com> * last changes Signed-off-by: Helene Vernier <helene.vernier@metroscope.tech> Co-authored-by: pepmts <97044708+pepmts@users.noreply.github.com>
1 parent 471e48a commit ef07fe5

File tree

17 files changed

+350
-47
lines changed

17 files changed

+350
-47
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525

2626
### Added <!--Make sure to add a link to the PR and issues related to your change-->
2727
- Added `psiA` and `psiG` distinction in pressure sensor [PR#252](https://github.com/Metroscope-dev/metroscope-modeling-library/pull/252)
28+
- Added `LMTDHeatExchange` function, `LMTDfuelHeater`component and reverse unit test. [PR #266](https://github.com/Metroscope-dev/metroscope-modeling-library/pull/266)
2829
- Added`HXmoistAirWater` component and reverse unit test, [PR #250](https://github.com/Metroscope-dev/metroscope-modeling-library/pull/250)
2930
- Added flue gases enthalpy start value to `hrsg_monophasic_HX`, [PR #264](https://github.com/Metroscope-dev/metroscope-modeling-library/pull/264)
3031
- Added `mass_flow_rate_bias` fault in `BaseSensor`, to be able to declare faulty `FlowSensor` [PR #245](https://github.com/Metroscope-dev/metroscope-modeling-library/pull/245)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
within MetroscopeModelingLibrary.FlueGases.Pipes;
2+
model HeatLoss
3+
package FlueGasesMedium = MetroscopeModelingLibrary.Media.FlueGasesMedium;
4+
extends Partial.Pipes.HeatLoss(
5+
redeclare MetroscopeModelingLibrary.FlueGases.Connectors.Inlet C_in,
6+
redeclare MetroscopeModelingLibrary.FlueGases.Connectors.Outlet C_out,
7+
redeclare package Medium = FlueGasesMedium)
8+
annotation(IconMap(primitivesVisible=false));
9+
annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={
10+
Rectangle(
11+
extent={{-100,30},{100,-30}},
12+
lineColor={95,95,95},
13+
fillColor={95,95,95},
14+
fillPattern=FillPattern.Solid),
15+
Line(
16+
points={{-14,50},{-14,50},{-24,40},{-10,30},{-24,16},{-14,8}},
17+
color={238,46,47},
18+
smooth=Smooth.Bezier,
19+
thickness=0.5),
20+
Line(
21+
points={{0,50},{0,50},{-10,40},{4,30},{-10,16},{0,8}},
22+
color={238,46,47},
23+
smooth=Smooth.Bezier,
24+
thickness=0.5),
25+
Line(
26+
points={{14,50},{14,50},{4,40},{18,30},{4,16},{14,8}},
27+
color={238,46,47},
28+
smooth=Smooth.Bezier,
29+
thickness=0.5)}), Diagram(coordinateSystem(preserveAspectRatio=false)));
30+
end HeatLoss;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Pipe
22
Filter
3+
HeatLoss

MetroscopeModelingLibrary/MultiFluid/HeatExchangers/Evaporator.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ model Evaporator
3333

3434
// Failure modes
3535
parameter Boolean faulty = false;
36-
Units.Percentage fouling(min = 0, max=100); // Fouling percentage
36+
Units.Percentage fouling; // Fouling percentage
3737

3838
// Initialization parameters
3939
parameter Units.MassFlowRate Q_cold_0 = 500;

MetroscopeModelingLibrary/MultiFluid/HeatExchangers/FuelHeater.mo

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ model FuelHeater
3232
// Initialization parameters
3333
parameter Units.MassFlowRate Q_cold_0 = 500;
3434
parameter Units.MassFlowRate Q_hot_0 = 50;
35-
parameter Units.Temperature T_cold_in_0 = 76 + 273.15;
36-
parameter Units.Pressure P_cold_in_0 = 18 *1e5;
35+
parameter Units.Temperature T_hot_in_0 = 76 + 273.15;
36+
parameter Units.Pressure P_hot_in_0 = 18 *1e5;
3737

3838
Fuel.Connectors.Inlet C_cold_in annotation (Placement(transformation(extent={{-80,-10},{-60,10}}), iconTransformation(extent={{-80,-10},{-60,10}})));
3939
Fuel.Connectors.Outlet C_cold_out annotation (Placement(transformation(extent={{60,-10},{80,10}}), iconTransformation(extent={{60,-10},{80,10}})));
@@ -43,18 +43,18 @@ model FuelHeater
4343
Power.HeatExchange.NTUHeatExchange HX(
4444
config=HX_config,
4545
QCp_max_side=QCp_max_side,
46-
T_cold_in_0=T_cold_in_0) annotation (Placement(transformation(
46+
T_hot_in_0=T_hot_in_0) annotation (Placement(transformation(
4747
extent={{-10,10},{10,-10}},
4848
rotation=0,
4949
origin={10,14})));
5050
WaterSteam.BaseClasses.IsoPFlowModel hot_side(
51-
Q_0=Q_cold_0,
52-
T_in_0=T_cold_in_0,
53-
P_in_0=P_cold_in_0) annotation (Placement(transformation(
51+
Q_0=Q_hot_0,
52+
T_in_0=T_hot_in_0,
53+
P_in_0=P_hot_in_0) annotation (Placement(transformation(
5454
extent={{10,10},{-10,-10}},
5555
rotation=0,
5656
origin={10,28})));
57-
WaterSteam.Pipes.Pipe hot_side_pipe(Q_0=Q_cold_0, T_in_0=T_cold_in_0) annotation (Placement(transformation(
57+
WaterSteam.Pipes.Pipe hot_side_pipe(Q_0=Q_hot_0, T_in_0=T_hot_in_0) annotation (Placement(transformation(
5858
extent={{10,-10},{-10,10}},
5959
rotation=90,
6060
origin={-14,-24})));
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
within MetroscopeModelingLibrary.MultiFluid.HeatExchangers;
2+
model LMTDFuelHeater
3+
4+
extends MetroscopeModelingLibrary.Icons.KeepingScaleIcon;
5+
package WaterSteamMedium = MetroscopeModelingLibrary.Media.WaterSteamMedium;
6+
package FuelMedium = MetroscopeModelingLibrary.Media.FuelMedium;
7+
import MetroscopeModelingLibrary.Units;
8+
import MetroscopeModelingLibrary.Units.Inputs;
9+
10+
// Pressure Losses
11+
Inputs.InputFrictionCoefficient Kfr_cold;
12+
Inputs.InputFrictionCoefficient Kfr_hot;
13+
14+
// Heating
15+
Inputs.InputArea S;
16+
Inputs.InputHeatExchangeCoefficient Kth;
17+
Units.Power W;
18+
19+
// Definitions
20+
Units.MassFlowRate Q_cold;
21+
Units.MassFlowRate Q_hot;
22+
Units.Temperature T_cold_in;
23+
Units.Temperature T_cold_out;
24+
Units.Temperature T_hot_in;
25+
Units.Temperature T_hot_out;
26+
27+
// Failure modes
28+
parameter Boolean faulty = false;
29+
Units.Percentage fouling; // Fouling percentage
30+
31+
// Initialization parameters
32+
parameter Units.MassFlowRate Q_cold_0 = 12;
33+
parameter Units.MassFlowRate Q_hot_0 = 8.6;
34+
parameter Units.Temperature T_cold_in_0 = 29.5 + 273.15;
35+
parameter Units.Temperature T_cold_out_0 = 97 + 273.15;
36+
parameter Units.Temperature T_hot_in_0 = 230 +273.15;
37+
parameter Units.Temperature T_hot_out_0 = 200 +273.15;
38+
parameter Units.Pressure P_cold_in_0 = 29.7 *1e5;
39+
parameter Units.Pressure P_cold_out_0 = 29.7 *1e5;
40+
parameter Units.Pressure P_hot_in_0 = 47 *1e5;
41+
parameter Units.Pressure P_hot_out_0 = 47 *1e5;
42+
parameter Units.SpecificEnthalpy h_hot_in_0 = 2e4;
43+
parameter Units.SpecificEnthalpy h_hot_out_0 = 1e4;
44+
parameter Units.SpecificEnthalpy h_cold_in_0 = 6e5;
45+
parameter Units.SpecificEnthalpy h_cold_out_0 = 1e6;
46+
47+
Power.HeatExchange.LMTDHeatExchange HX(
48+
T_cold_in_0=T_cold_in_0,T_hot_in_0=T_hot_in_0,T_cold_out_0=T_cold_out_0,T_hot_out_0=T_hot_out_0) annotation (Placement(transformation(
49+
extent={{-10,10},{10,-10}},
50+
rotation=0,
51+
origin={10,14})));
52+
WaterSteam.BaseClasses.IsoPFlowModel hot_side(Q_0=Q_hot_0, P_0 = P_hot_out_0, h_in_0 = h_hot_in_0, h_out_0 = h_hot_out_0, T_in_0 = T_hot_in_0, T_out_0 = T_hot_out_0) annotation (Placement(transformation(
53+
extent={{10,10},{-10,-10}},
54+
rotation=0,
55+
origin={10,28})));
56+
WaterSteam.Pipes.Pipe hot_side_pipe(Q_0=Q_hot_0, P_in_0 = P_hot_in_0, P_out_0 = P_hot_out_0, h_0 = h_hot_in_0, T_0 = T_hot_in_0) annotation (Placement(transformation(
57+
extent={{10,-10},{-10,10}},
58+
rotation=90,
59+
origin={-14,-24})));
60+
Fuel.Pipes.Pipe cold_side_pipe(Q_0=Q_cold_0, P_in_0 = P_cold_in_0, P_out_0 = P_cold_out_0, h_0 = h_cold_in_0, T_0 = T_cold_in_0) annotation (Placement(transformation(extent={{-52,-10},{-32,10}})));
61+
Fuel.BaseClasses.IsoPFlowModel cold_side(Q_0=Q_cold_0, P_0 = P_cold_out_0, h_in_0 = h_cold_in_0, h_out_0 = h_cold_out_0, T_in_0 = T_cold_in_0, T_out_0 = T_cold_out_0) annotation (Placement(transformation(extent={{0,-10},{20,10}})));
62+
Fuel.Connectors.Inlet C_cold_in(Q(start=Q_cold_0), P(start=P_cold_in_0)) annotation (Placement(transformation(extent={{-80,-10},{-60,10}}), iconTransformation(extent={{-80,-10},{-60,10}})));
63+
Fuel.Connectors.Outlet C_cold_out(Q(start=-Q_cold_0), P(start=P_cold_out_0), h_outflow(start=h_cold_out_0)) annotation (Placement(transformation(extent={{60,-10},{80,10}}), iconTransformation(extent={{60,-10},{80,10}})));
64+
WaterSteam.Connectors.Inlet C_hot_in(Q(start=Q_hot_0), P(start=P_hot_in_0)) annotation (Placement(transformation(extent={{30,60},{50,80}}), iconTransformation(extent={{30,60},{50,80}})));
65+
WaterSteam.Connectors.Outlet C_hot_out(Q(start=-Q_hot_0), P(start=P_hot_out_0), h_outflow(start=h_hot_out_0)) annotation (Placement(transformation(extent={{-50,-80},{-30,-60}}),
66+
iconTransformation(extent={{-50,-80},{-30,-60}})));
67+
equation
68+
// Failure modes
69+
if not faulty then
70+
fouling = 0;
71+
end if;
72+
73+
// Definitions
74+
Q_cold = cold_side.Q;
75+
Q_hot = hot_side.Q;
76+
T_cold_in = cold_side.T_in;
77+
T_cold_out = cold_side.T_out;
78+
T_hot_in = hot_side.T_in;
79+
T_hot_out = hot_side.T_out;
80+
cold_side.W = W;
81+
82+
// Energy balance
83+
hot_side.W + cold_side.W = 0;
84+
85+
// Pressure losses
86+
cold_side_pipe.delta_z = 0;
87+
cold_side_pipe.Kfr = Kfr_cold;
88+
hot_side_pipe.delta_z = 0;
89+
hot_side_pipe.Kfr = Kfr_hot;
90+
91+
// Power Exchange
92+
HX.W = W;
93+
HX.S = S;
94+
HX.Kth = Kth*(1-fouling/100);
95+
HX.T_cold_in = T_cold_in;
96+
HX.T_hot_in = T_hot_in;
97+
HX.T_cold_out = T_cold_out;
98+
HX.T_hot_out = T_hot_out;
99+
connect(hot_side_pipe.C_out,C_hot_out) annotation (Line(points={{-14,-34},{-14,-70},{-40,-70}}, color={28,108,200}));
100+
connect(hot_side_pipe.C_in,hot_side.C_out) annotation (Line(points={{-14,-14},{-14,28},{0,28}},color={28,108,200}));
101+
connect(hot_side.C_in,C_hot_in) annotation (Line(points={{20,28},{40,28},{40,70}}, color={28,108,200}));
102+
connect(cold_side_pipe.C_in,C_cold_in) annotation (Line(points={{-52,0},{-70,0}}, color={213,213,0}));
103+
connect(cold_side_pipe.C_out,cold_side.C_in) annotation (Line(points={{-32,0},{0,0}}, color={213,213,0}));
104+
connect(cold_side.C_out,C_cold_out) annotation (Line(points={{20,0},{70,0}}, color={213,213,0}));
105+
annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={
106+
Rectangle(
107+
extent={{-70,50},{70,-50}},
108+
lineColor={0,0,0},
109+
fillColor={226,230,140},
110+
fillPattern=FillPattern.Solid), Line(
111+
points={{40,66},{40,-60},{20,-60},{20,64},{0,64},{0,-60},{-20,-60},{-20,65.6309},{-40,66},{-40,-66}},
112+
color={28,108,200},
113+
thickness=1,
114+
smooth=Smooth.Bezier)}), Diagram(coordinateSystem(preserveAspectRatio=false)));
115+
end LMTDFuelHeater;

MetroscopeModelingLibrary/MultiFluid/HeatExchangers/package.order

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ Economiser
22
Superheater
33
Evaporator
44
FuelHeater
5+
LMTDFuelHeater
56
HXmoistAirWater
7+
LMTDFuelHeater

MetroscopeModelingLibrary/Partial/HeatExchangers/hrsg_monophasic_HX.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ partial model hrsg_monophasic_HX
2525

2626
// Failure modes
2727
parameter Boolean faulty = false;
28-
Units.Percentage fouling(min = 0, max=100); // Fouling percentage
28+
Units.Percentage fouling; // Fouling percentage
2929

3030
// Initialization parameters
3131
parameter Units.MassFlowRate Q_cold_0 = 500;
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
within MetroscopeModelingLibrary.Power.HeatExchange;
2+
model LMTDHeatExchange
3+
import MetroscopeModelingLibrary.Units.Inputs;
4+
import MetroscopeModelingLibrary.Units;
5+
6+
// Initialization parameters
7+
parameter Units.Temperature T_hot_in_0 = 273.15 + 200 "Init parameter for Hot temperature at the inlet";
8+
parameter Units.Temperature T_cold_in_0 = 273.15 + 30 "Init parameter for Cold temperature at the inlet";
9+
parameter Units.Temperature T_hot_out_0 = 273.15 + 90 "Init parameter for Hot temperature at the outlet";
10+
parameter Units.Temperature T_cold_out_0 = 273.15 + 100 "Init parameter for Cold temperature at the outlet";
11+
12+
/* Exchanger configuration and parameters */
13+
//parameter String config = "LMTD_monophasic_counter_current"; No need for parameter as long as there is only one configuration !!
14+
Inputs.InputArea S(start=100) "Heat exchange surface";
15+
Inputs.InputHeatExchangeCoefficient Kth(start=1900) "Heat exchange coefficient";
16+
17+
/* Exchanger output */
18+
Units.Power W(start=1e4);
19+
20+
/* Exchanger boundary conditions */
21+
Inputs.InputTemperature T_hot_in(start=T_hot_in_0) "Temperature, hot side, at the inlet";
22+
Inputs.InputTemperature T_cold_in(start=T_cold_in_0) "Temperature, cold side, at the inlet";
23+
Inputs.InputTemperature T_hot_out(start=T_hot_out_0) "Temperature, hot side, at the outlet";
24+
Inputs.InputTemperature T_cold_out(start=T_cold_out_0) "Temperature, cold side, at the outlet";
25+
26+
// intermediate variables
27+
Units.DifferentialTemperature DT_a(start = T_hot_in_0 - T_cold_out_0);
28+
Units.DifferentialTemperature DT_b(start = T_hot_out_0 - T_cold_in_0);
29+
equation
30+
// Counter-current configuration. (Also correct for cross-current since the likely correction coefficient can be considered as absorbed by Kth)
31+
DT_a = T_hot_in - T_cold_out;
32+
DT_b = T_hot_out - T_cold_in;
33+
34+
// Log mean equation written in an exponential way
35+
0 = - DT_a + DT_b * exp(Kth*S*(DT_a - DT_b)/W);
36+
37+
38+
annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={
39+
Polygon(
40+
points={{-66,-72},{-48,-72},{-48,-66},{-50,-54},{-54,-44},{-58,-34},{-60,-28},{-60,-16},{-60,-8},{-54,8},{-52,12},{-50,20},{-48,30},{-48,36},{-32,36},{-56,68},{-56,68},{-80,36},{-64,36},{-64,30},{-66,24},{-68,16},{-72,8},{-74,2},{-76,-6},{-76,-16},{-76,-28},{-74,-36},{-70,-48},{-66,-58},{-66,-72}},
41+
lineColor={255,170,255},
42+
fillColor={255,170,255},
43+
fillPattern=FillPattern.Solid),
44+
Polygon(
45+
points={{-10,-72},{8,-72},{8,-66},{6,-54},{2,-44},{-2,-34},{-4,-28},{-4,-16},{-4,-8},{2,8},{4,12},{6,20},{8,30},{8,36},{24,36},{0,68},{0,68},{-24,36},{-8,36},{-8,30},{-10,24},{-12,16},{-16,8},{-18,2},{-20,-6},{-20,-16},{-20,-28},{-18,-36},{-14,-48},{-10,-58},{-10,-72}},
46+
lineColor={255,170,255},
47+
fillColor={255,170,255},
48+
fillPattern=FillPattern.Solid),
49+
Polygon(
50+
points={{48,-72},{66,-72},{66,-66},{64,-54},{60,-44},{56,-34},{54,-28},{54,-16},{54,-8},{60,8},{62,12},{64,20},{66,30},{66,36},{82,36},{58,68},{58,68},{34,36},{50,36},{50,30},{48,24},{46,16},{42,8},{40,2},{38,-6},{38,-16},{38,-28},{40,-36},{44,-48},{48,-58},{48,-72}},
51+
lineColor={255,170,255},
52+
fillColor={255,170,255},
53+
fillPattern=FillPattern.Solid)}), Diagram(coordinateSystem(preserveAspectRatio=false)));
54+
end LMTDHeatExchange;

MetroscopeModelingLibrary/Power/HeatExchange/NTUHeatExchange.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ equation
7979
/* QCpMAX is associated to the mixed fluid, shell side, considered as hot side */
8080
QCpMAX = Q_hot*Cp_hot;
8181
QCpMIN = Q_cold*Cp_cold;
82-
assert(QCpMIN < QCpMAX, "QCPMIN is higher than QCpMAX", AssertionLevel.error);
82+
assert(QCpMIN < QCpMAX, "QCPMIN is higher than QCpMAX", AssertionLevel.warning);
8383
epsilon = (1 - exp(-Cr*(1 - exp(-NTU))))/Cr;
8484
else
8585
/* QCpMAX is associated to the unmixed fluid, tube side, considered as cold side */
8686
QCpMIN = Q_hot*Cp_hot;
8787
QCpMAX = Q_cold*Cp_cold;
88-
assert(QCpMIN < QCpMAX, "QCPMIN is higher than QCpMAX", AssertionLevel.error);
88+
assert(QCpMIN < QCpMAX, "QCPMIN is higher than QCpMAX", AssertionLevel.warning);
8989
epsilon = 1 - exp(-(1 - exp(-Cr*NTU))/Cr);
9090
end if;
9191

0 commit comments

Comments
 (0)