C C There are a total of 3 entries in the algebraic variable array. C There are a total of 1 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 x in component main (dimensionless). C ALGBRC(1) is sin in component sin (dimensionless). C STATES(1) is sin in component sin (dimensionless). C CONSTS(1) is deriv_approx_initial_value in component main (dimensionless). C ALGBRC(3) is sin in component sin (dimensionless). C CONSTS(3) is k2_oPi in component sin (dimensionless). C CONSTS(4) is k2Pi in component sin (dimensionless). C CONSTS(5) is kPi_2 in component sin (dimensionless). C CONSTS(6) is kPi in component sin (dimensionless). C CONSTS(7) is kPi_32 in component sin (dimensionless). C ALGBRC(2) is z in component sin (dimensionless). C CONSTS(2) is C in component sin (dimensionless). C RATES(1) is d/dt sin in component sin (dimensionless). C SUBROUTINE initConsts(CONSTS, RATES, STATES) REAL CONSTS(*), RATES(*), STATES(*) CONSTS(1) = 0 CONSTS(2) = 0.75 CONSTS(3) = 2.00000/ 3.14159265358979 CONSTS(4) = 2.00000* 3.14159265358979 CONSTS(5) = 3.14159265358979/2.00000 CONSTS(6) = 3.14159265358979 CONSTS(7) = ( 3.00000* 3.14159265358979)/2.00000 STATES(1) = CONSTS(1) RETURN END SUBROUTINE computeRates(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) RATES(1) = cos(VOI) RETURN END SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) ALGBRC(1) = sin(VOI) ALGBRC(2) = TERNRY(VOI.LT.CONSTS(5), VOI*CONSTS(3) - 0.500000, TERNRY(VOI.LT.CONSTS(6), ( 3.14159265358979 - VOI)*CONSTS(3) - 0.500000, TERNRY(VOI.LT.CONSTS(7), (VOI - 3.14159265358979)*CONSTS(3) - 0.500000, (CONSTS(4) - VOI)*CONSTS(3) - 0.500000) ALGBRC(3) = TERNRY(VOI.LT.CONSTS(5), - ( ALGBRC(2)*ALGBRC(2))+CONSTS(2)+ALGBRC(2), TERNRY(VOI.LT.CONSTS(6), - ( ALGBRC(2)*ALGBRC(2))+CONSTS(2)+ALGBRC(2), TERNRY(VOI.LT.CONSTS(7), ( ALGBRC(2)*ALGBRC(2) - CONSTS(2)) - ALGBRC(2), ( ALGBRC(2)*ALGBRC(2) - CONSTS(2)) - ALGBRC(2)) RETURN END REAL FUNCTION TERNRY(TEST, VALA, VALB) LOGICAL TEST REAL VALA, VALB IF (TEST) THEN TERNRY = VALA ELSE TERNRY = VALB ENDIF RETURN END