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 7 entries in the constant variable array. C C C VOI is time in component environment (hour). C STATES(1) is R in component R (ng_ml). C CONSTS(1) is h in component R (first_order_rate_constant). C CONSTS(2) is c in component R (ng_ml_hr). C CONSTS(3) is b1 in component R (first_order_rate_constant). C ALGBRC(2) is H in component R (dimensionless). C ALGBRC(1) is x in component R (ng_ml). C STATES(2) is T in component T (ng_ml). C STATES(3) is L in component L (ng_ml). C CONSTS(4) is g1 in component L (first_order_rate_constant). C CONSTS(5) is b2 in component L (first_order_rate_constant). C CONSTS(6) is g2 in component T (first_order_rate_constant). C CONSTS(7) is b3 in component T (first_order_rate_constant). C RATES(1) is d/dt R in component R (ng_ml). C RATES(3) is d/dt L in component L (ng_ml). C RATES(2) is d/dt T in component T (ng_ml). C SUBROUTINE initConsts(CONSTS, RATES, STATES) REAL CONSTS(*), RATES(*), STATES(*) STATES(1) = 0.5 CONSTS(1) = 12 CONSTS(2) = 100 CONSTS(3) = 1.29 STATES(2) = 15 STATES(3) = 22 CONSTS(4) = 10 CONSTS(5) = 0.97 CONSTS(6) = 0.7 CONSTS(7) = 1.39 RETURN END SUBROUTINE computeRates(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) RATES(3) = CONSTS(4)*STATES(1) - CONSTS(5)*STATES(3) RATES(2) = CONSTS(6)*STATES(3) - CONSTS(7)*STATES(2) ALGBRC(1) = STATES(2) - CONSTS(2)/CONSTS(1) ALGBRC(2) = TERNRY(ALGBRC(1).GT.0.00000, 1.00000, 0.00000) RATES(1) = (CONSTS(2) - CONSTS(1)*STATES(2))*(1.00000 - ALGBRC(2)) - CONSTS(3)*STATES(1) RETURN END SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) ALGBRC(1) = STATES(2) - CONSTS(2)/CONSTS(1) ALGBRC(2) = TERNRY(ALGBRC(1).GT.0.00000, 1.00000, 0.00000) RETURN END REAL FUNCTION TERNRY(TEST, VALA, VALB) LOGICAL TEST REAL VALA, VALB IF (TEST) THEN TERNRY = VALA ELSE TERNRY = VALB ENDIF RETURN END