Project 2 - Rankine cycle Simulator
PROGRAM OF RANKINE CYCLE SIMULATOR:
clear all
close all
clc
disp('RANKINE CYCLE SIMULATOR');
disp('1-2 is Isentropic Expansion in the turbine');
disp('2-3 is constant pressure heat rejection by condenser');
disp('3-4 is isentropic compression in pump');
disp('4-1 is constant pressure heat addition by the boiler');
fprintf('n');
%Taking inputs from user
P1 = 30
T1 = 400
P2 = 0.05
%Calcualting State values
%At state point1
H1 = XSteam('h_pT',30,400);
S1 = XSteam('s_pT',30,400);
S_L1 = XSteam('sL_p',30);
S_G1 = XSteam('sV_p',30);
T_sat1 = XSteam('Tsat_p',30);
%At State point2
S2 = S1;
S_L2 = XSteam('sL_p',0.05);
S_G2 = XSteam('sV_p',0.05);
D = (S2-S_L2)/(S_G2-S_L2); %Calculating Dryness Fraction
H_L2 = XSteam('hL_p',0.05);
H_G2 = XSteam('hV_p',0.05);
H2 = H_L2+D*(H_G2-H_L2); %Calculating enthalpy at point2
T2 = XSteam('T_ph',0.05,H2);
T_sat2 = XSteam('Tsat_p',0.05);
%At state point3
P3= P2;
T3 = T2
H3 = H_L2;
S3 = S_L2;
V3 = XSteam('vL_p',P3);
%At state point4
P4 = P1;
S4 = S3;
T4 = XSteam('T_pS',P4,S4);
H4 = XSteam('H_pS',P4,S4);
Cp4 = XSteam('Cp_pS',P4,S4);
Cv4 = XSteam('Cv_pS',P4,S4);
%Calculate the work
%Turbine Work
W_T = H1-H2;
%Pump Work
W_P = H4-H3;
%Net Work
W_NET = W_T-W_P;
%Heat Addition
Q_A =H1-H4;
%Heat Rejection
Q_R = H2-H3;
%Thermal Efficiency
Eff = (W_NET/(H1-H4))*100;
%Back Work Ratio
BWR = W_P/W_T;
%Specific Steam Conductivity
S.S.C = 3600/W_T;
%Plot T-S
figure(1)
hold on
plot(S_G1,T1,'color','b'); %saturated state point against time
plot(S_L1,T1,'color','b'); %saturated state point against time
plot([S1,S2],[T1,T2],'r','linewidth',2);
plot([S2,S3],[T2,T3],'r','linewidth',2) %state point for Entropy and temperature
plot([S3,S4],[T3,T4],'r','linewidth',2); %to plot
plot([S1,S2],[T1,T2],'r','linewidth',2);
plot([S4,S_L1],[T4,T_sat1],'r','linewidth',2);
plot([S_L1,S_G1],[T_sat1,T_sat1],'r','linewidth',2);
plot([S_G1,S1],[T_sat1,T1],'r','linewidth',2);
text(S1,T1,'1');
text(S1,T2,'2');
text(S3,T3,'3','HorizontalAlignment','Left','VerticalAlignment','top');
text(S_L1,T_sat1,'4','HorizontalAlignment','Right','VerticalAlignment','bottom');
text(S_G1,T_sat1,'5','HorizontalAlignment','Right','VerticalAlignment','bottom');
title('T-S Graph')
xlabel('Entropy[KJ/KG.K]')
ylabel('Temperature[Degree Celcius]')
%Plotting of H-S curve
figure(2)
hold on
plot(S_G2,H_G2,'linestyle','--','color','r');
plot(S_L2,H_L2,'linestyle','--','color','r');
plot([S1,S2,S3,S4,S1],[H1,H2,H3,H4,H1],'b','linewidth',2);
text(S1,H1,'1');
text(S1,H2,'2');
text(S3,H3,'3');
text(S4,H4,'4')
xlabel('Entropy(Kj/kg-k)')
ylabel('Enthalpy(Kj/kg)')
title('H-S Graph')


Explanation :
1. Program starts with clear all, close all, clc.
2. Initially it calculates entropy for second state point as expansion in turbine is isentropic values for entropies and other data in code is exported from XSteam.m file given.
3. Using the obtained data entropy at third state point is known with whichb entropy at boiler inlet is also obtained as pump in an isentropic process.
4. Similarly values for enthalpy is also found out.
5. Using the appropriate formulas and data generated parameters of rankine cycle is found out.
6. Required data as asked is pointed as output.
7. For plotting of T-S diagram : isentropic process and constant pressure heat addition and rejection at latent heat temperature follow a straight line. So, can be plotted with two end points.
8. For constant pressure heat addition and rejection at sensible heat temperature it follows the constant pressure line hence data is to be generated at each point. This is done by making use of loop.
9. Finally if dryness fraction is greater than one at turbine outlet condition than heat rejection in condenser will initially follow constant pressure curve until it reaches situation vapour temperature it is less than one steam is wet in condition.