Project 2 - Rankine cycle Simulator
RANKINE CYCLE SIMULATOR PROJECT
AIM
To simulate the rankine cycle using matlab and to find out the parameters like pressure,temperature,enthalpy &entropy at all the state points and also finding out the network and back work ratio. After getting all the state points they are plotted and Ts and Pv diagrams generated
RANKINE CYCLE
The rankine cycle is an idealized thermodynamic cycle describing the process by which certain heat engines,such as steam turbines or reciprocating steam engines,allow mechanical work to be extracted from a fluid as it moves between a heat source and heat sink. Heat energy is supplied to the system via a boiler where the working fluid (typically water) is converted to a high pressure gaseous state inorder to turn a turbine.After passing over the fluid is allowed to condense back into a liquid state as a waste heat energy is rejected before being to boiler,completing the cycle.Efficiency of rankine cycle is limited by high heat of vaporization of the working fluid,friction losses.water is usally the fluid of choise due to its favorable properties such as its non-toxic and unreactive chemistry,low cost as well as its thermodynamic properties.By condensing the working steam vapor to a liquid the pressure at the turbine outlet is lowered and the energy by feed pump consumes only 1% to 3% of the turbine output power and these factors contribute to higher efficiency for cycle.the benifit of this is offset by the low temperatures of steam admitted to the turbine.

