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 12 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 26 entries in the constant variable array.
C
C
C VOI is time in component environment (hour).
C STATES(1) is Cgen_pp in component Cgen_pp (micromolar).
C CONSTS(23) is Qpp in component Cgen_pp (litre_hour).
C CONSTS(1) is Ppp in component Cgen_pp (dimensionless).
C ALGBRC(1) is H_Cgen_pp in component Cgen_pp (dimensionless).
C CONSTS(2) is Vpp in component Cgen_pp (litre).
C ALGBRC(9) is H_Cgen_B in component Cgen_B (dimensionless).
C CONSTS(20) is Qt in component model_parameters (litre_hour).
C ALGBRC(7) is Cgen_B in component Cgen_B (micromolar).
C STATES(2) is Cgen_rp in component Cgen_rp (micromolar).
C CONSTS(3) is Prp in component Cgen_rp (dimensionless).
C CONSTS(24) is Qrp in component Cgen_rp (litre_hour).
C ALGBRC(2) is H_Cgen_rp in component Cgen_rp (dimensionless).
C CONSTS(4) is Vrp in component Cgen_rp (litre).
C CONSTS(5) is kgen_urine in component Cgen_rp (first_order_rate_constant).
C STATES(3) is Cgen_l in component Cgen_l (micromolar).
C CONSTS(25) is Ql in component Cgen_l (litre_hour).
C ALGBRC(3) is H_Cgen_l in component Cgen_l (dimensionless).
C CONSTS(6) is Vl in component Cgen_l (litre).
C CONSTS(7) is Pl in component Cgen_l (dimensionless).
C CONSTS(8) is Vmax in component model_parameters (micromolar_hour).
C CONSTS(9) is Km in component model_parameters (micromolar).
C ALGBRC(12) is vinf in component model_parameters (micromole_hour).
C ALGBRC(4) is H_Cgen_GI in component Cgen_GI (dimensionless).
C CONSTS(26) is QGI in component Cgen_GI (litre_hour).
C STATES(4) is Cgen_GI in component Cgen_GI (micromolar).
C CONSTS(10) is VGI in component Cgen_GI (litre).
C STATES(5) is Ccon_l in component Ccon_l (micromolar).
C ALGBRC(5) is H_Ccon_l in component Ccon_l (dimensionless).
C CONSTS(11) is kbile in component model_parameters (first_order_rate_constant).
C ALGBRC(8) is H_Ccon_ROB in component Ccon_ROB (dimensionless).
C STATES(6) is Ccon_ROB in component Ccon_ROB (micromolar).
C CONSTS(12) is VROB in component Ccon_ROB (litre).
C CONSTS(13) is kcon_urine in component Ccon_ROB (first_order_rate_constant).
C STATES(7) is Acon_b in component Acon_b (micromole).
C ALGBRC(6) is d_t_Cgen_l in component Acon_b (hour).
C CONSTS(14) is tbasal in component Acon_b (hour).
C CONSTS(15) is ct in component Acon_b (hour).
C CONSTS(16) is cgen in component Acon_b (litre_hour_micromole).
C CONSTS(17) is cv in component model_parameters (micromole_hour).
C ALGBRC(10) is F in component model_parameters (dimensionless).
C CONSTS(21) is G in component model_parameters (dimensionless).
C ALGBRC(11) is H in component model_parameters (dimensionless).
C CONSTS(22) is I in component model_parameters (dimensionless).
C CONSTS(18) is epsilon in component model_parameters (hour).
C CONSTS(19) is m_rat in component model_parameters (dimensionless).
C RATES(1) is d/dt Cgen_pp in component Cgen_pp (micromolar).
C RATES(2) is d/dt Cgen_rp in component Cgen_rp (micromolar).
C RATES(3) is d/dt Cgen_l in component Cgen_l (micromolar).
C RATES(4) is d/dt Cgen_GI in component Cgen_GI (micromolar).
C RATES(5) is d/dt Ccon_l in component Ccon_l (micromolar).
C RATES(6) is d/dt Ccon_ROB in component Ccon_ROB (micromolar).
C RATES(7) is d/dt Acon_b in component Acon_b (micromole).
C
      SUBROUTINE initConsts(CONSTS, RATES, STATES)
      REAL CONSTS(*), RATES(*), STATES(*)
      STATES(1) = 0
      CONSTS(1) = 0.59
      CONSTS(2) = 0.188
      STATES(2) = 0
      CONSTS(3) = 1.94
      CONSTS(4) = 0.012
      CONSTS(5) = 9.5
      STATES(3) = 0
      CONSTS(6) = 0.0092
      CONSTS(7) = 3.61
      CONSTS(8) = 25.25
      CONSTS(9) = 0.6231
      STATES(4) = 0
      CONSTS(10) = 0.011
      STATES(5) = 0
      CONSTS(11) = 111.72
      STATES(6) = 0
      CONSTS(12) = 0.2408
      CONSTS(13) = 0.0
      STATES(7) = 0
      CONSTS(14) = 0.0865
      CONSTS(15) = 1.0107
      CONSTS(16) = 0.06561
      CONSTS(17) = 1.0
      CONSTS(18) = 0.1
      CONSTS(19) = 0.25
      CONSTS(20) =  14.1000*CONSTS(19) ** 0.750000
      CONSTS(21) = 1.00000
      CONSTS(22) = 0.00000
      CONSTS(23) =  0.528000*CONSTS(20)
      CONSTS(24) =  0.289000*CONSTS(20)
      CONSTS(25) =  0.0300000*CONSTS(20)
      CONSTS(26) =  0.153000*CONSTS(20)
      RETURN
      END
      SUBROUTINE computeRates(VOI, CONSTS,  RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(5) = TERNRY(STATES(5).LT.0.00000, 0.00000, 1.00000)
      RATES(7) =  CONSTS(11)*ALGBRC(5)*STATES(5)*CONSTS(6)
      ALGBRC(3) = TERNRY(STATES(3).LT.0.00000, 0.00000, 1.00000)
      ALGBRC(8) = TERNRY(STATES(6).LT.0.00000, 0.00000, 1.00000)
      RATES(5) = ( CONSTS(8)*ALGBRC(3)*STATES(3))/(CONSTS(9)+ ALGBRC(3)*STATES(3)) - ( CONSTS(11)*ALGBRC(5)*STATES(5)+( (CONSTS(25)+CONSTS(26))*( ALGBRC(5)*STATES(5) -  ALGBRC(8)*STATES(6)))/CONSTS(6))
      RATES(6) = ( (CONSTS(25)+CONSTS(26))*( ALGBRC(5)*STATES(5) -  ALGBRC(8)*STATES(6)))/CONSTS(12) -  CONSTS(13)*ALGBRC(8)*STATES(6)
      ALGBRC(1) = TERNRY(STATES(1).LT.0.00000, 0.00000, 1.00000)
      ALGBRC(2) = TERNRY(STATES(2).LT.0.00000, 0.00000, 1.00000)
      ALGBRC(7) = (( CONSTS(24)*ALGBRC(2)*STATES(2))/CONSTS(3)+( CONSTS(23)*ALGBRC(1)*STATES(1))/CONSTS(1)+( (CONSTS(25)+CONSTS(26))*ALGBRC(3)*STATES(3))/CONSTS(7))/CONSTS(20)
      ALGBRC(9) = TERNRY(ALGBRC(7).LT.0.00000, 0.00000, 1.00000)
      RATES(1) = ( CONSTS(23)*ALGBRC(9)*ALGBRC(7) - ( CONSTS(23)*ALGBRC(1)*STATES(1))/CONSTS(1))/CONSTS(2)
      RATES(2) = ( CONSTS(24)*ALGBRC(9)*ALGBRC(7) - ( CONSTS(24)*ALGBRC(2)*STATES(2))/CONSTS(3))/CONSTS(4) -  CONSTS(5)*ALGBRC(2)*STATES(2)
      ALGBRC(4) = TERNRY(STATES(4).LT.0.00000, 0.00000, 1.00000)
      RATES(4) = ( CONSTS(26)*ALGBRC(9)*ALGBRC(7) - ( CONSTS(26)*ALGBRC(4)*STATES(4))/CONSTS(3))/CONSTS(10)
      ALGBRC(10) =  (-2.00000/CONSTS(18) ** 3.00000)*VOI ** 3.00000+ (3.00000/CONSTS(18) ** 2.00000)*VOI ** 2.00000
      ALGBRC(11) = ( 3.00000*1.00000 - VOI ** 2.00000)/CONSTS(18) ** 2.00000 - ( 2.00000*1.00000 - VOI ** 3.00000)/CONSTS(18) ** 3.00000
      ALGBRC(12) = TERNRY(VOI.LT.CONSTS(18).AND.VOI.GE.0.00000,  CONSTS(17)*ALGBRC(10), TERNRY(VOI.LE.1.00000 - CONSTS(18).AND.VOI.GE.CONSTS(18),  CONSTS(17)*CONSTS(21), TERNRY(VOI.LE.1.00000.AND.VOI.GT.1.00000 - CONSTS(18),  CONSTS(17)*ALGBRC(11), TERNRY(VOI.LE.1.00000+5.00000/60.0000.AND.VOI.GT.1.00000,  CONSTS(17)*CONSTS(22), 0.0/0.0)
      RATES(3) = (( CONSTS(25)*ALGBRC(9)*ALGBRC(7) - ( (CONSTS(25)+CONSTS(26))*ALGBRC(3)*STATES(3))/CONSTS(7))+ALGBRC(12)+( CONSTS(26)*ALGBRC(4)*STATES(4))/CONSTS(3))/CONSTS(6) - ( CONSTS(8)*ALGBRC(3)*STATES(3))/(CONSTS(9)+ ALGBRC(3)*STATES(3))
      RETURN
      END
      SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(5) = TERNRY(STATES(5).LT.0.00000, 0.00000, 1.00000)
      ALGBRC(3) = TERNRY(STATES(3).LT.0.00000, 0.00000, 1.00000)
      ALGBRC(8) = TERNRY(STATES(6).LT.0.00000, 0.00000, 1.00000)
      ALGBRC(1) = TERNRY(STATES(1).LT.0.00000, 0.00000, 1.00000)
      ALGBRC(2) = TERNRY(STATES(2).LT.0.00000, 0.00000, 1.00000)
      ALGBRC(7) = (( CONSTS(24)*ALGBRC(2)*STATES(2))/CONSTS(3)+( CONSTS(23)*ALGBRC(1)*STATES(1))/CONSTS(1)+( (CONSTS(25)+CONSTS(26))*ALGBRC(3)*STATES(3))/CONSTS(7))/CONSTS(20)
      ALGBRC(9) = TERNRY(ALGBRC(7).LT.0.00000, 0.00000, 1.00000)
      ALGBRC(4) = TERNRY(STATES(4).LT.0.00000, 0.00000, 1.00000)
      ALGBRC(10) =  (-2.00000/CONSTS(18) ** 3.00000)*VOI ** 3.00000+ (3.00000/CONSTS(18) ** 2.00000)*VOI ** 2.00000
      ALGBRC(11) = ( 3.00000*1.00000 - VOI ** 2.00000)/CONSTS(18) ** 2.00000 - ( 2.00000*1.00000 - VOI ** 3.00000)/CONSTS(18) ** 3.00000
      ALGBRC(12) = TERNRY(VOI.LT.CONSTS(18).AND.VOI.GE.0.00000,  CONSTS(17)*ALGBRC(10), TERNRY(VOI.LE.1.00000 - CONSTS(18).AND.VOI.GE.CONSTS(18),  CONSTS(17)*CONSTS(21), TERNRY(VOI.LE.1.00000.AND.VOI.GT.1.00000 - CONSTS(18),  CONSTS(17)*ALGBRC(11), TERNRY(VOI.LE.1.00000+5.00000/60.0000.AND.VOI.GT.1.00000,  CONSTS(17)*CONSTS(22), 0.0/0.0)
      ALGBRC(6) = CONSTS(14)+ CONSTS(16)*ALGBRC(3)*STATES(3)*EXP(- (VOI/CONSTS(15)))
      RETURN
      END
      REAL FUNCTION TERNRY(TEST, VALA, VALB)
      LOGICAL TEST
      REAL VALA, VALB
      IF (TEST) THEN
        TERNRY = VALA
      ELSE
        TERNRY = VALB
      ENDIF
      RETURN
      END