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 ALGBRC(2) is Istim in component stimulus_protocol (per_ms).
C CONSTS(1) is IstimStart in component stimulus_protocol (ms).
C CONSTS(2) is IstimEnd in component stimulus_protocol (ms).
C CONSTS(3) is IstimAmplitude in component stimulus_protocol (per_ms).
C CONSTS(4) is IstimPeriod in component stimulus_protocol (ms).
C CONSTS(5) is IstimPulseDuration in component stimulus_protocol (ms).
C STATES(1) is u in component membrane (dimensionless).
C CONSTS(6) is Cm in component membrane (uF_per_cm2).
C ALGBRC(1) is Vm in component membrane (mV).
C CONSTS(7) is V_0 in component membrane (mV).
C CONSTS(8) is V_fi in component membrane (mV).
C ALGBRC(4) is J_fi in component fast_inward_current (per_ms).
C ALGBRC(6) is J_so in component slow_outward_current (per_ms).
C ALGBRC(8) is J_si in component slow_inward_current (per_ms).
C ALGBRC(3) is p in component p (dimensionless).
C CONSTS(9) is u_c in component p (dimensionless).
C ALGBRC(5) is q in component q (dimensionless).
C CONSTS(10) is u_v in component q (dimensionless).
C CONSTS(22) is tau_d in component fast_inward_current (ms).
C CONSTS(11) 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(7) is tau_v_minus in component fast_inward_current_v_gate (ms).
C CONSTS(12) is tau_v1_minus in component fast_inward_current_v_gate (ms).
C CONSTS(13) is tau_v2_minus in component fast_inward_current_v_gate (ms).
C CONSTS(14) is tau_v_plus in component fast_inward_current_v_gate (ms).
C CONSTS(15) is tau_0 in component slow_outward_current (ms).
C CONSTS(16) is tau_r in component slow_outward_current (ms).
C CONSTS(17) is tau_si in component slow_inward_current (ms).
C CONSTS(18) is u_csi in component slow_inward_current (dimensionless).
C CONSTS(19) is k in component slow_inward_current (dimensionless).
C STATES(3) is w in component slow_inward_current_w_gate (dimensionless).
C CONSTS(20) is tau_w_minus in component slow_inward_current_w_gate (ms).
C CONSTS(21) is tau_w_plus in component slow_inward_current_w_gate (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(*)
      CONSTS(1) = 100
      CONSTS(2) = 50000
      CONSTS(3) = -0.2
      CONSTS(4) = 1000
      CONSTS(5) = 1
      STATES(1) = 0
      CONSTS(6) = 1
      CONSTS(7) = -85
      CONSTS(8) = 15
      CONSTS(9) = 0.13
      CONSTS(10) = 0
      CONSTS(11) = 5.8
      STATES(2) = 1
      CONSTS(12) = 18.2
      CONSTS(13) = 18.2
      CONSTS(14) = 10
      CONSTS(15) = 12.5
      CONSTS(16) = 130
      CONSTS(17) = 127
      CONSTS(18) = 0.85
      CONSTS(19) = 10
      STATES(3) = 1
      CONSTS(20) = 80
      CONSTS(21) = 1020
      CONSTS(22) = CONSTS(6)/CONSTS(11)
      RETURN
      END
      SUBROUTINE computeRates(VOI, CONSTS,  RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(3) = TERNRY(STATES(1).LT.CONSTS(9), 0.00000, 1.00000)
      RATES(3) = ( (1.00000 - ALGBRC(3))*(1.00000 - STATES(3)))/CONSTS(20) - ( ALGBRC(3)*STATES(3))/CONSTS(21)
      ALGBRC(5) = TERNRY(STATES(1).LT.CONSTS(10), 0.00000, 1.00000)
      ALGBRC(7) =  ALGBRC(5)*CONSTS(12)+ (1.00000 - ALGBRC(5))*CONSTS(13)
      RATES(2) = ( (1.00000 - ALGBRC(3))*(1.00000 - STATES(2)))/ALGBRC(7) - ( ALGBRC(3)*STATES(2))/CONSTS(14)
      ALGBRC(2) = TERNRY(VOI.GE.CONSTS(1).AND.VOI.LE.CONSTS(2).AND.(VOI - CONSTS(1)) -  INT((VOI - CONSTS(1))/CONSTS(4))*CONSTS(4).LE.CONSTS(5), CONSTS(3), 0.00000)
      ALGBRC(4) = ( - STATES(2)*ALGBRC(3)*(1.00000 - STATES(1))*(STATES(1) - CONSTS(9)))/CONSTS(22)
      ALGBRC(6) = ( STATES(1)*(1.00000 - ALGBRC(3)))/CONSTS(15)+ALGBRC(3)/CONSTS(16)
      ALGBRC(8) = ( - STATES(3)*(1.00000+ tanh( CONSTS(19)*(STATES(1) - CONSTS(18)))))/( 2.00000*CONSTS(17))
      RATES(1) = - (ALGBRC(4)+ALGBRC(6)+ALGBRC(8)+ALGBRC(2))
      RETURN
      END
      SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(3) = TERNRY(STATES(1).LT.CONSTS(9), 0.00000, 1.00000)
      ALGBRC(5) = TERNRY(STATES(1).LT.CONSTS(10), 0.00000, 1.00000)
      ALGBRC(7) =  ALGBRC(5)*CONSTS(12)+ (1.00000 - ALGBRC(5))*CONSTS(13)
      ALGBRC(2) = TERNRY(VOI.GE.CONSTS(1).AND.VOI.LE.CONSTS(2).AND.(VOI - CONSTS(1)) -  INT((VOI - CONSTS(1))/CONSTS(4))*CONSTS(4).LE.CONSTS(5), CONSTS(3), 0.00000)
      ALGBRC(4) = ( - STATES(2)*ALGBRC(3)*(1.00000 - STATES(1))*(STATES(1) - CONSTS(9)))/CONSTS(22)
      ALGBRC(6) = ( STATES(1)*(1.00000 - ALGBRC(3)))/CONSTS(15)+ALGBRC(3)/CONSTS(16)
      ALGBRC(8) = ( - STATES(3)*(1.00000+ tanh( CONSTS(19)*(STATES(1) - CONSTS(18)))))/( 2.00000*CONSTS(17))
      ALGBRC(1) = CONSTS(7)+ STATES(1)*(CONSTS(8) - CONSTS(7))
      RETURN
      END
      REAL FUNCTION TERNRY(TEST, VALA, VALB)
      LOGICAL TEST
      REAL VALA, VALB
      IF (TEST) THEN
        TERNRY = VALA
      ELSE
        TERNRY = VALB
      ENDIF
      RETURN
      END