Calculator Procedure - Examples

Assignment Statements

 

10 R(1) = P(1) * C(2)

15 V(2) = V(3) ** 2 + LOG(P(2))

20 R(4) = V(2) + CMW(15)

 

Flow Control Statements

 

$ FORTRAN IF statement

30 IF (ABS(R(1)). LE. 0.001) GOTO 45

.................. 

GOTO 70

 

$ FORTRAN DO LOOPS

45 DO 55 IS1 = STRM004, STRM009

50 V(2) = V(2) + SCMR(2, IS1)

55 CONTINUE

 

Stream Property Storage Sub-routines

 

$ Store elements V(12) - V(15) as the weight flow rates of components 2-5 in stream FD1.

70 CALL SRVSTR ( SCWR, V(12), FD1, 2, 5 )

 

$ Store the value of element 14 from array "R" as the temperature of stream SR4

 80 CALL SRXSTR ( STEMP, R(14), SR4 )

 

Print Control Statements

 

Open file SIMLATN.CAL and print elements R(2) - R(10) and P(1) - P(5)

 90 OPEN (FILE = SIMLATN, OVERWRITE)

100 OUTPUT { R( 2:10), P( 1:5) }