Generated Code

The following is f77 code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

C
C There are a total of 9 entries in the algebraic variable array.
C There are a total of 5 entries in each of the rate and state variable arrays.
C There are a total of 11 entries in the constant variable array.
C
C
C VOI is time in component environment (dimensionless).
C ALGBRC(1) is f in component f (dimensionless).
C CONSTS(1) is a in component f (dimensionless).
C STATES(1) is r in component r (dimensionless).
C CONSTS(2) is p in component model_parameters (dimensionless).
C CONSTS(3) is beta in component r (dimensionless).
C CONSTS(4) is alpha in component r (dimensionless).
C ALGBRC(6) is ur0 in component ur0 (dimensionless).
C ALGBRC(4) is m in component m (dimensionless).
C CONSTS(5) is r0 in component model_parameters (dimensionless).
C ALGBRC(5) is y in component y (dimensionless).
C CONSTS(6) is r1 in component model_parameters (dimensionless).
C ALGBRC(3) is ur1 in component ur1 (dimensionless).
C ALGBRC(7) is z in component z (dimensionless).
C CONSTS(7) is t1 in component model_parameters (dimensionless).
C STATES(2) is x1 in component x1 (dimensionless).
C ALGBRC(9) is q in component q (dimensionless).
C CONSTS(8) is d in component q (dimensionless).
C CONSTS(9) is k in component q (dimensionless).
C ALGBRC(8) is uz in component uz (dimensionless).
C STATES(3) is x2 in component x2 (dimensionless).
C CONSTS(10) is t2 in component model_parameters (dimensionless).
C STATES(4) is x3 in component x3 (dimensionless).
C ALGBRC(2) is phi in component phi (dimensionless).
C STATES(5) is h in component h (dimensionless).
C CONSTS(11) is t4 in component model_parameters (dimensionless).
C RATES(1) is d/dt r in component r (dimensionless).
C RATES(2) is d/dt x1 in component x1 (dimensionless).
C RATES(3) is d/dt x2 in component x2 (dimensionless).
C RATES(4) is d/dt x3 in component x3 (dimensionless).
C RATES(5) is d/dt h in component h (dimensionless).
C
      SUBROUTINE initConsts(CONSTS, RATES, STATES)
      REAL CONSTS(*), RATES(*), STATES(*)
      CONSTS(1) = 1.0
      STATES(1) = 0.5
      CONSTS(2) = 1.05
      CONSTS(3) = 1.0
      CONSTS(4) = 1.0
      CONSTS(5) = 0.5
      CONSTS(6) = 1.2
      CONSTS(7) = 0.1
      STATES(2) = 0.0
      CONSTS(8) = 5.0
      CONSTS(9) = 10.5
      STATES(3) = 0.0
      CONSTS(10) = 0.5
      STATES(4) = 0.0
      STATES(5) = 0.0
      CONSTS(11) = 20.0
      RETURN
      END
      SUBROUTINE computeRates(VOI, CONSTS,  RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      RATES(4) = (STATES(3) - STATES(4))/CONSTS(10)
      ALGBRC(1) =  CONSTS(1)*CONSTS(2)*STATES(1) ** 4.00000
      RATES(5) = (ALGBRC(1) - STATES(5))/CONSTS(11)
      ALGBRC(3) = TERNRY(STATES(1).GT.CONSTS(6), 1.00000, 0.00000)
      ALGBRC(5) =  (STATES(1) - CONSTS(6))*ALGBRC(3)
      RATES(2) = (ALGBRC(5) - STATES(2))/CONSTS(7)
      ALGBRC(6) = TERNRY(STATES(1).GT.CONSTS(5), 1.00000, 0.00000)
      ALGBRC(2) = TERNRY(STATES(1).LT.0.250000, 0.00000, TERNRY(STATES(1).GT.2.00000, 0.00000, 1.00000 -  1.30612*(STATES(1) - 1.12500)*(STATES(1) - 1.12500))
      ALGBRC(4) =  STATES(4)*ALGBRC(2)
      RATES(1) =  CONSTS(3)*( CONSTS(2)*STATES(1) - ( CONSTS(4)*STATES(1) - CONSTS(5) ** 2.00000*ALGBRC(6)+ALGBRC(4)))
      ALGBRC(7) = (ALGBRC(5) - STATES(2))/CONSTS(7)
      ALGBRC(8) = TERNRY(ALGBRC(7).GT.0.00000, 1.00000, 0.00000)
      ALGBRC(9) =  CONSTS(9)*(1.00000 - EXP(- ( CONSTS(8)*ALGBRC(7))))*ALGBRC(8)
      RATES(3) = (ALGBRC(9) - STATES(3))/CONSTS(10)
      RETURN
      END
      SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(1) =  CONSTS(1)*CONSTS(2)*STATES(1) ** 4.00000
      ALGBRC(3) = TERNRY(STATES(1).GT.CONSTS(6), 1.00000, 0.00000)
      ALGBRC(5) =  (STATES(1) - CONSTS(6))*ALGBRC(3)
      ALGBRC(6) = TERNRY(STATES(1).GT.CONSTS(5), 1.00000, 0.00000)
      ALGBRC(2) = TERNRY(STATES(1).LT.0.250000, 0.00000, TERNRY(STATES(1).GT.2.00000, 0.00000, 1.00000 -  1.30612*(STATES(1) - 1.12500)*(STATES(1) - 1.12500))
      ALGBRC(4) =  STATES(4)*ALGBRC(2)
      ALGBRC(7) = (ALGBRC(5) - STATES(2))/CONSTS(7)
      ALGBRC(8) = TERNRY(ALGBRC(7).GT.0.00000, 1.00000, 0.00000)
      ALGBRC(9) =  CONSTS(9)*(1.00000 - EXP(- ( CONSTS(8)*ALGBRC(7))))*ALGBRC(8)
      RETURN
      END
      REAL FUNCTION TERNRY(TEST, VALA, VALB)
      LOGICAL TEST
      REAL VALA, VALB
      IF (TEST) THEN
        TERNRY = VALA
      ELSE
        TERNRY = VALB
      ENDIF
      RETURN
      END