Project 2 - Rankine cycle Simulator
Aim-
- To simulate a Rankine cycle using matlab.
- Extracting steam and water properties from Xstram file.
- Calculating all the state points of cycle based on User inputs.
- Plotting the T vs S and H vs S plot for the given input.
Theory:-
A rankine cycle is an idealised Thermodynamic cycle which governs the working of a heat engine. In Rankine cycle, the friction losses of a heat engine are neglected. It is a cycle which converts heat into mechanical energy which usally is converted into electrical energy. There are four components in this cycle which work on four different processes. The four components are turbine, Condensor, Pump and Boiler. Rankine cycle is nothing but a modification of a carnot cycle. Ideal Rankine cycle is very useful in steam power plants and gas power plants. To improve the efficiency of Rankine cycle in the steam power plant, there are some changes in Rankine cycle which differs from the carnot cycle. Firstly, a pump is used in place of condensor to handle only liquid, not a mixture of liquid and vapour. Secondly, exhaust steam from the turbine is completely condensed in the condensor, see in the following diagram:

Processes and working:
There are four processes in rankine cycle:
- Process 1-2: Isentropic Expansion in the turbine
- Process 2-3: Constant pressure Heat rejection in condensor
- Process 3-4: Isentropic compression in the pump
- Process 4-1: Constant pressure heat addition in the boiler
Rankine cycle efficiency:
efficiency= work output from turbine/heat input to the boiler
Back work ratio:
The fraction of the work produced by the turbine that is consumed by the compressor.
BW ratio = Wp/Wt
Matlab program for rankine cycle:
clear allclose allclcdisp('RANKINE CYCLE')disp('1-2 is constant pressure heat addition in the boiler');disp('2-3 is Isentropic Expansion in the Turbine');disp(' 3-4 is Constant pressure heat removal in Condensor');disp('4-1 is Isentropic compression in the pump');p1 = input('nValue of pressure at turbine inlet, p1(in bar) =');T1 = input('nValue of temprature at turbine inlet, T1(in degree.C) =');p2 = input('nValue of pressure at condensor inlet,p2 (in bar)=')% At state 1h1 = XSteam('h_pT',p1,T1); %Extracting Entahlpy at state pt 1s1 = XSteam('s_pT',p1,T1); % Similarly%At State 2s2 = s1; %Isentropic Expansionsf2 = XSteam('sL_p',p2); % Saturated Liquid Entropysg2 = XSteam('sV_p',p2); % Saturated Vapour Entropyx2 = (s2-sf2)/(sg2-sf2);hf2= XSteam('hl_p',p2);hg2= XSteam('hV_p',p2);h2= hf2 + (x2*(hg2-hf2));% At state 3p3 = p2;s3 = XSteam('sL_p',p3);h3 = XSteam('hL_p',p3);% At State 4s4 =s3;p4 = p1;% Work done by turbineWt = h1 - h2;% Work done to run pumpv3 = XSteam('vL_p',p3);Wp = v3*(p4 - p3)*100;h4 = h3 + Wp;%Net workWnet = Wt - Wp;%Heat into the systemQin = h1 - h4;% Heat out of the systemQout = h2 - h3;%Thermal efficiencythermal_eff = (Wnet/Qin)*100;%Specific Steam Consumption%SSC = mass flow rate/powerSSC = (3600/Wnet);�ck work ratioBW = (Wp/Wt)�lculation of Tempratures at the state pointsT3 = XSteam('Tsat_p',p3);T2 = T3;Cp4 = XSteam('Cp_ps',p4,s4);Cv4 = XSteam('Cv_ps',p4,s4);k= Cp4/Cv4;T4 = T3/((p3/p4)^((k-1)/k));�lculating Temprature, Entropy and Enthalpy at the vapour and liquid lineT3 = XSteam('Tsat_p',p3);T2 = T3;Cp4 = XSteam('Cp_ps',p4,s4);Cv4 = XSteam('Cv_ps',p4,s4);k = Cp4/Cv4;T4 = T3/((p3/p4)^((k-1)/k));�lculating Temprature,Entropy and Enthalpy at the vapour and liquid line%for plottingT6 = XSteam('Tsat_p',p1);s5 = XSteam('sL_p',p1);s6 = XSteam('sV_p',p1);h5 = XSteam('hL_p',p1);h6 = XSteam('hV_p',p1);T5 = T6;%Plotting the saturation curveT = linspace(1,375,1000);for i= 1:length(T)sf(i) = XSteam('sL_T',T(i));sg(i) = XSteam('sV_T',T(i));hf(i) = XSteam('hL_T',T(i));hg(i) = XSteam('hV_T',T(i));end%Plotting T-s diagramfigure(1)hold onplot(sf, T, 'r','linewidth',1)plot(sg,T,'r','linewidth',1)plot([s1 s2], [T1 T2],'b','linewidth',2)plot([s2 s3],[T2 T3],'b','linewidth',2)plot([s3 s4], [T3 T4], 'b','linewidth',2)plot([s4 s5], [T4 T5], 'b','LineWidth',2)plot([s5 s6],[T5 T6],'b','linewidth',2)sc1 = linspace(s6,s1,1000);for l = 1:length(sc1)Tc1(l) = XSteam('T_ps',p1,sc1(l));endplot(sc1, Tc1,'b','linewidth',2)text(s1+0.1,T1, '1')text(s2+0.1,T2,'2')text(s3,T3-20,'3')text(s4,T4+20,'4')title('Temp vs Entropy plot')xlabel('Entropy, S(Kj/kgk)')ylabel('Temprature(degree C)')legend('Saturation Curve')%Plotting h-s diagramfigure(2)hold onplot(sf,hf,'k','linewidth',1)plot(sg,hg,'k','linewidth',1)plot([s1 s2],[h1 h2],'r','linewidth',2)plot([s2 s3],[h2 h3],'r','linewidth',2)plot([s3 s4],[h3 h4],'r','linewidth',2)hc= linspace(h4,h5 ,100);for r = 1:length(hc)sch(r) = XSteam('s_ph',p1,hc(r));endplot(sch,hc,'r','linewidth',2)plot([s5 s6],[h5 h6],'r','linewidth',2)for m= 1:length(sc1)hc1(m)= XSteam('h_ps',p1,sc1(m));endplot(sc1,hc1,'r','linewidth',2)text(s1+0.1,h1,'1')text(s2+0.1,h2,'2')text(s3,h3-100,'3')text(s4,h4+200,'4')title('Enthalpy vs Entropy plot')xlabel('Entropy , S(KJ/kgk)')ylabel('Enthalpy,H(KJ/kg)')legend('Saturation curve','location','northwest')%Displaying the Results in the command window:disp('Results');p1 = p1;T1 = T1;p2 = p2;disp('at stage point 1');n1 = sprintf('P1 is %.3f bar',p1);disp(n1);n2 = sprintf('T1 is %.3f C',T1);disp(n2);n3 = sprintf('h1 is %.3f kJ/kg',h1);disp(n3);n4 = sprintf('s1 is %.3f kJ/kgk',s1);disp(n4);disp('At stage point 2');n11 = sprintf('P2 is %.3f bar',p2);disp(n11);n21 = sprintf('T2 is %.3f C',T2);disp(n21);n31 = sprintf('h2 is %.3f kJ/kg',h2);disp(n31);n41 = sprintf('s2 is %.3f kJ/kgk',s2);disp(n41);disp('At stage point 3');n12 = sprintf('P3 is %.3 bar',p3);disp(n12);n22 = sprintf('T3 is %.3f C',T3);disp(n22);n32 = sprintf('h3 is %.3f kJ/kg',h3);disp(n32);n42 = sprintf('s3 is %.3f kJ/kgK',s3);disp(n42);disp('At stage point 4');n13 = sprintf('P4 is %.3f bar',p4);disp(n13);n23 = sprintf('T4 is %.3f C',T4);disp(n23);n33 = sprintf('h4 is %.3f kJ/kgK',h4);disp(n33);n43 = sprintf('s4 is %.3f kJ/kgK',s4);disp(n43);n14 = sprintf('Wt is %.3f kJ/kg',Wt);disp(n14);n15= sprintf('Wp is %.3f kJ/kg',Wp);disp(n15);n16 = sprintf('Wnet is %.3f kJ/kg',Wnet);disp(n16);n17 = sprintf('Thermal_efficiency is %.2f kg/kWh',SSC);disp(n17);n18 = sprintf('SSC is %.2f kg/kWh',SSC);disp(n18);n19 = sprintf('Back work ratio is %.3f',BW);disp(n19);Explaination of Program:
1. Xsteam data is used to extract steam and water properties of enthalpy, entropy at specific pressure and tempratures for sat liquid, sat vapour conditions etc.
2. The program requires the input pressure(in bar) at state point 1 (turbine inlet), Temprature at same point (degree celcius) and pressue at condensor inlet (point2).
3. With the help of these inlets and from Xsteam data, the program calculates all the state points of Rankine cycle.
4. The X steam data work as, h1 = XSteam('h_pt',p1,T1) it returns the entalpy of water at given pressure and temprature in bar and degC respectively.
5. As we extact the data, we use thermodynamic relation to further find the state points and extract their data from Xsteam which are mentioned after studying the Rankine cycle.
6.Sf and Sg, hf and hg, where f and g stands for saturated liquid and saturated vapour respectively are calculated after studying the plots of Rankine cycles and extracting data from Xsteam file.
7.The net work, work done by turbine, workdone to run the pump, Heat in and heat out are calculated using standard thermodynamic relation.
8.Efficiency and Specific steam consumption(s.s.c) of the Rankine cycle is calculated from thermodynamic relations and mentioning them in program using relations.
9. T,s and h are extracted at vapour and liquid line for plotting purpose, after 4th point for the variation you observe in the plot.
10. Saturation curve is plotted in red for saturated liquid and saturated gas in T-S and in H-S it is black.
11. Plot of T vs S and H vs S is created from all points obtained from the program using the plot command and mentioning all the labels, linewidth, colour and title.
12. The plot changes as the user input changes for the above mentioned inputs.
13.Results are displayed in the command window by using sprint command.
Result :
The output screen and various state points with various parameters genrated in the command window are shown below:


Results and Plots:
The performance of Heat Engine was calculated and the following Observations were made:
Net Work: 57.100 kJ/kg
Thermal efficiency = 36.17%
Back Work ratio = 0.003
The T-S and H-S performance curves of the Rankine Cycle were plotted.


REFERENCES