Project 2 - Rankine cycle Simulator
AIM:
Create a Rankine Cycle Simulator using MATLAB.
Objective:
- Calculate each state's points of the Rankine Cycle.
- Plot corresponding T-s and h-s plots for the given sets of input.
- Calculate Efficiency.
What is the Rankine Cycle??
The Rankine cycle is a modal used to predict the performance of the steam turbine systems. It was also used to study the performance of reciprocating steam engines. The Rankine cycle is an idealized thermodynamic cycle of a heat engine that converts heat into mechanical work while undergoing a phase change. It is an idealized cycle in which friction losses in each of the four components are neglected. The heat is supplied externally to a closed loop, which usually uses water as the working fluid. It is named after William John Macquorn Rankine, a Scottish polymath, and Glasgow University professor.

- The four processes in the Rankine Cycle:
Process 1-2: The working fluid is pumped from low to high pressure. As the fluid is a liquid at this stage, the pump requires little input energy. In other words Process, 1-2 is Isentropic compression.

Process 2-3: The high-pressure liquid enters a boiler, where it is heated at constant pressure by an external heat source to become a dry saturated vapor. The input energy required can be easily calculated graphically, using an enthalpy-entropy chart, or numerically, using Steam tables. In other words Process, 2-3 is Constant pressure heat addition in the boiler.

Process 3-4: The dry saturated vapor expands through a turbine, generating power. This decreases the temperature and the pressure of the vapor, and some condensation may occur. The output in this process can be easily calculated using the chart or tables. In other words process, 3-4 is Isentropic Expansion.

Process 4-1: The wet vapor then enters a condenser, where it is condensed at a constant pressure to become a saturated liquid. In other words process, 4-1 is constant pressure heat rejection in the condenser.

The efficiency of the Steam Cycle is given by:

The capacity of the Steam Plant is often expressed in terms of Steam Rate(SR) or Specific Steam Consumption(SSC):

