Project 2 - Rankine cycle Simulator
Rankine Cycle Simulator
Aim:
Creation of Rankine cycle simulator from given input and reading the data from standard thermodynamic library of steam table.
Rela
Objective:
1. To create a Rankine Cycle simulator in MATLAB. 2. To calculate the state point using function XSteam.
3. To plot the T-S and H-S curve for given input in Rankine Cycle. 4. To get output in the command window for each state point in cycle.
Description:
The Rankine cycle is one of the vapor powered cycle. This cycle is somewhat different than gas powered cycle in which working fluid remained gas throughout the entire cycle. In vapor powered cycle the working fluid is steam because of its many desirable characteristics such as low cost of production, availability and high enthalpy of vaporization. There are many impracticalities associated with Carnot cycle which can be eliminated by superheating the steam and condense in condenser which makes it best for nuclear power plants and other steam related power generation sources.
VIEW
The process in Rankine cycle are given as:
1. Isentropic Compression in Pump..
2. Constant pressure heat addition in boller.
3. Isentropic expansion in a turbine..
4. Constant pressure heat rejection in condenser.

Water enters the pump at state l as saturated liquid and is compressed isentropically to the operating pressure of the boiler. The water temperature increases somewhat during this isentropic compression process due to a slight decrease in the specific volume of water. The vertical distance between states 1 and 2 on the T-s diagram is greatly exaggerated for clarity.
Water enters the boiler as a compressed liquid at state 2 and leaves as a superheated vapor at state 3. The boiler is basically a large heat exchanger where the heat originating from combustion gases, nuclear reactors, or other sources is transferred to the water essentially at constant pressure. The boiler, together with the section where the steam is superheated (the superheater), is often called the steam generator.
The superheated vapor at state 3 enters the turbine, where it expands
isentropically and produces work by rotating the shaft connected to an electric
generator. The pressure and the temperature of steam drop during this process to the values at state 4, where steam enters the condenser. At this state, steam is usually a saturated liquid-vapor mixture with a high quality. Steam condensed at constant pressure in the condenser, which is basically a large heat exchanger, by rejecting heat to a cooling medium such as a lake, a river, or the atmosphere. Steam leaves the condenser as saturated liquid and enters the pump, completing the cycle. In areas where water is precious, the power plants are cooled by air instead of water. This method of cooling, which is also used in car engines, is called dry cooling.
VIEW
Remembering that the area under the process curve on a T-s diagram represents the heat transfer for internally reversible processes, we see that the area under process curve 2-3 represents the heat transferred to the water in the boiler and the area under the process curve 4-1 represents the heat rejected in the condenser. The difference between these two is the net work produced during the cycle.
All the four components of Rankine cycle are steady flow devices hence the
process regarding this device can be evaluated as steady state process. The
steady state flow energy equation per unit mass of steam reduces to:
The boiler and condenser are not involved in any mechanical work whereas pump and turbine are assumed to isentropic in nature while working throughout the cycle, then conservation of energy relation for each device can
Code Explanation:
1. The creation of Rankine cycle simulator starts with some input value which are required to calculate the other state point in cycle eventually.
2. The Rankine cycle process is displayed in the command window and then inputs are entered which are inlet pressure for turbine, temperature at
turbine inlet and pressure at condenser.
3. Then we are using XSteam function file for reading state point. First, we get the value of enthalpy and entropy at state point 1 from the XSteam
Matlab script:
|
close all % Closes all windows |
|
|
clc % |
|
| % Basic Info | |
| fprintf('%60s \r\n', 'Rankine Cycle Simulator') | |
| fprintf('%s \n','Process 1-2 is Isentropic Expansion in Turbine') | |
| fprintf('%s \n','Process 2-3 is Constant Pressure Heat Rejection by Condenser') | |
| fprintf('%s \n','Process 3-4 is Isentropic Compression in Pump') | |
| fprintf('%s \r\n','Process 4-1 is Constant Pressure heat Addition by Boiler') | |
| %% INPUTS | |
| p1=input('Enter the pressure at turbine Inlet : '); | |
| t1=input('Enter the temperature at turbine Inlet : '); | |
| p2=input('Enter the pressure at condensor Inlet : '); | |
| %% 1-2 Isentropic Turbine Expansion | |
| h1=XSteam('h_pT',p1,t1); | |
| s1=XSteam('s_pT',p1,t1); | |
| tsat1=XSteam('Tsat_p',p1); %Saturation Temp.at p1 | |
| hg1=XSteam('hV_p',p1); | |
| hf1=XSteam('hL_p',p1); | |
| sg1=XSteam('sV_p',p1); | |
| sf1=XSteam('sL_p',p1); | |
| s2=s1; | |
| hf2=XSteam('hL_p',p2); | |
| sf3=XSteam('sL_p',p2); | |
| hg2=XSteam('hV_p',p2); | |
| sg2=XSteam('sV_p',p2); | |
| sfg=sg2-sf3; %entropy of wet region | |
| hfg= hg2-hf2; | |
| if s2 < sg2 % Checks to see if Point 2 is within the vapor dome | |
| x2=(s2-sf3)/sfg; % calculates the new quality at this point | |
| h2=hf2+x2*hfg; % calculates the new enthalpy | |
| else | |
| x2 = 1; % Quality is max 1 | |
| h2 = x2*hg2; % calculates the new enthalpy | |
| end | |
| t2=XSteam('T_ps',p2,s2); | |
| tsat2=XSteam('Tsat_p',p2); %Saturation Temp.at p2 | |
| %% 2-3 Isobaric Condenser | |
| p3=p2; | |
| s3=sf3; | |
| h3=hf2; | |
| %% 3-4 Isentropic Pump | |
| s4=s3; | |
| t3=tsat2; | |
| %% 4-1 Isobaric Boiler | |
| p4=p1; | |
| h4=XSteam('h_ps',p4,s4); | |
| t4=XSteam('T_ps',p4,s4); | |
| %% T-S & H-S Diagrams | |
| t= linspace(1,t1,5000); | |
| figure(1) | |
| %axis([1.91984 1.92 157.4 158.3]); | |
| hold on | |
| sl=zeros; | |
| sv=zeros; | |
| hl=zeros; | |
| hv=zeros; | |
| for i=1:length(t) | |
| sl(i)=XSteam('sL_T',t(i)); | |
| sv(i)=XSteam('sV_T',t(i)); | |
| hl(i)=XSteam('hL_T',t(i)); | |
| hv(i)=XSteam('hV_T',t(i)); | |
| end | |
| plot(sl,t,'--r','linewidth',1) | |
| plot(sv,t,'--r','linewidth',1) | |
| %% T-S Diagram Animation | |
| for i=s1:s2 | |
| a=linspace(s1,s2,100); | |
| b=linspace(t1,t2,100); | |
| curve=animatedline('color','c','linewidth',2); | |
| for j=1:100 | |
| x=a(j); | |
| y=b(j); | |
| addpoints(curve,x,y); | |
| pause(0.01) ; | |
| end | |
| end | |
| for i=sg2:s2 | |
| a=linspace(s2,sg2,100); | |
| b=linspace(t2,tsat2,100); | |
| curve=animatedline('color','c','linewidth',2); | |
| for j=1:100 | |
| x=a(j); | |
| y=b(j); | |
| addpoints(curve,x,y); | |
| pause(0.01) ; | |
| end | |
| end | |
| for i=s3:sg2 | |
| a=linspace(sg2,s3,100); | |
| b=linspace(tsat2,t3,100); | |
| curve=animatedline('color','c','linewidth',2); | |
| for j=1:100 | |
| x=a(j); | |
| y=b(j); | |
| addpoints(curve,x,y); | |
| pause(0.01) ; | |
| end | |
| end | |
| for i=s3:s4 | |
| a=linspace(s3,s4,100); | |
| b=linspace(t3,t4,100); | |
| curve=animatedline('color','c','linewidth',2); | |
| for j=1:100 | |
| x=a(j); | |
| y=b(j); | |
| addpoints(curve,x,y); | |
| pause(0.01) ; | |
| end | |
| end | |
| for i=s4:sf1 | |
| a=linspace(s4,sf1,100); | |
| b=linspace(t4,tsat1,100); | |
| curve=animatedline('color','c','linewidth',2); | |
| for j=1:100 | |
| x=a(j); | |
| y=b(j); | |
| addpoints(curve,x,y); | |
| pause(0.01) ; | |
| end | |
| end | |
| for i=sf1:sg1 | |
| a=linspace(sf1,sg1,100); | |
| b=linspace(tsat1,tsat1,100); | |
| curve=animatedline('color','c','linewidth',2); | |
| for j=1:100 | |
| x=a(j); | |
| y=b(j); | |
| addpoints(curve,x,y); | |
| pause(0.01) ; | |
| end | |
| end | |
| for i=sg1:s1 | |
| a=linspace(sg1,s1,100); | |
| b=linspace(tsat1,t1,100); | |
| curve=animatedline('color','c','linewidth',2); | |
| for j=1:100 | |
| x=a(j); | |
| y=b(j); | |
| addpoints(curve,x,y); | |
| pause(0.01) ; | |
| end | |
| end | |
| % | |
| %plot([s1 s2],[t1 t2],'linewidth',2) | |
| %plot([s2 sg2],[t2 tsat2],'linewidth',2) | |
| %plot([sg2 s3],[tsat2 t3],'linewidth',2) | |
| %plot([s3 s4],[t3 t4],'linewidth',2) | |
| %plot([s4 sf1],[t4 tsat1],'linewidth',2) | |
| %plot([sf1 sg1],[tsat1 tsat1],'linewidth',2) | |
| %plot([sg1 s1],[tsat1 t1],'linewidth',2) | |
| xlabel({'Specific Entropy [S] ','(kJ/kg K)'},'FontWeight','bold') | |
| ylabel({'Temperature [T] ','(Deg C)'},'FontWeight','bold') | |
| %% H-S Diagram Animation | |
| figure(2) | |
| hold on | |
| plot([s1 s2],[h1 h2],'linewidth',2) | |
| plot([s2 s3],[h2 h3],'linewidth',2) | |
| plot([s3 s4],[h3 h4],'linewidth',2) | |
| plot([s4 sf1],[h4 hf1],'linewidth',2) | |
| plot([sf1 sg1],[hf1 hg1],'linewidth',2) | |
| plot([sg1 s1],[hg1 h1],'linewidth',2) | |
| plot([sl sv],[hl hv],'--r','linewidth',1) | |
| xlabel({'Specific Entropy [S] ','(kJ/kg K)'},'FontWeight','bold') | |
| ylabel({'Specific Enthalpy [H] ' ,'(kJ/kg)'},'FontWeight','bold') | |
| %% Efficiency and Work | |
| Wt=h1-h2; | |
| Wp=h4-h3; | |
| W=Wt-Wp; | |
| qin=h1-h4; | |
| qout=h2-h3; | |
| eff=W*100/qin; | |
| bwr=qin/qout; | |
| %% Display | |
| fprintf('%-60s %20s \r\n', 'At State Point 1','At State Point 2' ) | |
| fprintf('%s %.2f %s %64s %.2f %s \n','P1:',p1,'bar','P2:',p2,'bar') | |
| fprintf('%s %.2f %s %55s %.2f %s \n','T1:',t1,'deg Celcius','T2:',t2,'deg Celcius') | |
| fprintf('%s %.2f %s %60s %.2f %s \n','H1:',h1,'kJ/Kg','H2:',h2,'kJ/Kg') | |
| fprintf('%s %.2f %s %61s %.2f %s \r\n','S1:',s1,'kJ/Kg K','S2:',s2,'kJ/Kg K') | |
| fprintf('%-60s %20s \r\n', 'At State Point 3','At State Point 4' ) | |
| fprintf('%s %.2f %s %64s %.2f %s \n','P3:',p3,'bar','P4:',p4,'bar') | |
| fprintf('%s %.2f %s %55s %.2f %s \n','T3:',t3,'deg Celcius','T3:',t4,'deg Celcius') | |
| fprintf('%s %.2f %s %60s %.2f %s \n','H3:',h3,'kJ/Kg','H4:',h4,'kJ/Kg') | |
| fprintf('%s %.2f %s %60s %.2f %s \r\n','S3:',s3,'kJ/Kg K','S4:',s4,'kJ/Kg K') | |
| fprintf('%60s %.2f %s \n','Work Done by Turbine:',Wt,'kJ/Kg') | |
| fprintf('%60s %.2f %s \n','Work Done by Pump:',Wp,'kJ/Kg') | |
| fprintf('%60s %.2f %s \n','Net Work Done:',W,'kJ/Kg') | |
| fprintf('%60s %.2f %s \n','Heat Input in boiler:',qin,'kJ/Kg') | |
| fprintf('%60s %.2f %s \n','Heat rejected in Condenser:',qout,'kJ/Kg') | |
| fprintf('%60s %.2f \n','Back Work Ratio:',bwr) | |
Explanation of Program
1. Xsteam data is used to extract steam and water properties of enthaly, entropy at specific pressure and temperatures for sat liquid, sat vapour conditions etc.
2. The program requires the input of Pressure (in bar) at state point 1 ( turbine inlet), Temperature at same point (degree celcius) and pressure at condenser inlet (point 2).
3. With the help of these inlets & from Xsteam data, the program calculates all the state points of the Rankine cycle.
4. The Xsteam data works as, hl= XSteam (h_PT, pl, T1) it returns the enthalpy of water at given pressure and temperature in bar and degC respectively.
5. As we extract the data, we use thermodynamic relation to further find 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 calculayed after studying the plots of Rankine cycles and extracting data from Xsteam file.
7. The net work, work done by turbine, work done 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 the points obtained from the program using the plot command and mentioning all the lables, linewidth, color 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 input, ouput screen and the various state points with various parameters generated in the command window are shown below




