# Size of variable arrays: sizeAlgebraic = 131 sizeStates = 45 sizeConstants = 164 from math import * from numpy import * def createLegends(): legend_states = [""] * sizeStates legend_rates = [""] * sizeStates legend_algebraic = [""] * sizeAlgebraic legend_voi = "" legend_constants = [""] * sizeConstants legend_voi = "time in component environment (millisecond)" legend_states[0] = "V in component cell (millivolt)" legend_algebraic[57] = "i_Na in component INa (microA_per_microF)" legend_algebraic[60] = "i_Nab in component INab (microA_per_microF)" legend_algebraic[64] = "i_NaK in component INaK (microA_per_microF)" legend_algebraic[66] = "i_Kr in component IKr (microA_per_microF)" legend_algebraic[74] = "i_Ks in component IKs (microA_per_microF)" legend_algebraic[75] = "i_tos in component Itos (microA_per_microF)" legend_algebraic[76] = "i_tof in component Itof (microA_per_microF)" legend_algebraic[80] = "i_K1 in component IK1 (microA_per_microF)" legend_algebraic[99] = "i_NaCa in component INaCa (microA_per_microF)" legend_algebraic[81] = "i_Cl_Ca in component ICl_Ca (microA_per_microF)" legend_algebraic[82] = "i_Clb in component IClb (microA_per_microF)" legend_algebraic[91] = "i_CaL in component ICaL (microA_per_microF)" legend_algebraic[108] = "i_Cab in component ICab (microA_per_microF)" legend_algebraic[105] = "i_Cap in component ICap (microA_per_microF)" legend_algebraic[6] = "i_Stim in component cell (microA_per_microF)" legend_constants[0] = "stim_start in component cell (millisecond)" legend_constants[1] = "stim_period in component cell (millisecond)" legend_constants[2] = "stim_duration in component cell (millisecond)" legend_constants[3] = "stim_amplitude in component cell (microA_per_microF)" legend_constants[4] = "Ko in component model_parameters (millimolar)" legend_constants[5] = "Nao in component model_parameters (millimolar)" legend_constants[6] = "Cao in component model_parameters (millimolar)" legend_constants[7] = "Clo in component model_parameters (millimolar)" legend_constants[8] = "Ki in component model_parameters (millimolar)" legend_constants[9] = "Mgi in component model_parameters (millimolar)" legend_constants[10] = "Cli in component model_parameters (millimolar)" legend_constants[11] = "R in component model_parameters (joule_per_kilomole_kelvin)" legend_constants[12] = "T in component model_parameters (kelvin)" legend_constants[13] = "F in component model_parameters (coulomb_per_mole)" legend_constants[156] = "Cm in component model_parameters (farad)" legend_constants[14] = "Cm_per_area in component model_parameters (farad_per_cm2)" legend_constants[15] = "cell_length in component model_parameters (micrometre)" legend_constants[16] = "cell_radius in component model_parameters (micrometre)" legend_constants[157] = "Vol_Cell in component model_parameters (litre)" legend_constants[158] = "Vol_SR in component model_parameters (litre)" legend_constants[159] = "Vol_SL in component model_parameters (litre)" legend_constants[160] = "Vol_jct in component model_parameters (litre)" legend_constants[161] = "Vol_cytosol in component model_parameters (litre)" legend_constants[162] = "Vol_mito in component model_parameters (litre)" legend_algebraic[26] = "E_Na_jct in component reversal_potentials (millivolt)" legend_algebraic[46] = "E_Na_SL in component reversal_potentials (millivolt)" legend_algebraic[51] = "E_Ca_jct in component reversal_potentials (millivolt)" legend_algebraic[53] = "E_Ca_SL in component reversal_potentials (millivolt)" legend_constants[145] = "E_K in component reversal_potentials (millivolt)" legend_constants[146] = "E_Cl in component reversal_potentials (millivolt)" legend_states[1] = "Nai in component Na_buffer (millimolar)" legend_states[2] = "Na_jct in component Na_buffer (millimolar)" legend_states[3] = "Na_SL in component Na_buffer (millimolar)" legend_states[4] = "Cai in component Ca_buffer (millimolar)" legend_states[5] = "Ca_jct in component Ca_buffer (millimolar)" legend_states[6] = "Ca_SL in component Ca_buffer (millimolar)" legend_algebraic[55] = "i_Na_jct in component INa (microA_per_microF)" legend_algebraic[56] = "i_Na_SL in component INa (microA_per_microF)" legend_constants[17] = "G_INa in component INa (milliS_per_microF)" legend_constants[18] = "Fx_Na_jct in component INa (dimensionless)" legend_constants[19] = "Fx_Na_SL in component INa (dimensionless)" legend_states[7] = "m in component INa_m_gate (dimensionless)" legend_states[8] = "h in component INa_h_gate (dimensionless)" legend_states[9] = "j in component INa_j_gate (dimensionless)" legend_algebraic[54] = "openProb in component INa (dimensionless)" legend_algebraic[0] = "alpha_h in component INa_h_gate (per_millisecond)" legend_algebraic[22] = "beta_h in component INa_h_gate (per_millisecond)" legend_algebraic[43] = "tau_h in component INa_h_gate (millisecond)" legend_algebraic[48] = "h_infinity in component INa_h_gate (dimensionless)" legend_algebraic[1] = "alpha_j in component INa_j_gate (per_millisecond)" legend_algebraic[23] = "beta_j in component INa_j_gate (per_millisecond)" legend_algebraic[44] = "tau_j in component INa_j_gate (millisecond)" legend_algebraic[49] = "j_infinity in component INa_j_gate (dimensionless)" legend_algebraic[2] = "alpha_m in component INa_m_gate (per_millisecond)" legend_algebraic[24] = "beta_m in component INa_m_gate (per_millisecond)" legend_algebraic[45] = "tau_m in component INa_m_gate (millisecond)" legend_algebraic[50] = "m_infinity in component INa_m_gate (dimensionless)" legend_algebraic[58] = "i_Nab_jct in component INab (microA_per_microF)" legend_algebraic[59] = "i_Nab_SL in component INab (microA_per_microF)" legend_constants[20] = "G_NaBk in component INab (milliS_per_microF)" legend_constants[21] = "Fx_NaBk_jct in component INab (dimensionless)" legend_constants[22] = "Fx_NaBk_SL in component INab (dimensionless)" legend_algebraic[62] = "i_NaK_jct in component INaK (microA_per_microF)" legend_algebraic[63] = "i_NaK_SL in component INaK (microA_per_microF)" legend_algebraic[61] = "f_NaK in component INaK (dimensionless)" legend_constants[23] = "Q10_NaK in component INaK (dimensionless)" legend_constants[147] = "Q_NaK in component INaK (dimensionless)" legend_constants[24] = "H_NaK in component INaK (dimensionless)" legend_constants[25] = "Q10_Km_Nai in component INaK (dimensionless)" legend_constants[148] = "Q_Km_Nai in component INaK (dimensionless)" legend_constants[26] = "Km_Nai in component INaK (millimolar)" legend_constants[27] = "Km_Ko in component INaK (millimolar)" legend_constants[28] = "I_NaK_max in component INaK (microA_per_microF)" legend_constants[149] = "sigma in component INaK (dimensionless)" legend_constants[29] = "Fx_NaK_jct in component INaK (dimensionless)" legend_constants[30] = "Fx_NaK_SL in component INaK (dimensionless)" legend_constants[150] = "G_IKr in component IKr (milliS_per_microF)" legend_states[10] = "Xr in component IKr_Xr_gate (dimensionless)" legend_algebraic[65] = "Rr in component IKr_Rr_gate (dimensionless)" legend_algebraic[3] = "Xr_infinity in component IKr_Xr_gate (dimensionless)" legend_algebraic[25] = "tau_Xr in component IKr_Xr_gate (millisecond)" legend_algebraic[72] = "i_Ks_jct in component IKs (microA_per_microF)" legend_algebraic[73] = "i_Ks_SL in component IKs (microA_per_microF)" legend_algebraic[70] = "G_Ks_SL in component IKs (milliS_per_microF)" legend_algebraic[69] = "G_Ks_jct in component IKs (milliS_per_microF)" legend_constants[31] = "Fx_Ks_jct in component IKs (dimensionless)" legend_constants[32] = "Fx_Ks_SL in component IKs (dimensionless)" legend_algebraic[4] = "E_Ks_jct in component IKs (millivolt)" legend_algebraic[5] = "E_Ks_SL in component IKs (millivolt)" legend_algebraic[71] = "E_Ks in component IKs (millivolt)" legend_constants[33] = "pKNa in component IKs (dimensionless)" legend_algebraic[67] = "pCa_jct in component IKs (dimensionless)" legend_algebraic[68] = "pCa_SL in component IKs (dimensionless)" legend_states[11] = "Xs in component IKs_Xs_gate (dimensionless)" legend_algebraic[7] = "Xs_infinity in component IKs_Xs_gate (dimensionless)" legend_algebraic[27] = "tau_Xs in component IKs_Xs_gate (millisecond)" legend_constants[34] = "G_tos in component Itos (milliS_per_microF)" legend_states[12] = "Y_tos in component Itos_Y_gate (dimensionless)" legend_states[13] = "X_tos in component Itos_X_gate (dimensionless)" legend_states[14] = "R_tos in component Itos_R_gate (dimensionless)" legend_algebraic[8] = "X_tos_infinity in component Itos_X_gate (dimensionless)" legend_algebraic[28] = "tau_X_tos in component Itos_X_gate (millisecond)" legend_algebraic[9] = "Y_tos_infinity in component Itos_Y_gate (dimensionless)" legend_algebraic[29] = "tau_Y_tos in component Itos_Y_gate (millisecond)" legend_algebraic[10] = "R_tos_infinity in component Itos_R_gate (dimensionless)" legend_algebraic[30] = "R_tos_other in component Itos_R_gate (dimensionless)" legend_algebraic[31] = "tau_R_tos in component Itos_R_gate (millisecond)" legend_constants[35] = "G_tof in component Itof (milliS_per_microF)" legend_states[15] = "Y_tof in component Itof_Y_gate (dimensionless)" legend_states[16] = "X_tof in component Itof_X_gate (dimensionless)" legend_algebraic[11] = "X_tof_infinity in component Itof_X_gate (dimensionless)" legend_algebraic[32] = "tau_X_tof in component Itof_X_gate (millisecond)" legend_algebraic[12] = "Y_tof_infinity in component Itof_Y_gate (dimensionless)" legend_algebraic[33] = "tau_Y_tof in component Itof_Y_gate (millisecond)" legend_constants[151] = "G_K1 in component IK1 (milliS_per_microF)" legend_algebraic[79] = "K1_infinity in component IK1_K1_gate (dimensionless)" legend_algebraic[77] = "alpha_K1 in component IK1_K1_gate (per_millisecond)" legend_algebraic[78] = "beta_K1 in component IK1_K1_gate (per_millisecond)" legend_constants[36] = "G_Cl in component ICl_Ca (milliS_per_microF)" legend_constants[37] = "Kd_ClCa in component ICl_Ca (millimolar)" legend_constants[38] = "Fx_Cl_jct in component ICl_Ca (dimensionless)" legend_constants[39] = "Fx_Cl_SL in component ICl_Ca (dimensionless)" legend_constants[40] = "G_ClBk in component IClb (milliS_per_microF)" legend_algebraic[85] = "i_CaL_Ca_SL in component ICaL (microA_per_microF)" legend_algebraic[88] = "i_CaL_Ca_jct in component ICaL (microA_per_microF)" legend_algebraic[86] = "i_CaL_Na_SL in component ICaL (microA_per_microF)" legend_algebraic[89] = "i_CaL_Na_jct in component ICaL (microA_per_microF)" legend_algebraic[90] = "i_CaL_K in component ICaL (microA_per_microF)" legend_constants[41] = "PCa in component ICaL (litre_per_farad_millisecond)" legend_constants[42] = "PNa in component ICaL (litre_per_farad_millisecond)" legend_constants[43] = "PK in component ICaL (litre_per_farad_millisecond)" legend_constants[44] = "Fx_ICaL_jct in component ICaL (dimensionless)" legend_constants[45] = "Fx_ICaL_SL in component ICaL (dimensionless)" legend_constants[46] = "gamma_Cai in component ICaL (dimensionless)" legend_constants[47] = "gamma_Cao in component ICaL (dimensionless)" legend_constants[48] = "gamma_Nai in component ICaL (dimensionless)" legend_constants[49] = "gamma_Nao in component ICaL (dimensionless)" legend_constants[50] = "gamma_Ki in component ICaL (dimensionless)" legend_constants[51] = "gamma_Ko in component ICaL (dimensionless)" legend_constants[52] = "Q10_CaL in component ICaL (dimensionless)" legend_constants[152] = "Q_CaL in component ICaL (dimensionless)" legend_states[17] = "d in component ICaL_d_gate (dimensionless)" legend_states[18] = "f in component ICaL_f_gate (dimensionless)" legend_algebraic[84] = "fCa_SL in component ICaL_fCa_gate (dimensionless)" legend_algebraic[87] = "fCa_jct in component ICaL_fCa_gate (dimensionless)" legend_algebraic[83] = "temp in component ICaL (coulomb_per_mole)" legend_algebraic[13] = "d_infinity in component ICaL_d_gate (dimensionless)" legend_algebraic[34] = "tau_d in component ICaL_d_gate (millisecond)" legend_algebraic[14] = "f_infinity in component ICaL_f_gate (dimensionless)" legend_algebraic[35] = "tau_f in component ICaL_f_gate (millisecond)" legend_states[19] = "fCaB_SL in component ICaL_fCa_gate (dimensionless)" legend_states[20] = "fCaB_jct in component ICaL_fCa_gate (dimensionless)" legend_algebraic[97] = "i_NaCa_SL in component INaCa (microA_per_microF)" legend_algebraic[96] = "i_NaCa_jct in component INaCa (microA_per_microF)" legend_constants[53] = "V_max in component INaCa (microA_per_microF)" legend_constants[54] = "Fx_NCX_jct in component INaCa (dimensionless)" legend_constants[55] = "Fx_NCX_SL in component INaCa (dimensionless)" legend_constants[56] = "Q10_NCX in component INaCa (dimensionless)" legend_constants[153] = "Q_NCX in component INaCa (dimensionless)" legend_constants[57] = "K_mNai in component INaCa (millimolar)" legend_constants[58] = "K_mCao in component INaCa (millimolar)" legend_constants[59] = "K_mNao in component INaCa (millimolar)" legend_constants[60] = "K_mCai in component INaCa (millimolar)" legend_algebraic[94] = "Ka_SL in component INaCa (dimensionless)" legend_algebraic[95] = "Ka_jct in component INaCa (dimensionless)" legend_constants[61] = "Kd_act in component INaCa (millimolar)" legend_constants[62] = "ksat in component INaCa (dimensionless)" legend_constants[63] = "eta in component INaCa (dimensionless)" legend_constants[64] = "HNa in component INaCa (dimensionless)" legend_algebraic[92] = "temp_jct in component INaCa (millimolar4)" legend_algebraic[93] = "temp_SL in component INaCa (millimolar4)" legend_algebraic[104] = "i_Cap_SL in component ICap (microA_per_microF)" legend_algebraic[102] = "i_Cap_jct in component ICap (microA_per_microF)" legend_constants[65] = "V_max in component ICap (millimolar_per_millisecond)" legend_constants[66] = "Fx_SLCaP_jct in component ICap (dimensionless)" legend_constants[67] = "Fx_SLCaP_SL in component ICap (dimensionless)" legend_constants[68] = "Q10_SLCaP in component ICap (dimensionless)" legend_constants[154] = "Q_SLCaP in component ICap (dimensionless)" legend_constants[69] = "Km in component ICap (millimolar)" legend_constants[70] = "H in component ICap (dimensionless)" legend_constants[163] = "V_maxAF_old in component ICap (microA_per_microF)" legend_constants[71] = "V_maxAF in component ICap (microA_per_microF)" legend_algebraic[106] = "i_Cab_jct in component ICab (microA_per_microF)" legend_algebraic[107] = "i_Cab_SL in component ICab (microA_per_microF)" legend_constants[72] = "G_CaBk in component ICab (milliS_per_microF)" legend_constants[73] = "Fx_CaBk_jct in component ICab (dimensionless)" legend_constants[74] = "Fx_CaBk_SL in component ICab (dimensionless)" legend_algebraic[109] = "j_rel_SR in component Jrel_SR (millimolar_per_millisecond)" legend_constants[75] = "Max_SR in component Jrel_SR (dimensionless)" legend_constants[76] = "Min_SR in component Jrel_SR (dimensionless)" legend_constants[77] = "EC50_SR in component Jrel_SR (millimolar)" legend_states[21] = "R in component Jrel_SR (dimensionless)" legend_states[22] = "I in component Jrel_SR (dimensionless)" legend_algebraic[52] = "RI in component Jrel_SR (dimensionless)" legend_states[23] = "O in component Jrel_SR (dimensionless)" legend_constants[78] = "ks in component Jrel_SR (per_millisecond)" legend_constants[79] = "koCa in component Jrel_SR (per_millimolar2_per_millisecond)" legend_constants[80] = "kom in component Jrel_SR (per_millisecond)" legend_constants[81] = "kiCa in component Jrel_SR (per_millimolar_per_millisecond)" legend_constants[82] = "kim in component Jrel_SR (per_millisecond)" legend_constants[83] = "HSR in component Jrel_SR (dimensionless)" legend_states[24] = "Ca_SR in component Ca_buffer (millimolar)" legend_algebraic[15] = "kCaSR in component Jrel_SR (dimensionless)" legend_algebraic[36] = "koSRCa in component Jrel_SR (per_millimolar2_per_millisecond)" legend_algebraic[47] = "kiSRCa in component Jrel_SR (per_millimolar_per_millisecond)" legend_algebraic[110] = "j_leak_SR in component Jleak_SR (millimolar_per_millisecond)" legend_constants[84] = "KSRleak in component Jleak_SR (per_millisecond)" legend_algebraic[111] = "j_pump_SR in component Jpump_SR (millimolar_per_millisecond)" legend_constants[85] = "V_max in component Jpump_SR (millimolar_per_millisecond)" legend_constants[86] = "Q10_SRCaP in component Jpump_SR (dimensionless)" legend_constants[155] = "Q_SRCaP in component Jpump_SR (dimensionless)" legend_constants[87] = "Kmf in component Jpump_SR (millimolar)" legend_constants[88] = "Kmr in component Jpump_SR (millimolar)" legend_constants[89] = "H in component Jpump_SR (dimensionless)" legend_algebraic[98] = "J_Na_jct_SL in component ion_diffusion (millimole_per_millisecond)" legend_algebraic[101] = "J_Na_SL_cytosol in component ion_diffusion (millimole_per_millisecond)" legend_algebraic[113] = "J_Ca_jct_SL in component ion_diffusion (millimole_per_millisecond)" legend_algebraic[114] = "J_Ca_SL_cytosol in component ion_diffusion (millimole_per_millisecond)" legend_constants[90] = "D_Ca_jct_SL in component ion_diffusion (dm2_per_second)" legend_constants[91] = "D_Ca_SL_cytosol in component ion_diffusion (dm2_per_second)" legend_constants[92] = "D_Na_jct_SL in component ion_diffusion (dm2_per_second)" legend_constants[93] = "D_Na_SL_cytosol in component ion_diffusion (dm2_per_second)" legend_constants[94] = "x_jct_SL in component ion_diffusion (micrometre)" legend_constants[95] = "x_SL_cytosol in component ion_diffusion (micrometre)" legend_constants[96] = "A_jct_SL in component ion_diffusion (cm2)" legend_constants[97] = "A_SL_cytosol in component ion_diffusion (cm2)" legend_algebraic[16] = "J_Na_jct_SL_old in component ion_diffusion (millimole_per_millisecond)" legend_algebraic[17] = "J_Na_SL_cytosol_old in component ion_diffusion (millimole_per_millisecond)" legend_algebraic[18] = "J_Ca_jct_SL_old in component ion_diffusion (millimole_per_millisecond)" legend_algebraic[19] = "J_Ca_SL_cytosol_old in component ion_diffusion (millimole_per_millisecond)" legend_states[25] = "Na_SL_buf in component Na_buffer (millimolar)" legend_states[26] = "Na_jct_buf in component Na_buffer (millimolar)" legend_constants[98] = "Bmax_SL in component Na_buffer (millimolar)" legend_constants[99] = "Bmax_jct in component Na_buffer (millimolar)" legend_constants[100] = "kon in component Na_buffer (per_millimolar_per_millisecond)" legend_constants[101] = "koff in component Na_buffer (per_millisecond)" legend_algebraic[100] = "dNa_jct_buf in component Na_buffer (millimolar_per_millisecond)" legend_algebraic[103] = "dNa_SL_buf in component Na_buffer (millimolar_per_millisecond)" legend_states[27] = "Ca_SLB_SL in component Ca_buffer (millimolar)" legend_states[28] = "Ca_SLB_jct in component Ca_buffer (millimolar)" legend_states[29] = "Ca_SLHigh_SL in component Ca_buffer (millimolar)" legend_states[30] = "Ca_SLHigh_jct in component Ca_buffer (millimolar)" legend_states[31] = "Ca_Calsequestrin in component Ca_buffer (millimolar)" legend_constants[102] = "Bmax_SLB_SL in component Ca_buffer (millimolar)" legend_constants[103] = "Bmax_SLB_jct in component Ca_buffer (millimolar)" legend_constants[104] = "Bmax_SLHigh_SL in component Ca_buffer (millimolar)" legend_constants[105] = "Bmax_SLHigh_jct in component Ca_buffer (millimolar)" legend_constants[106] = "Bmax_Calsequestrin in component Ca_buffer (millimolar)" legend_constants[107] = "kon_SL in component Ca_buffer (per_millimolar_per_millisecond)" legend_constants[108] = "kon_Calsequestrin in component Ca_buffer (per_millimolar_per_millisecond)" legend_constants[109] = "koff_SLB in component Ca_buffer (per_millisecond)" legend_constants[110] = "koff_SLHigh in component Ca_buffer (per_millisecond)" legend_constants[111] = "koff_Calsequestrin in component Ca_buffer (per_millisecond)" legend_algebraic[112] = "dCalsequestrin in component Ca_buffer (millimolar_per_millisecond)" legend_algebraic[130] = "dCa_cytosol_tot_bound in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_algebraic[117] = "dCa_SLB_SL in component Ca_buffer (millimolar_per_millisecond)" legend_algebraic[115] = "dCa_SLB_jct in component Ca_buffer (millimolar_per_millisecond)" legend_algebraic[120] = "dCa_SLHigh_SL in component Ca_buffer (millimolar_per_millisecond)" legend_algebraic[118] = "dCa_SLHigh_jct in component Ca_buffer (millimolar_per_millisecond)" legend_algebraic[121] = "dCa_jct_tot_bound in component Ca_buffer (millimolar_per_millisecond)" legend_algebraic[124] = "dCa_SL_tot_bound in component Ca_buffer (millimolar_per_millisecond)" legend_algebraic[123] = "i_Ca_jct_tot in component Ca_buffer (microA_per_microF)" legend_algebraic[126] = "i_Ca_SL_tot in component Ca_buffer (microA_per_microF)" legend_states[32] = "Ca_TroponinC in component cytosolic_Ca_buffer (millimolar)" legend_states[33] = "Ca_TroponinC_Ca_Mg in component cytosolic_Ca_buffer (millimolar)" legend_states[34] = "Mg_TroponinC_Ca_Mg in component cytosolic_Ca_buffer (millimolar)" legend_states[35] = "Ca_Calmodulin in component cytosolic_Ca_buffer (millimolar)" legend_states[36] = "Ca_Myosin in component cytosolic_Ca_buffer (millimolar)" legend_states[37] = "Mg_Myosin in component cytosolic_Ca_buffer (millimolar)" legend_states[38] = "Ca_SRB in component cytosolic_Ca_buffer (millimolar)" legend_constants[112] = "Bmax_TroponinC in component cytosolic_Ca_buffer (millimolar)" legend_constants[113] = "Bmax_TroponinC_Ca_Mg_Ca in component cytosolic_Ca_buffer (millimolar)" legend_constants[114] = "Bmax_TroponinC_Ca_Mg_Mg in component cytosolic_Ca_buffer (millimolar)" legend_constants[115] = "Bmax_Calmodulin in component cytosolic_Ca_buffer (millimolar)" legend_constants[116] = "Bmax_Myosin_Ca in component cytosolic_Ca_buffer (millimolar)" legend_constants[117] = "Bmax_Myosin_Mg in component cytosolic_Ca_buffer (millimolar)" legend_constants[118] = "Bmax_SRB in component cytosolic_Ca_buffer (millimolar)" legend_constants[119] = "kon_TroponinC in component cytosolic_Ca_buffer (per_millimolar_per_millisecond)" legend_constants[120] = "kon_TroponinC_Ca_Mg_Ca in component cytosolic_Ca_buffer (per_millimolar_per_millisecond)" legend_constants[121] = "kon_TroponinC_Ca_Mg_Mg in component cytosolic_Ca_buffer (per_millimolar_per_millisecond)" legend_constants[122] = "kon_Calmodulin in component cytosolic_Ca_buffer (per_millimolar_per_millisecond)" legend_constants[123] = "kon_Myosin_Ca in component cytosolic_Ca_buffer (per_millimolar_per_millisecond)" legend_constants[124] = "kon_Myosin_Mg in component cytosolic_Ca_buffer (per_millimolar_per_millisecond)" legend_constants[125] = "kon_SRB in component cytosolic_Ca_buffer (per_millimolar_per_millisecond)" legend_constants[126] = "koff_TroponinC in component cytosolic_Ca_buffer (per_millisecond)" legend_constants[127] = "koff_TroponinC_Ca_Mg_Ca in component cytosolic_Ca_buffer (per_millisecond)" legend_constants[128] = "koff_TroponinC_Ca_Mg_Mg in component cytosolic_Ca_buffer (per_millisecond)" legend_constants[129] = "koff_Calmodulin in component cytosolic_Ca_buffer (per_millisecond)" legend_constants[130] = "koff_Myosin_Ca in component cytosolic_Ca_buffer (per_millisecond)" legend_constants[131] = "koff_Myosin_Mg in component cytosolic_Ca_buffer (per_millisecond)" legend_constants[132] = "koff_SRB in component cytosolic_Ca_buffer (per_millisecond)" legend_algebraic[116] = "dCa_TroponinC in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_algebraic[119] = "dCa_TroponinC_Ca_Mg in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_algebraic[122] = "dMg_TroponinC_Ca_Mg in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_algebraic[125] = "dCa_Calmodulin in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_algebraic[127] = "dCa_Myosin in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_algebraic[128] = "dMg_Myosin in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_algebraic[129] = "dCa_SRB in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_constants[133] = "Indo1 in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[134] = "Fluo3 in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_states[39] = "Ca_Indo1_Cytosol in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_states[40] = "Ca_Indo1_SL in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_states[41] = "Ca_Indo1_jct in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_states[42] = "Ca_Fluo3_Cytosol in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_states[43] = "Ca_Fluo3_SL in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_states[44] = "Ca_Fluo3_jct in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[135] = "Bmax_Indo1_Cytosol in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[136] = "Bmax_Indo1_SL in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[137] = "Bmax_Indo1_jct in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[138] = "Bmax_Fluo3_Cytosol in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[139] = "Bmax_Fluo3_SL in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[140] = "Bmax_Fluo3_jct in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[141] = "kon_Indo1 in component indo_fluo_Ca_buffer_not_connected (per_millimolar2_per_millisecond)" legend_constants[142] = "kon_Fluo3 in component indo_fluo_Ca_buffer_not_connected (per_millimolar2_per_millisecond)" legend_constants[143] = "koff_Indo1 in component indo_fluo_Ca_buffer_not_connected (per_millisecond)" legend_constants[144] = "koff_Fluo3 in component indo_fluo_Ca_buffer_not_connected (per_millisecond)" legend_algebraic[20] = "Indo1Bound in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_algebraic[21] = "Fluo3Bound in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_algebraic[37] = "dCa_Indo1_Cytosol in component indo_fluo_Ca_buffer_not_connected (millimolar_per_millisecond)" legend_algebraic[38] = "dCa_Indo1_jct in component indo_fluo_Ca_buffer_not_connected (millimolar_per_millisecond)" legend_algebraic[39] = "dCa_Indo1_SL in component indo_fluo_Ca_buffer_not_connected (millimolar_per_millisecond)" legend_algebraic[40] = "dCa_Fluo3_Cytosol in component indo_fluo_Ca_buffer_not_connected (millimolar_per_millisecond)" legend_algebraic[41] = "dCa_Fluo3_jct in component indo_fluo_Ca_buffer_not_connected (millimolar_per_millisecond)" legend_algebraic[42] = "dCa_Fluo3_SL in component indo_fluo_Ca_buffer_not_connected (millimolar_per_millisecond)" legend_rates[0] = "d/dt V in component cell (millivolt)" legend_rates[8] = "d/dt h in component INa_h_gate (dimensionless)" legend_rates[9] = "d/dt j in component INa_j_gate (dimensionless)" legend_rates[7] = "d/dt m in component INa_m_gate (dimensionless)" legend_rates[10] = "d/dt Xr in component IKr_Xr_gate (dimensionless)" legend_rates[11] = "d/dt Xs in component IKs_Xs_gate (dimensionless)" legend_rates[13] = "d/dt X_tos in component Itos_X_gate (dimensionless)" legend_rates[12] = "d/dt Y_tos in component Itos_Y_gate (dimensionless)" legend_rates[14] = "d/dt R_tos in component Itos_R_gate (dimensionless)" legend_rates[16] = "d/dt X_tof in component Itof_X_gate (dimensionless)" legend_rates[15] = "d/dt Y_tof in component Itof_Y_gate (dimensionless)" legend_rates[17] = "d/dt d in component ICaL_d_gate (dimensionless)" legend_rates[18] = "d/dt f in component ICaL_f_gate (dimensionless)" legend_rates[19] = "d/dt fCaB_SL in component ICaL_fCa_gate (dimensionless)" legend_rates[20] = "d/dt fCaB_jct in component ICaL_fCa_gate (dimensionless)" legend_rates[21] = "d/dt R in component Jrel_SR (dimensionless)" legend_rates[23] = "d/dt O in component Jrel_SR (dimensionless)" legend_rates[22] = "d/dt I in component Jrel_SR (dimensionless)" legend_rates[26] = "d/dt Na_jct_buf in component Na_buffer (millimolar)" legend_rates[25] = "d/dt Na_SL_buf in component Na_buffer (millimolar)" legend_rates[2] = "d/dt Na_jct in component Na_buffer (millimolar)" legend_rates[3] = "d/dt Na_SL in component Na_buffer (millimolar)" legend_rates[1] = "d/dt Nai in component Na_buffer (millimolar)" legend_rates[31] = "d/dt Ca_Calsequestrin in component Ca_buffer (millimolar)" legend_rates[27] = "d/dt Ca_SLB_SL in component Ca_buffer (millimolar)" legend_rates[28] = "d/dt Ca_SLB_jct in component Ca_buffer (millimolar)" legend_rates[29] = "d/dt Ca_SLHigh_SL in component Ca_buffer (millimolar)" legend_rates[30] = "d/dt Ca_SLHigh_jct in component Ca_buffer (millimolar)" legend_rates[24] = "d/dt Ca_SR in component Ca_buffer (millimolar)" legend_rates[5] = "d/dt Ca_jct in component Ca_buffer (millimolar)" legend_rates[6] = "d/dt Ca_SL in component Ca_buffer (millimolar)" legend_rates[4] = "d/dt Cai in component Ca_buffer (millimolar)" legend_rates[32] = "d/dt Ca_TroponinC in component cytosolic_Ca_buffer (millimolar)" legend_rates[33] = "d/dt Ca_TroponinC_Ca_Mg in component cytosolic_Ca_buffer (millimolar)" legend_rates[34] = "d/dt Mg_TroponinC_Ca_Mg in component cytosolic_Ca_buffer (millimolar)" legend_rates[35] = "d/dt Ca_Calmodulin in component cytosolic_Ca_buffer (millimolar)" legend_rates[36] = "d/dt Ca_Myosin in component cytosolic_Ca_buffer (millimolar)" legend_rates[37] = "d/dt Mg_Myosin in component cytosolic_Ca_buffer (millimolar)" legend_rates[38] = "d/dt Ca_SRB in component cytosolic_Ca_buffer (millimolar)" legend_rates[39] = "d/dt Ca_Indo1_Cytosol in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_rates[40] = "d/dt Ca_Indo1_SL in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_rates[41] = "d/dt Ca_Indo1_jct in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_rates[42] = "d/dt Ca_Fluo3_Cytosol in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_rates[43] = "d/dt Ca_Fluo3_SL in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_rates[44] = "d/dt Ca_Fluo3_jct in component indo_fluo_Ca_buffer_not_connected (millimolar)" return (legend_states, legend_algebraic, legend_voi, legend_constants) def initConsts(): constants = [0.0] * sizeConstants; states = [0.0] * sizeStates; states[0] = -85.719687955637 constants[0] = 100 constants[1] = 1000 constants[2] = 5 constants[3] = 9.5 constants[4] = 5.4 constants[5] = 140 constants[6] = 1.8 constants[7] = 150 constants[8] = 135 constants[9] = 1 constants[10] = 15 constants[11] = 8314.3 constants[12] = 310 constants[13] = 96486.7 constants[14] = 2e-6 constants[15] = 100 constants[16] = 10.25 states[1] = 8.874461106492 states[2] = 8.872823559072 states[3] = 8.874077316753 states[4] = 0.000087350002 states[5] = 0.000174843061 states[6] = 0.000106395937 constants[17] = 16 constants[18] = 0.11 constants[19] = 0.89 states[7] = 0.001370685156 states[8] = 0.987140350343 states[9] = 0.991822731369 constants[20] = 0.297e-3 constants[21] = 0.11 constants[22] = 0.89 constants[23] = 1.63 constants[24] = 4 constants[25] = 1.49 constants[26] = 11 constants[27] = 1.5 constants[28] = 1.91 constants[29] = 0.11 constants[30] = 0.89 states[10] = 0.008471550841 constants[31] = 0.11 constants[32] = 0.89 constants[33] = 0.01833 states[11] = 0.00687399199 constants[34] = 0.06 states[12] = 0.293519921626 states[13] = 0.004011272375 states[14] = 0.383430556383 constants[35] = 0.02 states[15] = 0.9946314893 states[16] = 0.00401120993 constants[36] = 0.109625 constants[37] = 0.1 constants[38] = 0.11 constants[39] = 0.89 constants[40] = 0.009 constants[41] = 5.4e-4 constants[42] = 1.5e-8 constants[43] = 2.7e-7 constants[44] = 0.9 constants[45] = 0.1 constants[46] = 0.341 constants[47] = 0.341 constants[48] = 0.75 constants[49] = 0.75 constants[50] = 0.75 constants[51] = 0.75 constants[52] = 1.8 states[17] = 0.000006997531 states[18] = 1.000675515962 states[19] = 0.015352888928 states[20] = 0.024609183734 constants[53] = 9 constants[54] = 0.11 constants[55] = 0.89 constants[56] = 1.57 constants[57] = 12.29 constants[58] = 1.3 constants[59] = 87.5 constants[60] = 0.00359 constants[61] = 0.000256 constants[62] = 0.27 constants[63] = 0.35 constants[64] = 3 constants[65] = 2.2e-6 constants[66] = 0.11 constants[67] = 0.89 constants[68] = 2.35 constants[69] = 0.0005 constants[70] = 1.6 constants[71] = 0.0673 constants[72] = 0.0002513 constants[73] = 0.11 constants[74] = 0.89 constants[75] = 15 constants[76] = 1 constants[77] = 0.45 states[21] = 0.884673513138 states[22] = 0.00000009272 states[23] = 0.000000711264 constants[78] = 25 constants[79] = 10 constants[80] = 0.06 constants[81] = 0.5 constants[82] = 0.005 constants[83] = 2.5 states[24] = 0.545611267699 constants[84] = 5.348e-6 constants[85] = 286e-6 constants[86] = 2.6 constants[87] = 0.000246 constants[88] = 1.7 constants[89] = 1.787 constants[90] = 1.64e-6 constants[91] = 1.22e-6 constants[92] = 1.09e-5 constants[93] = 1.79e-5 constants[94] = 0.5 constants[95] = 0.45 constants[96] = 3.01e-6 constants[97] = 1.3e-4 states[25] = 0.776121392467 states[26] = 3.557055389701 constants[98] = 1.65 constants[99] = 7.561 constants[100] = 0.0001 constants[101] = 1e-3 states[27] = 0.009868629147 states[28] = 0.007780801995 states[29] = 0.114438990328 states[30] = 0.077503874257 states[31] = 1.186496899338 constants[102] = 0.0374 constants[103] = 0.0046 constants[104] = 0.0134 constants[105] = 0.00165 constants[106] = 0.14 constants[107] = 100 constants[108] = 100 constants[109] = 1.3 constants[110] = 30e-3 constants[111] = 65 states[32] = 0.008963736337 states[33] = 0.117995194438 states[34] = 0.010337654274 states[35] = 0.000295961245 states[36] = 0.001984672275 states[37] = 0.137497736234 states[38] = 0.002177112381 constants[112] = 0.07 constants[113] = 0.14 constants[114] = 0.14 constants[115] = 0.024 constants[116] = 0.14 constants[117] = 0.14 constants[118] = 0.0171 constants[119] = 32.7 constants[120] = 2.37 constants[121] = 3e-3 constants[122] = 34 constants[123] = 13.8 constants[124] = 15.7e-3 constants[125] = 100 constants[126] = 19.6e-3 constants[127] = 0.032e-3 constants[128] = 3.33e-3 constants[129] = 238e-3 constants[130] = 0.46e-3 constants[131] = 0.057e-3 constants[132] = 60e-3 constants[133] = 0 constants[134] = 0 states[39] = 0 states[40] = 0 states[41] = 0 states[42] = 0 states[43] = 0 states[44] = 0 constants[135] = 0.025 constants[136] = 0.00077 constants[137] = 0.00002 constants[138] = 0.025 constants[139] = 0.00077 constants[140] = 0.00002 constants[141] = 100 constants[142] = 100 constants[143] = 60e-3 constants[144] = 110e-3 constants[145] = ((constants[11]*constants[12])/constants[13])*log(constants[4]/constants[8]) constants[146] = ((-constants[11]*constants[12])/constants[13])*log(constants[7]/constants[10]) constants[147] = power(constants[23], (constants[12]-310.000)/10.0000) constants[148] = power(constants[25], (constants[12]-310.000)/10.0000) constants[149] = (exp(constants[5]/67.3000)-1.00000)/7.00000 constants[150] = 0.0300000*(power(constants[4]/5.40000, 1.0/2)) constants[151] = 0.900000*(power(constants[4]/5.40000, 1.0/2)) constants[152] = power(constants[52], (constants[12]-310.000)/10.0000) constants[153] = power(constants[56], (constants[12]-310.000)/10.0000) constants[154] = power(constants[68], (constants[12]-310.000)/10.0000) constants[155] = power(constants[86], (constants[12]-310.000)/10.0000) constants[156] = (((constants[14]*2.00000*constants[16])/10000.0)* pi*constants[15])/10000.0 constants[157] = (3.14159*(power(constants[16]/1000.00, 2.00000))*constants[15])/(power(1000.00, 3.00000)) constants[158] = 0.0350000*constants[157] constants[159] = 0.0200000*constants[157] constants[160] = 0.000510000*constants[157] constants[161] = 0.650000*constants[157] constants[162] = constants[157]-(constants[158]+constants[159]+constants[160]+constants[161]) constants[163] = (constants[65]*constants[161]*2.00000*constants[13])/constants[156] return (states, constants) def computeRates(voi, states, constants): rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic rates[19] = 1.70000*states[6]*(1.00000-states[19])-0.0119000*states[19] rates[20] = 1.70000*states[5]*(1.00000-states[20])-0.0119000*states[20] algebraic[3] = 1.00000/(1.00000+exp(-(50.0000+states[0])/7.50000)) algebraic[25] = 1.00000/((0.00138000*(states[0]+7.00000))/(1.00000-exp(-0.123000*(states[0]+7.00000)))+(0.000610000*(states[0]+10.0000))/(exp(0.145000*(states[0]+10.0000))-1.00000)) rates[10] = (algebraic[3]-states[10])/algebraic[25] algebraic[7] = 1.00000/(1.00000+exp(-(states[0]-1.50000)/16.7000)) algebraic[27] = 1.00000/((7.19000e-05*(states[0]+30.0000))/(1.00000-exp(-0.148000*(states[0]+30.0000)))+(0.000131000*(states[0]+30.0000))/(-1.00000+exp(0.0687000*(states[0]+30.0000)))) rates[11] = (algebraic[7]-states[11])/algebraic[27] algebraic[8] = 1.00000/(1.00000+exp(-(states[0]+3.00000)/15.0000)) algebraic[28] = 9.00000/(1.00000+exp((states[0]+3.00000)/15.0000))+0.500000 rates[13] = (algebraic[8]-states[13])/algebraic[28] algebraic[9] = 1.00000/(1.00000+exp((states[0]+33.5000)/10.0000)) algebraic[29] = 3000.00/(1.00000+exp((states[0]+60.0000)/10.0000))+30.0000 rates[12] = (algebraic[9]-states[12])/algebraic[29] algebraic[10] = 1.00000/(1.00000+exp((states[0]+33.5000)/10.0000)) algebraic[31] = 2800.00/(1.00000+exp((states[0]+60.0000)/10.0000))+220.000 rates[14] = (algebraic[10]-states[14])/algebraic[31] algebraic[11] = 1.00000/(1.00000+exp(-(states[0]+3.00000)/15.0000)) algebraic[32] = 3.50000*exp(-(power(states[0]/30.0000, 2.00000)))+1.50000 rates[16] = (algebraic[11]-states[16])/algebraic[32] algebraic[12] = 1.00000/(1.00000+exp((states[0]+33.5000)/10.0000)) algebraic[33] = 20.0000/(1.00000+exp((states[0]+33.5000)/10.0000))+20.0000 rates[15] = (algebraic[12]-states[15])/algebraic[33] algebraic[13] = 1.00000/(1.00000+exp(-(states[0]+14.5000)/6.00000)) algebraic[34] = (1.00000*algebraic[13]*(1.00000-exp(-(states[0]+14.5000)/6.00000)))/(0.0350000*(states[0]+14.5000)) rates[17] = (algebraic[13]-states[17])/algebraic[34] algebraic[14] = 1.00000/(1.00000+exp((states[0]+35.0600)/3.60000))+0.600000/(1.00000+exp((50.0000-states[0])/20.0000)) algebraic[35] = 1.00000/(0.0197000*exp(-(power(0.0337000*(states[0]+14.5000), 2.00000)))+0.0200000) rates[18] = (algebraic[14]-states[18])/algebraic[35] algebraic[20] = states[39]+(states[41]*constants[160])/constants[161]+(states[40]*constants[159])/constants[161] algebraic[37] = constants[141]*(constants[133]-algebraic[20])*states[4]*(constants[135]-states[39])-constants[143]*states[39] rates[39] = algebraic[37] algebraic[39] = constants[141]*(constants[133]-algebraic[20])*states[6]*((constants[136]*constants[161])/constants[159]-states[40])-constants[143]*states[40] rates[40] = algebraic[39] algebraic[38] = constants[141]*(constants[133]-algebraic[20])*states[5]*((constants[137]*constants[161])/constants[160]-states[41])-constants[143]*states[41] rates[41] = algebraic[38] algebraic[21] = states[42]+(states[44]*constants[160])/constants[161]+(states[43]*constants[159])/constants[161] algebraic[40] = constants[142]*(constants[134]-algebraic[21])*states[4]*(constants[138]-states[42])-constants[144]*states[42] rates[42] = algebraic[40] algebraic[42] = constants[142]*(constants[134]-algebraic[21])*states[6]*((constants[139]*constants[161])/constants[159]-states[43])-constants[144]*states[43] rates[43] = algebraic[42] algebraic[41] = constants[142]*(constants[134]-algebraic[21])*states[5]*((constants[140]*constants[161])/constants[160]-states[44])-constants[144]*states[44] rates[44] = algebraic[41] algebraic[15] = constants[75]-(constants[75]-constants[76])/(1.00000+power(constants[77]/states[24], constants[83])) algebraic[36] = constants[79]/algebraic[15] algebraic[47] = constants[81]*algebraic[15] rates[23] = (algebraic[36]*(power(states[5], 2.00000))*states[21]-constants[80]*states[23])-(algebraic[47]*states[5]*states[23]-constants[82]*states[22]) algebraic[0] = custom_piecewise([less(states[0] , -40.0000), 0.135000*exp((80.0000+states[0])/-6.80000) , True, 0.00000]) algebraic[22] = custom_piecewise([less(states[0] , -40.0000), 3.56000*exp(0.0790000*states[0])+310000.*exp(0.350000*states[0]) , True, 1.00000/(0.130000*(1.00000+exp((states[0]+10.6600)/-11.1000)))]) algebraic[43] = 1.00000/(algebraic[0]+algebraic[22]) algebraic[48] = algebraic[0]/(algebraic[0]+algebraic[22]) rates[8] = (algebraic[48]-states[8])/algebraic[43] algebraic[1] = custom_piecewise([less(states[0] , -40.0000), (((-127140.*exp(0.244400*states[0])-3.47400e-05*exp(-0.0439100*states[0]))*(states[0]+37.7800))/1.00000)/(1.00000+exp(0.311000*(states[0]+79.2300))) , True, 0.00000]) algebraic[23] = custom_piecewise([less(states[0] , -40.0000), (0.121200*exp(-0.0105200*states[0]))/(1.00000+exp(-0.137800*(states[0]+40.1400))) , True, (0.300000*exp(-2.53500e-07*states[0]))/(1.00000+exp(-0.100000*(states[0]+32.0000)))]) algebraic[44] = 1.00000/(algebraic[1]+algebraic[23]) algebraic[49] = algebraic[1]/(algebraic[1]+algebraic[23]) rates[9] = (algebraic[49]-states[9])/algebraic[44] algebraic[2] = ((0.320000*(states[0]+47.1300))/1.00000)/(1.00000-exp(-0.100000*(states[0]+47.1300))) algebraic[24] = 0.0800000*exp(-states[0]/11.0000) algebraic[45] = 1.00000/(algebraic[2]+algebraic[24]) algebraic[50] = algebraic[2]/(algebraic[2]+algebraic[24]) rates[7] = (algebraic[50]-states[7])/algebraic[45] algebraic[52] = ((1.00000-states[21])-states[23])-states[22] rates[21] = (constants[82]*algebraic[52]-algebraic[47]*states[5]*states[21])-(algebraic[36]*(power(states[5], 2.00000))*states[21]-constants[80]*states[23]) rates[22] = (algebraic[47]*states[5]*states[23]-constants[82]*states[22])-(constants[80]*states[22]-algebraic[36]*(power(states[5], 2.00000))*algebraic[52]) algebraic[100] = constants[100]*states[2]*(constants[99]-states[26])-constants[101]*states[26] rates[26] = algebraic[100] algebraic[26] = ((constants[11]*constants[12])/constants[13])*log(constants[5]/states[2]) algebraic[54] = (power(states[7], 3.00000))*states[8]*states[9] algebraic[55] = constants[18]*constants[17]*algebraic[54]*(states[0]-algebraic[26]) algebraic[58] = constants[21]*constants[20]*(states[0]-algebraic[26]) algebraic[61] = 1.00000/(1.00000+0.124500*exp((-0.100000*states[0]*constants[13])/(constants[11]*constants[12]))+0.0365000*constants[149]*exp((-states[0]*constants[13])/(constants[11]*constants[12]))) algebraic[62] = (((constants[29]*constants[147]*constants[28]*algebraic[61])/(1.00000+power((constants[148]*constants[26])/states[2], constants[24])))*constants[4])/(constants[4]+constants[27]) algebraic[87] = 1.00000-states[20] algebraic[83] = (0.450000*states[17]*states[18]*constants[152]*states[0]*(power(constants[13], 2.00000)))/(constants[11]*constants[12]) algebraic[89] = (algebraic[83]*algebraic[87]*constants[44]*constants[42]*(constants[48]*states[2]*exp((states[0]*constants[13])/(constants[11]*constants[12]))-constants[49]*constants[5]))/(exp((states[0]*constants[13])/(constants[11]*constants[12]))-1.00000) algebraic[95] = 1.00000/(1.00000+power(constants[61]/states[5], 3.00000)) algebraic[92] = (exp((constants[63]*states[0]*constants[13])/(constants[11]*constants[12]))*(power(states[2], constants[64]))*constants[6]-exp(((constants[63]-1.00000)*states[0]*constants[13])/(constants[11]*constants[12]))*(power(constants[5], constants[64]))*states[5])/(1.00000+constants[62]*exp(((constants[63]-1.00000)*states[0]*constants[13])/(constants[11]*constants[12]))) algebraic[96] = (constants[54]*constants[53]*algebraic[95]*constants[153]*algebraic[92])/(constants[60]*(power(constants[5], constants[64]))*(1.00000+power(states[2]/constants[57], constants[64]))+(power(constants[59], constants[64]))*states[5]*(1.00000+states[5]/constants[60])+constants[58]*(power(states[2], constants[64]))+(power(states[2], constants[64]))*constants[6]+(power(constants[5], constants[64]))*states[5]) algebraic[98] = (states[2]-states[3])*1.83130e-14 rates[2] = ((-constants[156]*(algebraic[55]+3.00000*algebraic[96]+algebraic[58]+3.00000*algebraic[62]+algebraic[89]))/(constants[160]*constants[13])-algebraic[98]/constants[160])-algebraic[100] algebraic[101] = (states[3]-states[1])*1.63860e-12 rates[1] = algebraic[101]/constants[161] algebraic[103] = constants[100]*states[3]*(constants[98]-states[25])-constants[101]*states[25] rates[25] = algebraic[103] algebraic[46] = ((constants[11]*constants[12])/constants[13])*log(constants[5]/states[3]) algebraic[56] = constants[19]*constants[17]*algebraic[54]*(states[0]-algebraic[46]) algebraic[59] = constants[22]*constants[20]*(states[0]-algebraic[46]) algebraic[63] = (((constants[30]*constants[147]*constants[28]*algebraic[61])/(1.00000+power((constants[148]*constants[26])/states[3], constants[24])))*constants[4])/(constants[4]+constants[27]) algebraic[84] = 1.00000-states[19] algebraic[86] = (algebraic[83]*algebraic[84]*constants[45]*constants[42]*(constants[48]*states[3]*exp((states[0]*constants[13])/(constants[11]*constants[12]))-constants[49]*constants[5]))/(exp((states[0]*constants[13])/(constants[11]*constants[12]))-1.00000) algebraic[94] = 1.00000/(1.00000+power(constants[61]/states[6], 3.00000)) algebraic[93] = (exp((constants[63]*states[0]*constants[13])/(constants[11]*constants[12]))*(power(states[3], constants[64]))*constants[6]-exp(((constants[63]-1.00000)*states[0]*constants[13])/(constants[11]*constants[12]))*(power(constants[5], constants[64]))*states[6])/(1.00000+constants[62]*exp(((constants[63]-1.00000)*states[0]*constants[13])/(constants[11]*constants[12]))) algebraic[97] = (constants[55]*constants[53]*algebraic[94]*constants[153]*algebraic[93])/(constants[60]*(power(constants[5], constants[64]))*(1.00000+power(states[3]/constants[57], constants[64]))+(power(constants[59], constants[64]))*states[6]*(1.00000+states[6]/constants[60])+constants[58]*(power(states[3], constants[64]))+(power(states[3], constants[64]))*constants[6]+(power(constants[5], constants[64]))*states[6]) rates[3] = ((-constants[156]*(algebraic[56]+3.00000*algebraic[97]+algebraic[59]+3.00000*algebraic[63]+algebraic[86]))/(constants[159]*constants[13])+(algebraic[98]-algebraic[101])/constants[159])-algebraic[103] algebraic[57] = algebraic[55]+algebraic[56] algebraic[60] = algebraic[58]+algebraic[59] algebraic[64] = algebraic[62]+algebraic[63] algebraic[65] = 1.00000/(1.00000+exp((33.0000+states[0])/22.4000)) algebraic[66] = constants[150]*states[10]*algebraic[65]*(states[0]-constants[145]) algebraic[67] = -log(states[5]/1.00000, 10)+3.00000 algebraic[69] = 0.0700000*(0.0570000+0.190000/(1.00000+exp((-7.20000+algebraic[67])/0.600000))) algebraic[71] = ((constants[11]*constants[12])/constants[13])*log((constants[4]+constants[33]*constants[5])/(constants[8]+constants[33]*states[1])) algebraic[72] = constants[31]*algebraic[69]*(power(states[11], 2.00000))*(states[0]-algebraic[71]) algebraic[68] = -log(states[6]/1.00000, 10)+3.00000 algebraic[70] = 0.0700000*(0.0570000+0.190000/(1.00000+exp((-7.20000+algebraic[68])/0.600000))) algebraic[73] = constants[32]*algebraic[70]*(power(states[11], 2.00000))*(states[0]-algebraic[71]) algebraic[74] = algebraic[72]+algebraic[73] algebraic[75] = constants[34]*states[13]*(states[12]+0.500000*states[14])*(states[0]-constants[145]) algebraic[76] = constants[35]*states[16]*states[15]*(states[0]-constants[145]) algebraic[77] = 1.02000/(1.00000+exp(0.238500*(states[0]-(constants[145]+59.2150)))) algebraic[78] = (0.491240*exp(0.0803200*((states[0]-constants[145])+5.47600))+1.00000*exp(0.0617500*(states[0]-(constants[145]+594.310))))/(1.00000+exp(-0.514300*((states[0]-constants[145])+4.75300))) algebraic[79] = algebraic[77]/(algebraic[77]+algebraic[78]) algebraic[80] = constants[151]*algebraic[79]*(states[0]-constants[145]) algebraic[99] = algebraic[96]+algebraic[97] algebraic[81] = constants[36]*(states[0]-constants[146])*(constants[38]/(1.00000+constants[37]/states[5])+constants[39]/(1.00000+constants[37]/states[6])) algebraic[82] = constants[40]*(states[0]-constants[146]) algebraic[85] = (algebraic[83]*algebraic[84]*constants[45]*constants[41]*4.00000*(constants[46]*states[6]*exp((2.00000*states[0]*constants[13])/(constants[11]*constants[12]))-constants[47]*constants[6]))/(exp((2.00000*states[0]*constants[13])/(constants[11]*constants[12]))-1.00000) algebraic[88] = (algebraic[83]*algebraic[87]*constants[44]*constants[41]*4.00000*(constants[46]*states[5]*exp((2.00000*states[0]*constants[13])/(constants[11]*constants[12]))-constants[47]*constants[6]))/(exp((2.00000*states[0]*constants[13])/(constants[11]*constants[12]))-1.00000) algebraic[90] = (algebraic[83]*(algebraic[84]*constants[45]+algebraic[87]*constants[44])*constants[43]*(constants[50]*constants[8]*exp((states[0]*constants[13])/(constants[11]*constants[12]))-constants[51]*constants[4]))/(exp((states[0]*constants[13])/(constants[11]*constants[12]))-1.00000) algebraic[91] = algebraic[85]+algebraic[88]+algebraic[86]+algebraic[89]+algebraic[90] algebraic[51] = ((constants[11]*constants[12])/(2.00000*constants[13]))*log(constants[6]/states[5]) algebraic[106] = constants[72]*constants[73]*(states[0]-algebraic[51]) algebraic[53] = ((constants[11]*constants[12])/(2.00000*constants[13]))*log(constants[6]/states[6]) algebraic[107] = constants[72]*constants[74]*(states[0]-algebraic[53]) algebraic[108] = algebraic[107]+algebraic[106] algebraic[104] = (constants[154]*constants[71]*constants[67])/(1.00000+power(constants[69]/states[6], constants[70])) algebraic[102] = (constants[154]*constants[71]*constants[66])/(1.00000+power(constants[69]/states[5], constants[70])) algebraic[105] = algebraic[102]+algebraic[104] algebraic[6] = custom_piecewise([greater_equal(voi-floor(voi/constants[1])*constants[1] , constants[0]) & less_equal(voi-floor(voi/constants[1])*constants[1] , constants[0]+constants[2]), -constants[3] , True, 0.00000]) rates[0] = -(algebraic[57]+algebraic[60]+algebraic[64]+algebraic[66]+algebraic[74]+algebraic[75]+algebraic[76]+algebraic[80]+algebraic[99]+algebraic[81]+algebraic[82]+algebraic[91]+algebraic[108]+algebraic[105]+algebraic[6]) algebraic[112] = constants[108]*states[24]*((constants[106]*constants[161])/constants[158]-states[31])-constants[111]*states[31] rates[31] = algebraic[112] algebraic[109] = constants[78]*states[23]*(states[24]-states[5]) algebraic[110] = constants[84]*(states[24]-states[5]) algebraic[111] = (((constants[155]*constants[85]*constants[161])/constants[158])*(power(states[4]/constants[87], constants[89])-power(states[24]/constants[88], constants[89])))/(1.00000+power(states[4]/constants[87], constants[89])+power(states[24]/constants[88], constants[89])) rates[24] = (algebraic[111]-((algebraic[110]*constants[161])/constants[158]+algebraic[109]))-algebraic[112] algebraic[115] = constants[107]*states[5]*((constants[103]*0.100000*constants[161])/constants[160]-states[28])-constants[109]*states[28] rates[28] = algebraic[115] algebraic[117] = constants[107]*states[6]*((constants[102]*constants[161])/constants[159]-states[27])-constants[109]*states[27] rates[27] = algebraic[117] algebraic[118] = constants[107]*states[5]*((constants[105]*0.100000*constants[161])/constants[160]-states[30])-constants[110]*states[30] rates[30] = algebraic[118] algebraic[116] = constants[119]*states[4]*(constants[112]-states[32])-constants[126]*states[32] rates[32] = algebraic[116] algebraic[120] = constants[107]*states[6]*((constants[104]*constants[161])/constants[159]-states[29])-constants[110]*states[29] rates[29] = algebraic[120] algebraic[119] = constants[120]*states[4]*(constants[113]-(states[33]+states[34]))-constants[127]*states[33] rates[33] = algebraic[119] algebraic[113] = (states[5]-states[6])*8.24130e-13 algebraic[121] = algebraic[115]+algebraic[118] algebraic[123] = (algebraic[88]-2.00000*algebraic[96])+algebraic[106]+algebraic[102] rates[5] = (((-algebraic[123]*constants[156])/(constants[160]*2.00000*constants[13])-algebraic[113]/constants[160])+(algebraic[109]*constants[158])/constants[160]+(algebraic[110]*constants[161])/constants[160])-1.00000*algebraic[121] algebraic[122] = constants[121]*constants[9]*(constants[114]-(states[33]+states[34]))-constants[128]*states[34] rates[34] = algebraic[122] algebraic[114] = (states[6]-states[4])*3.72430e-12 algebraic[124] = algebraic[117]+algebraic[120] algebraic[126] = (algebraic[85]-2.00000*algebraic[97])+algebraic[107]+algebraic[104] rates[6] = ((-algebraic[126]*constants[156])/(constants[159]*2.00000*constants[13])+(algebraic[113]-algebraic[114])/constants[159])-1.00000*algebraic[124] algebraic[125] = constants[122]*states[4]*(constants[115]-states[35])-constants[129]*states[35] rates[35] = algebraic[125] algebraic[127] = constants[123]*states[4]*(constants[116]-(states[36]+states[37]))-constants[130]*states[36] rates[36] = algebraic[127] algebraic[128] = constants[124]*constants[9]*(constants[117]-(states[36]+states[37]))-constants[131]*states[37] rates[37] = algebraic[128] algebraic[129] = constants[125]*states[4]*(constants[118]-states[38])-constants[132]*states[38] rates[38] = algebraic[129] algebraic[130] = algebraic[116]+algebraic[119]+algebraic[122]+algebraic[125]+algebraic[127]+algebraic[128]+algebraic[129] rates[4] = ((-algebraic[111]*constants[158])/constants[161]+algebraic[114]/constants[161])-1.00000*algebraic[130] return(rates) def computeAlgebraic(constants, states, voi): algebraic = array([[0.0] * len(voi)] * sizeAlgebraic) states = array(states) voi = array(voi) algebraic[3] = 1.00000/(1.00000+exp(-(50.0000+states[0])/7.50000)) algebraic[25] = 1.00000/((0.00138000*(states[0]+7.00000))/(1.00000-exp(-0.123000*(states[0]+7.00000)))+(0.000610000*(states[0]+10.0000))/(exp(0.145000*(states[0]+10.0000))-1.00000)) algebraic[7] = 1.00000/(1.00000+exp(-(states[0]-1.50000)/16.7000)) algebraic[27] = 1.00000/((7.19000e-05*(states[0]+30.0000))/(1.00000-exp(-0.148000*(states[0]+30.0000)))+(0.000131000*(states[0]+30.0000))/(-1.00000+exp(0.0687000*(states[0]+30.0000)))) algebraic[8] = 1.00000/(1.00000+exp(-(states[0]+3.00000)/15.0000)) algebraic[28] = 9.00000/(1.00000+exp((states[0]+3.00000)/15.0000))+0.500000 algebraic[9] = 1.00000/(1.00000+exp((states[0]+33.5000)/10.0000)) algebraic[29] = 3000.00/(1.00000+exp((states[0]+60.0000)/10.0000))+30.0000 algebraic[10] = 1.00000/(1.00000+exp((states[0]+33.5000)/10.0000)) algebraic[31] = 2800.00/(1.00000+exp((states[0]+60.0000)/10.0000))+220.000 algebraic[11] = 1.00000/(1.00000+exp(-(states[0]+3.00000)/15.0000)) algebraic[32] = 3.50000*exp(-(power(states[0]/30.0000, 2.00000)))+1.50000 algebraic[12] = 1.00000/(1.00000+exp((states[0]+33.5000)/10.0000)) algebraic[33] = 20.0000/(1.00000+exp((states[0]+33.5000)/10.0000))+20.0000 algebraic[13] = 1.00000/(1.00000+exp(-(states[0]+14.5000)/6.00000)) algebraic[34] = (1.00000*algebraic[13]*(1.00000-exp(-(states[0]+14.5000)/6.00000)))/(0.0350000*(states[0]+14.5000)) algebraic[14] = 1.00000/(1.00000+exp((states[0]+35.0600)/3.60000))+0.600000/(1.00000+exp((50.0000-states[0])/20.0000)) algebraic[35] = 1.00000/(0.0197000*exp(-(power(0.0337000*(states[0]+14.5000), 2.00000)))+0.0200000) algebraic[20] = states[39]+(states[41]*constants[160])/constants[161]+(states[40]*constants[159])/constants[161] algebraic[37] = constants[141]*(constants[133]-algebraic[20])*states[4]*(constants[135]-states[39])-constants[143]*states[39] algebraic[39] = constants[141]*(constants[133]-algebraic[20])*states[6]*((constants[136]*constants[161])/constants[159]-states[40])-constants[143]*states[40] algebraic[38] = constants[141]*(constants[133]-algebraic[20])*states[5]*((constants[137]*constants[161])/constants[160]-states[41])-constants[143]*states[41] algebraic[21] = states[42]+(states[44]*constants[160])/constants[161]+(states[43]*constants[159])/constants[161] algebraic[40] = constants[142]*(constants[134]-algebraic[21])*states[4]*(constants[138]-states[42])-constants[144]*states[42] algebraic[42] = constants[142]*(constants[134]-algebraic[21])*states[6]*((constants[139]*constants[161])/constants[159]-states[43])-constants[144]*states[43] algebraic[41] = constants[142]*(constants[134]-algebraic[21])*states[5]*((constants[140]*constants[161])/constants[160]-states[44])-constants[144]*states[44] algebraic[15] = constants[75]-(constants[75]-constants[76])/(1.00000+power(constants[77]/states[24], constants[83])) algebraic[36] = constants[79]/algebraic[15] algebraic[47] = constants[81]*algebraic[15] algebraic[0] = custom_piecewise([less(states[0] , -40.0000), 0.135000*exp((80.0000+states[0])/-6.80000) , True, 0.00000]) algebraic[22] = custom_piecewise([less(states[0] , -40.0000), 3.56000*exp(0.0790000*states[0])+310000.*exp(0.350000*states[0]) , True, 1.00000/(0.130000*(1.00000+exp((states[0]+10.6600)/-11.1000)))]) algebraic[43] = 1.00000/(algebraic[0]+algebraic[22]) algebraic[48] = algebraic[0]/(algebraic[0]+algebraic[22]) algebraic[1] = custom_piecewise([less(states[0] , -40.0000), (((-127140.*exp(0.244400*states[0])-3.47400e-05*exp(-0.0439100*states[0]))*(states[0]+37.7800))/1.00000)/(1.00000+exp(0.311000*(states[0]+79.2300))) , True, 0.00000]) algebraic[23] = custom_piecewise([less(states[0] , -40.0000), (0.121200*exp(-0.0105200*states[0]))/(1.00000+exp(-0.137800*(states[0]+40.1400))) , True, (0.300000*exp(-2.53500e-07*states[0]))/(1.00000+exp(-0.100000*(states[0]+32.0000)))]) algebraic[44] = 1.00000/(algebraic[1]+algebraic[23]) algebraic[49] = algebraic[1]/(algebraic[1]+algebraic[23]) algebraic[2] = ((0.320000*(states[0]+47.1300))/1.00000)/(1.00000-exp(-0.100000*(states[0]+47.1300))) algebraic[24] = 0.0800000*exp(-states[0]/11.0000) algebraic[45] = 1.00000/(algebraic[2]+algebraic[24]) algebraic[50] = algebraic[2]/(algebraic[2]+algebraic[24]) algebraic[52] = ((1.00000-states[21])-states[23])-states[22] algebraic[100] = constants[100]*states[2]*(constants[99]-states[26])-constants[101]*states[26] algebraic[26] = ((constants[11]*constants[12])/constants[13])*log(constants[5]/states[2]) algebraic[54] = (power(states[7], 3.00000))*states[8]*states[9] algebraic[55] = constants[18]*constants[17]*algebraic[54]*(states[0]-algebraic[26]) algebraic[58] = constants[21]*constants[20]*(states[0]-algebraic[26]) algebraic[61] = 1.00000/(1.00000+0.124500*exp((-0.100000*states[0]*constants[13])/(constants[11]*constants[12]))+0.0365000*constants[149]*exp((-states[0]*constants[13])/(constants[11]*constants[12]))) algebraic[62] = (((constants[29]*constants[147]*constants[28]*algebraic[61])/(1.00000+power((constants[148]*constants[26])/states[2], constants[24])))*constants[4])/(constants[4]+constants[27]) algebraic[87] = 1.00000-states[20] algebraic[83] = (0.450000*states[17]*states[18]*constants[152]*states[0]*(power(constants[13], 2.00000)))/(constants[11]*constants[12]) algebraic[89] = (algebraic[83]*algebraic[87]*constants[44]*constants[42]*(constants[48]*states[2]*exp((states[0]*constants[13])/(constants[11]*constants[12]))-constants[49]*constants[5]))/(exp((states[0]*constants[13])/(constants[11]*constants[12]))-1.00000) algebraic[95] = 1.00000/(1.00000+power(constants[61]/states[5], 3.00000)) algebraic[92] = (exp((constants[63]*states[0]*constants[13])/(constants[11]*constants[12]))*(power(states[2], constants[64]))*constants[6]-exp(((constants[63]-1.00000)*states[0]*constants[13])/(constants[11]*constants[12]))*(power(constants[5], constants[64]))*states[5])/(1.00000+constants[62]*exp(((constants[63]-1.00000)*states[0]*constants[13])/(constants[11]*constants[12]))) algebraic[96] = (constants[54]*constants[53]*algebraic[95]*constants[153]*algebraic[92])/(constants[60]*(power(constants[5], constants[64]))*(1.00000+power(states[2]/constants[57], constants[64]))+(power(constants[59], constants[64]))*states[5]*(1.00000+states[5]/constants[60])+constants[58]*(power(states[2], constants[64]))+(power(states[2], constants[64]))*constants[6]+(power(constants[5], constants[64]))*states[5]) algebraic[98] = (states[2]-states[3])*1.83130e-14 algebraic[101] = (states[3]-states[1])*1.63860e-12 algebraic[103] = constants[100]*states[3]*(constants[98]-states[25])-constants[101]*states[25] algebraic[46] = ((constants[11]*constants[12])/constants[13])*log(constants[5]/states[3]) algebraic[56] = constants[19]*constants[17]*algebraic[54]*(states[0]-algebraic[46]) algebraic[59] = constants[22]*constants[20]*(states[0]-algebraic[46]) algebraic[63] = (((constants[30]*constants[147]*constants[28]*algebraic[61])/(1.00000+power((constants[148]*constants[26])/states[3], constants[24])))*constants[4])/(constants[4]+constants[27]) algebraic[84] = 1.00000-states[19] algebraic[86] = (algebraic[83]*algebraic[84]*constants[45]*constants[42]*(constants[48]*states[3]*exp((states[0]*constants[13])/(constants[11]*constants[12]))-constants[49]*constants[5]))/(exp((states[0]*constants[13])/(constants[11]*constants[12]))-1.00000) algebraic[94] = 1.00000/(1.00000+power(constants[61]/states[6], 3.00000)) algebraic[93] = (exp((constants[63]*states[0]*constants[13])/(constants[11]*constants[12]))*(power(states[3], constants[64]))*constants[6]-exp(((constants[63]-1.00000)*states[0]*constants[13])/(constants[11]*constants[12]))*(power(constants[5], constants[64]))*states[6])/(1.00000+constants[62]*exp(((constants[63]-1.00000)*states[0]*constants[13])/(constants[11]*constants[12]))) algebraic[97] = (constants[55]*constants[53]*algebraic[94]*constants[153]*algebraic[93])/(constants[60]*(power(constants[5], constants[64]))*(1.00000+power(states[3]/constants[57], constants[64]))+(power(constants[59], constants[64]))*states[6]*(1.00000+states[6]/constants[60])+constants[58]*(power(states[3], constants[64]))+(power(states[3], constants[64]))*constants[6]+(power(constants[5], constants[64]))*states[6]) algebraic[57] = algebraic[55]+algebraic[56] algebraic[60] = algebraic[58]+algebraic[59] algebraic[64] = algebraic[62]+algebraic[63] algebraic[65] = 1.00000/(1.00000+exp((33.0000+states[0])/22.4000)) algebraic[66] = constants[150]*states[10]*algebraic[65]*(states[0]-constants[145]) algebraic[67] = -log(states[5]/1.00000, 10)+3.00000 algebraic[69] = 0.0700000*(0.0570000+0.190000/(1.00000+exp((-7.20000+algebraic[67])/0.600000))) algebraic[71] = ((constants[11]*constants[12])/constants[13])*log((constants[4]+constants[33]*constants[5])/(constants[8]+constants[33]*states[1])) algebraic[72] = constants[31]*algebraic[69]*(power(states[11], 2.00000))*(states[0]-algebraic[71]) algebraic[68] = -log(states[6]/1.00000, 10)+3.00000 algebraic[70] = 0.0700000*(0.0570000+0.190000/(1.00000+exp((-7.20000+algebraic[68])/0.600000))) algebraic[73] = constants[32]*algebraic[70]*(power(states[11], 2.00000))*(states[0]-algebraic[71]) algebraic[74] = algebraic[72]+algebraic[73] algebraic[75] = constants[34]*states[13]*(states[12]+0.500000*states[14])*(states[0]-constants[145]) algebraic[76] = constants[35]*states[16]*states[15]*(states[0]-constants[145]) algebraic[77] = 1.02000/(1.00000+exp(0.238500*(states[0]-(constants[145]+59.2150)))) algebraic[78] = (0.491240*exp(0.0803200*((states[0]-constants[145])+5.47600))+1.00000*exp(0.0617500*(states[0]-(constants[145]+594.310))))/(1.00000+exp(-0.514300*((states[0]-constants[145])+4.75300))) algebraic[79] = algebraic[77]/(algebraic[77]+algebraic[78]) algebraic[80] = constants[151]*algebraic[79]*(states[0]-constants[145]) algebraic[99] = algebraic[96]+algebraic[97] algebraic[81] = constants[36]*(states[0]-constants[146])*(constants[38]/(1.00000+constants[37]/states[5])+constants[39]/(1.00000+constants[37]/states[6])) algebraic[82] = constants[40]*(states[0]-constants[146]) algebraic[85] = (algebraic[83]*algebraic[84]*constants[45]*constants[41]*4.00000*(constants[46]*states[6]*exp((2.00000*states[0]*constants[13])/(constants[11]*constants[12]))-constants[47]*constants[6]))/(exp((2.00000*states[0]*constants[13])/(constants[11]*constants[12]))-1.00000) algebraic[88] = (algebraic[83]*algebraic[87]*constants[44]*constants[41]*4.00000*(constants[46]*states[5]*exp((2.00000*states[0]*constants[13])/(constants[11]*constants[12]))-constants[47]*constants[6]))/(exp((2.00000*states[0]*constants[13])/(constants[11]*constants[12]))-1.00000) algebraic[90] = (algebraic[83]*(algebraic[84]*constants[45]+algebraic[87]*constants[44])*constants[43]*(constants[50]*constants[8]*exp((states[0]*constants[13])/(constants[11]*constants[12]))-constants[51]*constants[4]))/(exp((states[0]*constants[13])/(constants[11]*constants[12]))-1.00000) algebraic[91] = algebraic[85]+algebraic[88]+algebraic[86]+algebraic[89]+algebraic[90] algebraic[51] = ((constants[11]*constants[12])/(2.00000*constants[13]))*log(constants[6]/states[5]) algebraic[106] = constants[72]*constants[73]*(states[0]-algebraic[51]) algebraic[53] = ((constants[11]*constants[12])/(2.00000*constants[13]))*log(constants[6]/states[6]) algebraic[107] = constants[72]*constants[74]*(states[0]-algebraic[53]) algebraic[108] = algebraic[107]+algebraic[106] algebraic[104] = (constants[154]*constants[71]*constants[67])/(1.00000+power(constants[69]/states[6], constants[70])) algebraic[102] = (constants[154]*constants[71]*constants[66])/(1.00000+power(constants[69]/states[5], constants[70])) algebraic[105] = algebraic[102]+algebraic[104] algebraic[6] = custom_piecewise([greater_equal(voi-floor(voi/constants[1])*constants[1] , constants[0]) & less_equal(voi-floor(voi/constants[1])*constants[1] , constants[0]+constants[2]), -constants[3] , True, 0.00000]) algebraic[112] = constants[108]*states[24]*((constants[106]*constants[161])/constants[158]-states[31])-constants[111]*states[31] algebraic[109] = constants[78]*states[23]*(states[24]-states[5]) algebraic[110] = constants[84]*(states[24]-states[5]) algebraic[111] = (((constants[155]*constants[85]*constants[161])/constants[158])*(power(states[4]/constants[87], constants[89])-power(states[24]/constants[88], constants[89])))/(1.00000+power(states[4]/constants[87], constants[89])+power(states[24]/constants[88], constants[89])) algebraic[115] = constants[107]*states[5]*((constants[103]*0.100000*constants[161])/constants[160]-states[28])-constants[109]*states[28] algebraic[117] = constants[107]*states[6]*((constants[102]*constants[161])/constants[159]-states[27])-constants[109]*states[27] algebraic[118] = constants[107]*states[5]*((constants[105]*0.100000*constants[161])/constants[160]-states[30])-constants[110]*states[30] algebraic[116] = constants[119]*states[4]*(constants[112]-states[32])-constants[126]*states[32] algebraic[120] = constants[107]*states[6]*((constants[104]*constants[161])/constants[159]-states[29])-constants[110]*states[29] algebraic[119] = constants[120]*states[4]*(constants[113]-(states[33]+states[34]))-constants[127]*states[33] algebraic[113] = (states[5]-states[6])*8.24130e-13 algebraic[121] = algebraic[115]+algebraic[118] algebraic[123] = (algebraic[88]-2.00000*algebraic[96])+algebraic[106]+algebraic[102] algebraic[122] = constants[121]*constants[9]*(constants[114]-(states[33]+states[34]))-constants[128]*states[34] algebraic[114] = (states[6]-states[4])*3.72430e-12 algebraic[124] = algebraic[117]+algebraic[120] algebraic[126] = (algebraic[85]-2.00000*algebraic[97])+algebraic[107]+algebraic[104] algebraic[125] = constants[122]*states[4]*(constants[115]-states[35])-constants[129]*states[35] algebraic[127] = constants[123]*states[4]*(constants[116]-(states[36]+states[37]))-constants[130]*states[36] algebraic[128] = constants[124]*constants[9]*(constants[117]-(states[36]+states[37]))-constants[131]*states[37] algebraic[129] = constants[125]*states[4]*(constants[118]-states[38])-constants[132]*states[38] algebraic[130] = algebraic[116]+algebraic[119]+algebraic[122]+algebraic[125]+algebraic[127]+algebraic[128]+algebraic[129] algebraic[4] = ((constants[11]*constants[12])/constants[13])*log((constants[4]+constants[33]*constants[5])/(constants[8]+constants[33]*states[2])) algebraic[5] = ((constants[11]*constants[12])/constants[13])*log((constants[4]+constants[33]*constants[5])/(constants[8]+constants[33]*states[3])) algebraic[16] = (constants[92]*constants[96]*(states[2]-states[3]))/constants[94] algebraic[17] = (constants[93]*constants[97]*(states[3]-states[1]))/constants[95] algebraic[18] = (constants[90]*constants[96]*(states[5]-states[6]))/constants[94] algebraic[19] = (constants[91]*constants[97]*(states[6]-states[4]))/constants[95] algebraic[30] = algebraic[10] return algebraic def custom_piecewise(cases): """Compute result of a piecewise function""" return select(cases[0::2],cases[1::2]) def solve_model(): """Solve model with ODE solver""" from scipy.integrate import ode # Initialise constants and state variables (init_states, constants) = initConsts() # Set timespan to solve over voi = linspace(0, 10, 500) # Construct ODE object to solve r = ode(computeRates) r.set_integrator('vode', method='bdf', atol=1e-06, rtol=1e-06, max_step=1) r.set_initial_value(init_states, voi[0]) r.set_f_params(constants) # Solve model states = array([[0.0] * len(voi)] * sizeStates) states[:,0] = init_states for (i,t) in enumerate(voi[1:]): if r.successful(): r.integrate(t) states[:,i+1] = r.y else: break # Compute algebraic variables algebraic = computeAlgebraic(constants, states, voi) return (voi, states, algebraic) def plot_model(voi, states, algebraic): """Plot variables against variable of integration""" import pylab (legend_states, legend_algebraic, legend_voi, legend_constants) = createLegends() pylab.figure(1) pylab.plot(voi,vstack((states,algebraic)).T) pylab.xlabel(legend_voi) pylab.legend(legend_states + legend_algebraic, loc='best') pylab.show() if __name__ == "__main__": (voi, states, algebraic) = solve_model() plot_model(voi, states, algebraic)