Required Inputs are given below:
Turbine Inlet Temperature = 400 degrees Celcius
Turbine Inlet Pressure = 30 bars
Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure
- MATLAB Code:
clear all
close all
clc
% User Inputs
fprintf('%75s','Rankine Cycle Simulator');
fprintf('\n \n \n')
fprintf('1-2 is Isentropic Expansion in the turbine \n');
fprintf('2-3 is Constant Pressure Heat Rejection by the Condensor \n');
fprintf('3-4 is Isentropic Compression in the Pump \n');
fprintf('4-1 is Constant Pressure Heat Addition by the Boiler \n');
% Inputs
p1=input('Enter the Pressure(in bar) at the inlet of the turbine(at point 1):');
t1=input('Enter the Temperature(in degrees) at the inlet of the turbine(at point 1):');
p2=input('Enter the Pressure(in bar) at the inlet of the Condensor(at point 2):');
% Inputs are given to the Turbine
s1=XSteam('s_pT',p1,t1);
h1=XSteam('h_pt',p1,t1);
% Condensor Inlet
s2=s1; %1-2 is an isentropic expansion process
sf2=XSteam('sL_p',p2);
sg2=XSteam('sV_p',p2);
hf2=XSteam('hL_p',p2);
hg2=XSteam('hV_p',p2);
% Calculating dryness fraction
if(s2<=sg2)
x2=((s2-sf2)/(sg2-sf2)); % Dryness Fraction at state point 2
else
x2=1;
end
h2=hf2+(x2*(hg2-hf2));
% Condensor Exit
p3=p2;
t3=XSteam('Tsat_p',p3);
s3=XSteam('sL_p',p3);
h3=XSteam('hL_p',p3);
v3=XSteam('vL_p',p3);
t2=t3;
% Bolier Inputs
% Constant Pressure Heat Addition
p4=p1;
% Isentropic Compression in the Pump
s4=s3;
h4=XSteam('h_ps',p4,s4);
cp4=XSteam('Cp_ps',p4,s4);
cv4=XSteam('Cv_ps',p4,s4);
g4=(cp4/cv4);
% Calculation of t4
% p4^(1-gamma)*t4^gamma=p3^(1-gamma)*t3^gamma;
t4=(t3*((p3/p4)^((1-g4)/g4)));
% Calculations
% Work Done by the Turbine
Wt=h1-h2;
% Work Done by the Pump
Wp=h4-h3;
% Net work done
W_net=Wt-Wp;
% Heat added in the Boiler
q_in=h1-h4;
% Heat rejected in the condensor
q_out=h2-h3;
% Thermal Efficiency
n=(W_net/q_in)*100;
% Plotting the Results
figure(1)
% Plotting Liquid and Vapour curves
t=linspace(1,t1,1000);
for i=1:length(t)
s_1(i)=XSteam('sL_T',t(i));
end
for i=1:length(t)
s_v(i)=XSteam('sV_T',t(i));
end
hold on
plot(s_1,t,'linewidth',2,'linestyle','- -','color','r');
plot(s_v,t,'linewidth',2,'linestyle','- -','color','r');
grid on
% Plotting for the work done by the Turbine(Process 1-2)
plot([s1,s2],[t1,t2],'lineWidth',2,'color','k')
hold on
title('T-s Diagram of Ideal Rankine Cycle')
xlabel('Entropy(KJ/KgK)')
ylabel('Temperature(k)')
% Plotting for heat Rejected in Condensor(Process 2-3)
plot([s2,s3],[t2,t3],'lineWidth',2,'color','k')
hold on
% Plotting for work done by the Pump (Process 3-4)
plot([s3,s4],[t3,t4],'lineWidth',2,'color','k')
hold on
% Plotting for heat addition by the Boiler (Process 4-1)
tp=XSteam('Tsat_p',p4);
sp=XSteam('sL_T',tp);
plot([s4,sp],[t4,tp],'lineWidth',2,'color','k')
hold on
tq=tp;
sq=XSteam('sV_T',tq);
plot([sp,sq],[tp,tq],'lineWidth',2,'color','k')
hold on
plot([sq,s1],[tq,t1],'lineWidth',2,'color','k')
hold on
% Indicate the States with numbers
text(s1,t1,'1');
text(s2,t2,'2');
text(s3,t3,'3');
text(s4,t4,'4');
% Plot for Enthalpy vs Entropy
figure(2)
plot([s1,s2],[h1,h2],'lineWidth',2,'color','k')
grid on
title('h-s Diagram')
xlabel('Entropy(KJ/KgK)')
ylabel('Enthalpy(KJ/Kg)')
hold on
plot([s2,s3],[h2,h3],'lineWidth',2,'color','k')
hold on
plot([s3,s4],[h3,h4],'lineWidth',2,'color','k')
hold on
plot([s4,s1],[h4,h1],'lineWidth',2,'color','k')
% Plot for Liquid and Vapour Saturation Curve
t=linspace(1,t1,1000);
for j=1:length(t)
h_1(j)=XSteam('hL_T',t(j));
end
for j=1:length(t)
h_v(j)=XSteam('hV_T',t(j));
end
plot(s_1,h_1,'lineWidth',2,'color','r')
hold on
plot(s_v,h_v,'lineWidth',2,'color','r')
% Indicate the States with numbers
text(s1,h1,'1');
text(s2,h2,'2');
text(s3,h3,'3');
text(s4,h4,'4');
% Results Output
fprintf('%40s \n \n \n','RESULT');
fprintf('%10s %54s \n','At State Point 1','At State Point 2');
fprintf('%s %.2f%s %44s %.2f%s \n','P1:',p1,' bar','P2:',p2,' bar');
fprintf('%s %.2f%s %35s %.2f%s \n','T1:',t1,' Deg Celcius','T2:',t2,' Deg Celcius');
fprintf('%s %.2f%s %40s %.2f%s \n','H1:',h1,' KJ/kg','H2:',h2,' KJ/kg');
fprintf('%s %.2f%s %42s %.2f%s \n','S1:',s1,' KJ/kgK','S2:',s2,' KJ/kgK');
fprintf('%58s %.2f \n \n','X2:',x2);
fprintf('%10s %54s \n','At State Point 3','At State Point 4');
fprintf('%s %.2f%s %45s %.2f%s \n','P3:',p3,' bar','P4:',p4,' bar');
fprintf('%s %.2f%s %35s %.2f%s \n','T3:',t3,' Deg Celcius','T4:',t4,' Deg Celcius');
fprintf('%s %.2f%s %41s %.2f%s \n','H3:',h3,' KJ/kg','H4:',h4,' KJ/kg');
fprintf('%s %.2f%s %42s %.2f%s \n \n','S3:',s3,' KJ/kgK','S4:',s4,' KJ/kgK');
fprintf('%40s %.2f %s \n','Work Output by Turbine(Wt): ',Wt,' KJ/kg');
fprintf('%40s %.2f %s \n','Work Iutput by Pump(Wp): ',Wp,' KJ/kg');
fprintf('%40s %.2f %s \n','Net Work(Wnet): ',W_net,' KJ/kg');
fprintf('%40s %.2f %s \n','Thermodynamic Efficiency(Ntherm): ',n,' Percent');
fprintf('%40s %.2f %s \n','Heat Input in Boiler: ',q_in,' KJ/kg');
fprintf('%40s %.2f %s \n','Heat Rejected in Condensor: ',q_out,' KJ/kg');
fprintf('%40s %.2f %s \n','S.S.C.: ',p3,' kg/kWh');
Results:
- Command Window ScreenShot:

- Workspace window ScreenShot:

- Figure 1: T-s Diagram:

- Figure 1: h-s Diagram:

- Conclusion:
The Rankine Cycle plots have generated by calculating the state points, efficiency and the output is printed in the command window.