Project

Rankine cycle Simulator

Aim:To create a Rankine cycle Simulator

Software Used:Octave

Theory:

The Rankine cycle is an idealized thermodynamic cycle of a heat engine that converts heat into mechanical work while undergoing 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.

There are four processes in the Rankine cycle

1–2 Isentropic Expansion :The dry saturated vapour expands through a turbine, generating power. This decreases the temperature and pressure of the vapour, and some condensation may occur. The output in this process can be easily calculated using the chart or steam tables

2-3 Constant pressure heat rejection in condenser : The wet vapour then enters a condenser, where it is condensed at a constant pressure to become a saturated liquid.

3-4 Isentropic compression : 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.

4-1 Constant pressure heat addition in boiler: The high-pressure liquid enters a boiler, where it is heated at constant pressure by an external heat source to become a dry saturated vapour.

Required Inputs:

Turbine Inlet temperature = 400° C

Turbine Inlet Pressure = 30 bars

Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure

Code

clear all
close all
clc

%Process taking place in rankine cycle
fprintf("Process 1-2 = Isentropic expansion in turbinen");
fprintf("Process 2-3 = Constant pressure heat rejection by condensorn");
fprintf("Process 3-4 = Isentropic compression in pumpn");
fprintf("Process 4-1 = Constant pressure heat addition by boilern"); 

%Enter inputs
P1=input("nEnter the pressure at the inlet of the turbine(bar):n");
T1=input("nEnter the temperature at the turbine inlet(Degree celcius):n");
P2=input("nEnter the pressure at the condensor(bar):n");
fprintf("nRESULTn")

%Cp values at P1 and P2 for saturated liquid and vapour
Cp1_L=XSteam('CpL_p',P1);
Cp1_V=XSteam('CpV_p',P1);
Cp2_L=XSteam('CpL_p',P2);
Cp2_V=XSteam('CpV_p',P2);

%Saturation Temperature at P1 and P2
Tsat_P1=XSteam('Tsat_p',P1);
Tsat_P2=XSteam('Tsat_p',P2);

%Enthalpy and Entropy 
Hg1=XSteam('hV_p',P1);
Sg1=XSteam('sV_p',P1);
Hf1=XSteam('hL_p',P1);
Sf1=XSteam('sL_p',P1);

Hg2=XSteam('hV_p',P2);
Sg2=XSteam('sV_p',P2);
Hf2=XSteam('hL_p',P2);
Sf2=XSteam('sL_p',P2);

%calculation of process properties at state 1
fprintf("nstate point 1n");
fprintf("P1 : %f Barn",P1);
fprintf("T1 : %f degCn",T1);
H1=XSteam('h_pT',P1,T1);
fprintf("H1 : %f kJ/kgn",H1);
S1=XSteam('s_pT',P1,T1);
fprintf("S1 : %f kJ/kgKn",S1);

%calculation of process properties at state 2
fprintf("nstate point 2n");
fprintf("P2 : %f Barn",P2);
S2=S1;
fprintf("S2 : %f kJ/kgKn",S2);
%Calculating value of X
X2=(S2-Sf2)/(Sg2-Sf2);
fprintf("X2 : %fn",X2);
%calculating value of T2
T2=Tsat_P2;
fprintf("T2 : %f degCn",T2);
%calculating value of H2
H2=Hf2+X2*(Hg2-Hf2);
fprintf("H2 : %f kJ/kgn",H2);


%calculation of process properties at state 3
fprintf("nstate point 3n");
P3=P2;
fprintf("P3 : %f Barn",P3);
V3=XSteam('vL_p',P3);
T3=Tsat_P2;
fprintf("T3 : %f degCn",T3);
H3=Hf2;
fprintf("H3 : %f kJ/kgn",H3);
S3=Sf2;
fprintf("S3 : %f kJ/kgKn",S3);


%calculation of process properties at state4
fprintf("nstate point 4n");
P4=P1;
fprintf("P4 : %f Barn",P4);
S4=S3;
fprintf("S4 : %f kJ/kgKn",S4);
Wp=V3 * (P4-P3)*100;
H4=Wp+H3;
fprintf("H4 : %f kJ/kgn",H4);
cp=XSteam('cpL_p',P3);
cv=XSteam('cvL_p',P3);
gamma=(cp/cv);
T4=T3*((P4/P3)^((gamma-1)/gamma));
fprintf("T4 : %f degCn",T4);


T5=XSteam('Tsat_p',P1);
T6=T5;
S5=XSteam('sL_p',P1);
S6=XSteam('sV_p',P1);
H5=XSteam('hL_p',P1);
H6=XSteam('hV_p',P1);


