# Size of variable arrays: sizeAlgebraic = 117 sizeStates = 48 sizeConstants = 95 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 (ms)" legend_constants[0] = "F in component model_parameters (C_per_mole)" legend_constants[1] = "T in component model_parameters (kelvin)" legend_constants[2] = "R in component model_parameters (J_per_kmole_K)" legend_constants[3] = "K_o in component model_parameters (mM)" legend_constants[4] = "Ca_o in component model_parameters (mM)" legend_constants[5] = "Na_o in component model_parameters (mM)" legend_constants[6] = "Cl_o in component model_parameters (mM)" legend_constants[89] = "Vmyo in component cell_geometry (uL)" legend_constants[90] = "Vnsr in component cell_geometry (uL)" legend_constants[85] = "Vsr in component cell_geometry (uL)" legend_constants[91] = "Vjsr in component cell_geometry (uL)" legend_constants[92] = "Vss_sr in component cell_geometry (uL)" legend_constants[93] = "Vss_CaL in component cell_geometry (uL)" legend_constants[87] = "Acap in component cell_geometry (cm2)" legend_constants[88] = "AF in component cell_geometry (uF_mole_per_C)" legend_constants[7] = "l in component cell_geometry (cm)" legend_constants[8] = "a in component cell_geometry (cm)" legend_constants[82] = "vcell in component cell_geometry (uL)" legend_constants[86] = "ageo in component cell_geometry (cm2)" legend_states[0] = "Vm in component membrane (mV)" legend_algebraic[13] = "i_Stim in component membrane (uA_per_uF)" legend_constants[9] = "stim_offset in component membrane (ms)" legend_constants[10] = "stim_period in component membrane (ms)" legend_constants[11] = "stim_duration in component membrane (ms)" legend_constants[12] = "stim_amplitude in component membrane (uA_per_uF)" legend_algebraic[0] = "past in component membrane (ms)" legend_algebraic[70] = "caiont in component membrane (uA_per_uF)" legend_algebraic[87] = "naiont in component membrane (uA_per_uF)" legend_algebraic[111] = "kiont in component membrane (uA_per_uF)" legend_algebraic[115] = "clont in component membrane (uA_per_uF)" legend_algebraic[80] = "INa in component INa (uA_per_uF)" legend_algebraic[37] = "ICaL in component ICaL (uA_per_uF)" legend_algebraic[103] = "IK1 in component IK1 (uA_per_uF)" legend_algebraic[93] = "IKp in component IKp (uA_per_uF)" legend_algebraic[97] = "IKs in component IKs (uA_per_uF)" legend_algebraic[108] = "IKr in component IKr (uA_per_uF)" legend_algebraic[68] = "IpCa in component IpCa (uA_per_uF)" legend_algebraic[69] = "ICab in component ICab (uA_per_uF)" legend_algebraic[65] = "INaCa in component INaCa (uA_per_uF)" legend_algebraic[66] = "INaCa_ss_sr in component INaCa (uA_per_uF)" legend_algebraic[48] = "INaK in component INaK (uA_per_uF)" legend_algebraic[110] = "Ito1 in component Ito1 (uA_per_uF)" legend_algebraic[114] = "Ito2 in component Ito2 (uA_per_uF)" legend_algebraic[99] = "IClb in component IClb (uA_per_uF)" legend_algebraic[84] = "INaL in component INaL (uA_per_uF)" legend_algebraic[74] = "INab in component INab (uA_per_uF)" legend_algebraic[25] = "gKs in component IKs (mS_per_uF)" legend_states[1] = "C1 in component IKs (dimensionless)" legend_states[2] = "C2 in component IKs (dimensionless)" legend_states[3] = "C3 in component IKs (dimensionless)" legend_states[4] = "C4 in component IKs (dimensionless)" legend_states[5] = "C5 in component IKs (dimensionless)" legend_states[6] = "C6 in component IKs (dimensionless)" legend_states[7] = "C7 in component IKs (dimensionless)" legend_states[8] = "C8 in component IKs (dimensionless)" legend_states[9] = "C9 in component IKs (dimensionless)" legend_states[10] = "C10 in component IKs (dimensionless)" legend_states[11] = "C11 in component IKs (dimensionless)" legend_states[12] = "C12 in component IKs (dimensionless)" legend_states[13] = "C13 in component IKs (dimensionless)" legend_states[14] = "C14 in component IKs (dimensionless)" legend_states[15] = "C15 in component IKs (dimensionless)" legend_states[16] = "O1 in component IKs (dimensionless)" legend_states[17] = "O2 in component IKs (dimensionless)" legend_algebraic[30] = "OKs in component IKs (dimensionless)" legend_algebraic[1] = "alpha in component IKs (per_ms)" legend_algebraic[14] = "beta in component IKs (per_ms)" legend_algebraic[31] = "delta in component IKs (per_ms)" legend_algebraic[26] = "gamma in component IKs (per_ms)" legend_algebraic[35] = "eta in component IKs (per_ms)" legend_constants[81] = "theta in component IKs (per_ms)" legend_algebraic[38] = "omega in component IKs (per_ms)" legend_algebraic[40] = "psi in component IKs (per_ms)" legend_algebraic[95] = "EKs in component reversal_potentials (mV)" legend_states[18] = "Ca_i in component Ca (mM)" legend_algebraic[34] = "ICaL_max in component ICaL (uA_per_uF)" legend_constants[13] = "PCa in component ICaL (L_per_F_ms)" legend_states[19] = "C in component ICaL (dimensionless)" legend_states[20] = "O in component ICaL (dimensionless)" legend_states[21] = "C_star in component ICaL (dimensionless)" legend_states[22] = "O_star in component ICaL (dimensionless)" legend_states[23] = "CI in component ICaL (dimensionless)" legend_states[24] = "OI in component ICaL (dimensionless)" legend_states[25] = "CI_star in component ICaL (dimensionless)" legend_states[26] = "OI_star in component ICaL (dimensionless)" legend_algebraic[2] = "ACT_tau in component ICaL (ms)" legend_algebraic[39] = "IV_tau in component ICaL (ms)" legend_algebraic[51] = "IV_tau_star in component ICaL (ms)" legend_algebraic[15] = "ACT_infinity in component ICaL (dimensionless)" legend_algebraic[36] = "IV_infinity in component ICaL (dimensionless)" legend_algebraic[45] = "IV_infinity_star in component ICaL (dimensionless)" legend_algebraic[49] = "IV_beta_star in component ICaL (dimensionless)" legend_algebraic[47] = "IV_beta_infinity_star in component ICaL (dimensionless)" legend_algebraic[27] = "alpha in component ICaL (per_ms)" legend_algebraic[32] = "beta in component ICaL (per_ms)" legend_algebraic[57] = "delta in component ICaL (per_ms)" legend_algebraic[41] = "x in component ICaL (per_ms)" legend_algebraic[43] = "y in component ICaL (per_ms)" legend_constants[14] = "theta in component ICaL (per_ms)" legend_algebraic[59] = "delta_I in component ICaL (per_ms)" legend_algebraic[53] = "x_star in component ICaL (per_ms)" legend_algebraic[55] = "y_star in component ICaL (per_ms)" legend_constants[15] = "theta_I in component ICaL (per_ms)" legend_constants[16] = "gamma_Cai in component ICaL (dimensionless)" legend_constants[17] = "gamma_Cao in component ICaL (dimensionless)" legend_states[27] = "Ca_ss_CaL in component Ca (mM)" legend_constants[18] = "g_Na in component INa (mS_per_uF)" legend_algebraic[77] = "ENa in component reversal_potentials (mV)" legend_states[28] = "m in component INa_m_gate (dimensionless)" legend_states[29] = "h in component INa_h_gate (dimensionless)" legend_states[30] = "j in component INa_j_gate (dimensionless)" legend_algebraic[3] = "am in component INa_m_gate (per_ms)" legend_algebraic[16] = "bm in component INa_m_gate (per_ms)" legend_algebraic[4] = "ah in component INa_h_gate (per_ms)" legend_algebraic[17] = "bh in component INa_h_gate (per_ms)" legend_algebraic[5] = "aj in component INa_j_gate (per_ms)" legend_algebraic[18] = "bj in component INa_j_gate (per_ms)" legend_constants[19] = "kmnai in component INaK (mM)" legend_constants[20] = "kmko in component INaK (mM)" legend_constants[21] = "ibarnak in component INaK (uA_per_uF)" legend_constants[22] = "sigma in component INaK (dimensionless)" legend_constants[23] = "V_half in component INaK (mV)" legend_algebraic[42] = "phi in component INaK (dimensionless)" legend_algebraic[44] = "fv in component INaK (dimensionless)" legend_constants[94] = "PK in component INaK (dimensionless)" legend_algebraic[46] = "PNa in component INaK (dimensionless)" legend_states[31] = "Na_i in component Na (mM)" legend_constants[24] = "KmCa_act in component INaCa (mM)" legend_constants[25] = "Vmax in component INaCa (uA_per_uF)" legend_constants[26] = "ksat in component INaCa (dimensionless)" legend_constants[27] = "eta in component INaCa (dimensionless)" legend_constants[28] = "KmNai in component INaCa (mM)" legend_constants[29] = "KmNao in component INaCa (mM)" legend_constants[30] = "KmCai in component INaCa (mM)" legend_constants[31] = "KmCao in component INaCa (mM)" legend_states[32] = "Ca_ss_sr in component Ca (mM)" legend_states[33] = "Na_ss_sr in component Na (mM)" legend_algebraic[50] = "num in component INaCa (mM4_uA_per_uF)" legend_algebraic[60] = "num_ss in component INaCa (mM4_uA_per_uF)" legend_algebraic[52] = "denom_1 in component INaCa (dimensionless)" legend_algebraic[54] = "denom_2 in component INaCa (dimensionless)" legend_algebraic[56] = "denom_3 in component INaCa (mM4)" legend_algebraic[58] = "denom_4 in component INaCa (mM4)" legend_algebraic[61] = "denom_ss_1 in component INaCa (dimensionless)" legend_algebraic[62] = "denom_ss_2 in component INaCa (dimensionless)" legend_algebraic[63] = "denom_ss_3 in component INaCa (mM4)" legend_algebraic[64] = "denom_ss_4 in component INaCa (mM4)" legend_constants[32] = "gKp in component IKp (mS_per_uF)" legend_algebraic[67] = "Kp in component IKp (dimensionless)" legend_algebraic[90] = "EK in component reversal_potentials (mV)" legend_constants[33] = "gpCa in component IpCa (uA_per_uF)" legend_constants[34] = "KmpCa in component IpCa (mM)" legend_constants[35] = "PCab in component ICab (L_per_F_ms)" legend_constants[36] = "gamma_Ca_i in component ICab (dimensionless)" legend_constants[37] = "gamma_Ca_o in component ICab (dimensionless)" legend_constants[38] = "PNab in component INab (L_per_F_ms)" legend_algebraic[72] = "phi in component INab (dimensionless)" legend_constants[39] = "gClb in component IClb (mS_per_uF)" legend_algebraic[98] = "ECl in component reversal_potentials (mV)" legend_constants[40] = "gNaL in component INaL (mS_per_uF)" legend_states[34] = "mL in component INaL_mL_gate (dimensionless)" legend_states[35] = "hL in component INaL_hL_gate (dimensionless)" legend_algebraic[6] = "amL in component INaL_mL_gate (per_ms)" legend_algebraic[19] = "bmL in component INaL_mL_gate (per_ms)" legend_constants[41] = "tau_hL in component INaL_hL_gate (ms)" legend_algebraic[7] = "hL_infinity in component INaL_hL_gate (dimensionless)" legend_constants[42] = "prnak in component reversal_potentials (dimensionless)" legend_states[36] = "K_i in component K (mM)" legend_states[37] = "Cl_i in component Cl (mM)" legend_constants[83] = "gK1 in component IK1 (mS_per_uF)" legend_algebraic[102] = "K1 in component IK1_K1_gate (dimensionless)" legend_algebraic[100] = "alpha_k1 in component IK1_K1_gate (dimensionless)" legend_algebraic[101] = "beta_k1 in component IK1_K1_gate (dimensionless)" legend_algebraic[104] = "CT_Na_Cl in component CT_Na_Cl (mM_per_ms)" legend_constants[43] = "CT_Na_Cl_max in component CT_Na_Cl (mM_per_ms)" legend_algebraic[105] = "CT_K_Cl in component CT_K_Cl (mM_per_ms)" legend_constants[44] = "CT_K_Cl_max in component CT_K_Cl (mM_per_ms)" legend_constants[84] = "gKr in component IKr (mS_per_uF)" legend_algebraic[107] = "r in component IKr_r_gate (dimensionless)" legend_states[38] = "xr in component IKr_xr_gate (dimensionless)" legend_algebraic[8] = "xr_infinity in component IKr_xr_gate (dimensionless)" legend_algebraic[20] = "tau_xr in component IKr_xr_gate (ms)" legend_constants[45] = "gto1 in component Ito1 (mS_per_uF)" legend_algebraic[109] = "rto1 in component Ito1 (dimensionless)" legend_states[39] = "a in component Ito1_a_gate (dimensionless)" legend_states[40] = "i1f in component Ito1_i1f_gate (dimensionless)" legend_states[41] = "i1s in component Ito1_i1s_gate (dimensionless)" legend_algebraic[9] = "alpha_a in component Ito1_a_gate (per_ms)" legend_algebraic[21] = "beta_a in component Ito1_a_gate (per_ms)" legend_algebraic[28] = "tau_a in component Ito1_a_gate (ms)" legend_algebraic[33] = "a_infinity in component Ito1_a_gate (dimensionless)" legend_algebraic[22] = "alpha_i1f in component Ito1_i1f_gate (per_ms)" legend_algebraic[10] = "beta_i1f in component Ito1_i1f_gate (per_ms)" legend_algebraic[23] = "alpha_i1s in component Ito1_i1s_gate (per_ms)" legend_algebraic[11] = "beta_i1s in component Ito1_i1s_gate (per_ms)" legend_constants[46] = "PCl in component Ito2 (L_per_F_ms)" legend_constants[47] = "zCl in component Ito2 (dimensionless)" legend_algebraic[112] = "Ito2_max in component Ito2 (uA_per_uF)" legend_algebraic[113] = "KCa_ito2 in component Ito2 (dimensionless)" legend_constants[48] = "kCa_ito2 in component Ito2 (mM_per_ms)" legend_states[42] = "Irel in component Irel (mM_per_ms)" legend_states[43] = "i2f in component Ito2_i2f_gate (dimensionless)" legend_algebraic[24] = "alpha_i2f in component Ito2_i2f_gate (per_ms)" legend_algebraic[12] = "beta_i2f in component Ito2_i2f_gate (per_ms)" legend_algebraic[29] = "i2f_infinity in component Ito2_i2f_gate (dimensionless)" legend_constants[49] = "tau_i2f in component Ito2_i2f_gate (ms)" legend_algebraic[96] = "rel_infinity in component Irel (mM_per_ms)" legend_algebraic[94] = "tau_rel in component Irel (ms)" legend_constants[50] = "Krel_infinity in component Irel (mM)" legend_algebraic[91] = "alpha_rel in component Irel (mM_per_uA_per_uF_per_ms)" legend_algebraic[88] = "beta_tau in component Irel (ms)" legend_constants[51] = "beta_0 in component Irel (ms)" legend_constants[52] = "kappa in component Irel (mM_per_uA_per_uF_per_ms_per_ms)" legend_constants[53] = "h_rel in component Irel (dimensionless)" legend_constants[54] = "h_beta in component Irel (dimensionless)" legend_algebraic[85] = "delta_beta_CaMK in component Irel (dimensionless)" legend_constants[55] = "delta_beta_0 in component Irel (dimensionless)" legend_constants[56] = "K_beta in component Irel (mM)" legend_constants[57] = "Krel_tau in component Irel (mM)" legend_states[44] = "Ca_JSR in component Ca (mM)" legend_algebraic[81] = "CaMK_active in component CaMK_active (dimensionless)" legend_algebraic[92] = "Iup in component Iup (mM_per_ms)" legend_constants[58] = "kmup in component Iup (mM)" legend_algebraic[89] = "delta_kmPLB in component Iup (mM)" legend_constants[59] = "delta_kmPLB_bar in component Iup (mM)" legend_constants[60] = "iupbar in component Iup (mM_per_ms)" legend_algebraic[86] = "delta_iupCaMK in component Iup (dimensionless)" legend_constants[61] = "delta_iupCaMK_bar in component Iup (dimensionless)" legend_constants[62] = "kmCaMK in component Iup (mM)" legend_algebraic[71] = "Ileak in component Ileak (mM_per_ms)" legend_constants[63] = "nsrbar in component Ileak (mM)" legend_states[45] = "Ca_NSR in component Ca (mM)" legend_algebraic[73] = "Itr in component Itr (mM_per_ms)" legend_constants[64] = "tautr in component Itr (ms)" legend_constants[65] = "tau_diff in component Ca (ms)" legend_constants[66] = "tau_diff_ss in component Ca (ms)" legend_algebraic[75] = "Idiff in component Ca (mM_per_ms)" legend_algebraic[79] = "Idiff_ss in component Ca (mM_per_ms)" legend_algebraic[78] = "bmyo in component Ca (dimensionless)" legend_algebraic[82] = "bss in component Ca (dimensionless)" legend_algebraic[83] = "bss_sr in component Ca (dimensionless)" legend_constants[67] = "cmdn_bar in component Ca (mM)" legend_constants[68] = "trpn_bar in component Ca (mM)" legend_constants[69] = "km_cmdn in component Ca (mM)" legend_constants[70] = "km_trpn in component Ca (mM)" legend_constants[71] = "kmcsqn in component Ca (mM)" legend_constants[72] = "csqnbar in component Ca (mM)" legend_algebraic[76] = "bcsqn in component Ca (dimensionless)" legend_constants[73] = "BSRmax in component Ca (mM)" legend_constants[74] = "KmBSR in component Ca (mM)" legend_constants[75] = "BSLmax in component Ca (mM)" legend_constants[76] = "KmBSL in component Ca (mM)" legend_algebraic[106] = "Idiff_Na in component Na (mM_per_ms)" legend_states[46] = "Cl_ss in component Cl (mM)" legend_algebraic[116] = "Idiff_Cl in component Cl (mM_per_ms)" legend_constants[77] = "Km in component CaMK_active (mM)" legend_states[47] = "CaMK_trap in component CaMK_active (dimensionless)" legend_constants[78] = "alpha_CaMK in component CaMK_active (per_ms)" legend_constants[79] = "beta_CaMK in component CaMK_active (per_ms)" legend_constants[80] = "CaMK_0 in component CaMK_active (dimensionless)" legend_rates[0] = "d/dt Vm in component membrane (mV)" legend_rates[1] = "d/dt C1 in component IKs (dimensionless)" legend_rates[2] = "d/dt C2 in component IKs (dimensionless)" legend_rates[3] = "d/dt C3 in component IKs (dimensionless)" legend_rates[4] = "d/dt C4 in component IKs (dimensionless)" legend_rates[5] = "d/dt C5 in component IKs (dimensionless)" legend_rates[6] = "d/dt C6 in component IKs (dimensionless)" legend_rates[7] = "d/dt C7 in component IKs (dimensionless)" legend_rates[8] = "d/dt C8 in component IKs (dimensionless)" legend_rates[9] = "d/dt C9 in component IKs (dimensionless)" legend_rates[10] = "d/dt C10 in component IKs (dimensionless)" legend_rates[11] = "d/dt C11 in component IKs (dimensionless)" legend_rates[12] = "d/dt C12 in component IKs (dimensionless)" legend_rates[13] = "d/dt C13 in component IKs (dimensionless)" legend_rates[14] = "d/dt C14 in component IKs (dimensionless)" legend_rates[15] = "d/dt C15 in component IKs (dimensionless)" legend_rates[16] = "d/dt O1 in component IKs (dimensionless)" legend_rates[17] = "d/dt O2 in component IKs (dimensionless)" legend_rates[19] = "d/dt C in component ICaL (dimensionless)" legend_rates[20] = "d/dt O in component ICaL (dimensionless)" legend_rates[21] = "d/dt C_star in component ICaL (dimensionless)" legend_rates[22] = "d/dt O_star in component ICaL (dimensionless)" legend_rates[23] = "d/dt CI in component ICaL (dimensionless)" legend_rates[24] = "d/dt OI in component ICaL (dimensionless)" legend_rates[25] = "d/dt CI_star in component ICaL (dimensionless)" legend_rates[26] = "d/dt OI_star in component ICaL (dimensionless)" legend_rates[28] = "d/dt m in component INa_m_gate (dimensionless)" legend_rates[29] = "d/dt h in component INa_h_gate (dimensionless)" legend_rates[30] = "d/dt j in component INa_j_gate (dimensionless)" legend_rates[34] = "d/dt mL in component INaL_mL_gate (dimensionless)" legend_rates[35] = "d/dt hL in component INaL_hL_gate (dimensionless)" legend_rates[38] = "d/dt xr in component IKr_xr_gate (dimensionless)" legend_rates[39] = "d/dt a in component Ito1_a_gate (dimensionless)" legend_rates[40] = "d/dt i1f in component Ito1_i1f_gate (dimensionless)" legend_rates[41] = "d/dt i1s in component Ito1_i1s_gate (dimensionless)" legend_rates[43] = "d/dt i2f in component Ito2_i2f_gate (dimensionless)" legend_rates[42] = "d/dt Irel in component Irel (mM_per_ms)" legend_rates[18] = "d/dt Ca_i in component Ca (mM)" legend_rates[32] = "d/dt Ca_ss_sr in component Ca (mM)" legend_rates[27] = "d/dt Ca_ss_CaL in component Ca (mM)" legend_rates[45] = "d/dt Ca_NSR in component Ca (mM)" legend_rates[44] = "d/dt Ca_JSR in component Ca (mM)" legend_rates[31] = "d/dt Na_i in component Na (mM)" legend_rates[33] = "d/dt Na_ss_sr in component Na (mM)" legend_rates[37] = "d/dt Cl_i in component Cl (mM)" legend_rates[46] = "d/dt Cl_ss in component Cl (mM)" legend_rates[36] = "d/dt K_i in component K (mM)" legend_rates[47] = "d/dt CaMK_trap in component CaMK_active (dimensionless)" return (legend_states, legend_algebraic, legend_voi, legend_constants) def initConsts(): constants = [0.0] * sizeConstants; states = [0.0] * sizeStates; constants[0] = 96487 constants[1] = 310 constants[2] = 8314 constants[3] = 5.4 constants[4] = 1.8 constants[5] = 140 constants[6] = 100 constants[7] = 0.01 constants[8] = 0.0011 states[0] = -87.472528 constants[9] = 0 constants[10] = 1e3 constants[11] = 0.5 constants[12] = -80 states[1] = 0.476653873938053 states[2] = 0.2551771850026437 states[3] = 0.05122852186842027 states[4] = 0.004570874421666423 states[5] = 0.0001529389211563687 states[6] = 0.1328281770413747 states[7] = 0.05333228495514583 states[8] = 0.007137874613383642 states[9] = 0.0003184390970637536 states[10] = 0.01388061042363991 states[11] = 0.003715500164470033 states[12] = 0.0002486371465457659 states[13] = 0.0006446803014431032 states[14] = 8.628258026770862e-5 states[15] = 1.122823524761588e-5 states[16] = 1.051906959485266e-5 states[17] = 2.372219883411999e-6 states[18] = 7.09945e-5 constants[13] = 1.5552e-4 states[19] = 0.9999613782488198 states[20] = 2.27419494597377e-5 states[21] = 5.936477396599124e-11 states[22] = 1.350122566369778e-15 states[23] = 1.587938121237188e-5 states[24] = 3.611420243201921e-10 states[25] = 0 states[26] = 0 constants[14] = 1 constants[15] = 0.000001 constants[16] = 1 constants[17] = 0.341 states[27] = 9.61545e-5 constants[18] = 9.075 states[28] = 0.001022252813581797 states[29] = 0.9913109066867 states[30] = 0.9970771239754529 constants[19] = 2.6 constants[20] = 1.5 constants[21] = 1.4 constants[22] = 1 constants[23] = -92 states[31] = 6.935575 constants[24] = 1.25e-4 constants[25] = 4.5 constants[26] = 0.32 constants[27] = 0.27 constants[28] = 12.3 constants[29] = 87.5 constants[30] = 0.0036 constants[31] = 1.3 states[32] = 9.04757e-5 states[33] = 6.935607 constants[32] = 0.00276 constants[33] = 0.0575 constants[34] = 0.5e-3 constants[35] = 1.995084e-7 constants[36] = 1 constants[37] = 0.341 constants[38] = 0.32e-8 constants[39] = 2.25e-4 constants[40] = 0.0065 states[34] = 0.001022252813581797 states[35] = 0.3593255076983574 constants[41] = 600 constants[42] = 0.01833 states[36] = 145.5689 states[37] = 20.26842 constants[43] = 2.46108e-5 constants[44] = 1.77e-5 states[38] = 1.235996442041028e-8 constants[45] = 0.4975 states[39] = 1.773318268499115e-5 states[40] = 0.9979722 states[41] = 0.9874435 constants[46] = 9e-7 constants[47] = -1 constants[48] = 0.4 states[42] = 0.00107332 states[43] = 0.9960352 constants[49] = 8 constants[50] = 1 constants[51] = 4.75 constants[52] = 0.1125 constants[53] = 8 constants[54] = 10 constants[55] = 1 constants[56] = 0.28 constants[57] = 0.0123 states[44] = 0.917692717 constants[58] = 0.00092 constants[59] = 1.7e-4 constants[60] = 0.004375 constants[61] = 0.75 constants[62] = 0.15 constants[63] = 15 states[45] = 0.929835335 constants[64] = 25 constants[65] = 0.2 constants[66] = 2 constants[67] = 0.05 constants[68] = 0.07 constants[69] = 0.00238 constants[70] = 0.0005 constants[71] = 0.8 constants[72] = 10 constants[73] = 0.047 constants[74] = 0.00087 constants[75] = 1.124 constants[76] = 0.0087 states[46] = 20.26842 constants[77] = 0.0015 states[47] = 0.0018861341 constants[78] = 0.05 constants[79] = 0.00068 constants[80] = 0.05 constants[81] = 0.0895380 constants[82] = 1000.00* pi*constants[8]*constants[8]*constants[7] constants[83] = 0.500000*(power(constants[3]/5.40000, 1.0/2)) constants[84] = 0.0138542*(power(constants[3]/5.40000, 1.0/2)) constants[85] = constants[82]*0.0600000 constants[86] = 2.00000* pi*constants[8]*constants[8]+2.00000* pi*constants[8]*constants[7] constants[87] = constants[86]*2.00000 constants[88] = (1.00000*1.00000*constants[87])/(constants[0]*1.00000) constants[89] = constants[82]*0.678000 constants[90] = constants[82]*0.0552000 constants[91] = constants[82]*0.00480000 constants[92] = constants[82]*0.0200000 constants[93] = constants[82]*0.00200000 constants[94] = constants[3]/(constants[3]+constants[20]) return (states, constants) def computeRates(voi, states, constants): rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic algebraic[7] = 1.00000/(1.00000+exp((states[0]+91.0000)/6.10000)) rates[35] = (algebraic[7]-states[35])/constants[41] algebraic[1] = 0.0148640*exp((0.0298770*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[14] = 0.0839860*exp((-0.0554610*states[0]*constants[0])/(constants[2]*constants[1])) rates[1] = -4.00000*algebraic[1]*states[1]+algebraic[14]*states[2] algebraic[3] = (0.320000*(states[0]+47.1300))/(1.00000-exp(-0.100000*(states[0]+47.1300))) algebraic[16] = 0.0800000*exp(-states[0]/11.0000) rates[28] = algebraic[3]*(1.00000-states[28])-algebraic[16]*states[28] algebraic[4] = custom_piecewise([greater_equal(states[0] , -40.0000), 0.00000 , True, 0.135000*exp((80.0000+states[0])/-6.80000)]) algebraic[17] = custom_piecewise([greater_equal(states[0] , -40.0000), 1.00000/(0.130000*(1.00000+exp((states[0]+10.6600)/-11.1000))) , True, 3.56000*exp(0.0790000*states[0])+310000.*exp(0.350000*states[0])]) rates[29] = algebraic[4]*(1.00000-states[29])-algebraic[17]*states[29] algebraic[5] = custom_piecewise([greater_equal(states[0] , -40.0000), 0.00000 , True, ((-127140.*exp(0.244400*states[0])-6.94800e-05*exp(-0.0439100*states[0]))*(states[0]+37.7800))/(1.00000+exp(0.311000*(states[0]+79.2300)))]) algebraic[18] = custom_piecewise([greater_equal(states[0] , -40.0000), (0.300000*exp(-2.53500e-07*states[0]))/(1.00000+exp(-0.100000*(states[0]+32.0000))) , True, (0.121200*exp(-0.0105200*states[0]))/(1.00000+exp(-0.137800*(states[0]+40.1400)))]) rates[30] = algebraic[5]*(1.00000-states[30])-algebraic[18]*states[30] algebraic[6] = (0.320000*(states[0]+47.1300))/(1.00000-exp(-0.100000*(states[0]+47.1300))) algebraic[19] = 0.0800000*exp(-states[0]/11.0000) rates[34] = algebraic[6]*(1.00000-states[34])-algebraic[19]*states[34] algebraic[8] = 1.00000/(1.00000+exp(-(states[0]+10.0850)/4.25000)) algebraic[20] = 1.00000/((0.000600000*(states[0]-1.73840))/(1.00000-exp(-0.136000*(states[0]-1.73840)))+(0.000300000*(states[0]+38.3608))/(exp(0.152200*(states[0]+38.3608))-1.00000)) rates[38] = (algebraic[8]-states[38])/algebraic[20] algebraic[22] = 0.0250000/(1.00000+exp((states[0]+58.0000)/5.00000)) algebraic[10] = 1.00000/(9.79530*(1.00000+exp((states[0]+19.0000)/-9.00000))) rates[40] = algebraic[22]*(1.00000-states[40])-algebraic[10]*states[40] algebraic[23] = 1.00000/(250.000*(1.00000+exp((states[0]+60.0000)/5.00000))) algebraic[11] = 1.00000/(9.79530*(1.00000+exp((states[0]+19.0000)/-9.00000))) rates[41] = algebraic[23]*(1.00000-states[41])-algebraic[11]*states[41] algebraic[24] = 0.0250000/(1.00000+exp((states[0]+58.0000)/5.00000)) algebraic[12] = 1.00000/(5.00000*(1.00000+exp((states[0]+19.0000)/-9.00000))) algebraic[29] = algebraic[24]/(algebraic[24]+algebraic[12]) rates[43] = (algebraic[29]-states[43])/constants[49] algebraic[31] = 0.00311730*exp((-0.426250*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[26] = 0.0146010*exp((0.244650*states[0]*constants[0])/(constants[2]*constants[1])) rates[2] = -(3.00000*algebraic[1]+algebraic[14]+algebraic[26])*states[2]+4.00000*algebraic[1]*states[1]+2.00000*algebraic[14]*states[3]+algebraic[31]*states[6] rates[3] = -(2.00000*algebraic[1]+2.00000*algebraic[14]+2.00000*algebraic[26])*states[3]+3.00000*algebraic[1]*states[2]+3.00000*algebraic[14]*states[4]+algebraic[31]*states[7] rates[4] = -(algebraic[1]+3.00000*algebraic[14]+3.00000*algebraic[26])*states[4]+2.00000*algebraic[1]*states[3]+4.00000*algebraic[14]*states[5]+algebraic[31]*states[8] rates[5] = -(4.00000*algebraic[14]+4.00000*algebraic[26])*states[5]+algebraic[1]*states[4]+algebraic[31]*states[9] rates[6] = -(3.00000*algebraic[1]+algebraic[31])*states[6]+algebraic[14]*states[7]+algebraic[26]*states[2] rates[7] = -(2.00000*algebraic[1]+algebraic[14]+algebraic[26]+algebraic[31])*states[7]+3.00000*algebraic[1]*states[6]+2.00000*algebraic[14]*states[8]+2.00000*algebraic[26]*states[3]+2.00000*algebraic[31]*states[10] rates[8] = -(algebraic[1]+2.00000*algebraic[14]+2.00000*algebraic[26]+algebraic[31])*states[8]+2.00000*algebraic[1]*states[7]+3.00000*algebraic[14]*states[9]+3.00000*algebraic[26]*states[4]+2.00000*algebraic[31]*states[11] rates[9] = -(3.00000*algebraic[14]+3.00000*algebraic[26]+algebraic[31])*states[9]+algebraic[1]*states[8]+4.00000*algebraic[26]*states[5]+2.00000*algebraic[31]*states[12] rates[10] = -(2.00000*algebraic[1]+2.00000*algebraic[31])*states[10]+algebraic[14]*states[11]+algebraic[26]*states[7] rates[11] = -(algebraic[1]+algebraic[14]+algebraic[26]+2.00000*algebraic[31])*states[11]+2.00000*algebraic[1]*states[10]+2.00000*algebraic[14]*states[12]+2.00000*algebraic[26]*states[8]+3.00000*algebraic[31]*states[13] rates[12] = -(2.00000*algebraic[14]+2.00000*algebraic[26]+2.00000*algebraic[31])*states[12]+algebraic[1]*states[11]+3.00000*algebraic[26]*states[9]+3.00000*algebraic[31]*states[14] rates[13] = -(algebraic[1]+3.00000*algebraic[31])*states[13]+algebraic[14]*states[14]+algebraic[26]*states[11] rates[14] = -(algebraic[14]+algebraic[26]+3.00000*algebraic[31])*states[14]+algebraic[1]*states[13]+2.00000*algebraic[26]*states[12]+4.00000*algebraic[31]*states[15] algebraic[9] = 1.00000/(1.20890*(1.00000+exp((states[0]-18.4099)/-29.3814))) algebraic[21] = 3.50000/(1.00000+exp((states[0]+100.000)/29.3814)) algebraic[28] = 1.00000/(algebraic[9]+algebraic[21]) algebraic[33] = 1.00000/(1.00000+exp((states[0]+9.43700)/-7.13300)) rates[39] = (algebraic[33]-states[39])/algebraic[28] algebraic[35] = 0.0773200*exp((-0.0647260*states[0]*constants[0])/(constants[2]*constants[1])) rates[15] = -(4.00000*algebraic[31]+constants[81])*states[15]+algebraic[26]*states[14]+algebraic[35]*states[16] algebraic[38] = 0.794050*exp((-0.0801740*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[40] = 0.586380*exp((0.282060*states[0]*constants[0])/(constants[2]*constants[1])) rates[16] = -(algebraic[35]+algebraic[40])*states[16]+algebraic[38]*states[17]+constants[81]*states[15] rates[17] = -algebraic[38]*states[17]+algebraic[40]*states[16] algebraic[2] = 0.590000+(0.800000*exp(0.0520000*(states[0]+13.0000)))/(1.00000+exp(0.132000*(states[0]+13.0000))) algebraic[15] = 1.00000/(1.00000+exp(-(states[0]-13.5600)/9.45000)) algebraic[27] = algebraic[15]/algebraic[2] algebraic[32] = (1.00000-algebraic[15])/algebraic[2] algebraic[57] = 3.00000/(1.00000+power(0.00300000/states[27], 4.00000)) algebraic[39] = 1.00000/(1.00000/(24.8280*(1.00000+exp((states[0]+49.1000)/10.3490)))+1.00000/(30.5530*(1.00000+exp(-(states[0]+0.213000)/10.8070)))) algebraic[36] = (1.00000/(1.00000+exp((states[0]+17.5000)/3.00000))+0.250000)/1.25000 algebraic[41] = algebraic[36]/algebraic[39] algebraic[43] = (1.00000-algebraic[36])/algebraic[39] rates[19] = -(algebraic[27]+algebraic[57]+algebraic[43])*states[19]+algebraic[32]*states[20]+constants[14]*states[21]+algebraic[41]*states[23] rates[20] = -(algebraic[32]+algebraic[57]+algebraic[43])*states[20]+algebraic[27]*states[19]+constants[14]*states[22]+algebraic[41]*states[24] algebraic[47] = 25.0000-17.5000/(1.00000+power(0.00300000/states[27], 4.00000)) algebraic[49] = 1.00000/(algebraic[47]*(1.00000+exp(-(states[0]+0.213000)/10.8070))) algebraic[51] = 1.00000/(1.00000/(24.8280*(1.00000+exp((states[0]+49.1000)/10.3490)))+algebraic[49]) algebraic[45] = (1.00000/(1.00000+exp((states[0]+17.5000)/3.00000))+0.000100000)/1.00010 algebraic[53] = algebraic[45]/algebraic[51] algebraic[55] = (1.00000-algebraic[45])/algebraic[51] rates[21] = -(algebraic[27]+constants[14]+algebraic[55])*states[21]+algebraic[57]*states[19]+algebraic[32]*states[22]+algebraic[53]*states[25] rates[22] = -(algebraic[32]+constants[14]+algebraic[55])*states[22]+algebraic[57]*states[20]+algebraic[27]*states[21]+algebraic[53]*states[26] algebraic[59] = (constants[15]*algebraic[41]*algebraic[55]*algebraic[57])/(algebraic[43]*algebraic[53]*constants[14]) rates[23] = -(algebraic[27]+algebraic[59]+algebraic[41])*states[23]+algebraic[43]*states[19]+constants[15]*states[25]+algebraic[32]*states[24] rates[24] = -(algebraic[32]+algebraic[59]+algebraic[41])*states[24]+algebraic[43]*states[20]+constants[15]*states[26]+algebraic[27]*states[23] rates[25] = -(algebraic[27]+constants[15]+algebraic[53])*states[25]+algebraic[59]*states[23]+algebraic[55]*states[21]+algebraic[32]*states[26] rates[26] = -(algebraic[32]+constants[15]+algebraic[53])*states[26]+algebraic[59]*states[24]+algebraic[55]*states[22]+algebraic[27]*states[25] algebraic[73] = (states[45]-states[44])/constants[64] algebraic[76] = 1.00000/(1.00000+(constants[71]*constants[72])/(power(states[44]+constants[71], 2.00000))) rates[44] = algebraic[76]*(algebraic[73]-states[42]) algebraic[60] = 0.200000*constants[25]*((power(states[33], 3.00000))*constants[4]*exp((constants[27]*states[0]*constants[0])/(constants[2]*constants[1]))-(power(constants[5], 3.00000))*states[32]*exp(((constants[27]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1]))) algebraic[61] = 1.00000+power(constants[24]/states[32], 2.00000) algebraic[62] = 1.00000+constants[26]*exp(((constants[27]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[63] = constants[31]*(power(states[33], 3.00000))+(power(constants[29], 3.00000))*states[32]+(power(constants[28], 3.00000))*constants[4]*(1.00000+states[32]/constants[30]) algebraic[64] = constants[30]*(power(constants[5], 3.00000))*(1.00000+power(states[33]/constants[28], 3.00000))+(power(states[33], 3.00000))*constants[4]+(power(constants[5], 3.00000))*states[32] algebraic[66] = algebraic[60]/(algebraic[61]*algebraic[62]*(algebraic[63]+algebraic[64])) algebraic[75] = (states[32]-states[18])/constants[65] algebraic[79] = (states[32]-states[27])/constants[66] algebraic[83] = 1.00000/(1.00000+(constants[73]*constants[74])/(power(constants[74]+states[32], 2.00000))+(constants[75]*constants[76])/(power(constants[76]+states[32], 2.00000))) rates[32] = algebraic[83]*-((algebraic[75]+algebraic[79])-((2.00000*algebraic[66]*constants[88])/(2.00000*constants[92])+(states[42]*constants[91])/constants[92])) algebraic[34] = (((constants[13]*4.00000*states[0]*(power(constants[0], 2.00000)))/(constants[2]*constants[1]))*(constants[16]*states[27]*exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-constants[17]*constants[4]))/(exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-1.00000) algebraic[37] = algebraic[34]*(states[20]+states[22]) algebraic[82] = 1.00000/(1.00000+(constants[73]*constants[74])/(power(constants[74]+states[27], 2.00000))+(constants[75]*constants[76])/(power(constants[76]+states[27], 2.00000))) rates[27] = algebraic[82]*-((algebraic[37]*constants[88])/(2.00000*constants[93])-(algebraic[79]*constants[92])/constants[93]) algebraic[81] = (constants[80]*(1.00000-states[47]))/(1.00000+constants[77]/states[32])+states[47] rates[47] = constants[78]*algebraic[81]*(algebraic[81]-states[47])-constants[79]*states[47] algebraic[68] = (constants[33]*states[18])/(constants[34]+states[18]) algebraic[69] = (((constants[35]*4.00000*states[0]*(power(constants[0], 2.00000)))/(constants[2]*constants[1]))*(constants[36]*states[18]*exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-constants[37]*constants[4]))/(exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-1.00000) algebraic[50] = 0.800000*constants[25]*((power(states[31], 3.00000))*constants[4]*exp((constants[27]*states[0]*constants[0])/(constants[2]*constants[1]))-(power(constants[5], 3.00000))*states[18]*exp(((constants[27]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1]))) algebraic[52] = 1.00000+power(constants[24]/states[18], 2.00000) algebraic[54] = 1.00000+constants[26]*exp(((constants[27]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[56] = constants[31]*(power(states[31], 3.00000))+(power(constants[29], 3.00000))*states[18]+(power(constants[28], 3.00000))*constants[4]*(1.00000+states[18]/constants[30]) algebraic[58] = constants[30]*(power(constants[5], 3.00000))*(1.00000+power(states[31]/constants[28], 3.00000))+(power(states[31], 3.00000))*constants[4]+(power(constants[5], 3.00000))*states[18] algebraic[65] = algebraic[50]/(algebraic[52]*algebraic[54]*(algebraic[56]+algebraic[58])) algebraic[89] = (constants[59]*algebraic[81]*1.00000)/(constants[62]+algebraic[81]*1.00000) algebraic[86] = (constants[61]*algebraic[81]*1.00000)/(constants[62]+algebraic[81]*1.00000) algebraic[92] = ((algebraic[86]+1.00000)*constants[60]*states[18])/((states[18]+constants[58])-algebraic[89]) algebraic[71] = (0.00437500/constants[63])*states[45] algebraic[78] = 1.00000/(1.00000+(constants[67]*constants[69])/(power(states[18]+constants[69], 2.00000))+(constants[70]*constants[68])/(power(states[18]+constants[70], 2.00000))) rates[18] = algebraic[78]*((-((algebraic[69]+algebraic[68])-2.00000*algebraic[65])*constants[88])/(constants[89]*2.00000)+((algebraic[71]-algebraic[92])*constants[90])/constants[89]+(algebraic[75]*constants[93])/constants[89]) rates[45] = algebraic[92]-(algebraic[71]+(algebraic[73]*constants[91])/constants[90]) algebraic[85] = constants[55]/(1.00000+power(constants[56]/(1.00000*algebraic[81]), constants[54])) algebraic[88] = constants[51]*(1.00000+algebraic[85]) algebraic[91] = algebraic[88]*constants[52] algebraic[96] = (algebraic[37]*algebraic[91])/(1.00000+power(constants[50]/states[44], constants[53])) algebraic[94] = algebraic[88]/(1.00000+constants[57]/states[44]) rates[42] = -(algebraic[96]+states[42])/algebraic[94] algebraic[77] = ((constants[2]*constants[1])/constants[0])*log(constants[5]/states[31]) algebraic[80] = constants[18]*(power(states[28], 3.00000))*states[29]*states[30]*(states[0]-algebraic[77]) algebraic[42] = (constants[22]*(states[0]-constants[23])*constants[0])/(constants[2]*constants[1]) algebraic[44] = 1.00000/(1.00000+exp(-algebraic[42])) algebraic[46] = power(states[31]/(states[31]+constants[19]), 3.00000) algebraic[48] = constants[21]*algebraic[44]*constants[94]*algebraic[46] algebraic[84] = constants[40]*(power(states[34], 3.00000))*states[35]*(states[0]-algebraic[77]) algebraic[72] = (constants[0]*states[0])/(constants[2]*constants[1]) algebraic[74] = (constants[0]*constants[38]*algebraic[72]*(states[31]*exp(algebraic[72])-constants[5]))/(exp(algebraic[72])-1.00000) algebraic[98] = ((-constants[2]*constants[1])/constants[0])*log(constants[6]/states[37]) algebraic[104] = (constants[43]*(power(algebraic[77]-algebraic[98], 4.00000)))/(power(algebraic[77]-algebraic[98], 4.00000)+power(87.8251, 4.00000)) algebraic[106] = (states[33]-states[31])/constants[65] rates[31] = -(((3.00000*algebraic[65]+3.00000*algebraic[48]+algebraic[80]+algebraic[84]+algebraic[74])*constants[88])/constants[89]-(algebraic[104]+(algebraic[106]*constants[92])/constants[89])) rates[33] = -((3.00000*algebraic[66]*constants[88])/constants[92]+algebraic[106]) algebraic[0] = floor(voi/constants[10])*constants[10] algebraic[13] = custom_piecewise([greater_equal(voi-algebraic[0] , constants[9]) & less_equal(voi-algebraic[0] , constants[9]+constants[11]), constants[12] , True, 0.00000]) algebraic[90] = ((constants[2]*constants[1])/constants[0])*log(constants[3]/states[36]) algebraic[100] = 1.02000/(1.00000+exp(0.238500*((states[0]-algebraic[90])-59.2150))) algebraic[101] = (0.491240*exp(0.0803200*((states[0]-algebraic[90])+5.47600))+exp(0.0617500*((states[0]-algebraic[90])-594.310)))/(1.00000+exp(-0.514300*((states[0]-algebraic[90])+4.75300))) algebraic[102] = algebraic[100]/(algebraic[100]+algebraic[101]) algebraic[103] = constants[83]*algebraic[102]*(states[0]-algebraic[90]) algebraic[67] = 1.00000/(1.00000+exp((7.48800-states[0])/5.98000)) algebraic[93] = constants[32]*algebraic[67]*(states[0]-algebraic[90]) algebraic[25] = 0.0826000*(1.00000+0.600000/(1.00000+power(3.80000e-05/states[18], 1.40000))) algebraic[30] = states[16]+states[17] algebraic[95] = ((constants[2]*constants[1])/constants[0])*log((constants[3]+constants[42]*constants[5])/(states[36]+constants[42]*states[31])) algebraic[97] = algebraic[25]*algebraic[30]*(states[0]-algebraic[95]) algebraic[107] = 1.00000/(1.00000+exp((states[0]+10.0000)/15.4000)) algebraic[108] = constants[84]*states[38]*algebraic[107]*(states[0]-algebraic[90]) algebraic[109] = exp(states[0]/550.000) algebraic[110] = constants[45]*(power(states[39], 3.00000))*states[40]*states[41]*algebraic[109]*(states[0]-algebraic[90]) algebraic[105] = (constants[44]*(algebraic[90]-algebraic[98]))/((algebraic[90]+87.8251)-algebraic[98]) rates[36] = -((((algebraic[97]+algebraic[108]+algebraic[103]+algebraic[110]+algebraic[93]+algebraic[13])-2.00000*algebraic[48])*constants[88])/constants[89]-algebraic[105]) algebraic[70] = (algebraic[37]+algebraic[69]+algebraic[68])-2.00000*(algebraic[65]+algebraic[66]) algebraic[87] = algebraic[80]+3.00000*(algebraic[65]+algebraic[66])+3.00000*algebraic[48]+algebraic[84]+algebraic[74] algebraic[111] = algebraic[108]+algebraic[97]+algebraic[103]+algebraic[93]+-2.00000*algebraic[48]+algebraic[110]+algebraic[13] algebraic[112] = (((constants[46]*(power(constants[47], 2.00000))*states[0]*(power(constants[0], 2.00000)))/(constants[2]*constants[1]))*(states[37]-constants[6]*exp((states[0]*constants[0])/(constants[2]*constants[1]))))/(1.00000-exp((states[0]*constants[0])/(constants[2]*constants[1]))) algebraic[113] = 1.00000-1.00000/(1.00000+power(states[42]/constants[48], 2.00000)) algebraic[114] = algebraic[112]*states[43]*algebraic[113] algebraic[99] = constants[39]*(states[0]-algebraic[98]) algebraic[115] = algebraic[99]+algebraic[114] rates[0] = -(algebraic[87]+algebraic[111]+algebraic[70]+algebraic[115]) algebraic[116] = (states[46]-states[37])/constants[65] rates[37] = -((algebraic[99]*constants[88])/(-1.00000*constants[89])-(algebraic[104]+algebraic[105]+(algebraic[116]*constants[92])/constants[89])) rates[46] = -((algebraic[114]*constants[88])/(-1.00000*constants[92])+algebraic[116]) return(rates) def computeAlgebraic(constants, states, voi): algebraic = array([[0.0] * len(voi)] * sizeAlgebraic) states = array(states) voi = array(voi) algebraic[7] = 1.00000/(1.00000+exp((states[0]+91.0000)/6.10000)) algebraic[1] = 0.0148640*exp((0.0298770*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[14] = 0.0839860*exp((-0.0554610*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[3] = (0.320000*(states[0]+47.1300))/(1.00000-exp(-0.100000*(states[0]+47.1300))) algebraic[16] = 0.0800000*exp(-states[0]/11.0000) algebraic[4] = custom_piecewise([greater_equal(states[0] , -40.0000), 0.00000 , True, 0.135000*exp((80.0000+states[0])/-6.80000)]) algebraic[17] = custom_piecewise([greater_equal(states[0] , -40.0000), 1.00000/(0.130000*(1.00000+exp((states[0]+10.6600)/-11.1000))) , True, 3.56000*exp(0.0790000*states[0])+310000.*exp(0.350000*states[0])]) algebraic[5] = custom_piecewise([greater_equal(states[0] , -40.0000), 0.00000 , True, ((-127140.*exp(0.244400*states[0])-6.94800e-05*exp(-0.0439100*states[0]))*(states[0]+37.7800))/(1.00000+exp(0.311000*(states[0]+79.2300)))]) algebraic[18] = custom_piecewise([greater_equal(states[0] , -40.0000), (0.300000*exp(-2.53500e-07*states[0]))/(1.00000+exp(-0.100000*(states[0]+32.0000))) , True, (0.121200*exp(-0.0105200*states[0]))/(1.00000+exp(-0.137800*(states[0]+40.1400)))]) algebraic[6] = (0.320000*(states[0]+47.1300))/(1.00000-exp(-0.100000*(states[0]+47.1300))) algebraic[19] = 0.0800000*exp(-states[0]/11.0000) algebraic[8] = 1.00000/(1.00000+exp(-(states[0]+10.0850)/4.25000)) algebraic[20] = 1.00000/((0.000600000*(states[0]-1.73840))/(1.00000-exp(-0.136000*(states[0]-1.73840)))+(0.000300000*(states[0]+38.3608))/(exp(0.152200*(states[0]+38.3608))-1.00000)) algebraic[22] = 0.0250000/(1.00000+exp((states[0]+58.0000)/5.00000)) algebraic[10] = 1.00000/(9.79530*(1.00000+exp((states[0]+19.0000)/-9.00000))) algebraic[23] = 1.00000/(250.000*(1.00000+exp((states[0]+60.0000)/5.00000))) algebraic[11] = 1.00000/(9.79530*(1.00000+exp((states[0]+19.0000)/-9.00000))) algebraic[24] = 0.0250000/(1.00000+exp((states[0]+58.0000)/5.00000)) algebraic[12] = 1.00000/(5.00000*(1.00000+exp((states[0]+19.0000)/-9.00000))) algebraic[29] = algebraic[24]/(algebraic[24]+algebraic[12]) algebraic[31] = 0.00311730*exp((-0.426250*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[26] = 0.0146010*exp((0.244650*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[9] = 1.00000/(1.20890*(1.00000+exp((states[0]-18.4099)/-29.3814))) algebraic[21] = 3.50000/(1.00000+exp((states[0]+100.000)/29.3814)) algebraic[28] = 1.00000/(algebraic[9]+algebraic[21]) algebraic[33] = 1.00000/(1.00000+exp((states[0]+9.43700)/-7.13300)) algebraic[35] = 0.0773200*exp((-0.0647260*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[38] = 0.794050*exp((-0.0801740*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[40] = 0.586380*exp((0.282060*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[2] = 0.590000+(0.800000*exp(0.0520000*(states[0]+13.0000)))/(1.00000+exp(0.132000*(states[0]+13.0000))) algebraic[15] = 1.00000/(1.00000+exp(-(states[0]-13.5600)/9.45000)) algebraic[27] = algebraic[15]/algebraic[2] algebraic[32] = (1.00000-algebraic[15])/algebraic[2] algebraic[57] = 3.00000/(1.00000+power(0.00300000/states[27], 4.00000)) algebraic[39] = 1.00000/(1.00000/(24.8280*(1.00000+exp((states[0]+49.1000)/10.3490)))+1.00000/(30.5530*(1.00000+exp(-(states[0]+0.213000)/10.8070)))) algebraic[36] = (1.00000/(1.00000+exp((states[0]+17.5000)/3.00000))+0.250000)/1.25000 algebraic[41] = algebraic[36]/algebraic[39] algebraic[43] = (1.00000-algebraic[36])/algebraic[39] algebraic[47] = 25.0000-17.5000/(1.00000+power(0.00300000/states[27], 4.00000)) algebraic[49] = 1.00000/(algebraic[47]*(1.00000+exp(-(states[0]+0.213000)/10.8070))) algebraic[51] = 1.00000/(1.00000/(24.8280*(1.00000+exp((states[0]+49.1000)/10.3490)))+algebraic[49]) algebraic[45] = (1.00000/(1.00000+exp((states[0]+17.5000)/3.00000))+0.000100000)/1.00010 algebraic[53] = algebraic[45]/algebraic[51] algebraic[55] = (1.00000-algebraic[45])/algebraic[51] algebraic[59] = (constants[15]*algebraic[41]*algebraic[55]*algebraic[57])/(algebraic[43]*algebraic[53]*constants[14]) algebraic[73] = (states[45]-states[44])/constants[64] algebraic[76] = 1.00000/(1.00000+(constants[71]*constants[72])/(power(states[44]+constants[71], 2.00000))) algebraic[60] = 0.200000*constants[25]*((power(states[33], 3.00000))*constants[4]*exp((constants[27]*states[0]*constants[0])/(constants[2]*constants[1]))-(power(constants[5], 3.00000))*states[32]*exp(((constants[27]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1]))) algebraic[61] = 1.00000+power(constants[24]/states[32], 2.00000) algebraic[62] = 1.00000+constants[26]*exp(((constants[27]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[63] = constants[31]*(power(states[33], 3.00000))+(power(constants[29], 3.00000))*states[32]+(power(constants[28], 3.00000))*constants[4]*(1.00000+states[32]/constants[30]) algebraic[64] = constants[30]*(power(constants[5], 3.00000))*(1.00000+power(states[33]/constants[28], 3.00000))+(power(states[33], 3.00000))*constants[4]+(power(constants[5], 3.00000))*states[32] algebraic[66] = algebraic[60]/(algebraic[61]*algebraic[62]*(algebraic[63]+algebraic[64])) algebraic[75] = (states[32]-states[18])/constants[65] algebraic[79] = (states[32]-states[27])/constants[66] algebraic[83] = 1.00000/(1.00000+(constants[73]*constants[74])/(power(constants[74]+states[32], 2.00000))+(constants[75]*constants[76])/(power(constants[76]+states[32], 2.00000))) algebraic[34] = (((constants[13]*4.00000*states[0]*(power(constants[0], 2.00000)))/(constants[2]*constants[1]))*(constants[16]*states[27]*exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-constants[17]*constants[4]))/(exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-1.00000) algebraic[37] = algebraic[34]*(states[20]+states[22]) algebraic[82] = 1.00000/(1.00000+(constants[73]*constants[74])/(power(constants[74]+states[27], 2.00000))+(constants[75]*constants[76])/(power(constants[76]+states[27], 2.00000))) algebraic[81] = (constants[80]*(1.00000-states[47]))/(1.00000+constants[77]/states[32])+states[47] algebraic[68] = (constants[33]*states[18])/(constants[34]+states[18]) algebraic[69] = (((constants[35]*4.00000*states[0]*(power(constants[0], 2.00000)))/(constants[2]*constants[1]))*(constants[36]*states[18]*exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-constants[37]*constants[4]))/(exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-1.00000) algebraic[50] = 0.800000*constants[25]*((power(states[31], 3.00000))*constants[4]*exp((constants[27]*states[0]*constants[0])/(constants[2]*constants[1]))-(power(constants[5], 3.00000))*states[18]*exp(((constants[27]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1]))) algebraic[52] = 1.00000+power(constants[24]/states[18], 2.00000) algebraic[54] = 1.00000+constants[26]*exp(((constants[27]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[56] = constants[31]*(power(states[31], 3.00000))+(power(constants[29], 3.00000))*states[18]+(power(constants[28], 3.00000))*constants[4]*(1.00000+states[18]/constants[30]) algebraic[58] = constants[30]*(power(constants[5], 3.00000))*(1.00000+power(states[31]/constants[28], 3.00000))+(power(states[31], 3.00000))*constants[4]+(power(constants[5], 3.00000))*states[18] algebraic[65] = algebraic[50]/(algebraic[52]*algebraic[54]*(algebraic[56]+algebraic[58])) algebraic[89] = (constants[59]*algebraic[81]*1.00000)/(constants[62]+algebraic[81]*1.00000) algebraic[86] = (constants[61]*algebraic[81]*1.00000)/(constants[62]+algebraic[81]*1.00000) algebraic[92] = ((algebraic[86]+1.00000)*constants[60]*states[18])/((states[18]+constants[58])-algebraic[89]) algebraic[71] = (0.00437500/constants[63])*states[45] algebraic[78] = 1.00000/(1.00000+(constants[67]*constants[69])/(power(states[18]+constants[69], 2.00000))+(constants[70]*constants[68])/(power(states[18]+constants[70], 2.00000))) algebraic[85] = constants[55]/(1.00000+power(constants[56]/(1.00000*algebraic[81]), constants[54])) algebraic[88] = constants[51]*(1.00000+algebraic[85]) algebraic[91] = algebraic[88]*constants[52] algebraic[96] = (algebraic[37]*algebraic[91])/(1.00000+power(constants[50]/states[44], constants[53])) algebraic[94] = algebraic[88]/(1.00000+constants[57]/states[44]) algebraic[77] = ((constants[2]*constants[1])/constants[0])*log(constants[5]/states[31]) algebraic[80] = constants[18]*(power(states[28], 3.00000))*states[29]*states[30]*(states[0]-algebraic[77]) algebraic[42] = (constants[22]*(states[0]-constants[23])*constants[0])/(constants[2]*constants[1]) algebraic[44] = 1.00000/(1.00000+exp(-algebraic[42])) algebraic[46] = power(states[31]/(states[31]+constants[19]), 3.00000) algebraic[48] = constants[21]*algebraic[44]*constants[94]*algebraic[46] algebraic[84] = constants[40]*(power(states[34], 3.00000))*states[35]*(states[0]-algebraic[77]) algebraic[72] = (constants[0]*states[0])/(constants[2]*constants[1]) algebraic[74] = (constants[0]*constants[38]*algebraic[72]*(states[31]*exp(algebraic[72])-constants[5]))/(exp(algebraic[72])-1.00000) algebraic[98] = ((-constants[2]*constants[1])/constants[0])*log(constants[6]/states[37]) algebraic[104] = (constants[43]*(power(algebraic[77]-algebraic[98], 4.00000)))/(power(algebraic[77]-algebraic[98], 4.00000)+power(87.8251, 4.00000)) algebraic[106] = (states[33]-states[31])/constants[65] algebraic[0] = floor(voi/constants[10])*constants[10] algebraic[13] = custom_piecewise([greater_equal(voi-algebraic[0] , constants[9]) & less_equal(voi-algebraic[0] , constants[9]+constants[11]), constants[12] , True, 0.00000]) algebraic[90] = ((constants[2]*constants[1])/constants[0])*log(constants[3]/states[36]) algebraic[100] = 1.02000/(1.00000+exp(0.238500*((states[0]-algebraic[90])-59.2150))) algebraic[101] = (0.491240*exp(0.0803200*((states[0]-algebraic[90])+5.47600))+exp(0.0617500*((states[0]-algebraic[90])-594.310)))/(1.00000+exp(-0.514300*((states[0]-algebraic[90])+4.75300))) algebraic[102] = algebraic[100]/(algebraic[100]+algebraic[101]) algebraic[103] = constants[83]*algebraic[102]*(states[0]-algebraic[90]) algebraic[67] = 1.00000/(1.00000+exp((7.48800-states[0])/5.98000)) algebraic[93] = constants[32]*algebraic[67]*(states[0]-algebraic[90]) algebraic[25] = 0.0826000*(1.00000+0.600000/(1.00000+power(3.80000e-05/states[18], 1.40000))) algebraic[30] = states[16]+states[17] algebraic[95] = ((constants[2]*constants[1])/constants[0])*log((constants[3]+constants[42]*constants[5])/(states[36]+constants[42]*states[31])) algebraic[97] = algebraic[25]*algebraic[30]*(states[0]-algebraic[95]) algebraic[107] = 1.00000/(1.00000+exp((states[0]+10.0000)/15.4000)) algebraic[108] = constants[84]*states[38]*algebraic[107]*(states[0]-algebraic[90]) algebraic[109] = exp(states[0]/550.000) algebraic[110] = constants[45]*(power(states[39], 3.00000))*states[40]*states[41]*algebraic[109]*(states[0]-algebraic[90]) algebraic[105] = (constants[44]*(algebraic[90]-algebraic[98]))/((algebraic[90]+87.8251)-algebraic[98]) algebraic[70] = (algebraic[37]+algebraic[69]+algebraic[68])-2.00000*(algebraic[65]+algebraic[66]) algebraic[87] = algebraic[80]+3.00000*(algebraic[65]+algebraic[66])+3.00000*algebraic[48]+algebraic[84]+algebraic[74] algebraic[111] = algebraic[108]+algebraic[97]+algebraic[103]+algebraic[93]+-2.00000*algebraic[48]+algebraic[110]+algebraic[13] algebraic[112] = (((constants[46]*(power(constants[47], 2.00000))*states[0]*(power(constants[0], 2.00000)))/(constants[2]*constants[1]))*(states[37]-constants[6]*exp((states[0]*constants[0])/(constants[2]*constants[1]))))/(1.00000-exp((states[0]*constants[0])/(constants[2]*constants[1]))) algebraic[113] = 1.00000-1.00000/(1.00000+power(states[42]/constants[48], 2.00000)) algebraic[114] = algebraic[112]*states[43]*algebraic[113] algebraic[99] = constants[39]*(states[0]-algebraic[98]) algebraic[115] = algebraic[99]+algebraic[114] algebraic[116] = (states[46]-states[37])/constants[65] 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)