Challenge

Project 2 - Rankine cycle Simulator

AIM: MATLAB program to create simulation of rankine cycle and analyze it

OBJECTIVES:

  1. To Develop a basic program that calculates the state points of the cycle at various stages
  2. To add the thermodynamic relation to get the points inbetween the state variables.
  3. To plot rankine cycle on T-s and H-s curve for the given inputs
  4. To calculate net work ratio and back work ratio for the given cycle

THEORY:

The Rankine cycle or Rankine Vapor Cycle is the process widely used by power plants such as coal fired power plants or nuclear reactors. In this mechanism, a fuel is used to produce heat within a boiler, converting water into steam which then expands through a turbine producing useful work, its has following process involved:

  1. Process 1-2: Isentropic expansion in Turbine
  2. Process 2-3: Constant pressure Heat rejection in Condenser
  3. Process 3-4: Isentropic compression in pump
  4. Process 4-1: Constant pressure Heat addition in Boiler

GOVERNING EQUATIONS:

  • `eta_(th) = W_(n et)/q_(i n)`
  • `BWR = W_(pump)/W_(turbi n e)`
  • `q_(i n) = h_3 - h_2`
  • `q_(out) = h_4- h_1`

NOTE: The function file used for the code is available here

CODE AND STEP_WISE EXPLAINATION:

% Rankine cycle simulator
clear all;
close all;
clc
% Processes
fprintf("               RANKINE CYCLE SIMULATOR        \n")
fprintf("1-2 is isentropic expansion in the turbine\n")
fprintf("2-3 is constant pressure heat rejection by condenser\n")
fprintf("3-4 is isentropic compression in the pump\n")
fprintf("4-1 is the constant pressure head addition by boiler\n")
% taking inputs
p1 = input("enter the pressure inlet at turbine inlet: ");
t1 = input("enter the temp. at turbine inlet: ");
p2 = input("enter the pressure at conderser: ");
h1 = XSteam('h_pT',p1,t1);
s1 = XSteam('s_pT',p1,t1);
sf1 = XSteam('SL_p',p1);
ts1 = XSteam('Tsat_p',p1);
sv1 = XSteam('sV_p',p1);
% calculations
% for state point 3
p3 = p2;
h3 = XSteam('hL_P',p3);
s3 = XSteam('sL_P',p3);
v3 = XSteam('vL_P',p3);
t3 = XSteam('Tsat_P',p3);

% for state point 4
p4 = p1;
s4 = s3;
cp4 = XSteam('Cp_ps',p4,s4);
cv4 = XSteam('Cv_ps',p4,s4);
g4 = cp4/cv4;
o  =(g4-1)/g4;
W_p = v3*(p4-p3);
h4 = h3+ W_p;
% t4/t3 = (p4/p3)^o
t4 = t3*(p4/p3)^o;
% for state point 2
t2 = t3;
s2 = s1;
ts2 = XSteam('Tsat_P',p2);
sf2 = XSteam('sL_P',p2);
sg2 = XSteam('sV_P',p2);
hf2 = XSteam('hL_P',p2);
hg2 = XSteam('hV_P',p2);
sfg2 = sg2-sf2;
hfg2= hg2-hf2;
x2 = (s2-sf2)/sfg2;
h2 = hf2+x2*hfg2;
W_t = h1-h2;
W_net = W_t - W_p;
Q_in = h1-h4;
Q_out = h2-h3;
% caluclating various parameters
eff_th = W_net/Q_in;
SSC = 3600/W_t;
W_r = W_net/W_t;


% printing output
fprintf('              RESULTS           \n');
fprintf('At state point 1: \n');
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/kgk \n',s1);
fprintf('\n')

fprintf('At state point 2: \n');
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/kgk \n',s2);
fprintf(' x2 is %f \n',x2);
fprintf('\n')

fprintf('At state point 3: \n');
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/kgk \n',s3);
fprintf('\n')

fprintf('At state point 4: \n');
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/kgk \n',s4);
fprintf('\n')

fprintf('The turbine work is %f  KJ/kg\n',W_t);
fprintf('The pump work is %f  KJ/kg\n',W_p);
fprintf('The net work is %f  KJ/kg \n', W_net);
fprintf('The thermal efficiency is %f percent\n',eff_th);
fprintf('The Work ratio is is %f \n',W_r);


% plotting the graph
% creates a array of temp of given limits
temp = linspace(1,400,600); 
for i = 1:length(temp)
    % to plot the saturation curve
    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

% fot T-s Diagram
figure(1)
hold on
plot([s1, s2],[t1,t2],'k');
text(s1,t1,'1')
plot([s2, s3],[t2,t3],'k')
text(s2,t2,'2')
%plot([sg2, s3] ,[ts2, t3],'k');
plot([s3, s4] ,[t3, t4],'k');
text(s3,t3,'3')
plot([s4, sf1] ,[t4, ts1],'k')
text(s4,t4,'4')
plot([sf1, sv1] ,[ts1, ts1],'k')
plot([sv1, s1] ,[ts1, t1],'k')
plot(s_v,temp,'g--');
plot(s_l, temp,'g--');
title('T-s Diagram')
xlabel('Entropy')
ylabel('Temperature')
% h-s DIAGRAM

figure(2)
hold on
plot(s_l,h_l,'g--');
plot(s_v,h_v,'g--');
%plot(h_v,temp,'g--'); 
plot([s1 s2],[h1 h2],'k');
text(s1,h1,'1');
plot([s2 s3],[h2 h3],'k');
text(s2,h2,'2');
plot([s3 s4],[h3 h4],'k');
text(s3,h3,'3');
plot([s4 s1],[h4 h1],'k');
text(s4,h4,'4');
plot(s_l,h_l,'g--');
plot(s_v,h_v,'g--');
title('H-s Diagram');
xlabel('entropy')
ylabel('enthalpy')

OUTPUTS:

Shows the output in required format

PLOTS:

ERRORS Faced:

The most of the errors we syntax errors occured when using the function X-steam

It was rectified using manual dubugging

CONCLUSION:

  1. By this project we could simulate the ideal rankine cycle
  2. We understand the characterictics of p-v and h-s behaviour for various processes in the cycle
  3. Find out various factors responsible for thermal efficiency of the cycle and hence ways to improve it
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.