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 10 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 7 entries in the constant variable array.
C
C
C ALGBRC(1) is u_in_e in component Environment (J_per_C).
C VOI is t in component Environment (second).
C STATES(1) is v_1_e in component Voice_coil_equations (C_per_s).
C ALGBRC(9) is a_1_e in component Voice_coil_equations (C_per_s2).
C STATES(2) is q_C_m in component Voice_coil_equations (metre).
C STATES(3) is v_2_m in component Voice_coil_equations (m_per_s).
C ALGBRC(10) is a_2_m in component Voice_coil_equations (m_per_s2).
C ALGBRC(3) is u_R_e in component Voice_coil_equations (J_per_C).
C ALGBRC(7) is u_L_e in component Voice_coil_equations (J_per_C).
C ALGBRC(5) is u_1_e in component Voice_coil_equations (J_per_C).
C ALGBRC(2) is u_2_m in component Voice_coil_equations (J_per_m).
C ALGBRC(4) is u_C_m in component Voice_coil_equations (J_per_m).
C ALGBRC(6) is u_R_m in component Voice_coil_equations (J_per_m).
C ALGBRC(8) is u_L_m in component Voice_coil_equations (J_per_m).
C CONSTS(1) is E_1 in component Voice_coil_equations (J_per_C2).
C CONSTS(2) is E_2 in component Voice_coil_equations (J_per_m2).
C CONSTS(3) is R_1_e in component Voice_coil_equations (Js_per_C2).
C CONSTS(4) is R_2_m in component Voice_coil_equations (Js_per_m2).
C CONSTS(5) is L_1_e in component Voice_coil_equations (Js2_per_C2).
C CONSTS(6) is L_2_m in component Voice_coil_equations (Js2_per_m2).
C CONSTS(7) is Bl in component Voice_coil_equations (Js_per_C_m).
C RATES(1) is d/dt v_1_e in component Voice_coil_equations (C_per_s).
C RATES(2) is d/dt q_C_m in component Voice_coil_equations (metre).
C RATES(3) is d/dt v_2_m in component Voice_coil_equations (m_per_s).
C
      SUBROUTINE initConsts(CONSTS, RATES, STATES)
      REAL CONSTS(*), RATES(*), STATES(*)
      STATES(1) = 0
      STATES(2) = 0
      STATES(3) = 0
      CONSTS(1) = 1
      CONSTS(2) = 100
      CONSTS(3) = 5
      CONSTS(4) = 0.4
      CONSTS(5) = 0.2
      CONSTS(6) = 0.01
      CONSTS(7) = 6
      RETURN
      END
      SUBROUTINE computeRates(VOI, CONSTS,  RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      RATES(2) = STATES(3)
      ALGBRC(1) =  50.0000* sin( 50.0000*2.00000* 3.14159265358979*VOI)
      ALGBRC(3) =  CONSTS(3)*STATES(1)
      ALGBRC(5) =  CONSTS(7)*STATES(3)
CALL minimize(minfunc_0, CONSTS, VARIABLES, ALGBRC(7))
CALL minimize(minfunc_1, CONSTS, VARIABLES, ALGBRC(9))
      RATES(1) = ALGBRC(9)
      ALGBRC(2) =  CONSTS(7)*STATES(1)
      ALGBRC(4) =  CONSTS(2)*STATES(2)
      ALGBRC(6) =  CONSTS(4)*STATES(3)
CALL minimize(minfunc_2, CONSTS, VARIABLES, ALGBRC(8))
CALL minimize(minfunc_3, CONSTS, VARIABLES, ALGBRC(10))
      RATES(3) = ALGBRC(10)
      RETURN
      END
      SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(1) =  50.0000* sin( 50.0000*2.00000* 3.14159265358979*VOI)
      ALGBRC(3) =  CONSTS(3)*STATES(1)
      ALGBRC(5) =  CONSTS(7)*STATES(3)
      ALGBRC(2) =  CONSTS(7)*STATES(1)
      ALGBRC(4) =  CONSTS(2)*STATES(2)
      ALGBRC(6) =  CONSTS(4)*STATES(3)
      RETURN
      END
REAL FUNCTION minfunc_0(CONSTS, VARIABLES)
            REAL CONSTS(*), VARIABLES(*) 
      minfunc_0 = abs(ALGBRC(1) - ALGBRC(3)+ALGBRC(7)+ALGBRC(5))
      RETURN
      END
REAL FUNCTION minfunc_1(CONSTS, VARIABLES)
            REAL CONSTS(*), VARIABLES(*) 
      minfunc_1 = abs(ALGBRC(7) -  CONSTS(5)*ALGBRC(9))
      RETURN
      END
REAL FUNCTION minfunc_2(CONSTS, VARIABLES)
            REAL CONSTS(*), VARIABLES(*) 
      minfunc_2 = abs(ALGBRC(2) - ALGBRC(4)+ALGBRC(6)+ALGBRC(8))
      RETURN
      END
REAL FUNCTION minfunc_3(CONSTS, VARIABLES)
            REAL CONSTS(*), VARIABLES(*) 
      minfunc_3 = abs(ALGBRC(8) -  CONSTS(6)*ALGBRC(10))
      RETURN
      END