Design og modellering af metanolanlæg til VEnzin-visionen Bilag

Design og modellering af metanolanlæg til VEnzin-visionen Bilag Design og modellering af metanolanlæg til VEnzin-visionen Bilag

27.07.2013 Views

VEnzin.for c:/dna/source/ KOMTY = ’SET_M’ GOTO 9999 C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− C Component characteristics C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 200 CONTINUE KOMTY = ’SET_M’ ANTKN = 3 ANTPK = 0 ANTLK = 2 ANTM1 = 2 MEDIE(1) = ANYGAS$ MEDIE(2) = ANYGAS$ MEDIE(3) = 999 ANTME = 2 VARME(1) = NODE1$ VARME(2) = NODE1$ IF (FKOMP.EQ.6) GOTO 600 ** FKOMP = 3 GOTO 9999 C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− C Component equations. All in residual form. C Do not include the conservation laws. These are treated automatically C by DNA. C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 400 CONTINUE C RES(1) = P(1) − P(2) RES(2) = ZC(1)−(X_J(MEDIE(1),H2$)−X_J(MEDIE(1),CO2$))/ $ (X_J(MEDIE(1),CO2$)+X_J(MEDIE(1),CO$)) C IF (FKOMP.EQ.5) GOTO 500 GOTO 9999 C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− C Solution check C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 500 CONTINUE IF (MDOT(1).LT.−1D−10) GOTO 550 IF (MDOT(2).GT.1D−10) GOTO 550 IF (X_J(MEDIE(1),CO$)+X_J(MEDIE(1),CO2$).LT.1D−3) GOTO 550 GOTO 9999 550 FBETI = .FALSE. GOTO 9999 C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− C Write component information C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 600 CONTINUE KOMDSC = ’Utility component for setting the M−factor for a syngas $ used for production of a liquid fuel. The M−factor is defined $ in the equations below. If the M−factor is 2 for methanol $ production it means that all the syngas in theory can be $ converted to methanol. The M−factor is defined as a control $ variable (ZC).’ K_LIG(1) = ’Equal pressures: $p_1 = p_2$’ K_LIG(2) = $ ’M−factor: $ZC(1)=\\frac{y_{H_2}−y_{CO_2}}{y_{CO_2}+y_{CO}}$’ K_BET = ’$\\dot{m_1} \\gt 0 \\\\ \\dot{m_2} \\lt 0 \\\\ $y_{CO}+y_{CO_2} \\gt 0$’ KMEDDS(1) = ’Gas in’ KMEDDS(2) = ’Gas out’ KMEDDS(3) = ’M−factor’ K_INP=’struc set−M SET_M 611 612 900\\\\ $MEDIA 611 gas\\\\ $fluid gas N2 0.1 H2 0.6 CO 0.1 CO2 0.2\\\\ $addco m set−M 611 1 t set−M 611 50 p 611 1’ C GOTO 9999 C 9999 CONTINUE RETURN END C C======================================================================= C*********************************************************************** SUBROUTINE GASCOOL4(KOMTY,ANTLK,ANTKN,ANTPK,ANTM1,ANTM2,MEDIE, $ ANTME,VARME,ANTEL,VAREL,MDOT,P,H,Q,PAR,RES,X_J,ZA,ZANAM,ZC, $ ANTEX,KOMDSC,K_PAR,K_lig,K_bet,KMEDDS,K_inp) C*********************************************************************** 29/67 19−03−2007

VEnzin.for c:/dna/source/ C C GASCOOL1 is a model of a gas cooler with steam condensation. C The model does not include equations concerning the heat exchange. C 1−2 is the heat emitting fluid. C C*********************************************************************** C CA FKOMP − INPUT − Flag with the value: CA 1: Initialize the component. CA 2: Initialize with actual system. CA 3: Fluid composition calculation (constant). CA 4: Find residuals. CA 5: Find residuals and check variables. CA 6: Output information about component. CA MDOT − INPUT − Massflows from nodes. CA P − INPUT − Pressure in nodes. CA H − INPUT − Enthalpy of massflows. CA PAR − INPUT − Parameters of the component. CA KOMTY − OUTPUT − Component name. CA ANTPK − OUTPUT − Number of parameters. CA ANTLK − OUTPUT − Number of equations. CA ANTEX − OUTPUT − Number of algebraic independent equations. CA ANTED − OUTPUT − Number of differential independent equations. CA ANTKN − OUTPUT − Number of nodes connected to the component. CA ANTM1 − OUTPUT − Number of massflows in the first conservation of CA mass equation. CA ANTM2 − OUTPUT − Number of massflows in the second. CA DYCOM − OUTPUT − Type of conservation equations (static or dynamic CA mass and internal energy on side 1 and 2 respectively; CA and dynamic solid internal energy). CA MEDIE − IN/OUT − Media (fluid) of the connected nodes. CA The values mean: CA 99 : Water. CA ANTME − OUTPUT − Number of fluids with variable composition. CA RES − OUTPUT − Residuals for the component. C CL T1,T2 Temperature in first and second node. CL T3,T4 Temperature in third and fourth node. CL S Entropy. CL V Specific volume. CL X Quality. CL U Internal energy. CL DPA,DPB Pressure loss in heat exchanger. CL K_PAR Parameter description. CL K_LIG Equation description. CL K_BET Condition description. CL K_MED Media description. C C Subroutines : STATES C CP Programmer : Brian Elmegaard 2000 CP Dept. of Energy Eng., DTU, Denmark. C*********************************************************************** C C Include the common "environment" C INCLUDE ’ENVIRO.INI’ INCLUDE ’THERPROP.DEC’ C C Parameter variables C INTEGER ANTLK, ANTKN, MEDIE(8), ANTPK, ANTEX, & ANTM1, ANTM2, ANTME, VARME(4), ANTEL(4), & VAREL(ANTST,4) DOUBLE PRECISION RES(60), MDOT(6), P(6), H(6), Q, PAR(3), & X_J(MAXME,ANTST),ZA(12),ZC(1) CHARACTER*80 KOMTY,ZANAM(12) C C Local variables C INTEGER K_MED(6),I DOUBLE PRECISION V, S, U,M_BL1,M_BL2, T1, T2, T3, T4, T5,T6, X, : NIN,NOUT,NINST,NSTOUT,NCOND,PSTOUT,X0,HD,XSTOUT,H3,H4 $ ,X1,HPH,TPH,HSAT0,TPL,TPL1,TPH1,DTP,PMEOUT,XMEOUT,NCOND_MEOH $ ,NINME,NMEOUT,HPH_min,NCONDST,NCONDME,XST,XME,N,E1,E2,Ntotal $ ,HPHME,HPHST,PST,PME,HST,HME,HPH2,MPH,HSTV,HMEV,HPLST,HPLME $ ,TPHST,TPHME,TPLST,TPLME,TPHME2,TPHST2,b_2_1,b_1_2,alpha,R_u $ ,T_K,tau_2_1,tau_1_2,gamma_2,gamma_1,y_ME,y_ST,x_ME,x_ST,P_ME 30/67 19−03−2007

