C C There are a total of 2 entries in the algebraic variable array. C There are a total of 3 entries in each of the rate and state variable arrays. C There are a total of 8 entries in the constant variable array. C C C VOI is time in component environment (hour). C STATES(1) is R in component R (pg_ml). C CONSTS(1) is L_ in component R (ng_ml). C CONSTS(2) is T_ in component R (ng_ml). C CONSTS(3) is dR in component R (first_order_rate_constant). C CONSTS(4) is rR in component R (ng_ml_min). C ALGBRC(2) is H in component R (dimensionless). C ALGBRC(1) is x in component R (dimensionless). C STATES(2) is L in component L (ng_ml). C STATES(3) is T in component T (ng_ml). C CONSTS(5) is dL in component L (first_order_rate_constant). C CONSTS(6) is rL in component L (first_order_rate_constant). C CONSTS(7) is dT in component T (first_order_rate_constant). C CONSTS(8) is rT in component T (first_order_rate_constant). C RATES(1) is d/dt R in component R (pg_ml). C RATES(2) is d/dt L in component L (ng_ml). C RATES(3) is d/dt T in component T (ng_ml). C SUBROUTINE initConsts(CONSTS, RATES, STATES) REAL CONSTS(*), RATES(*), STATES(*) STATES(1) = 0.0 CONSTS(1) = 30.0 CONSTS(2) = 8.0 CONSTS(3) = 0.10 CONSTS(4) = 0.1 STATES(2) = 10.0 STATES(3) = 12.0 CONSTS(5) = 0.015 CONSTS(6) = 5.0 CONSTS(7) = 0.023 CONSTS(8) = 0.01 RETURN END SUBROUTINE computeRates(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) RATES(2) = CONSTS(6)*STATES(1) - CONSTS(5)*STATES(2) RATES(3) = CONSTS(8)*STATES(2) - CONSTS(7)*STATES(3) ALGBRC(1) = 2.00000 - (STATES(2)/CONSTS(1)+STATES(3)/CONSTS(2)) ALGBRC(2) = TERNRY(ALGBRC(1).LT.0.00000, 0.00000, TERNRY(ALGBRC(1).EQ.0.00000, 0.500000, TERNRY(ALGBRC(1).GT.0.00000, 1.00000, 0.0/0.0) RATES(1) = CONSTS(4)*ALGBRC(2) - CONSTS(3)*STATES(1) RETURN END SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) ALGBRC(1) = 2.00000 - (STATES(2)/CONSTS(1)+STATES(3)/CONSTS(2)) ALGBRC(2) = TERNRY(ALGBRC(1).LT.0.00000, 0.00000, TERNRY(ALGBRC(1).EQ.0.00000, 0.500000, TERNRY(ALGBRC(1).GT.0.00000, 1.00000, 0.0/0.0) RETURN END REAL FUNCTION TERNRY(TEST, VALA, VALB) LOGICAL TEST REAL VALA, VALB IF (TEST) THEN TERNRY = VALA ELSE TERNRY = VALB ENDIF RETURN END