# Size of variable arrays: sizeAlgebraic = 128 sizeStates = 45 sizeConstants = 177 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[50] = "i_Na in component INa (microA_per_microF)" legend_algebraic[53] = "i_Nab in component INab (microA_per_microF)" legend_algebraic[57] = "i_NaK in component INaK (microA_per_microF)" legend_algebraic[59] = "i_Kr in component IKr (microA_per_microF)" legend_algebraic[67] = "i_Ks in component IKs (microA_per_microF)" legend_algebraic[71] = "i_tos in component Itos (microA_per_microF)" legend_algebraic[72] = "i_tof in component Itof (microA_per_microF)" legend_algebraic[76] = "i_K1 in component IK1 (microA_per_microF)" legend_algebraic[77] = "i_Kp in component IKp (microA_per_microF)" legend_algebraic[96] = "i_NaCa in component INaCa (microA_per_microF)" legend_algebraic[78] = "i_Cl_Ca in component ICl_Ca (microA_per_microF)" legend_algebraic[79] = "i_Clb in component IClb (microA_per_microF)" legend_algebraic[88] = "i_CaL in component ICaL (microA_per_microF)" legend_algebraic[105] = "i_Cab in component ICab (microA_per_microF)" legend_algebraic[102] = "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] = "Mgo in component model_parameters (millimolar)" legend_constants[11] = "Cli in component model_parameters (millimolar)" legend_constants[12] = "R in component model_parameters (joule_per_kilomole_kelvin)" legend_constants[13] = "T in component model_parameters (kelvin)" legend_constants[14] = "F in component model_parameters (coulomb_per_mole)" legend_constants[169] = "Cm in component model_parameters (farad)" legend_constants[15] = "Cm_per_area in component model_parameters (farad_per_cm2)" legend_constants[16] = "cell_length in component model_parameters (micrometre)" legend_constants[17] = "cell_radius in component model_parameters (micrometre)" legend_constants[18] = "jct_radius in component model_parameters (micrometre)" legend_constants[19] = "jct_depth in component model_parameters (micrometre)" legend_constants[20] = "SL_depth in component model_parameters (micrometre)" legend_constants[170] = "Vol_Cell in component model_parameters (litre)" legend_constants[171] = "Vol_SR in component model_parameters (litre)" legend_constants[172] = "Vol_SL in component model_parameters (litre)" legend_constants[173] = "Vol_jct in component model_parameters (litre)" legend_constants[174] = "Vol_cytosol in component model_parameters (litre)" legend_constants[175] = "Vol_mito in component model_parameters (litre)" legend_algebraic[21] = "E_Na_jct in component reversal_potentials (millivolt)" legend_algebraic[39] = "E_Na_SL in component reversal_potentials (millivolt)" legend_algebraic[44] = "E_Ca_jct in component reversal_potentials (millivolt)" legend_algebraic[46] = "E_Ca_SL in component reversal_potentials (millivolt)" legend_constants[150] = "E_K in component reversal_potentials (millivolt)" legend_constants[151] = "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[48] = "i_Na_jct in component INa (microA_per_microF)" legend_algebraic[49] = "i_Na_SL in component INa (microA_per_microF)" legend_constants[21] = "G_INa in component INa (milliS_per_microF)" legend_constants[22] = "Fx_Na_jct in component INa (dimensionless)" legend_constants[23] = "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[47] = "openProb in component INa (dimensionless)" legend_algebraic[0] = "alpha_h in component INa_h_gate (per_millisecond)" legend_algebraic[17] = "beta_h in component INa_h_gate (per_millisecond)" legend_algebraic[36] = "tau_h in component INa_h_gate (millisecond)" legend_algebraic[41] = "h_infinity in component INa_h_gate (dimensionless)" legend_algebraic[1] = "alpha_j in component INa_j_gate (per_millisecond)" legend_algebraic[18] = "beta_j in component INa_j_gate (per_millisecond)" legend_algebraic[37] = "tau_j in component INa_j_gate (millisecond)" legend_algebraic[42] = "j_infinity in component INa_j_gate (dimensionless)" legend_algebraic[2] = "alpha_m in component INa_m_gate (per_millisecond)" legend_algebraic[19] = "beta_m in component INa_m_gate (per_millisecond)" legend_algebraic[38] = "tau_m in component INa_m_gate (millisecond)" legend_algebraic[43] = "m_infinity in component INa_m_gate (dimensionless)" legend_algebraic[51] = "i_Nab_jct in component INab (microA_per_microF)" legend_algebraic[52] = "i_Nab_SL in component INab (microA_per_microF)" legend_constants[24] = "G_NaBk in component INab (milliS_per_microF)" legend_constants[25] = "Fx_NaBk_jct in component INab (dimensionless)" legend_constants[26] = "Fx_NaBk_SL in component INab (dimensionless)" legend_algebraic[55] = "i_NaK_jct in component INaK (microA_per_microF)" legend_algebraic[56] = "i_NaK_SL in component INaK (microA_per_microF)" legend_algebraic[54] = "f_NaK in component INaK (dimensionless)" legend_constants[27] = "Q10_NaK in component INaK (dimensionless)" legend_constants[152] = "Q_NaK in component INaK (dimensionless)" legend_constants[28] = "H_NaK in component INaK (dimensionless)" legend_constants[29] = "Q10_Km_Nai in component INaK (dimensionless)" legend_constants[153] = "Q_Km_Nai in component INaK (dimensionless)" legend_constants[30] = "Km_Nai in component INaK (millimolar)" legend_constants[31] = "Km_Ko in component INaK (millimolar)" legend_constants[32] = "I_NaK_max in component INaK (microA_per_microF)" legend_constants[154] = "sigma in component INaK (dimensionless)" legend_constants[33] = "Fx_NaK_jct in component INaK (dimensionless)" legend_constants[34] = "Fx_NaK_SL in component INaK (dimensionless)" legend_constants[155] = "G_IKr in component IKr (milliS_per_microF)" legend_states[10] = "Xr in component IKr_Xr_gate (dimensionless)" legend_algebraic[58] = "Rr in component IKr_Rr_gate (dimensionless)" legend_algebraic[3] = "Xr_infinity in component IKr_Xr_gate (dimensionless)" legend_algebraic[20] = "tau_Xr in component IKr_Xr_gate (millisecond)" legend_algebraic[65] = "i_Ks_jct in component IKs (microA_per_microF)" legend_algebraic[66] = "i_Ks_SL in component IKs (microA_per_microF)" legend_algebraic[63] = "G_Ks_SL in component IKs (milliS_per_microF)" legend_algebraic[62] = "G_Ks_jct in component IKs (milliS_per_microF)" legend_constants[35] = "Fx_Ks_jct in component IKs (dimensionless)" legend_constants[36] = "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[64] = "E_Ks in component IKs (millivolt)" legend_constants[37] = "pKNa in component IKs (dimensionless)" legend_algebraic[60] = "pCa_jct in component IKs (dimensionless)" legend_algebraic[61] = "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[22] = "tau_Xs in component IKs_Xs_gate (millisecond)" legend_constants[38] = "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_algebraic[70] = "R_tos in component Itos_R_gate (dimensionless)" legend_algebraic[8] = "X_tos_infinity in component Itos_X_gate (dimensionless)" legend_algebraic[23] = "tau_X_tos in component Itos_X_gate (millisecond)" legend_algebraic[9] = "Y_tos_infinity in component Itos_Y_gate (dimensionless)" legend_algebraic[24] = "tau_Y_tos in component Itos_Y_gate (millisecond)" legend_states[14] = "R_tos_other in component Itos_R_gate (dimensionless)" legend_algebraic[68] = "R_tos_infinity in component Itos_R_gate (dimensionless)" legend_algebraic[69] = "tau_R_tos in component Itos_R_gate (millisecond)" legend_constants[39] = "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[10] = "X_tof_infinity in component Itof_X_gate (dimensionless)" legend_algebraic[25] = "tau_X_tof in component Itof_X_gate (millisecond)" legend_algebraic[11] = "Y_tof_infinity in component Itof_Y_gate (dimensionless)" legend_algebraic[26] = "tau_Y_tof in component Itof_Y_gate (millisecond)" legend_constants[156] = "G_K1 in component IK1 (milliS_per_microF)" legend_algebraic[75] = "K1_infinity in component IK1_K1_gate (dimensionless)" legend_algebraic[73] = "alpha_K1 in component IK1_K1_gate (per_millisecond)" legend_algebraic[74] = "beta_K1 in component IK1_K1_gate (per_millisecond)" legend_constants[40] = "g_Kp in component IKp (milliS_per_microF)" legend_constants[41] = "G_Cl in component ICl_Ca (milliS_per_microF)" legend_constants[42] = "Kd_ClCa in component ICl_Ca (millimolar)" legend_constants[43] = "Fx_Cl_jct in component ICl_Ca (dimensionless)" legend_constants[44] = "Fx_Cl_SL in component ICl_Ca (dimensionless)" legend_constants[45] = "G_ClBk in component IClb (milliS_per_microF)" legend_algebraic[82] = "i_CaL_Ca_SL in component ICaL (microA_per_microF)" legend_algebraic[85] = "i_CaL_Ca_jct in component ICaL (microA_per_microF)" legend_algebraic[83] = "i_CaL_Na_SL in component ICaL (microA_per_microF)" legend_algebraic[86] = "i_CaL_Na_jct in component ICaL (microA_per_microF)" legend_algebraic[87] = "i_CaL_K in component ICaL (microA_per_microF)" legend_constants[46] = "PCa in component ICaL (litre_per_farad_millisecond)" legend_constants[47] = "PNa in component ICaL (litre_per_farad_millisecond)" legend_constants[48] = "PK in component ICaL (litre_per_farad_millisecond)" legend_constants[49] = "Fx_ICaL_jct in component ICaL (dimensionless)" legend_constants[50] = "Fx_ICaL_SL in component ICaL (dimensionless)" legend_constants[51] = "gamma_Cai in component ICaL (dimensionless)" legend_constants[52] = "gamma_Cao in component ICaL (dimensionless)" legend_constants[53] = "gamma_Nai in component ICaL (dimensionless)" legend_constants[54] = "gamma_Nao in component ICaL (dimensionless)" legend_constants[55] = "gamma_Ki in component ICaL (dimensionless)" legend_constants[56] = "gamma_Ko in component ICaL (dimensionless)" legend_constants[57] = "Q10_CaL in component ICaL (dimensionless)" legend_constants[157] = "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[81] = "fCa_SL in component ICaL_fCa_gate (dimensionless)" legend_algebraic[84] = "fCa_jct in component ICaL_fCa_gate (dimensionless)" legend_algebraic[80] = "temp in component ICaL (coulomb_per_mole)" legend_algebraic[12] = "d_infinity in component ICaL_d_gate (dimensionless)" legend_algebraic[27] = "tau_d in component ICaL_d_gate (millisecond)" legend_algebraic[13] = "f_infinity in component ICaL_f_gate (dimensionless)" legend_algebraic[28] = "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[94] = "i_NaCa_SL in component INaCa (microA_per_microF)" legend_algebraic[93] = "i_NaCa_jct in component INaCa (microA_per_microF)" legend_constants[58] = "V_max in component INaCa (microA_per_microF)" legend_constants[59] = "Fx_NCX_jct in component INaCa (dimensionless)" legend_constants[60] = "Fx_NCX_SL in component INaCa (dimensionless)" legend_constants[61] = "Q10_NCX in component INaCa (dimensionless)" legend_constants[158] = "Q_NCX in component INaCa (dimensionless)" legend_constants[62] = "K_mNai in component INaCa (millimolar)" legend_constants[63] = "K_mCao in component INaCa (millimolar)" legend_constants[64] = "K_mNao in component INaCa (millimolar)" legend_constants[65] = "K_mCai in component INaCa (millimolar)" legend_algebraic[91] = "Ka_SL in component INaCa (dimensionless)" legend_algebraic[92] = "Ka_jct in component INaCa (dimensionless)" legend_constants[66] = "Kd_act in component INaCa (millimolar)" legend_constants[67] = "ksat in component INaCa (dimensionless)" legend_constants[68] = "eta in component INaCa (dimensionless)" legend_constants[69] = "HNa in component INaCa (dimensionless)" legend_algebraic[89] = "temp_jct in component INaCa (millimolar4)" legend_algebraic[90] = "temp_SL in component INaCa (millimolar4)" legend_algebraic[101] = "i_Cap_SL in component ICap (microA_per_microF)" legend_algebraic[99] = "i_Cap_jct in component ICap (microA_per_microF)" legend_constants[70] = "V_max in component ICap (millimolar_per_millisecond)" legend_constants[71] = "Fx_SLCaP_jct in component ICap (dimensionless)" legend_constants[72] = "Fx_SLCaP_SL in component ICap (dimensionless)" legend_constants[73] = "Q10_SLCaP in component ICap (dimensionless)" legend_constants[159] = "Q_SLCaP in component ICap (dimensionless)" legend_constants[74] = "Km in component ICap (millimolar)" legend_constants[75] = "H in component ICap (dimensionless)" legend_constants[176] = "V_maxAF_old in component ICap (microA_per_microF)" legend_constants[76] = "V_maxAF in component ICap (microA_per_microF)" legend_algebraic[103] = "i_Cab_jct in component ICab (microA_per_microF)" legend_algebraic[104] = "i_Cab_SL in component ICab (microA_per_microF)" legend_constants[77] = "G_CaBk in component ICab (milliS_per_microF)" legend_constants[78] = "Fx_CaBk_jct in component ICab (dimensionless)" legend_constants[79] = "Fx_CaBk_SL in component ICab (dimensionless)" legend_algebraic[106] = "j_rel_SR in component Jrel_SR (millimolar_per_millisecond)" legend_constants[80] = "Max_SR in component Jrel_SR (dimensionless)" legend_constants[81] = "Min_SR in component Jrel_SR (dimensionless)" legend_constants[82] = "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[45] = "RI in component Jrel_SR (dimensionless)" legend_states[23] = "O in component Jrel_SR (dimensionless)" legend_constants[83] = "ks in component Jrel_SR (per_millisecond)" legend_constants[84] = "koCa in component Jrel_SR (per_millimolar2_per_millisecond)" legend_constants[85] = "kom in component Jrel_SR (per_millisecond)" legend_constants[86] = "kiCa in component Jrel_SR (per_millimolar_per_millisecond)" legend_constants[87] = "kim in component Jrel_SR (per_millisecond)" legend_constants[88] = "HSR in component Jrel_SR (dimensionless)" legend_states[24] = "Ca_SR in component Ca_buffer (millimolar)" legend_algebraic[14] = "kCaSR in component Jrel_SR (dimensionless)" legend_algebraic[29] = "koSRCa in component Jrel_SR (per_millimolar2_per_millisecond)" legend_algebraic[40] = "kiSRCa in component Jrel_SR (per_millimolar_per_millisecond)" legend_algebraic[107] = "j_leak_SR in component Jleak_SR (millimolar_per_millisecond)" legend_constants[89] = "KSRleak in component Jleak_SR (per_millisecond)" legend_algebraic[108] = "j_pump_SR in component Jpump_SR (millimolar_per_millisecond)" legend_constants[90] = "V_max in component Jpump_SR (millimolar_per_millisecond)" legend_constants[91] = "Q10_SRCaP in component Jpump_SR (dimensionless)" legend_constants[160] = "Q_SRCaP in component Jpump_SR (dimensionless)" legend_constants[92] = "Kmf in component Jpump_SR (millimolar)" legend_constants[93] = "Kmr in component Jpump_SR (millimolar)" legend_constants[94] = "H in component Jpump_SR (dimensionless)" legend_algebraic[95] = "J_Na_jct_SL in component ion_diffusion (millimole_per_millisecond)" legend_algebraic[98] = "J_Na_SL_cytosol in component ion_diffusion (millimole_per_millisecond)" legend_algebraic[110] = "J_Ca_jct_SL in component ion_diffusion (millimole_per_millisecond)" legend_algebraic[111] = "J_Ca_SL_cytosol in component ion_diffusion (millimole_per_millisecond)" legend_constants[95] = "D_Ca_jct_SL in component ion_diffusion (dm2_per_second)" legend_constants[96] = "D_Ca_SL_cytosol in component ion_diffusion (dm2_per_second)" legend_constants[97] = "D_Na_jct_SL in component ion_diffusion (dm2_per_second)" legend_constants[98] = "D_Na_SL_cytosol in component ion_diffusion (dm2_per_second)" legend_constants[99] = "x_jct_SL in component ion_diffusion (micrometre)" legend_constants[100] = "x_SL_cytosol in component ion_diffusion (micrometre)" legend_constants[101] = "A_jct_SL in component ion_diffusion (cm2)" legend_constants[102] = "A_SL_cytosol in component ion_diffusion (cm2)" legend_constants[161] = "j_Na_jct_SL in component ion_diffusion (litre_per_millisecond)" legend_constants[162] = "j_Na_SL_cytosol in component ion_diffusion (litre_per_millisecond)" legend_constants[163] = "j_Ca_jct_SL in component ion_diffusion (litre_per_millisecond)" legend_constants[164] = "j_Ca_SL_cytosol in component ion_diffusion (litre_per_millisecond)" legend_constants[165] = "j_Na_jct_SL_new in component ion_diffusion (litre_per_millisecond)" legend_constants[166] = "j_Na_SL_cytosol_new in component ion_diffusion (litre_per_millisecond)" legend_constants[167] = "j_Ca_jct_SL_new in component ion_diffusion (litre_per_millisecond)" legend_constants[168] = "j_Ca_SL_cytosol_new in component ion_diffusion (litre_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[103] = "Bmax_SL in component Na_buffer (millimolar)" legend_constants[104] = "Bmax_jct in component Na_buffer (millimolar)" legend_constants[105] = "kon in component Na_buffer (per_millimolar_per_millisecond)" legend_constants[106] = "koff in component Na_buffer (per_millisecond)" legend_algebraic[97] = "dNa_jct_buf in component Na_buffer (millimolar_per_millisecond)" legend_algebraic[100] = "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[107] = "Bmax_SLB_SL in component Ca_buffer (millimolar)" legend_constants[108] = "Bmax_SLB_jct in component Ca_buffer (millimolar)" legend_constants[109] = "Bmax_SLHigh_SL in component Ca_buffer (millimolar)" legend_constants[110] = "Bmax_SLHigh_jct in component Ca_buffer (millimolar)" legend_constants[111] = "Bmax_Calsequestrin in component Ca_buffer (millimolar)" legend_constants[112] = "kon_SL in component Ca_buffer (per_millimolar_per_millisecond)" legend_constants[113] = "kon_Calsequestrin in component Ca_buffer (per_millimolar_per_millisecond)" legend_constants[114] = "koff_SLB in component Ca_buffer (per_millisecond)" legend_constants[115] = "koff_SLHigh in component Ca_buffer (per_millisecond)" legend_constants[116] = "koff_Calsequestrin in component Ca_buffer (per_millisecond)" legend_algebraic[109] = "dCalsequestrin in component Ca_buffer (millimolar_per_millisecond)" legend_algebraic[127] = "dCa_cytosol_tot_bound in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_algebraic[114] = "dCa_SLB_SL in component Ca_buffer (millimolar_per_millisecond)" legend_algebraic[112] = "dCa_SLB_jct in component Ca_buffer (millimolar_per_millisecond)" legend_algebraic[117] = "dCa_SLHigh_SL in component Ca_buffer (millimolar_per_millisecond)" legend_algebraic[115] = "dCa_SLHigh_jct in component Ca_buffer (millimolar_per_millisecond)" legend_algebraic[118] = "dCa_jct_tot_bound in component Ca_buffer (millimolar_per_millisecond)" legend_algebraic[121] = "dCa_SL_tot_bound in component Ca_buffer (millimolar_per_millisecond)" legend_algebraic[120] = "i_Ca_jct_tot in component Ca_buffer (microA_per_microF)" legend_algebraic[123] = "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[117] = "Bmax_TroponinC in component cytosolic_Ca_buffer (millimolar)" legend_constants[118] = "Bmax_TroponinC_Ca_Mg_Ca in component cytosolic_Ca_buffer (millimolar)" legend_constants[119] = "Bmax_TroponinC_Ca_Mg_Mg in component cytosolic_Ca_buffer (millimolar)" legend_constants[120] = "Bmax_Calmodulin in component cytosolic_Ca_buffer (millimolar)" legend_constants[121] = "Bmax_Myosin_Ca in component cytosolic_Ca_buffer (millimolar)" legend_constants[122] = "Bmax_Myosin_Mg in component cytosolic_Ca_buffer (millimolar)" legend_constants[123] = "Bmax_SRB in component cytosolic_Ca_buffer (millimolar)" legend_constants[124] = "kon_TroponinC in component cytosolic_Ca_buffer (per_millimolar_per_millisecond)" legend_constants[125] = "kon_TroponinC_Ca_Mg_Ca in component cytosolic_Ca_buffer (per_millimolar_per_millisecond)" legend_constants[126] = "kon_TroponinC_Ca_Mg_Mg in component cytosolic_Ca_buffer (per_millimolar_per_millisecond)" legend_constants[127] = "kon_Calmodulin in component cytosolic_Ca_buffer (per_millimolar_per_millisecond)" legend_constants[128] = "kon_Myosin_Ca in component cytosolic_Ca_buffer (per_millimolar_per_millisecond)" legend_constants[129] = "kon_Myosin_Mg in component cytosolic_Ca_buffer (per_millimolar_per_millisecond)" legend_constants[130] = "kon_SRB in component cytosolic_Ca_buffer (per_millimolar_per_millisecond)" legend_constants[131] = "koff_TroponinC in component cytosolic_Ca_buffer (per_millisecond)" legend_constants[132] = "koff_TroponinC_Ca_Mg_Ca in component cytosolic_Ca_buffer (per_millisecond)" legend_constants[133] = "koff_TroponinC_Ca_Mg_Mg in component cytosolic_Ca_buffer (per_millisecond)" legend_constants[134] = "koff_Calmodulin in component cytosolic_Ca_buffer (per_millisecond)" legend_constants[135] = "koff_Myosin_Ca in component cytosolic_Ca_buffer (per_millisecond)" legend_constants[136] = "koff_Myosin_Mg in component cytosolic_Ca_buffer (per_millisecond)" legend_constants[137] = "koff_SRB in component cytosolic_Ca_buffer (per_millisecond)" legend_algebraic[113] = "dCa_TroponinC in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_algebraic[116] = "dCa_TroponinC_Ca_Mg in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_algebraic[119] = "dMg_TroponinC_Ca_Mg in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_algebraic[122] = "dCa_Calmodulin in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_algebraic[124] = "dCa_Myosin in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_algebraic[125] = "dMg_Myosin in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_algebraic[126] = "dCa_SRB in component cytosolic_Ca_buffer (millimolar_per_millisecond)" legend_constants[138] = "Indo1 in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[139] = "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[140] = "Bmax_Indo1_Cytosol in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[141] = "Bmax_Indo1_SL in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[142] = "Bmax_Indo1_jct in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[143] = "Bmax_Fluo3_Cytosol in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[144] = "Bmax_Fluo3_SL in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[145] = "Bmax_Fluo3_jct in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_constants[146] = "kon_Indo1 in component indo_fluo_Ca_buffer_not_connected (per_millimolar2_per_millisecond)" legend_constants[147] = "kon_Fluo3 in component indo_fluo_Ca_buffer_not_connected (per_millimolar2_per_millisecond)" legend_constants[148] = "koff_Indo1 in component indo_fluo_Ca_buffer_not_connected (per_millisecond)" legend_constants[149] = "koff_Fluo3 in component indo_fluo_Ca_buffer_not_connected (per_millisecond)" legend_algebraic[15] = "Indo1Bound in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_algebraic[16] = "Fluo3Bound in component indo_fluo_Ca_buffer_not_connected (millimolar)" legend_algebraic[30] = "dCa_Indo1_Cytosol in component indo_fluo_Ca_buffer_not_connected (millimolar_per_millisecond)" legend_algebraic[31] = "dCa_Indo1_jct in component indo_fluo_Ca_buffer_not_connected (millimolar_per_millisecond)" legend_algebraic[32] = "dCa_Indo1_SL in component indo_fluo_Ca_buffer_not_connected (millimolar_per_millisecond)" legend_algebraic[33] = "dCa_Fluo3_Cytosol in component indo_fluo_Ca_buffer_not_connected (millimolar_per_millisecond)" legend_algebraic[34] = "dCa_Fluo3_jct in component indo_fluo_Ca_buffer_not_connected (millimolar_per_millisecond)" legend_algebraic[35] = "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_other 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] = 1 constants[11] = 15 constants[12] = 8314.3 constants[13] = 310 constants[14] = 96486.7 constants[15] = 2e-6 constants[16] = 100 constants[17] = 10.25 constants[18] = 0.16 constants[19] = 0.015 constants[20] = 0.045 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[21] = 16 constants[22] = 0.11 constants[23] = 0.89 states[7] = 0.001370685156 states[8] = 0.987140350343 states[9] = 0.991822731369 constants[24] = 0.297e-3 constants[25] = 0.11 constants[26] = 0.89 constants[27] = 1.63 constants[28] = 4 constants[29] = 1.49 constants[30] = 11 constants[31] = 1.5 constants[32] = 1.91 constants[33] = 0.11 constants[34] = 0.89 states[10] = 0.008471550841 constants[35] = 0.11 constants[36] = 0.89 constants[37] = 0.01833 states[11] = 0.00687399199 constants[38] = 0.02 states[12] = 0.293519921626 states[13] = 0.004011272375 states[14] = 0.383430556383 constants[39] = 0.06 states[15] = 0.9946314893 states[16] = 0.00401120993 constants[40] = 0.001 constants[41] = 0.109625 constants[42] = 0.1 constants[43] = 0.11 constants[44] = 0.89 constants[45] = 0.009 constants[46] = 5.4e-4 constants[47] = 1.5e-8 constants[48] = 2.7e-7 constants[49] = 0.9 constants[50] = 0.1 constants[51] = 0.341 constants[52] = 0.341 constants[53] = 0.75 constants[54] = 0.75 constants[55] = 0.75 constants[56] = 0.75 constants[57] = 1.8 states[17] = 0.000006997531 states[18] = 1.000675515962 states[19] = 0.015352888928 states[20] = 0.024609183734 constants[58] = 9 constants[59] = 0.11 constants[60] = 0.89 constants[61] = 1.57 constants[62] = 12.29 constants[63] = 1.3 constants[64] = 87.5 constants[65] = 0.00359 constants[66] = 0.000256 constants[67] = 0.27 constants[68] = 0.35 constants[69] = 3 constants[70] = 2.2e-6 constants[71] = 0.11 constants[72] = 0.89 constants[73] = 2.35 constants[74] = 0.0005 constants[75] = 1.6 constants[76] = 0.0673 constants[77] = 0.0002513 constants[78] = 0.11 constants[79] = 0.89 constants[80] = 15 constants[81] = 1 constants[82] = 0.45 states[21] = 0.884673513138 states[22] = 0.00000009272 states[23] = 0.000000711264 constants[83] = 25 constants[84] = 10 constants[85] = 0.06 constants[86] = 0.5 constants[87] = 0.005 constants[88] = 2.5 states[24] = 0.545611267699 constants[89] = 5.348e-6 constants[90] = 286e-6 constants[91] = 2.6 constants[92] = 0.000246 constants[93] = 1.7 constants[94] = 1.787 constants[95] = 1.64e-6 constants[96] = 1.22e-6 constants[97] = 1.09e-5 constants[98] = 1.79e-5 constants[99] = 0.5 constants[100] = 0.45 constants[101] = 3.01e-6 constants[102] = 1.3e-4 states[25] = 0.776121392467 states[26] = 3.557055389701 constants[103] = 1.65 constants[104] = 3.7 constants[105] = 0.0001 constants[106] = 1e-3 states[27] = 0.009868629147 states[28] = 0.007780801995 states[29] = 0.114438990328 states[30] = 0.077503874257 states[31] = 1.186496899338 constants[107] = 0.0374 constants[108] = 0.0046 constants[109] = 0.0134 constants[110] = 0.00165 constants[111] = 0.14 constants[112] = 100 constants[113] = 100 constants[114] = 1.3 constants[115] = 30e-3 constants[116] = 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[117] = 0.07 constants[118] = 0.14 constants[119] = 0.14 constants[120] = 0.024 constants[121] = 0.14 constants[122] = 0.14 constants[123] = 0.019 constants[124] = 32.7 constants[125] = 2.37 constants[126] = 3e-3 constants[127] = 34 constants[128] = 13.8 constants[129] = 15.7e-3 constants[130] = 100 constants[131] = 19.6e-3 constants[132] = 0.032e-3 constants[133] = 3.33e-3 constants[134] = 238e-3 constants[135] = 0.46e-3 constants[136] = 0.057e-3 constants[137] = 60e-3 constants[138] = 0 constants[139] = 0 states[39] = 0 states[40] = 0 states[41] = 0 states[42] = 0 states[43] = 0 states[44] = 0 constants[140] = 0.025 constants[141] = 0.00077 constants[142] = 0.00002 constants[143] = 0.025 constants[144] = 0.00077 constants[145] = 0.00002 constants[146] = 100 constants[147] = 100 constants[148] = 60e-3 constants[149] = 110e-3 constants[150] = ((constants[12]*constants[13])/constants[14])*log(constants[4]/constants[8]) constants[151] = ((-constants[12]*constants[13])/constants[14])*log(constants[7]/constants[11]) constants[152] = power(constants[27], (constants[13]-310.000)/10.0000) constants[153] = power(constants[29], (constants[13]-310.000)/10.0000) constants[154] = (exp(constants[5]/67.3000)-1.00000)/7.00000 constants[155] = 0.0300000*(power(constants[4]/5.40000, 1.0/2)) constants[156] = 0.900000*(power(constants[4]/5.40000, 1.0/2)) constants[157] = power(constants[57], (constants[13]-310.000)/10.0000) constants[158] = power(constants[61], (constants[13]-310.000)/10.0000) constants[159] = power(constants[73], (constants[13]-310.000)/10.0000) constants[160] = power(constants[91], (constants[13]-310.000)/10.0000) constants[161] = (constants[97]*constants[101])/constants[99] constants[162] = (constants[98]*constants[102])/constants[100] constants[163] = (constants[95]*constants[101])/constants[99] constants[164] = (constants[96]*constants[102])/constants[100] constants[165] = 1.83130e-14 constants[166] = 1.63860e-12 constants[167] = 8.24130e-13 constants[168] = 3.72430e-12 constants[169] = (((constants[15]*2.00000*constants[17])/10000.0)* pi*constants[16])/10000.0 constants[170] = (3.14159*(power(constants[17]/1000.00, 2.00000))*constants[16])/(power(1000.00, 3.00000)) constants[171] = 0.0350000*constants[170] constants[172] = 0.0200000*constants[170] constants[173] = 0.000510000*constants[170] constants[174] = 0.650000*constants[170] constants[175] = constants[170]-(constants[171]+constants[172]+constants[173]+constants[174]) constants[176] = (constants[70]*constants[174]*2.00000*constants[14])/constants[169] 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])-11.9000*states[19] rates[20] = 1.70000*states[5]*(1.00000-states[20])-11.9000*states[20] algebraic[3] = 1.00000/(1.00000+exp(-(50.0000+states[0])/7.50000)) algebraic[20] = 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[20] algebraic[7] = 1.00000/(1.00000+exp(-(states[0]-1.50000)/16.7000)) algebraic[22] = 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[22] algebraic[8] = 1.00000/(1.00000+exp(-(states[0]+3.00000)/15.0000)) algebraic[23] = 9.00000/(1.00000+exp((states[0]+3.00000)/15.0000))+0.500000 rates[13] = (algebraic[8]-states[13])/algebraic[23] algebraic[9] = 1.00000/(1.00000+exp((states[0]+33.5000)/10.0000)) algebraic[24] = 3000.00/(1.00000+exp((states[0]+60.0000)/10.0000))+30.0000 rates[12] = (algebraic[9]-states[12])/algebraic[24] algebraic[10] = 1.00000/(1.00000+exp(-(states[0]+3.00000)/15.0000)) algebraic[25] = 3.50000*exp(-(power(states[0]/30.0000, 2.00000)))+1.50000 rates[16] = (algebraic[10]-states[16])/algebraic[25] algebraic[11] = 1.00000/(1.00000+exp((states[0]+33.5000)/10.0000)) algebraic[26] = 20.0000/(1.00000+exp((states[0]+33.5000)/10.0000))+20.0000 rates[15] = (algebraic[11]-states[15])/algebraic[26] algebraic[12] = 1.00000/(1.00000+exp(-(states[0]+14.5000)/6.00000)) algebraic[27] = (1.00000*algebraic[12]*(1.00000-exp(-(states[0]+14.5000)/6.00000)))/(0.0350000*(states[0]+14.5000)) rates[17] = (algebraic[12]-states[17])/algebraic[27] algebraic[13] = 1.00000/(1.00000+exp((states[0]+35.0600)/3.60000))+0.600000/(1.00000+exp((50.0000-states[0])/20.0000)) algebraic[28] = 1.00000/(0.0197000*exp(-(power(0.0337000*(states[0]+14.5000), 2.00000)))+0.0200000) rates[18] = (algebraic[13]-states[18])/algebraic[28] algebraic[15] = states[39]+(states[41]*constants[173])/constants[174]+(states[40]*constants[172])/constants[174] algebraic[30] = constants[146]*(constants[138]-algebraic[15])*states[4]*(constants[140]-states[39])-constants[148]*states[39] rates[39] = algebraic[30] algebraic[32] = constants[146]*(constants[138]-algebraic[15])*states[6]*((constants[141]*constants[174])/constants[172]-states[40])-constants[148]*states[40] rates[40] = algebraic[32] algebraic[31] = constants[146]*(constants[138]-algebraic[15])*states[5]*((constants[142]*constants[174])/constants[173]-states[41])-constants[148]*states[41] rates[41] = algebraic[31] algebraic[16] = states[42]+(states[44]*constants[173])/constants[174]+(states[43]*constants[172])/constants[174] algebraic[33] = constants[147]*(constants[139]-algebraic[16])*states[4]*(constants[143]-states[42])-constants[149]*states[42] rates[42] = algebraic[33] algebraic[35] = constants[147]*(constants[139]-algebraic[16])*states[6]*((constants[144]*constants[174])/constants[172]-states[43])-constants[149]*states[43] rates[43] = algebraic[35] algebraic[34] = constants[147]*(constants[139]-algebraic[16])*states[5]*((constants[145]*constants[174])/constants[173]-states[44])-constants[149]*states[44] rates[44] = algebraic[34] algebraic[14] = constants[80]-(constants[80]-constants[81])/(1.00000+power(constants[82]/states[24], constants[88])) algebraic[29] = constants[84]/algebraic[14] algebraic[40] = constants[86]*algebraic[14] rates[23] = (algebraic[29]*(power(states[5], 2.00000))*states[21]-constants[85]*states[23])-(algebraic[40]*states[5]*states[23]-constants[87]*states[22]) algebraic[0] = custom_piecewise([less(states[0] , -40.0000), 0.135000*exp((80.0000+states[0])/-6.80000) , True, 0.00000]) algebraic[17] = 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[36] = 1.00000/(algebraic[0]+algebraic[17]) algebraic[41] = algebraic[0]/(algebraic[0]+algebraic[17]) rates[8] = (algebraic[41]-states[8])/algebraic[36] 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[18] = 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[37] = 1.00000/(algebraic[1]+algebraic[18]) algebraic[42] = algebraic[1]/(algebraic[1]+algebraic[18]) rates[9] = (algebraic[42]-states[9])/algebraic[37] algebraic[2] = ((0.320000*(states[0]+47.1300))/1.00000)/(1.00000-exp(-0.100000*(states[0]+47.1300))) algebraic[19] = 0.0800000*exp(-states[0]/11.0000) algebraic[38] = 1.00000/(algebraic[2]+algebraic[19]) algebraic[43] = algebraic[2]/(algebraic[2]+algebraic[19]) rates[7] = (algebraic[43]-states[7])/algebraic[38] algebraic[45] = ((1.00000-states[21])-states[23])-states[22] rates[21] = (constants[87]*algebraic[45]-algebraic[40]*states[5]*states[21])-(algebraic[29]*(power(states[5], 2.00000))*states[21]-constants[85]*states[23]) rates[22] = (algebraic[40]*states[5]*states[23]-constants[87]*states[22])-(constants[85]*states[22]-algebraic[29]*(power(states[5], 2.00000))*algebraic[45]) algebraic[68] = 1.00000/(1.00000+exp((states[0]+33.5000)/10.0000)) algebraic[70] = algebraic[68] algebraic[69] = 2800.00/(1.00000+exp((states[0]+60.0000)/10.0000))+220.000 rates[14] = (algebraic[68]-algebraic[70])/algebraic[69] algebraic[97] = constants[105]*states[2]*(constants[104]-states[26])-constants[106]*states[26] rates[26] = algebraic[97] algebraic[21] = ((constants[12]*constants[13])/constants[14])*log(constants[5]/states[2]) algebraic[47] = (power(states[7], 3.00000))*states[8]*states[9] algebraic[48] = constants[22]*constants[21]*algebraic[47]*(states[0]-algebraic[21]) algebraic[51] = constants[25]*constants[24]*(states[0]-algebraic[21]) algebraic[54] = 1.00000/(1.00000+0.124500*exp((-0.100000*states[0]*constants[14])/(constants[12]*constants[13]))+0.0365000*constants[154]*exp((-states[0]*constants[14])/(constants[12]*constants[13]))) algebraic[55] = (((constants[33]*constants[152]*constants[32]*algebraic[54])/(1.00000+power((constants[153]*constants[30])/states[2], constants[28])))*constants[4])/(constants[4]+constants[31]) algebraic[84] = 1.00000-states[20] algebraic[80] = (states[17]*states[18]*constants[157]*states[0]*(power(constants[14], 2.00000)))/(constants[12]*constants[13]) algebraic[86] = (algebraic[80]*algebraic[84]*constants[49]*constants[47]*(constants[53]*states[2]*exp((states[0]*constants[14])/(constants[12]*constants[13]))-constants[54]*constants[5]))/(exp((states[0]*constants[14])/(constants[12]*constants[13]))-1.00000) algebraic[92] = 1.00000/(1.00000+power(constants[66]/states[5], 3.00000)) algebraic[89] = (exp((constants[68]*states[0]*constants[14])/(constants[12]*constants[13]))*(power(states[2], constants[69]))*constants[6]-exp(((constants[68]-1.00000)*states[0]*constants[14])/(constants[12]*constants[13]))*(power(constants[5], constants[69]))*states[5])/(1.00000+constants[67]*exp(((constants[68]-1.00000)*states[0]*constants[14])/(constants[12]*constants[13]))) algebraic[93] = (constants[59]*constants[58]*algebraic[92]*constants[158]*algebraic[89])/(constants[65]*(power(constants[5], constants[69]))*(1.00000+power(states[2]/constants[62], constants[69]))+(power(constants[64], constants[69]))*states[5]*(1.00000+states[5]/constants[65])+constants[63]*(power(states[2], constants[69]))+(power(states[2], constants[69]))*constants[6]+(power(constants[5], constants[69]))*states[5]) algebraic[95] = (states[2]-states[3])*constants[161] rates[2] = ((-constants[169]*(algebraic[48]+3.00000*algebraic[93]+algebraic[51]+3.00000*algebraic[55]+algebraic[86]))/(constants[173]*constants[14])-algebraic[95]/constants[173])-algebraic[97] algebraic[98] = (states[3]-states[1])*constants[162] rates[1] = algebraic[98]/constants[174] algebraic[100] = constants[105]*states[3]*(constants[103]-states[25])-constants[106]*states[25] rates[25] = algebraic[100] algebraic[39] = ((constants[12]*constants[13])/constants[14])*log(constants[5]/states[3]) algebraic[49] = constants[23]*constants[21]*algebraic[47]*(states[0]-algebraic[39]) algebraic[52] = constants[26]*constants[24]*(states[0]-algebraic[39]) algebraic[56] = (((constants[34]*constants[152]*constants[32]*algebraic[54])/(1.00000+power((constants[153]*constants[30])/states[3], constants[28])))*constants[4])/(constants[4]+constants[31]) algebraic[81] = 1.00000-states[19] algebraic[83] = (algebraic[80]*algebraic[81]*constants[50]*constants[47]*(constants[53]*states[3]*exp((states[0]*constants[14])/(constants[12]*constants[13]))-constants[54]*constants[5]))/(exp((states[0]*constants[14])/(constants[12]*constants[13]))-1.00000) algebraic[91] = 1.00000/(1.00000+power(constants[66]/states[6], 3.00000)) algebraic[90] = (exp((constants[68]*states[0]*constants[14])/(constants[12]*constants[13]))*(power(states[3], constants[69]))*constants[6]-exp(((constants[68]-1.00000)*states[0]*constants[14])/(constants[12]*constants[13]))*(power(constants[5], constants[69]))*states[6])/(1.00000+constants[67]*exp(((constants[68]-1.00000)*states[0]*constants[14])/(constants[12]*constants[13]))) algebraic[94] = (constants[60]*constants[58]*algebraic[91]*constants[158]*algebraic[90])/(constants[65]*(power(constants[5], constants[69]))*(1.00000+power(states[3]/constants[62], constants[69]))+(power(constants[64], constants[69]))*states[6]*(1.00000+states[6]/constants[65])+constants[63]*(power(states[3], constants[69]))+(power(states[3], constants[69]))*constants[6]+(power(constants[5], constants[69]))*states[6]) rates[3] = ((-constants[169]*(algebraic[49]+3.00000*algebraic[94]+algebraic[52]+3.00000*algebraic[56]+algebraic[83]))/(constants[172]*constants[14])+(algebraic[95]-algebraic[98])/constants[172])-algebraic[100] algebraic[50] = algebraic[48]+algebraic[49] algebraic[53] = algebraic[51]+algebraic[52] algebraic[57] = algebraic[55]+algebraic[56] algebraic[58] = 1.00000/(1.00000+exp((33.0000+states[0])/22.4000)) algebraic[59] = constants[155]*states[10]*algebraic[58]*(states[0]-constants[150]) algebraic[60] = -log(states[5]/1.00000+3.00000, 10) algebraic[62] = 0.0700000*(0.0570000+0.190000/(1.00000+exp(-7.20000+algebraic[60]/0.600000))) algebraic[64] = ((constants[12]*constants[13])/constants[14])*log((constants[4]+constants[37]*constants[5])/(constants[8]+constants[37]*states[1])) algebraic[65] = constants[35]*algebraic[62]*(power(states[11], 2.00000))*(states[0]-algebraic[64]) algebraic[61] = -log(states[6]/1.00000+3.00000, 10) algebraic[63] = 0.0700000*(0.0570000+0.190000/(1.00000+exp(-7.20000+algebraic[61]/0.600000))) algebraic[66] = constants[36]*algebraic[63]*(power(states[11], 2.00000))*(states[0]-algebraic[64]) algebraic[67] = algebraic[65]+algebraic[66] algebraic[71] = constants[38]*states[13]*(states[12]+0.500000*algebraic[70])*(states[0]-constants[150]) algebraic[72] = constants[39]*states[16]*states[15]*(states[0]-constants[150]) algebraic[73] = 1.02000/(1.00000+exp(0.238500*(states[0]-(constants[150]+59.2150)))) algebraic[74] = (0.491240*exp(0.0803200*((states[0]-constants[150])+5.47600))+1.00000*exp(0.0617500*(states[0]-(constants[150]+594.310))))/(1.00000+exp(-0.514300*((states[0]-constants[150])+4.75300))) algebraic[75] = algebraic[73]/(algebraic[73]+algebraic[74]) algebraic[76] = constants[156]*algebraic[75]*(states[0]-constants[150]) algebraic[77] = (constants[40]*(states[0]-constants[150]))/(1.00000+exp(7.48800-states[0]/5.98000)) algebraic[96] = algebraic[93]+algebraic[94] algebraic[78] = constants[41]*(states[0]-constants[151])*(constants[43]/(1.00000+constants[42]/states[5])+constants[44]/(1.00000+constants[42]/states[6])) algebraic[79] = constants[45]*(states[0]-constants[151]) algebraic[82] = (algebraic[80]*algebraic[81]*constants[50]*constants[46]*4.00000*(constants[51]*states[6]*exp((2.00000*states[0]*constants[14])/(constants[12]*constants[13]))-constants[52]*constants[6]))/(exp((2.00000*states[0]*constants[14])/(constants[12]*constants[13]))-1.00000) algebraic[85] = (algebraic[80]*algebraic[84]*constants[49]*constants[46]*4.00000*(constants[51]*states[5]*exp((2.00000*states[0]*constants[14])/(constants[12]*constants[13]))-constants[52]*constants[6]))/(exp((2.00000*states[0]*constants[14])/(constants[12]*constants[13]))-1.00000) algebraic[87] = (algebraic[80]*(algebraic[81]*constants[50]+algebraic[84]*constants[49])*constants[48]*(constants[55]*constants[8]*exp((states[0]*constants[14])/(constants[12]*constants[13]))-constants[56]*constants[4]))/(exp((states[0]*constants[14])/(constants[12]*constants[13]))-1.00000) algebraic[88] = algebraic[82]+algebraic[85]+algebraic[83]+algebraic[86]+algebraic[87] algebraic[44] = ((constants[12]*constants[13])/(2.00000*constants[14]))*log(constants[6]/states[5]) algebraic[103] = constants[77]*constants[78]*(states[0]-algebraic[44]) algebraic[46] = ((constants[12]*constants[13])/(2.00000*constants[14]))*log(constants[6]/states[6]) algebraic[104] = constants[77]*constants[79]*(states[0]-algebraic[46]) algebraic[105] = algebraic[104]+algebraic[103] algebraic[101] = (constants[159]*constants[76]*constants[72])/(1.00000+power(constants[74]/states[6], constants[75])) algebraic[99] = (constants[159]*constants[76]*constants[71])/(1.00000+power(constants[74]/states[5], constants[75])) algebraic[102] = algebraic[99]+algebraic[101] 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[50]+algebraic[53]+algebraic[57]+algebraic[59]+algebraic[67]+algebraic[71]+algebraic[72]+algebraic[76]+algebraic[77]+algebraic[96]+algebraic[78]+algebraic[79]+algebraic[88]+algebraic[105]+algebraic[102]+algebraic[6]) algebraic[109] = constants[113]*states[24]*((constants[111]*constants[174])/constants[171]-states[31])-constants[116]*states[31] rates[31] = algebraic[109] algebraic[106] = constants[83]*states[23]*(states[24]-states[5]) algebraic[107] = constants[89]*(states[24]-states[5]) algebraic[108] = (((constants[160]*constants[90]*constants[174])/constants[171])*(power(states[4]/constants[92], constants[94])-power(states[24]/constants[93], constants[94])))/(1.00000+power(states[4]/constants[92], constants[94])+power(states[24]/constants[93], constants[94])) rates[24] = (algebraic[108]-((algebraic[107]*constants[174])/constants[171]+algebraic[106]))-algebraic[109] algebraic[112] = constants[112]*states[5]*((constants[108]*constants[174])/constants[173]-states[28])-constants[114]*states[28] rates[28] = algebraic[112] algebraic[114] = constants[112]*states[6]*((constants[107]*constants[174])/constants[172]-states[27])-constants[114]*states[27] rates[27] = algebraic[114] algebraic[115] = constants[112]*states[5]*((constants[110]*constants[174])/constants[173]-states[30])-constants[115]*states[30] rates[30] = algebraic[115] algebraic[113] = constants[124]*states[4]*(constants[117]-states[32])-constants[131]*states[32] rates[32] = algebraic[113] algebraic[117] = constants[112]*states[6]*((constants[109]*constants[174])/constants[172]-states[29])-constants[115]*states[29] rates[29] = algebraic[117] algebraic[116] = constants[125]*states[4]*(constants[118]-(states[33]+states[34]))-constants[132]*states[33] rates[33] = algebraic[116] algebraic[110] = (states[5]-states[6])*constants[163] algebraic[118] = algebraic[112]+algebraic[115] algebraic[120] = (algebraic[85]-2.00000*algebraic[93])+algebraic[103]+algebraic[99] rates[5] = (((-algebraic[120]*constants[169])/(constants[173]*2.00000*constants[14])-algebraic[110]/constants[173])+(algebraic[106]*constants[171])/constants[173]+(algebraic[107]*constants[174])/constants[173])-1.00000*algebraic[118] algebraic[119] = constants[126]*constants[9]*(constants[119]-(states[33]+states[34]))-constants[133]*states[34] rates[34] = algebraic[119] algebraic[111] = (states[6]-states[4])*constants[164] algebraic[121] = algebraic[114]+algebraic[117] algebraic[123] = (algebraic[82]-2.00000*algebraic[94])+algebraic[104]+algebraic[101] rates[6] = ((-algebraic[123]*constants[169])/(constants[172]*2.00000*constants[14])+(algebraic[110]-algebraic[111])/constants[172])-1.00000*algebraic[121] algebraic[122] = constants[127]*states[4]*(constants[120]-states[35])-constants[134]*states[35] rates[35] = algebraic[122] algebraic[124] = constants[128]*states[4]*(constants[121]-(states[36]+states[37]))-constants[135]*states[36] rates[36] = algebraic[124] algebraic[125] = constants[129]*constants[9]*(constants[122]-(states[36]+states[37]))-constants[136]*states[37] rates[37] = algebraic[125] algebraic[126] = constants[130]*states[4]*(constants[123]-states[38])-constants[137]*states[38] rates[38] = algebraic[126] algebraic[127] = algebraic[113]+algebraic[116]+algebraic[119]+algebraic[122]+algebraic[124]+algebraic[125]+algebraic[126] rates[4] = ((-algebraic[108]*constants[171])/constants[174]+algebraic[111]/constants[174])-1.00000*algebraic[127] 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[20] = 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[22] = 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[23] = 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[24] = 3000.00/(1.00000+exp((states[0]+60.0000)/10.0000))+30.0000 algebraic[10] = 1.00000/(1.00000+exp(-(states[0]+3.00000)/15.0000)) algebraic[25] = 3.50000*exp(-(power(states[0]/30.0000, 2.00000)))+1.50000 algebraic[11] = 1.00000/(1.00000+exp((states[0]+33.5000)/10.0000)) algebraic[26] = 20.0000/(1.00000+exp((states[0]+33.5000)/10.0000))+20.0000 algebraic[12] = 1.00000/(1.00000+exp(-(states[0]+14.5000)/6.00000)) algebraic[27] = (1.00000*algebraic[12]*(1.00000-exp(-(states[0]+14.5000)/6.00000)))/(0.0350000*(states[0]+14.5000)) algebraic[13] = 1.00000/(1.00000+exp((states[0]+35.0600)/3.60000))+0.600000/(1.00000+exp((50.0000-states[0])/20.0000)) algebraic[28] = 1.00000/(0.0197000*exp(-(power(0.0337000*(states[0]+14.5000), 2.00000)))+0.0200000) algebraic[15] = states[39]+(states[41]*constants[173])/constants[174]+(states[40]*constants[172])/constants[174] algebraic[30] = constants[146]*(constants[138]-algebraic[15])*states[4]*(constants[140]-states[39])-constants[148]*states[39] algebraic[32] = constants[146]*(constants[138]-algebraic[15])*states[6]*((constants[141]*constants[174])/constants[172]-states[40])-constants[148]*states[40] algebraic[31] = constants[146]*(constants[138]-algebraic[15])*states[5]*((constants[142]*constants[174])/constants[173]-states[41])-constants[148]*states[41] algebraic[16] = states[42]+(states[44]*constants[173])/constants[174]+(states[43]*constants[172])/constants[174] algebraic[33] = constants[147]*(constants[139]-algebraic[16])*states[4]*(constants[143]-states[42])-constants[149]*states[42] algebraic[35] = constants[147]*(constants[139]-algebraic[16])*states[6]*((constants[144]*constants[174])/constants[172]-states[43])-constants[149]*states[43] algebraic[34] = constants[147]*(constants[139]-algebraic[16])*states[5]*((constants[145]*constants[174])/constants[173]-states[44])-constants[149]*states[44] algebraic[14] = constants[80]-(constants[80]-constants[81])/(1.00000+power(constants[82]/states[24], constants[88])) algebraic[29] = constants[84]/algebraic[14] algebraic[40] = constants[86]*algebraic[14] algebraic[0] = custom_piecewise([less(states[0] , -40.0000), 0.135000*exp((80.0000+states[0])/-6.80000) , True, 0.00000]) algebraic[17] = 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[36] = 1.00000/(algebraic[0]+algebraic[17]) algebraic[41] = algebraic[0]/(algebraic[0]+algebraic[17]) 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[18] = 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[37] = 1.00000/(algebraic[1]+algebraic[18]) algebraic[42] = algebraic[1]/(algebraic[1]+algebraic[18]) algebraic[2] = ((0.320000*(states[0]+47.1300))/1.00000)/(1.00000-exp(-0.100000*(states[0]+47.1300))) algebraic[19] = 0.0800000*exp(-states[0]/11.0000) algebraic[38] = 1.00000/(algebraic[2]+algebraic[19]) algebraic[43] = algebraic[2]/(algebraic[2]+algebraic[19]) algebraic[45] = ((1.00000-states[21])-states[23])-states[22] algebraic[68] = 1.00000/(1.00000+exp((states[0]+33.5000)/10.0000)) algebraic[70] = algebraic[68] algebraic[69] = 2800.00/(1.00000+exp((states[0]+60.0000)/10.0000))+220.000 algebraic[97] = constants[105]*states[2]*(constants[104]-states[26])-constants[106]*states[26] algebraic[21] = ((constants[12]*constants[13])/constants[14])*log(constants[5]/states[2]) algebraic[47] = (power(states[7], 3.00000))*states[8]*states[9] algebraic[48] = constants[22]*constants[21]*algebraic[47]*(states[0]-algebraic[21]) algebraic[51] = constants[25]*constants[24]*(states[0]-algebraic[21]) algebraic[54] = 1.00000/(1.00000+0.124500*exp((-0.100000*states[0]*constants[14])/(constants[12]*constants[13]))+0.0365000*constants[154]*exp((-states[0]*constants[14])/(constants[12]*constants[13]))) algebraic[55] = (((constants[33]*constants[152]*constants[32]*algebraic[54])/(1.00000+power((constants[153]*constants[30])/states[2], constants[28])))*constants[4])/(constants[4]+constants[31]) algebraic[84] = 1.00000-states[20] algebraic[80] = (states[17]*states[18]*constants[157]*states[0]*(power(constants[14], 2.00000)))/(constants[12]*constants[13]) algebraic[86] = (algebraic[80]*algebraic[84]*constants[49]*constants[47]*(constants[53]*states[2]*exp((states[0]*constants[14])/(constants[12]*constants[13]))-constants[54]*constants[5]))/(exp((states[0]*constants[14])/(constants[12]*constants[13]))-1.00000) algebraic[92] = 1.00000/(1.00000+power(constants[66]/states[5], 3.00000)) algebraic[89] = (exp((constants[68]*states[0]*constants[14])/(constants[12]*constants[13]))*(power(states[2], constants[69]))*constants[6]-exp(((constants[68]-1.00000)*states[0]*constants[14])/(constants[12]*constants[13]))*(power(constants[5], constants[69]))*states[5])/(1.00000+constants[67]*exp(((constants[68]-1.00000)*states[0]*constants[14])/(constants[12]*constants[13]))) algebraic[93] = (constants[59]*constants[58]*algebraic[92]*constants[158]*algebraic[89])/(constants[65]*(power(constants[5], constants[69]))*(1.00000+power(states[2]/constants[62], constants[69]))+(power(constants[64], constants[69]))*states[5]*(1.00000+states[5]/constants[65])+constants[63]*(power(states[2], constants[69]))+(power(states[2], constants[69]))*constants[6]+(power(constants[5], constants[69]))*states[5]) algebraic[95] = (states[2]-states[3])*constants[161] algebraic[98] = (states[3]-states[1])*constants[162] algebraic[100] = constants[105]*states[3]*(constants[103]-states[25])-constants[106]*states[25] algebraic[39] = ((constants[12]*constants[13])/constants[14])*log(constants[5]/states[3]) algebraic[49] = constants[23]*constants[21]*algebraic[47]*(states[0]-algebraic[39]) algebraic[52] = constants[26]*constants[24]*(states[0]-algebraic[39]) algebraic[56] = (((constants[34]*constants[152]*constants[32]*algebraic[54])/(1.00000+power((constants[153]*constants[30])/states[3], constants[28])))*constants[4])/(constants[4]+constants[31]) algebraic[81] = 1.00000-states[19] algebraic[83] = (algebraic[80]*algebraic[81]*constants[50]*constants[47]*(constants[53]*states[3]*exp((states[0]*constants[14])/(constants[12]*constants[13]))-constants[54]*constants[5]))/(exp((states[0]*constants[14])/(constants[12]*constants[13]))-1.00000) algebraic[91] = 1.00000/(1.00000+power(constants[66]/states[6], 3.00000)) algebraic[90] = (exp((constants[68]*states[0]*constants[14])/(constants[12]*constants[13]))*(power(states[3], constants[69]))*constants[6]-exp(((constants[68]-1.00000)*states[0]*constants[14])/(constants[12]*constants[13]))*(power(constants[5], constants[69]))*states[6])/(1.00000+constants[67]*exp(((constants[68]-1.00000)*states[0]*constants[14])/(constants[12]*constants[13]))) algebraic[94] = (constants[60]*constants[58]*algebraic[91]*constants[158]*algebraic[90])/(constants[65]*(power(constants[5], constants[69]))*(1.00000+power(states[3]/constants[62], constants[69]))+(power(constants[64], constants[69]))*states[6]*(1.00000+states[6]/constants[65])+constants[63]*(power(states[3], constants[69]))+(power(states[3], constants[69]))*constants[6]+(power(constants[5], constants[69]))*states[6]) algebraic[50] = algebraic[48]+algebraic[49] algebraic[53] = algebraic[51]+algebraic[52] algebraic[57] = algebraic[55]+algebraic[56] algebraic[58] = 1.00000/(1.00000+exp((33.0000+states[0])/22.4000)) algebraic[59] = constants[155]*states[10]*algebraic[58]*(states[0]-constants[150]) algebraic[60] = -log(states[5]/1.00000+3.00000, 10) algebraic[62] = 0.0700000*(0.0570000+0.190000/(1.00000+exp(-7.20000+algebraic[60]/0.600000))) algebraic[64] = ((constants[12]*constants[13])/constants[14])*log((constants[4]+constants[37]*constants[5])/(constants[8]+constants[37]*states[1])) algebraic[65] = constants[35]*algebraic[62]*(power(states[11], 2.00000))*(states[0]-algebraic[64]) algebraic[61] = -log(states[6]/1.00000+3.00000, 10) algebraic[63] = 0.0700000*(0.0570000+0.190000/(1.00000+exp(-7.20000+algebraic[61]/0.600000))) algebraic[66] = constants[36]*algebraic[63]*(power(states[11], 2.00000))*(states[0]-algebraic[64]) algebraic[67] = algebraic[65]+algebraic[66] algebraic[71] = constants[38]*states[13]*(states[12]+0.500000*algebraic[70])*(states[0]-constants[150]) algebraic[72] = constants[39]*states[16]*states[15]*(states[0]-constants[150]) algebraic[73] = 1.02000/(1.00000+exp(0.238500*(states[0]-(constants[150]+59.2150)))) algebraic[74] = (0.491240*exp(0.0803200*((states[0]-constants[150])+5.47600))+1.00000*exp(0.0617500*(states[0]-(constants[150]+594.310))))/(1.00000+exp(-0.514300*((states[0]-constants[150])+4.75300))) algebraic[75] = algebraic[73]/(algebraic[73]+algebraic[74]) algebraic[76] = constants[156]*algebraic[75]*(states[0]-constants[150]) algebraic[77] = (constants[40]*(states[0]-constants[150]))/(1.00000+exp(7.48800-states[0]/5.98000)) algebraic[96] = algebraic[93]+algebraic[94] algebraic[78] = constants[41]*(states[0]-constants[151])*(constants[43]/(1.00000+constants[42]/states[5])+constants[44]/(1.00000+constants[42]/states[6])) algebraic[79] = constants[45]*(states[0]-constants[151]) algebraic[82] = (algebraic[80]*algebraic[81]*constants[50]*constants[46]*4.00000*(constants[51]*states[6]*exp((2.00000*states[0]*constants[14])/(constants[12]*constants[13]))-constants[52]*constants[6]))/(exp((2.00000*states[0]*constants[14])/(constants[12]*constants[13]))-1.00000) algebraic[85] = (algebraic[80]*algebraic[84]*constants[49]*constants[46]*4.00000*(constants[51]*states[5]*exp((2.00000*states[0]*constants[14])/(constants[12]*constants[13]))-constants[52]*constants[6]))/(exp((2.00000*states[0]*constants[14])/(constants[12]*constants[13]))-1.00000) algebraic[87] = (algebraic[80]*(algebraic[81]*constants[50]+algebraic[84]*constants[49])*constants[48]*(constants[55]*constants[8]*exp((states[0]*constants[14])/(constants[12]*constants[13]))-constants[56]*constants[4]))/(exp((states[0]*constants[14])/(constants[12]*constants[13]))-1.00000) algebraic[88] = algebraic[82]+algebraic[85]+algebraic[83]+algebraic[86]+algebraic[87] algebraic[44] = ((constants[12]*constants[13])/(2.00000*constants[14]))*log(constants[6]/states[5]) algebraic[103] = constants[77]*constants[78]*(states[0]-algebraic[44]) algebraic[46] = ((constants[12]*constants[13])/(2.00000*constants[14]))*log(constants[6]/states[6]) algebraic[104] = constants[77]*constants[79]*(states[0]-algebraic[46]) algebraic[105] = algebraic[104]+algebraic[103] algebraic[101] = (constants[159]*constants[76]*constants[72])/(1.00000+power(constants[74]/states[6], constants[75])) algebraic[99] = (constants[159]*constants[76]*constants[71])/(1.00000+power(constants[74]/states[5], constants[75])) algebraic[102] = algebraic[99]+algebraic[101] 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[109] = constants[113]*states[24]*((constants[111]*constants[174])/constants[171]-states[31])-constants[116]*states[31] algebraic[106] = constants[83]*states[23]*(states[24]-states[5]) algebraic[107] = constants[89]*(states[24]-states[5]) algebraic[108] = (((constants[160]*constants[90]*constants[174])/constants[171])*(power(states[4]/constants[92], constants[94])-power(states[24]/constants[93], constants[94])))/(1.00000+power(states[4]/constants[92], constants[94])+power(states[24]/constants[93], constants[94])) algebraic[112] = constants[112]*states[5]*((constants[108]*constants[174])/constants[173]-states[28])-constants[114]*states[28] algebraic[114] = constants[112]*states[6]*((constants[107]*constants[174])/constants[172]-states[27])-constants[114]*states[27] algebraic[115] = constants[112]*states[5]*((constants[110]*constants[174])/constants[173]-states[30])-constants[115]*states[30] algebraic[113] = constants[124]*states[4]*(constants[117]-states[32])-constants[131]*states[32] algebraic[117] = constants[112]*states[6]*((constants[109]*constants[174])/constants[172]-states[29])-constants[115]*states[29] algebraic[116] = constants[125]*states[4]*(constants[118]-(states[33]+states[34]))-constants[132]*states[33] algebraic[110] = (states[5]-states[6])*constants[163] algebraic[118] = algebraic[112]+algebraic[115] algebraic[120] = (algebraic[85]-2.00000*algebraic[93])+algebraic[103]+algebraic[99] algebraic[119] = constants[126]*constants[9]*(constants[119]-(states[33]+states[34]))-constants[133]*states[34] algebraic[111] = (states[6]-states[4])*constants[164] algebraic[121] = algebraic[114]+algebraic[117] algebraic[123] = (algebraic[82]-2.00000*algebraic[94])+algebraic[104]+algebraic[101] algebraic[122] = constants[127]*states[4]*(constants[120]-states[35])-constants[134]*states[35] algebraic[124] = constants[128]*states[4]*(constants[121]-(states[36]+states[37]))-constants[135]*states[36] algebraic[125] = constants[129]*constants[9]*(constants[122]-(states[36]+states[37]))-constants[136]*states[37] algebraic[126] = constants[130]*states[4]*(constants[123]-states[38])-constants[137]*states[38] algebraic[127] = algebraic[113]+algebraic[116]+algebraic[119]+algebraic[122]+algebraic[124]+algebraic[125]+algebraic[126] algebraic[4] = ((constants[12]*constants[13])/constants[14])*log((constants[4]+constants[37]*constants[5])/(constants[8]+constants[37]*states[2])) algebraic[5] = ((constants[12]*constants[13])/constants[14])*log((constants[4]+constants[37]*constants[5])/(constants[8]+constants[37]*states[3])) 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)