Project 2 - Rankine cycle Simulator
-
clear all close all clc % user inputs for the rankine cycle clear all close all clc % user inputs for the rankine cycle disp('rankine cycle simulator'); disp('1-2 isentropic expansion'); disp('2-3 constant pressure heat rejection by the condensor'); disp('3-4 isentropic compression in the pump'); disp('4-1 constant pressure heat addition by the boiler'); %Required Inputs: % Turbine Inlet temperature = 400° C % Turbine Inlet Pressure = 30 bars % Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure p1=input('enter presure at the turbine inlet(in bar):') t1=input('enter temperature at the turbine inlet (in degree celcius):') p2=input('enter pressure at the condensor (in bar):') % finding parameters at the inlet of turbine product of p & t h1=XSteam('h_pT',p1,t1); s1=XSteam('s_pT',p1,t1); % finding parameters at the inlet of condensor isentropic process. s2=s1; h2=XSteam('h_ps',p2,s2); %temperature t2=XSteam('T_ps',p2,s2); %saturated liquid volume vf=XSteam('vL_p',p2); % finding parameters at the exit of condensor isobaric process.p2 p3=p2 s3=XSteam('sL_p',p3) h3=XSteam('hL_p',p3) t3=XSteam('Tsat_p',p3) % constant presuure and isentropic process boiler inlet p4=p1 s4=s3 t4=XSteam('T_ps',p4,s4); h4=XSteam('h_ps',p4,s4); % printing outputs disp('-----------------RESULT------------'); fprintf(['turbine inlet state point 1: n'... ' P1 is : % 2.2f bar n'... ' T1 is : %f °C n'... ' H1 is : %f kj/kg n'... ' S1 is : %f kj/kgK n'],p1,t1,h1,s1 ) fprintf(['turbine inlet state point 2: n'... ' P2 is : % 2.2f bar n'... ' T2 is : %f °C n'... ' H2 is : %f kj/kg n'... ' S2 is : %f kj/kgK n'],p2,t2,h2,s2 ) fprintf(['turbine inlet state point 3: n'... ' P3 is : % 2.2f bar n'... ' T3 is : %f °C n'... ' H3 is : %f kj/kg n'... ' S3 is : %f kj/kgK n'],p3,t3,h3,s3) fprintf(['turbine inlet state point 4: n'... ' P4 is : % 2.2f bar n'... ' T4 is : %f °C n'... ' H4 is : %f kj/kg n'... ' S4 is : %f kj/kgK n'],p4,t4,h4,s4 ) % calculating work efficiency wt=h1-h2 % work done by turbine wp=h4-h3 % work supplied by pump heat_in=h1-h4 % heat addition in boiler heat_out=h2-h3 % heat rejected by condensor wnet=wt-wp % net woekdone efficiency=wnet/heat_in % efficiency of cycle %back work ratio bwr=wp/wt % printing all the work outputs disp(' ') fprintf(['wt is : %fkj/kgk n'... 'wp is : %f kj/kgk n'... 'back ratio is : %f n'... 'net work output is: %f kj/kgk n'... 'Q in is : %f kj/kgk n'... 'efficiency is : %f %'], wt,wp,bwr,wnet,heat_in,efficiency) % PLOTTING % PRESSURE IS CONSTANT ALONG THIS PATH s5=XSteam('sL_p',p1); t5=XSteam('tsat_p',p1); h6=XSteam('hV_p',p1); s6=XSteam('sV_p',p1); h5=XSteam('hL_p',p1); t6=t5; % SATURATED LIQUIDS % SATURATED VAPOURS % CRITICAL TEMPERATURE OF THE WATER IS 374 temperature=linspace(1,374,500); % using for loops for i=1:length(temperature) % sL_T saturated liquid entropy sL(i)=XSteam('sL_T',temperature(i)); % saturated vapour entropy sv(i)=XSteam('sV_T',temperature(i)); %saturated liquid enthalpy hL(i)=XSteam('hL_T',temperature(i)); % saturated vapour enthalpy hV(i)=XSteam('hV_T',temperature(i)); end % T-S diagram figure(1) % creating the vapour dom for T-S plot([sL,sv],[temperature,temperature],'b'); hold on %variation of entropy 4-1 isobaric process % in liquid region temp=linspace(t4,t5,500) for i=1:length(temp) % specific entropy as the function of temperature and entropy svar1(i)=XSteam('s_pT',p1,temp(i)) end temp2=linspace(t6,t1,500) for i=1:length(temp2) %specific entropy as function of pressure and temperature svar2(i)=XSteam('s_pT',p1,temp2(i)) end % plotting indicator diaagram for T-S plot([s1,s2,s3,s4],[t1,t2,t3,t4],'ro','MarkerFaceColor','r') text(s1,t1,' 1'); text(s2,t2,' 2'); text(s3,t3,' 3'); text(s4,t4,' 4'); hold on plot([s1,s2,s3,s4,svar1,s5,s6,svar2],[t1,t2,t3,t4,temp,t5,t6,temp2],'g-','linewidth',2) legend('vapour dome','state points','path') xlabel('ENTROPY') ylabel('TEMPERATURE') title('indicator diagram of T-S') % indicator diagram H-S figure(2) % creating vapour dome for h-s plot([sL,sv],[hL,hV],'b'); hold on plot([s1,s2,s3,s4],[h1,h2,h3,h4],'go','MarkerFaceColor','g'); text(s1,h1,' 1'); text(s2,h2,' 2'); text(s3,h3,' 3'); text(s4,h4,' 4'); % variation of entropy at constant pressure 2-3 savar1=0 hvar1=linspace(h2,h3,500) for i=1:length(hvar1) svar1(i)=XSteam('s_ph',p2,hvar1(i)) end % variation of entropy at constant pressure 4-5 savar2=0 hvar2=linspace(h4,h5,500) for i=1:length(hvar2) svar2(i)=XSteam('s_ph',p1,hvar2(i)) end % variation of entropy at constant pressure 5-6 savar3=0 hvar3=linspace(h6,h1,500) for i=1:length(hvar3) svar3(i)=XSteam('s_ph',p1,hvar3(i)) end %plotting plot([s1,s2,svar1,s3,s4,svar2,s5,s6,svar3],[h1,h2,hvar1,h3,h4,hvar2,h5,h6,hvar3],'r-','LineWidth',2); legend('vapour dome','state points','path') xlabel('ENTROPY') ylabel('enthalpy') title('indicator diagram of h-S') %% end disp('rankine cycle simulator'); disp('1-2 isentropic expansion'); disp('2-3 constant pressure heat rejection by the condensor'); disp('3-4 isentropic compression in the pump'); disp('4-1 constant pressure heat addition by the boiler'); p1=input('enter presure at the turbine inlet(in bar):') t1=input('enter temperature at the turbine inlet (in degree celcius):') p2=input('enter pressure at the condensor (in bar):') % finding parameters at the inlet of turbine product of p & t h1=XSteam('h_pT',p1,t1); s1=XSteam('s_pT',p1,t1); % finding parameters at the inlet of condensor isentropic process. s2=s1; h2=XSteam('h_ps',p2,s2); %temperature t2=XSteam('T_ps',p2,s2); %saturated liquid volume vf=XSteam('vL_p',p2); % finding parameters at the exit of condensor isobaric process.p2 p3=p2 s3=XSteam('sL_p',p3) h3=XSteam('hL_p',p3) t3=XSteam('Tsat_p',p3) % constant presuure and isentropic process boiler inlet p4=p1 s4=s3 t4=XSteam('T_ps',p4,s4); h4=XSteam('h_ps',p4,s4); % printing outputs disp('-----------------RESULT------------'); fprintf(['turbine inlet state point 1: n'... ' P1 is : % 2.2f bar n'... ' T1 is : %f °C n'... ' H1 is : %f kj/kg n'... ' S1 is : %f kj/kgK n'],p1,t1,h1,s1 ) fprintf(['turbine inlet state point 2: n'... ' P2 is : % 2.2f bar n'... ' T2 is : %f °C n'... ' H2 is : %f kj/kg n'... ' S2 is : %f kj/kgK n'],p2,t2,h2,s2 ) fprintf(['turbine inlet state point 3: n'... ' P3 is : % 2.2f bar n'... ' T3 is : %f °C n'... ' H3 is : %f kj/kg n'... ' S3 is : %f kj/kgK n'],p3,t3,h3,s3) fprintf(['turbine inlet state point 4: n'... ' P4 is : % 2.2f bar n'... ' T4 is : %f °C n'... ' H4 is : %f kj/kg n'... ' S4 is : %f kj/kgK n'],p4,t4,h4,s4 ) % calculating work efficiency wt=h1-h2 % work done by turbine wp=h4-h3 % work supplied by pump heat_in=h1-h4 % heat addition in boiler heat_out=h2-h3 % heat rejected by condensor wnet=wt-wp % net woekdone efficiency=wnet/heat_in % efficiency of cycle %back work ratio bwr=wp/wt % printing all the work outputs disp(' ') fprintf(['wt is : %fkj/kgk n'... 'wp is : %f kj/kgk n'... 'back ratio is : %f n'... 'net work output is: %f kj/kgk n'... 'Q in is : %f kj/kgk n'... 'efficiency is : %f %'], wt,wp,bwr,wnet,heat_in,efficiency) % PLOTTING % PRESSURE IS CONSTANT ALONG THIS PATH s5=XSteam('sL_p',p1); t5=XSteam('tsat_p',p1); h6=XSteam('hV_p',p1); s6=XSteam('sV_p',p1); h5=XSteam('hL_p',p1); t6=t5; % SATURATED LIQUIDS % SATURATED VAPOURS % CRITICAL TEMPERATURE OF THE WATER IS 374 temperature=linspace(1,374,500); % using for loops for i=1:length(temperature) % sL_T saturated liquid entropy sL(i)=XSteam('sL_T',temperature(i)); % saturated vapour entropy sv(i)=XSteam('sV_T',temperature(i)); %saturated liquid enthalpy hL(i)=XSteam('hL_T',temperature(i)); % saturated vapour enthalpy hV(i)=XSteam('hV_T',temperature(i)); end % T-S diagram figure(1) % creating the vapour dom for T-S plot([sL,sv],[temperature,temperature],'b'); hold on %variation of entropy 4-1 isobaric process % in liquid region temp=linspace(t4,t5,500) for i=1:length(temp) % specific entropy as the function of temperature and entropy svar1(i)=XSteam('s_pT',p1,temp(i)) end temp2=linspace(t6,t1,500) for i=1:length(temp2) %specific entropy as function of pressure and temperature svar2(i)=XSteam('s_pT',p1,temp2(i)) end % plotting indicator diaagram for T-S plot([s1,s2,s3,s4],[t1,t2,t3,t4],'ro','MarkerFaceColor','r') text(s1,t1,' 1'); text(s2,t2,' 2'); text(s3,t3,' 3'); text(s4,t4,' 4'); hold on plot([s1,s2,s3,s4,svar1,s5,s6,svar2],[t1,t2,t3,t4,temp,t5,t6,temp2],'g-','linewidth',2) legend('vapour dome','state points','path') xlabel('ENTROPY') ylabel('TEMPERATURE') title('indicator diagram of T-S') % indicator diagram H-S figure(2) % creating vapour dome for h-s plot([sL,sv],[hL,hV],'b'); hold on plot([s1,s2,s3,s4],[h1,h2,h3,h4],'go','MarkerFaceColor','g'); text(s1,h1,' 1'); text(s2,h2,' 2'); text(s3,h3,' 3'); text(s4,h4,' 4'); % variation of entropy at constant pressure 2-3 savar1=0 hvar1=linspace(h2,h3,500) for i=1:length(hvar1) svar1(i)=XSteam('s_ph',p2,hvar1(i)) end % variation of entropy at constant pressure 4-5 savar2=0 hvar2=linspace(h4,h5,500) for i=1:length(hvar2) svar2(i)=XSteam('s_ph',p1,hvar2(i)) end % variation of entropy at constant pressure 5-6 savar3=0 hvar3=linspace(h6,h1,500) for i=1:length(hvar3) svar3(i)=XSteam('s_ph',p1,hvar3(i)) end %plotting plot([s1,s2,svar1,s3,s4,svar2,s5,s6,svar3],[h1,h2,hvar1,h3,h4,hvar2,h5,h6,hvar3],'r-','LineWidth',2); legend('vapour dome','state points','path') xlabel('ENTROPY') ylabel('enthalpy') title('indicator diagram of h-S') %% end
used Inputs for rankine cycle :
Turbine Inlet temperature = 400° C
Turbine Inlet Pressure = 30 bars
Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure
EXPLANATION TO THE CODE:
- Using fprintf or disp print the processes involved in the ranking cycle. using input display the prompt at command to get initial values.
- Read the XSteam.m code carefully and use it to obtain the value of thermodynamic properties at different states. . We need at least 2independent, insensitive properties to define any state. During phase changes, the temperature remains constant.
- Display the outputs of computed thermodynamic properties of each state.
- Calculate the efficiency, net work, back work ratio and display it in the command window.
- To create a vapour dome make use the fact that the critical temperature of the water is 373.946-degree centigrade.
- compute the variation of entropy during the isobaric process and plot the T-S and H-S indicator diagrams.
- My states 3 and 4 are mixed up because in the 3 to 4 process entropy remains constant and my temperatures T3 and T4 a same which means that pump work is very small.