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 8 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 22 entries in the constant variable array.
C
C
C VOI is time in component environment (ms).
C STATES(1) is u in component membrane (dimensionless).
C CONSTS(1) is Cm in component membrane (uF_per_cm2).
C ALGBRC(1) is Vm in component membrane (mV).
C CONSTS(2) is V_0 in component membrane (mV).
C CONSTS(3) is V_fi in component membrane (mV).
C ALGBRC(3) is J_fi in component fast_inward_current (per_ms).
C ALGBRC(5) is J_so in component slow_outward_current (per_ms).
C ALGBRC(7) is J_si in component slow_inward_current (per_ms).
C ALGBRC(8) is Istim in component stimulus_protocol (per_ms).
C ALGBRC(2) is p in component p (dimensionless).
C CONSTS(4) is u_c in component p (dimensionless).
C ALGBRC(4) is q in component q (dimensionless).
C CONSTS(5) is u_v in component q (dimensionless).
C CONSTS(22) is tau_d in component fast_inward_current (ms).
C CONSTS(6) is g_fi_max in component fast_inward_current (mS_per_cm2).
C STATES(2) is v in component fast_inward_current_v_gate (dimensionless).
C ALGBRC(6) is tau_v_minus in component fast_inward_current_v_gate (ms).
C CONSTS(7) is tau_v1_minus in component fast_inward_current_v_gate (ms).
C CONSTS(8) is tau_v2_minus in component fast_inward_current_v_gate (ms).
C CONSTS(9) is tau_v_plus in component fast_inward_current_v_gate (ms).
C CONSTS(10) is tau_0 in component slow_outward_current (ms).
C CONSTS(11) is tau_r in component slow_outward_current (ms).
C CONSTS(12) is tau_si in component slow_inward_current (ms).
C CONSTS(13) is u_csi in component slow_inward_current (dimensionless).
C CONSTS(14) is k in component slow_inward_current (dimensionless).
C STATES(3) is w in component slow_inward_current_w_gate (dimensionless).
C CONSTS(15) is tau_w_minus in component slow_inward_current_w_gate (ms).
C CONSTS(16) is tau_w_plus in component slow_inward_current_w_gate (ms).
C CONSTS(17) is IstimStart in component stimulus_protocol (ms).
C CONSTS(18) is IstimEnd in component stimulus_protocol (ms).
C CONSTS(19) is IstimAmplitude in component stimulus_protocol (per_ms).
C CONSTS(20) is IstimPeriod in component stimulus_protocol (ms).
C CONSTS(21) is IstimPulseDuration in component stimulus_protocol (ms).
C RATES(1) is d/dt u in component membrane (dimensionless).
C RATES(2) is d/dt v in component fast_inward_current_v_gate (dimensionless).
C RATES(3) is d/dt w in component slow_inward_current_w_gate (dimensionless).
C
      SUBROUTINE initConsts(CONSTS, RATES, STATES)
      REAL CONSTS(*), RATES(*), STATES(*)
      STATES(1) = 0
      CONSTS(1) = 1
      CONSTS(2) = -85
      CONSTS(3) = 15
      CONSTS(4) = 0.13
      CONSTS(5) = 0.025
      CONSTS(6) = 8.7
      STATES(2) = 1
      CONSTS(7) = 333
      CONSTS(8) = 40
      CONSTS(9) = 10
      CONSTS(10) = 12.5
      CONSTS(11) = 25
      CONSTS(12) = 22.22
      CONSTS(13) = 0.85
      CONSTS(14) = 10
      STATES(3) = 1
      CONSTS(15) = 65
      CONSTS(16) = 1000
      CONSTS(17) = 10
      CONSTS(18) = 50000
      CONSTS(19) = -0.2
      CONSTS(20) = 1000
      CONSTS(21) = 1
      CONSTS(22) = CONSTS(1)/CONSTS(6)
      RETURN
      END
      SUBROUTINE computeRates(VOI, CONSTS,  RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(2) = TERNRY(STATES(1).LT.CONSTS(4), 0.00000, 1.00000)
      RATES(3) = ( (1.00000 - ALGBRC(2))*(1.00000 - STATES(3)))/CONSTS(15) - ( ALGBRC(2)*STATES(3))/CONSTS(16)
      ALGBRC(4) = TERNRY(STATES(1).LT.CONSTS(5), 0.00000, 1.00000)
      ALGBRC(6) =  ALGBRC(4)*CONSTS(7)+ (1.00000 - ALGBRC(4))*CONSTS(8)
      RATES(2) = ( (1.00000 - ALGBRC(2))*(1.00000 - STATES(2)))/ALGBRC(6) - ( ALGBRC(2)*STATES(2))/CONSTS(9)
      ALGBRC(3) = ( - STATES(2)*ALGBRC(2)*(1.00000 - STATES(1))*(STATES(1) - CONSTS(4)))/CONSTS(22)
      ALGBRC(5) = ( STATES(1)*(1.00000 - ALGBRC(2)))/CONSTS(10)+ALGBRC(2)/CONSTS(11)
      ALGBRC(7) = ( - STATES(3)*(1.00000+ tanh( CONSTS(14)*(STATES(1) - CONSTS(13)))))/( 2.00000*CONSTS(12))
      ALGBRC(8) = TERNRY(VOI.GE.CONSTS(17).AND.VOI.LE.CONSTS(18).AND.(VOI - CONSTS(17)) -  INT((VOI - CONSTS(17))/CONSTS(20))*CONSTS(20).LE.CONSTS(21), CONSTS(19), 0.00000)
      RATES(1) = - (ALGBRC(3)+ALGBRC(5)+ALGBRC(7)+ALGBRC(8))
      RETURN
      END
      SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(2) = TERNRY(STATES(1).LT.CONSTS(4), 0.00000, 1.00000)
      ALGBRC(4) = TERNRY(STATES(1).LT.CONSTS(5), 0.00000, 1.00000)
      ALGBRC(6) =  ALGBRC(4)*CONSTS(7)+ (1.00000 - ALGBRC(4))*CONSTS(8)
      ALGBRC(3) = ( - STATES(2)*ALGBRC(2)*(1.00000 - STATES(1))*(STATES(1) - CONSTS(4)))/CONSTS(22)
      ALGBRC(5) = ( STATES(1)*(1.00000 - ALGBRC(2)))/CONSTS(10)+ALGBRC(2)/CONSTS(11)
      ALGBRC(7) = ( - STATES(3)*(1.00000+ tanh( CONSTS(14)*(STATES(1) - CONSTS(13)))))/( 2.00000*CONSTS(12))
      ALGBRC(8) = TERNRY(VOI.GE.CONSTS(17).AND.VOI.LE.CONSTS(18).AND.(VOI - CONSTS(17)) -  INT((VOI - CONSTS(17))/CONSTS(20))*CONSTS(20).LE.CONSTS(21), CONSTS(19), 0.00000)
      ALGBRC(1) = CONSTS(2)+ STATES(1)*(CONSTS(3) - CONSTS(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