%calculations
%work done by turbine
Wt=H1-H2;
fprintf("nWork done by turbine  : %f kJ/kgn",Wt)
%work done by compressor
fprintf("Work done by compressor : %f kJ/kgn",Wp)
%net work done
Wnet=Wt-Wp;
fprintf("Net Work done : %f kJ/kgn",Wnet)
%Heat supplied
Qin=H1-H4;
fprintf("Qin : %f kJ/kgn",Qin)
%Heat rejected
Qout=H2-H3;
fprintf("Qout : %f kJ/kgn",Qout)
%thermal efficiency
thermal_efficiency=Wnet*100/Qin;
fprintf("Thermal efficiency : %fn",thermal_efficiency)
%specific Steam Consumption
SSC=3600/Wt;
fprintf("Specific Steam Consumption : %f kg/kWhn",SSC)
%Back Work ratio
BWR=Wp/Wt;
fprintf("Back Work Ratio : %fn",BWR)


%saturation curve
temp=linspace(1,T1,1000);
for i=1:length(temp)
    H_L(i)=XSteam('hL_T',temp(i));
    H_V(i)=XSteam('hV_T',temp(i));
    S_L(i)=XSteam('sL_T',temp(i));
    S_V(i)=XSteam('sV_T',temp(i));
endfor

%plotting
%T-S diagram
figure(1)
hold on
title('T-S Diagram')
plot([S1 S2],[T1 T2],'r','linewidth',2)
text(S1,T1,'1','fontsize',13)
text(S2,T2,'2','fontsize',13)
plot([S2 S3],[T2 T3],'r','linewidth',2)
text(S3,T3,'3','fontsize',13)
plot([S3 S4],[T3 T4],'r','linewidth',2)
text(S4,T4,'4','fontsize',13)
plot([S4 Sf1],[T4 Tsat_P1],'r','linewidth',2)
plot([Sf1 Sg1],[Tsat_P1 Tsat_P1],'r','linewidth',2)
plot([Sg1 S1],[Tsat_P1 T1],'r','linewidth',2)
plot(S_L,temp,'b','linestyle','--','linewidth',2)
plot(S_V,temp,'b','linestyle','--','linewidth',2)
ylabel('Temperature(DegC)')
xlabel('Specific Entropy(kJ/kgK)')
text(S5,T5,'5','fontsize',13)
text(S6,T6,'6','fontsize',13)


%plotting
%H-S diagram
figure(2)
hold on
title('H-S Diagram')
plot([S1 S2],[H1 H2],'r','linewidth',2)
text(S1,H1,'1','fontsize',13)
text(S2,H2,'2','fontsize',13)
plot([S2 S3],[H2 H3],'r','linewidth',2)
text(S3,H3,'3','fontsize',13)
plot([S3 S4],[H3 H4],'r','linewidth',2)
text(S4,H4,'4','fontsize',13)
plot([S4 Sf1],[H4 Hf1],'r','linewidth',2)
plot([Sf1 Sg1],[Hf1 Hg1 ],'r','linewidth',2)
plot([Sg1 S1],[Hg1 H1],'r','linewidth',2)
plot(S_L,H_L,'b','linestyle','--','linewidth',2)
plot(S_V,H_V,'b','linestyle','--','linewidth',2)
ylabel('Specific Enthalpy(kJ/kg)')
xlabel('Specific Entropy(kJ/kgK)')
text(S5,H5,'5','fontsize',13)
text(S6,H6,'6','fontsize',13)

Explanation for the code

1.Start the program with clear all,close all and clc

2.Using 'fprintf' command, the description of all the processes are printed in the command window.

3.Then it is programmed to get inputs from user for the pressure at state points 1 and 2 and temperature at state point 1.The given inputs are entered.

4.Using XSteam table and the thermodynamic equations,the various state variables such as Pressure,Temperature,enthalpy and entropy are calculated.

5.Then the Net work done,thermal efficiency,Specific steam consumption and Back work ratio are calculated using the formulas.

6.Using the plot command ,all the values are plotted and with the text command,the state points are marked.Thus the T-S and H-S diagrams are plotted.

Plots:

Result:

Errors Obtained: Simple Errors were obtained and were rectified easily.

Conclusion:The required output values are obtained for the given input parameters

Net Work done : 1117.851878 kJ/kg

Back Work Ratio : 0.002686

Thus the Rankine Cycle is simulated sucessfully using Octave

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.