Simulation of Rankine Cycle using MATLAB
AIM :
To Simulate the Rankine Cycle using MATLAB.
THEORY :
The Rankine cycle is the fundamental operating cycle of all power plants where an operating fluid is continuously evaporated and condensed. The selection of operating fluid depends mainly on the available temperature range.
The ideal Rankine Cycle consists of the following four processes :
- PROCESS 1-2 : Isentropic Expansion in the turbine.
- PROCESS 2-3 : Isobaric Heat Rejection by the condenser.
- PROCESS 3-4 : Isentropic Compression in the pump.
- PROCESS 4-1 : Isobaric Heat Addition by the boiler.
Given Input Values :
Turbine Inlet temperature = 400° C
Turbine Inlet Pressure = 30 bars
Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure
OBJECTIVE :
- Write a Program to calculate the state points of the Rankine Cycle based on given inputs.
- And, Plot the corresponding T-S and H-S plots for the given set of inputs.
MAIN CODE :
% Program to Simulate Rankine Cycle
close all
clear
clc
% Printing Introduction
fprintf('\t\t\t\tRANKINE CYCLE SIMULATOR \n')
fprintf('\nPROCESS 1-2 is Isentropic Expansion in the turbine \n')
fprintf('PROCESS 2-3 is Isobaric Heat Rejection by the condenser \n')
fprintf('PROCESS 3-4 is Isentropic Compression in the pump \n')
fprintf('PROCESS 4-1 is Isobaric Heat Addition by the boiler \n')
% User Inputs
P1 = input('\nEnter the Pressure at the Turbine Inlet (in bar) : ');
T1 = input('Enter the Temperature at the Turbine Inlet (in Degree Celcius) : ');
P2 = input('Enter the Pressure at the Turbine Outlet (in bar) : ');
% State Point 1
H1 = XSteam('h_pt',P1,T1); % Enthalpy
S1 = XSteam('s_pt',P1,T1); % Entropy
Hf1 = XSteam('hL_p',P1); % Enthalpy of Saturated Liquid
Hg1 = XSteam('hV_p',P1); % Enthalpy of Saturated Vapour
Ts1 = XSteam('Tsat_p',P1); % Saturation Temperature
Sf1 = XSteam('sL_p',P1); % Entropy of Saturated Liquid
Sg1 = XSteam('sV_p',P1); % Entropy of Saturated Vapour
% State Point 2
S2 = S1; % Entropy
Sf2 = XSteam('sL_p',P2); % Entropy of Saturated Liquid
Sg2 = XSteam('sV_p',P2); % Entropy of Saturated Vapour
x = (S2 - Sf2)/(Sg2 - Sf2); % Dryness Fraction
Hf2 = XSteam('hL_p',P2); % Enthalpy of Saturated Liquid
Hg2 = XSteam('hV_p',P2); % Enthalpy of Saturated Vapour
H2 = Hf2 + x*(Hg2 - Hf2); % Enthalpy
T2 = XSteam('T_ph',P2,H2); % Temperature
Ts2 = XSteam('Tsat_p',P2); % Saturation Temperature
% State Point 3
H3 = Hf2;
S3 = Sf2;
T3 = T2;
P3 = P2;
% State Point 4
P4 = P1;
S4 = S3;
H4 = XSteam('h_ps',P4,S4);
T4 = XSteam('T_ps',P4,S4);
% Temperature space for plotting saturation curves
t = linspace(0,374,500);
% Plot T-S Diagram
figure(1)
hold on
% Plot Saturation Curve
for i = 1 : length(t)
plot(XSteam('sL_T',t(i)),t(i),'.','color','r')
plot(XSteam('sV_T',t(i)),t(i),'.','color','r')
end
% Plot Cycle
plot([S1 S2],[T1 T2],'linewidth',2,'color','k')
if x > 1
T3 = Ts2;
plot([S2 Sg2 S3 S4],[T2 Ts2 T3 T4],'linewidth',2,'color','k')
T2 = Ts2;
else
plot([S2 S3 S4],[T2 T3 T4],'linewidth',2,'color','k')
end
l = linspace(T1,T2,1000);
for i = 1 : length(l)
plot(XSteam('s_pT',P1,l(i)),l(i),'.','color','k')
end
plot([Sf1 Sg1],[Ts1 Ts1],'linewidth',2,'color','k')
xlabel('Entropy [KJ/Kg-K]')
ylabel('Temperature [K]')
title('T-S Diagram')
% Plot H-S Diagram
figure(2)
hold on
% Plot Saturation Curve
for i = 1 : length(t)
plot(XSteam('sL_T',t(i)),XSteam('hL_T',t(i)),'.','color','r')
plot(XSteam('sV_T',t(i)),XSteam('hV_T',t(i)),'.','color','r')
end
% Plot Cycle
plot([S1 S2 S3 S4 S1],[H1 H2 H3 H4 H1],'linewidth',2,'color','k')
xlabel('Entropy [KJ/Kg-K]')
ylabel('Enthalpy [KJ/Kg]')
title('H-S Diagram')
% Calculations
% Turbine Work
Wt = H1 - H2;
% Pump Work
Wp = H4 - H3;
% Heat Addition
Qin = H1 - H4;
% Heat Rejection
Qout = H2 - H3;
% Net Work
Wnet = Wt - Wp;
% Efficiency
Ntherm = (Wnet/Qin)*100;
% Specific Steam Consumption
SSC = 3600/Wnet;
% Back Work Ratio
BWR = Wp/Wt;
% Print Results
fprintf('\n\n\t\t\t\tResults\n')
fprintf('\nAt State Point 1:\n')
fprintf('P1 is : %.2f bar\n',P1)
fprintf('T1 is : %.2f Degree Celcius\n',T1)
fprintf('H1 is : %.2f KJ/Kg\n',H1)
fprintf('S1 is : %.2f KJ/Kg-K\n',S1)
fprintf('\nAt State Point 2:\n')
fprintf('P2 is : %.2f bar\n',P2)
fprintf('T2 is : %.2f Degree Celcius\n',T2)
fprintf('H2 is : %.2f KJ/Kg\n',H2)
fprintf('S2 is : %.2f KJ/Kg-K\n',S2)
fprintf('\nAt State Point 3:\n')
fprintf('P3 is : %.2f bar\n',P3)
fprintf('T3 is : %.2f Degree Celcius\n',T3)
fprintf('H3 is : %.2f KJ/Kg\n',H3)
fprintf('S3 is : %.2f KJ/Kg-K\n',S3)
fprintf('\nAt State Point 4:\n')
fprintf('P4 is : %.2f bar\n',P4)
fprintf('T4 is : %.2f Degree Celcius\n',T4)
fprintf('H4 is : %.2f KJ/Kg\n',H4)
fprintf('S4 is : %.2f KJ/Kg-K\n',S4)
fprintf('\nWt is : %.2f KJ/Kg\n',Wt)
fprintf('Wp is : %.2f KJ/Kg\n',Wp)
fprintf('Wnet is : %.2f KJ/Kg\n',Wnet)
fprintf('Thermal Efficiency is : %.2f percent\n',Ntherm)
fprintf('Specific Steam Consumption is : %.2f Kg/KWh\n',SSC)
fprintf('Back Work Ratio is : %.3f \n',BWR)
Explanation
Step 1 : Defined the input values of "P1","T1" and "P2".
Step 2 : "input()" is used to provide the user input. The user input includes temperature and pressure before entry to the turbine and pressure after exiting to the turbine.
Step 3 : Now, based on user inputs parameters at 4 state points were calculated. Thermodynamic parameters includes Enthalpy, Entropy, Temperature, Pressure and dryness factor.
Step 4 : After calculating all parameters, the next objective is to calculate pump work, turbine work, net work output, back ratio and thermal efficiency.
Step 5 : Then, we used "fprintf()" command for displaying all the results in the command window.
RESULTS :
T-S Plot :
H-S Plot :
Workspace Values :