Challenge

Project 2 - Rankine cycle Simulator

Explanation of the code:

  • satring  with clear all and close all and clc commande earse all the previous data.
  • After that giving the inputs as mensioned the queation i.e p1,t1and p2
  • Ater that extracting the XSteam data file for water properties and temperture and sat vapour condition.
  • Withe these inputs  inlet and Xsteam data  calculate the  all points  sates if the rankine cycle.
  • sf,sg ,hf and hg where f and g stands  saturated  liquid  and satureted vapours.
  • The net work and work done by turbine and work done by the pump  are calulated using the thermodynamic relations.
  • Efficiency and specific steam consuption are calculated.
  • T,S and H are extracted at vapour and liquid line for plot.
  • saturation curve is plottedfor saturated liquis and saturated gas.
  • plot T vs S  and h vs s is created from all the points obtained from the program.
  • The plots changes are the user inputs changed for the above menstioned inputs.
  • Results are displayed in the command window 

code for the rankine cycle cimulator

clear all

close all

clc

 disp('rankine cycl simulator');

disp('1-2 isentropic expansion in turbine');

disp('2-3 isobaric heat rejection  in turbine');

disp('3-4 isentropic compression in pump');

disp(('4-1 isobraic  heat addition in boiler');

% inputs 

% turbine inlet pressure in bar

p1 = 30; 

%turbine inlet temperture in degree

t1 = 420;

% condenser pressure in bar

p2 =  0.05;

% inputs of the turbine 

s1 = XSteam('s_pT',p1,t1);

h1 = xSteam('h_pT',p1,t1);

% inputs of the condenser

s2 = s1;

t2 = XSteam('Tsat_p',p1);

sf2 = XSteam('sL_pT',p1,t1);

sg2 = XSteam('sV_p',p2);

hf2 = XSteam('hL_p',p2);

hg2 = XSteam('hV_p',p2);

x2 = ((s2-sf2)/(sg2-sf2));

h2 = hf2+(x2*(hg2-hf2));

% exit of the condenser

p3 = p2;

t3 = t2;

s3 = XSteam('sL_T',t3);

h3 = XSteam(h_ps',p3,s3);

% inputs to the boiler

p4 = p1;

s4 = s3;

h4 = XSteam('h_ps',p4,s4);

cp4 =XSteam('cpL_p',p3);

cv4 = XSteam('cvL_p',p3);

gamma = (cp4/cv4);

% to calculate t4

% p4^(1-gamma)*t4^gamma = p3^(1-gamma)*t3^gamma

t4 = (t3*(p3/p4)^((1-gamma)/gamma)));

 % calculation

% work done by turbine

wt = h1 - h2;

% work done by the pump

wp = h4 - h3;

% net work done

W_net = wt - wp;

% heat injected in the boiler

q_in = h1 - h4;

% heat rejected in condenser

q_ out = h2 - h3;

% thermal effiency

n = w_net /q_in;

np = n*100;

% plot for liquid and vapour saturation curve

t = linspace (0,550,600);

for i 1: length(t)

s_l(i) = XSteam(sL_T',t(i));

end

for i = 1: length(t)

s_v(i) = xSteam ('sV_T',t(i));

end

plot(s_l,t,'--','color','b')

hold on

plot(s_v,t,'--','color','b')

grid on

% plot for work done y turbine

plot([s1,s2],[t1,t2],'color','r')

hold on

title ('T-S digram is ideal rankine cycle')

xlabel('entropy')

ylabel('temp')

% plot for  work done by turbine

plot([s3,s4],[t2,t3],'color','b')

hold on

% plot for heat rejected in condenser

tp =XSteam (Tsat_p',p4);

sp = XSteam('sL_T',tp);

plot([s4,sp],[t4,tp],'color','M')

hold on 

tq = tp;

sq = XSteam('sV_T',tq);

plot([sp,sq],[tp,tq],'color','M')

hold on

plot([sq,sp],[tq,t1],'color','M')

hold on

% indicates states with numbers

text(s1,t1,'1');

text(s2,t2,'1');

text(s3,t3,'1');

text(s4,t4,'1');

% plot for enthalpy

figure (2)

plot([s1,s2],[h1,h2],'color','b')

grid on

title('H-S digram is ideal rankine cycle')

xlabel('entropthy')

ylabel('enthalpy')

hold on

plot([s2,s3],[h2,h3],'color','b')

hold on

plot([s3,s4],[h3,h4],'color','g')

hold on

plot([s4,s1],[h4,h1],'color','m')

hold on

% plot for liquid and vapour saturation

t = linspace(0,550,600);

for j = 1: length(t)

h_l(j) = XSteam (hV_T'),t(j));

end

for j = 1: length(t)

h_v(j) = XSteam('hV_t',t(j));

end

plot (s_l,h_l,'--','color','b')

hold on

plot(s_v,h_v,'--','color','b')

text(s1,h1,'1');

text(s2,h2,'1');

text(s3,h3,'1');

text(s4,h4,'1');

% results ouputs

fprintf('n n%10s %54s n','state1','state2');

fprintf('%s %6.3f%s %44s %.3f%s n','P1:',p1,'bar','P2:','p2','bar');

fprintf('%s %.3f%s %35s %.3f%s n','T1:',t1,'deg celecius','T2:',t2,'deg celcuis');

fprint('%s %8.3f%s %40s %.3f%s n','H1:',h1,'kj/kg','H2:',h2,'kj/kg');

fprint ('%s %.3f%s %42s %.3f%s n n n','S1:',s1,'kj/kg','s2:',s2,'kj/kg') 

fprintf('%10s %54s n','state3','state4');

fprintf('%s %6.3f%s %44s %.3f%s n','P3:',p3,'bar','P4:','p4','bar');

fprintf('%s %.3f%s %35s %.3f%s n','T3:',t3,'deg celecius','T4:',t4,'deg celcuis');

fprint('%s %8.3f%s %40s %.3f%s n','H3:',h3,'kj/kg','H4:',h4,'kj/kg');

fprint ('%s %.3f%s %42s %.3f%s n n n','S3:',s3,'kj/kg','S4:',s4,'kj/kg')

fprintf('%40s %.3f %s n','work output by turbine',wt,'kj/kg');

fprintf('%40s %.3f %s n','work output by pump',wp,'kj/kg');

fprintf('%40s %.3f %s  n','net work:',w_net,'kj/kg);

fprint('%40s %.3f %s  n','heat input in bolier:'q_in,'kj/kg');

fprint ('%40s %.3f %s  n','heat rejected in condenser:',q_out,'kj/kg');

 Explanation for  working of the rankine cycle:

The rankine cycle  or rankine vapour cycle is the fundamental operating cycle  of all the power palnts  where  an operating  fluids  is continuosly evaporated and condensed. The selection of operating fluids  depends mainly on the availble  temperture ranges

The pressure- enthalpy (p-H) and tenperture and entropy(T-S) diagrams

The rankine cycle operates   in the folllowing steps

1-2-3 isobaric transfer : high pressure liquids enters in the bolier  from the  feed pump  and heated to the saturation temperture .The addition of energy cacus evaportion of the liquid until it is fully converted into saturated steam.

3-4 isentropic expansion : The vapour is expand in the  turbine ,thus producing  work which may be converted  to electricity. The expansion is limited by the temperture  of the cooling medium and by the  erosion of the turbine blades  by the liquid entres  in the vapour streamas move further into the phases region.

4-5 isobaric heat rejection: The vapour  liquid mixture leaving the turbine is condensed at low pressure in the surface condensser using the cooling water and maintened condenser.The pressure of the vapouris well the atmospheric pressure,approching  the saturation pressure of the opertaing fluid at the cooling water temperture.

5-1 isentropic compression : The pressure of the condensate is rasied in the feed pump. because  of low specific  volume of liquid, the pump work iss relectively small often neglected in thernodynamic 

 

Error 

some typo errors obtained corrected by checking the spelling  corrected all the errors and no errore aobtained

 Result of the code 

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.