All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
1.AIM: Create a Rankine Cycle Simulator to solve it according to User Inputs. 2. OBJECTIVES OF THE PROJECT: The program should work according to user inputs. Plot T-S & H-S diagram of Rankine Cycle for given Inputs. To calculate State Points of Rankine Cycle. To Calculate: NetWork Output Back Work Ratio…
Amit Chilap
updated on 19 Mar 2021
1.AIM:
2. OBJECTIVES OF THE PROJECT:
3. THEORY & GOVERNING EQUATIONS:
4. BODY OF THE CONTENT:
close all
clear all
clc
%Displaying Rankine Cycle Process.
fprintf( ' Rankine Cycle Simulator ');
fprintf('n Process 1-2 is Isentropic Expansion in the Turbine');
fprintf('n Process 2-3 is Constant Pressure Heat Rejection by the Condenser');
fprintf('n Process 3-4 is Isentropic Compression in the Pump');
fprintf('n Process 4-1 is Constant Pressure Heat Addition by the Boiler nn');
%Taking Inputs from User.
p1=input(' Enter the Pressure at Turbine Inlet(in bar) : '); %Collecting P1 value from user.
T1=input(' Enter the Temperature at Turbine Inlet(in degC): '); %Collecting T1 value from user.
p2=input(' Enter the Pressure at Turbine Outlet(in bar) : '); %Collecting P2 value from user.
%Creating T-S curve & H-S curve.
for i=1:1000 %Defining No. of points on the curve.
temp=linspace(0,1.5*T1,1000); %Defining temperature range and total data points between them.
S_L(i)=XSteam('sL_T',temp(i)); %Collecting Saturated Fluid Entropy values within temperature range.
S_V(i)=XSteam('sV_T',temp(i)); %Collecting Saturated Gas Entropy values within temperature range.
H_L(i)=XSteam('hL_T',temp(i)); %Collecting Saturated Fluid Enthalppy values within temperature range.
H_V(i)=XSteam('hV_T',temp(i)); %Collecting Saturated Gas Enthalpy values within temperature range.
end %Ending FOR function.
%Calculating State Values at State Point 1.
s1=XSteam('s_pT',p1,T1); %Collecting Entropy value at P1.
s_l1=XSteam('sL_p',p1); %Collecting Saturated Fluid Entropy value at P1.
s_v1=XSteam('sV_p',p1); %Collecting Saturated Gas Entropy value at P1.
h_l1=XSteam('hL_p',p1); %Collecting Saturated Fluid Enthalpy value at P1.
h_v1=XSteam('hV_p',p1); %Collecting Saturated Gas Enthalpy value at P1.
T_sat1=XSteam('Tsat_p',p1); %Collecting Saturated Temperature value at P1.
X1=((s1-s_l1)/(s_v1-s_l1)); %Calculating Dryness Fraction Value.
h1=(h_l1+(X1*(h_v1-h_l1))); %Calculating Enthalpy Value at P1.
if X1>1 %Using IF condition to calculate enthalpy for dryness fraction greater than 1.
h1=XSteam('h_ps',p1,s1); %Collecting Enthalpy value by using P1 and S1 values.
end %Ending IF function.
%Calculating State Values at State Point 2.
s2=s1; %Collecting Entropy value at P2.
s_l2=XSteam('sL_p',p2); %Collecting Saturated Fluid Entropy value at P2.
s_v2=XSteam('sV_p',p2); %Collecting Saturated Gas Entropy value at P2.
h_l2=XSteam('hL_p',p2); %Collecting Saturated Fluid Enthalpy value at P2.
h_v2=XSteam('hV_p',p2); %Collecting Saturated Gas Enthalpy value at P2.
T_sat2=XSteam('Tsat_p',p2); %Collecting Saturated Temperature value at P2.
T2=XSteam('T_ps',p2,s2); %Collecting Temperature value by using P2 and S2 values.
X2=((s2-s_l2)/(s_v2-s_l2)); %Calculating Dryness Fraction Value.
h2=(h_l2+(X2*(h_v2-h_l2))); %Calculating Enthalpy Value at P2.
if X2>1 %Using IF condition to calculate enthalpy for dryness fraction greater than 1.
h2=XSteam('h_ps',p2,s2); %Collecting Enthalpy value by using P2 and S2 values.
end %Ending IF function.
%Calculating State Values at State Point 3.
p3=p2; %Collecting Pressure value at P3.
s3=XSteam('sL_p',p3); %Collecting Saturated Fluid Entropy value at P3.
T3=XSteam('Tsat_p',p3); %Collecting Saturated Temperature value at P3.
h3=XSteam('hL_p',p3); %Collecting Saturated Fluid Enthalpy value at P3.
X3=((s3-s_l2)/(s_v2-s_l2)); %Calculating Dryness Fraction Value.
%Calculating State Values at State Point 4.
p4=p1; %Collecting Pressure value at P4.
s4=s3; %Collecting Entropy value at P4.
T4=XSteam('T_ps',p4,s4); %Collecting Temperature value by using P4 and S4 values.
h4=XSteam('h_ps',p4,s4); %Collecting Enthalpy value by using P4 and S4 values.
X4=((s4-s_l1)/(s_v1-s_l1)); %Calculating Dryness Fraction Value.
%Calculating State Values at State Point 1'.
p1d=p1; %Collecting Pressure value at P1'.
T1d=T_sat1; %Collecting Temperature value at P1'.
s1d=s_v1; %Collecting Entropy value at P1'.
h1d=h_v1; %Collecting Enthalpy value at P1'.
X1d=((s1d-s_l1)/(s_v1-s_l1)); %Calculating Dryness Fraction Value.
%Calculating State Values at State Point 2'.
if X2>1 %Using IF condition to verify point lies beyond Vapour Saturated Line.
p2d=p2; %Collecting Pressure value at P2'.
T2d=T_sat2; %Collecting Temperature value at P2'.
s2d=s_v2; %Collecting Entropy value at P2'.
h2d=h_v2; %Collecting Enthalpy value at P2'.
X2d=((s2'-s_l2)/(s_v2-s_l2)); %Calculating Dryness Fraction Value.
end %Ending IF function.
%Calculating State Values at State Point 4'.
p4d=p1; %Collecting Pressure value at P4'.
T4d=T_sat1; %Collecting Temperature value at P4'.
s4d=s_l1; %Collecting Entropy value at P4'.
h4d=h_l1; %Collecting Enthalpy value at P4'.
X4d=((s4d-s_l1)/(s_v1-s_l1)); %Calculating Dryness Fraction Value.
%Calculating Rankine Cycle Results/Outputs.
H_add=h1-h4; %Calculating Heat added by the Boiler.
H_rej=h2-h3; %Calculating Heat removed by the Condenser.
W_turbine=h1-h2; %Calculating Work Output by the Turbine.
W_pump=h4-h3; %Calculating Work Input to the Pump.
N_thermal=(W_turbine-W_pump)/H_add; %Calculating Thermal Efficiency.
W_net=W_turbine-W_pump; %Calculating Net Work Output.
BWR=W_pump/W_turbine; %Calculating Back Work Ratio.
SSC=3600/W_net; %Calculating Specific Steam Consumption.
%Collecting data points to plot Process 4-1 on the graph.
for i=1:1000 %Using FOR loop to create 1000 data points.
s_4to1=linspace(s4,s1,1000); %Creating 1000 data points between S4 & S1.
t_4to1(i)=XSteam('T_ps',p4,s_4to1(i)); %Calculating 1000 data points between T4 & T1.
h_4to1(i)=XSteam('h_ps',p4,s_4to1(i)); %Calculating 1000 data points between H4 & H1.
end %Ending FOR function.
%Collecting data points to plot Process 2-3 on the graph.
for i=1:1000 %Using FOR loop to create 1000 data points.
s_2to3=linspace(s2,s3,1000); %Creating 1000 data points between S2 & S3.
t_2to3(i)=XSteam('T_ps',p3,s_2to3(i)); %Calculating 1000 data points between T2 & T3.
h_2to3(i)=XSteam('h_ps',p3,s_2to3(i)); %Calculating 1000 data points between H2 & H3.
end %Ending FOR function.
figure(1) %Plotting T-S Diagram of the Rankine Cycle.
hold on %Using hold on command to add multiple plots in a single figure.
title('T-S Diagram of the Rankine Cycle') %Adding Title to the figure
axis([0 10 0 1.25*T1]) %Defining the axis limits of the figure.
xlabel('Entropy (S) [KJ/Kg*K]') %Adding label to X-Axis.
ylabel('Temperature (T) [Deg. C]') %Adding label to Y-Axis.
plot(S_L,temp,'-','color','m') %Plotting Saturated Fluid Line.
plot(S_V,temp,'-','color','m') %Plotting Saturated Gas Line.
plot([s1 s2],[T1 T2],'linewidth',2,'color','b') %Plotting Process 1-2.
plot(s_2to3,t_2to3,'-','linewidth',2,'color','g') %Plotting Process 2-3.
plot([s3 s4],[T3 T4],'linewidth',2,'color','r') %Plotting Process 3-4.
plot(s_4to1,t_4to1,'-','linewidth',2,'color','g') %Plotting Process 4-1.
plot(s1,T1,'O','markersize',5,'markerfacecolor','r','markeredgecolor','r') %Plotting State 1 on T-S Diagram.
plot(s2,T2,'O','markersize',5,'markerfacecolor','r','markeredgecolor','b') %Plotting State 2 on T-S Diagram.
plot(s3,T3,'O','markersize',5,'markerfacecolor','b','markeredgecolor','b') %Plotting State 3 on T-S Diagram.
plot(s4,T4,'O','markersize',5,'markerfacecolor','b','markeredgecolor','r') %Plotting State 4 on T-S Diagram.
plot(s_v1,T_sat1,'O','markersize',5,'markerfacecolor','m','markeredgecolor','k') %Plotting State 1' on T-S Diagram.
plot(s_l1,T_sat1,'O','markersize',5,'markerfacecolor','m','markeredgecolor','k') %Plotting State 4' on T-S Diagram.
text(s1,T1,' 1') %Adding text on plot.
text(s2,T2,' 2') %Adding text on plot.
text(s3,T3,' 3') %Adding text on plot.
text(s4,T4,' 4') %Adding text on plot.
text(s_v1,T_sat1," 1'") %Adding text on plot.
text(s_l1,T_sat1," 4'") %Adding text on plot.
if X2>1 %Using IF condition to verify point lies beyond Vapour Saturated Line.
plot(s_v2,T_sat2,'O','markersize',5,'markerfacecolor','m','markeredgecolor','k') %Plotting State 2' on T-S Diagram.
text(s_v2,T_sat2," 2'") %Adding text on plot.
end %Ending IF function.
figure(2) %Plotting H-S Diagram of the Rankine Cycle.
hold on %Using hold on command to add multiple plots in a single figure.
title('H-S Diagram of the Rankine Cycle') %Adding Title to the figure
axis([0 10 0 1.25*h1]) %Defining the axis limits of the figure.
xlabel('Entropy (S) [KJ/Kg*K]') %Adding label to X-Axis.
ylabel('Enthalpy (H) [KJ/Kg]') %Adding label to Y-Axis.
plot(S_L,H_L,'-','color','m') %Plotting Saturated Fluid Line.
plot(S_V,H_V,'-','color','m') %Plotting Saturated Gas Line.
plot([s1 s2],[h1 h2],'linewidth',2,'color','b') %Plotting Process 1-2.
plot(s_2to3,h_2to3,'-','linewidth',2,'color','g') %Plotting Process 2-3.
plot([s3 s4],[h3 h4],'linewidth',2,'color','r') %Plotting Process 3-4.
plot(s_4to1,h_4to1,'-','linewidth',2,'color','g') %Plotting Process 4-1.
plot(s1,h1,'O','markersize',5,'markerfacecolor','r','markeredgecolor','r') %Plotting State 1 on H-S Diagram.
plot(s2,h2,'O','markersize',5,'markerfacecolor','r','markeredgecolor','b') %Plotting State 2 on H-S Diagram.
plot(s3,h3,'O','markersize',5,'markerfacecolor','b','markeredgecolor','b') %Plotting State 3 on H-S Diagram.
plot(s4,h4,'O','markersize',5,'markerfacecolor','b','markeredgecolor','r') %Plotting State 4 on H-S Diagram.
plot(s_v1,h_v1,'O','markersize',5,'markerfacecolor','m','markeredgecolor','k') %Plotting State 1' on H-S Diagram.
plot(s_l1,h_l1,'O','markersize',5,'markerfacecolor','m','markeredgecolor','k') %Plotting State 4' on H-S Diagram.
text(s1,h1,' 1') %Adding text on plot.
text(s2,h2,' 2') %Adding text on plot.
text(s3,h3,' 3') %Adding text on plot.
text(s4,h4,' 4') %Adding text on plot.
text(s_v1,h_v1," 1'") %Adding text on plot.
text(s_l1,h_l1," 4'") %Adding text on plot.
if X2>1 %Using IF condition to verify point lies beyond Vapour Saturated Line.
plot(s_v2,h_v2,'O','markersize',5,'markerfacecolor','m','markeredgecolor','k') %Plotting State 2' on H-S Diagram.
text(s_v2,h_v2," 2'") %Adding text on plot.
end %Ending IF function.
%Displaying the Results/Outputs of the given Rankine Cycle in the Command Window.
fprintf("n Results ")
fprintf("n At State point 1 | At State point 2 | At State point 3 | At State point 4 ")
fprintf("n P1 = %6.2f bar | P2 = %6.2f bar | P3 = %6.2f bar | P4 = %6.2f bar ",p1,p2,p3,p4)
fprintf("n T1 = %6.2f Deg. Celsius | T2 = %6.2f Deg. Celsius | T3 = %6.2f Deg. Celsius | T4 = %6.2f Deg. Celsius ",T1,T2,T3,T4)
fprintf("n H1 = %6.2f KJ/Kg | H2 = %6.2f KJ/Kg | H3 = %6.2f KJ/Kg | H4 = %6.2f KJ/Kg ",h1,h2,h3,h4)
fprintf("n S1 = %6.4f KJ/Kg*K | S2 = %6.4f KJ/Kg*K | S3 = %6.4f KJ/Kg*K | S4 = %6.4f KJ/Kg*K ",s1,s2,s3,s4)
fprintf("n X1 = %6.4f | X2 = %6.4f | X3 = %6.4f | X4 = %6.4f ",X1,X2,X3,X4)
fprintf("n")
if X2>1
fprintf("n At State point 1' | At State point 2' | At State point 4' ")
fprintf("n P1' = %6.2f bar | P2' = %6.2f bar | P4' = %6.2f bar ",p1d,p2d,p4d)
fprintf("n T1' = %6.2f Deg. Celsius | T2' = %6.2f Deg. Celsius | T4' = %6.2f Deg. Celsius ",T1d,T2d,T4d)
fprintf("n H1' = %6.2f KJ/Kg | H2' = %6.2f KJ/Kg | H4' = %6.2f KJ/Kg ",h1d,h2d,h4d)
fprintf("n S1' = %6.4f KJ/Kg*K | S2' = %6.4f KJ/Kg*K | S4' = %6.4f KJ/Kg*K ",s1d,s2d,s4d)
fprintf("n X1' = %6.4f | X2' = %6.4f | X4' = %6.4f ",X1d,X2d,X4d)
fprintf("n")
else
fprintf("n At State point 1' | At State point 4' ")
fprintf("n P1' = %6.2f bar | P4' = %6.2f bar ",p1d,p4d)
fprintf("n T1' = %6.2f Deg. Celsius | T4' = %6.2f Deg. Celsius ",T1d,T4d)
fprintf("n H1' = %6.2f KJ/Kg | H4' = %6.2f KJ/Kg ",h1d,h4d)
fprintf("n S1' = %6.4f KJ/Kg*K | S4' = %6.4f KJ/Kg*K ",s1d,s4d)
fprintf("n X1' = %6.4f | X4' = %6.4f ",X1d,X4d)
fprintf("n")
end
fprintf("n Rankine Cycle Results ")
fprintf("n Heat Addition through Boiler = %4.2f KJ/Kg",H_add)
fprintf("n Heat Rejection through Condenser = %4.2f KJ/Kg",H_rej)
fprintf("n Work output by Turbine = %4.2f KJ/Kg",W_turbine)
fprintf("n Work input by Pump = %4.2f KJ/Kg",W_pump)
fprintf("n Thermal Efficiency of Rankine Cycle = %4.2f Percent",N_thermal*100)
fprintf("n Net Work Output of Rankine Cycle = %4.2f KJ/Kg",W_net)
fprintf("n Back Work Ratio of Rankine Cycle = %4.2f Percent",BWR*100)
fprintf("n Specific Steam Consumption of Rankine Cycle = %4.2f KJ/KWh",SSC)
fprintf("n")
5. CONCLUSION:
6. REFERENCES:
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Week-3 Challenge: ADVISOR Tool
Introduction to HEV using MATLAB & Simulink Week-3 Challenge: ADVISOR Tool AIM: To simulate the given data and conditions for an EV using Advisor Tool in MATLAB. About ADVISOR ADVISOR, NREL’s Advanced Vehicle Simulator, is a set of model, data, and script text files for use with MATLAB and Simulink. It…
04 Jul 2022 11:04 AM IST
Project -BAJA All Terrain Vehicle (ATV) model
Simulink for Mechanical & Electrical Engineers - Challenges Final Project Aim To study, analyze and make a detailed report on BAJA All Terrain Vehicle (ATV) model using Simulink & compare between its different modes. Objective Prepare a technical report explaining the model properties & comments on the results.…
03 Jun 2021 03:25 AM IST
Week - 4
Simulink for Mechanical & Electrical Engineers Challenges = Week 4 Aim To Make a Simulink model using State-Flow for given questions. Questions & Solution Q1. Implement control logic of a “washing machine” using Stateflow as per given sequence: If the power supply is available, the system gets activated. If the Water supply…
21 May 2021 06:29 PM IST
Week -2
Simulink for Mechanical & Electrical Engineers Challenges = Week 2 Aim To Make a Simulink model of Doorbell using solenoid block. To Use a thermistor to sense the temperature of a heater & turn on or turn off the fan according to temperature. Questions & Solution Q1. Make a Simulink model of Doorbell using…
14 May 2021 12:30 AM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.