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 14 entries in the algebraic variable array.
C There are a total of 7 entries in each of the rate and state variable arrays.
C There are a total of 24 entries in the constant variable array.
C
C
C VOI is time in component environment (second).
C ALGBRC(1) is Vm in component membrane (millivolt).
C CONSTS(1) is Cm in component membrane (microfarad).
C ALGBRC(12) is I_b in component I_b (nanoampere).
C ALGBRC(3) is I_Kir in component I_Kir (nanoampere).
C ALGBRC(10) is I_Shkr in component I_Shkr (nanoampere).
C ALGBRC(14) is I_stim in component I_stim (nanoampere).
C STATES(1) is VmReal in component membrane (millivolt).
C CONSTS(2) is GKir in component I_Kir (microsiemens).
C CONSTS(3) is aKir in component I_Kir (dimensionless).
C CONSTS(4) is bKir in component I_Kir (dimensionless).
C CONSTS(24) is EK in component I_Kir (millivolt).
C ALGBRC(2) is OKir in component I_Kir (dimensionless).
C CONSTS(5) is R in component model_parameters (millijoule_per_kelvin_mole).
C CONSTS(6) is T in component model_parameters (kelvin).
C CONSTS(7) is F in component model_parameters (coulomb_per_mole).
C CONSTS(8) is Ko in component model_parameters (millimolar).
C CONSTS(9) is Ki in component model_parameters (millimolar).
C CONSTS(10) is PShkr in component I_Shkr (microlitre_per_second).
C STATES(2) is C0ShkrReal in component I_Shkr (dimensionless).
C STATES(3) is C1ShkrReal in component I_Shkr (dimensionless).
C STATES(4) is C2ShkrReal in component I_Shkr (dimensionless).
C STATES(5) is C3ShkrReal in component I_Shkr (dimensionless).
C STATES(6) is C4ShkrReal in component I_Shkr (dimensionless).
C STATES(7) is OShkrReal in component I_Shkr (dimensionless).
C ALGBRC(4) is C0Shkr in component I_Shkr (dimensionless).
C ALGBRC(5) is C1Shkr in component I_Shkr (dimensionless).
C ALGBRC(6) is C2Shkr in component I_Shkr (dimensionless).
C ALGBRC(7) is C3Shkr in component I_Shkr (dimensionless).
C ALGBRC(8) is C4Shkr in component I_Shkr (dimensionless).
C ALGBRC(9) is OShkr in component I_Shkr (dimensionless).
C ALGBRC(11) is kv in component I_Shkr (first_order_rate_constant).
C ALGBRC(13) is k_v in component I_Shkr (first_order_rate_constant).
C CONSTS(11) is kv0 in component I_Shkr (first_order_rate_constant).
C CONSTS(12) is zv in component I_Shkr (dimensionless).
C CONSTS(13) is k_v0 in component I_Shkr (first_order_rate_constant).
C CONSTS(14) is z_v in component I_Shkr (dimensionless).
C CONSTS(15) is ko in component I_Shkr (first_order_rate_constant).
C CONSTS(16) is k_o in component I_Shkr (first_order_rate_constant).
C CONSTS(17) is Gb in component I_b (microsiemens).
C CONSTS(18) is Eb in component I_b (millivolt).
C CONSTS(19) is stim_start in component I_stim (second).
C CONSTS(20) is stim_end in component I_stim (second).
C CONSTS(21) is stim_period in component I_stim (second).
C CONSTS(22) is stim_duration in component I_stim (second).
C CONSTS(23) is stim_amplitude in component I_stim (nanoampere).
C RATES(1) is d/dt VmReal in component membrane (millivolt).
C RATES(2) is d/dt C0ShkrReal in component I_Shkr (dimensionless).
C RATES(3) is d/dt C1ShkrReal in component I_Shkr (dimensionless).
C RATES(4) is d/dt C2ShkrReal in component I_Shkr (dimensionless).
C RATES(5) is d/dt C3ShkrReal in component I_Shkr (dimensionless).
C RATES(6) is d/dt C4ShkrReal in component I_Shkr (dimensionless).
C RATES(7) is d/dt OShkrReal in component I_Shkr (dimensionless).
C
      SUBROUTINE initConsts(CONSTS, RATES, STATES)
      REAL CONSTS(*), RATES(*), STATES(*)
      CONSTS(1) = 4.5e-6
      STATES(1) = -58.00
      CONSTS(2) = 1e-3
      CONSTS(3) = 0.94
      CONSTS(4) = 1.26
      CONSTS(5) = 8310
      CONSTS(6) = 295
      CONSTS(7) = 9.65e4
      CONSTS(8) = 5
      CONSTS(9) = 140
      CONSTS(10) = 5.4e-9
      STATES(2) = 9.11e-1
      STATES(3) = 8.57e-2
      STATES(4) = 3.02e-3
      STATES(5) = 4.74e-5
      STATES(6) = 2.79e-7
      STATES(7) = 0
      CONSTS(11) = 30
      CONSTS(12) = 1.28
      CONSTS(13) = 2
      CONSTS(14) = -1.53
      CONSTS(15) = 77
      CONSTS(16) = 18
      CONSTS(17) = 6.9e-6
      CONSTS(18) = 0
      CONSTS(19) = 0.1
      CONSTS(20) = 10
      CONSTS(21) = 1
      CONSTS(22) = 0.001
      CONSTS(23) = 0.1
      CONSTS(24) =  (( CONSTS(5)*CONSTS(6))/CONSTS(7))*log(CONSTS(8)/CONSTS(9))
      RETURN
      END
      SUBROUTINE computeRates(VOI, CONSTS,  RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(8) = TERNRY(STATES(6).LT.0.00000, 0.00000, TERNRY(STATES(6).GT.1.00000, 1.00000, STATES(6))
      ALGBRC(9) = TERNRY(STATES(7).LT.0.00000, 0.00000, TERNRY(STATES(7).GT.1.00000, 1.00000, STATES(7))
      RATES(7) =  CONSTS(15)*ALGBRC(8) -  CONSTS(16)*ALGBRC(9)
      ALGBRC(4) = TERNRY(STATES(2).LT.0.00000, 0.00000, TERNRY(STATES(2).GT.1.00000, 1.00000, STATES(2))
      ALGBRC(5) = TERNRY(STATES(3).LT.0.00000, 0.00000, TERNRY(STATES(3).GT.1.00000, 1.00000, STATES(3))
      ALGBRC(1) = TERNRY(ABS(STATES(1)).LT.1.00000e-07, 1.00000e-07, STATES(1))
      ALGBRC(11) =  CONSTS(11)*EXP(( ALGBRC(1)*CONSTS(12)*CONSTS(7))/( CONSTS(5)*CONSTS(6)))
      ALGBRC(13) =  CONSTS(13)*EXP(( ALGBRC(1)*CONSTS(14)*CONSTS(7))/( CONSTS(5)*CONSTS(6)))
      RATES(2) =  ALGBRC(13)*ALGBRC(5) -  4.00000*ALGBRC(11)*ALGBRC(4)
      ALGBRC(6) = TERNRY(STATES(4).LT.0.00000, 0.00000, TERNRY(STATES(4).GT.1.00000, 1.00000, STATES(4))
      RATES(3) = ( 2.00000*ALGBRC(13)*ALGBRC(6)+ 4.00000*ALGBRC(11)*ALGBRC(4)) -  ( 3.00000*ALGBRC(11)+ALGBRC(13))*ALGBRC(5)
      ALGBRC(7) = TERNRY(STATES(5).LT.0.00000, 0.00000, TERNRY(STATES(5).GT.1.00000, 1.00000, STATES(5))
      RATES(4) = ( 3.00000*ALGBRC(13)*ALGBRC(7)+ 3.00000*ALGBRC(11)*ALGBRC(5)) -  ( 2.00000*ALGBRC(11)+ 2.00000*ALGBRC(13))*ALGBRC(6)
      RATES(5) = ( 4.00000*ALGBRC(13)*ALGBRC(8)+ 2.00000*ALGBRC(11)*ALGBRC(6)) -  (ALGBRC(11)+ 3.00000*ALGBRC(13))*ALGBRC(7)
      RATES(6) = ( CONSTS(16)*ALGBRC(9)+ ALGBRC(11)*ALGBRC(7)) -  (CONSTS(15)+ 4.00000*ALGBRC(13))*ALGBRC(8)
      ALGBRC(12) =  CONSTS(17)*(ALGBRC(1) - CONSTS(18))
      ALGBRC(2) = 1.00000/(CONSTS(3)+EXP(( CONSTS(4)*(ALGBRC(1) - CONSTS(24))*CONSTS(7))/( CONSTS(5)*CONSTS(6))))
      ALGBRC(3) =  CONSTS(2)*ALGBRC(2)* ( CONSTS(8)*0.00100000) ** (1.0 / 2)*(ALGBRC(1) - CONSTS(24))
      ALGBRC(10) = ( (( CONSTS(10)*ALGBRC(9)*ALGBRC(1)*CONSTS(7) ** 2.00000)/( CONSTS(5)*CONSTS(6)))*(CONSTS(9) -  CONSTS(8)*EXP(( - ALGBRC(1)*CONSTS(7))/( CONSTS(5)*CONSTS(6)))))/(1.00000 - EXP(( - ALGBRC(1)*CONSTS(7))/( CONSTS(5)*CONSTS(6))))
      ALGBRC(14) = TERNRY(VOI.GE.CONSTS(19).AND.(VOI.LE.CONSTS(20).AND.(VOI - CONSTS(19)) -  INT((VOI - CONSTS(19))/CONSTS(21))*CONSTS(21).LE.CONSTS(22)), CONSTS(23), 0.00000)
      RATES(1) = - ((ALGBRC(3)+ALGBRC(10)+ALGBRC(12)) - ALGBRC(14))/CONSTS(1)
      RETURN
      END
      SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(8) = TERNRY(STATES(6).LT.0.00000, 0.00000, TERNRY(STATES(6).GT.1.00000, 1.00000, STATES(6))
      ALGBRC(9) = TERNRY(STATES(7).LT.0.00000, 0.00000, TERNRY(STATES(7).GT.1.00000, 1.00000, STATES(7))
      ALGBRC(4) = TERNRY(STATES(2).LT.0.00000, 0.00000, TERNRY(STATES(2).GT.1.00000, 1.00000, STATES(2))
      ALGBRC(5) = TERNRY(STATES(3).LT.0.00000, 0.00000, TERNRY(STATES(3).GT.1.00000, 1.00000, STATES(3))
      ALGBRC(1) = TERNRY(ABS(STATES(1)).LT.1.00000e-07, 1.00000e-07, STATES(1))
      ALGBRC(11) =  CONSTS(11)*EXP(( ALGBRC(1)*CONSTS(12)*CONSTS(7))/( CONSTS(5)*CONSTS(6)))
      ALGBRC(13) =  CONSTS(13)*EXP(( ALGBRC(1)*CONSTS(14)*CONSTS(7))/( CONSTS(5)*CONSTS(6)))
      ALGBRC(6) = TERNRY(STATES(4).LT.0.00000, 0.00000, TERNRY(STATES(4).GT.1.00000, 1.00000, STATES(4))
      ALGBRC(7) = TERNRY(STATES(5).LT.0.00000, 0.00000, TERNRY(STATES(5).GT.1.00000, 1.00000, STATES(5))
      ALGBRC(12) =  CONSTS(17)*(ALGBRC(1) - CONSTS(18))
      ALGBRC(2) = 1.00000/(CONSTS(3)+EXP(( CONSTS(4)*(ALGBRC(1) - CONSTS(24))*CONSTS(7))/( CONSTS(5)*CONSTS(6))))
      ALGBRC(3) =  CONSTS(2)*ALGBRC(2)* ( CONSTS(8)*0.00100000) ** (1.0 / 2)*(ALGBRC(1) - CONSTS(24))
      ALGBRC(10) = ( (( CONSTS(10)*ALGBRC(9)*ALGBRC(1)*CONSTS(7) ** 2.00000)/( CONSTS(5)*CONSTS(6)))*(CONSTS(9) -  CONSTS(8)*EXP(( - ALGBRC(1)*CONSTS(7))/( CONSTS(5)*CONSTS(6)))))/(1.00000 - EXP(( - ALGBRC(1)*CONSTS(7))/( CONSTS(5)*CONSTS(6))))
      ALGBRC(14) = TERNRY(VOI.GE.CONSTS(19).AND.(VOI.LE.CONSTS(20).AND.(VOI - CONSTS(19)) -  INT((VOI - CONSTS(19))/CONSTS(21))*CONSTS(21).LE.CONSTS(22)), CONSTS(23), 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