function [W_total,eta_total]=pfcspencer(A,B,D,F,G,A_an,tbomba,m_vvmax,p_3,p_4f,p_escip,T_3,T_5,p_8,PF,J,Genmax1,Genmax2) %Todo lo que el programa saca está en SI (aunque hay entradas que estan en sistema británico) %A=Tipo de cuerpo hp %B=Tipo de cuerpo ip-lp %D=Pitch diameter hp (inch) %F=Nº valvulas %G=Pitch diameter lp (diametro de paso) (inch) %A_an=Área anular total de salida de la turbina de baja (ft^2) %tbomba=1 si se usa una turbobomba; cualquier otro numero en caso de bomba electrica %TFratio=m_vv/m_vvmax; %throttle flow (percenteage) %PF=factor de potencia a la que trabaja el/los generador/es %J=tipo de generador (1 si es un solo generador convencional a 3600 rpm; 2 %es igual que 1 pero generador enfriado por conductor; 3 si es un generador convencional para %el de alta a 3600rpm y otro para media y baja a 1800 rpm; 4 es igual que 3 pero con generadores %enfriados por conductor; 5 es un generador convencional para alta y media a 3600rpm %y uno para baja a 1800rpm; 6 es lo mismo que 5 pero refrigerado por conductor) %Genmax1 y Genmax2 es la potencia aparente máxima que pueden dar los %generadores. Para casos 1 y 2 Genmax2=0 %para cambiar la configuración de los precalentadores, ir a los bucles de %las extracciones (p. ej: para extraccion 7 lin. 692 y 1014) y eliminar dicho %bucle o añadir uno nuevo. También hay que eliminar o añadir las referencias a dicho %precalentador (p. ej: para precalentador 7 lin. 678 y siguientes y 1100 y %siguientes) N=10; M=N/2; for k=M:N m=N-(k-M); TFratio=m/N m_vv(m)=TFratio*m_vvmax; m_mu=0.02*m_vv(m); p_govhp=(8.26205534E-01+8.55184440E-05*m_vv(m)+5.66588017E-12*m_vv(m)^2)*p_3/165; DTT=5; DC=10; %datos y estimaciones de entrada y salida al cuerpo de hp h_3=XSteam('h_pT',p_3,T_3); s_3=XSteam('s_pT',p_3,T_3); v_3=XSteam('v_pT',p_3,T_3); p_4=(m/N)*p_4f; p_iv=0.9*p_4; v_5=XSteam('v_pT',0.9*p_4f,T_5); m_rec(m)=0.9*m_vv(m); %estimacion de rendimiento de cada cuerpo por Spencer if A == 1 etabase=89.48; C_vol=-12183.6/(m_vv(m)*v_3)*etabase/100; vol_flow=m_vv(m)*v_3; PressRat=p_govhp/p_3; if vol_flow <= 2831.7 C_govpress100=-5.99831138E+00+2.58999329E+01*PressRat-2.60436217E+01*PressRat^2; C_govpress=C_govpress100; end if vol_flow > 2831.7 && vol_flow <= 5663.4 C_govpress100=-5.99831138E+00+2.58999329E+01*PressRat-2.60436217E+01*PressRat^2; C_govpress200=-8.31662877E+00+2.92715528E+01*PressRat-2.55082004E+01*PressRat^2; C_govpress=(C_govpress100*(5663.4-vol_flow)+C_govpress200*(vol_flow-2831.7))/(5663.4-2831.7); end if vol_flow > 5663.4 C_govpress200=-8.31662877E+00+2.92715528E+01*PressRat-2.55082004E+01*PressRat^2; C_govpressinf=-1.00641709E+01+3.10452825E+01*PressRat-2.38728805E+01*PressRat^2; C_govpress=(C_govpress200*(5*5663.4-vol_flow)+C_govpressinf*(vol_flow-5663.4))/(4*5663.4); end if T_3 <= 260 C_inic260=-1.07394647E+00-4.04038684E-01*p_3+1.17906780E-02*p_3^2-1.49979279E-04*p_3^3; C_condinic=C_inic260; end if T_3 > 260 && T_3<= 315 C_inic260=-1.07394647E+00-4.04038684E-01*p_3+1.17906780E-02*p_3^2-1.49979279E-04*p_3^3; C_inic315=-2.25362260E-01-2.63291673E-01*p_3+4.97835469E-03*p_3^2-3.96358532E-05*p_3^3; C_condinic=(C_inic260*(315-T_3)+C_inic315*(T_3-260))/(315-260); end if T_3 > 315 && T_3<= 371 C_inic315=-2.25362260E-01-2.63291673E-01*p_3+4.97835469E-03*p_3^2-3.96358532E-05*p_3^3; C_inic371=1.19989169E+00-4.30393344E-01*p_3+2.33994125E-02*p_3^2-7.30931534E-04*p_3^3+1.18514262E-05*p_3^4-9.46369174E-08*p_3^5+2.93186478E-10*p_3^6; C_condinic=(C_inic315*(371-T_3)+C_inic371*(T_3-315))/(371-315); end if T_3 > 371 && T_3<= 427 C_inic371=1.19989169E+00-4.30393344E-01*p_3+2.33994125E-02*p_3^2-7.30931534E-04*p_3^3+1.18514262E-05*p_3^4-9.46369174E-08*p_3^5+2.93186478E-10*p_3^6; C_inic427=1.32849721E+00-2.21331782E-01*p_3+7.15588072E-03*p_3^2-1.43702098E-04*p_3^3+1.54079426E-06*p_3^4-8.32089233E-09*p_3^5+1.77956003E-11*p_3^6; C_condinic=(C_inic371*(427-T_3)+C_inic427*(T_3-371))/(421-371); end if T_3 > 427 && T_3<= 482 C_inic427=1.32849721E+00-2.21331782E-01*p_3+7.15588072E-03*p_3^2-1.43702098E-04*p_3^3+1.54079426E-06*p_3^4-8.32089233E-09*p_3^5+1.77956003E-11*p_3^6; C_inic482=1.43072861E+00-8.42168448E-02*p_3-3.45572241E-05*p_3^2+3.38851765E-05*p_3^3-6.22432913E-07*p_3^4+4.41354692E-09*p_3^5-1.11237485E-11*p_3^6; C_condinic=(C_inic427*(482-T_3)+C_inic482*(T_3-427))/(482-427); end if T_3 > 482 && T_3<= 538 C_inic482=1.43072861E+00-8.42168448E-02*p_3-3.45572241E-05*p_3^2+3.38851765E-05*p_3^3-6.22432913E-07*p_3^4+4.41354692E-09*p_3^5-1.11237485E-11*p_3^6; C_inic538=1.27870464E+00+6.06624753E-02*p_3-7.47590558E-03*p_3^2+2.10224611E-04*p_3^3-2.68634192E-06*p_3^4+1.61032976E-08*p_3^5-3.67106408E-11*p_3^6; C_condinic=(C_inic482*(538-T_3)+C_inic538*(T_3-482))/(538-482); end if T_3 > 538 && T_3<= 593 C_inic538=1.27870464E+00+6.06624753E-02*p_3-7.47590558E-03*p_3^2+2.10224611E-04*p_3^3-2.68634192E-06*p_3^4+1.61032976E-08*p_3^5-3.67106408E-11*p_3^6; C_inic593=1.04488167E+00+1.91562726E-01*p_3-1.39841763E-02*p_3^2+3.60798652E-04*p_3^3-4.42383805E-06*p_3^4+2.58768543E-08*p_3^5-5.80801196E-11*p_3^6; C_condinic=(C_inic538*(593-T_3)+C_inic593*(T_3-538))/(593-538); end if T_3 > 593 && T_3<= 649 C_inic593=1.04488167E+00+1.91562726E-01*p_3-1.39841763E-02*p_3^2+3.60798652E-04*p_3^3-4.42383805E-06*p_3^4+2.58768543E-08*p_3^5-5.80801196E-11*p_3^6; C_inic649=8.11405785E-01+3.01607227E-01*p_3-1.90808631E-02*p_3^2+4.73204560E-04*p_3^3-5.68144670E-06*p_3^4+3.27897021E-08*p_3^5-7.28894006E-11*p_3^6; C_condinic=(C_inic593*(649-T_3)+C_inic649*(T_3-593))/(649-593); end if T_3 > 649 && T_3<= 704 C_inic649=8.11405785E-01+3.01607227E-01*p_3-1.90808631E-02*p_3^2+4.73204560E-04*p_3^3-5.68144670E-06*p_3^4+3.27897021E-08*p_3^5-7.28894006E-11*p_3^6; C_inic704=6.67287615E-01+3.59749277E-01*p_3-2.10483798E-02*p_3^2+5.08019685E-04*p_3^3-6.01151485E-06*p_3^4+3.43956762E-08*p_3^5-7.60498694E-11*p_3^6; C_condinic=(C_inic649*(704-T_3)+C_inic704*(T_3-649))/(704-649); end if T_3 > 704 && T_3<= 760 C_inic704=6.67287615E-01+3.59749277E-01*p_3-2.10483798E-02*p_3^2+5.08019685E-04*p_3^3-6.01151485E-06*p_3^4+3.43956762E-08*p_3^5-7.60498694E-11*p_3^6; C_inic760=5.94326739E-01+3.81306786E-01*p_3-2.05423162E-02*p_3^2+4.75918525E-04*p_3^3-5.48212185E-06*p_3^4+3.07550380E-08*p_3^5-6.69649101E-11*p_3^6; C_condinic=(C_inic704*(760-T_3)+C_inic760*(T_3-704))/(760-704); end PressRatnew=PressRat^-1; if PressRatnew <= 1.2 C_partload12=5.27000000E+00-1.13988095E+01*TFratio+1.60267857E+01*TFratio^2-9.89583333E+00*TFratio^3; C_govpartload=C_partload12; end if PressRatnew > 1.2 && PressRatnew <= 1.3 C_partload12=5.27000000E+00-1.13988095E+01*TFratio+1.60267857E+01*TFratio^2-9.89583333E+00*TFratio^3; C_partload13=3.57000000E+00-8.30357143E+00*TFratio+1.09821428E+01*TFratio^2-6.25000000E+00*TFratio^3; C_govpartload=(C_partload12*(1.3-PressRatnew)+C_partload13*(PressRatnew-1.2))/(1.3-1.2); end if PressRatnew > 1.3 && PressRatnew <= 1.4 C_partload13=3.57000000E+00-8.30357143E+00*TFratio+1.09821428E+01*TFratio^2-6.25000000E+00*TFratio^3; C_partload14=2.16000000E+00-5.25595238E+00*TFratio+6.74107143E+00*TFratio^2-3.64583333E+00*TFratio^3; C_govpartload=(C_partload13*(1.4-PressRatnew)+C_partload14*(PressRatnew-1.3))/(1.4-1.3); end if PressRatnew > 1.4 && PressRatnew <= 1.5 C_partload14=3.57000000E+00-8.30357143E+00*TFratio+1.09821428E+01*TFratio^2-6.25000000E+00*TFratio^3; C_partload15=2.16000000E+00-5.25595238E+00*TFratio+6.74107143E+00*TFratio^2-3.64583333E+00*TFratio^3; C_govpartload=(C_partload14*(1.5-PressRatnew)+C_partload15*(PressRatnew-1.4))/(1.5-1.4); end if PressRatnew > 1.5 && PressRatnew <= 1.6 C_partload15=9.30000000E-01-2.02976190E+00*TFratio+2.14285714E+00*TFratio^2-1.04166667E+00*TFratio^3; C_partload16=0; C_govpartload=(C_partload15*(1.6-PressRatnew)+C_partload16*(PressRatnew-1.5))/(1.6-1.5); end if PressRatnew > 1.6 && PressRatnew <= 1.7 C_partload16=0; C_partload17=-8.40000000E-01+1.70238095E+00*TFratio-1.38392857E+00*TFratio^2+5.20833333E-01*TFratio^3; C_govpartload=(C_partload16*(1.7-PressRatnew)+C_partload17*(PressRatnew-1.6))/(1.7-1.6); end if PressRatnew > 1.7 && PressRatnew <= 1.8 C_partload17=-8.40000000E-01+1.70238095E+00*TFratio-1.38392857E+00*TFratio^2+5.20833333E-01*TFratio^3; C_partload18=-1.66000000E+00+3.71428571E+00*TFratio-3.61607143E+00*TFratio^2+1.56250000E+00*TFratio^3; C_govpartload=(C_partload17*(1.8-PressRatnew)+C_partload18*(PressRatnew-1.7))/(1.8-1.7); end if PressRatnew > 1.8 && PressRatnew <= 1.9 C_partload18=-1.66000000E+00+3.71428571E+00*TFratio-3.61607143E+00*TFratio^2+1.56250000E+00*TFratio^3; C_partload19=-2.52000000E+00+5.94047619E+00*TFratio-6.02678571E+00*TFratio^2+2.60416667E+00*TFratio^3; C_govpartload=(C_partload18*(1.9-PressRatnew)+C_partload19*(PressRatnew-1.8))/(1.9-1.8); end if PressRatnew > 1.9 && PressRatnew <= 2 C_partload19=-2.52000000E+00+5.94047619E+00*TFratio-6.02678571E+00*TFratio^2+2.60416667E+00*TFratio^3; C_partload20=-2.83000000E+00+4.42857143E+00*TFratio-1.60714286E+00*TFratio^2+4.81836793E-13*TFratio^3; C_govpartload=(C_partload19*(2-PressRatnew)+C_partload20*(PressRatnew-1.9))/(2-1.9); end if PressRatnew > 2 C_partload20=-2.83000000E+00+4.42857143E+00*TFratio-1.60714286E+00*TFratio^2+4.81836793E-13*TFratio^3; C_govpartload=C_partload20; end C_partload=-1.58912387E+01+3.76895871E+01*TFratio-2.18267504E+01*TFratio^2; C_meanloop=-1.59000000E+00+2.18035714E+00*TFratio-8.48214286E-01*TFratio^2; etahp=etabase*(1 + C_vol/100); etahp=etahp*(1+C_govpress/100); etahp=etahp*(1+C_condinic/100); etahp=etahp*(1+C_govpartload/100); etahp=etahp*(1+C_partload/100); etahp=etahp*(1+C_meanloop/100); etahp1(m)=etahp; end if A == 2 etabase=87.00; C_vol=-28464.1/(m_vv(m)*v_3)*etabase/100; Pitchdiameter=D; C_diam=4.33200000E+00-1.14000000E-01*Pitchdiameter; vol_flow=m_vv(m)*v_3; vol_flowd=m_vvmax*v_3; PressRat=p_4f/p_3; if vol_flowd <= 5663.4 C_press200=5.01428571E+00-2.84423963E+01*PressRat; C_press=C_press200; end if vol_flowd > 5663.4 && vol_flowd <= 16990.1 C_press200=5.01428571E+00-2.84423963E+01*PressRat; C_press600=4.50000000E+00-2.54193548E+01*PressRat; C_press=(C_press200*(16990.1-vol_flow)+C_press600*(vol_flow-5663.4))/(16990.1-5663.4); end if vol_flowd > 16990.1 && vol_flowd <= 28316.9 C_press600=4.50000000E+00-2.54193548E+01*PressRat; C_press1000=4.16428571E+00-2.37327189E+01*PressRat; C_press=(C_press600*(28316.9-vol_flow)+C_press1000*(vol_flow-16990.1))/(28316.9-16990.1); end if vol_flowd > 28316.9 && vol_flowd <= 56633.7 C_press1000=4.16428571E+00-2.37327189E+01*PressRat; C_press2000=3.87142857E+00-2.19539171E+01*PressRat; C_press=(C_press1000*(56633.7-vol_flow)+C_press2000*(vol_flow-28316.9))/(56633.7-28316.9); end if vol_flowd > 56633.7 && vol_flowd <= 113267.4 C_press2000=3.87142857E+00-2.19539171E+01*PressRat; C_press4000=3.57857143E+00-2.01751152E+01*PressRat; C_press=(C_press2000*(113267.4-vol_flow)+C_press4000*(vol_flow-56633.7))/(113267.4-56633.7); end if vol_flowd > 113267.4 C_press4000=3.57857143E+00-2.01751152E+01*PressRat; C_press=C_press4000; end if Pitchdiameter <= 30 C_govpartload30=-4.56083333E+00+4.56250000E+00*TFratio; C_govpartload=C_govpartload30; end if Pitchdiameter > 30 && Pitchdiameter <= 34 C_govpartload30=-4.56083333E+00+4.56250000E+00*TFratio; C_govpartload34=-2.25000000E+00+2.25000000E+00*TFratio; C_govpartload=(C_govpartload30*(30-Pitchdiameter)+C_govpartload34*(Pitchdiameter-30))/(34-30); end if Pitchdiameter > 34 && Pitchdiameter <= 38 C_govpartload34=-2.25000000E+00+2.25000000E+00*TFratio; C_govpartload38=0; C_govpartload=(C_govpartload34*(38-Pitchdiameter)+C_govpartload38*(Pitchdiameter-34))/(38-34); end if Pitchdiameter > 34 && Pitchdiameter <= 38 C_govpartload34=-2.25000000E+00+2.25000000E+00*TFratio; C_govpartload38=0; C_govpartload=(C_govpartload34*(38-Pitchdiameter)+C_govpartload38*(Pitchdiameter-34))/(38-34); end if Pitchdiameter > 38 && Pitchdiameter <= 42 C_govpartload38=0; C_govpartload42=2.25000000E+00-2.25000000E+00*TFratio; C_govpartload=(C_govpartload38*(42-Pitchdiameter)+C_govpartload42*(Pitchdiameter-38))/(42-38); end if Pitchdiameter > 42 && Pitchdiameter <= 46 C_govpartload42=2.25000000E+00-2.25000000E+00*TFratio; C_govpartload46=4.56083333E+00-4.56250000E+00*TFratio; C_govpartload=(C_govpartload42*(46-Pitchdiameter)+C_govpartload46*(Pitchdiameter-42))/(46-42); end if Pitchdiameter > 46 C_govpartload46=4.56083333E+00-4.56250000E+00*TFratio; C_govpartload=C_govpartload46; end PressRatHP=p_3/p_4; if PressRatHP <= 2 C_partload2=5.30760868E+01-8.49582917E+01*TFratio+3.13889756E+01*TFratio^2; C_partload=C_partload2; end if PressRatHP > 2 && PressRatHP <= 3 C_partload2=5.30760868E+01-8.49582917E+01*TFratio+3.13889756E+01*TFratio^2; C_partload3=4.58037758E+01-7.55329013E+01*TFratio+2.92543723E+01*TFratio^2; C_partload=(C_partload2*(3-PressRatHP)+C_partload3*(PressRatHP-2))/(3-2); end if PressRatHP > 3 && PressRatHP <= 4 C_partload3=4.58037758E+01-7.55329013E+01*TFratio+2.92543723E+01*TFratio^2; C_partload4=4.07087726E+01-6.86486102E+01*TFratio+2.74508120E+01*TFratio^2; C_partload=(C_partload3*(4-PressRatHP)+C_partload4*(PressRatHP-3))/(4-3); end if PressRatHP > 4 && PressRatHP <= 5 C_partload4=4.07087726E+01-6.86486102E+01*TFratio+2.74508120E+01*TFratio^2; C_partload5=3.68665709E+01-6.44984072E+01*TFratio+2.71908182E+01*TFratio^2; C_partload=(C_partload4*(5-PressRatHP)+C_partload5*(PressRatHP-4))/(5-4); end if PressRatHP > 5 && PressRatHP <= 6 C_partload5=3.68665709E+01-6.44984072E+01*TFratio+2.71908182E+01*TFratio^2; C_partload6=3.34357589E+01-5.96327295E+01*TFratio+2.57651468E+01*TFratio^2; C_partload=(C_partload5*(6-PressRatHP)+C_partload6*(PressRatHP-5))/(6-5); end if PressRatHP > 6 C_partload6=3.34357589E+01-5.96327295E+01*TFratio+2.57651468E+01*TFratio^2; C_partload=C_partload6; end Numbervalves=F; if Numbervalves <= 4 C_meanloop4=3.58378378E+00-2.92567568E+00*TFratio; C_meanloop=C_meanloop4; end if Numbervalves == 6 C_meanloop6=2.64459459E+00-2.14189189E+00*TFratio; C_meanloop=C_meanloop6; end if Numbervalves >= 8 C_meanloop8=1.78378378E+00-1.42567568E+00*TFratio; C_meanloop=C_meanloop8; end etahp=etabase*(1 + C_vol/100); etahp=etahp*(1+C_diam/100); etahp=etahp*(1+C_press/100); etahp=etahp*(1+C_govpartload/100); etahp=etahp*(1-C_partload/100); etahp=etahp*(1-C_meanloop/100); etahp1(m)=etahp; end if A == 3 etabase=84; C_vol=-38227.8/(m_vv(m)*v_3)*etabase/100; vol_flow=m_vv(m)*v_3; vol_flowd=m_vvmax*v_3; PressRatHP=p_4f/p_3; PressRatHPnew=PressRatHP^-1; if vol_flowd <= 5663.4 C_press200=9.36560970E+00-5.29266817E+01*Pressratio; C_press=C_press200; end if vol_flowd > 5663.4 && vol_flowd <= 16990.1 C_press200=9.36560970E+00-5.29266817E+01*Pressratio; C_press600=8.93100490E+00-5.02634619E+01*Pressratio; C_press=(C_press200*(16990.1-vol_flow)+C_press600*(vol_flow-5663.4))/(16990.1-5663.4); end if vol_flowd > 16990.1 && vol_flowd <= 28316.9 C_press600=8.93100490E+00-5.02634619E+01*Pressratio; C_press1000=8.51382762E+00-4.80259612E+01*Pressratio; C_press=(C_press600*(28316.9-vol_flow)+C_press1000*(vol_flow-16990.1))/(28316.9-16990.1); end if vol_flowd > 28316.9 && vol_flowd <= 56633.7 C_press1000=8.51382762E+00-4.80259612E+01*Pressratio; C_press2000=8.00007150E+00-4.51966338E+01*Pressratio; C_press=(C_press1000*(56633.7-vol_flow)+C_press2000*(vol_flow-28316.9))/(56633.7-28316.9); end if vol_flowd > 56633.7 && vol_flowd <= 113267.4 C_press2000=8.00007150E+00-4.51966338E+01*Pressratio; C_press4000=7.24486827E+00-4.08877399E+01*Pressratio; C_press=(C_press2000*(113267.4-vol_flow)+C_press4000*(vol_flow-56633.7))/(113267.4-56633.7); end if vol_flowd > 113267.4 C_press4000=7.24486827E+00-4.08877399E+01*Pressratio; C_press=C_press4000; end if PressRatHPnew <= 2 C_partload2=-2.83017373E+01+5.75766292E+01*TFratio-2.90686668E+01*TFratio^2; C_partload=C_partload2; end if PressRatHPnew > 2 && PressRatHPnew <= 3 C_partload2=-2.83017373E+01+5.75766292E+01*TFratio-2.90686668E+01*TFratio^2; C_partload3=-2.50528799E+01+4.32433739E+01*TFratio-1.80426745E+01*TFratio^2; C_partload=(C_partload2*(3-PressRatHP)+C_partload3*(PressRatHP-2))/(3-2); end if PressRatHPnew > 3 && PressRatHPnew <= 4 C_partload3=-2.50528799E+01+4.32433739E+01*TFratio-1.80426745E+01*TFratio^2; C_partload4=-2.30678003E+01+3.72248987E+01*TFratio-1.40599804E+01*TFratio^2; C_partload=(C_partload3*(4-PressRatHP)+C_partload4*(PressRatHP-3))/(4-3); end if PressRatHPnew > 4 && PressRatHPnew <= 5 C_partload4=-2.30678003E+01+3.72248987E+01*TFratio-1.40599804E+01*TFratio^2; C_partload5=-2.17392690E+01+3.62132055E+01*TFratio-1.43873891E+01*TFratio^2; C_partload=(C_partload4*(5-PressRatHP)+C_partload5*(PressRatHP-4))/(5-4); end if PressRatHPnew > 5 && PressRatHPnew <= 6 C_partload5=-2.17392690E+01+3.62132055E+01*TFratio-1.43873891E+01*TFratio^2; C_partload6=-2.12265669E+01+3.91679919E+01*TFratio-1.77962270E+01*TFratio^2; C_partload=(C_partload5*(6-PressRatHP)+C_partload6*(PressRatHP-5))/(6-5); end if PressRatHPnew > 6 C_partload6=-2.12265669E+01+3.91679919E+01*TFratio-1.77962270E+01*TFratio^2; C_partload=C_partload6; end Numbervalves=F; if Numbervalves <= 4 C_meanloop4=3.58378378E+00-2.92567568E+00*TFratio; C_meanloop=C_meanloop4; end if Numbervalves == 6 C_meanloop6=2.64459459E+00-2.14189189E+00*TFratio; C_meanloop=C_meanloop6; end if Numbervalves >= 8 C_meanloop8=1.78378378E+00-1.42567568E+00*TFratio; C_meanloop=C_meanloop8; end etahp=etabase*(1 + C_vol/100); etahp=etahp*(1+C_press/100); etahp=etahp*(1+C_partload/100); etahp=etahp*(1-C_meanloop/100); etahp1(m)=etahp; end if B == 1 etabasereheat=91.93; C_vol=-35962.4/(m_rec(N)*v_5)*etabase/100; if T_5 <= 260 C_inic260=-1.07394647E+00-4.04038684E-01*p_iv+1.17906780E-02*p_iv^2-1.49979279E-04*p_iv^3; C_condinic=C_inic260; end if T_5 > 260 && T_5<= 315 C_inic260=-1.07394647E+00-4.04038684E-01*p_iv+1.17906780E-02*p_iv^2-1.49979279E-04*p_iv^3; C_inic315=-2.25362260E-01-2.63291673E-01*p_iv+4.97835469E-03*p_iv^2-3.96358532E-05*p_iv^3; C_condinic=(C_inic260*(315-T_5)+C_inic315*(T_5-260))/(315-260); end if T_5 > 315 && T_5<= 371 C_inic315=-2.25362260E-01-2.63291673E-01*p_iv+4.97835469E-03*p_iv^2-3.96358532E-05*p_iv^3; C_inic371=1.19989169E+00-4.30393344E-01*p_iv+2.33994125E-02*p_iv^2-7.30931534E-04*p_iv^3+1.18514262E-05*p_iv^4-9.46369174E-08*p_iv^5+2.93186478E-10*p_iv^6; C_condinic=(C_inic315*(371-T_5)+C_inic371*(T_5-315))/(371-315); end if T_5 > 371 && T_5<= 427 C_inic371=1.19989169E+00-4.30393344E-01*p_iv+2.33994125E-02*p_iv^2-7.30931534E-04*p_iv^3+1.18514262E-05*p_iv^4-9.46369174E-08*p_iv^5+2.93186478E-10*p_iv^6; C_inic427=1.32849721E+00-2.21331782E-01*p_iv+7.15588072E-03*p_iv^2-1.43702098E-04*p_iv^3+1.54079426E-06*p_iv^4-8.32089233E-09*p_iv^5+1.77956003E-11*p_iv^6; C_condinic=(C_inic371*(427-T_5)+C_inic427*(T_5-371))/(421-371); end if T_5 > 427 && T_5<= 482 C_inic427=1.32849721E+00-2.21331782E-01*p_iv+7.15588072E-03*p_iv^2-1.43702098E-04*p_iv^3+1.54079426E-06*p_iv^4-8.32089233E-09*p_iv^5+1.77956003E-11*p_iv^6; C_inic482=1.43072861E+00-8.42168448E-02*p_iv-3.45572241E-05*p_iv^2+3.38851765E-05*p_iv^3-6.22432913E-07*p_iv^4+4.41354692E-09*p_iv^5-1.11237485E-11*p_iv^6; C_condinic=(C_inic427*(482-T_5)+C_inic482*(T_5-427))/(482-427); end if T_5 > 482 && T_5<= 538 C_inic482=1.43072861E+00-8.42168448E-02*p_iv-3.45572241E-05*p_iv^2+3.38851765E-05*p_iv^3-6.22432913E-07*p_iv^4+4.41354692E-09*p_iv^5-1.11237485E-11*p_iv^6; C_inic538=1.27870464E+00+6.06624753E-02*p_iv-7.47590558E-03*p_iv^2+2.10224611E-04*p_iv^3-2.68634192E-06*p_iv^4+1.61032976E-08*p_iv^5-3.67106408E-11*p_iv^6; C_condinic=(C_inic482*(538-T_5)+C_inic538*(T_5-482))/(538-482); end if T_5 > 538 && T_5<= 593 C_inic538=1.27870464E+00+6.06624753E-02*p_iv-7.47590558E-03*p_iv^2+2.10224611E-04*p_iv^3-2.68634192E-06*p_iv^4+1.61032976E-08*p_iv^5-3.67106408E-11*p_iv^6; C_inic593=1.04488167E+00+1.91562726E-01*p_iv-1.39841763E-02*p_iv^2+3.60798652E-04*p_iv^3-4.42383805E-06*p_iv^4+2.58768543E-08*p_iv^5-5.80801196E-11*p_iv^6; C_condinic=(C_inic538*(593-T_5)+C_inic593*(T_5-538))/(593-538); end if T_5 > 593 && T_5<= 649 C_inic593=1.04488167E+00+1.91562726E-01*p_iv-1.39841763E-02*p_iv^2+3.60798652E-04*p_iv^3-4.42383805E-06*p_iv^4+2.58768543E-08*p_iv^5-5.80801196E-11*p_iv^6; C_inic649=8.11405785E-01+3.01607227E-01*p_iv-1.90808631E-02*p_iv^2+4.73204560E-04*p_iv^3-5.68144670E-06*p_iv^4+3.27897021E-08*p_iv^5-7.28894006E-11*p_iv^6; C_condinic=(C_inic593*(649-T_5)+C_inic649*(T_5-593))/(649-593); end if T_5 > 649 && T_5<= 704 C_inic649=8.11405785E-01+3.01607227E-01*p_iv-1.90808631E-02*p_iv^2+4.73204560E-04*p_iv^3-5.68144670E-06*p_iv^4+3.27897021E-08*p_iv^5-7.28894006E-11*p_iv^6; C_inic704=6.67287615E-01+3.59749277E-01*p_iv-2.10483798E-02*p_iv^2+5.08019685E-04*p_iv^3-6.01151485E-06*p_iv^4+3.43956762E-08*p_iv^5-7.60498694E-11*p_iv^6; C_condinic=(C_inic649*(704-T_5)+C_inic704*(T_5-649))/(704-649); end if T_5 > 704 && T_5<= 760 C_inic704=6.67287615E-01+3.59749277E-01*p_iv-2.10483798E-02*p_iv^2+5.08019685E-04*p_iv^3-6.01151485E-06*p_iv^4+3.43956762E-08*p_iv^5-7.60498694E-11*p_iv^6; C_inic760=5.94326739E-01+3.81306786E-01*p_iv-2.05423162E-02*p_iv^2+4.75918525E-04*p_iv^3-5.48212185E-06*p_iv^4+3.07550380E-08*p_iv^5-6.69649101E-11*p_iv^6; C_condinic=(C_inic704*(760-T_5)+C_inic760*(T_5-704))/(760-704); end etaip=etabasereheat*(1 + C_vol/100); etaip=etaip*(1+C_condinic/100); etaip1(m)=etaip; end if B == 3 etabasereheat=92.95; C_vol=-35962.4/(m_rec(N)*v_5)*etabase/100; if T_5 <= 260 C_inic260=-1.07394647E+00-4.04038684E-01*p_iv+1.17906780E-02*p_iv^2-1.49979279E-04*p_iv^3; C_condinic=C_inic260; end if T_5 > 260 && T_5<= 315 C_inic260=-1.07394647E+00-4.04038684E-01*p_iv+1.17906780E-02*p_iv^2-1.49979279E-04*p_iv^3; C_inic315=-2.25362260E-01-2.63291673E-01*p_iv+4.97835469E-03*p_iv^2-3.96358532E-05*p_iv^3; C_condinic=(C_inic260*(315-T_5)+C_inic315*(T_5-260))/(315-260); end if T_5 > 315 && T_5<= 371 C_inic315=-2.25362260E-01-2.63291673E-01*p_iv+4.97835469E-03*p_iv^2-3.96358532E-05*p_iv^3; C_inic371=1.19989169E+00-4.30393344E-01*p_iv+2.33994125E-02*p_iv^2-7.30931534E-04*p_iv^3+1.18514262E-05*p_iv^4-9.46369174E-08*p_iv^5+2.93186478E-10*p_iv^6; C_condinic=(C_inic315*(371-T_5)+C_inic371*(T_5-315))/(371-315); end if T_5 > 371 && T_5<= 427 C_inic371=1.19989169E+00-4.30393344E-01*p_iv+2.33994125E-02*p_iv^2-7.30931534E-04*p_iv^3+1.18514262E-05*p_iv^4-9.46369174E-08*p_iv^5+2.93186478E-10*p_iv^6; C_inic427=1.32849721E+00-2.21331782E-01*p_iv+7.15588072E-03*p_iv^2-1.43702098E-04*p_iv^3+1.54079426E-06*p_iv^4-8.32089233E-09*p_iv^5+1.77956003E-11*p_iv^6; C_condinic=(C_inic371*(427-T_5)+C_inic427*(T_5-371))/(421-371); end if T_5 > 427 && T_5<= 482 C_inic427=1.32849721E+00-2.21331782E-01*p_iv+7.15588072E-03*p_iv^2-1.43702098E-04*p_iv^3+1.54079426E-06*p_iv^4-8.32089233E-09*p_iv^5+1.77956003E-11*p_iv^6; C_inic482=1.43072861E+00-8.42168448E-02*p_iv-3.45572241E-05*p_iv^2+3.38851765E-05*p_iv^3-6.22432913E-07*p_iv^4+4.41354692E-09*p_iv^5-1.11237485E-11*p_iv^6; C_condinic=(C_inic427*(482-T_5)+C_inic482*(T_5-427))/(482-427); end if T_5 > 482 && T_5<= 538 C_inic482=1.43072861E+00-8.42168448E-02*p_iv-3.45572241E-05*p_iv^2+3.38851765E-05*p_iv^3-6.22432913E-07*p_iv^4+4.41354692E-09*p_iv^5-1.11237485E-11*p_iv^6; C_inic538=1.27870464E+00+6.06624753E-02*p_iv-7.47590558E-03*p_iv^2+2.10224611E-04*p_iv^3-2.68634192E-06*p_iv^4+1.61032976E-08*p_iv^5-3.67106408E-11*p_iv^6; C_condinic=(C_inic482*(538-T_5)+C_inic538*(T_5-482))/(538-482); end if T_5 > 538 && T_5<= 593 C_inic538=1.27870464E+00+6.06624753E-02*p_iv-7.47590558E-03*p_iv^2+2.10224611E-04*p_iv^3-2.68634192E-06*p_iv^4+1.61032976E-08*p_iv^5-3.67106408E-11*p_iv^6; C_inic593=1.04488167E+00+1.91562726E-01*p_iv-1.39841763E-02*p_iv^2+3.60798652E-04*p_iv^3-4.42383805E-06*p_iv^4+2.58768543E-08*p_iv^5-5.80801196E-11*p_iv^6; C_condinic=(C_inic538*(593-T_5)+C_inic593*(T_5-538))/(593-538); end if T_5 > 593 && T_5<= 649 C_inic593=1.04488167E+00+1.91562726E-01*p_iv-1.39841763E-02*p_iv^2+3.60798652E-04*p_iv^3-4.42383805E-06*p_iv^4+2.58768543E-08*p_iv^5-5.80801196E-11*p_iv^6; C_inic649=8.11405785E-01+3.01607227E-01*p_iv-1.90808631E-02*p_iv^2+4.73204560E-04*p_iv^3-5.68144670E-06*p_iv^4+3.27897021E-08*p_iv^5-7.28894006E-11*p_iv^6; C_condinic=(C_inic593*(649-T_5)+C_inic649*(T_5-593))/(649-593); end if T_5 > 649 && T_5<= 704 C_inic649=8.11405785E-01+3.01607227E-01*p_iv-1.90808631E-02*p_iv^2+4.73204560E-04*p_iv^3-5.68144670E-06*p_iv^4+3.27897021E-08*p_iv^5-7.28894006E-11*p_iv^6; C_inic704=6.67287615E-01+3.59749277E-01*p_iv-2.10483798E-02*p_iv^2+5.08019685E-04*p_iv^3-6.01151485E-06*p_iv^4+3.43956762E-08*p_iv^5-7.60498694E-11*p_iv^6; C_condinic=(C_inic649*(704-T_5)+C_inic704*(T_5-649))/(704-649); end if T_5 > 704 && T_5<= 760 C_inic704=6.67287615E-01+3.59749277E-01*p_iv-2.10483798E-02*p_iv^2+5.08019685E-04*p_iv^3-6.01151485E-06*p_iv^4+3.43956762E-08*p_iv^5-7.60498694E-11*p_iv^6; C_inic760=5.94326739E-01+3.81306786E-01*p_iv-2.05423162E-02*p_iv^2+4.75918525E-04*p_iv^3-5.48212185E-06*p_iv^4+3.07550380E-08*p_iv^5-6.69649101E-11*p_iv^6; C_condinic=(C_inic704*(760-T_5)+C_inic760*(T_5-704))/(760-704); end etaip=etabasereheat*(1 + C_vol/100); etaip=etaip*(1+C_condinic/100); etaip1(m)=etaip; end if B == 2 etabasereheat=91.93; C_vol=-35962.4/(m_rec(N)*v_5)*etabase/100; if T_5 <= 260 C_inic260=-1.07394647E+00-4.04038684E-01*p_iv+1.17906780E-02*p_iv^2-1.49979279E-04*p_iv^3; C_condinic=C_inic260; end if T_5 > 260 && T_5<= 315 C_inic260=-1.07394647E+00-4.04038684E-01*p_iv+1.17906780E-02*p_iv^2-1.49979279E-04*p_iv^3; C_inic315=-2.25362260E-01-2.63291673E-01*p_iv+4.97835469E-03*p_iv^2-3.96358532E-05*p_iv^3; C_condinic=(C_inic260*(315-T_5)+C_inic315*(T_5-260))/(315-260); end if T_5 > 315 && T_5<= 371 C_inic315=-2.25362260E-01-2.63291673E-01*p_iv+4.97835469E-03*p_iv^2-3.96358532E-05*p_iv^3; C_inic371=1.19989169E+00-4.30393344E-01*p_iv+2.33994125E-02*p_iv^2-7.30931534E-04*p_iv^3+1.18514262E-05*p_iv^4-9.46369174E-08*p_iv^5+2.93186478E-10*p_iv^6; C_condinic=(C_inic315*(371-T_5)+C_inic371*(T_5-315))/(371-315); end if T_5 > 371 && T_5<= 427 C_inic371=1.19989169E+00-4.30393344E-01*p_iv+2.33994125E-02*p_iv^2-7.30931534E-04*p_iv^3+1.18514262E-05*p_iv^4-9.46369174E-08*p_iv^5+2.93186478E-10*p_iv^6; C_inic427=1.32849721E+00-2.21331782E-01*p_iv+7.15588072E-03*p_iv^2-1.43702098E-04*p_iv^3+1.54079426E-06*p_iv^4-8.32089233E-09*p_iv^5+1.77956003E-11*p_iv^6; C_condinic=(C_inic371*(427-T_5)+C_inic427*(T_5-371))/(421-371); end if T_5 > 427 && T_5<= 482 C_inic427=1.32849721E+00-2.21331782E-01*p_iv+7.15588072E-03*p_iv^2-1.43702098E-04*p_iv^3+1.54079426E-06*p_iv^4-8.32089233E-09*p_iv^5+1.77956003E-11*p_iv^6; C_inic482=1.43072861E+00-8.42168448E-02*p_iv-3.45572241E-05*p_iv^2+3.38851765E-05*p_iv^3-6.22432913E-07*p_iv^4+4.41354692E-09*p_iv^5-1.11237485E-11*p_iv^6; C_condinic=(C_inic427*(482-T_5)+C_inic482*(T_5-427))/(482-427); end if T_5 > 482 && T_5<= 538 C_inic482=1.43072861E+00-8.42168448E-02*p_iv-3.45572241E-05*p_iv^2+3.38851765E-05*p_iv^3-6.22432913E-07*p_iv^4+4.41354692E-09*p_iv^5-1.11237485E-11*p_iv^6; C_inic538=1.27870464E+00+6.06624753E-02*p_iv-7.47590558E-03*p_iv^2+2.10224611E-04*p_iv^3-2.68634192E-06*p_iv^4+1.61032976E-08*p_iv^5-3.67106408E-11*p_iv^6; C_condinic=(C_inic482*(538-T_5)+C_inic538*(T_5-482))/(538-482); end if T_5 > 538 && T_5<= 593 C_inic538=1.27870464E+00+6.06624753E-02*p_iv-7.47590558E-03*p_iv^2+2.10224611E-04*p_iv^3-2.68634192E-06*p_iv^4+1.61032976E-08*p_iv^5-3.67106408E-11*p_iv^6; C_inic593=1.04488167E+00+1.91562726E-01*p_iv-1.39841763E-02*p_iv^2+3.60798652E-04*p_iv^3-4.42383805E-06*p_iv^4+2.58768543E-08*p_iv^5-5.80801196E-11*p_iv^6; C_condinic=(C_inic538*(593-T_5)+C_inic593*(T_5-538))/(593-538); end if T_5 > 593 && T_5<= 649 C_inic593=1.04488167E+00+1.91562726E-01*p_iv-1.39841763E-02*p_iv^2+3.60798652E-04*p_iv^3-4.42383805E-06*p_iv^4+2.58768543E-08*p_iv^5-5.80801196E-11*p_iv^6; C_inic649=8.11405785E-01+3.01607227E-01*p_iv-1.90808631E-02*p_iv^2+4.73204560E-04*p_iv^3-5.68144670E-06*p_iv^4+3.27897021E-08*p_iv^5-7.28894006E-11*p_iv^6; C_condinic=(C_inic593*(649-T_5)+C_inic649*(T_5-593))/(649-593); end if T_5 > 649 && T_5<= 704 C_inic649=8.11405785E-01+3.01607227E-01*p_iv-1.90808631E-02*p_iv^2+4.73204560E-04*p_iv^3-5.68144670E-06*p_iv^4+3.27897021E-08*p_iv^5-7.28894006E-11*p_iv^6; C_inic704=6.67287615E-01+3.59749277E-01*p_iv-2.10483798E-02*p_iv^2+5.08019685E-04*p_iv^3-6.01151485E-06*p_iv^4+3.43956762E-08*p_iv^5-7.60498694E-11*p_iv^6; C_condinic=(C_inic649*(704-T_5)+C_inic704*(T_5-649))/(704-649); end if T_5 > 704 && T_5<= 760 C_inic704=6.67287615E-01+3.59749277E-01*p_iv-2.10483798E-02*p_iv^2+5.08019685E-04*p_iv^3-6.01151485E-06*p_iv^4+3.43956762E-08*p_iv^5-7.60498694E-11*p_iv^6; C_inic760=5.94326739E-01+3.81306786E-01*p_iv-2.05423162E-02*p_iv^2+4.75918525E-04*p_iv^3-5.48212185E-06*p_iv^4+3.07550380E-08*p_iv^5-6.69649101E-11*p_iv^6; C_condinic=(C_inic704*(760-T_5)+C_inic760*(T_5-704))/(760-704); end h_5(m)=XSteam('h_pT',p_iv,T_5); s_5=XSteam('s_pT',p_iv,T_5); h_6s=XSteam('h_ps',p_escip,s_5); h_8s=XSteam('h_ps',p_8,s_5); AELP = h_5(m) - h_8s; AE1800 = h_6s - h_8s; C_1800=1.25*(AE1800/AELP); etaip=etabasereheat*(1 + C_vol/100); etaip=etaip*(1+C_condinic/100); etaip=etaip*(1+C_1800/100); etaip1(m)=etaip; end %Ahora se resuelve el problema térmico de los precalentadores m_esclp(m)=0.65*m_vv(m);%estimación inicial del gasto a la salida de baja presión difmesclp(m)=1; if m==N while difmesclp(m)>0.05 %primero se calcula el punto final de la línea de expansión en cada cuerpo h_4s=XSteam('h_ps',p_4,s_3); AEHP = h_3 - h_4s; ELEPHP = h_3 - etahp/100 * AEHP; h_4(m)=ELEPHP; s_4=XSteam('s_ph',p_4,h_4(m)); h_5(m)=XSteam('h_pT',p_iv,T_5); s_5=XSteam('s_pT',p_iv,T_5); h_6s=XSteam('h_ps',p_escip,s_5); h_8s=XSteam('h_ps',0.05,s_5); %P=0.05 AEIP = h_5(m) - h_6s; ELEPIP = h_5(m) - etaip/100 * AEIP; h_6(m)=ELEPIP; AELP = h_5(m) - h_8s; ELEPLP = h_5(m) - etaip/100 * AELP %pérdidas de escape IncH_esclp=-2.35186188E+02+6.45527772E+03*p_8-4.23249952E+04*p_8^2+1.12096071E+05*p_8^3 X=XSteam('x_ph',p_8,ELEPLP); Y=1-X; v_esclp=XSteam('vV_p',p_8); AnulVel=m_esclp(m)*v_esclp*(1-Y)/(3600*A_an*0.0929); if B==1 if G <= 60 ExhLoss=9.88268860E+01-1.51551831E+00*AnulVel+7.48442434E-03*AnulVel^2-8.97231270E-06*AnulVel^3; end if G > 60 && G <= 65.5 ExhLoss60=9.88268860E+01-1.51551831E+00*AnulVel+7.48442434E-03*AnulVel^2-8.97231270E-06*AnulVel^3; ExhLoss65=1.96571058E+02-2.42042872E+00*AnulVel+9.74704047E-03*AnulVel^2-1.06430503E-05*AnulVel^3; ExhLoss=(ExhLoss60*(65.5-G)+ExhLoss65*(G-60))/(65.5-60); end if G > 65.5 && G <= 72 ExhLoss65=1.96571058E+02-2.42042872E+00*AnulVel+9.74704047E-03*AnulVel^2-1.06430503E-05*AnulVel^3; ExhLoss72=2.21017485E+02-2.64269019E+00*AnulVel+1.04331965E-02*AnulVel^2-1.13657152E-05*AnulVel^3; ExhLoss=(ExhLoss65*(72-G)+ExhLoss72*(G-65.5))/(72-65.5); end if G > 72 && G <= 85 ExhLoss72=2.21017485E+02-2.64269019E+00*AnulVel+1.04331965E-02*AnulVel^2-1.13657152E-05*AnulVel^3; ExhLoss85=2.99360547E+02-3.30109623E+00*AnulVel+1.22337525E-02*AnulVel^2-1.30064763E-05*AnulVel^3; ExhLoss=(ExhLoss72*(85-G)+ExhLoss85*(G-72))/(85-72); end if G > 85 && G <= 90.5 ExhLoss85=2.99360547E+02-3.30109623E+00*AnulVel+1.22337525E-02*AnulVel^2-1.30064763E-05*AnulVel^3; ExhLoss90=3.18060472E+02-3.44072572E+00*AnulVel+1.24802005E-02*AnulVel^2-1.30696121E-05*AnulVel^3; ExhLoss=(ExhLoss85*(90.5-G)+ExhLoss90*(G-85))/(90.5-85); end if G > 90.5 ExhLoss=3.18060472E+02-3.44072572E+00*AnulVel+1.24802005E-02*AnulVel^2-1.30696121E-05*AnulVel^3; end end if B==2 || B==3 if G <= 38 ExhLoss=1.61457355E+02-2.00616202E+00*AnulVel+8.37535477E-03*AnulVel^2-9.19728349E-06*AnulVel^3; end if G > 38 && G <= 43 ExhLoss38=1.61457355E+02-2.00616202E+00*AnulVel+8.37535477E-03*AnulVel^2-9.19728349E-06*AnulVel^3; ExhLoss43=1.95429333E+02-2.51178088E+00*AnulVel+1.05111363E-02*AnulVel^2-1.18690819E-05*AnulVel^3; ExhLoss=(ExhLoss38*(43-G)+ExhLoss43*(G-38))/(43-38); end if G > 38 && G <= 43 ExhLoss38=1.61457355E+02-2.00616202E+00*AnulVel+8.37535477E-03*AnulVel^2-9.19728349E-06*AnulVel^3; ExhLoss43=1.95429333E+02-2.51178088E+00*AnulVel+1.05111363E-02*AnulVel^2-1.18690819E-05*AnulVel^3; ExhLoss=(ExhLoss38*(43-G)+ExhLoss43*(G-38))/(43-38); end if G > 43 && G <= 52 ExhLoss43=1.95429333E+02-2.51178088E+00*AnulVel+1.05111363E-02*AnulVel^2-1.18690819E-05*AnulVel^3; ExhLoss52=2.47408160E+02-2.89813521E+00*AnulVel+1.12225948E-02*AnulVel^2-1.21804261E-05*AnulVel^3; ExhLoss=(ExhLoss43*(52-G)+ExhLoss52*(G-43))/(52-43); end if G > 52 ExhLoss=2.47408160E+02-2.89813521E+00*AnulVel+1.12225948E-02*AnulVel^2-1.21804261E-05*AnulVel^3; end end ExhLoss h_8(m)=ELEPLP+(IncH_esclp+ExhLoss)*0.87*(1-Y)*(1-0.65*Y); s_8=XSteam('s_ph',p_8,h_8(m)); p_entcald=1.25*p_3; h_cond=XSteam('hL_p',p_8); T_entcald=XSteam('tsat_p',p_entcald); h_entcald=XSteam('hL_p',p_entcald); %aquí se ve el salto de temperatura en cada precalentador p_extr7(m)=p_4; p_extr5(m)=p_escip; T_sat7=XSteam('Tsat_p',0.97*p_extr7(m)); T_salprec7=T_sat7-DTT; h_salprec7=XSteam('h_pT',p_entcald,T_salprec7); T_sat5=XSteam('Tsat_p',0.97*p_extr5(m)); T_salprec5=T_sat5-DTT; h_salprec5=XSteam('h_pT',0.97*p_extr5(m),T_salprec5); incH_precip=(h_salprec7-h_salprec5)/2; c_p=XSteam('cp_pT',p_entcald,T_salprec5); incT7=incH_precip/c_p; T_salprec6=T_salprec7-incT7; T_sat6=T_salprec6+DTT; p_extr6(m)=1.03*(XSteam('psat_T',T_sat6)); %estos bucles son para hallar las propiedades de cada extracción for i=1:1000 h_aux7(i)=h_3-i*(h_3-h_4(m))/1000; s_aux7(i)=s_3+i*(s_4-s_3)/1000; p_extr7aux(i)=XSteam('p_hs', h_aux7(i),s_aux7(i)); difp_extr7(i)=abs((p_extr7aux(i)-p_extr7(m))/p_extr7(m)); if difp_extr7(i)<= min(difp_extr7) h_extr7(m)=h_aux7(i); s_extr7=s_aux7(i); end end for i=1:1000 h_aux6(i)=h_5(m)-i*(h_5(m)-h_8(m))/1000; s_aux6(i)=s_5+i*(s_8-s_5)/1000; p_extr6aux(i)=XSteam('p_hs', h_aux6(i),s_aux6(i)); difp_extr6(i)=abs((p_extr6aux(i)-p_extr6(m))/p_extr6(m)); if difp_extr6(i)<= min(difp_extr6) h_extr6(m)=h_aux6(i); s_extr6=s_aux6(i); end end for i=1:1000 h_aux5(i)=h_5(m)-i*(h_5(m)-h_8(m))/1000; s_aux5(i)=s_5+i*(s_8-s_5)/1000; p_extr5aux(i)=XSteam('p_hs', h_aux5(i),s_aux5(i)); difp_extr5(i)=abs((p_extr5aux(i)-p_extr5(m))/p_extr5(m)); if difp_extr5(i)<= min(difp_extr5) h_extr5(m)=h_aux5(i); s_extr5=s_aux5(i); end end h_sat7=XSteam('hL_p',0.97*p_extr7(m)); h_sat6=XSteam('hL_p',0.97*p_extr6(m)); h_sal7=c_p*(DC+T_salprec6); h_sal6=c_p*(DC+T_salprec5); %aquí se calcula el gasto másico necesario por extracción m_extr7(m)=m_vv(m)*incH_precip/(h_extr7(m)-h_sal7); m_extr6(m)=(m_vv(m)*incH_precip-m_extr7(m)*(h_sal7-h_sal6))/(h_extr6(m)-h_sal6); c_p=XSteam('cp_pT',0.97*p_extr5(m),T_salprec5); incH_preclp=(h_salprec5-h_cond)/5; incT5=incH_preclp/c_p; T_salprec4=T_salprec5-incT5; T_sat4=T_salprec4+DTT; h_sal5=XSteam('h_pT',0.97*p_extr5(m),T_salprec4); p_extr4(m)=XSteam('psat_T',T_sat4); c_p=XSteam('cp_pT',0.97*p_extr5(m),T_salprec4); incT4=incH_preclp/c_p; T_salprec3=T_salprec4-incT4; T_sat3=T_salprec3+DTT; p_extr3(m)=XSteam('psat_T',T_sat3); c_p=XSteam('cp_pT',0.97*p_extr5(m),T_salprec3); incT3=incH_preclp/c_p; T_salprec2=T_salprec3-incT3; T_sat2=T_salprec2+DTT; p_extr2(m)=XSteam('psat_T',T_sat2); c_p=XSteam('cp_pT',0.97*p_extr5(m),T_salprec2); incT2=incH_preclp/c_p; T_salprec1=T_salprec2-incT2; T_sat1=T_salprec1+DTT; p_extr1(m)=XSteam('psat_T',T_sat1); for i=1:1000 h_aux4(i)=h_5(m)-i*(h_5(m)-h_8(m))/1000; s_aux4(i)=s_5+i*(s_8-s_5)/1000; p_extr4aux(i)=XSteam('p_hs', h_aux4(i),s_aux4(i)); difp_extr4(i)=abs((p_extr4aux(i)-p_extr4(m))/p_extr4(m)); if difp_extr4(i)<= min(difp_extr4) h_extr4(m)=h_aux4(i); s_extr4=s_aux4(i); end end for i=1:1000 h_aux3(i)=h_5(m)-i*(h_5(m)-h_8(m))/1000; s_aux3(i)=s_5+i*(s_8-s_5)/1000; p_extr3aux(i)=XSteam('p_hs', h_aux3(i),s_aux3(i)); difp_extr3(i)=abs((p_extr3aux(i)-p_extr3(m))/p_extr3(m)); if difp_extr3(i)<= min(difp_extr3) h_extr3(m)=h_aux3(i); s_extr3=s_aux3(i); end end for i=1:1000 h_aux2(i)=h_5(m)-i*(h_5(m)-h_8(m))/1000; s_aux2(i)=s_5+i*(s_8-s_5)/1000; p_extr2aux(i)=XSteam('p_hs', h_aux2(i),s_aux2(i)); difp_extr2(i)=abs((p_extr2aux(i)-p_extr2(m))/p_extr2(m)); if difp_extr2(i)<= min(difp_extr2) h_extr2(m)=h_aux2(i); s_extr2=s_aux2(i); end end for i=1:1000 h_aux1(i)=h_5(m)-i*(h_5(m)-h_8(m))/1000; s_aux1(i)=s_5+i*(s_8-s_5)/1000; p_extr1aux(i)=XSteam('p_hs', h_aux1(i),s_aux1(i)); difp_extr1(i)=abs((p_extr1aux(i)-p_extr1(m))/p_extr1(m)); if difp_extr1(i)<= min(difp_extr1) h_extr1(m)=h_aux1(i); s_extr1=s_aux1(i); end end T_extr1=XSteam('t_ph',p_extr1(m),h_extr1(m)); T_extr2=XSteam('t_ph',p_extr2(m),h_extr2(m)); T_extr3=XSteam('t_ph',p_extr3(m),h_extr3(m)); T_extr4=XSteam('t_ph',p_extr4(m),h_extr4(m)); T_extr5=XSteam('t_ph',p_extr5(m),h_extr5(m)); T_extr6=XSteam('t_ph',p_extr6(m),h_extr6(m)); T_extr7=XSteam('t_ph',p_extr7(m),h_extr7(m)); h_sat4=XSteam('hL_p',0.97*p_extr4(m)); h_sat3=XSteam('hL_p',0.97*p_extr3(m)); h_sat2=XSteam('hL_p',0.97*p_extr2(m)); h_sat1=XSteam('hL_p',0.97*p_extr1(m)); h_sal4=c_p*(DC+T_salprec3); h_sal3=c_p*(DC+T_salprec2); h_sal2=c_p*(DC+T_salprec1); T_cond=XSteam('Tsat_p',p_8); h_sal1=c_p*(DC+T_cond); m_extr5(m)=(m_vv(m)*incH_preclp-m_extr7(m)*(h_sal7-h_sal6)-(m_extr7(m)+m_extr6(m))*(h_sal6-h_sal5))/(h_extr5(m)-h_sal5); m_cond(m)=m_vv(m)-m_extr7(m)-m_extr6(m)-m_extr5(m); m_extr4(m)=(m_cond(m)*incH_preclp)/(h_extr4(m)-h_sal4); m_extr3(m)=(m_cond(m)*incH_preclp-m_extr4(m)*(h_sal4-h_sal3))/(h_extr3(m)-h_sal3); m_extr2(m)=(m_cond(m)*incH_preclp-m_extr4(m)*(h_sal4-h_sal3)-(m_extr4(m)+m_extr3(m))*(h_sal3-h_sal2))/(h_extr2(m)-h_sal2); m_extr1(m)=(m_cond(m)*incH_preclp-m_extr4(m)*(h_sal4-h_sal3)-(m_extr4(m)+m_extr3(m))*(h_sal3-h_sal2)-(m_extr4(m)+m_extr3(m)+m_extr2(m))*(h_sal2-h_sal1))/(h_extr1(m)-h_sal1); m_7(m)=m_vv(m)-m_extr7(m); m_6(m)=m_7(m)-m_extr6(m); m_5(m)=m_6(m)-m_extr5(m); m_4(m)=m_5(m)-m_extr4(m); m_3(m)=m_4(m)-m_extr3(m); m_2(m)=m_3(m)-m_extr2(m); m_1(m)=m_2(m)-m_extr1(m); %calculo de coeficientes de flujo para aplicar posteriormente la elipse de Stodola phid_extr1=(m_1(m)*sqrt(T_extr1))/p_extr1(m); phid_extr2=(m_2(m)*sqrt(T_extr2))/p_extr2(m); phid_extr3=(m_3(m)*sqrt(T_extr3))/p_extr3(m); phid_extr4=(m_4(m)*sqrt(T_extr4))/p_extr4(m); phid_extr5=(m_5(m)*sqrt(T_extr5))/p_extr5(m); phid_extr6=(m_6(m)*sqrt(T_extr6))/p_extr6(m); phid_extr7=(m_7(m)*sqrt(T_extr7))/p_extr7(m); Yd_extr1=((p_extr1(m))^2-p_8^2)/(((p_extr1(m))^2)*(phid_extr1^2)); Yd_extr2=((p_extr2(m))^2-(p_extr1(m))^2)/(((p_extr2(m))^2)*(phid_extr2^2)); Yd_extr3=((p_extr3(m))^2-(p_extr2(m))^2)/(((p_extr3(m))^2)*(phid_extr3^2)); Yd_extr4=((p_extr4(m))^2-(p_extr3(m))^2)/(((p_extr4(m))^2)*(phid_extr4^2)); Yd_extr5=((p_extr5(m))^2-(p_extr4(m))^2)/(((p_extr5(m))^2)*(phid_extr5^2)); Yd_extr6=((p_extr6(m))^2-(p_extr5(m))^2)/(((p_extr6(m))^2)*(phid_extr6^2)); Yd_extr7=((p_extr7(m))^2-(p_extr6(m))^2)/(((p_extr7(m))^2)*(phid_extr7^2)); p_entcald=1.25*p_3; p_desg=p_extr5(m)*(1-0.03); if tbomba==1 eta_bomba=-1.00000000E-02+1.89200000E+00*TFratio-1.04000000E+00*TFratio^2; deltaH_bomba=(p_entcald-p_desg)/(10*eta_bomba); m_bomba=(m_vv(m)+m_mu)/3600; W_bomba=m_bomba*deltaH_bomba; W_bombalp=(m_cond(m)*(p_extr5(m)-p_8))/(10*3600*eta_bomba); p_escbfpt=p_8+0.017; h_escbfpts=XSteam('h_ps',p_escbfpt,s_4); eta_bfpt=7.80000000E-01-6.00000000E-02*TFratio+8.00000000E-02*TFratio^2; h_escbfpt=h_4(m)-eta_bfpt*(h_4(m)-h_escbfpts); %notar la diferencia entre isentropico y no isentropico 'escbfpt vs escbfpts' h_bfpt(m)=h_extr5(m); deltaH_bfpt=h_bfpt(m)-h_escbfpt; m_bfpt(m)=((W_bomba+W_bombalp)/deltaH_bfpt)*3600; gastobombaelec(m)=0; else m_bfpt(m)=0; h_bfpt(m)=0; gastobombaelec(m)=((m_vv(m)+m_mu)*(p_entcald-0.97*p_extr5(m))+(m_cond(m)*(p_extr5(m)-p_8)))/(10*0.75*3600); end h_slo6(m)=h_extr5(m); v_slo6=XSteam('v_ph',p_extr5(m),h_slo6(m)); m_slo6(m)=272.4*sqrt(p_extr5(m)/v_slo6); h_gslo(m)=3.20844668E+03-3.14113463E-06*m_vv(m)+7.03296886E-11*m_vv(m)^2; %ecuaciones sacadas de la tabla 3 fugas y pérd. mecanicas p_gslo=8.26205534E-01+8.55184440E-05*m_vv(m)+5.66588017E-12*m_vv(m)^2; v_gslo=XSteam('v_ph',p_gslo,h_gslo(m)); m_gslo(m)=215.8*sqrt(p_govhp/v_gslo); v_slo45=XSteam('v_ph',p_4,h_4(m)); m_slo45(m)=281.48*sqrt(p_4/v_slo45); h_vslo12(m)=h_3; h_slo45(m)=h_4(m); m_vslo12(m)=25.42*sqrt(p_3/v_3); m_eschp(m)=m_vv(m)-m_vslo12(m)-m_gslo(m)-m_slo45(m); m_ip(m)=m_vv(m)-m_vslo12(m)-m_slo45(m)-m_extr7(m); m_lp(m)=m_ip(m)-m_extr6(m)-m_extr5(m)-m_bfpt(m)-m_slo6(m); m_esclpn(m)=m_lp(m)-m_extr4(m)-m_extr3(m)-m_extr2(m)-m_extr1(m); difmesclp(m)=abs((m_esclp(m)-m_esclpn(m))/m_esclpn(m)); if difmesclp(m) > 0.005 m_esclp(m)=m_esclpn(m); end end end %estimación de presiones de extracción en carga parcial p_extr1(m)=(m/N)*p_extr1(N); p_extr2(m)=(m/N)*p_extr2(N); p_extr3(m)=(m/N)*p_extr3(N); p_extr4(m)=(m/N)*p_extr4(N); p_extr5(m)=(m/N)*p_extr5(N); p_extr6(m)=(m/N)*p_extr6(N); p_extr7(m)=(m/N)*p_extr7(N); desvp_extr=1; %Ahora calculamos lo mismo para carga parcial (primero PFLE de cada cuerpo %y seguidamente saltos de temperatura en los precalentadores y gastos en %las extracciones) %el bucle desvp_extr sirve para asegurarnos que las presiones de extraccion %con las que trabajamos en la elipse de Stodola son las correctas, para así %poder calcular los gastos por las extracciones if m ~= N while desvp_extr > 0.05 difmesclp(m)=1; m_esclp(m)=0.65*m_vv(m); while difmesclp(m)>0.05 p_4=p_extr7(m); h_4s=XSteam('h_ps',p_4,s_3); AEHP = h_3 - h_4s; ELEPHP = h_3 - etahp/100 * AEHP; h_4(m)=ELEPHP; s_4=XSteam('s_ph',p_4,h_4(m)); h_5(m)=XSteam('h_pT',p_iv,T_5); s_5=XSteam('s_pT',p_iv,T_5); h_6s=XSteam('h_ps',p_escip,s_5); h_8s=XSteam('h_ps',0.05,s_5); AEIP = h_5(m) - h_6s; ELEPIP = h_5(m) - etaip/100 * AEIP; h_6(m)=ELEPIP; AELP = h_5(m) - h_8s; ELEPLP = h_5(m) - etaip/100 * AELP IncH_esclp=-2.35186188E+02+6.45527772E+03*p_8-4.23249952E+04*p_8^2+1.12096071E+05*p_8^3 X=XSteam('x_ph',p_8,ELEPLP); Y=1-X v_esclp=XSteam('vV_p',p_8); AnulVel=m_esclp(m)*v_esclp*(1-Y)/(3600*A_an*0.0929); if B==1 if G <= 60 ExhLoss=9.88268860E+01-1.51551831E+00*AnulVel+7.48442434E-03*AnulVel^2-8.97231270E-06*AnulVel^3; end if G > 60 && G <= 65.5 ExhLoss60=9.88268860E+01-1.51551831E+00*AnulVel+7.48442434E-03*AnulVel^2-8.97231270E-06*AnulVel^3; ExhLoss65=1.96571058E+02-2.42042872E+00*AnulVel+9.74704047E-03*AnulVel^2-1.06430503E-05*AnulVel^3; ExhLoss=(ExhLoss60*(65.5-G)+ExhLoss65*(G-60))/(65.5-60); end if G > 65.5 && G <= 72 ExhLoss65=1.96571058E+02-2.42042872E+00*AnulVel+9.74704047E-03*AnulVel^2-1.06430503E-05*AnulVel^3; ExhLoss72=2.21017485E+02-2.64269019E+00*AnulVel+1.04331965E-02*AnulVel^2-1.13657152E-05*AnulVel^3; ExhLoss=(ExhLoss65*(72-G)+ExhLoss72*(G-65.5))/(72-65.5); end if G > 72 && G <= 85 ExhLoss72=2.21017485E+02-2.64269019E+00*AnulVel+1.04331965E-02*AnulVel^2-1.13657152E-05*AnulVel^3; ExhLoss85=2.99360547E+02-3.30109623E+00*AnulVel+1.22337525E-02*AnulVel^2-1.30064763E-05*AnulVel^3; ExhLoss=(ExhLoss72*(85-G)+ExhLoss85*(G-72))/(85-72); end if G > 85 && G <= 90.5 ExhLoss85=2.99360547E+02-3.30109623E+00*AnulVel+1.22337525E-02*AnulVel^2-1.30064763E-05*AnulVel^3; ExhLoss90=3.18060472E+02-3.44072572E+00*AnulVel+1.24802005E-02*AnulVel^2-1.30696121E-05*AnulVel^3; ExhLoss=(ExhLoss85*(90.5-G)+ExhLoss90*(G-85))/(90.5-85); end if G > 90.5 ExhLoss=3.18060472E+02-3.44072572E+00*AnulVel+1.24802005E-02*AnulVel^2-1.30696121E-05*AnulVel^3; end end if B==3 || B==2 if G <= 38 ExhLoss=1.61457355E+02-2.00616202E+00*AnulVel+8.37535477E-03*AnulVel^2-9.19728349E-06*AnulVel^3; end if G > 38 && G <= 43 ExhLoss38=1.61457355E+02-2.00616202E+00*AnulVel+8.37535477E-03*AnulVel^2-9.19728349E-06*AnulVel^3; ExhLoss43=1.95429333E+02-2.51178088E+00*AnulVel+1.05111363E-02*AnulVel^2-1.18690819E-05*AnulVel^3; ExhLoss=(ExhLoss38*(43-G)+ExhLoss43*(G-38))/(43-38); end if G > 38 && G <= 43 ExhLoss38=1.61457355E+02-2.00616202E+00*AnulVel+8.37535477E-03*AnulVel^2-9.19728349E-06*AnulVel^3; ExhLoss43=1.95429333E+02-2.51178088E+00*AnulVel+1.05111363E-02*AnulVel^2-1.18690819E-05*AnulVel^3; ExhLoss=(ExhLoss38*(43-G)+ExhLoss43*(G-38))/(43-38); end if G > 43 && G <= 52 ExhLoss43=1.95429333E+02-2.51178088E+00*AnulVel+1.05111363E-02*AnulVel^2-1.18690819E-05*AnulVel^3; ExhLoss52=2.47408160E+02-2.89813521E+00*AnulVel+1.12225948E-02*AnulVel^2-1.21804261E-05*AnulVel^3; ExhLoss=(ExhLoss43*(52-G)+ExhLoss52*(G-43))/(52-43); end if G > 52 ExhLoss=2.47408160E+02-2.89813521E+00*AnulVel+1.12225948E-02*AnulVel^2-1.21804261E-05*AnulVel^3; end end ExhLoss h_8(m)=ELEPLP+(IncH_esclp+ExhLoss)*0.87*(1-Y)*(1-0.65*Y); s_8=XSteam('s_ph',p_8,h_8(m)); for i=1:1000 h_aux7(i)=h_3-i*(h_3-h_4(m))/1000; s_aux7(i)=s_3+i*(s_4-s_3)/1000; p_extr7aux(i)=XSteam('p_hs', h_aux7(i),s_aux7(i)); difp_extr7(i)=abs((p_extr7aux(i)-p_extr7(m))/p_extr7(m)); if difp_extr7(i)<= min(difp_extr7) h_extr7(m)=h_aux7(i); s_extr7=s_aux7(i); end end for i=1:1000 h_aux6(i)=h_5(m)-i*(h_5(m)-h_8(m))/1000; s_aux6(i)=s_5+i*(s_8-s_5)/1000; p_extr6aux(i)=XSteam('p_hs', h_aux6(i),s_aux6(i)); difp_extr6(i)=abs((p_extr6aux(i)-p_extr6(m))/p_extr6(m)); if difp_extr6(i)<= min(difp_extr6) h_extr6(m)=h_aux6(i); s_extr6=s_aux6(i); end end for i=1:1000 h_aux5(i)=h_5(m)-i*(h_5(m)-h_8(m))/1000; s_aux5(i)=s_5+i*(s_8-s_5)/1000; p_extr5aux(i)=XSteam('p_hs', h_aux5(i),s_aux5(i)); difp_extr5(i)=abs((p_extr5aux(i)-p_extr5(m))/p_extr5(m)); if difp_extr5(i)<= min(difp_extr5) h_extr5(m)=h_aux5(i); s_extr5=s_aux5(i); end end h_slo6(m)=h_extr5(m); v_slo6=XSteam('v_ph',p_extr5(m),h_slo6(m)); m_slo6(m)=272.4*sqrt(p_extr5(m)/v_slo6); for i=1:1000 h_aux4(i)=h_5(m)-i*(h_5(m)-h_8(m))/1000; s_aux4(i)=s_5+i*(s_8-s_5)/1000; p_extr4aux(i)=XSteam('p_hs', h_aux4(i),s_aux4(i)); difp_extr4(i)=abs((p_extr4aux(i)-p_extr4(m))/p_extr4(m)); if difp_extr4(i)<= min(difp_extr4) h_extr4(m)=h_aux4(i); s_extr4=s_aux4(i); end end for i=1:1000 h_aux3(i)=h_5(m)-i*(h_5(m)-h_8(m))/1000; s_aux3(i)=s_5+i*(s_8-s_5)/1000; p_extr3aux(i)=XSteam('p_hs', h_aux3(i),s_aux3(i)); difp_extr3(i)=abs((p_extr3aux(i)-p_extr3(m))/p_extr3(m)); if difp_extr3(i)<= min(difp_extr3) h_extr3(m)=h_aux3(i); s_extr3=s_aux3(i); end end for i=1:1000 h_aux2(i)=h_5(m)-i*(h_5(m)-h_8(m))/1000; s_aux2(i)=s_5+i*(s_8-s_5)/1000; p_extr2aux(i)=XSteam('p_hs', h_aux2(i),s_aux2(i)); difp_extr2(i)=abs((p_extr2aux(i)-p_extr2(m))/p_extr2(m)); if difp_extr2(i)<= min(difp_extr2) h_extr2(m)=h_aux2(i); s_extr2=s_aux2(i); end end for i=1:1000 h_aux1(i)=h_5(m)-i*(h_5(m)-h_8(m))/1000; s_aux1(i)=s_5+i*(s_8-s_5)/1000; p_extr1aux(i)=XSteam('p_hs', h_aux1(i),s_aux1(i)); difp_extr1(i)=abs((p_extr1aux(i)-p_extr1(m))/p_extr1(m)); if difp_extr1(i)<= min(difp_extr1) h_extr1(m)=h_aux1(i); s_extr1=s_aux1(i); end end T_sat7=XSteam('Tsat_p',0.97*p_extr7(m)); T_sat6=XSteam('Tsat_p',0.97*p_extr6(m)); T_sat5=XSteam('Tsat_p',0.97*p_extr5(m)); T_sat4=XSteam('Tsat_p',0.97*p_extr4(m)); T_sat3=XSteam('Tsat_p',0.97*p_extr3(m)); T_sat2=XSteam('Tsat_p',0.97*p_extr2(m)); T_sat1=XSteam('Tsat_p',0.97*p_extr1(m)); T_salprec7=T_sat7-DTT; T_salprec6=T_sat6-DTT; T_salprec5=T_sat5-DTT; T_salprec4=T_sat4-DTT; T_salprec3=T_sat3-DTT; T_salprec2=T_sat2-DTT; T_salprec1=T_sat1-DTT; h_salprec7=XSteam('h_pT',p_entcald,T_salprec7); h_salprec6=XSteam('h_pT',p_entcald,T_salprec6); h_salprec5=XSteam('h_pT',0.97*p_extr5(m),T_salprec5); h_salprec4=XSteam('h_pT',0.97*p_extr5(m),T_salprec4); h_salprec3=XSteam('h_pT',0.97*p_extr5(m),T_salprec3); h_salprec2=XSteam('h_pT',0.97*p_extr5(m),T_salprec2); h_salprec1=XSteam('h_pT',0.97*p_extr5(m),T_salprec1); h_cond=XSteam('hL_p',p_8); h_sat7=XSteam('hL_p',0.97*p_extr7(m)); h_sat6=XSteam('hL_p',0.97*p_extr6(m)); h_sat5=XSteam('hL_p',0.97*p_extr5(m)); h_sal7=c_p*(DC+T_salprec6); h_sal6=c_p*(DC+T_salprec5); h_sal5=XSteam('h_pT',0.97*p_extr5(m),T_salprec4); h_sat4=XSteam('hL_p',0.97*p_extr4(m)); h_sat3=XSteam('hL_p',0.97*p_extr3(m)); h_sat2=XSteam('hL_p',0.97*p_extr2(m)); h_sat1=XSteam('hL_p',0.97*p_extr1(m)); h_sal4=c_p*(DC+T_salprec3); h_sal3=c_p*(DC+T_salprec2); h_sal2=c_p*(DC+T_salprec1); T_cond=XSteam('Tsat_p',p_8); h_sal1=c_p*(DC+T_cond); m_extr7(m)=(m_vv(m)*(h_salprec7-h_salprec6))/(h_extr7(m)-h_sal7); m_extr6(m)=(m_vv(m)*(h_salprec6-h_salprec5)-(m_extr7(m)*(h_sal7-h_sal6)))/(h_extr6(m)-h_sal6); m_extr5(m)=(m_vv(m)*(h_salprec5-h_salprec4)-(m_extr7(m)*(h_sal7-h_sal6))-((m_extr7(m)+m_extr6(m))*(h_sal6-h_sal5)))/(h_extr5(m)-h_sal5); m_cond(m)=m_vv(m)-m_extr7(m)-m_extr6(m)-m_extr5(m); m_extr4(m)=(m_cond(m)*(h_salprec4-h_salprec3))/(h_extr4(m)-h_sal4); m_extr3(m)=(m_cond(m)*(h_salprec3-h_salprec2)-(m_extr4(m)*(h_sal4-h_sal3)))/(h_extr3(m)-h_sal3); m_extr2(m)=(m_cond(m)*(h_salprec2-h_salprec1)-(m_extr4(m)*(h_sal4-h_sal3))-((m_extr4(m)+m_extr3(m))*(h_sal3-h_sal2)))/(h_extr2(m)-h_sal2); m_extr1(m)=(m_cond(m)*(h_salprec1-h_cond)-(m_extr4(m)*(h_sal4-h_sal3))-((m_extr4(m)+m_extr3(m))*(h_sal3-h_sal2))-((m_extr4(m)+m_extr3(m)+m_extr2(m))*(h_sal2-h_sal1)))/(h_extr1(m)-h_sal1); p_entcald=1.25*p_3; p_desg=p_extr5(m)*(1-0.03); if tbomba==1 eta_bomba=-1.00000000E-02+1.89200000E+00*TFratio-1.04000000E+00*TFratio^2; deltaH_bomba=(p_entcald-p_desg)/(10*eta_bomba); m_bomba=(m_vv(m)+m_mu)/3600; W_bomba=m_bomba*deltaH_bomba; W_bombalp=(m_cond(m)*(p_extr5(m)-p_8))/(10*3600*eta_bomba); p_escbfpt=p_8+0.017; h_escbfpts=XSteam('h_ps',p_escbfpt,s_4); eta_bfpt=7.80000000E-01-6.00000000E-02*TFratio+8.00000000E-02*TFratio^2; h_escbfpt=h_4(m)-eta_bfpt*(h_4(m)-h_escbfpts); %notar la diferencia entre isentropico y no isentropico 'escbfpt vs escbfpts' h_bfpt(m)=h_extr5(m); deltaH_bfpt=h_bfpt(m)-h_escbfpt; m_bfpt(m)=((W_bomba+W_bombalp)/deltaH_bfpt)*3600; gastobombaelec(m)=0; else m_bfpt(m)=0; h_bfpt(m)=0; gastobombaelec(m)=((m_vv(m)+m_mu)*(p_entcald-0.97*p_extr5(m))+(m_cond(m)*(p_extr5(m)-p_8)))/(10*0.75*3600); end v_slo45=XSteam('v_ph',p_4,h_4(m)); m_slo45(m)=281.48*sqrt(p_4/v_slo45); v_slo5=XSteam('v_ph',p_extr5(m),h_4(m)); m_slo5(m)=440.38*sqrt(p_extr5(m)/v_slo5); v_slo2=XSteam('v_ph',p_iv,h_3); m_vslo2(m)=22.7*sqrt(p_iv/v_slo2); m_shell(m)=m_vslo2(m)+m_slo5(m)+m_slo6(m); if m_shell(m) < 2360 m_vv(m)=m_vv(m)-2360+m_shell(m); end h_gslo(m)=3.20844668E+03-3.14113463E-06*m_vv(m)+7.03296886E-11*m_vv(m)^2; %ecuaciones sacadas de la tabla 3 fugas y pérd. mecanicas p_gslo=8.26205534E-01+8.55184440E-05*m_vv(m)+5.66588017E-12*m_vv(m)^2; v_gslo=XSteam('v_ph',p_gslo,h_gslo(m)); m_gslo(m)=215.8*sqrt(p_govhp/v_gslo); h_vslo12(m)=h_3; h_slo45(m)=h_4(m); m_vslo12(m)=25.42*sqrt(p_3/v_3); m_eschp(m)=m_vv(m)-m_vslo12(m)-m_gslo(m)-m_slo45(m); m_ip(m)=m_vv(m)-m_vslo12(m)-m_slo45(m)-m_extr7(m); m_lp(m)=m_ip(m)-m_extr6(m)-m_extr5(m)-m_bfpt(m)-m_slo6(m); m_esclpn(m)=m_lp(m)-m_extr4(m)-m_extr3(m)-m_extr2(m)-m_extr1(m); difmesclp(m)=abs((m_esclp(m)-m_esclpn(m))/m_esclpn(m)); if difmesclp(m) > 0.01 m_esclp(m)=m_esclpn(m); end %m_corteip=m_vv-m_vslo12-m_gslo-m_slo45-m_extr7n; %m_ip=m_corteip+m_gslo; %p_extr6n=16.74*(m_ip-m_extr7n-m_extr6n)*1e-6; %p_extr5n=9.01*(m_ip-m_extr7n-m_extr6n-m_extr5n)*1e-6; %m_lpn=m_ip-m_extr6n-m_extr5n-m_bfpt-m_slo6; %p_extr4n=3.63*(m_lpn-m_extr4n)*1e-6; %p_extr3n=1.36*(m_lpn-m_extr4n-m_extr3n)*1e-6; %p_extr2n=0.76*(m_lpn-m_extr4n-m_extr3n-m_extr2n)*1e-6; %p_extr1n=0.39*(m_lpn-m_extr4n-m_extr3n-m_extr2n-m_extr1n)*1e-6; m_7(m)=m_vv(m)-m_extr7(m); m_6(m)=m_7(m)-m_extr6(m); m_5(m)=m_6(m)-m_extr5(m); m_4(m)=m_5(m)-m_extr4(m); m_3(m)=m_4(m)-m_extr3(m); m_2(m)=m_3(m)-m_extr2(m); m_1(m)=m_2(m)-m_extr1(m); p_extr1n(m)=sqrt(m_1(m)^2*T_extr1*Yd_extr1+p_8^2); p_extr2n(m)=sqrt(m_2(m)^2*T_extr2*Yd_extr2+p_extr1(m)^2); p_extr3n(m)=sqrt(m_3(m)^2*T_extr3*Yd_extr3+p_extr2(m)^2); p_extr4n(m)=sqrt(m_4(m)^2*T_extr4*Yd_extr4+p_extr3(m)^2); p_extr5n(m)=sqrt(m_5(m)^2*T_extr5*Yd_extr5+p_extr4(m)^2); p_extr6n(m)=sqrt(m_6(m)^2*T_extr6*Yd_extr6+p_extr5(m)^2); p_extr7n(m)=sqrt(m_7(m)^2*T_extr7*Yd_extr7+p_extr6(m)^2); if m_extr7==0 desviop_extr(7)=0; else desviop_extr(7)=abs(p_extr7(m)-p_extr7n(m))/p_extr7n(m); end if m_extr6==0 desviop_extr(6)=0; else desviop_extr(6)=abs(p_extr6(m)-p_extr6n(m))/p_extr6n(m); end if m_extr5==0 desviop_extr(5)=0; else desviop_extr(5)=abs(p_extr5(m)-p_extr5n(m))/p_extr5n(m); end if m_extr4==0 desviop_extr(4)=0; else desviop_extr(4)=abs(p_extr4(m)-p_extr4n(m))/p_extr4n(m); end if m_extr3==0 desviop_extr(3)=0; else desviop_extr(3)=abs(p_extr3(m)-p_extr3n(m))/p_extr3n(m); end if m_extr2==0 desviop_extr(2)=0; else desviop_extr(2)=abs(p_extr2(m)-p_extr2n(m))/p_extr2n(m); end if m_extr1==0 desviop_extr(1)=0; else desviop_extr(1)=abs(p_extr1(m)-p_extr1n(m))/p_extr1n(m); end % m_extr1n % m_extr2n % m_extr3n % m_extr4n % m_extr5n % m_extr6n % m_extr7n desvp_extr=max(desviop_extr) difmesclp(m) if desvp_extr > 0.05 p_extr7(m)=p_extr7n(m); p_extr6(m)=p_extr6n(m); p_extr5(m)=p_extr5n(m); p_extr4(m)=p_extr4n(m); p_extr3(m)=p_extr3n(m); p_extr2(m)=p_extr2n(m); p_extr1(m)=p_extr1n(m); end end end end end %este bucle es una preparación de los datos para sacar en pantalla for r=M:N h_4a=h_4(r);%salida hp h_8a=h_8(r);%salida lp m_vslo12a=m_vslo12(r); h_vslo12a=h_vslo12(r); m_gsloa=m_gslo(r); h_gsloa=h_gslo(r); m_slo45a=m_slo45(r); h_slo45a=h_slo45(r); m_eschpa=m_eschp(r); m_ipa=m_ip(r); m_lpa=m_lp(r); h_5a=h_5(r);%entrada ip h_6a=h_6(r);%entrada lp m_extr6a=m_extr6(r); h_extr6a=h_extr6(r); m_extr5a=m_extr5(r); h_extr5a=h_extr5(r); m_extr4a=m_extr4(r); h_extr4a=h_extr4(r); m_extr3a=m_extr3(r); h_extr3a=h_extr3(r); m_extr2a=m_extr2(r); h_extr2a=h_extr2(r); m_extr1a=m_extr1(r); h_extr1a=h_extr1(r); m_bfpta=m_bfpt(r); h_bfpta=h_bfpt(r); m_slo6a=m_slo6(r); h_slo6a=h_slo6(r); m_esclpa=m_esclp(r); T_entcal=T_salprec7; h_salprec7=Xsteam('h_pT',p_entcald,T_entcal); W_hp(r)=(m_vv(r)*h_3-m_vslo12a*h_vslo12a-m_gsloa*h_gsloa-m_slo45a*h_slo45a-m_eschpa*h_4a)/3600; W_ip(r)=(m_ipa*h_5a-m_extr6a*h_extr6a-m_extr5a*h_extr5a-m_bfpta*h_bfpta-m_slo6a*h_slo6a-m_lpa*h_6a)/3600; W_lp(r)=(m_lpa*h_6a-m_extr4a*h_extr4a-m_extr3a*h_extr3a-m_extr2a*h_extr2a-m_extr1a*h_extr1a-m_esclpa*h_8a)/3600; W_total1(r)=W_hp(r)+W_ip(r)+W_lp(r); w_consumida(r)=((m_vv(r)+m_mu)*(h_3-h_salprec7)+m_rec(m)*(h_5(r)-h_4(r)))/3600; eta_total1(r)=W_total1(r)/w_consumida(r); end m_extr1 m_extr2 m_extr3 m_extr4 m_extr5 m_extr6 m_extr7 gastobombaelec W_total1 %bruto eta_total1 %bruto W_total=W_total1(N); eta_total=eta_total1(N); AnulVel=m_esclp*v_esclp*(1-Y)/(3600*A_an*0.0929) v_esclp=XSteam('vV_p',p_8) m_esclp Y etahp1 etaip1 W_hp W_ip W_lp HR=1./eta_total1 m_lp m_ip %pérdidas mecánicas y de generador for r=M:N if J==1 GenRat=(W_total1(r)/PF)*1e-3; Ratio=GenRat*1e3/Genmax1; MechLoss1(r)=7.49285714E+02-2.73214286E-01*1.1*Genmax1*1e-3+3.30357143E-03*(1.1*Genmax1*1e-3)^2; MechLoss2(r)=0; K1=1.49846324E+00-6.31706555E-03*GenRat+3.01774969E-05*GenRat^2-4.89234402E-08*GenRat^3; K2=4.67246032E+00-1.37708393E+01*Ratio+1.75519481E+01*Ratio^2-7.48316498E+00*Ratio^3; GenLoss1(r)=GenRat*1e3*(K1/100)*K2; GenLoss2(r)=0; end if J==2 GenRat=(W_total1(r)/PF)*1e-3; Ratio=GenRat*1e3/Genmax1; MechLoss1(r)=7.49285714E+02-2.73214286E-01*Genmax1*1e-3+3.30357143E-03*(Genmax1*1e-3)^2; MechLoss2(r)=0; K1=1.42371478E+00-5.46835091E-04*GenRat+4.27759975E-07*GenRat^2-1.02028548E-10*GenRat^3; K2=3.30246032E+00-9.36326359E+00*Ratio+1.22489177E+01*Ratio^2-5.21043771E+00*Ratio^3; GenLoss1(r)=GenRat*1e3*(K1/100)*K2; GenLoss2(r)=0; end if J==3 GenRat1=(W_hp(r)/PF)*1e-3; GenRat2=((W_ip(r)+W_lp(r))/PF)*1e-3; Ratio1=GenRat1*1e3/Genmax1; Ratio2=GenRat2*1e3/Genmax2; MechLoss1(r)=7.49285714E+02-2.73214286E-01*1.1*Genmax1*1e-3+3.30357143E-03*(1.1*Genmax1*1e-3)^2; MechLoss2(r)=7.49285714E+02-2.73214286E-01*1.1*Genmax2*1e-3+3.30357143E-03*(1.1*Genmax2*1e-3)^2; K11=1.49846324E+00-6.31706555E-03*GenRat1+3.01774969E-05*GenRat1^2-4.89234402E-08*GenRat1^3; K21=4.67246032E+00-1.37708393E+01*Ratio1+1.75519481E+01*Ratio1^2-7.48316498E+00*Ratio1^3; GenLoss1(r)=GenRat1*1e3*(K11/100)*K21; K12=1.21427632E+00-2.36575815E-03*GenRat2+6.33364662E-06*GenRat2^2-6.27192982E-09*GenRat2^3; K22=4.67246032E+00-1.37708393E+01*Ratio2+1.75519481E+01*Ratio2^2-7.48316498E+00*Ratio2^3; GenLoss2(r)=GenRat2*1e3*(K12/100)*K22; end if J==4 GenRat1=(W_hp(r)/PF)*1e-3; GenRat2=((W_ip(r)+W_lp(r))/PF)*1e-3; Ratio1=GenRat1*1e3/Genmax1; Ratio2=GenRat2*1e3/Genmax2; MechLoss1(r)=7.49285714E+02-2.73214286E-01*Genmax1*1e-3+3.30357143E-03*(Genmax1*1e-3)^2; MechLoss2(r)=7.49285714E+02-2.73214286E-01*Genmax2*1e-3+3.30357143E-03*(Genmax2*1e-3)^2; K11=1.42371478E+00-5.46835091E-04*GenRat1+4.27759975E-07*GenRat1^2-1.02028548E-10*GenRat1^3; K21=3.30246032E+00-9.36326359E+00*Ratio1+1.22489177E+01*Ratio1^2-5.21043771E+00*Ratio1^3; GenLoss1(r)=GenRat1*1e3*(K11/100)*K21; K12=1.32371478E+00-5.46835091E-04*GenRat2+4.27759975E-07*GenRat2^2-1.02028548E-10*GenRat2^3; K22=2.35484127E+00-5.57199375E+00*Ratio2+6.86688312E+00*Ratio2^2-2.65993266E+00*Ratio2^3; GenLoss2(r)=GenRat2*1e3*(K12/100)*K22; end if J==5 GenRat1=((W_hp(r)+W_ip(r))/PF)*1e-3; GenRat2=(W_lp(r)/PF)*1e-3; Ratio1=GenRat1*1e3/Genmax1; Ratio2=GenRat2*1e3/Genmax2; MechLoss1(r)=7.49285714E+02-2.73214286E-01*1.1*Genmax1*1e-3+3.30357143E-03*(1.1*Genmax1*1e-3)^2; MechLoss2(r)=7.49285714E+02-2.73214286E-01*1.1*Genmax2*1e-3+3.30357143E-03*(1.1*Genmax2*1e-3)^2; K11=1.49846324E+00-6.31706555E-03*GenRat1+3.01774969E-05*GenRat1^2-4.89234402E-08*GenRat1^3; K21=4.67246032E+00-1.37708393E+01*Ratio1+1.75519481E+01*Ratio1^2-7.48316498E+00*Ratio1^3; GenLoss1(r)=GenRat1*1e3*(K11/100)*K21; K12=1.21427632E+00-2.36575815E-03*GenRat2+6.33364662E-06*GenRat2^2-6.27192982E-09*GenRat2^3; K22=4.67246032E+00-1.37708393E+01*Ratio2+1.75519481E+01*Ratio2^2-7.48316498E+00*Ratio2^3; GenLoss2(r)=GenRat2*1e3*(K12/100)*K22; end if J==6 GenRat1=((W_hp(r)+W_ip(r))/PF)*1e-3; GenRat2=(W_lp(r)/PF)*1e-3; Ratio1=GenRat1*1e3/Genmax1; Ratio2=GenRat2*1e3/Genmax2; MechLoss1(r)=7.49285714E+02-2.73214286E-01*Genmax1*1e-3+3.30357143E-03*(Genmax1*1e-3)^2; MechLoss2(r)=7.49285714E+02-2.73214286E-01*Genmax2*1e-3+3.30357143E-03*(Genmax2*1e-3)^2; K11=1.42371478E+00-5.46835091E-04*GenRat1+4.27759975E-07*GenRat1^2-1.02028548E-10*GenRat1^3; K21=3.30246032E+00-9.36326359E+00*Ratio1+1.22489177E+01*Ratio1^2-5.21043771E+00*Ratio1^3; GenLoss1(r)=GenRat1*1e3*(K11/100)*K21; K12=1.32371478E+00-5.46835091E-04*GenRat2+4.27759975E-07*GenRat2^2-1.02028548E-10*GenRat2^3; K22=2.35484127E+00-5.57199375E+00*Ratio2+6.86688312E+00*Ratio2^2-2.65993266E+00*Ratio2^3; GenLoss2(r)=GenRat2*1e3*(K12/100)*K22; end end GenLoss1 GenLoss2 MechLoss1 MechLoss2 W_totalneta=W_total1-GenLoss1-GenLoss2-MechLoss1-MechLoss2-gastobombaelec eta_totalneta=W_totalneta./w_consumida p_extr1 p_extr2 p_extr3 p_extr4 p_extr5 p_extr6 p_extr7