Making a rankine cycle simulator by using MATLAB
AIM
To create a code for making the rankine cycle simulator with appropriate data by using MATLAB.
OBJECTIVES
1) To calculate the thermodynamic state point in the rankine cycle.
2) Plotting the enthalpy and temperature with fuction of entropy.
3) Write down the thermodynamic property value at each and every state points.
INTRODUCTION
The Rankine cycle is a model used to predict the performance of steam turbine systems. It was also used to study the performance of reciprocating steam engines. 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.
Working components for rankine cycle
Rankine cycle T - S diagram
Process 1 - 2 Isentropic expanstion
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 difference of enthalpy at turbine inlet to outlet.
The maximum superheated temperature is 600 degree celsius it not beyond that temperature. The steam possing through the turbine, it gets starts to condensing with denoted in terms of dryness fraction (x).
At the end of the turbine shaft, we coupled with the generator shaft. The mechanical energy is converted into electrical energy.
Process 2 - 3 Constant pressure heat rejecton
The wetvapour entering into the condensor then it starts condensed by measures we calculate dryness fraction. When we condensing the saturated vapour steam to liquid, the volume of saturated liquid is very less compare to the volume of saturated vapour.
The volume of saturated steam is approximately 1600m^3/kg times of greater than the volume of saturated liquid.
The absolute temperature of the steam is crossing below or equal to the dew point temperature, at the steam has starts to precipitating. Moreover, the pressure and temperature is decreased.
Process 3 - 4 Isentropic compression
At the end of the previous process the steam had been completely condensed. So, we want to boost up the pressure of the water for which liquid gets entered to the boiler. We use the pump for increase the pressure of working fluid.
It have taken some small amount of energy from our turbine work.
Process 4 - 1 Constant pressure heat addition
The high pressure fluid is passed to boiler by the help of pump, adding the heat by using the any burnable substance. Over the period, liquid has increasing the heat of sensible and at some temperature the liquid is phase change into vapour state that heat is called Latent heat.
When we further increasing the temperature of the system, that is called superheat steam. It crossing the saturated vapour curve line and it to attached turbine inlet.
ASSUMPTIONS FOR RANKINE CYCLE
1) Frictionless between pipes and working fluid.
2) Neglecting the viscuous forces at duct inside wall.
LIMITATIONS
1) The superheat steam is not to beyond the 640 degree celsius.
DEFINITIONS
Sensible heat
If the heat added and change in temperature and there is no change in the phase is called sensible of heat.
Latent heat
At same heat and no change in temperature and there is phase change is occur it is called latent heat.
Enthalpy
Enthalpy, a property of a thermodynamic system, is the sum of the system's internal energy and the product of its pressure and volume. It denoted by H, SI units are J/mol.
Entropy
Entropy can be defined in a simple qualitative way as a measure of the degree of randomness of the particles, such as molecules in a system. It denoted by S, SI units are J/K.
Specific heat
The specific heat capacity of a substance is the amount of energy required to raise the temperature of 1kg of the substance by `1^oC`. It denoted by Cp, SI units are J/kg.K
FORMULA FOR CALCULATING THE CYCLE PERFORMANCE
Turbine work(Wt)
Wt = H1 - H2
Pump work(Wp)
Wp = H4 - H3
Net workdone
Net work = Wt - Wp
Heat supplied (Qs)
Qs = H1 - H4
Heat rejection(Qr)
Qr = H2 - H3
Work ratio(Wr)
Wr = Net work/Wt
Dryness fraction of the steam(x)
x = Mass of dry steam/Mass of wet steam
PROGRAM FOR CREATING THE RANKINE CYCLE
clear all % Remove all variable and corresponding values from workspace
close all % Closing the all figures
clc % Clean the all data from command window
% Print of process description
fprintf('\n %70s \n','RANKINE CYCLE SIMULATOR') % Naming for showing in command window
fprintf('1-2 Isentropic Expansion in the turbine\n') % Inside the bracket text it showing in command window
fprintf('2-3 Isobaric or constant pressure heat rejection in the condensor\n')
fprintf('3-4 Isentropic compression in the pump\n')
fprintf('1-2 Isobaric or constant pressure heat addition in the boiler\n')
% Initial inputs
p1 = input('State point 1 pressure at the turbine inlet (in bar):'); % Pressure value for state point 1
T1 = input('State point 1 temperature at the turbine inlet(in degree Celsius):'); % Temperature value for state point 1
p2 = input('State point 2 pressure at the Condenser(in bar):'); % Pressure value for state point 2
% Calculating a each state point values % Calculating the thermodynamic properties by using XSteam function
% Remaining points for state point 1
S1 = XSteam('s_pT',p1,T1); % Entropy value at state point 1
H1 = XSteam('h_pT',p1,T1); % Enthalpy value at state point 1
% Calulating a state point 2 % Calculating the state point 2 by using Xst
% S2 = Sf2 + (x*(Sv2 - sf2)) % Entropy value at state point 2
% H2 = hf2 + (x*(hv2 - hf2)) % Enthalpy value at state point 2
S2 = S1; % Entropy of state 1 and 2 are equal Because of isentropic expansion
Sf2 = XSteam('sL_p',p2); % Saturated liquid entropy at state point 2
Sv2 = XSteam('sv_p',p2); % Saturated vapour entropy at state point 2
hf2 = XSteam('hL_p',p2); % Saturated liquid enthalpy at state point 2
hv2 = XSteam('hv_p',p2); % Saturated liquid enthalpy at state point 2
x2 = (S2 - Sf2)/(Sv2 - Sf2); % Dryness fraction for state ponit 2
H2 = hf2 + (x2*(hv2 - hf2)); % Enthalpy for state point 2
T2 = XSteam('T_hs',H2,S2); % Temperature of turbine exist or condensor inlet
%Calculating a state point 3
p3 = p2; % Pressure at state point 2 and 3 is equal
T3 = T2; % Temperature at state point 2 and 3 is equal
S3 = XSteam('sL_p',p3); % Entropy for state point 3
H3 = XSteam('hL_p',p3); % Enthalpy for state point 3
% Calculating the state point 4
% Calculating a Gamma value
Cp = XSteam('cpL_p',p3); % Calculating specific heat capacity of pressure
Cv = XSteam('cvL_p',p3); % Calculating specific heat capacity of volume
Gamma = (Cp/Cv); % Gamma is depends on specific heat of pressure and volume
p4 = p1; % Pressure at state 1 is equal to pressure at state 4
S4 = S3; % Entropy at state 1 is equal to entropy at state 4
H4 = XSteam('h_ps',p4,S4); % Enthalpy at state point 4
T4 = T3*(p4/p3)^((Gamma-1)/(Gamma)); % Temperature at state point 4
% Calculating & Checking the Cycle performance
% Finding the workdone
Turbine_work = H1 - H2; % Difference of enthalpy at turbine inlet to outlet
Pump_work = H4 - H3; % Difference of enthalpy at pump inlet to pump outlet
Net_work = Turbine_work - Pump_work; % Difference of turbine work to pump work
% Calculating the heat input and output
Heat_in = H1 - H4; % Difference of boiler outlet to boiler inlet
Heat_out = H2 - H3; % Difference of condensor inlet to outlet
% Calculating the ratios
Work_ratio = Net_work/Turbine_work;
Back_work_ratio = Turbine_work/Heat_in;
% Calculating the Specific steam consumption
SSC = 3600/Net_work;
% Calculating the thermal efficiency of rankine cycle
Eff_rankine = ((Net_work)/(Heat_in))*100;
% Calculating the state point 5
T5 = XSteam('Tsat_p',p1);
S5 = XSteam('sL_p',p1);
H5 = XSteam('hL_p',p1);
% Calculating the state point 6
T6 = T5;
S6 = XSteam('sv_p',p1);
H6 = XSteam('hv_p',p1);
% Printed all the thermal properties in order of state points % Printing the upcoming results in the command window
fprintf('\n %65s \n','RESULTS') % Printing the text at middle of command window
fprintf('At state point 1:\n') % Printing the state point 1 thermodynamic values
fprintf('P1 is: %f Bar \n',p1)
fprintf('T1 is: %f Degree celcius \n',T1)
fprintf('H1 is: %f KJ/kg \n',H1)
fprintf('S1 is: %f KJ/kg.k \n',S1)
fprintf('\nAt state point 2:\n') % Printing the state point 2 thermodynamic values
fprintf('P2 is: %f Bar \n',p2)
fprintf('T2 is: %f Degree celcius \n',T2)
fprintf('H2 is: %f KJ/kg \n',H2)
fprintf('S2 is: %f KJ/kg.k \n',S2)
fprintf('\nAt state point 3:\n') % Printing the state point 3 thermodynamic values
fprintf('P3 is: %f Bar \n',p3)
fprintf('T3 is: %f Degree celcius \n',T3)
fprintf('H3 is: %f KJ/kg \n',H3)
fprintf('S3 is: %f KJ/kg.k \n',S3)
fprintf('\nAt state point 4:\n') % Printing the state point 4 thermodynamic values
fprintf('P4 is: %f Bar \n',p4)
fprintf('T4 is: %f Degree celcius \n',T4)
fprintf('H4 is: %f KJ/kg \n',H4)
fprintf('S4 is: %f KJ/kg.k \n',S4)
fprintf('\nAt state point 5:\n') % Printing the state point 5 thermodynamic values
fprintf('T5 is: %f Degree celcius \n',T5)
fprintf('H5 is: %f KJ/kg \n',H5)
fprintf('S5 is: %f KJ/kg.k \n',S5)
fprintf('\nTurbine work is: %f KJ/kg \n',Turbine_work) % Printing the calculated values into the command window
fprintf('Pump_work is: %f KJ/kg \n',Pump_work)
fprintf('Net_work is: %f KJ/kg \n',Net_work)
fprintf('Efficiency is: %f %% \n',Eff_rankine)
fprintf('Specific steam consumption is: %f kg/KWh \n',SSC)
fprintf('Work ratio is: %f \n',Work_ratio)
fprintf('Back work ratio is: %f \n',Back_work_ratio)
% Plotting the graphs for represents the curves
% Plotting the temperature vs Entropy
figure(1);
hold on;
plot([S1 S2 S3 S4 S5 S6 S1],[T1 T2 T3 T4 T5 T6 T1],'linewidth',3,'color','r'); % Make the plot of rankine cycle
% Sat_curve means saturation curve % Plotting the saturation curve
Sat_curve = linspace(0,T1,500); % Dividing the temperature value in linearly spaced values
for i = 1:length(Sat_curve); % Calculating the saturated value with function of temperature
S_l(i) = XSteam('sL_T',Sat_curve(i));
S_v(i) = XSteam('sv_T',Sat_curve(i));
h_l(i) = XSteam('hL_T',Sat_curve(i));
h_v(i) = XSteam('hv_T',Sat_curve(i));
end
plot(S_l,Sat_curve,'linewidth',3,'color','g');
plot(S_v,Sat_curve,'linewidth',3,'color','g');
gtext('1'); % By using the gtext command for paste the strings where we want
gtext('2');
gtext('3');
gtext('4');
gtext('Critical point');
gtext('x = 0');
gtext('x =0.8');
gtext('Saturation liquid line');
gtext('Saturation Vapour line');
xlabel('Entropy in KJ/kg');
ylabel('Temperature in Degree Celsius');
title('Entropy vs temperature');
legend('Working Boundary','Saturation curve');
% Plotting the entropy vs enthalpy
figure(2);
hold on;
plot([S1 S2 S3 S4 S5 S6 S1],[H1 H2 H3 H4 H5 H6 H1],'linewidth',3,'color','r');
plot(S_l,h_l,'linewidth',3,'color','g');
plot(S_v,h_v,'linewidth',3,'color','g');
gtext('1');
gtext('2');
gtext('3');
gtext('4');
xlabel('Entropy in KJ/kg');
ylabel('Enthalpy in KJ/kg.K');
title('Entropy vs enthalpy');
legend('Working Boundary','Saturation curve');
EXPLANATION
1) We have to print about the rankine cycle thermodynamic four processess with some assumptions in the command window.
2) Provide the initial values of pressure and temperature at state point 1 and pressure at state point 2 for this rankine cycle.
3) XSteam function file is saved in same folder then only program gets run. It helps to finding the thermodynamic properties at point and as well path function.
4) We calculating the enthalpy, entropy, temperature and pressure for each and every state point.
5) The state point 1,2 and 3 same manner to calculate the property values. But, state point 3 to 4 is isentropic compression we use thermodynamic relation for finding the state point 4.
6) We calculating the dryness fraction it helps to finding the quatity of water and vapour in total volume.
7) Further, we want calculating the performances of rankine cycle code it for calculating the net workdone and back work ratio.
8) Afterthat, create a ploting for represents the rankine cycle curve with saturation curve. The saturation curve has two categories one is saturated liquid curve and another one is saturated vapour curve.
9) Plotting the both figures such as entropy versus temperature and entropy versus enthalpy.
RESULTS
DETAILS SHOWN ABOUT RANKINE CYCLE IN COMMAND WINDOW
1) The printed the title of project name and printed down the four processes.
2) Load the initial values for state point 1 ands 2.
3) Printed down all thermodynamic properties for each and every state points.
4) Moreover, printed down the performance calculation for rankine cycle simulator.
PLOT FOR ENTROPY VS TEMPERATURE
1) Left side of the saturation liquid curve is to named as subcooled region, the subcooled region fluid has been completely liquid phase.
2) Inside the curve by using the dryness fraction we can able to finding the quatity of vapour and water in given volume.
3) In our problem 80% of dry air and 20% of water vapour in our total volume.
PLOT FOR ENTROPY VS ENTHALPY
WORKSPACE
ERRORS WHILE DOING PROGRAMMING
When I did the iterations by using for loop command and each iterate values are saved in below formulated code. In that code I was used capital letter variables, but in formulae I mistakely type in small letter.
Afterthat, I recorrect it the program has run smoothly.
I forgot the state point 4 while I doind in program. Afterthat, I identified the error and make it correct, it was make plot in neatly.
CONCLUSION
Finally, to created the rankine cycle simulator in appropriately by using in an MATLAB.
REFERANCE
2) https://www.youtube.com/watch?v=lhilSmE2Ee0