Rankine Cycle Simulator
AIM:- Code to simulate Rankine Cycle
Rankine Cycle- The Rankine cycle is the fundamental operating cycle of all power plants where an operating fluid is continuously evaporated and condensed.
Rankine Cycle Processes-
1-2: Isentropic Expansion - The vapor is expanded in the turbine, thus producing work which may be converted to electricity. In practice, the expansion is limited by the temperature of the cooling medium and by the erosion of the turbine blades by liquid entrainment in the vapor stream as the process moves further into the two-phase region. Exit vapor qualities should be greater than 90%.
2-3: Isobaric Heat Rejection - The vapor-liquid mixture leaving the turbine (2) is condensed at low pressure, usually in a surface condenser using cooling water. In well designed and maintained condensers, the pressure of the vapor is well below atmospheric pressure, approaching the saturation pressure of the operating fluid at the cooling water temperature.
3-4: Isentropic Compression - The pressure of the condensate is raised in the feed pump. Because of the low specific volume of liquids, the pump work is relatively small and often neglected in thermodynamic calculations.
4-1:Isobaric Heat Transfer - High pressure liquid enters the boiler from the feed pump (4) and is heated to the saturation temperature (5). Further addition of energy causes evaporation of the liquid until it is fully converted to saturated steam (6).
REHEAT RANKINE CYCLE
The processes of reheat rankine cycle are explained below using the enthalpy-entropy diagram.
Process 1-2 - This process is known as high pressure turbine.Obtain the work-done by turbine using enthalpies of inlet and exit.
Where, h1 is the enthalpy for inlet state 1 and h2 is the enthalpy for outlet state 2.
Process 2-3 - This process is known as boiler. In this process calculate the values of h3 and S3.
Process 3-4 - This process is known as low pressure turbine. In this process calculate the values of h4 and S4. Where, S4 is the entropy at state 4.
Process 4-5 - This process is known as condenser. In this process the heat is expelled from condenser.
Process 5-6 - This process is known as pump. In this process work is done by the pump.
Where, h6 is the enthalpy at state 6.
Process 6-1 - This process is known as boiler. In this process the heat is supplied.
Where, h5 is the enthalpy at state 5.
REGENERATIVE RANKINE CYCLE-
In a simple Rankine cycle, heat is added to the cycle during process 2-2\'-3 (see the T-s diagram on the left). During this first stage (process 2-2\'), the temperature of the water is low. That reduces the average temperature during heat addition (process 2-2\'-3). To remedy this shortcoming, increasing the temperature of the feedwater (water leaving the pump and entering the boiler) can be considered. This is accomplished by extracting stream from the turbine to heat the feedwater. This process is called regeneration and the heat exchanger where heat is transferred from steam to feedwater is called a regenerator, or a feedwater heater. There are actually two main types of feedwater heaters. If the steam mixes with the compressed water from the pump, it is an open feedwater heater. If the steam does not mix with the compressed water from the pump, it is a closed feedwater heater.
CODE-
clc
clear all
fprintf(\'1-2 -Isentropic Expansion.\\n\')
fprintf(\'2-3 -Isobaric Heat Rejection.\\n\')
fprintf(\'3-4 -Isentropic Compression.\\n\')
fprintf(\'4-1 -Isobaric Heat Transfer.\\n\\n\\n\')
%Given
Pmax=input(\'Enter maximum Pressure:\')
Tmax=input(\'Enter maximum Tempreature:\')
Tmin=input(\'Enter minimum Tempreature:\')
Pressure1=Pmax;
Tempreature1=Tmax;
Enthalpy1= XSteam(\'h_pt\',Pressure1,Tempreature1);
Entropy1=XSteam(\'s_pt\',Pressure1,Tempreature1);
Pressure5=Pmax;
Tempreature5=XSteam(\'Tsat_p\',Pressure5);
Enthalpy5= XSteam(\'hL_p\',Pressure5);
Entropy5=XSteam(\'sL_p\',Pressure5);
Pressure6=Pmax;
Tempreature6=XSteam(\'Tsat_p\',Pressure6);
Enthalpy6= XSteam(\'hV_p\',Pressure6);
Entropy6=XSteam(\'sV_p\',Pressure6);
Tempreature3=Tmin;
Pressure3=XSteam(\'Psat_t\',Tempreature3);
Enthalpy3= XSteam(\'hL_t\',Tempreature3);
Entropy3=XSteam(\'sL_t\',Tempreature3);
Pressure2=Pressure3;
Tempreature2=Tmin;
Entropy2= Entropy1;
SL=XSteam(\'sL_t\',Tempreature2);
SV=XSteam(\'sV_t\',Tempreature2);
x= (Entropy2-SL)/SV;
HL=XSteam(\'hL_t\',Tempreature2);
HV=XSteam(\'hV_t\',Tempreature2);
Enthalpy2= HL + x*HV;
Pressure4=Pmax;
Entropy4=Entropy3;
Enthalpy4= XSteam(\'h_ps\',Pressure4,Entropy4);
cp4=XSteam(\'Cp_ps\',Pressure4,Entropy4);
cv4=XSteam(\'Cv_ps\',Pressure4,Entropy4);
g4=cp4/cv4;
o=(g4-1)/g4;
Tempreature4= Tempreature3*((Pressure4/Pressure3)^o);
T6_1=linspace(Tempreature6,Tempreature1,200);
P6_1=Pmax;
for i=1:length(T6_1)
Entropy6_1(i)= XSteam(\'s_pt\',P6_1,T6_1(i));
Enthalpy6_1(i)= XSteam(\'h_pt\',P6_1,T6_1(i));
end
Tall= linspace(0,375,1000);
for i=1:length(Tall)
EntropyallL(i)=XSteam(\'sL_T\',Tall(i));
EnthalpyallL(i)=XSteam(\'hL_T\',Tall(i));
end
Tall= linspace(0,375,1000);
for i=1:length(Tall)
EntropyallV(i)=XSteam(\'sV_T\',Tall(i));
EnthalpyallV(i)=XSteam(\'hV_T\',Tall(i));
end
figure(1)
plot([Entropy4 Entropy5],[Tempreature4 Tempreature5],\'linewidth\',3,\'color\',\'r\')
hold on
plot(Entropy6_1,T6_1,\'linewidth\',3,\'color\',\'r\')
hold on
plot([Entropy1 Entropy2],[Tempreature1 Tempreature2],\'linewidth\',3,\'color\',\'r\')
hold on
plot([Entropy2 Entropy3],[Tempreature2 Tempreature3],\'linewidth\',3,\'color\',\'r\')
hold on
plot([Entropy3 Entropy4],[Tempreature3 Tempreature4],\'linewidth\',2,\'color\',\'r\')
hold on
plot([Entropy5 Entropy6],[Tempreature5 Tempreature6],\'linewidth\',3,\'color\',\'r\')
hold on
plot(EntropyallL,Tall,\'linewidth\',1,\'color\',\'k\')
hold on
plot(EntropyallV,Tall,\'linewidth\',1,\'color\',\'k\')
text(Entropy1,Tempreature1,\'1\',\'Fontsize\',15)
text(Entropy2,Tempreature2,\'2\',\'Fontsize\',15)
text(Entropy3,Tempreature3,\'3\',\'Fontsize\',15,\'VerticalAlignment\',\'bottom\')
text(Entropy4,Tempreature4,\'4\',\'Fontsize\',15,\'VerticalAlignment\',\'top\')
text(Entropy5,Tempreature5,\'5\',\'Fontsize\',15)
text(Entropy6,Tempreature6,\'6\',\'Fontsize\',15)
xlabel(\'Entropy\')
ylabel(\'Tempreature\')
figure(2)
plot([Entropy4 Entropy5],[Enthalpy4 Enthalpy5],\'linewidth\',3,\'color\',\'r\')
hold on
plot(Entropy6_1,Enthalpy6_1,\'linewidth\',3,\'color\',\'r\')
hold on
plot([Entropy1 Entropy2],[Enthalpy1 Enthalpy2],\'linewidth\',3,\'color\',\'r\')
hold on
plot([Entropy2 Entropy3],[Enthalpy2 Enthalpy3],\'linewidth\',3,\'color\',\'r\')
hold on
plot([Entropy3 Entropy4],[Enthalpy3 Enthalpy4],\'linewidth\',2,\'color\',\'r\')
hold on
plot([Entropy5 Entropy6],[Enthalpy5 Enthalpy6],\'linewidth\',3,\'color\',\'r\')
hold on
plot(EntropyallL,EnthalpyallL,\'linewidth\',1,\'color\',\'k\')
hold on
plot(EntropyallV,EnthalpyallV,\'linewidth\',1,\'color\',\'k\')
text(Entropy1,Enthalpy1,\'1\',\'Fontsize\',15)
text(Entropy2,Enthalpy2,\'2\',\'Fontsize\',15)
text(Entropy3,Enthalpy3,\'3\',\'Fontsize\',15,\'HorizontalAlignment\',\'left\')
text(Entropy4,Enthalpy4,\'4\',\'Fontsize\',15,\'HorizontalAlignment\',\'right\')
text(Entropy5,Enthalpy5,\'5\',\'Fontsize\',15)
text(Entropy6,Enthalpy6,\'6\',\'Fontsize\',15)
xlabel(\'Entropy\')
ylabel(\'Tempreature\')
fprintf(\'\\n\\tRESULT\\n\\n\')
fprintf(\'At state point 1:\\n\')
fprintf(\'Pressure is:\')
fprintf(\'%4.2f\',Pressure1)
fprintf(\'Bar\\n\')
fprintf(\'Tempreature is:\')
fprintf(\'%4.2f\',Tempreature1)
fprintf(\'Degree Celcius\\n\')
fprintf(\'Enthalpy is:\')
fprintf(\'%4.2f\',Enthalpy1)
fprintf(\'kJ/kg\\n\')
fprintf(\'Entropy is:\')
fprintf(\'%4.2f\',Entropy1)
fprintf(\'kJ/kg K\\n\\n\')
fprintf(\'At state point 2:\\n\\n\')
fprintf(\'Pressure is:\')
fprintf(\'%4.2f\',Pressure2)
fprintf(\'Bar\\n\')
fprintf(\'Tempreature is:\')
fprintf(\'%4.2f\',Tempreature2)
fprintf(\'Degree Celcius\\n\')
fprintf(\'Enthalpy is:\')
fprintf(\'%4.2f\',Enthalpy2)
fprintf(\'kJ/kg\\n\')
fprintf(\'Entropy is:\')
fprintf(\'%4.2f\',Entropy2)
fprintf(\'kJ/kg K\\n\\n\')
fprintf(\'At state point 3:\\n\\n\')
fprintf(\'Pressure is:\')
fprintf(\'%4.2f\',Pressure3)
fprintf(\'Bar\\n\')
fprintf(\'Tempreature is:\')
fprintf(\'%4.2f\',Tempreature3)
fprintf(\'Degree Celcius\\n\')
fprintf(\'Enthalpy is:\')
fprintf(\'%4.2f\',Enthalpy3)
fprintf(\'kJ/kg\\n\')
fprintf(\'Entropy is:\')
fprintf(\'%4.2f\',Entropy3)
fprintf(\'kJ/kg K\\n\\n\')
fprintf(\'At state point 4:\\n\\n\')
fprintf(\'Pressure is:\')
fprintf(\'%4.2f\',Pressure4)
fprintf(\'Bar\\n\')
fprintf(\'Tempreature is:\')
fprintf(\'%4.2f\',Tempreature4)
fprintf(\'Degree Celcius\\n\')
fprintf(\'Enthalpy is:\')
fprintf(\'%4.2f\',Enthalpy4)
fprintf(\'kJ/kg\\n\')
fprintf(\'Entropy is:\')
fprintf(\'%4.2f\',Entropy4)
fprintf(\'kJ/kg K\\n\\n\')
fprintf(\'At state point 5:\\n\\n\')
fprintf(\'Pressure is:\')
fprintf(\'%4.2f\',Pressure5)
fprintf(\'Bar\\n\')
fprintf(\'Tempreature is:\')
fprintf(\'%4.2f\',Tempreature5)
fprintf(\'Degree Celcius\\n\')
fprintf(\'Enthalpy is:\')
fprintf(\'%4.2f\',Enthalpy5)
fprintf(\'kJ/kg\\n\')
fprintf(\'Entropy is:\')
fprintf(\'%4.2f\',Entropy5)
fprintf(\'kJ/kg K\\n\\n\')
fprintf(\'At state point 6:\\n\\n\')
fprintf(\'Pressure is:\')
fprintf(\'%4.2f\',Pressure6)
fprintf(\'Bar\\n\')
fprintf(\'Tempreature is:\')
fprintf(\'%4.2f\',Tempreature6)
fprintf(\'Degree Celcius\\n\')
fprintf(\'Enthalpy is:\')
fprintf(\'%4.2f\',Enthalpy6)
fprintf(\'kJ/kg\\n\')
fprintf(\'Entropy is:\')
fprintf(\'%4.2f\',Entropy6)
fprintf(\'kJ/kg K\\n\\n\')
EXPLANATION-
clc
clear all
fprintf(\'1-2 -Isentropic Expansion.\\n\')
fprintf(\'2-3 -Isobaric Heat Rejection.\\n\')
fprintf(\'3-4 -Isentropic Compression.\\n\')
fprintf(\'4-1 -Isobaric Heat Transfer.\\n\\n\\n\')
%Given to put the input values
Pmax=input(\'Enter maximum Pressure:\')
Tmax=input(\'Enter maximum Tempreature:\')
Tmin=input(\'Enter minimum Tempreature:\')
%to calculate variables at state point 1, using given data and steam table in XSteam
Pressure1=Pmax;
Tempreature1=Tmax;
Enthalpy1= XSteam(\'h_pt\',Pressure1,Tempreature1);
Entropy1=XSteam(\'s_pt\',Pressure1,Tempreature1);
%to calculate variables at state point 5, using given data and steam table in XSteam
Pressure5=Pmax;
Tempreature5=XSteam(\'Tsat_p\',Pressure5);
Enthalpy5= XSteam(\'hL_p\',Pressure5);
Entropy5=XSteam(\'sL_p\',Pressure5);
%to calculate variables at state point 6, using given data and steam table in XSteam
Pressure6=Pmax;
Tempreature6=XSteam(\'Tsat_p\',Pressure6);
Enthalpy6= XSteam(\'hV_p\',Pressure6);
Entropy6=XSteam(\'sV_p\',Pressure6);
%to calculate variables at state point 3, using given data and steam table in XSteam
Tempreature3=Tmin;
Pressure3=XSteam(\'Psat_t\',Tempreature3);
Enthalpy3= XSteam(\'hL_t\',Tempreature3);
Entropy3=XSteam(\'sL_t\',Tempreature3);
%to calculate variables at state point 2, using given data and steam table in XSteam
Pressure2=Pressure3;
Tempreature2=Tmin;
Entropy2= Entropy1;
SL=XSteam(\'sL_t\',Tempreature2); %mixture of liquid and vapour
SV=XSteam(\'sV_t\',Tempreature2);
x= (Entropy2-SL)/SV; %dryness fraction calculation
HL=XSteam(\'hL_t\',Tempreature2);
HV=XSteam(\'hV_t\',Tempreature2);
Enthalpy2= HL + x*HV;
%to calculate variables at state point 4, using given data and steam table in XSteam
Pressure4=Pmax;
Entropy4=Entropy3;
Enthalpy4= XSteam(\'h_ps\',Pressure4,Entropy4);
cp4=XSteam(\'Cp_ps\',Pressure4,Entropy4);
cv4=XSteam(\'Cv_ps\',Pressure4,Entropy4);
g4=cp4/cv4;
o=(g4-1)/g4;
Tempreature4= Tempreature3*((Pressure4/Pressure3)^o);
%to calculate variables at between state points 6 and 1, using given data and steam table in XSteam for every 200 tempreature values between state 6 and 1 entalpy and entropy
value is extracted from the XSteam data and stored
T6_1=linspace(Tempreature6,Tempreature1,200);
P6_1=Pmax;
for i=1:length(T6_1)
Entropy6_1(i)= XSteam(\'s_pt\',P6_1,T6_1(i));
Enthalpy6_1(i)= XSteam(\'h_pt\',P6_1,T6_1(i));
end
%to calculate the values for staturation liquid and vapour curves, using given data and steam table in XSteam for every 1000 tempreature values between low and high tempreatures entalpy and entropy value is extracted from the XSteam data and stored
Tall= linspace(0,375,1000);
for i=1:length(Tall)
EntropyallL(i)=XSteam(\'sL_T\',Tall(i));
EnthalpyallL(i)=XSteam(\'hL_T\',Tall(i));
end
Tall= linspace(0,375,1000);
for i=1:length(Tall)
EntropyallV(i)=XSteam(\'sV_T\',Tall(i));
EnthalpyallV(i)=XSteam(\'hV_T\',Tall(i));
end
%plotting T-s Diagram-
figure(1)
%4-5
plot([Entropy4 Entropy5],[Tempreature4 Tempreature5],\'linewidth\',3,\'color\',\'r\')
hold on
%6-1
plot(Entropy6_1,T6_1,\'linewidth\',3,\'color\',\'r\')
hold on
%1-2
plot([Entropy1 Entropy2],[Tempreature1 Tempreature2],\'linewidth\',3,\'color\',\'r\')
hold on
%2-3
plot([Entropy2 Entropy3],[Tempreature2 Tempreature3],\'linewidth\',3,\'color\',\'r\')
hold on
%3-4
plot([Entropy3 Entropy4],[Tempreature3 Tempreature4],\'linewidth\',2,\'color\',\'r\')
hold on
%5-6
plot([Entropy5 Entropy6],[Tempreature5 Tempreature6],\'linewidth\',3,\'color\',\'r\')
hold on
%stauration curves
plot(EntropyallL,Tall,\'linewidth\',1,\'color\',\'k\')
hold on
plot(EntropyallV,Tall,\'linewidth\',1,\'color\',\'k\')
%print texts- text point numbers
text(Entropy1,Tempreature1,\'1\',\'Fontsize\',15)
text(Entropy2,Tempreature2,\'2\',\'Fontsize\',15)
text(Entropy3,Tempreature3,\'3\',\'Fontsize\',15,\'VerticalAlignment\',\'bottom\')
text(Entropy4,Tempreature4,\'4\',\'Fontsize\',15,\'VerticalAlignment\',\'top\')
text(Entropy5,Tempreature5,\'5\',\'Fontsize\',15)
text(Entropy6,Tempreature6,\'6\',\'Fontsize\',15)
xlabel(\'Entropy\')
ylabel(\'Tempreature\')
%plotting h-s curve
figure(2)
plot([Entropy4 Entropy5],[Enthalpy4 Enthalpy5],\'linewidth\',3,\'color\',\'r\')
hold on
plot(Entropy6_1,Enthalpy6_1,\'linewidth\',3,\'color\',\'r\')
hold on
plot([Entropy1 Entropy2],[Enthalpy1 Enthalpy2],\'linewidth\',3,\'color\',\'r\')
hold on
plot([Entropy2 Entropy3],[Enthalpy2 Enthalpy3],\'linewidth\',3,\'color\',\'r\')
hold on
plot([Entropy3 Entropy4],[Enthalpy3 Enthalpy4],\'linewidth\',2,\'color\',\'r\')
hold on
plot([Entropy5 Entropy6],[Enthalpy5 Enthalpy6],\'linewidth\',3,\'color\',\'r\')
hold on
plot(EntropyallL,EnthalpyallL,\'linewidth\',1,\'color\',\'k\')
hold on
plot(EntropyallV,EnthalpyallV,\'linewidth\',1,\'color\',\'k\')
text(Entropy1,Enthalpy1,\'1\',\'Fontsize\',15)
text(Entropy2,Enthalpy2,\'2\',\'Fontsize\',15)
text(Entropy3,Enthalpy3,\'3\',\'Fontsize\',15,\'HorizontalAlignment\',\'left\')
text(Entropy4,Enthalpy4,\'4\',\'Fontsize\',15,\'HorizontalAlignment\',\'right\')
text(Entropy5,Enthalpy5,\'5\',\'Fontsize\',15)
text(Entropy6,Enthalpy6,\'6\',\'Fontsize\',15)
xlabel(\'Entropy\')
ylabel(\'Tempreature\')
%printing variables at different state points
fprintf(\'\\n\\tRESULT\\n\\n\')
fprintf(\'At state point 1:\\n\')
fprintf(\'Pressure is:\')
fprintf(\'%4.2f\',Pressure1)
fprintf(\'Bar\\n\')
fprintf(\'Tempreature is:\')
fprintf(\'%4.2f\',Tempreature1)
fprintf(\'Degree Celcius\\n\')
fprintf(\'Enthalpy is:\')
fprintf(\'%4.2f\',Enthalpy1)
fprintf(\'kJ/kg\\n\')
fprintf(\'Entropy is:\')
fprintf(\'%4.2f\',Entropy1)
fprintf(\'kJ/kg K\\n\\n\')
fprintf(\'At state point 2:\\n\\n\')
fprintf(\'Pressure is:\')
fprintf(\'%4.2f\',Pressure2)
fprintf(\'Bar\\n\')
fprintf(\'Tempreature is:\')
fprintf(\'%4.2f\',Tempreature2)
fprintf(\'Degree Celcius\\n\')
fprintf(\'Enthalpy is:\')
fprintf(\'%4.2f\',Enthalpy2)
fprintf(\'kJ/kg\\n\')
fprintf(\'Entropy is:\')
fprintf(\'%4.2f\',Entropy2)
fprintf(\'kJ/kg K\\n\\n\')
fprintf(\'At state point 3:\\n\\n\')
fprintf(\'Pressure is:\')
fprintf(\'%4.2f\',Pressure3)
fprintf(\'Bar\\n\')
fprintf(\'Tempreature is:\')
fprintf(\'%4.2f\',Tempreature3)
fprintf(\'Degree Celcius\\n\')
fprintf(\'Enthalpy is:\')
fprintf(\'%4.2f\',Enthalpy3)
fprintf(\'kJ/kg\\n\')
fprintf(\'Entropy is:\')
fprintf(\'%4.2f\',Entropy3)
fprintf(\'kJ/kg K\\n\\n\')
fprintf(\'At state point 4:\\n\\n\')
fprintf(\'Pressure is:\')
fprintf(\'%4.2f\',Pressure4)
fprintf(\'Bar\\n\')
fprintf(\'Tempreature is:\')
fprintf(\'%4.2f\',Tempreature4)
fprintf(\'Degree Celcius\\n\')
fprintf(\'Enthalpy is:\')
fprintf(\'%4.2f\',Enthalpy4)
fprintf(\'kJ/kg\\n\')
fprintf(\'Entropy is:\')
fprintf(\'%4.2f\',Entropy4)
fprintf(\'kJ/kg K\\n\\n\')
fprintf(\'At state point 5:\\n\\n\')
fprintf(\'Pressure is:\')
fprintf(\'%4.2f\',Pressure5)
fprintf(\'Bar\\n\')
fprintf(\'Tempreature is:\')
fprintf(\'%4.2f\',Tempreature5)
fprintf(\'Degree Celcius\\n\')
fprintf(\'Enthalpy is:\')
fprintf(\'%4.2f\',Enthalpy5)
fprintf(\'kJ/kg\\n\')
fprintf(\'Entropy is:\')
fprintf(\'%4.2f\',Entropy5)
fprintf(\'kJ/kg K\\n\\n\')
fprintf(\'At state point 6:\\n\\n\')
fprintf(\'Pressure is:\')
fprintf(\'%4.2f\',Pressure6)
fprintf(\'Bar\\n\')
fprintf(\'Tempreature is:\')
fprintf(\'%4.2f\',Tempreature6)
fprintf(\'Degree Celcius\\n\')
fprintf(\'Enthalpy is:\')
fprintf(\'%4.2f\',Enthalpy6)
fprintf(\'kJ/kg\\n\')
fprintf(\'Entropy is:\')
fprintf(\'%4.2f\',Entropy6)
fprintf(\'kJ/kg K\\n\\n\')
Output-
T-s Diargram-
H-s Diagram-