Skip to content

Add H2 into our fuel media #517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MetroscopeModelingLibrary/Examples/CCGT/GasTurbine_direct.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions MetroscopeModelingLibrary/Examples/CCGT/GasTurbine_reverse.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions MetroscopeModelingLibrary/Fuel/BoundaryConditions/Source.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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
Expand All @@ -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;
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ 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";
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 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 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";

// Initialization parameters
parameter Units.SpecificEnthalpy h_in_air_0 = 5e5;
Expand All @@ -72,10 +73,10 @@ 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;
h_exhaust = source_exhaust.h_out;

X_in_N2 = sink_air.Xi_in[1];
X_in_O2 = sink_air.Xi_in[2];
Expand All @@ -89,6 +90,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];
Expand All @@ -112,7 +114,7 @@ equation
// 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
Expand All @@ -131,11 +133,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}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ 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.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.1;

// Parameters
combustion_chamber.Kfr = combustion_chamber_Kfr;
Expand Down
22 changes: 22 additions & 0 deletions MetroscopeModelingLibrary/Utilities/Constants/package.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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={
Expand Down
13 changes: 13 additions & 0 deletions MetroscopeModelingLibrary/Utilities/Constants/package.order
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ kgs_to_lbs
kgs_to_Mlbh
kgs_to_lbh
m_H
m_H2
m_C
m_O
m_CH4
Expand All @@ -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
10 changes: 6 additions & 4 deletions MetroscopeModelingLibrary/Utilities/Media/FuelMedium/package.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down