Project 2 - Rankine cycle Simulator
1.Aim :
- To Create a Rankine Cycle Simulator using MATLAB
- Formulas used :


Changed as per our question
- Objective of the project:
- calculate the state points of the Rankine Cycle based on user inputs.
- plot the corresponding T-s and h-s plots for the given set of inputs.
- Body of content:
RANKINE CYCLE:
The Rankine cycle was named after him and describes the performance of steam turbine systems, though the theoretical principle also applies to reciprocating engines such as steam locomotives. The Rankine cycle is an idealized thermodynamic cycle of a constant pressure heat engine that converts part of heat into mechanical work. In this cycle, the heat is supplied externally to a closed loop, which usually uses water (in a liquid and vapor phase) as the working fluid. In contrast to the Brayton cycle, the working fluid in the Rankine cycle undergo the phase change from a liquid to vapor phase and vice versa.

- 1-2 Isentropic expansion (expansion in a steam turbine) – Steam from the boiler expands adiabatically from state 3 to state 4 in a steam turbine to produce work and then is discharged to the condenser (partially condensed). The steam works on the surroundings (blades of the turbine) and loses an amount of enthalpy equal to the work that leaves the system.
- 2-3 Isobaric heat rejection (in a heat exchanger) – In this phase, the cycle completes by a constant-pressure process in which heat is rejected from the partially condensed steam. There is heat transfer from the vapor to cooling water flowing in a cooling circuit. The vapor condenses, and the temperature of the cooling water increases.
- 3-4 Isentropic compression (compression in centrifugal pumps) – The liquid condensate is compressed adiabatically from state 1 to state 2 by centrifugal pumps (usually by condensate pumps and then by feedwater pumps). The liquid condensate is pumped from the condenser into the higher pressure boiler. In this process, the surroundings work on the fluid, increasing its enthalpy (h = u+pv) and compressing it (increasing its pressure). On the other hand, the entropy remains unchanged.
- 4-1 Isobaric heat addition (in a heat exchanger – boiler) – In this phase (between state 2 and state 3), there is a constant-pressure heat transfer to the liquid condensate from an external source since the chamber is open to flow in and out. The feedwater (secondary circuit) is heated to the boiling point (2 → 3a) of that fluid and then evaporated in the boiler (3a → 3).
PROGRAM FOR RANKINE CYCLE SIMULATOR
- Displaying the process and the tile of the program
- getting the inputs from user using input command
- Stating the various parameters such as temperature, pressure,enthaly,entropy, which are used for ploting the T-S Diagram and H-S diagram
- same has been done for all the points
- calculating the workdone and efficiency of the rankine cycle by using formula
- plotting the various points and draw the T-S and H-S Curve using Matlab the same has been attached with this program
- the results were printed in the command window the same as needed screenshot is attached
- pragram is as follows
close all
clear all
clc
%Printing the Process
fprintf('\t\tRANKINE CYCLE SIMULATOR\n\n')
fprintf('Process (1-2) - Isentropic Expansion in the Turbinen\n')
fprintf( 'Process (2-3) - Isobaric Heat Rejection by the Condenser\n')
fprintf('Process (3-4) - Isentropic Compression in the Pump\n')
fprintf('Process (4-1) - Isobaric Heat Addition by the Boiler\n')
%Getting the Inputs
p1 = input('Enter the Pressure at the Turbine Inlet (in bar): ');
t1 = input ('Enter the Temperature at the Turbine inlet (in Degree celsius): ');
p2 = input('Enter the Pressure at the Turbine Outlet (in bar):');
%At State point 1
tsat1 = XSteam('Tsat_p',p1);
h1 = XSteam('h_pT',p1,t1);
s1 = XSteam('s_pT',p1,t1);
hl1 = XSteam('hL_p',p1);
hv1 = XSteam('hV_p',p1);
sl1 = XSteam('sL_p',p1);
sv1 = XSteam('sV_p',p1);
%At state point 2
tsat2 = XSteam('Tsat_p',p2);
t2 = tsat2;
s2 = s1;
sl2 = XSteam('sL_p',p2);
sv2 = XSteam('sV_p',p2);
slv2 = sv2-sl2;
x2 = (s2 - sl2)/slv2;
hl2 = XSteam('hL_p',p2);
hv2 = XSteam('hV_p',p2);
h2 = hl2+(x2*(hv2-hl2));
%At State point 3
p3 = p2;
t3 = XSteam('Tsat_p',p2);
h3 = XSteam('hL_P',p3);
s3 = XSteam('sL_P',p3);
%At State point 4
s4 = s3;
p4 = p1;
h4 = h3 + ((XSteam('v_ps',p4,s4))*(p4-p3));
cp4 = XSteam('Cp_ps',p4,s4);
cv4 = XSteam('Cv_ps',p4,s4);
gamma = (cp4-cv4)/cp4;
t4 = t3*((p4/p3)^gamma);
%Calculation the wokdone
wt = h1-h2;
wp = h4-h3;
qin = h1-h4;
qout = h2-h3;
wnet = wt-wp;
ntherm = (wnet/qin)*100;
ssc = 3600/wnet;
bwr = wp/wt;
%plotting
t = linspace(1,400,100);
for i=1: length(t)
s_l(i) = XSteam('sL_T', t(i));
s_v(i) = XSteam('sV_T', t(i));
h_l(i) = XSteam('hL_T', t(i));
h_v(i) = XSteam( 'hV_T', t(i));
end
%Plotting T-S Diagram
figure(1)
plot ([s1 s2 s3 s4 sl1 sv1 s1], [t1 t2 t3 t4 tsat1 tsat1 t1],'linewidth',3, 'color','r')
hold on
plot(s_l, t, 'color','b')
plot(s_v, t, 'color','b')
axis([0 10 0 700])
text (s1, t1, '1', 'FontSize',15)
text (s2, t2, '2', 'FontSize',15)
text (s3, t3, '3', 'FontSize', 15)
text (s4, t4, '4' , 'FontSize',15)
xlabel( 'Entropy(KJ/Kg-K)' )
ylabel('Temperature(K)')
%Plotting H-S Diagram
figure(2)
plot( [s1 s2 s3 s4 s1],[h1 h2 h3 h4 h1],'color','r', 'linewidth',3)
axis([0 10 300 5000])
hold on
plot(s_v, h_v, 'color','b')
plot(s_l, h_l, 'color','b')
text (s1,h1, '1')
text (s2,h2, '2')
text (s3,h3, '3')
text (s4, h4, ' 4')
xlabel ('Entropy(KJ/Kg-K)' )
ylabel ('Enthalpy (KJ/kgK')
%Printing Results
fprintf('\n\tRESULT\n\n')
fprintf('At State point 1: \nP1 is :%4.2f Bar\nT1 is :%4.2f Deg Celcius\nH1 is :%4.2f kJ/kg\nS1 is : %4.2f KJ/kgk\n\n',p1,t1,h1,s1)
fprintf('At State point 2: \nP2 is :%4.2f Bar\nT2 is :%4.2f Deg Celcius\nH2 is :%4.2f kJ/kg\nS2 is : %4.2f KJ/kgk\nX2 is :%4.2f\n\n',p2,t2,h2,s2,x2)
fprintf('At State point 3: \nP3 is :%4.2f Bar\nT3 is :%4.2f Deg Celcius\nH3 is :%4.2f kJ/kg\nS3 is : %4.2f KJ/kgk\n\n',p3,t3,h3,s3)
fprintf('At State point 4: \nP4 is :%4.2f Bar\nT4 is :%4.2f Deg Celcius\nH4 is :%4.2f kJ/kg\nS4 is : %4.2f KJ/kgk\n\n',p4,t4,h4,s4)
fprintf('Wt is :%4.2f kJ/kg\nWp is :%4.2f kJ/kg\nWnet is :%4.2f kJ/kg\nNtherm is :%4.2f percent\nS.S.C is : %4.2f kg/Kwh',wt,wp,wnet,ntherm,ssc)
5. Results:
- calculated, state points of the Rankine Cycle based on user inputs are published in the command window.
- plot the corresponding T-s and h-s plots for the given set of inputs are attached.
- Rankine Cycle stimulator program runs succesfully.
Reference:
1. https://civil.colorado.edu/~silverst/aren2110/RANKINE%20POWER%20AND%20VCR%20CYCLES.pdf
2.http://www.ecourses.ou.edu/cgi-bin/ebook.cgi?topic=th&chap_sec=10.1&page=theory