From 465e7d4136b8d432d635b8ffb54c2bad89eef1f2 Mon Sep 17 00:00:00 2001 From: Helene Vernier Date: Wed, 27 Jul 2022 15:12:24 +0200 Subject: [PATCH 01/13] added : LMTD heat exchange function, LMTDfuelHeater componenent and unit test --- .../MultiFluid/HeatExchangers/FuelHeater.mo | 14 +-- .../HeatExchangers/LMTDFuelHeater.mo | 101 ++++++++++++++++++ .../MultiFluid/HeatExchangers/package.order | 1 + .../Power/HeatExchange/LMTDHeatExchange.mo | 56 ++++++++++ .../Power/HeatExchange/package.order | 1 + .../HeatExchangers/FuelHeater_reverse.mo | 34 +++--- .../HeatExchangers/LMTDFuelHeater_reverse.mo | 75 +++++++++++++ .../Multifluid/HeatExchangers/package.order | 1 + ...HeatExchange_monophasic_counter_current.mo | 18 ++++ .../Tests/Power/HeatExchange/package.order | 1 + 10 files changed, 279 insertions(+), 23 deletions(-) create mode 100644 MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo create mode 100644 MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo create mode 100644 MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo create mode 100644 MetroscopeModelingLibrary/Tests/Power/HeatExchange/LMTD_HeatExchange_monophasic_counter_current.mo diff --git a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/FuelHeater.mo b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/FuelHeater.mo index cbab86ca..35c210f4 100644 --- a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/FuelHeater.mo +++ b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/FuelHeater.mo @@ -28,8 +28,8 @@ model FuelHeater // Initialization parameters parameter Units.MassFlowRate Q_cold_0 = 500; parameter Units.MassFlowRate Q_hot_0 = 50; - parameter Units.Temperature T_cold_in_0 = 76 + 273.15; - parameter Units.Pressure P_cold_in_0 = 18 *1e5; + parameter Units.Temperature T_hot_in_0 = 76 + 273.15; + parameter Units.Pressure P_hot_in_0 = 18 *1e5; Fuel.Connectors.Inlet C_cold_in annotation (Placement(transformation(extent={{-80,-10},{-60,10}}), iconTransformation(extent={{-80,-10},{-60,10}}))); Fuel.Connectors.Outlet C_cold_out annotation (Placement(transformation(extent={{60,-10},{80,10}}), iconTransformation(extent={{60,-10},{80,10}}))); @@ -39,18 +39,18 @@ model FuelHeater Power.HeatExchange.NTUHeatExchange HX( config=HX_config, QCp_max_side=QCp_max_side, - T_cold_in_0=T_cold_in_0) annotation (Placement(transformation( + T_hot_in_0=T_hot_in_0) annotation (Placement(transformation( extent={{-10,10},{10,-10}}, rotation=0, origin={10,14}))); WaterSteam.BaseClasses.IsoPFlowModel hot_side( - Q_0=Q_cold_0, - T_in_0=T_cold_in_0, - P_in_0=P_cold_in_0) annotation (Placement(transformation( + Q_0=Q_hot_0, + T_in_0=T_hot_in_0, + P_in_0=P_hot_in_0) annotation (Placement(transformation( extent={{10,10},{-10,-10}}, rotation=0, origin={10,28}))); - WaterSteam.Pipes.Pipe hot_side_pipe(Q_0=Q_cold_0, T_in_0=T_cold_in_0) annotation (Placement(transformation( + WaterSteam.Pipes.Pipe hot_side_pipe(Q_0=Q_hot_0, T_in_0=T_hot_in_0) annotation (Placement(transformation( extent={{10,-10},{-10,10}}, rotation=90, origin={-14,-24}))); diff --git a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo new file mode 100644 index 00000000..d03862c0 --- /dev/null +++ b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo @@ -0,0 +1,101 @@ +within MetroscopeModelingLibrary.MultiFluid.HeatExchangers; +model LMTDFuelHeater + + extends MetroscopeModelingLibrary.Icons.KeepingScaleIcon; + package WaterSteamMedium = MetroscopeModelingLibrary.Media.WaterSteamMedium; + package FuelMedium = MetroscopeModelingLibrary.Media.FuelMedium; + import MetroscopeModelingLibrary.Units; + import MetroscopeModelingLibrary.Units.Inputs; + + // Pressure Losses + Inputs.InputFrictionCoefficient Kfr_cold; + Inputs.InputFrictionCoefficient Kfr_hot; + + // Heating + Inputs.InputArea S; + Inputs.InputHeatExchangeCoefficient Kth; + Units.Power W; + + // Definitions + Units.MassFlowRate Q_cold; + Units.MassFlowRate Q_hot; + Units.Temperature T_cold_in; + Units.Temperature T_cold_out; + Units.Temperature T_hot_in; + Units.Temperature T_hot_out; + + // Initialization parameters + parameter Units.MassFlowRate Q_cold_0 = 12; + parameter Units.MassFlowRate Q_hot_0 = 8.6; + parameter Units.Temperature T_cold_in_0 = 29.5 + 273.15; + parameter Units.Temperature T_hot_in_0 = 230 +273.15; + parameter Units.Pressure P_cold_in_0 = 29.7 *1e5; + parameter Units.Pressure P_hot_in_0 = 47 *1e5; + + Power.HeatExchange.LMTDHeatExchange HX( + T_cold_in_0=T_cold_in_0) annotation (Placement(transformation( + extent={{-10,10},{10,-10}}, + rotation=0, + origin={10,14}))); + WaterSteam.BaseClasses.IsoPFlowModel hot_side( + Q_0=Q_hot_0, + T_in_0=T_hot_in_0, + P_in_0=P_hot_in_0) annotation (Placement(transformation( + extent={{10,10},{-10,-10}}, + rotation=0, + origin={10,28}))); + WaterSteam.Pipes.Pipe hot_side_pipe(Q_0=Q_hot_0, T_in_0=T_hot_in_0) annotation (Placement(transformation( + extent={{10,-10},{-10,10}}, + rotation=90, + origin={-14,-24}))); + Fuel.Pipes.Pipe cold_side_pipe annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); + Fuel.BaseClasses.IsoPFlowModel cold_side annotation (Placement(transformation(extent={{0,-10},{20,10}}))); + Fuel.Connectors.Inlet C_cold_in annotation (Placement(transformation(extent={{-80,-10},{-60,10}}), iconTransformation(extent={{-80,-10},{-60,10}}))); + Fuel.Connectors.Outlet C_cold_out annotation (Placement(transformation(extent={{60,-10},{80,10}}), iconTransformation(extent={{60,-10},{80,10}}))); + WaterSteam.Connectors.Inlet C_hot_in annotation (Placement(transformation(extent={{30,60},{50,80}}), iconTransformation(extent={{30,60},{50,80}}))); + WaterSteam.Connectors.Outlet C_hot_out annotation (Placement(transformation(extent={{-50,-80},{-30,-60}}), + iconTransformation(extent={{-50,-80},{-30,-60}}))); +equation + // Definitions + Q_cold = cold_side.Q; + Q_hot = hot_side.Q; + T_cold_in = cold_side.T_in; + T_cold_out = cold_side.T_out; + T_hot_in = hot_side.T_in; + T_hot_out = hot_side.T_out; + cold_side.W = W; + + // Energy balance + hot_side.W + cold_side.W = 0; + + // Pressure losses + cold_side_pipe.delta_z = 0; + cold_side_pipe.Kfr = Kfr_cold; + hot_side_pipe.delta_z = 0; + hot_side_pipe.Kfr = Kfr_hot; + + // Power Exchange + HX.W = W; + HX.S = S; + HX.Kth = Kth; + HX.T_cold_in = T_cold_in; + HX.T_hot_in = T_hot_in; + HX.T_cold_out = T_cold_out; + HX.T_hot_out = T_hot_out; + connect(hot_side_pipe.C_out,C_hot_out) annotation (Line(points={{-14,-34},{-14,-70},{-40,-70}}, color={28,108,200})); + connect(hot_side_pipe.C_in,hot_side. C_out) annotation (Line(points={{-14,-14},{-14,28},{0,28}},color={28,108,200})); + connect(hot_side.C_in,C_hot_in) annotation (Line(points={{20,28},{40,28},{40,70}}, color={28,108,200})); + connect(cold_side_pipe.C_in,C_cold_in) annotation (Line(points={{-52,0},{-70,0}}, color={213,213,0})); + connect(cold_side_pipe.C_out,cold_side. C_in) annotation (Line(points={{-32,0},{0,0}}, color={213,213,0})); + connect(cold_side.C_out,C_cold_out) annotation (Line(points={{20,0},{70,0}}, color={213,213,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Rectangle( + extent={{-70,50},{70,-50}}, + lineColor={0,0,0}, + fillColor={226,230,140}, + fillPattern=FillPattern.Solid), Line( + points={{40,66},{40,-60},{20,-60},{20,64},{0,64},{0,-60},{-20,-60},{-20,65.6309},{-40,66},{-40,-66}}, + color={28,108,200}, + thickness=1, + smooth=Smooth.Bezier)}), Diagram(coordinateSystem(preserveAspectRatio=false))); +end LMTDFuelHeater; diff --git a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/package.order b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/package.order index 0ce766a3..5010c3c9 100644 --- a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/package.order +++ b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/package.order @@ -2,3 +2,4 @@ Economiser Superheater Evaporator FuelHeater +LMTDFuelHeater diff --git a/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo b/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo new file mode 100644 index 00000000..91b8dc01 --- /dev/null +++ b/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo @@ -0,0 +1,56 @@ +within MetroscopeModelingLibrary.Power.HeatExchange; +model LMTDHeatExchange + import MetroscopeModelingLibrary.Units.Inputs; + import MetroscopeModelingLibrary.Units; + + // Initialization parameters + parameter Units.Temperature T_hot_in_0 = 273.15 + 200 "Init parameter for Hot mass flow rate at the inlet"; + parameter Units.Temperature T_cold_in_0 = 273.15 + 100 "Init parameter for Cold mass flow rate at the inlet"; + parameter Units.Temperature T_hot_out_0 = 273.15 + 200 "Init parameter for Hot mass flow rate at the outlet"; + parameter Units.Temperature T_cold_out_0 = 273.15 + 100 "Init parameter for Cold mass flow rate at the outlet"; + parameter Units.Area S_0 = 100 "init parameter for Heat exchange surface"; + parameter Units.HeatExchangeCoefficient Kth_0 = 5000 "init parameter for Heat exchange coefficient"; + + /* Exchanger configuration and parameters */ + //parameter String config = "LMTD_monophasic_counter_current"; No need for parameter as long as there is only one configuration !! + Inputs.InputArea S(start=S_0) "Heat exchange surface"; + Inputs.InputHeatExchangeCoefficient Kth(start=Kth_0) "Heat exchange coefficient"; + + /* Exchanger output */ + Units.Power W(start=1e4); + + /* Exchanger boundary conditions */ + Inputs.InputTemperature T_hot_in(start=T_hot_in_0) "Temperature, hot side, at the inlet"; + Inputs.InputTemperature T_cold_in(start=T_cold_in_0) "Temperature, cold side, at the inlet"; + Inputs.InputTemperature T_hot_out(start=T_hot_out_0) "Temperature, hot side, at the outlet"; + Inputs.InputTemperature T_cold_out(start=T_cold_out_0) "Temperature, cold side, at the outlet"; + + // intermediate variables + Real dT_a(start = 15); + Real dT_b(start=1); +equation + + dT_a = T_hot_in - T_cold_out; + dT_b = T_hot_out - T_cold_in; + + // Log mean equation written in an exponential way + 0 = - dT_a + dT_b * exp(Kth*S*(dT_a - dT_b)/W); + + + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Polygon( + 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}}, + lineColor={255,170,255}, + fillColor={255,170,255}, + fillPattern=FillPattern.Solid), + Polygon( + 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}}, + lineColor={255,170,255}, + fillColor={255,170,255}, + fillPattern=FillPattern.Solid), + Polygon( + 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}}, + lineColor={255,170,255}, + fillColor={255,170,255}, + fillPattern=FillPattern.Solid)}), Diagram(coordinateSystem(preserveAspectRatio=false))); +end LMTDHeatExchange; diff --git a/MetroscopeModelingLibrary/Power/HeatExchange/package.order b/MetroscopeModelingLibrary/Power/HeatExchange/package.order index 1f3a3b41..5a7be702 100644 --- a/MetroscopeModelingLibrary/Power/HeatExchange/package.order +++ b/MetroscopeModelingLibrary/Power/HeatExchange/package.order @@ -1 +1,2 @@ NTUHeatExchange +LMTDHeatExchange diff --git a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/FuelHeater_reverse.mo b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/FuelHeater_reverse.mo index f7412ff4..2fd0ec57 100644 --- a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/FuelHeater_reverse.mo +++ b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/FuelHeater_reverse.mo @@ -2,14 +2,14 @@ within MetroscopeModelingLibrary.Tests.Multifluid.HeatExchangers; model FuelHeater_reverse extends MetroscopeModelingLibrary.Icons.Tests.MultifluidTestIcon; // Boundary conditions - input Real P_hot_source(start=20, min=0, nominal=10) "barA"; - input Units.MassFlowRate Q_hot_source(start=50) "kg/s"; - input Real T_hot_source(start=50) "J/kg"; + input Real P_hot_source(start=47, min=0, nominal=10) "barA"; + input Units.MassFlowRate Q_hot_source(start=8) "kg/s"; + input Real T_hot_source(start=230) "J/kg"; - input Real P_cold_source(start=20, min=0, nominal=10) "barA"; - input Units.MassFlowRate Q_cold_source(start=100) "kg/s"; - //input Real T_cold_source(start = 50, min = 0, nominal = 50) "degC"; - input Units.SpecificEnthalpy h_cold_source(start=1e6) "J/kg"; + input Real P_cold_source(start=30, min=0, nominal=10) "barA"; + input Units.MassFlowRate Q_cold_source(start=12) "kg/s"; + input Real T_cold_source(start = 30, min = 0, nominal = 50) "degC"; + //input Units.SpecificEnthalpy h_cold_source(start=1e6) "J/kg"; // Parameters parameter String QCp_max_side = "hot"; parameter Units.Area S = 100; @@ -20,9 +20,10 @@ model FuelHeater_reverse output Units.FrictionCoefficient Kfr_cold; // Calibration inputs - input Real P_cold_out(start = 19, min= 0, nominal = 10) "barA"; // Outlet pressure on cold side, to calibrate Kfr cold - input Real P_hot_out(start = 50, min = 0, nominal = 10) "barA"; // Outlet pressure on hot side, to calibrate Kfr hot - input Real T_hot_out(start = 55, min = 0, nominal = 100) "degC"; // Outlet temperature on cold side, to calibrate Kth + input Real P_cold_out(start = 30, min= 0, nominal = 10) "barA"; // Outlet pressure on cold side, to calibrate Kfr cold + input Real P_hot_out(start = 47, min = 0, nominal = 10) "barA"; // Outlet pressure on hot side, to calibrate Kfr hot + //input Real T_hot_out(start = 80, min = 0, nominal = 100) "degC"; // Outlet temperature on cold side, to calibrate Kth + input Real T_cold_out(start = 200, nominal = 200); MultiFluid.HeatExchangers.FuelHeater fuelHeater(QCp_max_side = QCp_max_side) annotation (Placement(transformation(extent={{-38,-34},{38,34}}))); MetroscopeModelingLibrary.WaterSteam.BoundaryConditions.Source hot_source annotation (Placement(transformation( @@ -47,11 +48,11 @@ model FuelHeater_reverse equation // Boundary conditions hot_source.P_out = P_hot_source * 1e5; - hot_source.T_out = T_hot_source; + hot_source.T_out = T_hot_source+273.15; hot_source.Q_out = - Q_hot_source; cold_source.P_out = P_cold_source *1e5; - //cold_source.T_out = 273.15 + T_cold_source; - cold_source.h_out = h_cold_source; + cold_source.T_out = 273.15 + T_cold_source; + //cold_source.h_out = h_cold_source; cold_source.Q_out = - Q_cold_source; cold_source.Xi_out = {0.92,0.048,0.005,0.002,0.015,0.01}; @@ -59,7 +60,8 @@ equation fuelHeater.S = S; // Inputs for calibration - T_hot_out_sensor.T_degC = T_hot_out; + //T_hot_out_sensor.T_degC = T_hot_out; + cold_sink.T_in = T_cold_out +273.15; P_cold_out_sensor.P_barA = P_cold_out; P_hot_out_sensor.P_barA = P_hot_out; @@ -68,11 +70,11 @@ equation fuelHeater.Kfr_hot = Kfr_hot; fuelHeater.Kfr_cold = Kfr_cold; - connect(fuelHeater.C_hot_in, hot_source.C_out) annotation (Line(points={{11.4,23.8},{12,23.8},{12,45}}, color={28,108,200})); + connect(fuelHeater.C_hot_in, hot_source.C_out) annotation (Line(points={{15.2,23.8},{12,23.8},{12,45}}, color={28,108,200})); connect(fuelHeater.C_cold_in, cold_source.C_out) annotation (Line(points={{-26.6,0},{-51,0}}, color={213,213,0})); connect(fuelHeater.C_cold_out, P_cold_out_sensor.C_in) annotation (Line(points={{26.6,0},{46,0}}, color={213,213,0})); connect(cold_sink.C_in, P_cold_out_sensor.C_out) annotation (Line(points={{79,0},{66,0}}, color={213,213,0})); - connect(fuelHeater.C_hot_out, T_hot_out_sensor.C_in) annotation (Line(points={{-11.4,23.8},{-11.4,27.9},{-12,27.9},{-12,32}}, color={28,108,200})); + connect(fuelHeater.C_hot_out, T_hot_out_sensor.C_in) annotation (Line(points={{-15.2,-23.8},{-15.2,27.9},{-12,27.9},{-12,32}},color={28,108,200})); connect(T_hot_out_sensor.C_out, P_hot_out_sensor.C_in) annotation (Line(points={{-12,52},{-12,58}}, color={28,108,200})); connect(hot_sink.C_in, P_hot_out_sensor.C_out) annotation (Line(points={{-12,85},{-12,78}}, color={28,108,200})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); diff --git a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo new file mode 100644 index 00000000..c9839c2e --- /dev/null +++ b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo @@ -0,0 +1,75 @@ +within MetroscopeModelingLibrary.Tests.Multifluid.HeatExchangers; +model LMTDFuelHeater_reverse + extends MetroscopeModelingLibrary.Icons.Tests.MultifluidTestIcon; + // Boundary conditions + input Real P_hot_source(start=47, min=0, nominal=10) "barA"; + input Units.MassFlowRate Q_hot_source(start=8.6) "kg/s"; + input Real T_hot_source(start=230) "J/kg"; + + input Real P_cold_source(start=30, min=0, nominal=10) "barA"; + input Units.MassFlowRate Q_cold_source(start=12) "kg/s"; + input Real T_cold_source(start = 30, min = 0, nominal = 50) "degC"; + //input Units.SpecificEnthalpy h_cold_source(start=1e6) "J/kg"; + // Parameters + parameter Units.Area S = 100; + + // Calibrated parameters + output Units.HeatExchangeCoefficient Kth; + output Units.FrictionCoefficient Kfr_hot; + output Units.FrictionCoefficient Kfr_cold; + + // Calibration inputs + input Real P_cold_out(start = 30, min= 0, nominal = 10) "barA"; // Outlet pressure on cold side, to calibrate Kfr cold + input Real P_hot_out(start = 47, min = 0, nominal = 10) "barA"; // Outlet pressure on hot side, to calibrate Kfr hot + //input Real T_hot_out(start = 80, min = 0, nominal = 100) "degC"; // Outlet temperature on cold side, to calibrate Kth + input Real T_cold_out(start = 200, nominal = 200); + MultiFluid.HeatExchangers.LMTDFuelHeater + lMTDFuelHeater annotation (Placement(transformation(extent={{-36,-34},{40,34}}))); + MetroscopeModelingLibrary.WaterSteam.BoundaryConditions.Source hot_source annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=270, + origin={18,50}))); + MetroscopeModelingLibrary.WaterSteam.BoundaryConditions.Sink hot_sink annotation (Placement(transformation( + extent={{10,-10},{-10,10}}, + rotation=90, + origin={-12,-92}))); + MetroscopeModelingLibrary.Fuel.BoundaryConditions.Source cold_source annotation (Placement(transformation(extent={{-64,-10},{-44,10}}))); + MetroscopeModelingLibrary.Fuel.BoundaryConditions.Sink cold_sink annotation (Placement(transformation(extent={{76,-10},{96,10}}))); + MetroscopeModelingLibrary.Sensors.Fuel.PressureSensor P_cold_out_sensor annotation (Placement(transformation(extent={{36,-10},{56,10}}))); + MetroscopeModelingLibrary.Sensors.WaterSteam.PressureSensor P_hot_out_sensor annotation (Placement(transformation( + extent={{10,-10},{-10,10}}, + rotation=90, + origin={-12,-70}))); + MetroscopeModelingLibrary.Sensors.Fuel.TemperatureSensor T_cold_out_sensor annotation (Placement(transformation(extent={{58,-10},{78,10}}))); +equation + // Boundary conditions + hot_source.P_out = P_hot_source * 1e5; + hot_source.T_out = T_hot_source+273.15; + hot_source.Q_out = - Q_hot_source; + cold_source.P_out = P_cold_source *1e5; + cold_source.T_out = 273.15 + T_cold_source; + cold_source.Q_out = - Q_cold_source; + cold_source.Xi_out = {0.92,0.048,0.005,0.002,0.015,0.01}; + + // Parameters + lMTDFuelHeater.S = S; + + // Inputs for calibration + T_cold_out_sensor.T_degC = T_cold_out; + P_cold_out_sensor.P_barA = P_cold_out; + P_hot_out_sensor.P_barA = P_hot_out; + + // Calibrated parameters + lMTDFuelHeater.Kth = Kth; + lMTDFuelHeater.Kfr_hot = Kfr_hot; + lMTDFuelHeater.Kfr_cold = Kfr_cold; + connect(lMTDFuelHeater.C_hot_in, hot_source.C_out) annotation (Line(points={{17.2,23.8},{18,23.8},{18,45}}, color={28,108,200})); + connect(lMTDFuelHeater.C_cold_in, cold_source.C_out) annotation (Line(points={{-24.6,0},{-49,0}}, color={213,213,0})); + connect(lMTDFuelHeater.C_cold_out, P_cold_out_sensor.C_in) annotation (Line(points={{28.6,0},{36,0}}, color={213,213,0})); + connect(hot_sink.C_in,P_hot_out_sensor. C_out) annotation (Line(points={{-12,-87},{-12,-80}}, + color={28,108,200})); + connect(lMTDFuelHeater.C_hot_out, P_hot_out_sensor.C_in) annotation (Line(points={{-13.2,-23.8},{-12,-23.8},{-12,-60}}, color={28,108,200})); + connect(cold_sink.C_in, T_cold_out_sensor.C_out) annotation (Line(points={{81,0},{78,0}}, color={213,213,0})); + connect(T_cold_out_sensor.C_in, P_cold_out_sensor.C_out) annotation (Line(points={{58,0},{56,0}}, color={213,213,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end LMTDFuelHeater_reverse; diff --git a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/package.order b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/package.order index e30445c4..3a3e9c99 100644 --- a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/package.order +++ b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/package.order @@ -6,3 +6,4 @@ Evaporator_direct Evaporator_reverse FuelHeater_direct FuelHeater_reverse +LMTDFuelHeater_reverse diff --git a/MetroscopeModelingLibrary/Tests/Power/HeatExchange/LMTD_HeatExchange_monophasic_counter_current.mo b/MetroscopeModelingLibrary/Tests/Power/HeatExchange/LMTD_HeatExchange_monophasic_counter_current.mo new file mode 100644 index 00000000..be89471b --- /dev/null +++ b/MetroscopeModelingLibrary/Tests/Power/HeatExchange/LMTD_HeatExchange_monophasic_counter_current.mo @@ -0,0 +1,18 @@ +within MetroscopeModelingLibrary.Tests.Power.HeatExchange; +model LMTD_HeatExchange_monophasic_counter_current + extends MetroscopeModelingLibrary.Icons.Tests.PowerTestIcon; + + MetroscopeModelingLibrary.Power.HeatExchange.LMTDHeatExchange LMTDHeatExchange; +equation + LMTDHeatExchange.Kth = 1000; + LMTDHeatExchange.S = 100; + + // Cold Side + LMTDHeatExchange.T_cold_in = 273.15 + 30; + LMTDHeatExchange.T_cold_out = 273.15 + 200; + + // Hot Side + LMTDHeatExchange.T_hot_in = 273.15 + 230; + LMTDHeatExchange.T_hot_out = 273.15 + 80; + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end LMTD_HeatExchange_monophasic_counter_current; diff --git a/MetroscopeModelingLibrary/Tests/Power/HeatExchange/package.order b/MetroscopeModelingLibrary/Tests/Power/HeatExchange/package.order index 8c2f5aa9..9d4d67b6 100644 --- a/MetroscopeModelingLibrary/Tests/Power/HeatExchange/package.order +++ b/MetroscopeModelingLibrary/Tests/Power/HeatExchange/package.order @@ -2,3 +2,4 @@ NTU_HeatExchanger_shell_and_tubes NTU_HeatExchanger_monophasic_cross_current NTU_HeatExchanger_condenser NTU_HeatExchanger_evaporator +LMTD_HeatExchange_monophasic_counter_current From 6328269638f7ee370c7af1393b32ddc4f3014c7a Mon Sep 17 00:00:00 2001 From: hvernier <98099701+hvernier@users.noreply.github.com> Date: Wed, 27 Jul 2022 15:18:51 +0200 Subject: [PATCH 02/13] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a57075ec..5ad03937 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Ordered nuclear examples into subpackages called with power plant system names, [PR#219](https://github.com/Metroscope-dev/metroscope-modeling-library/pull/219) ### Added + - Added `LMTDHeatExchange`function, `LMTDfuelHeater`component and reverse unit test. [PR #266](https://github.com/Metroscope-dev/metroscope-modeling-library/pull/266) - 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) - Added `Mlb/h` unit in flow sensor [PR #240](https://github.com/Metroscope-dev/metroscope-modeling-library/pull/240) - Added LP turbine with nozzle and condenser example [PR#224](https://github.com/Metroscope-dev/metroscope-modeling-library/pull/224) From 73811c63468bd103eca8ae204ce5b722f1fedec8 Mon Sep 17 00:00:00 2001 From: Helene Vernier Date: Wed, 27 Jul 2022 15:12:24 +0200 Subject: [PATCH 03/13] added : LMTD heat exchange function, LMTDfuelHeater componenent and unit test --- .../MultiFluid/HeatExchangers/FuelHeater.mo | 14 +-- .../HeatExchangers/LMTDFuelHeater.mo | 101 ++++++++++++++++++ .../MultiFluid/HeatExchangers/package.order | 1 + .../Power/HeatExchange/LMTDHeatExchange.mo | 56 ++++++++++ .../Power/HeatExchange/package.order | 1 + .../HeatExchangers/FuelHeater_reverse.mo | 30 +++--- .../HeatExchangers/LMTDFuelHeater_reverse.mo | 75 +++++++++++++ .../Multifluid/HeatExchangers/package.order | 1 + ...HeatExchange_monophasic_counter_current.mo | 18 ++++ .../Tests/Power/HeatExchange/package.order | 1 + 10 files changed, 277 insertions(+), 21 deletions(-) create mode 100644 MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo create mode 100644 MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo create mode 100644 MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo create mode 100644 MetroscopeModelingLibrary/Tests/Power/HeatExchange/LMTD_HeatExchange_monophasic_counter_current.mo diff --git a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/FuelHeater.mo b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/FuelHeater.mo index cbab86ca..35c210f4 100644 --- a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/FuelHeater.mo +++ b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/FuelHeater.mo @@ -28,8 +28,8 @@ model FuelHeater // Initialization parameters parameter Units.MassFlowRate Q_cold_0 = 500; parameter Units.MassFlowRate Q_hot_0 = 50; - parameter Units.Temperature T_cold_in_0 = 76 + 273.15; - parameter Units.Pressure P_cold_in_0 = 18 *1e5; + parameter Units.Temperature T_hot_in_0 = 76 + 273.15; + parameter Units.Pressure P_hot_in_0 = 18 *1e5; Fuel.Connectors.Inlet C_cold_in annotation (Placement(transformation(extent={{-80,-10},{-60,10}}), iconTransformation(extent={{-80,-10},{-60,10}}))); Fuel.Connectors.Outlet C_cold_out annotation (Placement(transformation(extent={{60,-10},{80,10}}), iconTransformation(extent={{60,-10},{80,10}}))); @@ -39,18 +39,18 @@ model FuelHeater Power.HeatExchange.NTUHeatExchange HX( config=HX_config, QCp_max_side=QCp_max_side, - T_cold_in_0=T_cold_in_0) annotation (Placement(transformation( + T_hot_in_0=T_hot_in_0) annotation (Placement(transformation( extent={{-10,10},{10,-10}}, rotation=0, origin={10,14}))); WaterSteam.BaseClasses.IsoPFlowModel hot_side( - Q_0=Q_cold_0, - T_in_0=T_cold_in_0, - P_in_0=P_cold_in_0) annotation (Placement(transformation( + Q_0=Q_hot_0, + T_in_0=T_hot_in_0, + P_in_0=P_hot_in_0) annotation (Placement(transformation( extent={{10,10},{-10,-10}}, rotation=0, origin={10,28}))); - WaterSteam.Pipes.Pipe hot_side_pipe(Q_0=Q_cold_0, T_in_0=T_cold_in_0) annotation (Placement(transformation( + WaterSteam.Pipes.Pipe hot_side_pipe(Q_0=Q_hot_0, T_in_0=T_hot_in_0) annotation (Placement(transformation( extent={{10,-10},{-10,10}}, rotation=90, origin={-14,-24}))); diff --git a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo new file mode 100644 index 00000000..d03862c0 --- /dev/null +++ b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo @@ -0,0 +1,101 @@ +within MetroscopeModelingLibrary.MultiFluid.HeatExchangers; +model LMTDFuelHeater + + extends MetroscopeModelingLibrary.Icons.KeepingScaleIcon; + package WaterSteamMedium = MetroscopeModelingLibrary.Media.WaterSteamMedium; + package FuelMedium = MetroscopeModelingLibrary.Media.FuelMedium; + import MetroscopeModelingLibrary.Units; + import MetroscopeModelingLibrary.Units.Inputs; + + // Pressure Losses + Inputs.InputFrictionCoefficient Kfr_cold; + Inputs.InputFrictionCoefficient Kfr_hot; + + // Heating + Inputs.InputArea S; + Inputs.InputHeatExchangeCoefficient Kth; + Units.Power W; + + // Definitions + Units.MassFlowRate Q_cold; + Units.MassFlowRate Q_hot; + Units.Temperature T_cold_in; + Units.Temperature T_cold_out; + Units.Temperature T_hot_in; + Units.Temperature T_hot_out; + + // Initialization parameters + parameter Units.MassFlowRate Q_cold_0 = 12; + parameter Units.MassFlowRate Q_hot_0 = 8.6; + parameter Units.Temperature T_cold_in_0 = 29.5 + 273.15; + parameter Units.Temperature T_hot_in_0 = 230 +273.15; + parameter Units.Pressure P_cold_in_0 = 29.7 *1e5; + parameter Units.Pressure P_hot_in_0 = 47 *1e5; + + Power.HeatExchange.LMTDHeatExchange HX( + T_cold_in_0=T_cold_in_0) annotation (Placement(transformation( + extent={{-10,10},{10,-10}}, + rotation=0, + origin={10,14}))); + WaterSteam.BaseClasses.IsoPFlowModel hot_side( + Q_0=Q_hot_0, + T_in_0=T_hot_in_0, + P_in_0=P_hot_in_0) annotation (Placement(transformation( + extent={{10,10},{-10,-10}}, + rotation=0, + origin={10,28}))); + WaterSteam.Pipes.Pipe hot_side_pipe(Q_0=Q_hot_0, T_in_0=T_hot_in_0) annotation (Placement(transformation( + extent={{10,-10},{-10,10}}, + rotation=90, + origin={-14,-24}))); + Fuel.Pipes.Pipe cold_side_pipe annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); + Fuel.BaseClasses.IsoPFlowModel cold_side annotation (Placement(transformation(extent={{0,-10},{20,10}}))); + Fuel.Connectors.Inlet C_cold_in annotation (Placement(transformation(extent={{-80,-10},{-60,10}}), iconTransformation(extent={{-80,-10},{-60,10}}))); + Fuel.Connectors.Outlet C_cold_out annotation (Placement(transformation(extent={{60,-10},{80,10}}), iconTransformation(extent={{60,-10},{80,10}}))); + WaterSteam.Connectors.Inlet C_hot_in annotation (Placement(transformation(extent={{30,60},{50,80}}), iconTransformation(extent={{30,60},{50,80}}))); + WaterSteam.Connectors.Outlet C_hot_out annotation (Placement(transformation(extent={{-50,-80},{-30,-60}}), + iconTransformation(extent={{-50,-80},{-30,-60}}))); +equation + // Definitions + Q_cold = cold_side.Q; + Q_hot = hot_side.Q; + T_cold_in = cold_side.T_in; + T_cold_out = cold_side.T_out; + T_hot_in = hot_side.T_in; + T_hot_out = hot_side.T_out; + cold_side.W = W; + + // Energy balance + hot_side.W + cold_side.W = 0; + + // Pressure losses + cold_side_pipe.delta_z = 0; + cold_side_pipe.Kfr = Kfr_cold; + hot_side_pipe.delta_z = 0; + hot_side_pipe.Kfr = Kfr_hot; + + // Power Exchange + HX.W = W; + HX.S = S; + HX.Kth = Kth; + HX.T_cold_in = T_cold_in; + HX.T_hot_in = T_hot_in; + HX.T_cold_out = T_cold_out; + HX.T_hot_out = T_hot_out; + connect(hot_side_pipe.C_out,C_hot_out) annotation (Line(points={{-14,-34},{-14,-70},{-40,-70}}, color={28,108,200})); + connect(hot_side_pipe.C_in,hot_side. C_out) annotation (Line(points={{-14,-14},{-14,28},{0,28}},color={28,108,200})); + connect(hot_side.C_in,C_hot_in) annotation (Line(points={{20,28},{40,28},{40,70}}, color={28,108,200})); + connect(cold_side_pipe.C_in,C_cold_in) annotation (Line(points={{-52,0},{-70,0}}, color={213,213,0})); + connect(cold_side_pipe.C_out,cold_side. C_in) annotation (Line(points={{-32,0},{0,0}}, color={213,213,0})); + connect(cold_side.C_out,C_cold_out) annotation (Line(points={{20,0},{70,0}}, color={213,213,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Rectangle( + extent={{-70,50},{70,-50}}, + lineColor={0,0,0}, + fillColor={226,230,140}, + fillPattern=FillPattern.Solid), Line( + points={{40,66},{40,-60},{20,-60},{20,64},{0,64},{0,-60},{-20,-60},{-20,65.6309},{-40,66},{-40,-66}}, + color={28,108,200}, + thickness=1, + smooth=Smooth.Bezier)}), Diagram(coordinateSystem(preserveAspectRatio=false))); +end LMTDFuelHeater; diff --git a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/package.order b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/package.order index dfb7bd7c..47578432 100644 --- a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/package.order +++ b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/package.order @@ -3,3 +3,4 @@ Superheater Evaporator FuelHeater HXmoistAirWater +LMTDFuelHeater diff --git a/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo b/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo new file mode 100644 index 00000000..91b8dc01 --- /dev/null +++ b/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo @@ -0,0 +1,56 @@ +within MetroscopeModelingLibrary.Power.HeatExchange; +model LMTDHeatExchange + import MetroscopeModelingLibrary.Units.Inputs; + import MetroscopeModelingLibrary.Units; + + // Initialization parameters + parameter Units.Temperature T_hot_in_0 = 273.15 + 200 "Init parameter for Hot mass flow rate at the inlet"; + parameter Units.Temperature T_cold_in_0 = 273.15 + 100 "Init parameter for Cold mass flow rate at the inlet"; + parameter Units.Temperature T_hot_out_0 = 273.15 + 200 "Init parameter for Hot mass flow rate at the outlet"; + parameter Units.Temperature T_cold_out_0 = 273.15 + 100 "Init parameter for Cold mass flow rate at the outlet"; + parameter Units.Area S_0 = 100 "init parameter for Heat exchange surface"; + parameter Units.HeatExchangeCoefficient Kth_0 = 5000 "init parameter for Heat exchange coefficient"; + + /* Exchanger configuration and parameters */ + //parameter String config = "LMTD_monophasic_counter_current"; No need for parameter as long as there is only one configuration !! + Inputs.InputArea S(start=S_0) "Heat exchange surface"; + Inputs.InputHeatExchangeCoefficient Kth(start=Kth_0) "Heat exchange coefficient"; + + /* Exchanger output */ + Units.Power W(start=1e4); + + /* Exchanger boundary conditions */ + Inputs.InputTemperature T_hot_in(start=T_hot_in_0) "Temperature, hot side, at the inlet"; + Inputs.InputTemperature T_cold_in(start=T_cold_in_0) "Temperature, cold side, at the inlet"; + Inputs.InputTemperature T_hot_out(start=T_hot_out_0) "Temperature, hot side, at the outlet"; + Inputs.InputTemperature T_cold_out(start=T_cold_out_0) "Temperature, cold side, at the outlet"; + + // intermediate variables + Real dT_a(start = 15); + Real dT_b(start=1); +equation + + dT_a = T_hot_in - T_cold_out; + dT_b = T_hot_out - T_cold_in; + + // Log mean equation written in an exponential way + 0 = - dT_a + dT_b * exp(Kth*S*(dT_a - dT_b)/W); + + + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Polygon( + 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}}, + lineColor={255,170,255}, + fillColor={255,170,255}, + fillPattern=FillPattern.Solid), + Polygon( + 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}}, + lineColor={255,170,255}, + fillColor={255,170,255}, + fillPattern=FillPattern.Solid), + Polygon( + 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}}, + lineColor={255,170,255}, + fillColor={255,170,255}, + fillPattern=FillPattern.Solid)}), Diagram(coordinateSystem(preserveAspectRatio=false))); +end LMTDHeatExchange; diff --git a/MetroscopeModelingLibrary/Power/HeatExchange/package.order b/MetroscopeModelingLibrary/Power/HeatExchange/package.order index 1f3a3b41..5a7be702 100644 --- a/MetroscopeModelingLibrary/Power/HeatExchange/package.order +++ b/MetroscopeModelingLibrary/Power/HeatExchange/package.order @@ -1 +1,2 @@ NTUHeatExchange +LMTDHeatExchange diff --git a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/FuelHeater_reverse.mo b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/FuelHeater_reverse.mo index acc9c19e..2fd0ec57 100644 --- a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/FuelHeater_reverse.mo +++ b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/FuelHeater_reverse.mo @@ -2,14 +2,14 @@ within MetroscopeModelingLibrary.Tests.Multifluid.HeatExchangers; model FuelHeater_reverse extends MetroscopeModelingLibrary.Icons.Tests.MultifluidTestIcon; // Boundary conditions - input Real P_hot_source(start=20, min=0, nominal=10) "barA"; - input Units.MassFlowRate Q_hot_source(start=50) "kg/s"; - input Real T_hot_source(start=50) "J/kg"; + input Real P_hot_source(start=47, min=0, nominal=10) "barA"; + input Units.MassFlowRate Q_hot_source(start=8) "kg/s"; + input Real T_hot_source(start=230) "J/kg"; - input Real P_cold_source(start=20, min=0, nominal=10) "barA"; - input Units.MassFlowRate Q_cold_source(start=100) "kg/s"; - //input Real T_cold_source(start = 50, min = 0, nominal = 50) "degC"; - input Units.SpecificEnthalpy h_cold_source(start=1e6) "J/kg"; + input Real P_cold_source(start=30, min=0, nominal=10) "barA"; + input Units.MassFlowRate Q_cold_source(start=12) "kg/s"; + input Real T_cold_source(start = 30, min = 0, nominal = 50) "degC"; + //input Units.SpecificEnthalpy h_cold_source(start=1e6) "J/kg"; // Parameters parameter String QCp_max_side = "hot"; parameter Units.Area S = 100; @@ -20,9 +20,10 @@ model FuelHeater_reverse output Units.FrictionCoefficient Kfr_cold; // Calibration inputs - input Real P_cold_out(start = 19, min= 0, nominal = 10) "barA"; // Outlet pressure on cold side, to calibrate Kfr cold - input Real P_hot_out(start = 50, min = 0, nominal = 10) "barA"; // Outlet pressure on hot side, to calibrate Kfr hot - input Real T_hot_out(start = 55, min = 0, nominal = 100) "degC"; // Outlet temperature on cold side, to calibrate Kth + input Real P_cold_out(start = 30, min= 0, nominal = 10) "barA"; // Outlet pressure on cold side, to calibrate Kfr cold + input Real P_hot_out(start = 47, min = 0, nominal = 10) "barA"; // Outlet pressure on hot side, to calibrate Kfr hot + //input Real T_hot_out(start = 80, min = 0, nominal = 100) "degC"; // Outlet temperature on cold side, to calibrate Kth + input Real T_cold_out(start = 200, nominal = 200); MultiFluid.HeatExchangers.FuelHeater fuelHeater(QCp_max_side = QCp_max_side) annotation (Placement(transformation(extent={{-38,-34},{38,34}}))); MetroscopeModelingLibrary.WaterSteam.BoundaryConditions.Source hot_source annotation (Placement(transformation( @@ -47,11 +48,11 @@ model FuelHeater_reverse equation // Boundary conditions hot_source.P_out = P_hot_source * 1e5; - hot_source.T_out = T_hot_source; + hot_source.T_out = T_hot_source+273.15; hot_source.Q_out = - Q_hot_source; cold_source.P_out = P_cold_source *1e5; - //cold_source.T_out = 273.15 + T_cold_source; - cold_source.h_out = h_cold_source; + cold_source.T_out = 273.15 + T_cold_source; + //cold_source.h_out = h_cold_source; cold_source.Q_out = - Q_cold_source; cold_source.Xi_out = {0.92,0.048,0.005,0.002,0.015,0.01}; @@ -59,7 +60,8 @@ equation fuelHeater.S = S; // Inputs for calibration - T_hot_out_sensor.T_degC = T_hot_out; + //T_hot_out_sensor.T_degC = T_hot_out; + cold_sink.T_in = T_cold_out +273.15; P_cold_out_sensor.P_barA = P_cold_out; P_hot_out_sensor.P_barA = P_hot_out; diff --git a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo new file mode 100644 index 00000000..c9839c2e --- /dev/null +++ b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo @@ -0,0 +1,75 @@ +within MetroscopeModelingLibrary.Tests.Multifluid.HeatExchangers; +model LMTDFuelHeater_reverse + extends MetroscopeModelingLibrary.Icons.Tests.MultifluidTestIcon; + // Boundary conditions + input Real P_hot_source(start=47, min=0, nominal=10) "barA"; + input Units.MassFlowRate Q_hot_source(start=8.6) "kg/s"; + input Real T_hot_source(start=230) "J/kg"; + + input Real P_cold_source(start=30, min=0, nominal=10) "barA"; + input Units.MassFlowRate Q_cold_source(start=12) "kg/s"; + input Real T_cold_source(start = 30, min = 0, nominal = 50) "degC"; + //input Units.SpecificEnthalpy h_cold_source(start=1e6) "J/kg"; + // Parameters + parameter Units.Area S = 100; + + // Calibrated parameters + output Units.HeatExchangeCoefficient Kth; + output Units.FrictionCoefficient Kfr_hot; + output Units.FrictionCoefficient Kfr_cold; + + // Calibration inputs + input Real P_cold_out(start = 30, min= 0, nominal = 10) "barA"; // Outlet pressure on cold side, to calibrate Kfr cold + input Real P_hot_out(start = 47, min = 0, nominal = 10) "barA"; // Outlet pressure on hot side, to calibrate Kfr hot + //input Real T_hot_out(start = 80, min = 0, nominal = 100) "degC"; // Outlet temperature on cold side, to calibrate Kth + input Real T_cold_out(start = 200, nominal = 200); + MultiFluid.HeatExchangers.LMTDFuelHeater + lMTDFuelHeater annotation (Placement(transformation(extent={{-36,-34},{40,34}}))); + MetroscopeModelingLibrary.WaterSteam.BoundaryConditions.Source hot_source annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=270, + origin={18,50}))); + MetroscopeModelingLibrary.WaterSteam.BoundaryConditions.Sink hot_sink annotation (Placement(transformation( + extent={{10,-10},{-10,10}}, + rotation=90, + origin={-12,-92}))); + MetroscopeModelingLibrary.Fuel.BoundaryConditions.Source cold_source annotation (Placement(transformation(extent={{-64,-10},{-44,10}}))); + MetroscopeModelingLibrary.Fuel.BoundaryConditions.Sink cold_sink annotation (Placement(transformation(extent={{76,-10},{96,10}}))); + MetroscopeModelingLibrary.Sensors.Fuel.PressureSensor P_cold_out_sensor annotation (Placement(transformation(extent={{36,-10},{56,10}}))); + MetroscopeModelingLibrary.Sensors.WaterSteam.PressureSensor P_hot_out_sensor annotation (Placement(transformation( + extent={{10,-10},{-10,10}}, + rotation=90, + origin={-12,-70}))); + MetroscopeModelingLibrary.Sensors.Fuel.TemperatureSensor T_cold_out_sensor annotation (Placement(transformation(extent={{58,-10},{78,10}}))); +equation + // Boundary conditions + hot_source.P_out = P_hot_source * 1e5; + hot_source.T_out = T_hot_source+273.15; + hot_source.Q_out = - Q_hot_source; + cold_source.P_out = P_cold_source *1e5; + cold_source.T_out = 273.15 + T_cold_source; + cold_source.Q_out = - Q_cold_source; + cold_source.Xi_out = {0.92,0.048,0.005,0.002,0.015,0.01}; + + // Parameters + lMTDFuelHeater.S = S; + + // Inputs for calibration + T_cold_out_sensor.T_degC = T_cold_out; + P_cold_out_sensor.P_barA = P_cold_out; + P_hot_out_sensor.P_barA = P_hot_out; + + // Calibrated parameters + lMTDFuelHeater.Kth = Kth; + lMTDFuelHeater.Kfr_hot = Kfr_hot; + lMTDFuelHeater.Kfr_cold = Kfr_cold; + connect(lMTDFuelHeater.C_hot_in, hot_source.C_out) annotation (Line(points={{17.2,23.8},{18,23.8},{18,45}}, color={28,108,200})); + connect(lMTDFuelHeater.C_cold_in, cold_source.C_out) annotation (Line(points={{-24.6,0},{-49,0}}, color={213,213,0})); + connect(lMTDFuelHeater.C_cold_out, P_cold_out_sensor.C_in) annotation (Line(points={{28.6,0},{36,0}}, color={213,213,0})); + connect(hot_sink.C_in,P_hot_out_sensor. C_out) annotation (Line(points={{-12,-87},{-12,-80}}, + color={28,108,200})); + connect(lMTDFuelHeater.C_hot_out, P_hot_out_sensor.C_in) annotation (Line(points={{-13.2,-23.8},{-12,-23.8},{-12,-60}}, color={28,108,200})); + connect(cold_sink.C_in, T_cold_out_sensor.C_out) annotation (Line(points={{81,0},{78,0}}, color={213,213,0})); + connect(T_cold_out_sensor.C_in, P_cold_out_sensor.C_out) annotation (Line(points={{58,0},{56,0}}, color={213,213,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end LMTDFuelHeater_reverse; diff --git a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/package.order b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/package.order index 840c17bb..b0c44cc5 100644 --- a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/package.order +++ b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/package.order @@ -7,3 +7,4 @@ Evaporator_reverse FuelHeater_direct FuelHeater_reverse HXmoistAirWater_reverse +LMTDFuelHeater_reverse diff --git a/MetroscopeModelingLibrary/Tests/Power/HeatExchange/LMTD_HeatExchange_monophasic_counter_current.mo b/MetroscopeModelingLibrary/Tests/Power/HeatExchange/LMTD_HeatExchange_monophasic_counter_current.mo new file mode 100644 index 00000000..be89471b --- /dev/null +++ b/MetroscopeModelingLibrary/Tests/Power/HeatExchange/LMTD_HeatExchange_monophasic_counter_current.mo @@ -0,0 +1,18 @@ +within MetroscopeModelingLibrary.Tests.Power.HeatExchange; +model LMTD_HeatExchange_monophasic_counter_current + extends MetroscopeModelingLibrary.Icons.Tests.PowerTestIcon; + + MetroscopeModelingLibrary.Power.HeatExchange.LMTDHeatExchange LMTDHeatExchange; +equation + LMTDHeatExchange.Kth = 1000; + LMTDHeatExchange.S = 100; + + // Cold Side + LMTDHeatExchange.T_cold_in = 273.15 + 30; + LMTDHeatExchange.T_cold_out = 273.15 + 200; + + // Hot Side + LMTDHeatExchange.T_hot_in = 273.15 + 230; + LMTDHeatExchange.T_hot_out = 273.15 + 80; + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end LMTD_HeatExchange_monophasic_counter_current; diff --git a/MetroscopeModelingLibrary/Tests/Power/HeatExchange/package.order b/MetroscopeModelingLibrary/Tests/Power/HeatExchange/package.order index 8c2f5aa9..9d4d67b6 100644 --- a/MetroscopeModelingLibrary/Tests/Power/HeatExchange/package.order +++ b/MetroscopeModelingLibrary/Tests/Power/HeatExchange/package.order @@ -2,3 +2,4 @@ NTU_HeatExchanger_shell_and_tubes NTU_HeatExchanger_monophasic_cross_current NTU_HeatExchanger_condenser NTU_HeatExchanger_evaporator +LMTD_HeatExchange_monophasic_counter_current From 874088dbf737cceb0fb7f5b94428103bd782ce84 Mon Sep 17 00:00:00 2001 From: Helene Vernier Date: Wed, 3 Aug 2022 09:47:01 +0200 Subject: [PATCH 04/13] =?UTF-8?q?mise=20=C3=A0=20jour=20du=20LMTDFuelHEate?= =?UTF-8?q?r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HeatExchangers/LMTDFuelHeater.mo | 17 ++++++++----- .../HeatExchangers/HXmoistAirWater_reverse.mo | 24 +++++++++---------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo index d03862c0..7220fb09 100644 --- a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo +++ b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo @@ -31,6 +31,10 @@ model LMTDFuelHeater parameter Units.Temperature T_hot_in_0 = 230 +273.15; parameter Units.Pressure P_cold_in_0 = 29.7 *1e5; parameter Units.Pressure P_hot_in_0 = 47 *1e5; + parameter Real h_hot_in_0 = 2e4; + parameter Real h_hot_out_0 = 1e4; + parameter Real h_cold_in_0 = 6e5; + parameter Real h_cold_out_0 = 1e6; Power.HeatExchange.LMTDHeatExchange HX( T_cold_in_0=T_cold_in_0) annotation (Placement(transformation( @@ -40,20 +44,21 @@ model LMTDFuelHeater WaterSteam.BaseClasses.IsoPFlowModel hot_side( Q_0=Q_hot_0, T_in_0=T_hot_in_0, - P_in_0=P_hot_in_0) annotation (Placement(transformation( + P_in_0=P_hot_in_0, + h_in_0 = h_hot_in_0) annotation (Placement(transformation( extent={{10,10},{-10,-10}}, rotation=0, origin={10,28}))); - WaterSteam.Pipes.Pipe hot_side_pipe(Q_0=Q_hot_0, T_in_0=T_hot_in_0) annotation (Placement(transformation( + WaterSteam.Pipes.Pipe hot_side_pipe(Q_0=Q_hot_0, T_in_0=T_hot_in_0,h_0=h_hot_in_0) annotation (Placement(transformation( extent={{10,-10},{-10,10}}, rotation=90, origin={-14,-24}))); - Fuel.Pipes.Pipe cold_side_pipe annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); - Fuel.BaseClasses.IsoPFlowModel cold_side annotation (Placement(transformation(extent={{0,-10},{20,10}}))); + Fuel.Pipes.Pipe cold_side_pipe(h_0=h_cold_in_0) annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); + Fuel.BaseClasses.IsoPFlowModel cold_side(h_in_0 = h_cold_in_0) annotation (Placement(transformation(extent={{0,-10},{20,10}}))); Fuel.Connectors.Inlet C_cold_in annotation (Placement(transformation(extent={{-80,-10},{-60,10}}), iconTransformation(extent={{-80,-10},{-60,10}}))); - Fuel.Connectors.Outlet C_cold_out annotation (Placement(transformation(extent={{60,-10},{80,10}}), iconTransformation(extent={{60,-10},{80,10}}))); + Fuel.Connectors.Outlet C_cold_out(h_outflow(start=h_cold_out_0)) annotation (Placement(transformation(extent={{60,-10},{80,10}}), iconTransformation(extent={{60,-10},{80,10}}))); WaterSteam.Connectors.Inlet C_hot_in annotation (Placement(transformation(extent={{30,60},{50,80}}), iconTransformation(extent={{30,60},{50,80}}))); - WaterSteam.Connectors.Outlet C_hot_out annotation (Placement(transformation(extent={{-50,-80},{-30,-60}}), + WaterSteam.Connectors.Outlet C_hot_out(h_outflow(start=h_hot_out_0)) annotation (Placement(transformation(extent={{-50,-80},{-30,-60}}), iconTransformation(extent={{-50,-80},{-30,-60}}))); equation // Definitions diff --git a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/HXmoistAirWater_reverse.mo b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/HXmoistAirWater_reverse.mo index 73f1fe8a..7b7e6a2f 100644 --- a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/HXmoistAirWater_reverse.mo +++ b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/HXmoistAirWater_reverse.mo @@ -4,15 +4,15 @@ model HXmoistAirWater_reverse // Boundary conditions input Real P_hot_source(start=3, min=0, nominal=10) "barA"; - //input Units.MassFlowRate Q_hot_source(start=0.05) "kg/s"; - input Real T_hot_source(start=36, nominal = 40, unit="degC"); + input Units.MassFlowRate Q_hot_source(start=31.4) "kg/s"; + input Real T_hot_source(start=9.03, nominal = 40, unit="degC"); - input Real P_cold_source(start=1, min=0, nominal=10) "barA"; + input Real P_cold_source(start=0.985, min=0, nominal=10) "barA"; input Units.MassFlowRate Q_cold_source(start=700) "kg/s"; - input Real T_cold_source(start = 0.44, nominal = 10,unit="degC"); + input Real T_cold_source(start = 6.44, nominal = 10,unit="degC"); //input Real h_cold_source(start = 9e3, min = 0, nominal = 10e4) "degC"; - input Real T_cold_sink( start = 7.54, nominal = 10, unit= "degC"); - input Real moistAir_relative_humidity( start=0, nominal=1) "%"; + //input Real T_cold_sink( start = 7.54, nominal = 10, unit= "degC"); + //input Real moistAir_relative_humidity( start=0.55, nominal=1) "%"; // Parameters parameter String QCp_max_side = "cold"; @@ -24,9 +24,9 @@ model HXmoistAirWater_reverse output Units.FrictionCoefficient Kfr_cold; // Calibration inputs - input Real P_cold_out(start = 1, min= 0, nominal = 10) "barA"; // Outlet pressure on cold side, to calibrate Kfr cold - input Real P_hot_out(start = 3, min = 0, nominal = 10) "barA"; // Outlet pressure on hot side, to calibrate Kfr hot - input Real T_hot_out(start = 23, min = 0, nominal = 100) "degC"; // Outlet temperature on cold side, to calibrate Kth + input Real P_cold_out(start = 0.9, min= 0, nominal = 10) "barA"; // Outlet pressure on cold side, to calibrate Kfr cold + input Real P_hot_out(start = 2.8, min = 0, nominal = 10) "barA"; // Outlet pressure on hot side, to calibrate Kfr hot + input Real T_hot_out(start = 7.8, min = 0, nominal = 100) "degC"; // Outlet temperature on cold side, to calibrate Kth MultiFluid.HeatExchangers.HXmoistAirWater hXmoistAirWater(QCp_max_side = QCp_max_side, @@ -61,14 +61,14 @@ equation // Boundary conditions hot_source.P_out = P_hot_source * 1e5; hot_source.T_out = T_hot_source +273.15; - //hot_source.Q_out = - Q_hot_source; + hot_source.Q_out = - Q_hot_source; cold_source.P_out = P_cold_source *1e5; cold_source.T_out = 273.15 + T_cold_source; - cold_sink.T_in = 273.25 + T_cold_sink; + //cold_sink.T_in = 273.25 + T_cold_sink; //cold_source.h_out = h_cold_source; cold_source.Q_out = - Q_cold_source; - cold_source.relative_humidity = moistAir_relative_humidity; + cold_source.relative_humidity = 55/100; //moistAir_relative_humidity; // Parameters hXmoistAirWater.S = S; From 9035161e58975cf0f50f4ec16199510f3901a1e3 Mon Sep 17 00:00:00 2001 From: Helene Vernier Date: Wed, 3 Aug 2022 10:29:26 +0200 Subject: [PATCH 05/13] modif related to PEP PR comment --- .../Power/HeatExchange/LMTDHeatExchange.mo | 10 +++--- .../HeatExchangers/FuelHeater_reverse.mo | 33 ++++++++++--------- .../HeatExchangers/LMTDFuelHeater_reverse.mo | 4 +-- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo b/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo index 91b8dc01..8865cbda 100644 --- a/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo +++ b/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo @@ -8,13 +8,11 @@ model LMTDHeatExchange parameter Units.Temperature T_cold_in_0 = 273.15 + 100 "Init parameter for Cold mass flow rate at the inlet"; parameter Units.Temperature T_hot_out_0 = 273.15 + 200 "Init parameter for Hot mass flow rate at the outlet"; parameter Units.Temperature T_cold_out_0 = 273.15 + 100 "Init parameter for Cold mass flow rate at the outlet"; - parameter Units.Area S_0 = 100 "init parameter for Heat exchange surface"; - parameter Units.HeatExchangeCoefficient Kth_0 = 5000 "init parameter for Heat exchange coefficient"; /* Exchanger configuration and parameters */ //parameter String config = "LMTD_monophasic_counter_current"; No need for parameter as long as there is only one configuration !! - Inputs.InputArea S(start=S_0) "Heat exchange surface"; - Inputs.InputHeatExchangeCoefficient Kth(start=Kth_0) "Heat exchange coefficient"; + Inputs.InputArea S(start=100) "Heat exchange surface"; + Inputs.InputHeatExchangeCoefficient Kth(start=1900) "Heat exchange coefficient"; /* Exchanger output */ Units.Power W(start=1e4); @@ -26,8 +24,8 @@ model LMTDHeatExchange Inputs.InputTemperature T_cold_out(start=T_cold_out_0) "Temperature, cold side, at the outlet"; // intermediate variables - Real dT_a(start = 15); - Real dT_b(start=1); + Units.DifferentialTemperature dT_a(start = 15); + Units.DifferentialTemperature dT_b(start=1); equation dT_a = T_hot_in - T_cold_out; diff --git a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/FuelHeater_reverse.mo b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/FuelHeater_reverse.mo index 2fd0ec57..068f4132 100644 --- a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/FuelHeater_reverse.mo +++ b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/FuelHeater_reverse.mo @@ -22,29 +22,29 @@ model FuelHeater_reverse // Calibration inputs input Real P_cold_out(start = 30, min= 0, nominal = 10) "barA"; // Outlet pressure on cold side, to calibrate Kfr cold input Real P_hot_out(start = 47, min = 0, nominal = 10) "barA"; // Outlet pressure on hot side, to calibrate Kfr hot - //input Real T_hot_out(start = 80, min = 0, nominal = 100) "degC"; // Outlet temperature on cold side, to calibrate Kth - input Real T_cold_out(start = 200, nominal = 200); + input Real T_hot_out(start = 80, min = 0, nominal = 100) "degC"; // Outlet temperature on cold side, to calibrate Kth + //input Real T_cold_out(start = 200, nominal = 200)"degC"; MultiFluid.HeatExchangers.FuelHeater fuelHeater(QCp_max_side = QCp_max_side) annotation (Placement(transformation(extent={{-38,-34},{38,34}}))); MetroscopeModelingLibrary.WaterSteam.BoundaryConditions.Source hot_source annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=270, - origin={12,50}))); + origin={14,50}))); MetroscopeModelingLibrary.WaterSteam.BoundaryConditions.Sink hot_sink annotation (Placement(transformation( extent={{-10,-10},{10,10}}, - rotation=90, - origin={-12,90}))); + rotation=270, + origin={-16,-88}))); MetroscopeModelingLibrary.Fuel.BoundaryConditions.Source cold_source annotation (Placement(transformation(extent={{-66,-10},{-46,10}}))); MetroscopeModelingLibrary.Fuel.BoundaryConditions.Sink cold_sink annotation (Placement(transformation(extent={{74,-10},{94,10}}))); MetroscopeModelingLibrary.Sensors.Fuel.PressureSensor P_cold_out_sensor annotation (Placement(transformation(extent={{46,-10},{66,10}}))); MetroscopeModelingLibrary.Sensors.WaterSteam.TemperatureSensor T_hot_out_sensor annotation (Placement(transformation( extent={{-10,-10},{10,10}}, - rotation=90, - origin={-12,42}))); + rotation=270, + origin={-16,-40}))); MetroscopeModelingLibrary.Sensors.WaterSteam.PressureSensor P_hot_out_sensor annotation (Placement(transformation( extent={{-10,-10},{10,10}}, - rotation=90, - origin={-12,68}))); + rotation=270, + origin={-16,-66}))); equation // Boundary conditions hot_source.P_out = P_hot_source * 1e5; @@ -60,8 +60,8 @@ equation fuelHeater.S = S; // Inputs for calibration - //T_hot_out_sensor.T_degC = T_hot_out; - cold_sink.T_in = T_cold_out +273.15; + T_hot_out_sensor.T_degC = T_hot_out; + //cold_sink.T_in = T_cold_out +273.15; P_cold_out_sensor.P_barA = P_cold_out; P_hot_out_sensor.P_barA = P_hot_out; @@ -70,12 +70,15 @@ equation fuelHeater.Kfr_hot = Kfr_hot; fuelHeater.Kfr_cold = Kfr_cold; - connect(fuelHeater.C_hot_in, hot_source.C_out) annotation (Line(points={{15.2,23.8},{12,23.8},{12,45}}, color={28,108,200})); + connect(fuelHeater.C_hot_in, hot_source.C_out) annotation (Line(points={{15.2,23.8},{14,23.8},{14,45}}, color={28,108,200})); connect(fuelHeater.C_cold_in, cold_source.C_out) annotation (Line(points={{-26.6,0},{-51,0}}, color={213,213,0})); connect(fuelHeater.C_cold_out, P_cold_out_sensor.C_in) annotation (Line(points={{26.6,0},{46,0}}, color={213,213,0})); connect(cold_sink.C_in, P_cold_out_sensor.C_out) annotation (Line(points={{79,0},{66,0}}, color={213,213,0})); - connect(fuelHeater.C_hot_out, T_hot_out_sensor.C_in) annotation (Line(points={{-15.2,-23.8},{-15.2,27.9},{-12,27.9},{-12,32}},color={28,108,200})); - connect(T_hot_out_sensor.C_out, P_hot_out_sensor.C_in) annotation (Line(points={{-12,52},{-12,58}}, color={28,108,200})); - connect(hot_sink.C_in, P_hot_out_sensor.C_out) annotation (Line(points={{-12,85},{-12,78}}, color={28,108,200})); + connect(fuelHeater.C_hot_out, T_hot_out_sensor.C_in) annotation (Line(points={{-15.2,-23.8},{-15.2,-26.9},{-16,-26.9},{-16,-30}}, + color={28,108,200})); + connect(T_hot_out_sensor.C_out, P_hot_out_sensor.C_in) annotation (Line(points={{-16,-50},{-16,-53},{-16,-53},{-16,-56}}, + color={28,108,200})); + connect(hot_sink.C_in, P_hot_out_sensor.C_out) annotation (Line(points={{-16,-83},{-16,-76}}, + color={28,108,200})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end FuelHeater_reverse; diff --git a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo index c9839c2e..419ae803 100644 --- a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo +++ b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo @@ -21,8 +21,8 @@ model LMTDFuelHeater_reverse // Calibration inputs input Real P_cold_out(start = 30, min= 0, nominal = 10) "barA"; // Outlet pressure on cold side, to calibrate Kfr cold input Real P_hot_out(start = 47, min = 0, nominal = 10) "barA"; // Outlet pressure on hot side, to calibrate Kfr hot - //input Real T_hot_out(start = 80, min = 0, nominal = 100) "degC"; // Outlet temperature on cold side, to calibrate Kth - input Real T_cold_out(start = 200, nominal = 200); + input Real T_cold_out(start = 200, nominal = 200) + "degC";// Outlet temperature on cold side, to calibrate Kth MultiFluid.HeatExchangers.LMTDFuelHeater lMTDFuelHeater annotation (Placement(transformation(extent={{-36,-34},{40,34}}))); MetroscopeModelingLibrary.WaterSteam.BoundaryConditions.Source hot_source annotation (Placement(transformation( From f866dd6f781fb4ff2b49d021eb6b0bc1d8eb3c4d Mon Sep 17 00:00:00 2001 From: Helene Vernier Date: Fri, 5 Aug 2022 13:53:51 +0200 Subject: [PATCH 06/13] changing : test to check QCpmin < QCmax raises warning instead of an error --- .../Power/HeatExchange/NTUHeatExchange.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MetroscopeModelingLibrary/Power/HeatExchange/NTUHeatExchange.mo b/MetroscopeModelingLibrary/Power/HeatExchange/NTUHeatExchange.mo index 9ce5ca15..0edd204d 100644 --- a/MetroscopeModelingLibrary/Power/HeatExchange/NTUHeatExchange.mo +++ b/MetroscopeModelingLibrary/Power/HeatExchange/NTUHeatExchange.mo @@ -79,13 +79,13 @@ equation /* QCpMAX is associated to the mixed fluid, shell side, considered as hot side */ QCpMAX = Q_hot*Cp_hot; QCpMIN = Q_cold*Cp_cold; - assert(QCpMIN < QCpMAX, "QCPMIN is higher than QCpMAX", AssertionLevel.error); + assert(QCpMIN < QCpMAX, "QCPMIN is higher than QCpMAX", AssertionLevel.warning); epsilon = (1 - exp(-Cr*(1 - exp(-NTU))))/Cr; else /* QCpMAX is associated to the unmixed fluid, tube side, considered as cold side */ QCpMIN = Q_hot*Cp_hot; QCpMAX = Q_cold*Cp_cold; - assert(QCpMIN < QCpMAX, "QCPMIN is higher than QCpMAX", AssertionLevel.error); + assert(QCpMIN < QCpMAX, "QCPMIN is higher than QCpMAX", AssertionLevel.warning); epsilon = 1 - exp(-(1 - exp(-Cr*NTU))/Cr); end if; From c4272f61810f71416624e557ff5bd34b1e202896 Mon Sep 17 00:00:00 2001 From: Helene Vernier Date: Fri, 5 Aug 2022 16:28:43 +0200 Subject: [PATCH 07/13] adding heat loss for flue gases --- MetroscopeModelingLibrary/FlueGases/Pipes/HeatLoss.mo | 9 +++++++++ MetroscopeModelingLibrary/FlueGases/Pipes/package.order | 1 + 2 files changed, 10 insertions(+) create mode 100644 MetroscopeModelingLibrary/FlueGases/Pipes/HeatLoss.mo diff --git a/MetroscopeModelingLibrary/FlueGases/Pipes/HeatLoss.mo b/MetroscopeModelingLibrary/FlueGases/Pipes/HeatLoss.mo new file mode 100644 index 00000000..4f72653e --- /dev/null +++ b/MetroscopeModelingLibrary/FlueGases/Pipes/HeatLoss.mo @@ -0,0 +1,9 @@ +within MetroscopeModelingLibrary.FlueGases.Pipes; +model HeatLoss + package FlueGasesMedium = MetroscopeModelingLibrary.Media.FlueGasesMedium; + extends Partial.Pipes.HeatLoss( + redeclare MetroscopeModelingLibrary.FlueGases.Connectors.Inlet C_in, + redeclare MetroscopeModelingLibrary.FlueGases.Connectors.Outlet C_out, + redeclare package Medium = FlueGasesMedium) + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); +end HeatLoss; diff --git a/MetroscopeModelingLibrary/FlueGases/Pipes/package.order b/MetroscopeModelingLibrary/FlueGases/Pipes/package.order index 2d506237..8dbbc7b8 100644 --- a/MetroscopeModelingLibrary/FlueGases/Pipes/package.order +++ b/MetroscopeModelingLibrary/FlueGases/Pipes/package.order @@ -1,2 +1,3 @@ Pipe Filter +HeatLoss From 8e578aa8b019a414e1f68ad5740b5b0a82a65d84 Mon Sep 17 00:00:00 2001 From: Helene Vernier Date: Fri, 23 Sep 2022 15:39:34 +0200 Subject: [PATCH 08/13] adding start values to LMTDFuelHeater Signed-off-by: Helene Vernier --- .../HeatExchangers/LMTDFuelHeater.mo | 26 +++++++++---------- .../HeatExchangers/LMTDFuelHeater_reverse.mo | 3 +-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo index 7220fb09..b47a3a3f 100644 --- a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo +++ b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo @@ -28,37 +28,37 @@ model LMTDFuelHeater parameter Units.MassFlowRate Q_cold_0 = 12; parameter Units.MassFlowRate Q_hot_0 = 8.6; parameter Units.Temperature T_cold_in_0 = 29.5 + 273.15; + parameter Units.Temperature T_cold_out_0 = 97 + 273.15; parameter Units.Temperature T_hot_in_0 = 230 +273.15; + parameter Units.Temperature T_hot_out_0 = 200 +273.15; parameter Units.Pressure P_cold_in_0 = 29.7 *1e5; + parameter Units.Pressure P_cold_out_0 = 29.7 *1e5; parameter Units.Pressure P_hot_in_0 = 47 *1e5; + parameter Units.Pressure P_hot_out_0 = 47 *1e5; parameter Real h_hot_in_0 = 2e4; parameter Real h_hot_out_0 = 1e4; parameter Real h_cold_in_0 = 6e5; parameter Real h_cold_out_0 = 1e6; Power.HeatExchange.LMTDHeatExchange HX( - T_cold_in_0=T_cold_in_0) annotation (Placement(transformation( + 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( extent={{-10,10},{10,-10}}, rotation=0, origin={10,14}))); - WaterSteam.BaseClasses.IsoPFlowModel hot_side( - Q_0=Q_hot_0, - T_in_0=T_hot_in_0, - P_in_0=P_hot_in_0, - h_in_0 = h_hot_in_0) annotation (Placement(transformation( + WaterSteam.BaseClasses.IsoPFlowModel hot_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={{10,10},{-10,-10}}, rotation=0, origin={10,28}))); - WaterSteam.Pipes.Pipe hot_side_pipe(Q_0=Q_hot_0, T_in_0=T_hot_in_0,h_0=h_hot_in_0) annotation (Placement(transformation( + 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( extent={{10,-10},{-10,10}}, rotation=90, origin={-14,-24}))); - Fuel.Pipes.Pipe cold_side_pipe(h_0=h_cold_in_0) annotation (Placement(transformation(extent={{-52,-10},{-32,10}}))); - Fuel.BaseClasses.IsoPFlowModel cold_side(h_in_0 = h_cold_in_0) annotation (Placement(transformation(extent={{0,-10},{20,10}}))); - Fuel.Connectors.Inlet C_cold_in annotation (Placement(transformation(extent={{-80,-10},{-60,10}}), iconTransformation(extent={{-80,-10},{-60,10}}))); - Fuel.Connectors.Outlet C_cold_out(h_outflow(start=h_cold_out_0)) annotation (Placement(transformation(extent={{60,-10},{80,10}}), iconTransformation(extent={{60,-10},{80,10}}))); - WaterSteam.Connectors.Inlet C_hot_in annotation (Placement(transformation(extent={{30,60},{50,80}}), iconTransformation(extent={{30,60},{50,80}}))); - WaterSteam.Connectors.Outlet C_hot_out(h_outflow(start=h_hot_out_0)) annotation (Placement(transformation(extent={{-50,-80},{-30,-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}}))); + Fuel.BaseClasses.IsoPFlowModel cold_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(extent={{0,-10},{20,10}}))); + 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}}))); + 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}}))); + 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}}))); + WaterSteam.Connectors.Outlet C_hot_out(Q(start=Q_cold_0), P(start=P_hot_out_0), h_outflow(start=h_hot_out_0)) annotation (Placement(transformation(extent={{-50,-80},{-30,-60}}), iconTransformation(extent={{-50,-80},{-30,-60}}))); equation // Definitions diff --git a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo index 419ae803..4d2196f0 100644 --- a/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo +++ b/MetroscopeModelingLibrary/Tests/Multifluid/HeatExchangers/LMTDFuelHeater_reverse.mo @@ -21,8 +21,7 @@ model LMTDFuelHeater_reverse // Calibration inputs input Real P_cold_out(start = 30, min= 0, nominal = 10) "barA"; // Outlet pressure on cold side, to calibrate Kfr cold input Real P_hot_out(start = 47, min = 0, nominal = 10) "barA"; // Outlet pressure on hot side, to calibrate Kfr hot - input Real T_cold_out(start = 200, nominal = 200) - "degC";// Outlet temperature on cold side, to calibrate Kth + input Real T_cold_out(start = 97, nominal = 100) "degC";// Outlet temperature on cold side, to calibrate Kth MultiFluid.HeatExchangers.LMTDFuelHeater lMTDFuelHeater annotation (Placement(transformation(extent={{-36,-34},{40,34}}))); MetroscopeModelingLibrary.WaterSteam.BoundaryConditions.Source hot_source annotation (Placement(transformation( From bb7bb0e028b5a7885c25ca85e231f38da2e87999 Mon Sep 17 00:00:00 2001 From: Helene Vernier Date: Fri, 23 Sep 2022 16:04:47 +0200 Subject: [PATCH 09/13] last modif on LMTD Signed-off-by: Helene Vernier --- .../Power/HeatExchange/LMTDHeatExchange.mo | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo b/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo index 8865cbda..f23927e2 100644 --- a/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo +++ b/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo @@ -24,15 +24,15 @@ model LMTDHeatExchange Inputs.InputTemperature T_cold_out(start=T_cold_out_0) "Temperature, cold side, at the outlet"; // intermediate variables - Units.DifferentialTemperature dT_a(start = 15); - Units.DifferentialTemperature dT_b(start=1); + Units.DifferentialTemperature DT_a(start = T_hot_in_0 - T_cold_out_0); + Units.DifferentialTemperature DT_b(start = T_hot_out_0 - T_cold_in_0); equation - - dT_a = T_hot_in - T_cold_out; - dT_b = T_hot_out - T_cold_in; + // Counter-current configuration. (Also correct for cross-current since the likely correction coefficient can be considered as absorbed by Kth) + DT_a = T_hot_in - T_cold_out; + DT_b = T_hot_out - T_cold_in; // Log mean equation written in an exponential way - 0 = - dT_a + dT_b * exp(Kth*S*(dT_a - dT_b)/W); + 0 = - DT_a + DT_b * exp(Kth*S*(DT_a - DT_b)/W); annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ From 6655d6a84d8a124ba9a3230e567f27bb00d3533f Mon Sep 17 00:00:00 2001 From: Helene Vernier Date: Fri, 23 Sep 2022 16:11:20 +0200 Subject: [PATCH 10/13] Failure mode in LMTFuelHeater Signed-off-by: Helene Vernier --- .../MultiFluid/HeatExchangers/LMTDFuelHeater.mo | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo index b47a3a3f..f9691b3d 100644 --- a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo +++ b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo @@ -24,6 +24,10 @@ model LMTDFuelHeater Units.Temperature T_hot_in; Units.Temperature T_hot_out; + // Failure modes + parameter Boolean faulty = false; + Units.Percentage fouling(min = 0, max=100); // Fouling percentage + // Initialization parameters parameter Units.MassFlowRate Q_cold_0 = 12; parameter Units.MassFlowRate Q_hot_0 = 8.6; @@ -61,6 +65,11 @@ model LMTDFuelHeater WaterSteam.Connectors.Outlet C_hot_out(Q(start=Q_cold_0), P(start=P_hot_out_0), h_outflow(start=h_hot_out_0)) annotation (Placement(transformation(extent={{-50,-80},{-30,-60}}), iconTransformation(extent={{-50,-80},{-30,-60}}))); equation + // Failure modes + if not faulty then + fouling = 0; + end if; + // Definitions Q_cold = cold_side.Q; Q_hot = hot_side.Q; @@ -82,7 +91,7 @@ equation // Power Exchange HX.W = W; HX.S = S; - HX.Kth = Kth; + HX.Kth = Kth*(1-fouling/100); HX.T_cold_in = T_cold_in; HX.T_hot_in = T_hot_in; HX.T_cold_out = T_cold_out; From f08d0382988cae0053de1598cdf327a50535e6a5 Mon Sep 17 00:00:00 2001 From: Helene Vernier Date: Fri, 23 Sep 2022 16:27:34 +0200 Subject: [PATCH 11/13] changing fluegases heat loss icon Signed-off-by: Helene Vernier --- .../FlueGases/Pipes/HeatLoss.mo | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/MetroscopeModelingLibrary/FlueGases/Pipes/HeatLoss.mo b/MetroscopeModelingLibrary/FlueGases/Pipes/HeatLoss.mo index 4f72653e..f0c583aa 100644 --- a/MetroscopeModelingLibrary/FlueGases/Pipes/HeatLoss.mo +++ b/MetroscopeModelingLibrary/FlueGases/Pipes/HeatLoss.mo @@ -5,5 +5,26 @@ model HeatLoss redeclare MetroscopeModelingLibrary.FlueGases.Connectors.Inlet C_in, redeclare MetroscopeModelingLibrary.FlueGases.Connectors.Outlet C_out, redeclare package Medium = FlueGasesMedium) - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); + annotation(IconMap(primitivesVisible=false)); + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Rectangle( + extent={{-100,30},{100,-30}}, + lineColor={95,95,95}, + fillColor={95,95,95}, + fillPattern=FillPattern.Solid), + Line( + points={{-14,50},{-14,50},{-24,40},{-10,30},{-24,16},{-14,8}}, + color={238,46,47}, + smooth=Smooth.Bezier, + thickness=0.5), + Line( + points={{0,50},{0,50},{-10,40},{4,30},{-10,16},{0,8}}, + color={238,46,47}, + smooth=Smooth.Bezier, + thickness=0.5), + Line( + points={{14,50},{14,50},{4,40},{18,30},{4,16},{14,8}}, + color={238,46,47}, + smooth=Smooth.Bezier, + thickness=0.5)}), Diagram(coordinateSystem(preserveAspectRatio=false))); end HeatLoss; From 4ca8d202efe0a4e93d6c413e422c8ca0a8e87fac Mon Sep 17 00:00:00 2001 From: hvernier <98099701+hvernier@users.noreply.github.com> Date: Fri, 23 Sep 2022 16:29:25 +0200 Subject: [PATCH 12/13] Update CHANGELOG.md Co-authored-by: pepmts <97044708+pepmts@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93cf5a48..a697999f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added `psiA` and `psiG` distinction in pressure sensor [PR#252](https://github.com/Metroscope-dev/metroscope-modeling-library/pull/252) - - Added `LMTDHeatExchange`function, `LMTDfuelHeater`component and reverse unit test. [PR #266](https://github.com/Metroscope-dev/metroscope-modeling-library/pull/266) + - Added `LMTDHeatExchange` function, `LMTDfuelHeater`component and reverse unit test. [PR #266](https://github.com/Metroscope-dev/metroscope-modeling-library/pull/266) - Added`HXmoistAirWater` component and reverse unit test, [PR #250](https://github.com/Metroscope-dev/metroscope-modeling-library/pull/250) - Added flue gases enthalpy start value to `hrsg_monophasic_HX`, [PR #264](https://github.com/Metroscope-dev/metroscope-modeling-library/pull/264) - 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) From e83e440d2c5131ed3a97f7ded5642287b15d3dde Mon Sep 17 00:00:00 2001 From: Helene Vernier Date: Mon, 3 Oct 2022 09:52:31 +0200 Subject: [PATCH 13/13] last changes --- .../MultiFluid/HeatExchangers/Evaporator.mo | 2 +- .../HeatExchangers/LMTDFuelHeater.mo | 20 +++++++++---------- .../HeatExchangers/hrsg_monophasic_HX.mo | 2 +- .../Power/HeatExchange/LMTDHeatExchange.mo | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/Evaporator.mo b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/Evaporator.mo index e1aa4a48..73bffef5 100644 --- a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/Evaporator.mo +++ b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/Evaporator.mo @@ -33,7 +33,7 @@ model Evaporator // Failure modes parameter Boolean faulty = false; - Units.Percentage fouling(min = 0, max=100); // Fouling percentage + Units.Percentage fouling; // Fouling percentage // Initialization parameters parameter Units.MassFlowRate Q_cold_0 = 500; diff --git a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo index f9691b3d..a0dd818b 100644 --- a/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo +++ b/MetroscopeModelingLibrary/MultiFluid/HeatExchangers/LMTDFuelHeater.mo @@ -26,7 +26,7 @@ model LMTDFuelHeater // Failure modes parameter Boolean faulty = false; - Units.Percentage fouling(min = 0, max=100); // Fouling percentage + Units.Percentage fouling; // Fouling percentage // Initialization parameters parameter Units.MassFlowRate Q_cold_0 = 12; @@ -39,17 +39,17 @@ model LMTDFuelHeater parameter Units.Pressure P_cold_out_0 = 29.7 *1e5; parameter Units.Pressure P_hot_in_0 = 47 *1e5; parameter Units.Pressure P_hot_out_0 = 47 *1e5; - parameter Real h_hot_in_0 = 2e4; - parameter Real h_hot_out_0 = 1e4; - parameter Real h_cold_in_0 = 6e5; - parameter Real h_cold_out_0 = 1e6; + parameter Units.SpecificEnthalpy h_hot_in_0 = 2e4; + parameter Units.SpecificEnthalpy h_hot_out_0 = 1e4; + parameter Units.SpecificEnthalpy h_cold_in_0 = 6e5; + parameter Units.SpecificEnthalpy h_cold_out_0 = 1e6; Power.HeatExchange.LMTDHeatExchange HX( 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( extent={{-10,10},{10,-10}}, rotation=0, origin={10,14}))); - WaterSteam.BaseClasses.IsoPFlowModel hot_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( + 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( extent={{10,10},{-10,-10}}, rotation=0, origin={10,28}))); @@ -58,11 +58,11 @@ model LMTDFuelHeater rotation=90, origin={-14,-24}))); 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}}))); - Fuel.BaseClasses.IsoPFlowModel cold_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(extent={{0,-10},{20,10}}))); + 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}}))); 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}}))); 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}}))); 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}}))); - WaterSteam.Connectors.Outlet C_hot_out(Q(start=Q_cold_0), P(start=P_hot_out_0), h_outflow(start=h_hot_out_0)) annotation (Placement(transformation(extent={{-50,-80},{-30,-60}}), + 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}}), iconTransformation(extent={{-50,-80},{-30,-60}}))); equation // Failure modes @@ -97,10 +97,10 @@ equation HX.T_cold_out = T_cold_out; HX.T_hot_out = T_hot_out; connect(hot_side_pipe.C_out,C_hot_out) annotation (Line(points={{-14,-34},{-14,-70},{-40,-70}}, color={28,108,200})); - connect(hot_side_pipe.C_in,hot_side. C_out) annotation (Line(points={{-14,-14},{-14,28},{0,28}},color={28,108,200})); + connect(hot_side_pipe.C_in,hot_side.C_out) annotation (Line(points={{-14,-14},{-14,28},{0,28}},color={28,108,200})); connect(hot_side.C_in,C_hot_in) annotation (Line(points={{20,28},{40,28},{40,70}}, color={28,108,200})); connect(cold_side_pipe.C_in,C_cold_in) annotation (Line(points={{-52,0},{-70,0}}, color={213,213,0})); - connect(cold_side_pipe.C_out,cold_side. C_in) annotation (Line(points={{-32,0},{0,0}}, color={213,213,0})); + connect(cold_side_pipe.C_out,cold_side.C_in) annotation (Line(points={{-32,0},{0,0}}, color={213,213,0})); connect(cold_side.C_out,C_cold_out) annotation (Line(points={{20,0},{70,0}}, color={213,213,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ Rectangle( diff --git a/MetroscopeModelingLibrary/Partial/HeatExchangers/hrsg_monophasic_HX.mo b/MetroscopeModelingLibrary/Partial/HeatExchangers/hrsg_monophasic_HX.mo index 3d5e7490..2717622b 100644 --- a/MetroscopeModelingLibrary/Partial/HeatExchangers/hrsg_monophasic_HX.mo +++ b/MetroscopeModelingLibrary/Partial/HeatExchangers/hrsg_monophasic_HX.mo @@ -25,7 +25,7 @@ partial model hrsg_monophasic_HX // Failure modes parameter Boolean faulty = false; - Units.Percentage fouling(min = 0, max=100); // Fouling percentage + Units.Percentage fouling; // Fouling percentage // Initialization parameters parameter Units.MassFlowRate Q_cold_0 = 500; diff --git a/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo b/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo index f23927e2..beb13229 100644 --- a/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo +++ b/MetroscopeModelingLibrary/Power/HeatExchange/LMTDHeatExchange.mo @@ -4,10 +4,10 @@ model LMTDHeatExchange import MetroscopeModelingLibrary.Units; // Initialization parameters - parameter Units.Temperature T_hot_in_0 = 273.15 + 200 "Init parameter for Hot mass flow rate at the inlet"; - parameter Units.Temperature T_cold_in_0 = 273.15 + 100 "Init parameter for Cold mass flow rate at the inlet"; - parameter Units.Temperature T_hot_out_0 = 273.15 + 200 "Init parameter for Hot mass flow rate at the outlet"; - parameter Units.Temperature T_cold_out_0 = 273.15 + 100 "Init parameter for Cold mass flow rate at the outlet"; + parameter Units.Temperature T_hot_in_0 = 273.15 + 200 "Init parameter for Hot temperature at the inlet"; + parameter Units.Temperature T_cold_in_0 = 273.15 + 30 "Init parameter for Cold temperature at the inlet"; + parameter Units.Temperature T_hot_out_0 = 273.15 + 90 "Init parameter for Hot temperature at the outlet"; + parameter Units.Temperature T_cold_out_0 = 273.15 + 100 "Init parameter for Cold temperature at the outlet"; /* Exchanger configuration and parameters */ //parameter String config = "LMTD_monophasic_counter_current"; No need for parameter as long as there is only one configuration !!