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 21 entries in the algebraic variable array.
C There are a total of 6 entries in each of the rate and state variable arrays.
C There are a total of 40 entries in the constant variable array.
C
C
C VOI is time in component environment (second).
C CONSTS(1) is R_mt in component heart_parameters (kPa_second_per_liter).
C CONSTS(2) is R_av in component heart_parameters (kPa_second_per_liter).
C CONSTS(3) is R_tc in component heart_parameters (kPa_second_per_liter).
C CONSTS(4) is R_pv in component heart_parameters (kPa_second_per_liter).
C CONSTS(5) is R_pul in component heart_parameters (kPa_second_per_liter).
C CONSTS(6) is R_sys in component heart_parameters (kPa_second_per_liter).
C CONSTS(7) is HR in component heart_parameters (dimensionless).
C CONSTS(8) is V_tot in component heart_parameters (liter).
C CONSTS(9) is P_pl in component heart_parameters (kPa).
C ALGBRC(2) is e_t in component driver_function (dimensionless).
C CONSTS(10) is A in component driver_function (dimensionless).
C CONSTS(11) is B in component driver_function (dimensionless).
C CONSTS(12) is C in component driver_function (dimensionless).
C ALGBRC(1) is tau in component driver_function (second).
C CONSTS(13) is period in component driver_function (dimensionless).
C ALGBRC(3) is V_pcd in component pericardium (liter).
C ALGBRC(4) is P_pcd in component pericardium (kPa).
C ALGBRC(5) is P_peri in component pericardium (kPa).
C STATES(1) is V_lv in component left_ventricle (liter).
C STATES(2) is V_rv in component right_ventricle (liter).
C CONSTS(14) is P_0_pcd in component pericardium (kPa).
C CONSTS(15) is V_0_pcd in component pericardium (liter).
C CONSTS(16) is lambda_pcd in component pericardium (per_liter).
C ALGBRC(10) is V_lvf in component left_ventricle (liter).
C ALGBRC(11) is P_lvf in component left_ventricle (kPa).
C ALGBRC(19) is P_lv in component left_ventricle (kPa).
C ALGBRC(12) is V_spt in component septum (liter).
C ALGBRC(13) is P_es_lvf in component lvf_calculator (kPa).
C ALGBRC(14) is P_ed_lvf in component lvf_calculator (kPa).
C ALGBRC(7) is P_pu in component pulmonary_vein (kPa).
C ALGBRC(8) is P_ao in component aorta (kPa).
C CONSTS(17) is E_es_lvf in component lvf_calculator (kPa_per_liter).
C CONSTS(18) is V_d_lvf in component lvf_calculator (liter).
C CONSTS(19) is P_0_lvf in component lvf_calculator (kPa).
C CONSTS(20) is lambda_lvf in component lvf_calculator (per_liter).
C CONSTS(21) is V_0_lvf in component lvf_calculator (liter).
C ALGBRC(15) is V_rvf in component right_ventricle (liter).
C ALGBRC(16) is P_rvf in component right_ventricle (kPa).
C ALGBRC(20) is P_rv in component right_ventricle (kPa).
C ALGBRC(17) is P_es_rvf in component rvf_calculator (kPa).
C ALGBRC(18) is P_ed_rvf in component rvf_calculator (kPa).
C ALGBRC(6) is P_pa in component pulmonary_artery (kPa).
C ALGBRC(9) is P_vc in component vena_cava (kPa).
C CONSTS(22) is E_es_rvf in component rvf_calculator (kPa_per_liter).
C CONSTS(23) is V_d_rvf in component rvf_calculator (liter).
C CONSTS(24) is P_0_rvf in component rvf_calculator (kPa).
C CONSTS(25) is lambda_rvf in component rvf_calculator (per_liter).
C CONSTS(26) is V_0_rvf in component rvf_calculator (liter).
C ALGBRC(21) is P_sept in component septum (kPa).
C CONSTS(27) is E_es_spt in component septum (kPa_per_liter).
C CONSTS(28) is V_d_spt in component septum (liter).
C CONSTS(29) is P_0_spt in component septum (kPa).
C CONSTS(30) is lambda_spt in component septum (per_liter).
C CONSTS(31) is V_0_spt in component septum (liter).
C CONSTS(32) is one in component septum (dimensionless).
C CONSTS(33) is E_es_pa in component pulmonary_artery (kPa_per_liter).
C STATES(3) is V_pa in component pulmonary_artery (liter).
C CONSTS(34) is V_d_pa in component pulmonary_artery (liter).
C CONSTS(35) is E_es_pu in component pulmonary_vein (kPa_per_liter).
C STATES(4) is V_pu in component pulmonary_vein (liter).
C CONSTS(36) is V_d_pu in component pulmonary_vein (liter).
C CONSTS(37) is E_es_ao in component aorta (kPa_per_liter).
C STATES(5) is V_ao in component aorta (liter).
C CONSTS(38) is V_d_ao in component aorta (liter).
C CONSTS(39) is E_es_vc in component vena_cava (kPa_per_liter).
C STATES(6) is V_vc in component vena_cava (liter).
C CONSTS(40) is V_d_vc in component vena_cava (liter).
C RATES(1) is d/dt V_lv in component left_ventricle (liter).
C RATES(2) is d/dt V_rv in component right_ventricle (liter).
C RATES(3) is d/dt V_pa in component pulmonary_artery (liter).
C RATES(4) is d/dt V_pu in component pulmonary_vein (liter).
C RATES(5) is d/dt V_ao in component aorta (liter).
C RATES(6) is d/dt V_vc in component vena_cava (liter).
C
      SUBROUTINE initConsts(CONSTS, RATES, STATES)
      REAL CONSTS(*), RATES(*), STATES(*)
      CONSTS(1) = 0.06
      CONSTS(2) = 1.4
      CONSTS(3) = 0.18
      CONSTS(4) = 0.48
      CONSTS(5) = 19
      CONSTS(6) = 140
      CONSTS(7) = 80
      CONSTS(8) = 5.5
      CONSTS(9) = -0.533289474
      CONSTS(10) = 1
      CONSTS(11) = 80
      CONSTS(12) = 0.27
      CONSTS(13) = 0.405
      STATES(1) = 0.005
      STATES(2) = 0.005
      CONSTS(14) = 0.067
      CONSTS(15) = 0.2
      CONSTS(16) = 30
      CONSTS(17) = 454
      CONSTS(18) = 0.005
      CONSTS(19) = 0.17
      CONSTS(20) = 15
      CONSTS(21) = 0.005
      CONSTS(22) = 87
      CONSTS(23) = 0.005
      CONSTS(24) = 0.16
      CONSTS(25) = 15
      CONSTS(26) = 0.005
      CONSTS(27) = 6500
      CONSTS(28) = 0.002
      CONSTS(29) = 0.148
      CONSTS(30) = 435
      CONSTS(31) = 0.002
      CONSTS(32) = 1
      CONSTS(33) = 45
      STATES(3) = 0.16
      CONSTS(34) = 0.16
      CONSTS(35) = 0.8
      STATES(4) = 0.2
      CONSTS(36) = 0.2
      CONSTS(37) = 94
      STATES(5) = 0.8
      CONSTS(38) = 0.8
      CONSTS(39) = 1.5
      STATES(6) = 2.83
      CONSTS(40) = 2.83
      RETURN
      END
      SUBROUTINE computeRates(VOI, CONSTS,  RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(3) = STATES(1)+STATES(2)
      ALGBRC(4) =  CONSTS(14)*(EXP( CONSTS(16)*(ALGBRC(3) - CONSTS(15))) - 1.00000)
      ALGBRC(5) = ALGBRC(4)+CONSTS(9)
      ALGBRC(1) =  INT(MOD(VOI, CONSTS(13)))
      ALGBRC(2) =  CONSTS(10)*EXP( - CONSTS(11)*( ALGBRC(1)*CONSTS(7))/60.0000 - CONSTS(12) ** 2.00000)
CALL minimize(minfunc_0, CONSTS, VARIABLES, <VAR>)
      ALGBRC(19) = ALGBRC(11)+ALGBRC(5)
      ALGBRC(7) =  CONSTS(35)*(STATES(4) - CONSTS(36))
      ALGBRC(8) =  CONSTS(37)*(STATES(5) - CONSTS(38))
      RATES(1) = TERNRY(ALGBRC(7) - ALGBRC(19).LT.0.00000.AND.ALGBRC(19) - ALGBRC(8).LT.0.00000, 0.00000, TERNRY(ALGBRC(7) - ALGBRC(19).LT.0.00000, - (ALGBRC(19) - ALGBRC(8))/CONSTS(2), TERNRY(ALGBRC(19) - ALGBRC(8).LT.0.00000, (ALGBRC(7) - ALGBRC(19))/CONSTS(1), (ALGBRC(7) - ALGBRC(19))/CONSTS(1) - (ALGBRC(19) - ALGBRC(8))/CONSTS(2))
      ALGBRC(6) =  CONSTS(33)*(STATES(3) - CONSTS(34))
      RATES(4) = TERNRY(ALGBRC(6) - ALGBRC(7).LT.0.00000.AND.ALGBRC(7) - ALGBRC(19).LT.0.00000, 0.00000, TERNRY(ALGBRC(6) - ALGBRC(7).LT.0.00000, - (ALGBRC(7) - ALGBRC(19))/CONSTS(1), TERNRY(ALGBRC(7) - ALGBRC(19).LT.0.00000, (ALGBRC(6) - ALGBRC(7))/CONSTS(5), (ALGBRC(6) - ALGBRC(7))/CONSTS(5) - (ALGBRC(7) - ALGBRC(19))/CONSTS(1))
      ALGBRC(9) =  CONSTS(39)*(STATES(6) - CONSTS(40))
      RATES(5) = TERNRY(ALGBRC(19) - ALGBRC(8).LT.0.00000.AND.ALGBRC(8) - ALGBRC(9).LT.0.00000, 0.00000, TERNRY(ALGBRC(19) - ALGBRC(8).LT.0.00000, - (ALGBRC(8) - ALGBRC(9))/CONSTS(6), TERNRY(ALGBRC(8) - ALGBRC(9).LT.0.00000, (ALGBRC(19) - ALGBRC(8))/CONSTS(2), (ALGBRC(19) - ALGBRC(8))/CONSTS(2) - (ALGBRC(8) - ALGBRC(9))/CONSTS(6))
      ALGBRC(20) = ALGBRC(16)+ALGBRC(5)
      RATES(2) = TERNRY(ALGBRC(9) - ALGBRC(20).LT.0.00000.AND.ALGBRC(20) - ALGBRC(6).LT.0.00000, 0.00000, TERNRY(ALGBRC(9) - ALGBRC(20).LT.0.00000, - (ALGBRC(20) - ALGBRC(6))/CONSTS(4), TERNRY(ALGBRC(20) - ALGBRC(6).LT.0.00000, (ALGBRC(9) - ALGBRC(20))/CONSTS(3), (ALGBRC(9) - ALGBRC(20))/CONSTS(3) - (ALGBRC(20) - ALGBRC(6))/CONSTS(4))
      RATES(3) = TERNRY(ALGBRC(20) - ALGBRC(6).LT.0.00000.AND.ALGBRC(6) - ALGBRC(7).LT.0.00000, 0.00000, TERNRY(ALGBRC(20) - ALGBRC(6).LT.0.00000, - (ALGBRC(6) - ALGBRC(7))/CONSTS(5), TERNRY(ALGBRC(6) - ALGBRC(7).LT.0.00000, (ALGBRC(20) - ALGBRC(6))/CONSTS(4), (ALGBRC(20) - ALGBRC(6))/CONSTS(4) - (ALGBRC(6) - ALGBRC(7))/CONSTS(5))
      RATES(6) = TERNRY(ALGBRC(8) - ALGBRC(9).LT.0.00000.AND.ALGBRC(9) - ALGBRC(20).LT.0.00000, 0.00000, TERNRY(ALGBRC(8) - ALGBRC(9).LT.0.00000, - (ALGBRC(9) - ALGBRC(20))/CONSTS(3), TERNRY(ALGBRC(9) - ALGBRC(20).LT.0.00000, (ALGBRC(8) - ALGBRC(9))/CONSTS(6), (ALGBRC(8) - ALGBRC(9))/CONSTS(6) - (ALGBRC(9) - ALGBRC(20))/CONSTS(3))
      RETURN
      END
      SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC)
      REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
      ALGBRC(3) = STATES(1)+STATES(2)
      ALGBRC(4) =  CONSTS(14)*(EXP( CONSTS(16)*(ALGBRC(3) - CONSTS(15))) - 1.00000)
      ALGBRC(5) = ALGBRC(4)+CONSTS(9)
      ALGBRC(1) =  INT(MOD(VOI, CONSTS(13)))
      ALGBRC(2) =  CONSTS(10)*EXP( - CONSTS(11)*( ALGBRC(1)*CONSTS(7))/60.0000 - CONSTS(12) ** 2.00000)
      ALGBRC(19) = ALGBRC(11)+ALGBRC(5)
      ALGBRC(7) =  CONSTS(35)*(STATES(4) - CONSTS(36))
      ALGBRC(8) =  CONSTS(37)*(STATES(5) - CONSTS(38))
      ALGBRC(6) =  CONSTS(33)*(STATES(3) - CONSTS(34))
      ALGBRC(9) =  CONSTS(39)*(STATES(6) - CONSTS(40))
      ALGBRC(20) = ALGBRC(16)+ALGBRC(5)
      ALGBRC(21) = ALGBRC(19) - ALGBRC(20)
      RETURN
      END
REAL FUNCTION minfunc_0(CONSTS, VARIABLES)
            REAL CONSTS(*), VARIABLES(*) 
      minfunc_0[1] = abs(ALGBRC(10) - (STATES(1) - ALGBRC(12)))
      minfunc_0[2] = abs(ALGBRC(11) - ( ALGBRC(2)*ALGBRC(13)+ (1.00000 - ALGBRC(2))*ALGBRC(14)))
      minfunc_0[3] = abs(ALGBRC(13) -  CONSTS(17)*(ALGBRC(10) - CONSTS(18)))
      minfunc_0[4] = abs(ALGBRC(14) -  CONSTS(19)*(EXP( CONSTS(20)*(ALGBRC(10) - CONSTS(21))) - 1.00000))
      minfunc_0[5] = abs(ALGBRC(15) - (STATES(2)+ALGBRC(12)))
      minfunc_0[6] = abs(ALGBRC(16) - ( ALGBRC(2)*ALGBRC(17)+ (1.00000 - ALGBRC(2))*ALGBRC(18)))
      minfunc_0[7] = abs(ALGBRC(17) -  CONSTS(22)*(ALGBRC(15) - CONSTS(23)))
      minfunc_0[8] = abs(ALGBRC(18) -  CONSTS(24)*(EXP( CONSTS(25)*(ALGBRC(15) - CONSTS(26))) - 1.00000))
      minfunc_0[9] = abs(ALGBRC(11) - (( ALGBRC(2)*CONSTS(27)*(ALGBRC(12) - CONSTS(28))+ (CONSTS(32) - ALGBRC(2))*CONSTS(29)*(EXP( CONSTS(30)*(ALGBRC(12) - CONSTS(31))) - CONSTS(32))) - ALGBRC(16)))
      RETURN
      END
      REAL FUNCTION TERNRY(TEST, VALA, VALB)
      LOGICAL TEST
      REAL VALA, VALB
      IF (TEST) THEN
        TERNRY = VALA
      ELSE
        TERNRY = VALB
      ENDIF
      RETURN
      END