Challenge

Project 2 - Rankine cycle Simulator

Object:

Creating a Rankine Cycle Simulator & Calculating the state points of the Rankine Cycle based on user inputs.

Plotting the corresponding T-S and H-S plots for the given set of inputs.

Theory:

The Rankine cycle is an idealized thermodynamic cycle of a constant pressure heat engine that converts part of heat into mechanical work. In this cycle, the heat is supplied externally to a closed loop, which usually uses water (in a liquid and vapor phase) as the working fluid.

Rankine cycle is the theoretical cycle on which the steam turbine works

Process 1-2: Reversible adiabatic expansion in the turbine (or steam engine).

Process 2-3: Constant-pressure transfer of heat in the condenser.

Process 3-4: Reversible adiabatic pumping process in the feed pump.

Process 4-1: Constant-pressure transfer of heat in the boiler.

Applying steady flow energy equation (S.F.E.E) to boiler, turbine, condenser and pump

1 For boiler (as control volume), we get

F4+Q1=h1

Q1=h1-hf4

2 For turbine (as control volume), we get

h1=WT+h2, where WT=turbine work

WT=h1-h2

3 For condenser, we get

H2=Q2+hf3

Q2=h2-hf3

4 For the feed pump, we get

Hf3+wp=hf4, where, WP=Pump work

WP=hf4-hf3=v3(p1-p2)

Efficiency of Rankine cycle is given by

Efficiency =W/Qnet1=WT/Q1

Required Inputs:

Turbine Inlet temperature = 400° C

Turbine Inlet Pressure = 30 bars

Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure

Code:

%Rankine cycle calculation 

%Clearing workspace, command window & closing all plots 
clear all
close all
clc

%step 1
%print discription of all process
fprintf('      RANKINE CYCLE SIMULATOR');
fprintf('1-2 Isentropic Expansion in the Turbine');
fprintf('2-3 constant pressure Heat Rejection by the Condenser');
fprintf('3-4 Isentropic Compression in the Pump');
fprintf('4-1 constant pressure Heat Addition by the Boiler');

%step 2
%Taking all input arguments
P1=input('Enter the pressure at the Turbine Inlet (in bar): ');
T1=input('Enter the Temperature at the Turbine Inlet (in Degree Celsius): ');
P2=input('Enter the pressure at the Condenser (in bar): ');

fprintf('      RESULT')

%% Calculation for General properties
%step 3
%Calculation of cp value at P1 & P2 for saturated liquid & 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);

%step 4
%Calculation of saturation temperture at P1 & P2
Tsat_P1=XSteam('Tsat_p',P1);
Tsat_P2=XSteam('Tsat_p',P2);

%%Calculation of Enthalpy & Entropy at saturation points
%step 5
%Calculation of saturation properties at state 1
Hg_1=XSteam('hV_p',P1);
Sg_1=XSteam('sV_p',P1);

%step 6
%Calculation of saturation properties at state 2
Hg_2=XSteam('hV_p',P2);
Sg_2=XSteam('sV_p',P2);

%step 7
%Calculation of saturation properties at state 3
Hf_3=XSteam('hL_p',P2);
Sf_3=XSteam('sL_p',P2);

%step 8
%Calculation of saturation properties at state 4
Hf_4=XSteam('hL_p',P1);
Sf_4=XSteam('sL_p',P1);

%%Calculation of process properties at state 1
%step 9
%Calculation of process properties at state 1
fprintf('At State point 1n');

fprintf('P1 is :%f Barn',P1);

fprintf('T1 is :%f degCn',T1);

H1=XSteam('h_pT',P1,T1);
fprintf('H1 is :%f kJ/kgn',H1);

S1=XSteam('s_pT',P1,T1);
fprintf('S1 is :%f kJ/kgnn',S1);

%%Calculation of process properties at state 2
%step 10
%Calculation of process properties at state 2
fprintf('At State point 2n');

fprintf('P2 is :%f Barn',P2);

S2=S1;
fprintf('S2 is :%f kJ/kgKn', S2);

%Calculating the value of  X
if(S2<Sg_2)
    X2=(S2-Sf_3)/(Sg_2-Sf_3); 
else
    X2=1;
end
fprintf('X2 is  :%f n', X2);

%calculating value of T2
if(X2<1)
    T2=Tsat_P2;
else
    %S2=Sg_2+CP2_V*(log(T2/Tsat_P2))
    T2=(Tsat_P2+273.15)*exp((S2-Sg_2)/CP2_V);
    T2=T2-273.15;
end
fprintf('T2 is :%f degCn',T2);

if(X2<1)
    H2=Hf_3+X2*(Hf_3-Hg_2);
else
    H2=XSteam('h_pT',P2,T2);
end
fprintf('H2 is : %f kJ/kgnn', H2)

%%Calculation of process properties at state 3
%step 11
%Calculation of process properties at state 3

fprintf('At state point 3n')

P3=P2;
fprintf('P3 is : %f Barn', P3)

V3=XSteam('vL_p', P3);

T3=Tsat_P2;  %No subcooling assumed 
fprintf('T3 is : %f degCn', T3)

H3=Hf_3;
fprintf('H3 is : %f kJ/kgn', H3)

S3=Sf_3;
fprintf('S3 is : %f kJ/kgnn', S3)

%%Calculation of process properties at state 4
%step 12
%Calculation of process properties at state 4

fprintf('At state point 4n');

P4=P1;
fprintf('P4 is : %f Barn', P4)

S4=S3;
fprintf('S4 is : %f kJ/kgn', S4)

Wp=V3*(P4-P3)*100;
H4=Wp+H3;
fprintf('H4 is : %f kJ/kgn', H4)

