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 6 entries in the algebraic variable array.
C There are a total of 2 entries in each of the rate and state variable arrays.
C There are a total of 3 entries in the constant variable array.
C
C
C VOI is t in component main (second).
C STATES(1) is q_C in component main (coulomb).
C ALGBRC(2) is v_C in component main (C_per_s).
C ALGBRC(1) is v_R in component main (C_per_s).
C STATES(2) is v_L in component main (C_per_s).
C ALGBRC(6) is a_L in component main (C_per_s2).
C ALGBRC(3) is u_C in component main (J_per_C).
C ALGBRC(4) is u_R in component main (J_per_C).
C ALGBRC(5) is u_L in component main (J_per_C).
C CONSTS(1) is C in component main (C2_per_J).
C CONSTS(2) is R in component main (Js_per_C2).
C CONSTS(3) is L in component main (Js2_per_C2).
C RATES(1) is d/dt q_C in component main (coulomb).
C RATES(2) is d/dt v_L in component main (C_per_s).
C
      SUBROUTINE initConsts(CONSTS, RATES, STATES)
      REAL CONSTS(*), RATES(*), STATES(*)
      STATES(1) = 1
      STATES(2) = 0
      CONSTS(1) = 20
      CONSTS(2) = 2
      CONSTS(3) = 10
      RETURN
      END
      SUBROUTINE computeRates(VOI, CONSTS,  RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(1) = STATES(2)
      ALGBRC(2) = - ALGBRC(1)
      RATES(1) = ALGBRC(2)
      ALGBRC(3) = STATES(1)/CONSTS(1)
      ALGBRC(4) =  ALGBRC(1)*CONSTS(2)
CALL minimize(minfunc_0, CONSTS, VARIABLES, ALGBRC(5))
CALL minimize(minfunc_1, CONSTS, VARIABLES, ALGBRC(6))
      RATES(2) = ALGBRC(6)
      RETURN
      END
      SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(1) = STATES(2)
      ALGBRC(2) = - ALGBRC(1)
      ALGBRC(3) = STATES(1)/CONSTS(1)
      ALGBRC(4) =  ALGBRC(1)*CONSTS(2)
      RETURN
      END
REAL FUNCTION minfunc_0(CONSTS, VARIABLES)
            REAL CONSTS(*), VARIABLES(*) 
      minfunc_0 = abs(ALGBRC(3) - ALGBRC(4)+ALGBRC(5))
      RETURN
      END
REAL FUNCTION minfunc_1(CONSTS, VARIABLES)
            REAL CONSTS(*), VARIABLES(*) 
      minfunc_1 = abs(ALGBRC(5) -  ALGBRC(6)*CONSTS(3))
      RETURN
      END