From e027620767142013f79c804d399306c4caa645de Mon Sep 17 00:00:00 2001 From: pepmts Date: Thu, 19 Dec 2024 09:34:41 +0100 Subject: [PATCH 1/6] first try Signed-off-by: pepmts --- .../Fuel/BoundaryConditions/Source.mo | 7 ++++++ .../MultiFluid/Machines/CombustionChamber.mo | 13 ++++++++--- .../Multifluid/Machines/CombustionChamber.mo | 9 ++++---- .../Utilities/Constants/package.mo | 22 +++++++++++++++++++ .../Utilities/Constants/package.order | 13 +++++++++++ .../Utilities/Media/FuelMedium/package.mo | 10 +++++---- 6 files changed, 63 insertions(+), 11 deletions(-) diff --git a/MetroscopeModelingLibrary/Fuel/BoundaryConditions/Source.mo b/MetroscopeModelingLibrary/Fuel/BoundaryConditions/Source.mo index b49880a7..31c108a3 100644 --- a/MetroscopeModelingLibrary/Fuel/BoundaryConditions/Source.mo +++ b/MetroscopeModelingLibrary/Fuel/BoundaryConditions/Source.mo @@ -17,6 +17,8 @@ model Source Real amC4H10 "C4H10 molecular mass"; Real amCO2 "CO2 molecular mass"; Real amN2 "H2O molecular mass"; + Real amH2 "H2 molecular mass"; + // Fuel composition Utilities.Units.MassFraction X_CH4(start=0.848); @@ -25,6 +27,7 @@ model Source Utilities.Units.MassFraction X_C4H10_n_butane(start=0.00668); Utilities.Units.MassFraction X_N2(start=0.024); Utilities.Units.MassFraction X_CO2(start=0.025); + Utilities.Units.MassFraction X_H2(start=0.0); // Mole fractions Real X_molar_CH4(start=0.92); @@ -33,6 +36,7 @@ model Source Real X_molar_C4H10_n_butane(start=0.002); Real X_molar_N2(start=0.015); Real X_molar_CO2(start=0.01); + Real X_molar_H2(start=0.0); // Mean molecular mass Real mean_molecular_mass(start=17); @@ -46,6 +50,7 @@ equation amC4H10 = 4*amC + 10*amH; amN2 = 2*amN; amCO2 = amC + 2*amO; + amH2 = 2*amH; // Composition mass fraction X_CH4 = Xi_out[1]; // methane @@ -54,6 +59,7 @@ equation X_C4H10_n_butane = Xi_out[4]; // butane X_N2 = Xi_out[5]; // nitrogen X_CO2 = Xi_out[6]; // carbon dioxyde + X_H2 = Xi_out[7]; // carbon dioxyde // Mean Molecular Mass: this gives the correct results only if the molar fraction is given as an input, if the mass fraction is given, this quantity is useless mean_molecular_mass = X_molar_CH4*amCH4 + X_molar_C2H6*amC2H6 + X_molar_C3H8*amC3H8 + X_molar_C4H10_n_butane*amC4H10 + X_molar_N2*amN2 + X_molar_CO2*amCO2; @@ -65,6 +71,7 @@ equation X_molar_C4H10_n_butane = X_C4H10_n_butane/amC4H10 * mean_molecular_mass; X_molar_N2 = X_N2/amN2 * mean_molecular_mass; X_molar_CO2 = X_CO2/amCO2 * mean_molecular_mass; + X_molar_H2 = X_H2/amH2 * mean_molecular_mass; annotation (Icon(graphics={ Ellipse( diff --git a/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo b/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo index 99753496..eefeab67 100644 --- a/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo +++ b/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo @@ -17,11 +17,13 @@ model CombustionChamber // Power released by the combustion Inputs.InputPower Wth; + Inputs.InputPower Wth_test; // Enthalpies at each connector Units.SpecificEnthalpy h_in_air(start=h_in_air_0); Units.SpecificEnthalpy h_in_fuel; Units.SpecificEnthalpy h_exhaust; + Units.SpecificEnthalpy h_exhaust_test; // Air intake composition Units.MassFraction X_in_N2(start=0.78); @@ -44,6 +46,7 @@ model CombustionChamber Units.MassFraction X_fuel_C4H10_n_butane(start=0.002); Units.MassFraction X_fuel_N2(start=0.015); Units.MassFraction X_fuel_CO2(start=0.01); + Units.MassFraction X_fuel_H2(start=0.01); Units.MassFraction X_fuel_C(start=0.8) "C mass fraction in the fuel"; Units.MassFraction X_fuel_H(start=0.2) "H mass fraction in the fuel"; @@ -51,7 +54,8 @@ model CombustionChamber // Heating values Units.SpecificEnthalpy HHV = (hhv_mass_CH4*X_fuel_CH4 + hhv_mass_C2H6*X_fuel_C2H6 + hhv_mass_C3H8*X_fuel_C3H8 + hhv_mass_C4H10*X_fuel_C4H10_n_butane)*1e6 "J/kg can be assigned in component modifiers"; - Units.SpecificEnthalpy LHV = HHV - 2202.92069 * m_H*(4*X_fuel_CH4/m_CH4 + 6*X_fuel_C2H6/m_C2H6 + 8*X_fuel_C3H8/m_C3H8 + 10*X_fuel_C4H10_n_butane/m_C4H10)*1e4 "J/kg can be assigned in component modifiers"; + Units.SpecificEnthalpy LHV = HHV - 2202.92069 * X_fuel_H*1e4 "J/kg can be assigned in component modifiers"; + Units.SpecificEnthalpy LHV_test = (lhv_mass_H2*X_fuel_H2 + lhv_mass_CH4*X_fuel_CH4 + lhv_mass_C2H6*X_fuel_C2H6 + lhv_mass_C3H8*X_fuel_C3H8 + lhv_mass_C4H10*X_fuel_C4H10_n_butane)*1e6; // Initialization parameters parameter Units.SpecificEnthalpy h_in_air_0 = 5e5; @@ -75,7 +79,7 @@ equation h_in_air = sink_air.h_in; h_in_fuel = sink_fuel.h_in; - h_exhaust = source_exhaust.h_out; + h_exhaust_test = source_exhaust.h_out; X_in_N2 = sink_air.Xi_in[1]; X_in_O2 = sink_air.Xi_in[2]; @@ -89,6 +93,7 @@ equation X_fuel_C4H10_n_butane= sink_fuel.Xi_in[4]; //butane X_fuel_N2= sink_fuel.Xi_in[5]; // nitrogen X_fuel_CO2= sink_fuel.Xi_in[6]; // carbon dioxyde + X_fuel_H2= sink_fuel.Xi_in[7]; // hydrogen // Final quantities X_out_N2 = source_exhaust.Xi_out[1]; @@ -107,12 +112,14 @@ equation // Energy balance Wth = eta*Q_fuel*LHV; + Wth_test = eta*Q_fuel*LHV_test; Q_exhaust*h_exhaust = Q_air*h_in_air + Q_fuel*h_in_fuel + Wth; + Q_exhaust*h_exhaust_test = Q_air*h_in_air + Q_fuel*h_in_fuel + Wth_test; // Chemical balance // Quantity of reactants in fuel X_fuel_C = m_C*(X_fuel_CH4/m_CH4 + 2*X_fuel_C2H6/m_C2H6 + 3*X_fuel_C3H8/m_C3H8 + 4*X_fuel_C4H10_n_butane/m_C4H10 + X_fuel_CO2/m_CO2); - X_fuel_H = m_H*(4*X_fuel_CH4/m_CH4 + 6*X_fuel_C2H6/m_C2H6 + 8*X_fuel_C3H8/m_C3H8 + 10*X_fuel_C4H10_n_butane/m_C4H10); + X_fuel_H = m_H*(2*X_fuel_H2/m_H2 + 4*X_fuel_CH4/m_CH4 + 6*X_fuel_C2H6/m_C2H6 + 8*X_fuel_C3H8/m_C3H8 + 10*X_fuel_C4H10_n_butane/m_C4H10); X_fuel_O = 2*m_O*X_fuel_CO2/m_CO2; // Mass balance for all species diff --git a/MetroscopeModelingLibrary/Tests/Multifluid/Machines/CombustionChamber.mo b/MetroscopeModelingLibrary/Tests/Multifluid/Machines/CombustionChamber.mo index 045e3ed1..8d2f2a9a 100644 --- a/MetroscopeModelingLibrary/Tests/Multifluid/Machines/CombustionChamber.mo +++ b/MetroscopeModelingLibrary/Tests/Multifluid/Machines/CombustionChamber.mo @@ -12,12 +12,12 @@ model CombustionChamber input Units.SpecificEnthalpy h_fuel(start=0.9e6); input Units.PositiveMassFlowRate Q_fuel(start=15); - input Units.SpecificEnthalpy LHV_plant(start=47276868) "Directly assigned in combustion chamber modifiers"; + //input Units.SpecificEnthalpy LHV_plant(start=47276868) "Directly assigned in combustion chamber modifiers"; // Parameters parameter Units.FrictionCoefficient combustion_chamber_Kfr = 0.1; - MultiFluid.Machines.CombustionChamber combustion_chamber(LHV=LHV_plant) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + MultiFluid.Machines.CombustionChamber combustion_chamber annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); MetroscopeModelingLibrary.Fuel.BoundaryConditions.Source source_fuel annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=90, @@ -33,14 +33,15 @@ equation source_air.Xi_out = {0.768,0.232,0.0,0.0,0.0}; source_fuel.P_out = P_fuel; - source_fuel.h_out = h_fuel; + source_fuel.T_out = 160 + 273.15; source_fuel.Q_out = - Q_fuel; - source_fuel.X_molar_CH4=0.92; + source_fuel.X_molar_CH4=0.92 - time*0.1; source_fuel.X_molar_C2H6=0.048; source_fuel.X_molar_C3H8=0.005; source_fuel.X_molar_C4H10_n_butane=0.002; source_fuel.X_molar_N2=0.015; source_fuel.X_molar_CO2=0.01; + source_fuel.X_molar_H2=0.0 + time*0.1; // Parameters combustion_chamber.Kfr = combustion_chamber_Kfr; diff --git a/MetroscopeModelingLibrary/Utilities/Constants/package.mo b/MetroscopeModelingLibrary/Utilities/Constants/package.mo index 89f9df62..71fcaf56 100644 --- a/MetroscopeModelingLibrary/Utilities/Constants/package.mo +++ b/MetroscopeModelingLibrary/Utilities/Constants/package.mo @@ -38,6 +38,7 @@ package Constants "Stores all constants used in MML" // Atomic/Molecular masses final constant Units.AtomicMass m_H = 1.00798; + final constant Units.AtomicMass m_H2 = m_H*2; final constant Units.AtomicMass m_C = 12.0106; final constant Units.AtomicMass m_O = 15.9994; final constant Units.MolecularMass m_CH4 = m_C + m_H*4; @@ -60,6 +61,27 @@ package Constants "Stores all constants used in MML" // n-Butane C4H10 final constant Real hhv_molar_C4H10 = 2879.63 "kJ/mol"; final constant Real hhv_mass_C4H10 = hhv_molar_C4H10/m_C4H10 "MJ/kg"; + // Hydrogen H2 + final constant Real hhv_molar_H2 = 286.13 "kJ/mol"; + final constant Real hhv_mass_H2 = hhv_molar_H2/m_H2 "MJ/kg"; + + + // Heating values: based on ISO 6976 at 25°C + // Methane CH4 + final constant Real lhv_molar_CH4 = 802.69 "kJ/mol"; + final constant Real lhv_mass_CH4 = lhv_molar_CH4/m_CH4 "MJ/kg"; + // Ethane C2H6 + final constant Real lhv_molar_C2H6 = 1428.83 "kJ/mol"; + final constant Real lhv_mass_C2H6 = lhv_molar_C2H6/m_C2H6 "MJ/kg"; + // Propane C3H8 + final constant Real lhv_molar_C3H8 = 2043.35 "kJ/mol"; + final constant Real lhv_mass_C3H8 = lhv_molar_C3H8/m_C3H8 "MJ/kg"; + // n-Butane C4H10 + final constant Real lhv_molar_C4H10 = 2657.58 "kJ/mol"; + final constant Real lhv_mass_C4H10 = lhv_molar_C4H10/m_C4H10 "MJ/kg"; + // Hydrogen H2 + final constant Real lhv_molar_H2 = 241.72 "kJ/mol"; + final constant Real lhv_mass_H2 = lhv_molar_H2/m_H2 "MJ/kg"; annotation ( Icon(coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}}), graphics={ diff --git a/MetroscopeModelingLibrary/Utilities/Constants/package.order b/MetroscopeModelingLibrary/Utilities/Constants/package.order index f0bb5020..700b34e6 100644 --- a/MetroscopeModelingLibrary/Utilities/Constants/package.order +++ b/MetroscopeModelingLibrary/Utilities/Constants/package.order @@ -21,6 +21,7 @@ kgs_to_lbs kgs_to_Mlbh kgs_to_lbh m_H +m_H2 m_C m_O m_CH4 @@ -37,3 +38,15 @@ hhv_molar_C3H8 hhv_mass_C3H8 hhv_molar_C4H10 hhv_mass_C4H10 +hhv_molar_H2 +hhv_mass_H2 +lhv_molar_CH4 +lhv_mass_CH4 +lhv_molar_C2H6 +lhv_mass_C2H6 +lhv_molar_C3H8 +lhv_mass_C3H8 +lhv_molar_C4H10 +lhv_mass_C4H10 +lhv_molar_H2 +lhv_mass_H2 diff --git a/MetroscopeModelingLibrary/Utilities/Media/FuelMedium/package.mo b/MetroscopeModelingLibrary/Utilities/Media/FuelMedium/package.mo index 9cab6afe..97e28500 100644 --- a/MetroscopeModelingLibrary/Utilities/Media/FuelMedium/package.mo +++ b/MetroscopeModelingLibrary/Utilities/Media/FuelMedium/package.mo @@ -7,15 +7,17 @@ package FuelMedium Modelica.Media.IdealGases.Common.SingleGasesData.C3H8, Modelica.Media.IdealGases.Common.SingleGasesData.C4H10_n_butane, Modelica.Media.IdealGases.Common.SingleGasesData.N2, - Modelica.Media.IdealGases.Common.SingleGasesData.CO2}, + Modelica.Media.IdealGases.Common.SingleGasesData.CO2, + Modelica.Media.IdealGases.Common.SingleGasesData.H2}, fluidConstants={Modelica.Media.IdealGases.Common.FluidData.CH4, Modelica.Media.IdealGases.Common.FluidData.C2H6, Modelica.Media.IdealGases.Common.FluidData.C3H8, Modelica.Media.IdealGases.Common.FluidData.C4H10_n_butane, Modelica.Media.IdealGases.Common.FluidData.N2, - Modelica.Media.IdealGases.Common.FluidData.CO2}, - substanceNames = {"Methane","Ethane","Propane","N-Butane,","Nitrogen","Carbondioxide"}, - reference_X={0.92,0.048,0.005,0.002,0.015,0.01}) annotation(IconMap(primitivesVisible=false)); + Modelica.Media.IdealGases.Common.FluidData.CO2, + Modelica.Media.IdealGases.Common.FluidData.H2}, + substanceNames = {"Methane","Ethane","Propane","N-Butane,","Nitrogen","Carbondioxide","Hydrogen"}, + reference_X={0.92,0.048,0.005,0.002,0.015,0.01,0.0}) annotation(IconMap(primitivesVisible=false)); annotation (Icon(graphics={ Rectangle( From 4810149c78b562978894133c159096354feb6c59 Mon Sep 17 00:00:00 2001 From: pepmts Date: Thu, 19 Dec 2024 09:41:03 +0100 Subject: [PATCH 2/6] fixed issues, H2 is integrated :) Signed-off-by: pepmts --- .../MultiFluid/Machines/CombustionChamber.mo | 4 ++-- .../Tests/Multifluid/Machines/CombustionChamber.mo | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo b/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo index eefeab67..f8cb1eaf 100644 --- a/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo +++ b/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo @@ -53,10 +53,10 @@ model CombustionChamber Units.MassFraction X_fuel_O(start=0) "O mass fraction in the fuel"; // Heating values - Units.SpecificEnthalpy HHV = (hhv_mass_CH4*X_fuel_CH4 + hhv_mass_C2H6*X_fuel_C2H6 + hhv_mass_C3H8*X_fuel_C3H8 + hhv_mass_C4H10*X_fuel_C4H10_n_butane)*1e6 "J/kg can be assigned in component modifiers"; + Units.SpecificEnthalpy HHV = (hhv_mass_H2*X_fuel_H2 + hhv_mass_CH4*X_fuel_CH4 + hhv_mass_C2H6*X_fuel_C2H6 + hhv_mass_C3H8*X_fuel_C3H8 + hhv_mass_C4H10*X_fuel_C4H10_n_butane)*1e6 "J/kg can be assigned in component modifiers"; Units.SpecificEnthalpy LHV = HHV - 2202.92069 * X_fuel_H*1e4 "J/kg can be assigned in component modifiers"; Units.SpecificEnthalpy LHV_test = (lhv_mass_H2*X_fuel_H2 + lhv_mass_CH4*X_fuel_CH4 + lhv_mass_C2H6*X_fuel_C2H6 + lhv_mass_C3H8*X_fuel_C3H8 + lhv_mass_C4H10*X_fuel_C4H10_n_butane)*1e6; - + Real diff = HHV - LHV_test; // Initialization parameters parameter Units.SpecificEnthalpy h_in_air_0 = 5e5; diff --git a/MetroscopeModelingLibrary/Tests/Multifluid/Machines/CombustionChamber.mo b/MetroscopeModelingLibrary/Tests/Multifluid/Machines/CombustionChamber.mo index 8d2f2a9a..94d9d336 100644 --- a/MetroscopeModelingLibrary/Tests/Multifluid/Machines/CombustionChamber.mo +++ b/MetroscopeModelingLibrary/Tests/Multifluid/Machines/CombustionChamber.mo @@ -35,13 +35,13 @@ equation source_fuel.P_out = P_fuel; source_fuel.T_out = 160 + 273.15; source_fuel.Q_out = - Q_fuel; - source_fuel.X_molar_CH4=0.92 - time*0.1; + source_fuel.X_molar_CH4=0.82; source_fuel.X_molar_C2H6=0.048; source_fuel.X_molar_C3H8=0.005; source_fuel.X_molar_C4H10_n_butane=0.002; source_fuel.X_molar_N2=0.015; source_fuel.X_molar_CO2=0.01; - source_fuel.X_molar_H2=0.0 + time*0.1; + source_fuel.X_molar_H2=0.1; // Parameters combustion_chamber.Kfr = combustion_chamber_Kfr; From 6ecf94576b6401bdbc7e09ce6d3bdbce42184e02 Mon Sep 17 00:00:00 2001 From: pepmts Date: Thu, 19 Dec 2024 09:57:11 +0100 Subject: [PATCH 3/6] clean up test variables Signed-off-by: pepmts --- .../MultiFluid/Machines/CombustionChamber.mo | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo b/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo index f8cb1eaf..e2caeb31 100644 --- a/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo +++ b/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo @@ -17,13 +17,11 @@ model CombustionChamber // Power released by the combustion Inputs.InputPower Wth; - Inputs.InputPower Wth_test; // Enthalpies at each connector Units.SpecificEnthalpy h_in_air(start=h_in_air_0); Units.SpecificEnthalpy h_in_fuel; Units.SpecificEnthalpy h_exhaust; - Units.SpecificEnthalpy h_exhaust_test; // Air intake composition Units.MassFraction X_in_N2(start=0.78); @@ -55,8 +53,7 @@ model CombustionChamber // Heating values Units.SpecificEnthalpy HHV = (hhv_mass_H2*X_fuel_H2 + hhv_mass_CH4*X_fuel_CH4 + hhv_mass_C2H6*X_fuel_C2H6 + hhv_mass_C3H8*X_fuel_C3H8 + hhv_mass_C4H10*X_fuel_C4H10_n_butane)*1e6 "J/kg can be assigned in component modifiers"; Units.SpecificEnthalpy LHV = HHV - 2202.92069 * X_fuel_H*1e4 "J/kg can be assigned in component modifiers"; - Units.SpecificEnthalpy LHV_test = (lhv_mass_H2*X_fuel_H2 + lhv_mass_CH4*X_fuel_CH4 + lhv_mass_C2H6*X_fuel_C2H6 + lhv_mass_C3H8*X_fuel_C3H8 + lhv_mass_C4H10*X_fuel_C4H10_n_butane)*1e6; - Real diff = HHV - LHV_test; + // Initialization parameters parameter Units.SpecificEnthalpy h_in_air_0 = 5e5; @@ -79,7 +76,6 @@ equation h_in_air = sink_air.h_in; h_in_fuel = sink_fuel.h_in; - h_exhaust_test = source_exhaust.h_out; X_in_N2 = sink_air.Xi_in[1]; X_in_O2 = sink_air.Xi_in[2]; @@ -112,9 +108,7 @@ equation // Energy balance Wth = eta*Q_fuel*LHV; - Wth_test = eta*Q_fuel*LHV_test; Q_exhaust*h_exhaust = Q_air*h_in_air + Q_fuel*h_in_fuel + Wth; - Q_exhaust*h_exhaust_test = Q_air*h_in_air + Q_fuel*h_in_fuel + Wth_test; // Chemical balance // Quantity of reactants in fuel From fb46395036af51111131f78a3fb33fcf63d4f30c Mon Sep 17 00:00:00 2001 From: pepmts Date: Thu, 19 Dec 2024 10:01:37 +0100 Subject: [PATCH 4/6] clean up unit test Signed-off-by: pepmts --- .../MultiFluid/Machines/CombustionChamber.mo | 5 ----- .../Tests/Multifluid/Machines/CombustionChamber.mo | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo b/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo index e2caeb31..6d6802ab 100644 --- a/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo +++ b/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo @@ -132,11 +132,6 @@ equation preserveAspectRatio=false, extent={{-100,-100},{100,100}}, grid={2,2})), - Window( - x=0.03, - y=0.02, - width=0.95, - height=0.95), Icon(coordinateSystem( preserveAspectRatio=false, extent={{-100,-100},{100,100}}, diff --git a/MetroscopeModelingLibrary/Tests/Multifluid/Machines/CombustionChamber.mo b/MetroscopeModelingLibrary/Tests/Multifluid/Machines/CombustionChamber.mo index 94d9d336..cbd5211f 100644 --- a/MetroscopeModelingLibrary/Tests/Multifluid/Machines/CombustionChamber.mo +++ b/MetroscopeModelingLibrary/Tests/Multifluid/Machines/CombustionChamber.mo @@ -12,12 +12,12 @@ model CombustionChamber input Units.SpecificEnthalpy h_fuel(start=0.9e6); input Units.PositiveMassFlowRate Q_fuel(start=15); - //input Units.SpecificEnthalpy LHV_plant(start=47276868) "Directly assigned in combustion chamber modifiers"; + input Units.SpecificEnthalpy LHV_plant(start=47276868) "Directly assigned in combustion chamber modifiers"; // Parameters parameter Units.FrictionCoefficient combustion_chamber_Kfr = 0.1; - MultiFluid.Machines.CombustionChamber combustion_chamber annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + MultiFluid.Machines.CombustionChamber combustion_chamber(LHV=LHV_plant) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); MetroscopeModelingLibrary.Fuel.BoundaryConditions.Source source_fuel annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=90, @@ -35,6 +35,7 @@ equation source_fuel.P_out = P_fuel; source_fuel.T_out = 160 + 273.15; source_fuel.Q_out = - Q_fuel; + source_fuel.X_molar_CH4=0.82; source_fuel.X_molar_C2H6=0.048; source_fuel.X_molar_C3H8=0.005; From cb07627fe3f3c4e717c460820cb47ae2af8ca55d Mon Sep 17 00:00:00 2001 From: pepmts Date: Thu, 19 Dec 2024 10:06:31 +0100 Subject: [PATCH 5/6] repair balance Signed-off-by: pepmts --- .../MultiFluid/Machines/CombustionChamber.mo | 1 + 1 file changed, 1 insertion(+) diff --git a/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo b/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo index 6d6802ab..2cad8d2c 100644 --- a/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo +++ b/MetroscopeModelingLibrary/MultiFluid/Machines/CombustionChamber.mo @@ -73,6 +73,7 @@ equation Q_air = sink_air.Q_in; Q_fuel = sink_fuel.Q_in; Q_exhaust = - source_exhaust.Q_out; + h_exhaust = source_exhaust.h_out; h_in_air = sink_air.h_in; h_in_fuel = sink_fuel.h_in; From 51432eb0f8dcb933b585dae9fe6069b20e294326 Mon Sep 17 00:00:00 2001 From: pepmts Date: Thu, 19 Dec 2024 10:29:44 +0100 Subject: [PATCH 6/6] updated examples files Signed-off-by: pepmts --- MetroscopeModelingLibrary/Examples/CCGT/GasTurbine_direct.mo | 4 ++-- MetroscopeModelingLibrary/Examples/CCGT/GasTurbine_reverse.mo | 4 ++-- .../Examples/CCGT/MetroscopiaCCGT/MetroscopiaCCGT_direct.mo | 2 +- .../Examples/CCGT/MetroscopiaCCGT/MetroscopiaCCGT_reverse.mo | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MetroscopeModelingLibrary/Examples/CCGT/GasTurbine_direct.mo b/MetroscopeModelingLibrary/Examples/CCGT/GasTurbine_direct.mo index fb3b28cf..213954fa 100644 --- a/MetroscopeModelingLibrary/Examples/CCGT/GasTurbine_direct.mo +++ b/MetroscopeModelingLibrary/Examples/CCGT/GasTurbine_direct.mo @@ -22,7 +22,7 @@ model GasTurbine_direct parameter Real combustionChamber_eta = 0.9999; // Inputs for calibration - output Units.NegativeMassFlowRate source_Q "kg/s"; + output Units.PositiveMassFlowRate source_Q "kg/s"; output Real compressor_P_out "barA"; output Real compressor_T_out "degC"; output Real W "MW"; @@ -68,7 +68,7 @@ equation source_fuel.P_out = P_fuel; source_fuel.h_out = h_fuel; source_fuel.Q_out = Q_fuel; - source_fuel.Xi_out = {0.90,0.05,0,0,0.025,0.025}; + source_fuel.Xi_out = {0.80,0.05,0,0,0.025,0.025,0.1}; // Parameters combustion_chamber.Kfr = combustion_chamber_Kfr; diff --git a/MetroscopeModelingLibrary/Examples/CCGT/GasTurbine_reverse.mo b/MetroscopeModelingLibrary/Examples/CCGT/GasTurbine_reverse.mo index 3d0334a7..55452837 100644 --- a/MetroscopeModelingLibrary/Examples/CCGT/GasTurbine_reverse.mo +++ b/MetroscopeModelingLibrary/Examples/CCGT/GasTurbine_reverse.mo @@ -22,7 +22,7 @@ model GasTurbine_reverse parameter Real combustionChamber_eta = 0.9999; // Inputs for calibration - input Units.NegativeMassFlowRate source_Q(start=500) "kg/s"; + input Units.PositiveMassFlowRate source_Q(start=500) "kg/s"; input Real compressor_P_out(start = 16) "barA"; input Real compressor_T_out(start = 406) "degC"; input Real W(start = 200) "MW"; @@ -68,7 +68,7 @@ equation source_fuel.P_out = P_fuel; source_fuel.h_out = h_fuel; source_fuel.Q_out = Q_fuel; - source_fuel.Xi_out = {0.90,0.05,0,0,0.025,0.025}; + source_fuel.Xi_out = {0.80,0.05,0,0,0.025,0.025,0.1}; // Parameters combustion_chamber.Kfr = combustion_chamber_Kfr; diff --git a/MetroscopeModelingLibrary/Examples/CCGT/MetroscopiaCCGT/MetroscopiaCCGT_direct.mo b/MetroscopeModelingLibrary/Examples/CCGT/MetroscopiaCCGT/MetroscopiaCCGT_direct.mo index e134ecda..748a39bd 100644 --- a/MetroscopeModelingLibrary/Examples/CCGT/MetroscopiaCCGT/MetroscopiaCCGT_direct.mo +++ b/MetroscopeModelingLibrary/Examples/CCGT/MetroscopiaCCGT/MetroscopiaCCGT_direct.mo @@ -693,7 +693,7 @@ equation Q_fuel_source_sensor.Q = Q_fuel_source; P_fuel_source_sensor.P_barA = P_fuel_source; T_fuel_source_sensor.T_degC = T_fuel_source; - source_fuel.Xi_out = {0.90,0.05,0,0,0.025,0.025}; + source_fuel.Xi_out = {0.80,0.05,0,0,0.025,0.025,0.1}; // Air Filter // Quantities definition diff --git a/MetroscopeModelingLibrary/Examples/CCGT/MetroscopiaCCGT/MetroscopiaCCGT_reverse.mo b/MetroscopeModelingLibrary/Examples/CCGT/MetroscopiaCCGT/MetroscopiaCCGT_reverse.mo index a3f03037..f8dd9374 100644 --- a/MetroscopeModelingLibrary/Examples/CCGT/MetroscopiaCCGT/MetroscopiaCCGT_reverse.mo +++ b/MetroscopeModelingLibrary/Examples/CCGT/MetroscopiaCCGT/MetroscopiaCCGT_reverse.mo @@ -399,7 +399,7 @@ equation Q_fuel_source_sensor.Q = Q_fuel_source; P_fuel_source_sensor.P_barA = P_fuel_source; T_fuel_source_sensor.T_degC = T_fuel_source; - source_fuel.Xi_out = {0.90,0.05,0,0,0.025,0.025}; + source_fuel.Xi_out = {0.80,0.05,0,0,0.025,0.025,0.1}; // Air Filter // Quantities definition