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 1 entries in each of the rate and state variable arrays.
C There are a total of 11 entries in the constant variable array.
C
C
C VOI is time in component environment (minute).
C CONSTS(1) is VP in component red_cells_and_viscosity (litre).
C STATES(1) is VRC in component RBC_volume (litre).
C ALGBRC(3) is HM in component hematocrit_fraction (dimensionless).
C ALGBRC(2) is HM1 in component hematocrit_fraction (dimensionless).
C ALGBRC(1) is VB in component hematocrit_fraction (litre).
C ALGBRC(4) is VIE in component viscosity_due_to_RBCs (dimensionless).
C CONSTS(2) is HMK in component parameter_values (dimensionless).
C CONSTS(3) is HKM in component parameter_values (dimensionless).
C ALGBRC(6) is VIM in component blood_viscosity (dimensionless).
C ALGBRC(5) is VIB in component blood_viscosity (dimensionless).
C ALGBRC(9) is HM7 in component oxygen_stimulation (mmHg).
C CONSTS(4) is PO2AMB in component parameter_values (mmHg).
C CONSTS(5) is HM6 in component parameter_values (mmHg).
C CONSTS(10) is PO2AM1 in component oxygen_stimulation (mmHg).
C ALGBRC(7) is HM3 in component oxygen_stimulation (mmHg).
C CONSTS(11) is HM4 in component oxygen_stimulation (mmHg).
C ALGBRC(8) is HM5 in component oxygen_stimulation (mmHg).
C ALGBRC(10) is RC1 in component RBC_production (L_per_minute).
C CONSTS(6) is HM8 in component parameter_values (L_per_minute_per_mmHg).
C CONSTS(7) is REK in component parameter_values (dimensionless).
C ALGBRC(11) is RC2 in component RBC_destruction (L_per_minute).
C CONSTS(8) is RKC in component parameter_values (per_minute).
C CONSTS(9) is TRRBC in component parameter_values (L_per_minute).
C ALGBRC(12) is RCD in component RBC_volume (L_per_minute).
C RATES(1) is d/dt VRC in component RBC_volume (litre).
C
      SUBROUTINE initConsts(CONSTS, RATES, STATES)
      REAL CONSTS(*), RATES(*), STATES(*)
      CONSTS(1) = 3.00449
      STATES(1) = 2.00439
      CONSTS(2) = 90
      CONSTS(3) = 0.53333
      CONSTS(4) = 150
      CONSTS(5) = 1850
      CONSTS(6) = 4.714e-08
      CONSTS(7) = 1
      CONSTS(8) = 5.8e-06
      CONSTS(9) = 0
      CONSTS(10) = TERNRY(CONSTS(4).GT.80.0000, 80.0000, CONSTS(4))
      CONSTS(11) = CONSTS(4) - 40.0000
      RETURN
      END
      SUBROUTINE computeRates(VOI, CONSTS,  RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(1) = CONSTS(1)+STATES(1)
      ALGBRC(2) = STATES(1)/ALGBRC(1)
      ALGBRC(3) =  100.000*ALGBRC(2)
      ALGBRC(7) =  (CONSTS(10) - 40.0000)*ALGBRC(3)
      ALGBRC(8) = TERNRY(ALGBRC(7)+CONSTS(11).LT.0.00000, 0.00000, ALGBRC(7)+CONSTS(11))
      ALGBRC(9) = CONSTS(5) - ALGBRC(8)
      ALGBRC(10) = TERNRY( ALGBRC(9)*CONSTS(6)*CONSTS(7)+5.00000e-06.LT.0.00000, 0.00000,  ALGBRC(9)*CONSTS(6)*CONSTS(7)+5.00000e-06)
      ALGBRC(4) = ALGBRC(3)/( (CONSTS(2) - ALGBRC(3))*CONSTS(3))
      ALGBRC(5) = ALGBRC(4)+1.50000
      ALGBRC(6) =  0.333300*ALGBRC(5)
      ALGBRC(11) =  STATES(1)*CONSTS(8)*ALGBRC(6)
      ALGBRC(12) = (ALGBRC(10) - ALGBRC(11))+CONSTS(9)
      RATES(1) = ALGBRC(12)
      RETURN
      END
      SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(1) = CONSTS(1)+STATES(1)
      ALGBRC(2) = STATES(1)/ALGBRC(1)
      ALGBRC(3) =  100.000*ALGBRC(2)
      ALGBRC(7) =  (CONSTS(10) - 40.0000)*ALGBRC(3)
      ALGBRC(8) = TERNRY(ALGBRC(7)+CONSTS(11).LT.0.00000, 0.00000, ALGBRC(7)+CONSTS(11))
      ALGBRC(9) = CONSTS(5) - ALGBRC(8)
      ALGBRC(10) = TERNRY( ALGBRC(9)*CONSTS(6)*CONSTS(7)+5.00000e-06.LT.0.00000, 0.00000,  ALGBRC(9)*CONSTS(6)*CONSTS(7)+5.00000e-06)
      ALGBRC(4) = ALGBRC(3)/( (CONSTS(2) - ALGBRC(3))*CONSTS(3))
      ALGBRC(5) = ALGBRC(4)+1.50000
      ALGBRC(6) =  0.333300*ALGBRC(5)
      ALGBRC(11) =  STATES(1)*CONSTS(8)*ALGBRC(6)
      ALGBRC(12) = (ALGBRC(10) - ALGBRC(11))+CONSTS(9)
      RETURN
      END
      REAL FUNCTION TERNRY(TEST, VALA, VALB)
      LOGICAL TEST
      REAL VALA, VALB
      IF (TEST) THEN
        TERNRY = VALA
      ELSE
        TERNRY = VALB
      ENDIF
      RETURN
      END