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 22 entries in the algebraic variable array.
C There are a total of 10 entries in each of the rate and state variable arrays.
C There are a total of 43 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_mL).
C CONSTS(2) is R_av in component heart_parameters (kPa_second_per_mL).
C CONSTS(3) is R_tc in component heart_parameters (kPa_second_per_mL).
C CONSTS(4) is R_pv in component heart_parameters (kPa_second_per_mL).
C CONSTS(5) is R_pul in component heart_parameters (kPa_second_per_mL).
C CONSTS(6) is R_sys in component heart_parameters (kPa_second_per_mL).
C CONSTS(7) is L_tc in component heart_parameters (kPa_second2_per_mL).
C CONSTS(8) is L_pv in component heart_parameters (kPa_second2_per_mL).
C CONSTS(9) is L_mt in component heart_parameters (kPa_second2_per_mL).
C CONSTS(10) is L_av in component heart_parameters (kPa_second2_per_mL).
C CONSTS(11) is V_tot in component heart_parameters (mL).
C CONSTS(12) is P_th in component heart_parameters (kPa).
C ALGBRC(2) is e_t in component driver_function (dimensionless).
C CONSTS(13) is A in component driver_function (dimensionless).
C CONSTS(14) is B in component driver_function (per_second2).
C CONSTS(15) is C in component driver_function (second).
C ALGBRC(1) is tau in component driver_function (second).
C CONSTS(16) is period in component driver_function (second).
C ALGBRC(3) is V_pcd in component pericardium (mL).
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 (mL).
C STATES(2) is V_rv in component right_ventricle (mL).
C CONSTS(17) is P_0_pcd in component pericardium (kPa).
C CONSTS(18) is V_0_pcd in component pericardium (mL).
C CONSTS(19) is lambda_pcd in component pericardium (per_mL).
C ALGBRC(7) is V_lvf in component left_ventricle (mL).
C ALGBRC(10) is P_lvf in component left_ventricle (kPa).
C ALGBRC(11) is P_lv in component left_ventricle (kPa).
C ALGBRC(6) is V_spt in component septum (mL).
C ALGBRC(8) is P_es_lvf in component lvf_calculator (kPa).
C ALGBRC(9) is P_ed_lvf in component lvf_calculator (kPa).
C ALGBRC(19) is P_pu in component pulmonary_vein (kPa).
C ALGBRC(18) is P_ao in component aorta (kPa).
C CONSTS(20) is E_es_lvf in component lvf_calculator (kPa_per_mL).
C CONSTS(21) is lambda_lvf in component lvf_calculator (per_mL).
C CONSTS(22) is P_0_lvf in component lvf_calculator (kPa).
C STATES(3) is Q_mt in component flow (mL_per_second).
C STATES(4) is Q_av in component flow (mL_per_second).
C CONSTS(23) is V_d_lvf in component lvf_calculator (mL).
C CONSTS(24) is V_0_lvf in component lvf_calculator (mL).
C ALGBRC(12) is V_rvf in component right_ventricle (mL).
C ALGBRC(15) is P_rvf in component right_ventricle (kPa).
C ALGBRC(16) is P_rv in component right_ventricle (kPa).
C ALGBRC(13) is P_es_rvf in component rvf_calculator (kPa).
C ALGBRC(14) is P_ed_rvf in component rvf_calculator (kPa).
C ALGBRC(17) is P_pa in component pulmonary_artery (kPa).
C ALGBRC(20) is P_vc in component vena_cava (kPa).
C CONSTS(25) is E_es_rvf in component rvf_calculator (kPa_per_mL).
C CONSTS(26) is lambda_rvf in component rvf_calculator (per_mL).
C CONSTS(27) is P_0_rvf in component rvf_calculator (kPa).
C STATES(5) is Q_tc in component flow (mL_per_second).
C STATES(6) is Q_pv in component flow (mL_per_second).
C CONSTS(28) is V_d_rvf in component rvf_calculator (mL).
C CONSTS(29) is V_0_rvf in component rvf_calculator (mL).
C CONSTS(30) is E_es_spt in component septum (kPa_per_mL).
C CONSTS(31) is V_d_spt in component septum (mL).
C CONSTS(32) is P_0_spt in component septum (kPa).
C CONSTS(33) is lambda_spt in component septum (per_mL).
C CONSTS(34) is V_0_spt in component septum (mL).
C CONSTS(35) is one in component septum (dimensionless).
C CONSTS(36) is E_es_pa in component pulmonary_artery (kPa_per_mL).
C STATES(7) is V_pa in component pulmonary_artery (mL).
C CONSTS(37) is V_d_pa in component pulmonary_artery (mL).
C ALGBRC(21) is Q_pul in component flow (mL_per_second).
C CONSTS(38) is E_es_pu in component pulmonary_vein (kPa_per_mL).
C STATES(8) is V_pu in component pulmonary_vein (mL).
C CONSTS(39) is V_d_pu in component pulmonary_vein (mL).
C CONSTS(40) is E_es_ao in component aorta (kPa_per_mL).
C STATES(9) is V_ao in component aorta (mL).
C CONSTS(41) is V_d_ao in component aorta (mL).
C ALGBRC(22) is Q_sys in component flow (mL_per_second).
C CONSTS(42) is E_es_vc in component vena_cava (kPa_per_mL).
C STATES(10) is V_vc in component vena_cava (mL).
C CONSTS(43) is V_d_vc in component vena_cava (mL).
C RATES(1) is d/dt V_lv in component left_ventricle (mL).
C RATES(2) is d/dt V_rv in component right_ventricle (mL).
C RATES(7) is d/dt V_pa in component pulmonary_artery (mL).
C RATES(8) is d/dt V_pu in component pulmonary_vein (mL).
C RATES(9) is d/dt V_ao in component aorta (mL).
C RATES(10) is d/dt V_vc in component vena_cava (mL).
C RATES(3) is d/dt Q_mt in component flow (mL_per_second).
C RATES(4) is d/dt Q_av in component flow (mL_per_second).
C RATES(5) is d/dt Q_tc in component flow (mL_per_second).
C RATES(6) is d/dt Q_pv in component flow (mL_per_second).
C
SUBROUTINE initConsts(CONSTS, RATES, STATES)
REAL CONSTS(*), RATES(*), STATES(*)
CONSTS(1) = 0.0158
CONSTS(2) = 0.0180
CONSTS(3) = 0.0237
CONSTS(4) = 0.0055
CONSTS(5) = 0.1552
CONSTS(6) = 1.0889
CONSTS(7) = 8.0093e-5
CONSTS(8) = 1.4868e-4
CONSTS(9) = 7.6968e-5
CONSTS(10) = 1.2189e-4
CONSTS(11) = 5.5
CONSTS(12) = -4
CONSTS(13) = 1
CONSTS(14) = 80
CONSTS(15) = 0.375
CONSTS(16) = 0.75
STATES(1) = 94.6812
STATES(2) = 90.7302
CONSTS(17) = 0.5003
CONSTS(18) = 200
CONSTS(19) = 0.03
CONSTS(20) = 2.8798
CONSTS(21) = 0.033
CONSTS(22) = 0.1203
STATES(3) = 245.5813
STATES(4) = 0
CONSTS(23) = 0
CONSTS(24) = 0
CONSTS(25) = 0.585
CONSTS(26) = 0.023
CONSTS(27) = 0.2157
STATES(5) = 190.0661
STATES(6) = 0
CONSTS(28) = 0
CONSTS(29) = 0
CONSTS(30) = 48.754
CONSTS(31) = 2
CONSTS(32) = 1.1101
CONSTS(33) = 0.435
CONSTS(34) = 2
CONSTS(35) = 1
CONSTS(36) = 0.369
STATES(7) = 43.0123
CONSTS(37) = 0
CONSTS(38) = 0.0073
STATES(8) = 808.4579
CONSTS(39) = 0
CONSTS(40) = 0.6913
STATES(9) = 133.3381
CONSTS(41) = 0
CONSTS(42) = 0.0059
STATES(10) = 329.7803
CONSTS(43) = 0
RETURN
END
SUBROUTINE computeRates(VOI, CONSTS, RATES, STATES, ALGBRC)
REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
RATES(1) = TERNRY(STATES(3).LT.0.00000.AND.STATES(4).LT.0.00000, 0.00000, TERNRY(STATES(3).LT.0.00000, - STATES(4), TERNRY(STATES(4).LT.0.00000, STATES(3), STATES(3) - STATES(4))
RATES(2) = TERNRY(STATES(5).LT.0.00000.AND.STATES(6).LT.0.00000, 0.00000, TERNRY(STATES(5).LT.0.00000, - STATES(6), TERNRY(STATES(6).LT.0.00000, STATES(5), STATES(5) - STATES(6))
ALGBRC(3) = STATES(1)+STATES(2)
ALGBRC(4) = CONSTS(17)*(EXP( CONSTS(19)*(ALGBRC(3) - CONSTS(18))) - 1.00000)
ALGBRC(5) = ALGBRC(4)+CONSTS(12)
ALGBRC(1) = TERNRY(VOI.LE.CONSTS(16), VOI, TERNRY(VOI.LE. CONSTS(16)*2.00000, VOI - CONSTS(16), TERNRY(VOI.LE. CONSTS(16)*3.00000, VOI - CONSTS(16)*2.00000, TERNRY(VOI.LE. CONSTS(16)*4.00000, VOI - CONSTS(16)*3.00000, TERNRY(VOI.LE. CONSTS(16)*5.00000, VOI - CONSTS(16)*4.00000, TERNRY(VOI.LE. CONSTS(16)*6.00000, VOI - CONSTS(16)*5.00000, TERNRY(VOI.LE. CONSTS(16)*7.00000, VOI - CONSTS(16)*6.00000, TERNRY(VOI.LE. CONSTS(16)*8.00000, VOI - CONSTS(16)*7.00000, TERNRY(VOI.LE. CONSTS(16)*9.00000, VOI - CONSTS(16)*8.00000, TERNRY(VOI.LE. CONSTS(16)*10.0000, VOI - CONSTS(16)*9.00000, TERNRY(VOI.LE. CONSTS(16)*11.0000, VOI - CONSTS(16)*10.0000, TERNRY(VOI.LE. CONSTS(16)*12.0000, VOI - CONSTS(16)*11.0000, TERNRY(VOI.LE. CONSTS(16)*13.0000, VOI - CONSTS(16)*12.0000, 0.0/0.0)
ALGBRC(2) = CONSTS(13)*EXP( - CONSTS(14)*ALGBRC(1) - CONSTS(15) ** 2.00000)
CALL minimize(minfunc_0, CONSTS, VARIABLES, ALGBRC(6))
ALGBRC(7) = STATES(1) - ALGBRC(6)
ALGBRC(8) = CONSTS(20)*(ALGBRC(7) - CONSTS(23))
ALGBRC(9) = CONSTS(22)*(EXP( CONSTS(21)*(ALGBRC(7) - CONSTS(24))) - 1.00000)
ALGBRC(10) = ALGBRC(2)*ALGBRC(8)+ (1.00000 - ALGBRC(2))*ALGBRC(9)
ALGBRC(11) = ALGBRC(10)+ALGBRC(5)
ALGBRC(18) = CONSTS(40)*(STATES(9) - CONSTS(41))
RATES(4) = TERNRY(ALGBRC(11) - ALGBRC(18).LT.0.00000.AND.STATES(4).LT.0.00000, 0.00000, ((ALGBRC(11) - ALGBRC(18)) - STATES(4)*CONSTS(2))/CONSTS(10))
ALGBRC(12) = STATES(2)+ALGBRC(6)
ALGBRC(13) = CONSTS(25)*(ALGBRC(12) - CONSTS(28))
ALGBRC(14) = CONSTS(27)*(EXP( CONSTS(26)*(ALGBRC(12) - CONSTS(29))) - 1.00000)
ALGBRC(15) = ALGBRC(2)*ALGBRC(13)+ (1.00000 - ALGBRC(2))*ALGBRC(14)
ALGBRC(16) = ALGBRC(15)+ALGBRC(5)
ALGBRC(17) = CONSTS(36)*(STATES(7) - CONSTS(37))+CONSTS(12)
RATES(6) = TERNRY(ALGBRC(16) - ALGBRC(17).LT.0.00000.AND.STATES(6).LT.0.00000, 0.00000, ((ALGBRC(16) - ALGBRC(17)) - STATES(6)*CONSTS(4))/CONSTS(8))
ALGBRC(19) = CONSTS(38)*(STATES(8) - CONSTS(39))+CONSTS(12)
RATES(3) = TERNRY(ALGBRC(19) - ALGBRC(11).LT.0.00000.AND.STATES(3).LT.0.00000, 0.00000, ((ALGBRC(19) - ALGBRC(11)) - STATES(3)*CONSTS(1))/CONSTS(9))
ALGBRC(20) = CONSTS(42)*(STATES(10) - CONSTS(43))
RATES(5) = TERNRY(ALGBRC(20) - ALGBRC(16).LT.0.00000.AND.STATES(5).LT.0.00000, 0.00000, ((ALGBRC(20) - ALGBRC(16)) - STATES(5)*CONSTS(3))/CONSTS(7))
ALGBRC(21) = (ALGBRC(17) - ALGBRC(19))/CONSTS(5)
RATES(7) = TERNRY(STATES(6).LT.0.00000, - ALGBRC(21), STATES(6) - ALGBRC(21))
RATES(8) = TERNRY(STATES(3).LT.0.00000, ALGBRC(21), ALGBRC(21) - STATES(3))
ALGBRC(22) = (ALGBRC(18) - ALGBRC(20))/CONSTS(6)
RATES(9) = TERNRY(STATES(4).LT.0.00000, - ALGBRC(22), STATES(4) - ALGBRC(22))
RATES(10) = TERNRY(STATES(5).LT.0.00000, ALGBRC(22), ALGBRC(22) - STATES(5))
RETURN
END
SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC)
REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*)
ALGBRC(3) = STATES(1)+STATES(2)
ALGBRC(4) = CONSTS(17)*(EXP( CONSTS(19)*(ALGBRC(3) - CONSTS(18))) - 1.00000)
ALGBRC(5) = ALGBRC(4)+CONSTS(12)
ALGBRC(1) = TERNRY(VOI.LE.CONSTS(16), VOI, TERNRY(VOI.LE. CONSTS(16)*2.00000, VOI - CONSTS(16), TERNRY(VOI.LE. CONSTS(16)*3.00000, VOI - CONSTS(16)*2.00000, TERNRY(VOI.LE. CONSTS(16)*4.00000, VOI - CONSTS(16)*3.00000, TERNRY(VOI.LE. CONSTS(16)*5.00000, VOI - CONSTS(16)*4.00000, TERNRY(VOI.LE. CONSTS(16)*6.00000, VOI - CONSTS(16)*5.00000, TERNRY(VOI.LE. CONSTS(16)*7.00000, VOI - CONSTS(16)*6.00000, TERNRY(VOI.LE. CONSTS(16)*8.00000, VOI - CONSTS(16)*7.00000, TERNRY(VOI.LE. CONSTS(16)*9.00000, VOI - CONSTS(16)*8.00000, TERNRY(VOI.LE. CONSTS(16)*10.0000, VOI - CONSTS(16)*9.00000, TERNRY(VOI.LE. CONSTS(16)*11.0000, VOI - CONSTS(16)*10.0000, TERNRY(VOI.LE. CONSTS(16)*12.0000, VOI - CONSTS(16)*11.0000, TERNRY(VOI.LE. CONSTS(16)*13.0000, VOI - CONSTS(16)*12.0000, 0.0/0.0)
ALGBRC(2) = CONSTS(13)*EXP( - CONSTS(14)*ALGBRC(1) - CONSTS(15) ** 2.00000)
ALGBRC(7) = STATES(1) - ALGBRC(6)
ALGBRC(8) = CONSTS(20)*(ALGBRC(7) - CONSTS(23))
ALGBRC(9) = CONSTS(22)*(EXP( CONSTS(21)*(ALGBRC(7) - CONSTS(24))) - 1.00000)
ALGBRC(10) = ALGBRC(2)*ALGBRC(8)+ (1.00000 - ALGBRC(2))*ALGBRC(9)
ALGBRC(11) = ALGBRC(10)+ALGBRC(5)
ALGBRC(18) = CONSTS(40)*(STATES(9) - CONSTS(41))
ALGBRC(12) = STATES(2)+ALGBRC(6)
ALGBRC(13) = CONSTS(25)*(ALGBRC(12) - CONSTS(28))
ALGBRC(14) = CONSTS(27)*(EXP( CONSTS(26)*(ALGBRC(12) - CONSTS(29))) - 1.00000)
ALGBRC(15) = ALGBRC(2)*ALGBRC(13)+ (1.00000 - ALGBRC(2))*ALGBRC(14)
ALGBRC(16) = ALGBRC(15)+ALGBRC(5)
ALGBRC(17) = CONSTS(36)*(STATES(7) - CONSTS(37))+CONSTS(12)
ALGBRC(19) = CONSTS(38)*(STATES(8) - CONSTS(39))+CONSTS(12)
ALGBRC(20) = CONSTS(42)*(STATES(10) - CONSTS(43))
ALGBRC(21) = (ALGBRC(17) - ALGBRC(19))/CONSTS(5)
ALGBRC(22) = (ALGBRC(18) - ALGBRC(20))/CONSTS(6)
RETURN
END
REAL FUNCTION minfunc_0(CONSTS, VARIABLES)
REAL CONSTS(*), VARIABLES(*)
minfunc_0 = abs(0.00000 - ((( ALGBRC(2)*CONSTS(30)*(ALGBRC(6) - CONSTS(31))+ (CONSTS(35) - ALGBRC(2))*CONSTS(32)*(EXP( CONSTS(33)*(ALGBRC(6) - CONSTS(34))) - CONSTS(35))) - ALGBRC(2)*CONSTS(20)*(STATES(1) - ALGBRC(6))) - (1.00000 - ALGBRC(2))*CONSTS(22)*(EXP( CONSTS(21)*(STATES(1) - ALGBRC(6))) - 1.00000))+ ALGBRC(2)*CONSTS(25)*(STATES(2)+ALGBRC(6))+ (1.00000 - ALGBRC(2))*CONSTS(27)*(EXP( CONSTS(26)*(STATES(2)+ALGBRC(6))) - 1.00000))
RETURN
END
REAL FUNCTION TERNRY(TEST, VALA, VALB)
LOGICAL TEST
REAL VALA, VALB
IF (TEST) THEN
TERNRY = VALA
ELSE
TERNRY = VALB
ENDIF
RETURN
END
