Project 2 - Rankine cycle Simulator
clear all
close all
clc
% Display Representation of individual process.
fprintf('Rankine cycle simulator')
fprintf('\n1-2 is Isentropic Expansion in Turbine \n')
fprintf('2-3 is Const Pressure heat rejection by the condenser\n')
fprintf('3-4 is Isentropic compression in the pump\n')
fprintf('4-1 is Const Pressure heat addition by the boiler')
% take input from the user turbine inlet temp pr and turbine outlet pr.
P1=input('\nEnter pressure at the inlet of the turbine (in bar): ');
T1=input('Enter Temperature at the inlet of the turbine (in degree celsius): ');
P2=input('Enter pressure at the outlet of the turbine (in bar): ');
% take data from xsteam file
H1=XSteam('h_pt',P1,T1); %Enthalpy
S1 = XSteam('s_pt',P1,T1); %Entropy
Hf1 = XSteam('hL_p',P1); %Enthalpy of sat liq
Hg1 = XSteam('hV_p',P1); %Enthaply of sat vap
Ts1 = XSteam('Tsat_p',P1); %Saturation Temprature
Sf1 = XSteam('sL_p',P1); %Entropy of satliq
Sg1 = XSteam('sV_p',P1); % Entropy of sat vapour
S2 = S1;
Sf2 = XSteam('sL_p',P2);
Sg2 = XSteam('sV_p',P2);
x = (S2-Sf2)/(Sg2-Sf2); % Dryness fraction
Hf2 = XSteam('hL_p',P2);
Hg2 = XSteam('hV_p',P2);
H2 = Hf2 + x*(Hg2-Hf2);
T2 = XSteam('T_ph',P2,H2);
Ts2 = XSteam('Tsat_p',P2);
P3=P2;
H3 = Hf2;
S3 = Sf2;
T3 = T2;
P4 = P1;
S4 = S3;
H4 = XSteam('h_ps',P4,S4);
T4 = XSteam('T_ps',P4,S4);
% calc of various parameters
% Turbine Work
Wt = H1-H2;
% Pump Work
Wp = H4-H3;
% Heat Addition
Qin = H1-H4;
% Heat Rejection
Qout = H2-H3;
% Net Work
Wnet = Wt-Wp;
% Efficiency
Ntherm = (Wnet/Qin)*100;
% Specific steam consumption
SSC = 3600/Wnet;
% Back Work Ratio
BWR = Wp/Wt;
fprintf('\n\nResults\n')
fprintf('At State Point 1:\n')
fprintf('P1 is : %.2f bar\n',P1)
fprintf('T1 is : %.2f Deg Celcius\n',T1)
fprintf('H1 is : %.2f KJ/Kg\n',H1)
fprintf('S1 is : %.2f KJ/Kg-K\n',S1)
fprintf('\nAt State Point 2:\n')
fprintf('P2 is : %.2f bar\n',P2)
fprintf('T2 is : %.2f Deg Celcius\n',T2)
fprintf('H2 is : %.2f KJ/Kg\n',H2)
fprintf('S2 is : %.2f KJ/Kg-K\n',S2)
fprintf('\nAt State Point 3:\n')
fprintf('P3 is : %.2f bar\n',P3)
fprintf('T3 is : %.2f Deg Celcius\n',T3)
fprintf('H3 is : %.2f KJ/Kg\n',H3)
fprintf('S3 is : %.2f KJ/Kg-K\n',S3)
fprintf('\nAt State Point 4:\n')
fprintf('P4 is : %.2f bar\n',P4)
fprintf('T4 is : %.2f Deg Celcius\n',T4)
fprintf('H4 is : %.2f KJ/Kg\n',H4)
fprintf('S4 is : %.2f KJ/Kg-K\n',S4)
fprintf('\nWork done by turbine Wt is : %.2f KJ/Kg\n',Wt)
fprintf('work in at pump Wp is : %.2f KJ/Kg\n',Wp)
fprintf('Wnet is : %.2f KJ/Kg\n',Wnet)
fprintf('Thermal Efficiency is : %.2f percent\n',Ntherm)
fprintf('S.S.C. is : %.2f Kg/KWh\n',SSC)
fprintf('Back Work Ratio is : %.4f \n',BWR)
% Generate plot
figure(1)
plot([S1 S2 S3 S4 S1],[T1 T2 T3 T4 T1],'linewidth',2,'color','r')
xlabel('entropy')
ylabel('temperature')
figure(2)
plot([H1 H2 H3 H4 H1],[S1 S2 S3 S4 S1],'linewidth',2,'color','r')
xlabel('ENTHALPY')
ylabel('ENTROPY')
Rankine cycle simulator:
This program is to calculate the various state points of a Rankine cycle by taking user inputs like the turbine inlet temp and pressure and turbine outlet pressure and a plot is generated temperature vs entropy and enthalpy vs entropy.
first, we display the representation of various processes of a Rankine cycle by using fprintf command.
then we take input from the user reg turbine inlet temp, pressure, and turbine outlet pressure using input command and is stored in variables P1, T1, P2 respectively.
Now we have to calculate the state points by looking at the steam table.
so we use the Xsteam file that was provided and we find the values at a particular state point by calling the Xsteam function as given in the example.
then we calculate all the performance parameters like work output, work input, efficiency etc... by using suitable thermodynamic relations.