T4=(Tsat_P1+273.15)/(exp((Sf_4-S4)/CP1_L));
T4=T4-273.15;
fprintf('T4 is : %f Deg celsius nn', T4)


%%Calculation for plotting saturated liquid and vapor lines
%step 13
%Calculation & plotting saturated liquid and vapor lines

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));
end

%%ploting T-S and H-S Diagrams
%step 14
%plotting T-S plot

figure(1)
hold on 
plot([S1 S2],[T1 T2],'r','LineWidth', 2)
text(S1,T1,' 1')
text(S2,T2,' 2')
plot([S2 Sg_2],[T2 Tsat_P2],'r','LineWidth', 2)
text(Sg_2,Tsat_P2,' 2s')
plot([Sg_2 S3],[Tsat_P2 T3],'r','LineWidth', 2)
text(S3,T3,' 3')
plot([S3 S4],[T3 T4],'r','LineWidth', 2)
text(S4,T4,' 4')
plot([S4 Sf_4],[T4 Tsat_P1],'r','LineWidth', 2)
text(Sf_4,Tsat_P1,' 4s')
plot([Sf_4 Sg_1],[Tsat_P1 Tsat_P1],'r','LineWidth', 2)
text(Sg_1,Tsat_P1,' 1s')
plot([Sg_1 S1],[Tsat_P1 T1],'r','linewidth', 2)
plot(S_L,temp,'b','linestyle','--','LineWidth', 1)
plot(S_V,temp,'b','linestyle','--','LineWidth', 1)
title('T-S Diagram of Ideal Rankine Cycle')
xlabel('Specific Entropy (kJ/kgk)')
ylabel('Temperture (degC)')

%step 15
%ploting H_S plot

figure(2)
hold on 
plot([S1 S2],[H1 H2],'r','LineWidth', 2)
text(S1,H1,' 1')
text(S2,H2,' 2')
plot([S2 Sg_2],[H2 Hg_2],'r','LineWidth', 2)
text(Sg_2,Hg_2,' 2s')
plot([Sg_2 S3],[Hg_2 H3],'r','LineWidth', 2)
text(S3,H3,' 3')
plot([S3 S4],[H3 H4],'r','LineWidth', 2)
text(S4,H4,' 4')
plot([S4 Sf_4],[H4 Hf_4],'r','LineWidth', 2)
text(Sf_4,Hf_4,' 4s')
plot([Sf_4 Sg_1],[Hf_4 Hg_1],'r','LineWidth', 2)
text(Sg_1,Hg_1,' 1s')
plot([Sg_1 S1],[Hg_1 H1],'r','linewidth', 2)
plot(S_L,H_L,'b','linestyle','--','LineWidth', 1.5)
plot(S_V,H_V,'b','linestyle','--','LineWidth', 1.5)
title('H-S Diagram of Ideal Rankine Cycle')
xlabel('Specific Enthalpy (kJ/kg)')
ylabel('Specific Entropy (kJ/kgk)')


%% work done, heat, SSC and efficiency calculation
%step 16
%calculation of work done, heat, SSC and efficiency
Wt=H1-H2;
fprintf('Work by turbine is : %f kJ/kgn',Wt)
fprintf('Work by compressor is : %f kJ/kgn',Wp)
Wnet=Wt-Wp;
fprintf('Net Work done is : %f kJ/kgn',Wnet)
Qin=H1-H4;
%Efficiency
eff_thermal=Wnet*100/Qin;  
fprintf('Thermal efficiency is : %f', eff_thermal); disp('%')
%specific steam consuption
SSC=3600/Wt;
fprintf('S.S.C is : %f kg/kWh',SSC)

Explanation:

For writing this program, we are using XSteam.m which is basically steam table

Step 1: Clearing workspace, command window & closing all plots

Step 2: print discription of all process in command window

Step 3: Taking all input arguments.

Step 4: calculate pf cp value are p1 and p2 for saturated liquid & vapor

Step 5: calculation of saturation temperature at p1 & p2

Step 6: calculation of saturation properties at state 1

Step 7: calculation of saturation properties at state 2

Step 8: calculation of saturation properties at state 3

Step 9: calculation of saturation properties at state 4

Step 10: calculation of process properties at state 1

Step 11: calculation of process properties at state 2

Step 12: calculation of process properties at state 3

Step 13: calculation of process properties at state 4

Step 14: Calculate & plotting saturation liquid and vapor lines.

Step 15: plotting T-S plot

Step 16: plotting H-S plot

Step 17: Calculation of working done, heat, SSC and efficiency.

Output:

Enter the pressure at the Turbine Inlet (in bar): 30

Enter the Temperature at the Turbine Inlet (in Degree Celsius): 400

Enter the pressure at the Condenser (in bar): 0.05

RESULT

At State point 1n

P1 is :30.000000 Barn

T1 is :400.000000 degCn

H1 is :3231.571027 kJ/kgn

S1 is :6.923259 kJ/kgnn

At State point 2n

P2 is :0.050000 Barn

S2 is :6.923259 kJ/kgKn

X2 is :0.814256 n

T2 is :32.875490 degCn

H2 is: -1835.177974 kJ/kgnn

At state point 3n

P3 is: 0.050000 Barn

T3 is: 32.875490 degCn

H3 is: 137.765119 kJ/kgn

S3 is: 0.476254 kJ/kgnn

At state point 4n

P4 is: 30.000000 Barn

S4 is: 0.476254 kJ/kgn

H4 is: 140.776056 kJ/kgn

T4 is: 46.846863 Deg celsius nn

Work by turbine is: 5066.749001 kJ/kgn

Work by compressor is: 3.010937 kJ/kgnNet

Work done is: 5063.738064 kJ/kgn

Thermal efficiency is: 163.832869%

S.S.C is: 0.710515 kg/kWh

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.