# Size of variable arrays: sizeAlgebraic = 101 sizeStates = 33 sizeConstants = 116 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 (second)" legend_constants[0] = "R in component Membrane (joule_per_kilomole_kelvin)" legend_constants[1] = "T in component Membrane (kelvin)" legend_constants[2] = "F in component Membrane (coulomb_per_mole)" legend_constants[3] = "C in component Membrane (microF)" legend_constants[91] = "RTONF in component Membrane (millivolt)" legend_algebraic[59] = "i_f in component i_f (nanoA)" legend_algebraic[61] = "i_NaK in component i_NaK (nanoA)" legend_algebraic[75] = "i_NaCa in component i_NaCa (nanoA)" legend_algebraic[79] = "i_Na in component i_Na (nanoA)" legend_algebraic[89] = "i_Kr in component i_Kr (nanoA)" legend_algebraic[95] = "i_Ks in component i_Ks (nanoA)" legend_algebraic[87] = "i_to in component i_to (nanoA)" legend_algebraic[83] = "i_CaL in component i_CaL (nanoA)" legend_algebraic[84] = "i_CaT in component i_CaT (nanoA)" legend_algebraic[98] = "i_KACh in component i_KACh (nanoA)" legend_algebraic[85] = "i_Kur in component i_Kur (nanoA)" legend_algebraic[9] = "V in component Membrane (millivolt)" legend_constants[4] = "clamp_mode in component Membrane (dimensionless)" legend_algebraic[5] = "V_clamp in component Voltage_clamp (millivolt)" legend_states[0] = "V_ode in component Membrane (millivolt)" legend_algebraic[100] = "i_tot in component Membrane (nanoA)" legend_constants[5] = "t_holding in component Voltage_clamp (second)" legend_constants[6] = "t_test in component Voltage_clamp (second)" legend_constants[7] = "V_test in component Voltage_clamp (millivolt)" legend_constants[8] = "V_holding in component Voltage_clamp (millivolt)" legend_constants[9] = "ACh in component Rate_modulation_experiments (millimolar)" legend_constants[10] = "Iso_1_uM in component Rate_modulation_experiments (dimensionless)" legend_algebraic[18] = "Nai in component Nai_concentration (millimolar)" legend_constants[11] = "Nao in component Ionic_values (millimolar)" legend_constants[12] = "Ki in component Ionic_values (millimolar)" legend_constants[13] = "Ko in component Ionic_values (millimolar)" legend_states[1] = "Ca_sub in component Ca_dynamics (millimolar)" legend_constants[14] = "Cao in component Ionic_values (millimolar)" legend_algebraic[36] = "E_Na in component Ionic_values (millivolt)" legend_constants[96] = "E_K in component Ionic_values (millivolt)" legend_algebraic[0] = "E_Ca in component Ionic_values (millivolt)" legend_constants[110] = "V_sub in component Cell_parameters (millimetre3)" legend_constants[112] = "V_i in component Cell_parameters (millimetre3)" legend_algebraic[49] = "i_fNa in component i_f (nanoA)" legend_algebraic[82] = "i_siNa in component i_CaL (nanoA)" legend_states[2] = "Nai_ in component Nai_concentration (millimolar)" legend_constants[15] = "Nai_clamp in component Nai_concentration (dimensionless)" legend_algebraic[55] = "i_fK in component i_f (nanoA)" legend_constants[16] = "g_f in component i_f (microS)" legend_constants[92] = "G_f in component i_f (microS)" legend_constants[103] = "g_f_Na in component i_f (microS)" legend_constants[100] = "G_f_Na in component i_f (microS)" legend_constants[101] = "g_f_K in component i_f (microS)" legend_constants[97] = "G_f_K in component i_f (microS)" legend_constants[17] = "Km_f in component i_f (millimolar)" legend_constants[18] = "alpha in component i_f (dimensionless)" legend_states[3] = "y in component i_f_y_gate (dimensionless)" legend_constants[19] = "blockade in component i_f (dimensionless)" legend_algebraic[10] = "tau_y in component i_f_y_gate (second)" legend_algebraic[29] = "y_infinity in component i_f_y_gate (dimensionless)" legend_constants[95] = "ACh_shift in component i_f_y_gate (millivolt)" legend_constants[99] = "Iso_shift in component i_f_y_gate (millivolt)" legend_constants[20] = "y_shift in component i_f_y_gate (millivolt)" legend_constants[21] = "Km_Kp in component i_NaK (millimolar)" legend_constants[22] = "Km_Nap in component i_NaK (millimolar)" legend_constants[23] = "i_NaK_max in component i_NaK (nanoA)" legend_constants[102] = "Iso_increase in component i_NaK (dimensionless)" legend_constants[24] = "K_NaCa in component i_NaCa (nanoA)" legend_algebraic[72] = "x1 in component i_NaCa (dimensionless)" legend_algebraic[68] = "x2 in component i_NaCa (dimensionless)" legend_algebraic[73] = "x3 in component i_NaCa (dimensionless)" legend_algebraic[74] = "x4 in component i_NaCa (dimensionless)" legend_algebraic[63] = "k41 in component i_NaCa (dimensionless)" legend_constants[104] = "k34 in component i_NaCa (dimensionless)" legend_algebraic[71] = "k23 in component i_NaCa (dimensionless)" legend_algebraic[70] = "k21 in component i_NaCa (dimensionless)" legend_algebraic[67] = "k32 in component i_NaCa (dimensionless)" legend_algebraic[62] = "k43 in component i_NaCa (dimensionless)" legend_algebraic[65] = "k12 in component i_NaCa (dimensionless)" legend_algebraic[66] = "k14 in component i_NaCa (dimensionless)" legend_constants[25] = "Qci in component i_NaCa (dimensionless)" legend_constants[26] = "Qn in component i_NaCa (dimensionless)" legend_constants[27] = "Qco in component i_NaCa (dimensionless)" legend_constants[28] = "K3ni in component i_NaCa (millimolar)" legend_constants[29] = "Kci in component i_NaCa (millimolar)" legend_constants[30] = "K1ni in component i_NaCa (millimolar)" legend_constants[31] = "K2ni in component i_NaCa (millimolar)" legend_constants[32] = "Kcni in component i_NaCa (millimolar)" legend_constants[33] = "K3no in component i_NaCa (millimolar)" legend_constants[34] = "K1no in component i_NaCa (millimolar)" legend_constants[35] = "K2no in component i_NaCa (millimolar)" legend_constants[36] = "Kco in component i_NaCa (millimolar)" legend_algebraic[69] = "do in component i_NaCa (dimensionless)" legend_algebraic[64] = "di in component i_NaCa (dimensionless)" legend_constants[37] = "blockade_NaCa in component i_NaCa (dimensionless)" legend_algebraic[77] = "i_Na_ in component i_Na (nanoA)" legend_algebraic[78] = "i_Na_L in component i_Na (nanoA)" legend_constants[38] = "g_Na in component i_Na (microS)" legend_constants[39] = "g_Na_L in component i_Na (microS)" legend_algebraic[76] = "E_mh in component i_Na (millivolt)" legend_states[4] = "m in component i_Na_m_gate (dimensionless)" legend_states[5] = "h in component i_Na_h_gate (dimensionless)" legend_algebraic[46] = "alpha_m in component i_Na_m_gate (per_second)" legend_algebraic[52] = "beta_m in component i_Na_m_gate (per_second)" legend_algebraic[11] = "m_infinity in component i_Na_m_gate (dimensionless)" legend_algebraic[57] = "tau_m in component i_Na_m_gate (second)" legend_constants[40] = "delta_m in component i_Na_m_gate (millivolt)" legend_algebraic[30] = "E0_m in component i_Na_m_gate (millivolt)" legend_algebraic[31] = "alpha_h in component i_Na_h_gate (per_second)" legend_algebraic[47] = "beta_h in component i_Na_h_gate (per_second)" legend_algebraic[12] = "h_infinity in component i_Na_h_gate (dimensionless)" legend_algebraic[53] = "tau_h in component i_Na_h_gate (second)" legend_algebraic[80] = "i_siCa in component i_CaL (nanoA)" legend_algebraic[81] = "i_siK in component i_CaL (nanoA)" legend_constants[106] = "ACh_block in component i_CaL (dimensionless)" legend_constants[41] = "P_CaL in component i_CaL (nanoA_per_millimolar)" legend_states[6] = "dL in component i_CaL_dL_gate (dimensionless)" legend_states[7] = "fL in component i_CaL_fL_gate (dimensionless)" legend_states[8] = "fCa in component i_CaL_fCa_gate (dimensionless)" legend_constants[105] = "Iso_increase in component i_CaL (dimensionless)" legend_algebraic[13] = "dL_infinity in component i_CaL_dL_gate (dimensionless)" legend_algebraic[60] = "tau_dL in component i_CaL_dL_gate (second)" legend_algebraic[48] = "alpha_dL in component i_CaL_dL_gate (per_second)" legend_algebraic[58] = "beta_dL in component i_CaL_dL_gate (per_second)" legend_algebraic[32] = "adVm in component i_CaL_dL_gate (millivolt)" legend_algebraic[54] = "bdVm in component i_CaL_dL_gate (millivolt)" legend_constants[42] = "k_dL in component i_CaL_dL_gate (millivolt)" legend_constants[43] = "V_dL in component i_CaL_dL_gate (millivolt)" legend_constants[107] = "Iso_shift_dL in component i_CaL_dL_gate (millivolt)" legend_constants[108] = "Iso_slope_dL in component i_CaL_dL_gate (dimensionless)" legend_algebraic[14] = "fL_infinity in component i_CaL_fL_gate (dimensionless)" legend_algebraic[33] = "tau_fL in component i_CaL_fL_gate (second)" legend_constants[44] = "shift_fL in component i_CaL_fL_gate (millivolt)" legend_constants[45] = "k_fL in component i_CaL_fL_gate (millivolt)" legend_constants[46] = "alpha_fCa in component i_CaL_fCa_gate (per_second)" legend_algebraic[1] = "fCa_infinity in component i_CaL_fCa_gate (dimensionless)" legend_algebraic[7] = "tau_fCa in component i_CaL_fCa_gate (second)" legend_constants[47] = "Km_fCa in component i_CaL_fCa_gate (millimolar)" legend_constants[48] = "P_CaT in component i_CaT (nanoA_per_millimolar)" legend_states[9] = "dT in component i_CaT_dT_gate (dimensionless)" legend_states[10] = "fT in component i_CaT_fT_gate (dimensionless)" legend_algebraic[15] = "dT_infinity in component i_CaT_dT_gate (dimensionless)" legend_algebraic[34] = "tau_dT in component i_CaT_dT_gate (second)" legend_algebraic[16] = "fT_infinity in component i_CaT_fT_gate (dimensionless)" legend_algebraic[35] = "tau_fT in component i_CaT_fT_gate (second)" legend_constants[49] = "offset_fT in component i_CaT_fT_gate (second)" legend_algebraic[86] = "j_SRCarel in component Ca_SR_release (millimolar_per_second)" legend_states[11] = "R in component Ca_SR_release (dimensionless)" legend_states[12] = "O in component Ca_SR_release (dimensionless)" legend_states[13] = "I in component Ca_SR_release (dimensionless)" legend_states[14] = "RI in component Ca_SR_release (dimensionless)" legend_constants[50] = "ks in component Ca_SR_release (per_second)" legend_constants[51] = "MaxSR in component Ca_SR_release (dimensionless)" legend_constants[52] = "MinSR in component Ca_SR_release (dimensionless)" legend_constants[53] = "EC50_SR in component Ca_SR_release (millimolar)" legend_constants[54] = "HSR in component Ca_SR_release (dimensionless)" legend_algebraic[8] = "koSRCa in component Ca_SR_release (per_millimolar2_second)" legend_algebraic[17] = "kiSRCa in component Ca_SR_release (per_millimolar_second)" legend_constants[55] = "koCa in component Ca_SR_release (per_millimolar2_second)" legend_constants[56] = "kiCa in component Ca_SR_release (per_millimolar_second)" legend_algebraic[2] = "kCaSR in component Ca_SR_release (dimensionless)" legend_constants[57] = "kim in component Ca_SR_release (per_second)" legend_constants[58] = "kom in component Ca_SR_release (per_second)" legend_states[15] = "Ca_jsr in component Ca_dynamics (millimolar)" legend_algebraic[3] = "diff in component Ca_SR_release (millimolar)" legend_algebraic[4] = "P_tot in component Ca_SR_release (dimensionless)" legend_algebraic[88] = "j_Ca_dif in component Ca_intracellular_fluxes (millimolar_per_second)" legend_algebraic[91] = "j_up in component Ca_intracellular_fluxes (millimolar_per_second)" legend_algebraic[94] = "j_tr in component Ca_intracellular_fluxes (millimolar_per_second)" legend_constants[59] = "tau_dif_Ca in component Ca_intracellular_fluxes (second)" legend_constants[60] = "tau_tr in component Ca_intracellular_fluxes (second)" legend_constants[98] = "P_up in component Ca_intracellular_fluxes (millimolar_per_second)" legend_constants[61] = "P_up_basal in component Ca_intracellular_fluxes (millimolar_per_second)" legend_constants[93] = "b_up in component Ca_intracellular_fluxes (dimensionless)" legend_constants[62] = "K_up in component Ca_intracellular_fluxes (millimolar)" legend_states[16] = "Ca_nsr in component Ca_dynamics (millimolar)" legend_states[17] = "Cai in component Ca_dynamics (millimolar)" legend_constants[63] = "slope_up in component Ca_intracellular_fluxes (millimolar)" legend_constants[64] = "TC_tot in component Ca_buffering (millimolar)" legend_constants[65] = "TMC_tot in component Ca_buffering (millimolar)" legend_constants[66] = "CM_tot in component Ca_buffering (millimolar)" legend_constants[67] = "CQ_tot in component Ca_buffering (millimolar)" legend_algebraic[93] = "delta_fTC in component Ca_buffering (per_second)" legend_algebraic[96] = "delta_fTMC in component Ca_buffering (per_second)" legend_algebraic[90] = "delta_fCMs in component Ca_buffering (per_second)" legend_algebraic[99] = "delta_fCMi in component Ca_buffering (per_second)" legend_algebraic[97] = "delta_fCQ in component Ca_buffering (per_second)" legend_algebraic[6] = "delta_fTMM in component Ca_buffering (per_second)" legend_states[18] = "fTMM in component Ca_buffering (dimensionless)" legend_states[19] = "fCMi in component Ca_buffering (dimensionless)" legend_states[20] = "fCMs in component Ca_buffering (dimensionless)" legend_states[21] = "fTC in component Ca_buffering (dimensionless)" legend_states[22] = "fTMC in component Ca_buffering (dimensionless)" legend_states[23] = "fCQ in component Ca_buffering (dimensionless)" legend_constants[68] = "kf_TC in component Ca_buffering (per_millimolar_second)" legend_constants[69] = "kf_TMM in component Ca_buffering (per_millimolar_second)" legend_constants[70] = "kf_TMC in component Ca_buffering (per_millimolar_second)" legend_constants[71] = "kf_CM in component Ca_buffering (per_millimolar_second)" legend_constants[72] = "kf_CQ in component Ca_buffering (per_millimolar_second)" legend_constants[73] = "kb_TC in component Ca_buffering (per_second)" legend_constants[74] = "kb_TMC in component Ca_buffering (per_second)" legend_constants[75] = "kb_TMM in component Ca_buffering (per_second)" legend_constants[76] = "kb_CM in component Ca_buffering (per_second)" legend_constants[77] = "kb_CQ in component Ca_buffering (per_second)" legend_constants[78] = "Mgi in component Ca_buffering (millimolar)" legend_constants[111] = "V_jsr in component Cell_parameters (millimetre3)" legend_constants[113] = "V_nsr in component Cell_parameters (millimetre3)" legend_constants[109] = "V_cell in component Cell_parameters (millimetre3)" legend_constants[79] = "V_jsr_part in component Cell_parameters (dimensionless)" legend_constants[80] = "V_i_part in component Cell_parameters (dimensionless)" legend_constants[81] = "V_nsr_part in component Cell_parameters (dimensionless)" legend_constants[82] = "R_cell in component Cell_parameters (micrometre)" legend_constants[83] = "L_cell in component Cell_parameters (micrometre)" legend_constants[84] = "L_sub in component Cell_parameters (micrometre)" legend_constants[85] = "g_Kur in component i_Kur (microS)" legend_states[24] = "r_Kur in component i_Kur_rKur_gate (dimensionless)" legend_states[25] = "s_Kur in component i_Kur_sKur_gate (dimensionless)" legend_algebraic[37] = "tau_r_Kur in component i_Kur_rKur_gate (second)" legend_algebraic[19] = "r_Kur_infinity in component i_Kur_rKur_gate (dimensionless)" legend_algebraic[38] = "tau_s_Kur in component i_Kur_sKur_gate (second)" legend_algebraic[20] = "s_Kur_infinity in component i_Kur_sKur_gate (dimensionless)" legend_constants[86] = "g_to in component i_to (microS)" legend_states[26] = "q in component i_to_q_gate (dimensionless)" legend_states[27] = "r in component i_to_r_gate (dimensionless)" legend_algebraic[21] = "q_infinity in component i_to_q_gate (dimensionless)" legend_algebraic[39] = "tau_q in component i_to_q_gate (second)" legend_algebraic[22] = "r_infinity in component i_to_r_gate (dimensionless)" legend_algebraic[40] = "tau_r in component i_to_r_gate (second)" legend_constants[87] = "g_Kr in component i_Kr (microS)" legend_states[28] = "paS in component i_Kr_pa_gate (dimensionless)" legend_states[29] = "paF in component i_Kr_pa_gate (dimensionless)" legend_states[30] = "piy in component i_Kr_pi_gate (dimensionless)" legend_algebraic[23] = "pa_infinity in component i_Kr_pa_gate (dimensionless)" legend_algebraic[24] = "alfapaF in component i_Kr_pa_gate (per_second)" legend_algebraic[25] = "betapaF in component i_Kr_pa_gate (per_second)" legend_algebraic[41] = "tau_paS in component i_Kr_pa_gate (second)" legend_algebraic[42] = "tau_paF in component i_Kr_pa_gate (second)" legend_algebraic[43] = "pi_infinity in component i_Kr_pi_gate (dimensionless)" legend_algebraic[26] = "tau_pi in component i_Kr_pi_gate (second)" legend_constants[94] = "g_Ks in component i_Ks (microS)" legend_constants[88] = "g_Ks_ in component i_Ks (microS)" legend_algebraic[92] = "E_Ks in component i_Ks (millivolt)" legend_states[31] = "n in component i_Ks_n_gate (dimensionless)" legend_algebraic[27] = "n_infinity in component i_Ks_n_gate (dimensionless)" legend_algebraic[56] = "tau_n in component i_Ks_n_gate (second)" legend_constants[114] = "Iso_shift in component i_Ks_n_gate (millivolt)" legend_algebraic[44] = "alpha_n in component i_Ks_n_gate (per_second)" legend_algebraic[50] = "beta_n in component i_Ks_n_gate (per_second)" legend_constants[89] = "g_KACh in component i_KACh (microS)" legend_states[32] = "a in component i_KACh_a_gate (dimensionless)" legend_constants[90] = "ACh_on in component i_KACh (dimensionless)" legend_constants[115] = "alpha_a in component i_KACh_a_gate (per_second)" legend_algebraic[28] = "beta_a in component i_KACh_a_gate (per_second)" legend_algebraic[45] = "a_infinity in component i_KACh_a_gate (dimensionless)" legend_algebraic[51] = "tau_a in component i_KACh_a_gate (second)" legend_rates[0] = "d/dt V_ode in component Membrane (millivolt)" legend_rates[2] = "d/dt Nai_ in component Nai_concentration (millimolar)" legend_rates[3] = "d/dt y in component i_f_y_gate (dimensionless)" legend_rates[4] = "d/dt m in component i_Na_m_gate (dimensionless)" legend_rates[5] = "d/dt h in component i_Na_h_gate (dimensionless)" legend_rates[6] = "d/dt dL in component i_CaL_dL_gate (dimensionless)" legend_rates[7] = "d/dt fL in component i_CaL_fL_gate (dimensionless)" legend_rates[8] = "d/dt fCa in component i_CaL_fCa_gate (dimensionless)" legend_rates[9] = "d/dt dT in component i_CaT_dT_gate (dimensionless)" legend_rates[10] = "d/dt fT in component i_CaT_fT_gate (dimensionless)" legend_rates[11] = "d/dt R in component Ca_SR_release (dimensionless)" legend_rates[12] = "d/dt O in component Ca_SR_release (dimensionless)" legend_rates[13] = "d/dt I in component Ca_SR_release (dimensionless)" legend_rates[14] = "d/dt RI in component Ca_SR_release (dimensionless)" legend_rates[21] = "d/dt fTC in component Ca_buffering (dimensionless)" legend_rates[22] = "d/dt fTMC in component Ca_buffering (dimensionless)" legend_rates[18] = "d/dt fTMM in component Ca_buffering (dimensionless)" legend_rates[19] = "d/dt fCMi in component Ca_buffering (dimensionless)" legend_rates[20] = "d/dt fCMs in component Ca_buffering (dimensionless)" legend_rates[23] = "d/dt fCQ in component Ca_buffering (dimensionless)" legend_rates[17] = "d/dt Cai in component Ca_dynamics (millimolar)" legend_rates[1] = "d/dt Ca_sub in component Ca_dynamics (millimolar)" legend_rates[16] = "d/dt Ca_nsr in component Ca_dynamics (millimolar)" legend_rates[15] = "d/dt Ca_jsr in component Ca_dynamics (millimolar)" legend_rates[24] = "d/dt r_Kur in component i_Kur_rKur_gate (dimensionless)" legend_rates[25] = "d/dt s_Kur in component i_Kur_sKur_gate (dimensionless)" legend_rates[26] = "d/dt q in component i_to_q_gate (dimensionless)" legend_rates[27] = "d/dt r in component i_to_r_gate (dimensionless)" legend_rates[28] = "d/dt paS in component i_Kr_pa_gate (dimensionless)" legend_rates[29] = "d/dt paF in component i_Kr_pa_gate (dimensionless)" legend_rates[30] = "d/dt piy in component i_Kr_pi_gate (dimensionless)" legend_rates[31] = "d/dt n in component i_Ks_n_gate (dimensionless)" legend_rates[32] = "d/dt a in component i_KACh_a_gate (dimensionless)" return (legend_states, legend_algebraic, legend_voi, legend_constants) def initConsts(): constants = [0.0] * sizeConstants; states = [0.0] * sizeStates; constants[0] = 8314.472 constants[1] = 310 constants[2] = 96485.3415 constants[3] = 5.7e-5 constants[4] = 0 states[0] = -47.787168 constants[5] = 0.5 constants[6] = 0.5 constants[7] = -35 constants[8] = -45 constants[9] = 0 constants[10] = 0 constants[11] = 140 constants[12] = 140 constants[13] = 5.4 states[1] = 6.226104e-5 constants[14] = 1.8 states[2] = 5 constants[15] = 1 constants[16] = 0.00427 constants[17] = 45 constants[18] = 0.5927 states[3] = 0.009508 constants[19] = 0 constants[20] = 0 constants[21] = 1.4 constants[22] = 14 constants[23] = 0.08105 constants[24] = 3.343 constants[25] = 0.1369 constants[26] = 0.4315 constants[27] = 0 constants[28] = 26.44 constants[29] = 0.0207 constants[30] = 395.3 constants[31] = 2.289 constants[32] = 26.44 constants[33] = 4.663 constants[34] = 1628 constants[35] = 561.4 constants[36] = 3.663 constants[37] = 0 constants[38] = 0.0223 constants[39] = 0 states[4] = 0.447724 states[5] = 0.003058 constants[40] = 1e-5 constants[41] = 0.4578 states[6] = 0.001921 states[7] = 0.846702 states[8] = 0.844449 constants[42] = 4.3371 constants[43] = -16.4508 constants[44] = 0 constants[45] = 0 constants[46] = 0.0075 constants[47] = 0.000338 constants[48] = 0.04132 states[9] = 0.268909 states[10] = 0.020484 constants[49] = 0 states[11] = 0.9308 states[12] = 6.181512e-9 states[13] = 4.595622e-10 states[14] = 0.069199 constants[50] = 148041085.1 constants[51] = 15 constants[52] = 1 constants[53] = 0.45 constants[54] = 2.5 constants[55] = 10000 constants[56] = 500 constants[57] = 5 constants[58] = 660 states[15] = 0.409551 constants[59] = 5.469e-5 constants[60] = 0.04 constants[61] = 5 constants[62] = 0.000286113 states[16] = 0.435148 states[17] = 9.15641e-6 constants[63] = 5e-5 constants[64] = 0.031 constants[65] = 0.062 constants[66] = 0.045 constants[67] = 10 states[18] = 0.653777 states[19] = 0.217311 states[20] = 0.158521 states[21] = 0.017929 states[22] = 0.259947 states[23] = 0.138975 constants[68] = 88800 constants[69] = 2277 constants[70] = 227700 constants[71] = 1.642e6 constants[72] = 175.4 constants[73] = 446 constants[74] = 7.51 constants[75] = 751 constants[76] = 542 constants[77] = 445 constants[78] = 2.5 constants[79] = 0.0012 constants[80] = 0.46 constants[81] = 0.0116 constants[82] = 3.9 constants[83] = 67 constants[84] = 0.02 constants[85] = 0.1539e-3 states[24] = 0.011845 states[25] = 0.845304 constants[86] = 3.5e-3 states[26] = 0.430836 states[27] = 0.014523 constants[87] = 0.00424 states[28] = 0.283185 states[29] = 0.011068 states[30] = 0.709051 constants[88] = 0.00065 states[31] = 0.1162 constants[89] = 0.00345 states[32] = 0.00277 constants[90] = 1 constants[91] = (constants[0]*constants[1])/constants[2] constants[92] = constants[16]/(constants[13]/(constants[13]+constants[17])) constants[93] = custom_piecewise([greater(constants[10] , 0.00000), -0.250000 , greater(constants[9] , 0.00000), (0.700000*constants[9])/(9.00000e-05+constants[9]) , True, 0.00000]) constants[94] = custom_piecewise([greater(constants[10] , 0.00000), 1.20000*constants[88] , True, constants[88]]) constants[95] = custom_piecewise([greater(constants[9] , 0.00000), -1.00000-(9.89800*(power(1.00000*constants[9], 0.618000)))/(power(1.00000*constants[9], 0.618000)+0.00122423) , True, 0.00000]) constants[96] = constants[91]*log(constants[13]/constants[12]) constants[97] = constants[92]/(constants[18]+1.00000) constants[98] = constants[61]*(1.00000-constants[93]) constants[99] = custom_piecewise([greater(constants[10] , 0.00000), 7.50000 , True, 0.00000]) constants[100] = constants[18]*constants[97] constants[101] = (constants[97]*constants[13])/(constants[13]+constants[17]) constants[102] = custom_piecewise([greater(constants[10] , 0.00000), 1.20000 , True, 1.00000]) constants[103] = (constants[100]*constants[13])/(constants[13]+constants[17]) constants[104] = constants[11]/(constants[33]+constants[11]) constants[105] = custom_piecewise([greater(constants[10] , 0.00000), 1.23000 , True, 1.00000]) constants[106] = (0.310000*constants[9])/(constants[9]+9.00000e-05) constants[107] = custom_piecewise([greater(constants[10] , 0.00000), -8.00000 , True, 0.00000]) constants[108] = custom_piecewise([greater(constants[10] , 0.00000), -27.0000 , True, 0.00000]) constants[109] = 1.00000e-09* pi*(power(constants[82], 2.00000))*constants[83] constants[110] = 1.00000e-09*2.00000* pi*constants[84]*(constants[82]-constants[84]/2.00000)*constants[83] constants[111] = constants[79]*constants[109] constants[112] = constants[80]*constants[109]-constants[110] constants[113] = constants[81]*constants[109] constants[114] = custom_piecewise([greater(constants[10] , 0.00000), -14.0000 , True, 0.00000]) constants[115] = (3.59880-0.0256410)/(1.00000+1.21550e-06/(power(1.00000*constants[9], 1.69510)))+0.0256410 return (states, constants) def computeRates(voi, states, constants): rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic algebraic[6] = constants[69]*constants[78]*(1.00000-(states[22]+states[18]))-constants[75]*states[18] rates[18] = algebraic[6] algebraic[1] = constants[47]/(constants[47]+states[1]) algebraic[7] = (0.00100000*algebraic[1])/constants[46] rates[8] = (algebraic[1]-states[8])/algebraic[7] algebraic[2] = constants[51]-(constants[51]-constants[52])/(1.00000+power(constants[53]/states[15], constants[54])) algebraic[8] = constants[55]/algebraic[2] algebraic[17] = constants[56]*algebraic[2] rates[11] = (constants[57]*states[14]-algebraic[17]*states[1]*states[11])-(algebraic[8]*(power(states[1], 2.00000))*states[11]-constants[58]*states[12]) rates[12] = (algebraic[8]*(power(states[1], 2.00000))*states[11]-constants[58]*states[12])-(algebraic[17]*states[1]*states[12]-constants[57]*states[13]) rates[13] = (algebraic[17]*states[1]*states[12]-constants[57]*states[13])-(constants[58]*states[13]-algebraic[8]*(power(states[1], 2.00000))*states[14]) rates[14] = (constants[58]*states[13]-algebraic[8]*(power(states[1], 2.00000))*states[14])-(constants[57]*states[14]-algebraic[17]*states[1]*states[11]) algebraic[5] = custom_piecewise([greater(voi , constants[5]) & less(voi , constants[5]+constants[6]), constants[7] , True, constants[8]]) algebraic[9] = custom_piecewise([greater_equal(constants[4] , 1.00000), algebraic[5] , True, states[0]]) algebraic[10] = 1.00000/((0.360000*(((algebraic[9]+148.800)-constants[95])-constants[99]))/(exp(0.0660000*(((algebraic[9]+148.800)-constants[95])-constants[99]))-1.00000)+(0.100000*(((algebraic[9]+87.3000)-constants[95])-constants[99]))/(1.00000-exp(-0.200000*(((algebraic[9]+87.3000)-constants[95])-constants[99]))))-0.0540000 algebraic[29] = custom_piecewise([less(algebraic[9] , -(((80.0000-constants[95])-constants[99])-constants[20])), 0.0132900+0.999210/(1.00000+exp(((((algebraic[9]+97.1340)-constants[95])-constants[99])-constants[20])/8.17520)) , True, 0.000250100*exp(-(((algebraic[9]-constants[95])-constants[99])-constants[20])/12.8610)]) rates[3] = (algebraic[29]-states[3])/algebraic[10] algebraic[14] = 1.00000/(1.00000+exp((algebraic[9]+37.4000+constants[44])/(5.30000+constants[45]))) algebraic[33] = 0.00100000*(44.3000+230.000*exp(-(power((algebraic[9]+36.0000)/10.0000, 2.00000)))) rates[7] = (algebraic[14]-states[7])/algebraic[33] algebraic[15] = 1.00000/(1.00000+exp(-(algebraic[9]+38.3000)/5.50000)) algebraic[34] = 0.00100000/(1.06800*exp((algebraic[9]+38.3000)/30.0000)+1.06800*exp(-(algebraic[9]+38.3000)/30.0000)) rates[9] = (algebraic[15]-states[9])/algebraic[34] algebraic[16] = 1.00000/(1.00000+exp((algebraic[9]+58.7000)/3.80000)) algebraic[35] = 1.00000/(16.6700*exp(-(algebraic[9]+75.0000)/83.3000)+16.6700*exp((algebraic[9]+75.0000)/15.3800))+constants[49] rates[10] = (algebraic[16]-states[10])/algebraic[35] algebraic[37] = 0.00900000/(1.00000+exp((algebraic[9]+5.00000)/12.0000))+0.000500000 algebraic[19] = 1.00000/(1.00000+exp((algebraic[9]+6.00000)/-8.60000)) rates[24] = (algebraic[19]-states[24])/algebraic[37] algebraic[38] = 0.590000/(1.00000+exp((algebraic[9]+60.0000)/10.0000))+3.05000 algebraic[20] = 1.00000/(1.00000+exp((algebraic[9]+7.50000)/10.0000)) rates[25] = (algebraic[20]-states[25])/algebraic[38] algebraic[21] = 1.00000/(1.00000+exp((algebraic[9]+49.0000)/13.0000)) algebraic[39] = 0.00100000*0.600000*(65.1700/(0.570000*exp(-0.0800000*(algebraic[9]+44.0000))+0.0650000*exp(0.100000*(algebraic[9]+45.9300)))+10.1000) rates[26] = (algebraic[21]-states[26])/algebraic[39] algebraic[22] = 1.00000/(1.00000+exp(-(algebraic[9]-19.3000)/15.0000)) algebraic[40] = 0.00100000*0.660000*1.40000*(15.5900/(1.03700*exp(0.0900000*(algebraic[9]+30.6100))+0.369000*exp(-0.120000*(algebraic[9]+23.8400)))+2.98000) rates[27] = (algebraic[22]-states[27])/algebraic[40] algebraic[23] = 1.00000/(1.00000+exp(-(algebraic[9]+10.0144)/7.66070)) algebraic[41] = 0.846554/(4.20000*exp(algebraic[9]/17.0000)+0.150000*exp(-algebraic[9]/21.6000)) rates[28] = (algebraic[23]-states[28])/algebraic[41] algebraic[42] = 1.00000/(30.0000*exp(algebraic[9]/10.0000)+exp(-algebraic[9]/12.0000)) rates[29] = (algebraic[23]-states[29])/algebraic[42] algebraic[43] = 1.00000/(1.00000+exp((algebraic[9]+28.6000)/17.1000)) algebraic[26] = 1.00000/(100.000*exp(-algebraic[9]/54.6450)+656.000*exp(algebraic[9]/106.157)) rates[30] = (algebraic[43]-states[30])/algebraic[26] algebraic[28] = 10.0000*exp(0.0133000*(algebraic[9]+40.0000)) algebraic[45] = constants[115]/(constants[115]+algebraic[28]) algebraic[51] = 1.00000/(constants[115]+algebraic[28]) rates[32] = (algebraic[45]-states[32])/algebraic[51] algebraic[12] = 1.00000/(1.00000+exp((algebraic[9]+69.8040)/4.45650)) algebraic[31] = 20.0000*exp(-0.125000*(algebraic[9]+75.0000)) algebraic[47] = 2000.00/(320.000*exp(-0.100000*(algebraic[9]+75.0000))+1.00000) algebraic[53] = 1.00000/(algebraic[31]+algebraic[47]) rates[5] = (algebraic[12]-states[5])/algebraic[53] algebraic[27] = power(1.00000/(1.00000+exp(-((algebraic[9]+0.638300)-constants[114])/10.7071)), 1.0/2) algebraic[44] = 28.0000/(1.00000+exp(-((algebraic[9]-40.0000)-constants[114])/3.00000)) algebraic[50] = 1.00000*exp(-((algebraic[9]-constants[114])-5.00000)/25.0000) algebraic[56] = 1.00000/(algebraic[44]+algebraic[50]) rates[31] = (algebraic[27]-states[31])/algebraic[56] algebraic[11] = 1.00000/(1.00000+exp(-(algebraic[9]+42.0504)/8.31060)) algebraic[30] = algebraic[9]+41.0000 algebraic[46] = custom_piecewise([less(fabs(algebraic[30]) , constants[40]), 2000.00 , True, (200.000*algebraic[30])/(1.00000-exp(-0.100000*algebraic[30]))]) algebraic[52] = 8000.00*exp(-0.0560000*(algebraic[9]+66.0000)) algebraic[57] = 1.00000/(algebraic[46]+algebraic[52]) rates[4] = (algebraic[11]-states[4])/algebraic[57] algebraic[13] = 1.00000/(1.00000+exp(-((algebraic[9]-constants[43])-constants[107])/(constants[42]*(1.00000+constants[108]/100.000)))) algebraic[32] = custom_piecewise([equal(algebraic[9] , -41.8000), -41.8000 , equal(algebraic[9] , 0.00000), 0.00000 , equal(algebraic[9] , -6.80000), -6.80001 , True, algebraic[9]]) algebraic[48] = (-0.0283900*(algebraic[32]+41.8000))/(exp(-(algebraic[32]+41.8000)/2.50000)-1.00000)-(0.0849000*(algebraic[32]+6.80000))/(exp(-(algebraic[32]+6.80000)/4.80000)-1.00000) algebraic[54] = custom_piecewise([equal(algebraic[9] , -1.80000), -1.80001 , True, algebraic[9]]) algebraic[58] = (0.0114300*(algebraic[54]+1.80000))/(exp((algebraic[54]+1.80000)/2.50000)-1.00000) algebraic[60] = 0.00100000/(algebraic[48]+algebraic[58]) rates[6] = (algebraic[13]-states[6])/algebraic[60] algebraic[18] = states[2] algebraic[36] = constants[91]*log(constants[11]/algebraic[18]) algebraic[61] = constants[102]*constants[23]*(power(1.00000+power(constants[21]/constants[13], 1.20000), -1.00000))*(power(1.00000+power(constants[22]/algebraic[18], 1.30000), -1.00000))*(power(1.00000+exp(-((algebraic[9]-algebraic[36])+110.000)/20.0000), -1.00000)) algebraic[63] = exp((-constants[26]*algebraic[9])/(2.00000*constants[91])) algebraic[69] = 1.00000+(constants[14]/constants[36])*(1.00000+exp((constants[27]*algebraic[9])/constants[91]))+(constants[11]/constants[34])*(1.00000+(constants[11]/constants[35])*(1.00000+constants[11]/constants[33])) algebraic[71] = ((((constants[11]/constants[34])*constants[11])/constants[35])*(1.00000+constants[11]/constants[33])*exp((-constants[26]*algebraic[9])/(2.00000*constants[91])))/algebraic[69] algebraic[70] = ((constants[14]/constants[36])*exp((constants[27]*algebraic[9])/constants[91]))/algebraic[69] algebraic[67] = exp((constants[26]*algebraic[9])/(2.00000*constants[91])) algebraic[62] = algebraic[18]/(constants[28]+algebraic[18]) algebraic[72] = algebraic[63]*constants[104]*(algebraic[71]+algebraic[70])+algebraic[70]*algebraic[67]*(algebraic[62]+algebraic[63]) algebraic[64] = 1.00000+(states[1]/constants[29])*(1.00000+exp((-constants[25]*algebraic[9])/constants[91])+algebraic[18]/constants[32])+(algebraic[18]/constants[30])*(1.00000+(algebraic[18]/constants[31])*(1.00000+algebraic[18]/constants[28])) algebraic[65] = ((states[1]/constants[29])*exp((-constants[25]*algebraic[9])/constants[91]))/algebraic[64] algebraic[66] = ((((algebraic[18]/constants[30])*algebraic[18])/constants[31])*(1.00000+algebraic[18]/constants[28])*exp((constants[26]*algebraic[9])/(2.00000*constants[91])))/algebraic[64] algebraic[68] = algebraic[67]*algebraic[62]*(algebraic[66]+algebraic[65])+algebraic[63]*algebraic[65]*(constants[104]+algebraic[67]) algebraic[73] = algebraic[66]*algebraic[62]*(algebraic[71]+algebraic[70])+algebraic[65]*algebraic[71]*(algebraic[62]+algebraic[63]) algebraic[74] = algebraic[71]*constants[104]*(algebraic[66]+algebraic[65])+algebraic[66]*algebraic[70]*(constants[104]+algebraic[67]) algebraic[75] = ((1.00000-constants[37])*constants[24]*(algebraic[68]*algebraic[70]-algebraic[72]*algebraic[65]))/(algebraic[72]+algebraic[68]+algebraic[73]+algebraic[74]) algebraic[76] = constants[91]*log((constants[11]+0.120000*constants[13])/(algebraic[18]+0.120000*constants[12])) algebraic[77] = constants[38]*(power(states[4], 3.00000))*states[5]*(algebraic[9]-algebraic[76]) algebraic[78] = constants[39]*(power(states[4], 3.00000))*(algebraic[9]-algebraic[76]) algebraic[79] = algebraic[77]+algebraic[78] algebraic[49] = states[3]*constants[103]*(algebraic[9]-algebraic[36])*(1.00000-constants[19]) algebraic[82] = ((1.85000e-05*constants[41]*(algebraic[9]-0.00000))/(constants[91]*(1.00000-exp((-1.00000*(algebraic[9]-0.00000))/constants[91]))))*(algebraic[18]-constants[11]*exp((-1.00000*(algebraic[9]-0.00000))/constants[91]))*states[6]*states[7]*states[8] rates[2] = ((1.00000-constants[15])*-1.00000*(algebraic[79]+algebraic[49]+algebraic[82]+3.00000*algebraic[61]+3.00000*algebraic[75]))/(1.00000*(constants[112]+constants[110])*constants[2]) algebraic[90] = constants[71]*states[1]*(1.00000-states[20])-constants[76]*states[20] rates[20] = algebraic[90] algebraic[84] = ((2.00000*constants[48]*algebraic[9])/(constants[91]*(1.00000-exp((-1.00000*algebraic[9]*2.00000)/constants[91]))))*(states[1]-constants[14]*exp((-2.00000*algebraic[9])/constants[91]))*states[9]*states[10] algebraic[80] = ((2.00000*constants[41]*(algebraic[9]-0.00000))/(constants[91]*(1.00000-exp((-1.00000*(algebraic[9]-0.00000)*2.00000)/constants[91]))))*(states[1]-constants[14]*exp((-2.00000*(algebraic[9]-0.00000))/constants[91]))*states[6]*states[7]*states[8] algebraic[86] = constants[50]*states[12]*(states[15]-states[1]) algebraic[88] = (states[1]-states[17])/constants[59] rates[1] = (algebraic[86]*constants[111])/constants[110]-(((algebraic[80]+algebraic[84])-2.00000*algebraic[75])/(2.00000*constants[2]*constants[110])+algebraic[88]+constants[66]*algebraic[90]) algebraic[93] = constants[68]*states[17]*(1.00000-states[21])-constants[73]*states[21] rates[21] = algebraic[93] algebraic[91] = constants[98]/(1.00000+exp((-states[17]+constants[62])/constants[63])) algebraic[94] = (states[16]-states[15])/constants[60] rates[16] = algebraic[91]-(algebraic[94]*constants[111])/constants[113] algebraic[96] = constants[70]*states[17]*(1.00000-(states[22]+states[18]))-constants[74]*states[22] rates[22] = algebraic[96] algebraic[97] = constants[72]*states[15]*(1.00000-states[23])-constants[77]*states[23] rates[23] = algebraic[97] rates[15] = algebraic[94]-(algebraic[86]+constants[67]*algebraic[97]) algebraic[99] = constants[71]*states[17]*(1.00000-states[19])-constants[76]*states[19] rates[19] = algebraic[99] rates[17] = (1.00000*(algebraic[88]*constants[110]-algebraic[91]*constants[113]))/constants[112]-(constants[66]*algebraic[99]+constants[64]*algebraic[93]+constants[65]*algebraic[96]) algebraic[55] = states[3]*constants[101]*(algebraic[9]-constants[96])*(1.00000-constants[19]) algebraic[59] = algebraic[49]+algebraic[55] algebraic[89] = constants[87]*(algebraic[9]-constants[96])*(0.900000*states[29]+0.100000*states[28])*states[30] algebraic[92] = constants[91]*log((constants[13]+0.120000*constants[11])/(constants[12]+0.120000*algebraic[18])) algebraic[95] = constants[94]*(algebraic[9]-algebraic[92])*(power(states[31], 2.00000)) algebraic[87] = constants[86]*(algebraic[9]-constants[96])*states[26]*states[27] algebraic[81] = ((0.000365000*constants[41]*(algebraic[9]-0.00000))/(constants[91]*(1.00000-exp((-1.00000*(algebraic[9]-0.00000))/constants[91]))))*(constants[12]-constants[13]*exp((-1.00000*(algebraic[9]-0.00000))/constants[91]))*states[6]*states[7]*states[8] algebraic[83] = (algebraic[80]+algebraic[81]+algebraic[82])*(1.00000-constants[106])*1.00000*constants[105] algebraic[98] = custom_piecewise([greater(constants[9] , 0.00000), constants[90]*constants[89]*(algebraic[9]-constants[96])*(1.00000+exp((algebraic[9]+20.0000)/20.0000))*states[32] , True, 0.00000]) algebraic[85] = constants[85]*states[24]*states[25]*(algebraic[9]-constants[96]) algebraic[100] = algebraic[59]+algebraic[89]+algebraic[95]+algebraic[87]+algebraic[61]+algebraic[75]+algebraic[79]+algebraic[83]+algebraic[84]+algebraic[98]+algebraic[85] rates[0] = -algebraic[100]/constants[3] return(rates) def computeAlgebraic(constants, states, voi): algebraic = array([[0.0] * len(voi)] * sizeAlgebraic) states = array(states) voi = array(voi) algebraic[6] = constants[69]*constants[78]*(1.00000-(states[22]+states[18]))-constants[75]*states[18] algebraic[1] = constants[47]/(constants[47]+states[1]) algebraic[7] = (0.00100000*algebraic[1])/constants[46] algebraic[2] = constants[51]-(constants[51]-constants[52])/(1.00000+power(constants[53]/states[15], constants[54])) algebraic[8] = constants[55]/algebraic[2] algebraic[17] = constants[56]*algebraic[2] algebraic[5] = custom_piecewise([greater(voi , constants[5]) & less(voi , constants[5]+constants[6]), constants[7] , True, constants[8]]) algebraic[9] = custom_piecewise([greater_equal(constants[4] , 1.00000), algebraic[5] , True, states[0]]) algebraic[10] = 1.00000/((0.360000*(((algebraic[9]+148.800)-constants[95])-constants[99]))/(exp(0.0660000*(((algebraic[9]+148.800)-constants[95])-constants[99]))-1.00000)+(0.100000*(((algebraic[9]+87.3000)-constants[95])-constants[99]))/(1.00000-exp(-0.200000*(((algebraic[9]+87.3000)-constants[95])-constants[99]))))-0.0540000 algebraic[29] = custom_piecewise([less(algebraic[9] , -(((80.0000-constants[95])-constants[99])-constants[20])), 0.0132900+0.999210/(1.00000+exp(((((algebraic[9]+97.1340)-constants[95])-constants[99])-constants[20])/8.17520)) , True, 0.000250100*exp(-(((algebraic[9]-constants[95])-constants[99])-constants[20])/12.8610)]) algebraic[14] = 1.00000/(1.00000+exp((algebraic[9]+37.4000+constants[44])/(5.30000+constants[45]))) algebraic[33] = 0.00100000*(44.3000+230.000*exp(-(power((algebraic[9]+36.0000)/10.0000, 2.00000)))) algebraic[15] = 1.00000/(1.00000+exp(-(algebraic[9]+38.3000)/5.50000)) algebraic[34] = 0.00100000/(1.06800*exp((algebraic[9]+38.3000)/30.0000)+1.06800*exp(-(algebraic[9]+38.3000)/30.0000)) algebraic[16] = 1.00000/(1.00000+exp((algebraic[9]+58.7000)/3.80000)) algebraic[35] = 1.00000/(16.6700*exp(-(algebraic[9]+75.0000)/83.3000)+16.6700*exp((algebraic[9]+75.0000)/15.3800))+constants[49] algebraic[37] = 0.00900000/(1.00000+exp((algebraic[9]+5.00000)/12.0000))+0.000500000 algebraic[19] = 1.00000/(1.00000+exp((algebraic[9]+6.00000)/-8.60000)) algebraic[38] = 0.590000/(1.00000+exp((algebraic[9]+60.0000)/10.0000))+3.05000 algebraic[20] = 1.00000/(1.00000+exp((algebraic[9]+7.50000)/10.0000)) algebraic[21] = 1.00000/(1.00000+exp((algebraic[9]+49.0000)/13.0000)) algebraic[39] = 0.00100000*0.600000*(65.1700/(0.570000*exp(-0.0800000*(algebraic[9]+44.0000))+0.0650000*exp(0.100000*(algebraic[9]+45.9300)))+10.1000) algebraic[22] = 1.00000/(1.00000+exp(-(algebraic[9]-19.3000)/15.0000)) algebraic[40] = 0.00100000*0.660000*1.40000*(15.5900/(1.03700*exp(0.0900000*(algebraic[9]+30.6100))+0.369000*exp(-0.120000*(algebraic[9]+23.8400)))+2.98000) algebraic[23] = 1.00000/(1.00000+exp(-(algebraic[9]+10.0144)/7.66070)) algebraic[41] = 0.846554/(4.20000*exp(algebraic[9]/17.0000)+0.150000*exp(-algebraic[9]/21.6000)) algebraic[42] = 1.00000/(30.0000*exp(algebraic[9]/10.0000)+exp(-algebraic[9]/12.0000)) algebraic[43] = 1.00000/(1.00000+exp((algebraic[9]+28.6000)/17.1000)) algebraic[26] = 1.00000/(100.000*exp(-algebraic[9]/54.6450)+656.000*exp(algebraic[9]/106.157)) algebraic[28] = 10.0000*exp(0.0133000*(algebraic[9]+40.0000)) algebraic[45] = constants[115]/(constants[115]+algebraic[28]) algebraic[51] = 1.00000/(constants[115]+algebraic[28]) algebraic[12] = 1.00000/(1.00000+exp((algebraic[9]+69.8040)/4.45650)) algebraic[31] = 20.0000*exp(-0.125000*(algebraic[9]+75.0000)) algebraic[47] = 2000.00/(320.000*exp(-0.100000*(algebraic[9]+75.0000))+1.00000) algebraic[53] = 1.00000/(algebraic[31]+algebraic[47]) algebraic[27] = power(1.00000/(1.00000+exp(-((algebraic[9]+0.638300)-constants[114])/10.7071)), 1.0/2) algebraic[44] = 28.0000/(1.00000+exp(-((algebraic[9]-40.0000)-constants[114])/3.00000)) algebraic[50] = 1.00000*exp(-((algebraic[9]-constants[114])-5.00000)/25.0000) algebraic[56] = 1.00000/(algebraic[44]+algebraic[50]) algebraic[11] = 1.00000/(1.00000+exp(-(algebraic[9]+42.0504)/8.31060)) algebraic[30] = algebraic[9]+41.0000 algebraic[46] = custom_piecewise([less(fabs(algebraic[30]) , constants[40]), 2000.00 , True, (200.000*algebraic[30])/(1.00000-exp(-0.100000*algebraic[30]))]) algebraic[52] = 8000.00*exp(-0.0560000*(algebraic[9]+66.0000)) algebraic[57] = 1.00000/(algebraic[46]+algebraic[52]) algebraic[13] = 1.00000/(1.00000+exp(-((algebraic[9]-constants[43])-constants[107])/(constants[42]*(1.00000+constants[108]/100.000)))) algebraic[32] = custom_piecewise([equal(algebraic[9] , -41.8000), -41.8000 , equal(algebraic[9] , 0.00000), 0.00000 , equal(algebraic[9] , -6.80000), -6.80001 , True, algebraic[9]]) algebraic[48] = (-0.0283900*(algebraic[32]+41.8000))/(exp(-(algebraic[32]+41.8000)/2.50000)-1.00000)-(0.0849000*(algebraic[32]+6.80000))/(exp(-(algebraic[32]+6.80000)/4.80000)-1.00000) algebraic[54] = custom_piecewise([equal(algebraic[9] , -1.80000), -1.80001 , True, algebraic[9]]) algebraic[58] = (0.0114300*(algebraic[54]+1.80000))/(exp((algebraic[54]+1.80000)/2.50000)-1.00000) algebraic[60] = 0.00100000/(algebraic[48]+algebraic[58]) algebraic[18] = states[2] algebraic[36] = constants[91]*log(constants[11]/algebraic[18]) algebraic[61] = constants[102]*constants[23]*(power(1.00000+power(constants[21]/constants[13], 1.20000), -1.00000))*(power(1.00000+power(constants[22]/algebraic[18], 1.30000), -1.00000))*(power(1.00000+exp(-((algebraic[9]-algebraic[36])+110.000)/20.0000), -1.00000)) algebraic[63] = exp((-constants[26]*algebraic[9])/(2.00000*constants[91])) algebraic[69] = 1.00000+(constants[14]/constants[36])*(1.00000+exp((constants[27]*algebraic[9])/constants[91]))+(constants[11]/constants[34])*(1.00000+(constants[11]/constants[35])*(1.00000+constants[11]/constants[33])) algebraic[71] = ((((constants[11]/constants[34])*constants[11])/constants[35])*(1.00000+constants[11]/constants[33])*exp((-constants[26]*algebraic[9])/(2.00000*constants[91])))/algebraic[69] algebraic[70] = ((constants[14]/constants[36])*exp((constants[27]*algebraic[9])/constants[91]))/algebraic[69] algebraic[67] = exp((constants[26]*algebraic[9])/(2.00000*constants[91])) algebraic[62] = algebraic[18]/(constants[28]+algebraic[18]) algebraic[72] = algebraic[63]*constants[104]*(algebraic[71]+algebraic[70])+algebraic[70]*algebraic[67]*(algebraic[62]+algebraic[63]) algebraic[64] = 1.00000+(states[1]/constants[29])*(1.00000+exp((-constants[25]*algebraic[9])/constants[91])+algebraic[18]/constants[32])+(algebraic[18]/constants[30])*(1.00000+(algebraic[18]/constants[31])*(1.00000+algebraic[18]/constants[28])) algebraic[65] = ((states[1]/constants[29])*exp((-constants[25]*algebraic[9])/constants[91]))/algebraic[64] algebraic[66] = ((((algebraic[18]/constants[30])*algebraic[18])/constants[31])*(1.00000+algebraic[18]/constants[28])*exp((constants[26]*algebraic[9])/(2.00000*constants[91])))/algebraic[64] algebraic[68] = algebraic[67]*algebraic[62]*(algebraic[66]+algebraic[65])+algebraic[63]*algebraic[65]*(constants[104]+algebraic[67]) algebraic[73] = algebraic[66]*algebraic[62]*(algebraic[71]+algebraic[70])+algebraic[65]*algebraic[71]*(algebraic[62]+algebraic[63]) algebraic[74] = algebraic[71]*constants[104]*(algebraic[66]+algebraic[65])+algebraic[66]*algebraic[70]*(constants[104]+algebraic[67]) algebraic[75] = ((1.00000-constants[37])*constants[24]*(algebraic[68]*algebraic[70]-algebraic[72]*algebraic[65]))/(algebraic[72]+algebraic[68]+algebraic[73]+algebraic[74]) algebraic[76] = constants[91]*log((constants[11]+0.120000*constants[13])/(algebraic[18]+0.120000*constants[12])) algebraic[77] = constants[38]*(power(states[4], 3.00000))*states[5]*(algebraic[9]-algebraic[76]) algebraic[78] = constants[39]*(power(states[4], 3.00000))*(algebraic[9]-algebraic[76]) algebraic[79] = algebraic[77]+algebraic[78] algebraic[49] = states[3]*constants[103]*(algebraic[9]-algebraic[36])*(1.00000-constants[19]) algebraic[82] = ((1.85000e-05*constants[41]*(algebraic[9]-0.00000))/(constants[91]*(1.00000-exp((-1.00000*(algebraic[9]-0.00000))/constants[91]))))*(algebraic[18]-constants[11]*exp((-1.00000*(algebraic[9]-0.00000))/constants[91]))*states[6]*states[7]*states[8] algebraic[90] = constants[71]*states[1]*(1.00000-states[20])-constants[76]*states[20] algebraic[84] = ((2.00000*constants[48]*algebraic[9])/(constants[91]*(1.00000-exp((-1.00000*algebraic[9]*2.00000)/constants[91]))))*(states[1]-constants[14]*exp((-2.00000*algebraic[9])/constants[91]))*states[9]*states[10] algebraic[80] = ((2.00000*constants[41]*(algebraic[9]-0.00000))/(constants[91]*(1.00000-exp((-1.00000*(algebraic[9]-0.00000)*2.00000)/constants[91]))))*(states[1]-constants[14]*exp((-2.00000*(algebraic[9]-0.00000))/constants[91]))*states[6]*states[7]*states[8] algebraic[86] = constants[50]*states[12]*(states[15]-states[1]) algebraic[88] = (states[1]-states[17])/constants[59] algebraic[93] = constants[68]*states[17]*(1.00000-states[21])-constants[73]*states[21] algebraic[91] = constants[98]/(1.00000+exp((-states[17]+constants[62])/constants[63])) algebraic[94] = (states[16]-states[15])/constants[60] algebraic[96] = constants[70]*states[17]*(1.00000-(states[22]+states[18]))-constants[74]*states[22] algebraic[97] = constants[72]*states[15]*(1.00000-states[23])-constants[77]*states[23] algebraic[99] = constants[71]*states[17]*(1.00000-states[19])-constants[76]*states[19] algebraic[55] = states[3]*constants[101]*(algebraic[9]-constants[96])*(1.00000-constants[19]) algebraic[59] = algebraic[49]+algebraic[55] algebraic[89] = constants[87]*(algebraic[9]-constants[96])*(0.900000*states[29]+0.100000*states[28])*states[30] algebraic[92] = constants[91]*log((constants[13]+0.120000*constants[11])/(constants[12]+0.120000*algebraic[18])) algebraic[95] = constants[94]*(algebraic[9]-algebraic[92])*(power(states[31], 2.00000)) algebraic[87] = constants[86]*(algebraic[9]-constants[96])*states[26]*states[27] algebraic[81] = ((0.000365000*constants[41]*(algebraic[9]-0.00000))/(constants[91]*(1.00000-exp((-1.00000*(algebraic[9]-0.00000))/constants[91]))))*(constants[12]-constants[13]*exp((-1.00000*(algebraic[9]-0.00000))/constants[91]))*states[6]*states[7]*states[8] algebraic[83] = (algebraic[80]+algebraic[81]+algebraic[82])*(1.00000-constants[106])*1.00000*constants[105] algebraic[98] = custom_piecewise([greater(constants[9] , 0.00000), constants[90]*constants[89]*(algebraic[9]-constants[96])*(1.00000+exp((algebraic[9]+20.0000)/20.0000))*states[32] , True, 0.00000]) algebraic[85] = constants[85]*states[24]*states[25]*(algebraic[9]-constants[96]) algebraic[100] = algebraic[59]+algebraic[89]+algebraic[95]+algebraic[87]+algebraic[61]+algebraic[75]+algebraic[79]+algebraic[83]+algebraic[84]+algebraic[98]+algebraic[85] algebraic[0] = 0.500000*constants[91]*log(constants[14]/states[1]) algebraic[3] = states[15]-states[1] algebraic[4] = states[11]+states[12]+states[13]+states[14] algebraic[24] = (1.00000/(1.00000+exp(-(algebraic[9]+23.2000)/6.60000)))/(0.846554/(37.2000*exp(algebraic[9]/11.9000)+0.960000*exp(-algebraic[9]/18.5000))) algebraic[25] = 4.00000*((37.2000*exp(algebraic[9]/15.9000)+0.960000*exp(-algebraic[9]/22.5000))/0.846554-(1.00000/(1.00000+exp(-(algebraic[9]+23.2000)/10.6000)))/(0.846554/(37.2000*exp(algebraic[9]/15.9000)+0.960000*exp(-algebraic[9]/22.5000)))) 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)