<strong>VEnzin</strong>.for<br />

c:/dna/source/<br />

KOMTY = ’SET_M’<br />

GOTO 9999<br />

C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

C Component characteristics<br />

C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

200 CONTINUE<br />

KOMTY = ’SET_M’<br />

ANTKN = 3<br />

ANTPK = 0<br />

ANTLK = 2<br />

ANTM1 = 2<br />

MEDIE(1) = ANYGAS$<br />

MEDIE(2) = ANYGAS$<br />

MEDIE(3) = 999<br />

ANTME = 2<br />

VARME(1) = NODE1$<br />

VARME(2) = NODE1$<br />

IF (FKOMP.EQ.6) GOTO 600<br />

** FKOMP = 3<br />

GOTO 9999<br />

C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

C Component equations. All in residual form.<br />

C Do not include the conservation laws. These are treated automatically<br />

C by DNA.<br />

C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

400 CONTINUE<br />

C<br />

RES(1) = P(1) − P(2)<br />

RES(2) = ZC(1)−(X_J(MEDIE(1),H2$)−X_J(MEDIE(1),CO2$))/<br />

$ (X_J(MEDIE(1),CO2$)+X_J(MEDIE(1),CO$))<br />

C<br />

IF (FKOMP.EQ.5) GOTO 500<br />

GOTO 9999<br />

C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

C Solution check<br />

C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

500 CONTINUE<br />

IF (MDOT(1).LT.−1D−10) GOTO 550<br />

IF (MDOT(2).GT.1D−10) GOTO 550<br />

IF (X_J(MEDIE(1),CO$)+X_J(MEDIE(1),CO2$).LT.1D−3) GOTO 550<br />

GOTO 9999<br />

550 FBETI = .FALSE.<br />

GOTO 9999<br />

C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

C Write component information<br />

C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

600 CONTINUE<br />

KOMDSC = ’U<strong>til</strong>ity component for setting the M−factor for a syngas<br />

$ used for production of a liquid fuel. The M−factor is defined<br />

$ in the equations below. If the M−factor is 2 for methanol<br />

$ production it means that all the syngas in theory can be<br />

$ converted to methanol. The M−factor is defined as a control<br />

$ variable (ZC).’<br />

K_LIG(1) = ’Equal pressures: $p_1 = p_2$’<br />

K_LIG(2) =<br />

$ ’M−factor: $ZC(1)=\\frac{y_{H_2}−y_{CO_2}}{y_{CO_2}+y_{CO}}$’<br />

K_BET = ’$\\dot{m_1} \\gt 0 \\\\ \\dot{m_2} \\lt 0 \\\\<br />

$y_{CO}+y_{CO_2} \\gt 0$’<br />

KMEDDS(1) = ’Gas in’<br />

KMEDDS(2) = ’Gas out’<br />

KMEDDS(3) = ’M−factor’<br />

K_INP=’struc set−M SET_M 611 612 900\\\\<br />

$MEDIA 611 gas\\\\<br />

$fluid gas N2 0.1 H2 0.6 CO 0.1 CO2 0.2\\\\<br />

$addco m set−M 611 1 t set−M 611 50 p 611 1’<br />

C<br />

GOTO 9999<br />

C<br />

9999 CONTINUE<br />

RETURN<br />

END<br />

C<br />

C=======================================================================<br />

C***********************************************************************<br />

SUBROUTINE GASCOOL4(KOMTY,ANTLK,ANTKN,ANTPK,ANTM1,ANTM2,MEDIE,<br />

$ ANTME,VARME,ANTEL,VAREL,MDOT,P,H,Q,PAR,RES,X_J,ZA,ZANAM,ZC,<br />

$ ANTEX,KOMDSC,K_PAR,K_lig,K_bet,KMEDDS,K_inp)<br />

C***********************************************************************<br />

29/67<br />

19−03−2007

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!