homework

heonvhoe
matlabcode.docx

clear,clc; % clears variables and cleans screen%

% Rankine cycle inputs%

Pressure_turbine3 = '(3)What is the Pressure for the turbine inlet?(Bar)';

P3 = (Pressure_turbine3);

%P3 = 125;% % [bar] pressure turbine 3 inlet

Temp_turbine3 = '(3)What is the Temperature for the turbine inlet?(C)';

T3 = (Temp_turbine3);

%T3 = 500;% % [C] temperature turbine 3 inlet

Pressure_turbine5 = '(5)What is the Pressure for the turbine inlet?(Bar)';

P5 = (Pressure_turbine5);

%P5 = 25;% % [bar] pressure turbine 4 inlet

Temp_turbine5 = '(5)What is the Temperature for the turbine inlet?(C)';

T5 = (Temp_turbine5);

%T5 =500;% % [C] temperature turbine 4 inlet

Pressure_pump1 = ' (1) What is the pressure pump inlet? [bar] ';

P1 = (Pressure_pump1);

%P1 = 0.1;% % [bar] pressure pump inlet

Quality_pump1 = ' (1) What is the quality of the pump inlet?(Decimal form)';

x1 = input (Quality_pump1);

%x1 = 0.00;% % [-] quality pump inlet

Temp_comp7 = '(7)What is the Temperature for the Compressor inlet?(C)';

T7 = (Temp_comp7);

%T7=310;%

Temp_comb8 = '(8)What is the Temperature for the combustion chamber inlet?(C)';

T8 = (Temp_comb8);

%T8=700;%

Temp_turbine9 = '(9)What is the Temperature for the turbine inlet?(C)';

T9 = (Temp_turbine9);

%T9=1500;%

Temp_exch10 = '(10)What is the Temperature for the Heat exchanger inlet?(C)';

T10 = (Temp_exch10);

%T10=850;%

Temp_exch11 = '(11)What is the Temperature for the Heat exchanger exit?(C)';

T11 = (Temp_exch11);

%T11=520;%

Workgas = 'What is the power generated by the top cycle?(MW)';

W_gas = (Workgas);

%Wgas = 800000; % [kw]%

effeciency_turbine = 'What is the effiecency of the turbine?';

eff_turbine = (effeciency_turbine);

%eff_turbine = 0.88;% % [-] turbine efficiency

effeciency_pump = 'What is the effiecency of the pump?';

eff_pump = (effeciency_pump);

%eff_pump% = 0.8; % [-] pump efficiency

% Processing: Determine states

% state 3: boiler 3 output / turbine 3 input

s3 = XSteam( 's_pT', P3, T3 );

h3 = XSteam( 'h_ps', P3, s3 );

% state 4: turbine 1 output / boiler 2 input

% - recall isentropic efficiency: eta_turbine = ( h3 - h4 ) / ( h3 - h4s )

P4 = P5;

s4s = s3;

h4s = XSteam( 'h_ps', P4, s4s ); % isentropic enthalpy

h4 = h3 - eff_turbine * ( h3 - h4s );% real enthalpy

s4 = XSteam( 's_ph', P4, h4 );

T4 = XSteam( 'T_ps', P4, s4 );

% state 5: boiler 2 output / turbine 2 input

s5 = XSteam( 's_pT', P5, T5 );

h5 = XSteam( 'h_ps', P5, s5 );

% state 6: turbine 2 output / condenser input

s6s = s5;

P6 = P1;

h6s = XSteam( 'h_ps', P6, s6s );

h6 = h5 - eff_turbine * ( h5 - h6s ); % real enthalpy

s6 = XSteam( 's_ph', P6, h6 );

T6 = XSteam( 'T_ps', P6, s6 );

% additional / optional:

s6V = XSteam( 'sV_p' , P6 );

s6L = XSteam( 'sL_p' , P6 );

x6 = ( s6 - s6L ) / ( s6V - s6L );

% state 1: condenser output / pump input

T1 = XSteam( 'Tsat_p', P1 );

h1 = XSteam( 'hL_p' , P1 );

s1 = XSteam( 'sL_p' , P1 );

% state 2: pumpt output / boiler 3 input

P2 = P3;

s2s = s1;

h2s = XSteam( 'h_ps', P2, s2s );

h2 = h1 + (( h2s - h1)/ eff_pump);

s2 = XSteam( 's_ph', P2, h2 );

T2 = XSteam( 'T_ps', P2, s2 );

% Post-Processing: Power / Heat - Produced / Consumed

% determine power, heat rates:

h7=h_air(T7);

h8=h_air(T8);

h9=h_air(T9);

h10=h_air(T10);

h11=h_air(T11);

w_turb = (h9 -h10);

w_comp = (h7- h8);

M_dot_gas= W_gas/(w_turb+w_comp);

w_turbine1 = ( h3 - h4 );

q_boiler2 = ( h5 - h4 );

w_turbine2 = ( h5 - h6 );

q_condenser = ( h1 - h6 );

w_pump = ( h2 - h1 );

q_boiler1 = ( h3 - h2 );

m_dot= ((h10-h11)*M_dot_gas)/(q_boiler2+q_boiler1);

W_dot_turbine1 = m_dot * ( h3 - h4 );

Q_dot_boiler2 = m_dot * ( h5 - h4 );

W_dot_turbine2 = m_dot * ( h5 - h6 );

Q_dot_condenser = m_dot * ( h1 - h6 );

W_dot_pump = m_dot * ( h2 - h1 );

Q_dot_boiler1 = m_dot * ( h3 - h2 );

W_steam=W_dot_turbine1+W_dot_turbine2-W_dot_pump;

W_steam=W_steam/1000;

Q_dot_in = Q_dot_boiler1 + Q_dot_boiler2;

W_gas=W_gas/1000;

Q_gas= (h9-h8)*M_dot_gas;

Q_gas=Q_gas/1000;

efficiency = ((W_gas+W_steam)/ (Q_gas))*100;

HeatRate=3412/(efficiency/100);

clc;

X = sprintf('The mass flow rate of air into the gas-turbine cycle is: \n %dkg/s \n',round(M_dot_gas));

Y = sprintf('The rate of total heat input into the combustion chamber is: \n %dMw \n',round(Q_gas));

Z = sprintf('The thermal efficiency of the combined cycle is: \n %0.3f%% \n',efficiency);

disp(X);

disp(Y);

disp(Z);