Function LAMBD(T0;T;a) //function to calculate the air factor knowing a (4 for CH4), T0 recatant initial temperature and T adiabatic temperature //CH4 + lambda (1+a/4) (O2 + 3.76 N2) <--> CO2 + 2 H2O + 3.76 lambda (1+a/4) N2 + (lambda-1) (1+a/4)O2 num= enthalpy(CH4;T=T0)-enthalpy(CO2;T=T)-a/2*enthalpy(H2O;T=T)+(1+a/4)*enthalpy(O2;T=T) denom=(1+a/4)*3,76*(enThalpy(N2;T=T)-enthalpy(N2;T=T0)) +(1+a/4)*(enthalpy(O2;T=T)-enthalpy(O2;T=T0)) LAMBD= num/denom END Function h_products(T;a;lambda) //function to calculate the enthalpy of reactants knowing a (4 for CH4), air factor lambda and temperature T //CH4 + lambda (1+a/4) (O2 + 3.76 N2) <--> CO2 + (1+a/4) H2O + 3.76 lambda (1+a/4) N2 + (lambda-1) (1+a/4) O2 nb_moles=(1+(1+a/4)+3,76*lambda*(1+a/4)+(lambda-1)*(1+a/4)) molar_mass=MolarMass(CO2)/nb_moles+MolarMass(H2O)*(1+a/4)/nb_moles+MolarMass(N2)*3,76*lambda*(1+a/4)/nb_moles+MolarMass(O2)*(lambda-1)*(1+a/4)/nb_moles fract_CO2=1/nb_moles*MolarMass(CO2)/molar_mass fract_H2O=(1+a/4)/nb_moles*MolarMass(H2O)/molar_mass fract_N2=3,76*lambda*(1+a/4)/nb_moles*MolarMass(N2)/molar_mass fract_O2=(lambda-1)*(1+a/4)/nb_moles*MolarMass(O2)/molar_mass h_products=enThalpy(CO2;T=T)*fracT_CO2+enthalpy(H2O;T=T)*fract_H2O+enthalpy(N2;T=T)*fract_N2+enthalpy(O2;T=T)*fract_O2 END Function s_products(T;P;a;lambda) //function to calculate the enthalpy of reactants knowing a (4 for CH4), air factor lambda and temperature T //CH4 + lambda (1+a/4) (O2 + 3.76 N2) <--> CO2 + (1+a/4) H2O + 3.76 lambda (1+a/4) N2 + (lambda-1) (1+a/4) O2 nb_moles=(1+(1+a/4)+3,76*lambda*(1+a/4)+(lambda-1)*(1+a/4)) molar_mass=MolarMass(CO2)/nb_moles+MolarMass(H2O)*(1+a/4)/nb_moles+MolarMass(N2)*3,76*lambda*(1+a/4)/nb_moles+MolarMass(O2)*(lambda-1)*(1+a/4)/nb_moles fract_CO2=1/nb_moles*MolarMass(CO2)/molar_mass fract_H2O=(1+a/4)/nb_moles*MolarMass(H2O)/molar_mass fract_N2=3,76*lambda*(1+a/4)/nb_moles*MolarMass(N2)/molar_mass fract_O2=(lambda-1)*(1+a/4)/nb_moles*MolarMass(O2)/molar_mass mixEntropy=-8,314/molar_mass*(1/nb_moles*ln(1/nb_moles)+(a/2)/nb_moles*ln((a/2)/nb_moles)+3,76*lambda*(1+a/4)/nb_moles*ln(3,76*lambda*(1+a/4)/nb_moles)+(lambda-1)*(1+a/4)/nb_moles*ln((lambda-1)*(1+a/4)/nb_moles)) s0=entropy(CO2;T=T;P=P)*fract_CO2+entropy(H2O;T=T;P=P)*fract_H2O+entropy(N2;T=T;P=P)*fract_N2+entropy(O2;T=T;P=P)*fract_O2 s_products= s0 +mixEntropy END //EQUATIONS //Units: SI, Temperatures in Celsius, pressures in bar //Project file: D:\_classement\_Thopt\THERMOPTIM_Pro_282\proj\CC1P_En,prj //Date and Time: 2024-08-15 10:41:35 //Flow rate unit: kg/s //GAS COMPOSITIONS //gaz_brulés //CO2 0,047180889401337925 //H2O 0,03591547827957794 //O2 0,16188344594525753 //N2 0,7428161903169307 //Ar 0,012203996056895823 //Montoir natural gas //CH4 ` methane 0,7589660273748472 //C2H6 ` ethane 0,14372793810423284 //C3H8 ` propane 0,05987758826605583 //C4H10 ` n-butane 0,025255914824295813 //N2 0,012172531430568422 //air //N2 0,7555302216468832 //Ar 0,012416359476160373 //O2 0,2320534188769565 //PROCESSES //Process: gas exhaust //Equation: 1 m_dot_gasexhaust = m_dot_HRSG3 // Upstream process - HRSG 3 //Equation: 2 //m_dot_gasexhaust = 559,57063 // Given value //Process: HRSG 3 //Equation: 3 m_dot_HRSG3 = m_dot_HRSG2 // Upstream process - HRSG 2 // Comment = //Exchange process connected to a heat exchanger //Process: HRSG 2 //Equation: 4 m_dot_HRSG2 = m_dot_HRSG1 // Upstream process - HRSG 1 // Comment = //Exchange process connected to a heat exchanger //Process: HRSG 1 //Equation: 5 m_dot_HRSG1 = m_dot_gasturbine // Upstream process - gas turbine // Comment = //Exchange process connected to a heat exchanger //Process: air inlet //Equation: 6 m_dot_airinlet = 550,0 // Given value //Equation: 7 T_airinlet = 15,0// Given value (Celsius) //Equation: 8 p_airinlet = 1,0// Given value (bar) //Equation: 9 h_airinlet = enthalpy(Air;T = T_airinlet) // Downstream point - air inlet //Equation: 10 //m_dot_aircompressor = m_dot_airinlet //Flow propagation //Process: fuel //Equation: 11 //m_dot_fuel = 9,57063 // Given value //Equation: 12 //T_fuel = 18,0// Given value (Celsius) //Equation: 13 p_fuel = 20,0// Given value (bar) //Equation: 14 h_fuel = enthalpy(CH4;T = T_fuel) // Downstream point - fuel //Equation: 15 //m_dot_combustionchamber = m_dot_fuel //Flow propagation //Process: feed water pump //Equation: 16 s_1 = entropy(Water;P = p_1;H = h_1) // Upstream point - 1 - Downstream point - 2 // Comment = Isentropic reference //Equation: 17 hs_2 = enthalpy(Water;P = p_2;S = s_1) // Downstream point - 2 //Equation: 18 etaT_feedwaterpump = 1,0// Isentropic efficiency //Equation: 19 v_2 = volume(Water;P = p_2;H = h_2) // Downstream point volume - //Equation: 20 h_2 = h_1 + v_2*(p_2 - p_1)/100, // Liquid compression //Equation: 21 T_2 = temperature(Water;P = p_2;H = h_2) // Downstream point - 2 // Comment = Given outlet pressure //Equation: 22 p_2 = 120,0// Outlet pressure //Equation: 23 W_dot_feedwaterpump = m_dot_feedwaterpump*(h_2 - h_1) // DeltaH //Process: turbine //Equation: 24 m_dot_turbine = m_dot_superheater // Upstream process - superheater //Equation: 25 s_3 = entropy(Water;P = p_3;H = h_3) // Upstream point - 3 - Downstream point - 4 // Comment = Isentropic reference //Equation: 26 hs_4 = enthalpy(Water;P = p_4;S = s_3) // Downstream point - 4 //Equation: 27 etaT_turbine = 0,85// Isentropic efficiency //Equation: 28 h_4 = h_3 - etaT_turbine*(h_3 - hs_4) // Upstream point - 3 - Downstream point - 4 //Equation: 29 xl_4 = 0,// Saturated liquid quality //Equation: 30 Tl_4 = T_4- 0,01// Saturated liquid temperature //Equation: 31 xv_4 = 1,// Saturated vapor quality //Equation: 32 Tv_4 = T_4+ 0,01// Saturated vapor temperature //Equation: 33 hl_4 = enthalpy(Water;P = p_4;X = xl_4)// Saturated liquid enthalpy //Equation: 34 hv_4 = enthalpy(Water;P = p_4;X = xv_4)// Saturated vapor enthalpy //Equation: 35 x_4 = (h_4 - hl_4)/(hv_4 - hl_4)// Quality //Equation: 36 T_4 = t_sat(Water;P = p_4) // Downstream point - 4 //Equation: 37 s_4 = entropy(Water;P = p_4;H = h_4) // Entropy // Comment = Given outlet pressure //Equation: 38 p_4 = 0,03// Outlet pressure //Equation: 39 W_dot_turbine = m_dot_turbine*(h_4 - h_3) // DeltaH //Process: condenser //Equation: 40 m_dot_condenser = m_dot_turbine // Upstream process - turbine // Comment = mDeltaH not set //Equation: 41 Q_dot_condenser/m_dot_condenser = h_1 - h_4 // Upstream point - 4 - Downstream point - 1 - DeltaH/flow //Process: economizer //Equation: 42 m_dot_economizer = m_dot_feedwaterpump // Upstream process - feed water pump // Comment = isobaricExchange //Equation: 43 p_3a = p_2 // Upstream point - 2 - Downstream point - 3a // Comment = //Exchange process connected to a heat exchanger //Process: superheater //Equation: 44 m_dot_superheater = m_dot_evaporator // Upstream process - evaporator // Comment = isobaricExchange //Equation: 45 p_3 = p_3b // Upstream point - 3b - Downstream point - 3 // Comment = //Exchange process connected to a heat exchanger //Process: evaporator //Equation: 46 m_dot_evaporator = m_dot_economizer // Upstream process - economizer // Comment = isobaricExchange //Equation: 47 p_3b = p_3a // Upstream point - 3a - Downstream point - 3b // Comment = //Exchange process connected to a heat exchanger //Process: air compressor //Equation: 48 m_dot_aircompressor = m_dot_airinlet // Upstream process - air inlet //Equation: 49 s_airinlet = entropy(Air;P = p_airinlet;H = h_airinlet) // Upstream point - air inlet - Downstream point - compressed air // Comment = Polytropic reference //Equation: 50 ds_compressedair = (1 - etaT_aircompressor)/etaT_aircompressor*8,314/M_airinlet*ln(p_compressedair/p_airinlet) // Upstream point - air inlet - Downstream point - compressed air //Equation: 51 s_compressedair = s_airinlet + ds_compressedair // Entropy - compressed air //Equation: 52 M_airinlet = 28,957763399999997 // Molar mass - compressed air //Equation: 53 etaT_aircompressor = 0,85// Polytropic efficiency // Comment = Polytropic coefficient: k = -Math,log(aval,p/amont,p)/Math,log(aval,V/amont,V) //Equation: 54 h_compressedair = enthalpy(Air;P = p_compressedair;S = s_compressedair) // Enthalpy //Equation: 55 T_compressedair = temperature(Air;H = h_compressedair) // Downstream point - compressed air // Comment = Given outlet pressure //Equation: 56 p_compressedair = 16,0// Outlet pressure //Equation: 57 W_dot_aircompressor = m_dot_aircompressor*(h_compressedair - h_airinlet) // DeltaH //Process: gas turbine //Equation: 58 m_dot_gasturbine = m_dot_combustionchamber // Upstream process - combustion chamber //Equation: 59 //s_hotgas = entropy(gaz_brulés;P = p_hotgas;H = h_hotgas) // Upstream point - hot gas - Downstream point - expanded gas s_hotgas = s_products(T_hotgas;p_hotgas;a_combustionchamber;lambda_combustionchamber)// entropy of the reactants /// Comment = Polytropic reference //Equation: 60 ds_expandedgas = -(1 - etaT_gasturbine)*8,314/M_hotgas*ln(p_expandedgas/p_hotgas) // Upstream point - hot gas - Downstream point - expanded gas //Equation: 61 s_expandedgas = s_hotgas + ds_expandedgas // Entropy - expanded gas //Equation: 62 M_hotgas = 28,615042026734177 // Molar mass - expanded gas //Equation: 63 etaT_gasturbine = 0,85// Polytropic efficiency //Equation: 64 //h_expandedgas = enthalpy(gaz_brulés;P = p_expandedgas;S = s_expandedgas) // Enthalpy // Comment = Polytropic coefficient: k = -Math,log(aval,p/amont,p)/Math,log(aval,V/amont,V) //Equation: 65 //h_expandedgas = enthalpy(gaz_brulés;P = p_expandedgas;S = s_expandedgas) // Enthalpy h_expandedgas = h_products(T_expandedgas;a_combustionchamber;lambda_combustionchamber)// enthalpy of the reactants //Equation: 66 //T_expandedgas = temperature(gaz_brulés;H = h_expandedgas) // Downstream point - expanded gas s_expandedgas = s_products(T_expandedgas;p_expandedgas;a_combustionchamber;lambda_combustionchamber)// enropy of the // // Comment = Given outlet pressure // Comment = Given outlet pressure //Equation: 67 p_expandedgas = 1,3// Outlet pressure //Equation: 68 W_dot_gasturbine = m_dot_gasturbine*(h_expandedgas - h_hotgas) // DeltaH //Process: combustion chamber // Comment = Calculate lambda simplified model oxidizer air, fuel CH4 //Equation: 69 T_hotgas = 1120,0// Given value (Celsius) //Equation: 70 a_combustionchamber = 4// for CH4 //Equation: 71 lambda_combustionchamber = lambd(T_compressedair;T_hotgas;a_combustionchamber)// air factor lambda //Equation: 72 h_hotgas = h_products(T_hotgas;a_combustionchamber;lambda_combustionchamber)// enthalpy of the reactants //Equation: 73 hfict_compressedair = h_products(T_compressedair;a_combustionchamber;lambda_combustionchamber)// enthalpy of a fictitious inlet point for calculating the heat released //Equation: 74 m_dot_combustionchamber = m_dot_aircompressor + m_dot_fuel // Upstream process - air compressor - Fuel process fuel - Downstream process - combustion chamber //Equation: 75 Q_dot_combustionchamber = (h_hotgas - hfict_compressedair)*m_dot_combustionchamber // DeltaH //Equation: 76 DeltaHr_combustionchamber = (-(-74850) +(-393520)+a_combustionchamber/2*(-242000))/16 // DeltaHr (kJ/kg) = (-(-74850) +(-393520) + a/2* (-242000))/16 for methane //Equation: 77 m_dot_fuel = abs(Q_dot_combustionchamber/DeltaHr_combustionchamber) // fuel flow rate // Comment = Isobaric process //Equation: 78 p_hotgas = p_compressedair// Isopressure //Equation: 79 T_fuel = 18,0// Given value (Celsius) //Equation: 80 //p_fuel = 20,0// Given value (bar) //Equation: 81 //h_fuel = enthalpy(CH4;T = T_fuel) // Fuel point - fuel //NODES //HEAT EXCHANGERS //Heat exchanger: superheater //Equation: 82 mCp_superheater = (h_3 - h_3b)/(T_3 - T_3b)*m_dot_superheater // mCpf =deltaH/deltaT - superheater //Equation: 83 mCp_HRSG1 = (h_gas1 - h_expandedgas)*m_dot_HRSG1/(T_gas1 - T_expandedgas) // mCpc =-deltaH/deltaT - HRSG 1 // Comment = mCpc>mCpf //Equation: 84 UA_superheater = NTU_superheater *mCp_superheater // Cold fluid - superheater //Equation: 85 R_superheater = mCp_superheater /mCp_HRSG1 // Hot fluid - HRSG 1 - Cold fluid - superheater //Equation: 86 T_3 = T_3b + epsilon_superheater*(T_expandedgas - T_3b) // Hot fluid outlet temperature //Equation: 87 h_3 = enthalpy(Water;P = p_3;T = T_3)// Enthalpy //Equation: 88 h_gas1 = - m_dot_superheater /m_dot_HRSG1*(h_3 - h_3b) + h_expandedgas // Hot fluid - HRSG 1 - Cold fluid - superheater //Equation: 89 //T_gas1 = temperature(gaz_bruls;P = p_gas1;H = h_gas1)// Hot fluid outlet temperature h_gas1 = h_products(T_gas1;a_combustionchamber;lambda_combustionchamber)// enthalpy of the reactants // Comment = epsilon given value //Equation: 90 //epsilon_superheater = 0,8319416771796286 // Given value //We calculate epsilon_superheater as a function of T_3 which is set T_3 = 520 //Equation: 91 argLn_superheater = (1 - epsilon_superheater*R_superheater)/(1 - epsilon_superheater) //Equation: 92 NTU_superheater = 1/(1 - R_superheater)*ln(argLn_superheater) // Counterflow heat exchanger //Equation: 93 Q_dot_HRSG1 = m_dot_HRSG1*(h_gas1 - h_expandedgas) // DeltaH hot fluid //Equation: 94 Q_dot_superheater = m_dot_superheater*(h_3 - h_3b) // DeltaH cold fluid //Heat exchanger: evaporator //Equation: 95 mCp_evaporator = (h_3b - h_3a)/(T_3b - T_3a)*m_dot_evaporator // mCpf =deltaH/deltaT - evaporator //Equation: 96 mCp_HRSG2 = (h_gas2 - h_gas1)*m_dot_HRSG2/(T_gas2 - T_gas1) // mCpc =-deltaH/deltaT - HRSG 2 // Comment = mCpcmCpf //Equation: 110 UA_economizer = NTU_economizer *mCp_economizer // Cold fluid - economizer //Equation: 111 R_economizer = mCp_economizer /mCp_HRSG3 // Hot fluid - HRSG 3 - Cold fluid - economizer //Equation: 112 T_3a = T_2 + epsilon_economizer*(T_gas2 - T_2) // Hot fluid outlet temperature //Equation: 113 h_3a = enthalpy(Water;P = p_3a;T = T_3a)// Enthalpy //Equation: 114 h_gas3 = - m_dot_economizer /m_dot_HRSG3*(h_3a - h_2) + h_gas2 // Hot fluid - HRSG 3 - Cold fluid - economizer //Equation: 115 //T_gas3 = temperature(gaz_bruls;P = p_gas3;H = h_gas3)// Hot fluid outlet temperature h_gas3 = h_products(T_gas3;a_combustionchamber;lambda_combustionchamber)// enthalpy of the reactants // Comment = epsilon given value //Equation: 116 epsilon_economizer = 0,9682745608816544 // Given value //Equation: 117 argLn_economizer = (1 - epsilon_economizer*R_economizer)/(1 - epsilon_economizer) //Equation: 118 NTU_economizer = 1/(1 - R_economizer)*ln(argLn_economizer) // Counterflow heat exchanger //Equation: 119 Q_dot_HRSG3 = m_dot_HRSG3*(h_gas3 - h_gas2) // DeltaH hot fluid //Equation: 120 Q_dot_economizer = m_dot_economizer*(h_3a - h_2) // DeltaH cold fluid //Number of equations: 120 //POINTS WITH SATURATION TEMPERATURE SET //Point 1 //Outlet point of process condenser //Equation: 121 p_1 = 0,03// P (bar) //Equation: 122 x_1 = 0,0// Quality //Equation: 123 dTsat_1 = 0,0// Deviation from Tsat //Equation: 124 T_1 = t_sat(Water;P = p_1)+dTsat_1// set Tsat (Celsius) //Equation: 125 h_1 = enthalpy(Water;P = p_1;X = x_1)// Enthalpy //Point 3a //Outlet point of process economizer //Equation: 126 x_3a = 0,0// Quality //Equation: 127 dTsat_3a = 0,0// Deviation from Tsat //Equation: 128 //T_3a = T_sat(water;P = p_3a)+dTsat_3a// set Tsat (Celsius) //Equation: 129 //h_3a = enthalpy(water;P = p_3a;X = x_3a)// Enthalpy //Point 3b //Outlet point of process evaporator //Equation: 130 x_3b = 1,0// Quality //Equation: 131 dTsat_3b = 0,1// Deviation from Tsat //Equation: 132 //T_3b = T_sat(water;P = p_3b)+dTsat_3b// set Tsat (Celsius) //Equation: 133 //h_3b = enthalpy(water;P = p_3b;X = x_3b)// Enthalpy //Point 4 //Outlet point of process turbine //Equation: 134 //x_4 = 0,843713553// Quality //Equation: 135 dTsat_4 = 0,0// Deviation from Tsat //Equation: 136 //T_4 = T_sat(water;P = p_4)+dTsat_4// set Tsat (Celsius) //Equation: 137 //h_4 = enthalpy(water;P = p_4;X = x_4)// Enthalpy //OTHER POINTS WITH PRESSURE SET //SET FLOW RATES //Equation: 138 m_dot_feedwaterpump = 74,0// Given flow //OVERALL BALANCE //Equation: 138 useful_Energy = W_dot_feedwaterpump + W_dot_turbine + W_dot_aircompressor + W_dot_gasturbine //Equation: 139 purchased_Energy = Q_dot_combustionchamber //Equation: 140 eta_global = abs(useful_Energy/purchased_Energy) p_gas3 = 1 p_gas2 = 1,1 p_gas1 = 1,2