PROCESS IN RANKINE CYCLE
- PROCESS 1-2: Isentropic expansion in the turbine,the dry saturated vapour expands through a turbine,generating power.This decreases the temperature and pressure of the vapour,and some condensation may occur.
- PROCESS 2-3: Constant pressure heat rejection in condensor, the vapour-liquid mixture leaving the turbine is condensed at low pressure,usually in a surface condenser using cooling water. In well designed and maintained condensers,the pressure of the vapour is well below atmospheric pressure,approaching the saturation pressure of the operating fluid at the cooling water temperature.
- PROCESS 3-4: Isentropic compression in the pump,The pressure of condenstate is raised in feed pump.Because of the low specific volume of liquids,the pump work is relatively small and often neglected in thermodynamic calculations.
- PROCESS 4-1: Constant pressure heat addition in boiler,High pressure liquid enters the boiler from the feed pump and is heated to the saturation temperature(curve).further addition of energy causes evaporation of the liquid until it is fully converted to saturated steam into superheated state
CODE
%RANKINE CYCLE
clear all
close all
clc
%DISPLAYING THE PROCESS OF RANKINE CYCYLE
disp('RANKINE CYCLE');
disp('process 1-2 is isentropic expansion in the turbine');
disp('process 2-3 is constant pressure heat removal in the condensor');
disp('process 3-4 is isentropic compression in the pump');
disp('process 4-1 is constant pressure heat addition in the boiler');
%INPUTS GIVEN
%TEMPERATURE AT STATE POINT 1 IN DEGREE CELCIUS
T1=400;
%PRESSURE AT STATE POINT 1 IN BAR
P1=30;
%AT STATE POINT 1 (TURBINE INLET)
%CALCULATING ENTROPY AND ENTHALPY AT POINT 1
%h_pT & s_pT are ENTHALPY AND ENTROPY AT PARTICULAR PRESSURE AND TEMPERATURE
h1=XSteam('h_pT',P1,T1);
s1=XSteam('s_pT',P1,T1);
%AT STATE POINT 2(CONDENSOR INLET)
%ALL THE UNKNOWN PARAMETERS ARE CALCULATED.
% T2 IS CALCULATED FROM ISENTROPIC EXPANSION RELATION.
s2=s1;
P2=0.05;
%FOR AN ISENTROPIC EXPANSION,(T2/T1)=(P2/P1)^(1-(1/GAMMA))
%RATIO OF SPECIFIC HEATS OF AIR GAMMA=1.4
gamma=1.4;
power=(1-(1/gamma));
T2=T1*((P2/P1)^power);
%h_pT is enthalpy as a function of pressure and temperature
h2=XSteam('h_pT',P2,T2);
%AT STATE POINT 3(PUMP INLET)
%hL_T & sL_T REPRESENTS THE ENTROPY AND ENTHALPY AT LIQUID STATE ATTAINED TEMPERATURE
T3=T2;
P3=P2;
h3=XSteam('hL_T',T3);
s3=XSteam('sL_T',T3);
%AT STATE POINT 4(BOILER INLET)
P4=P1;
s4=s3;
%T_ps is temperature as a function of pressure and entropy
T4=XSteam('T_ps',P4,s4);
h4=XSteam('h_pT',P4,T4);
%hL_p is saturated liquid enthalpy
h41=XSteam('hL_p',P4);
%sL_p is saturated liquid entropy
s41=XSteam('sL_p',P4);
%hV_p is saturated vapour enthalpy
h42=XSteam('hV_p',P4);
%sV_p is saturated vapour entropy
s42=XSteam('sV_p',P4);
%T_hs temperature as a function of enthalpy and entropy
T41=XSteam('T_hs',h41,s41);
T42=XSteam('T_hs',h42,s42);
%TO CALCULATE THE WORK DONE BY TURBINE,PUMP & NET WORK DONE
%wt=work done by turbine
wt=h1-h2;
%wp=work done to the pump
wp=h4-h3;
%wnet=net work done
wnet=wt-wp;
%CALCULATION OF BACK WORK RATIO
bwr=wp/wt;
%CALCULATION OF HEAT SUPPLIED AND HEAT REJECTED
%q_s=heat supplied,q_r=heat rejected
q_s=h1-h4;
q_r=h2-h3;
%CALCULATION OF THERMAL EFFICIENCY
%THERMAL EFFICIENCY IS RATIO OF WORK DONE TO THE HEAT INPUT AT HIGH TEMPERATURE
t_eff=(wnet/q_s)*100;
%TO CALCULATE SPECIFIC STEAM CONSUMPTION
%SSC IS MASS FLOW RATE/POWER
ssc=3600/wnet;
%TO CREATE THE CURVE ALL THE ENTROPY AND ENTHALPY AT LIQUID VAPOUR
% CONDITIONS ARE CALCULATED
%inputs for the temperature
temp=linspace(1,600,1000);
%here the loop starting from 1 to max of value temp
%the i value changes and here i is length of temp
for i=1:length(temp)
%saturated liquid entropy
sl(i)=XSteam('sl_T',temp(i));
%saturated vapour entropy
sv(i)=XSteam('sV_T',temp(i));
%saturated liquid enthalpy
hl(i)=XSteam('hL_T',temp(i));
%saturated vapour enthalpy
hv(i)=XSteam('hV_T',temp(i));
end
%PLOTTING
%PLOTTING FOR ENTROPY AND TEMPERATURE(TS DIAGRAM)
figure(1)
plot([s1 s2],[T1 T2],[s2 s3],[T2 T3],[s3 s4],[T3 T4],[s4 s41],[T4 T41],[s41 s42],[T41 T42],[s42 s1],[T42 T1],'marker','*','color','r')
%hold on is used to get more than one plot in same program
hold on
%plotting curve
plot(sl,temp)
plot(sv,temp)
%title is used for title of plot
title('T vs S diagram')
%x label is used to define x axis
xlabel('Entropy(KJ/KgK)')
%y label is used to define y axis
ylabel('Temperature(k)')
%PLOTTING FOR ENTROPY AND ENTHALPY(HS DIAGRAM)
figure(2)
plot([s1 s2],[h1 h2],[s2 s3],[h2 h3],[s3 s4],[h3 h4],[s4 s1],[h4 h1],'marker','*','color','b')
hold on
%plotting curve
plot(sv,hv)
plot(sl,hl)
title('H vs S diagram')
xlabel('Entropy(KJ/KgK)')
ylabel('Enthalpy(KJ/K)')
%DISPLAYING THE RESULTS
%TO DISPLAY ALL VALUES IN COMMAND WINDOW.'SPRINTF' IS USED TO PRINT VALUES
% '%.3F' IS USED TO PRINT VALUES WITH THREE DECIMAL POINTS
disp('Results');
disp('given inputs');
disp('P1 = 30');
disp('P2 = 0.05');
disp('T1 = 400');
%DISPLAYING AT STATE POINT 1
disp('At state point 1');
d1=sprintf('P1 is %.3f bar',P1);
disp(d1);
d2=sprintf('T1 is %.3f degree celcius',T1);
disp(d2);
d3=sprintf('h1 is %.3f kJ/Kg',h1);
disp(d3);
d4=sprintf('s1 is %.3f KJ/KgK',s1);
disp(d4);
%DISPLAYING AT STATE POINT 2
disp('At state point 2');
d5=sprintf('P2 is %.3f bar',P2);
disp(d5);
d6=sprintf('T2 is %.3f degree celcius',T2);
disp(d6);
d7=sprintf('h2 is %.3f KJ/Kg',h2);
disp(d7);
d8=sprintf('s2 is %.3f KJ/KgK',s2);
disp(d8);
%DISPLAYING AT STATE POINT 3
disp('At state point 3');
d9=sprintf('P3 is %.3f bar',P3);
disp(d9);
d10=sprintf('T3 is %.3f degree celcius',T3);
disp(d10);
d11=sprintf('h3 is %.3f KJ/Kg',h3);
disp(d11);
d12=sprintf('s3 is %.3f KJ/KgK',s3);
disp(d12);
%DISPLAYING AT STATE POINT 4
disp('At state point 4');
d13=sprintf('P4 is %.3f bar',P4);
disp(d13);
d14=sprintf('T4 is %.3f degree celcius',T4);
disp(d14);
d15=sprintf('h4 is %.3f KJ/Kg',h4);
disp(d15);
d16=sprintf('s4 is %.3f KJ/KgK',s4);
disp(d16);
%DISPLAYING THE CALCULATED PARAMETERS
disp('calculated parameters');
d17=sprintf('work done by the turbine=%.3f',wt);
disp(d17);
d18=sprintf('work done by the pump=%.3f',wp);
disp(d18);
d19=sprintf('net work done =%3.f',wnet);
disp(d19);
d20=sprintf('Heat supplied=%.3f KJ/K',q_s);
disp(d20);
d21=sprintf('Heat rejected =%.3f KJ/K',q_r);
disp(d21);
d22=sprintf('Thermal efficiency=%.3f%',t_eff);
disp(d22);
d23=sprintf('Specific Steam consumption(ssc)=%.3f Kg/kW h',ssc);
disp(d23);
d24=sprintf('Back work ratio=%.3f',bwr);
disp(d24);
- XSteam data is used to extract steam and water properties of enthalpy,entropy at specific pressure and temperature for saturated liquid,vapour conditions.the program has the input pressure at state point 1(p1) and 2(p2) and temperature (t1).
- With these inputs and from given XSteam data,the program calculates all state point of cycle
- As we extract data the data we use thermodynamic relation to further find state points and extract the data from XSteam.
- sf ,sg,hf & hg where f and g stands for saturated liquid and saturated vapour of entropy and enthalpy.
- The network ,work done by turbine,work done to run the pump,Heat in ,heat out ,(ssc) specific steam consumption and efficiency are calculated using standard thermodynamic relation.
- Temperature ,entropy,enthalpy are extracted at vapour and liquid line for plotting purpose.
- Plot of T vs s and h vs s is plotted from all points obtained from the program.
- Results are displayed in command window


Results for the entire calculation in command window

REFERENCES
https://en.wikipedia.org/wiki/Rankine_cycle
https://www.ecourses.ou.edu/cgi-bin/ebook.cgi?topic=th&chap_sec=10.1&page=theory