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/ 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 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 K_PAR Parameter description. CL K_LIG Equation description. CL K_BET Condition description. CL K_MED Media description. C C Subroutines : COMINF C CP Programmer : Bent Lorentzen 1994 CP Lab. for Energetics, DTU, Denmark. C*********************************************************************** C C Include the common "environment" C INCLUDE ’ENVIRO.INI’ C C Parameter variables C INTEGER ANTLK, ANTKN, MEDIE(2), & ANTM1, ANTME, VARME(2) DOUBLE PRECISION RES(1), P(2), MDOT(2) CHARACTER*80 KOMTY C C Local variables C INTEGER K_MED(2) CHARACTER*100 K_PAR(1),K_STAT(1) CHARACTER*500 K_LIG(1), K_BET CHARACTER*1000 KOMDSC,K_INP CHARACTER*100 KMEDDS(2) EXTERNAL COMINF C======================================================================= GOTO (100,200,1,400,400,200) FKOMP 1 RETURN C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− C Component name C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 100 CONTINUE KOMTY = ’PRES_SEP’ GOTO 9999 C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− C Component characteristics C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 200 CONTINUE KOMTY = ’PRES_SEP’ ANTKN = 2 ANTLK = 0 ANTM1 = 2 MEDIE(1) = ANYFLU$ 51/67 19−03−2007

VEnzin.for c:/dna/source/ MEDIE(2) = ANYFLU$ 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 C Pressure balance C c RES(1) = P(1) − P(2) C IF (FKOMP.EQ.5) GOTO 500 GOTO 9999 C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− C Solution check C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 500 CONTINUE IF (MDOT(1).LT.−1D−10) GOTO 450 IF (MDOT(2).GT.1D−10) GOTO 450 GOTO 9999 450 FBETI = .FALSE. GOTO 9999 C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− C Write component information C−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− 600 CONTINUE KOMDSC = ’Utility component for seperating nodes which both have $ assigned the pressure. Can also be used as a throttle valve.’ K_BET = ’$\\dot{m}_1 \\gt 0 \\\\ \\dot{m}_2 \\lt 0$’ KMEDDS(1) = ’Fluid in’ KMEDDS(2) = ’Fluid out’ k_INP=’struc dummy PRES_SEP 1 2\\\\ $media 1 STEAM\\\\ $addco m dummy 1 1 t dummy 1 50 p 1 1 p 2 1’ C GOTO 9999 C 9999 CONTINUE RETURN END C======================================================================= C*********************************************************************** SUBROUTINE SET_X(KOMTY,ANTLK,ANTKN,ANTPK,ANTM1,MEDIE,ANTME $ ,VARME,MDOT,P,H,ZC,PAR,RES,X_J,KOMDSC,K_PAR,K_lig,K_bet $ ,KMEDDS,K_inp) C*********************************************************************** C C SETFLOW1 is a model of a control valve. The valve controls massflow C using an error input from a controller. 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 ZC − INPUT − Control variables. 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 ANTKN − OUTPUT − Number of nodes connected to the component. CA ANTM1 − OUTPUT − Number of massflows in the first conservation of CA mass equation. 52/67 19−03−2007

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

c:/dna/source/<br />

MEDIE(2) = ANYFLU$<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 />

C Pressure balance<br />

C<br />

c RES(1) = P(1) − P(2)<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 450<br />

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

GOTO 9999<br />

450 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 seperating nodes which both have<br />

$ assigned the pressure. Can also be used as a throttle valve.’<br />

K_BET = ’$\\dot{m}_1 \\gt 0 \\\\ \\dot{m}_2 \\lt 0$’<br />

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

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

k_INP=’struc dummy PRES_SEP 1 2\\\\<br />

$media 1 STEAM\\\\<br />

$addco m dummy 1 1 t dummy 1 50 p 1 1 p 2 1’<br />

C<br />

GOTO 9999<br />

C<br />

9999 CONTINUE<br />

RETURN<br />

END<br />

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

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

SUBROUTINE SET_X(KOMTY,ANTLK,ANTKN,ANTPK,ANTM1,MEDIE,ANTME<br />

$ ,VARME,MDOT,P,H,ZC,PAR,RES,X_J,KOMDSC,K_PAR,K_lig,K_bet<br />

$ ,KMEDDS,K_inp)<br />

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

C<br />

C SETFLOW1 is a model of a control valve. The valve controls massflow<br />

C using an error input from a controller.<br />

C<br />

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

C<br />

CA FKOMP − INPUT − Flag with the value:<br />

CA 1: Initialize the component.<br />

CA 2: Initialize with actual system.<br />

CA 3: Fluid composition calculation (constant).<br />

CA 4: Find residuals.<br />

CA 5: Find residuals and check variables.<br />

CA 6: Output information about component.<br />

CA MDOT − INPUT − Massflows from nodes.<br />

CA P − INPUT − Pressure in nodes.<br />

CA H − INPUT − Enthalpy of massflows.<br />

CA ZC − INPUT − Control variables.<br />

CA PAR − INPUT − Parameters of the component.<br />

CA KOMTY − OUTPUT − Component name.<br />

CA ANTPK − OUTPUT − Number of parameters.<br />

CA ANTLK − OUTPUT − Number of equations.<br />

CA ANTEX − OUTPUT − Number of algebraic independent equations.<br />

CA ANTKN − OUTPUT − Number of nodes connected to the component.<br />

CA ANTM1 − OUTPUT − Number of massflows in the first conservation of<br />

CA mass equation.<br />

52/67<br />

19−03−2007

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

Saved successfully!

Ooh no, something went wrong!