# Size of variable arrays: sizeAlgebraic = 120 sizeStates = 46 sizeConstants = 99 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[93] = "Vmyo in component cell_geometry (uL)" legend_constants[94] = "Vnsr in component cell_geometry (uL)" legend_constants[89] = "Vsr in component cell_geometry (uL)" legend_constants[95] = "Vjsr in component cell_geometry (uL)" legend_constants[96] = "Vss_sr in component cell_geometry (uL)" legend_constants[97] = "Vss_CaL in component cell_geometry (uL)" legend_constants[91] = "Acap in component cell_geometry (cm2)" legend_constants[92] = "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[86] = "vcell in component cell_geometry (uL)" legend_constants[90] = "ageo in component cell_geometry (cm2)" legend_states[0] = "Vm in component membrane (mV)" legend_algebraic[12] = "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[73] = "caiont in component membrane (uA_per_uF)" legend_algebraic[90] = "naiont in component membrane (uA_per_uF)" legend_algebraic[114] = "kiont in component membrane (uA_per_uF)" legend_algebraic[118] = "clont in component membrane (uA_per_uF)" legend_algebraic[83] = "INa in component INa (uA_per_uF)" legend_algebraic[36] = "ICaL in component ICaL (uA_per_uF)" legend_algebraic[106] = "IK1 in component IK1 (uA_per_uF)" legend_algebraic[96] = "IKp in component IKp (uA_per_uF)" legend_algebraic[100] = "IKs in component IKs (uA_per_uF)" legend_algebraic[111] = "IKr in component IKr (uA_per_uF)" legend_algebraic[71] = "IpCa in component IpCa (uA_per_uF)" legend_algebraic[72] = "ICab in component ICab (uA_per_uF)" legend_algebraic[69] = "INaCa in component INaCa (uA_per_uF)" legend_algebraic[67] = "INaCa_ss_sr in component INaCa (uA_per_uF)" legend_algebraic[50] = "INaK in component INaK (uA_per_uF)" legend_algebraic[113] = "Ito1 in component Ito1 (uA_per_uF)" legend_algebraic[117] = "Ito2 in component Ito2 (uA_per_uF)" legend_algebraic[102] = "IClb in component IClb (uA_per_uF)" legend_algebraic[87] = "INaL in component INaL (uA_per_uF)" legend_algebraic[77] = "INab in component INab (uA_per_uF)" legend_algebraic[23] = "gKs in component IKs (mS_per_uF)" legend_constants[13] = "gKs_max 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_algebraic[27] = "O2 in component IKs (dimensionless)" legend_algebraic[30] = "OKs in component IKs (dimensionless)" legend_algebraic[31] = "alpha in component IKs (per_ms)" legend_algebraic[34] = "beta in component IKs (per_ms)" legend_algebraic[39] = "delta in component IKs (per_ms)" legend_algebraic[37] = "gamma in component IKs (per_ms)" legend_algebraic[42] = "eta in component IKs (per_ms)" legend_constants[85] = "theta in component IKs (per_ms)" legend_algebraic[45] = "omega in component IKs (per_ms)" legend_algebraic[48] = "psi in component IKs (per_ms)" legend_algebraic[98] = "EKs in component reversal_potentials (mV)" legend_states[17] = "Ca_i in component Ca (mM)" legend_algebraic[33] = "ICaL_max in component ICaL (uA_per_uF)" legend_constants[14] = "PCa in component ICaL (L_per_F_ms)" legend_states[18] = "C in component ICaL (dimensionless)" legend_states[19] = "O in component ICaL (dimensionless)" legend_states[20] = "C_star in component ICaL (dimensionless)" legend_states[21] = "O_star in component ICaL (dimensionless)" legend_states[22] = "CI in component ICaL (dimensionless)" legend_states[23] = "OI in component ICaL (dimensionless)" legend_states[24] = "CI_star in component ICaL (dimensionless)" legend_algebraic[1] = "OI_star in component ICaL (dimensionless)" legend_algebraic[13] = "ACT_tau in component ICaL (ms)" legend_algebraic[38] = "IV_tau in component ICaL (ms)" legend_algebraic[53] = "IV_tau_star in component ICaL (ms)" legend_algebraic[24] = "ACT_infinity in component ICaL (dimensionless)" legend_algebraic[35] = "IV_infinity in component ICaL (dimensionless)" legend_algebraic[46] = "IV_infinity_star in component ICaL (dimensionless)" legend_algebraic[51] = "IV_beta_star in component ICaL (dimensionless)" legend_algebraic[49] = "IV_beta_infinity_star in component ICaL (dimensionless)" legend_algebraic[28] = "alpha in component ICaL (per_ms)" legend_algebraic[32] = "beta in component ICaL (per_ms)" legend_algebraic[59] = "delta in component ICaL (per_ms)" legend_algebraic[40] = "x in component ICaL (per_ms)" legend_algebraic[43] = "y in component ICaL (per_ms)" legend_constants[15] = "theta in component ICaL (per_ms)" legend_algebraic[61] = "delta_I in component ICaL (per_ms)" legend_algebraic[55] = "x_star in component ICaL (per_ms)" legend_algebraic[57] = "y_star in component ICaL (per_ms)" legend_constants[16] = "theta_I in component ICaL (per_ms)" legend_constants[17] = "gamma_Cai in component ICaL (dimensionless)" legend_constants[18] = "gamma_Cao in component ICaL (dimensionless)" legend_states[25] = "Ca_ss_CaL in component Ca (mM)" legend_constants[19] = "g_Na in component INa (mS_per_uF)" legend_algebraic[80] = "ENa in component reversal_potentials (mV)" legend_states[26] = "m in component INa_m_gate (dimensionless)" legend_states[27] = "h in component INa_h_gate (dimensionless)" legend_states[28] = "j in component INa_j_gate (dimensionless)" legend_algebraic[2] = "am in component INa_m_gate (per_ms)" legend_algebraic[14] = "bm in component INa_m_gate (per_ms)" legend_algebraic[3] = "ah in component INa_h_gate (per_ms)" legend_algebraic[15] = "bh in component INa_h_gate (per_ms)" legend_algebraic[4] = "aj in component INa_j_gate (per_ms)" legend_algebraic[16] = "bj in component INa_j_gate (per_ms)" legend_constants[20] = "kmnai in component INaK (mM)" legend_constants[21] = "kmko in component INaK (mM)" legend_constants[22] = "ibarnak in component INaK (uA_per_uF)" legend_constants[23] = "sigma in component INaK (dimensionless)" legend_constants[24] = "V_half in component INaK (mV)" legend_algebraic[41] = "phi in component INaK (dimensionless)" legend_algebraic[44] = "fv in component INaK (dimensionless)" legend_constants[98] = "PK in component INaK (dimensionless)" legend_algebraic[47] = "PNa in component INaK (dimensionless)" legend_states[29] = "Na_i in component Na (mM)" legend_algebraic[68] = "INaCa_cai in component INaCa (uA_per_uF)" legend_constants[25] = "KmCa_act in component INaCa (mM)" legend_constants[26] = "Vmax in component INaCa (uA_per_uF)" legend_constants[27] = "ksat in component INaCa (dimensionless)" legend_constants[28] = "eta in component INaCa (dimensionless)" legend_constants[29] = "KmNai in component INaCa (mM)" legend_constants[30] = "KmNao in component INaCa (mM)" legend_constants[31] = "KmCai in component INaCa (mM)" legend_constants[32] = "KmCao in component INaCa (mM)" legend_states[30] = "Ca_ss_sr in component Ca (mM)" legend_states[31] = "Na_ss_sr in component Na (mM)" legend_algebraic[52] = "numerator in component INaCa (mM4_uA_per_uF)" legend_algebraic[62] = "num_ss in component INaCa (mM4_uA_per_uF)" legend_algebraic[54] = "denom_1 in component INaCa (dimensionless)" legend_algebraic[56] = "denom_2 in component INaCa (dimensionless)" legend_algebraic[58] = "denom_3 in component INaCa (mM4)" legend_algebraic[60] = "denom_4 in component INaCa (mM4)" legend_algebraic[63] = "denom_ss_1 in component INaCa (dimensionless)" legend_algebraic[64] = "denom_ss_2 in component INaCa (dimensionless)" legend_algebraic[65] = "denom_ss_3 in component INaCa (mM4)" legend_algebraic[66] = "denom_ss_4 in component INaCa (mM4)" legend_constants[33] = "gKp in component IKp (mS_per_uF)" legend_algebraic[70] = "Kp in component IKp (dimensionless)" legend_algebraic[93] = "EK in component reversal_potentials (mV)" legend_constants[34] = "gpCa in component IpCa (uA_per_uF)" legend_constants[35] = "KmpCa in component IpCa (mM)" legend_constants[36] = "PCab in component ICab (L_per_F_ms)" legend_constants[37] = "gamma_Ca_i in component ICab (dimensionless)" legend_constants[38] = "gamma_Ca_o in component ICab (dimensionless)" legend_constants[39] = "PNab in component INab (L_per_F_ms)" legend_algebraic[75] = "phi in component INab (dimensionless)" legend_constants[40] = "gClb in component IClb (mS_per_uF)" legend_algebraic[101] = "ECl in component reversal_potentials (mV)" legend_constants[41] = "gNaL in component INaL (mS_per_uF)" legend_states[32] = "mL in component INaL_mL_gate (dimensionless)" legend_states[33] = "hL in component INaL_hL_gate (dimensionless)" legend_algebraic[5] = "amL in component INaL_mL_gate (per_ms)" legend_algebraic[17] = "bmL in component INaL_mL_gate (per_ms)" legend_constants[42] = "tau_hL in component INaL_hL_gate (ms)" legend_algebraic[6] = "hL_infinity in component INaL_hL_gate (dimensionless)" legend_constants[43] = "prnak in component reversal_potentials (dimensionless)" legend_states[34] = "K_i in component K (mM)" legend_states[35] = "Cl_i in component Cl (mM)" legend_constants[44] = "g_K1_max in component IK1 (mS_per_uF)" legend_constants[87] = "gK1 in component IK1 (mS_per_uF)" legend_algebraic[105] = "K1 in component IK1_K1_gate (dimensionless)" legend_algebraic[103] = "alpha_k1 in component IK1_K1_gate (dimensionless)" legend_algebraic[104] = "beta_k1 in component IK1_K1_gate (dimensionless)" legend_algebraic[107] = "CT_Na_Cl in component CT_Na_Cl (mM_per_ms)" legend_constants[45] = "CT_Na_Cl_max in component CT_Na_Cl (mM_per_ms)" legend_algebraic[108] = "CT_K_Cl in component CT_K_Cl (mM_per_ms)" legend_constants[46] = "CT_K_Cl_max in component CT_K_Cl (mM_per_ms)" legend_constants[88] = "gKr in component IKr (mS_per_uF)" legend_constants[47] = "gKr_max in component IKr (mS_per_uF)" legend_algebraic[110] = "r in component IKr_r_gate (dimensionless)" legend_states[36] = "xr in component IKr_xr_gate (dimensionless)" legend_algebraic[7] = "xr_infinity in component IKr_xr_gate (dimensionless)" legend_algebraic[18] = "tau_xr in component IKr_xr_gate (ms)" legend_constants[48] = "gto1 in component Ito1 (mS_per_uF)" legend_algebraic[112] = "rto1 in component Ito1 (dimensionless)" legend_states[37] = "a in component Ito1_a_gate (dimensionless)" legend_states[38] = "i1f in component Ito1_i1f_gate (dimensionless)" legend_states[39] = "i1s in component Ito1_i1s_gate (dimensionless)" legend_algebraic[8] = "alpha_a in component Ito1_a_gate (per_ms)" legend_algebraic[19] = "beta_a in component Ito1_a_gate (per_ms)" legend_algebraic[25] = "tau_a in component Ito1_a_gate (ms)" legend_algebraic[29] = "a_infinity in component Ito1_a_gate (dimensionless)" legend_algebraic[20] = "alpha_i1f in component Ito1_i1f_gate (per_ms)" legend_algebraic[9] = "beta_i1f in component Ito1_i1f_gate (per_ms)" legend_algebraic[21] = "alpha_i1s in component Ito1_i1s_gate (per_ms)" legend_algebraic[10] = "beta_i1s in component Ito1_i1s_gate (per_ms)" legend_constants[49] = "PCl in component Ito2 (L_per_F_ms)" legend_constants[50] = "zCl in component Ito2 (dimensionless)" legend_algebraic[115] = "Ito2_max in component Ito2 (uA_per_uF)" legend_constants[51] = "Ito2_max_scaling_factor in component Ito2 (dimensionless)" legend_algebraic[116] = "KCa_ito2 in component Ito2 (dimensionless)" legend_constants[52] = "kCa_ito2 in component Ito2 (mM_per_ms)" legend_states[40] = "Irel in component Irel (mM_per_ms)" legend_states[41] = "i2f in component Ito2_i2f_gate (dimensionless)" legend_algebraic[22] = "alpha_i2f in component Ito2_i2f_gate (per_ms)" legend_algebraic[11] = "beta_i2f in component Ito2_i2f_gate (per_ms)" legend_algebraic[26] = "i2f_infinity in component Ito2_i2f_gate (dimensionless)" legend_constants[53] = "tau_i2f in component Ito2_i2f_gate (ms)" legend_algebraic[99] = "rel_infinity in component Irel (mM_per_ms)" legend_algebraic[97] = "tau_rel in component Irel (ms)" legend_constants[54] = "Krel_infinity in component Irel (mM)" legend_algebraic[94] = "alpha_rel in component Irel (mM_per_uA_per_uF_per_ms)" legend_algebraic[91] = "beta_tau in component Irel (ms)" legend_constants[55] = "beta_0 in component Irel (ms)" legend_constants[56] = "kappa in component Irel (mM_per_uA_per_uF_per_ms_per_ms)" legend_constants[57] = "h_rel in component Irel (dimensionless)" legend_constants[58] = "h_beta in component Irel (dimensionless)" legend_algebraic[88] = "delta_beta_CaMK in component Irel (dimensionless)" legend_constants[59] = "delta_beta_0 in component Irel (dimensionless)" legend_constants[60] = "K_beta in component Irel (mM)" legend_constants[61] = "Krel_tau in component Irel (mM)" legend_states[42] = "Ca_JSR in component Ca (mM)" legend_algebraic[84] = "CaMK_active in component CaMK_active (dimensionless)" legend_algebraic[95] = "Iup in component Iup (mM_per_ms)" legend_constants[62] = "kmup in component Iup (mM)" legend_algebraic[92] = "delta_kmPLB in component Iup (mM)" legend_constants[63] = "delta_kmPLB_bar in component Iup (mM)" legend_constants[64] = "iupbar in component Iup (mM_per_ms)" legend_algebraic[89] = "delta_iupCaMK in component Iup (dimensionless)" legend_constants[65] = "delta_iupCaMK_bar in component Iup (dimensionless)" legend_constants[66] = "kmCaMK in component Iup (mM)" legend_algebraic[74] = "Ileak in component Ileak (mM_per_ms)" legend_constants[67] = "nsrbar in component Ileak (mM)" legend_states[43] = "Ca_NSR in component Ca (mM)" legend_algebraic[76] = "Itr in component Itr (mM_per_ms)" legend_constants[68] = "tautr in component Itr (ms)" legend_constants[69] = "tau_diff in component Ca (ms)" legend_constants[70] = "tau_diff_ss in component Ca (ms)" legend_algebraic[78] = "Idiff in component Ca (mM_per_ms)" legend_algebraic[82] = "Idiff_ss in component Ca (mM_per_ms)" legend_algebraic[81] = "bmyo in component Ca (dimensionless)" legend_algebraic[85] = "bss_sr in component Ca (dimensionless)" legend_algebraic[86] = "bss_cal in component Ca (dimensionless)" legend_algebraic[79] = "bcsqn in component Ca (dimensionless)" legend_constants[71] = "cmdn_bar in component Ca (mM)" legend_constants[72] = "trpn_bar in component Ca (mM)" legend_constants[73] = "km_cmdn in component Ca (mM)" legend_constants[74] = "km_trpn in component Ca (mM)" legend_constants[75] = "kmcsqn in component Ca (mM)" legend_constants[76] = "csqnbar in component Ca (mM)" legend_constants[77] = "BSRmax in component Ca (mM)" legend_constants[78] = "KmBSR in component Ca (mM)" legend_constants[79] = "BSLmax in component Ca (mM)" legend_constants[80] = "KmBSL in component Ca (mM)" legend_algebraic[109] = "Idiff_Na in component Na (mM_per_ms)" legend_states[44] = "Cl_ss in component Cl (mM)" legend_algebraic[119] = "Idiff_Cl in component Cl (mM_per_ms)" legend_constants[81] = "Km in component CaMK_active (mM)" legend_states[45] = "CaMK_trap in component CaMK_active (dimensionless)" legend_constants[82] = "alpha_CaMK in component CaMK_active (per_ms)" legend_constants[83] = "beta_CaMK in component CaMK_active (per_ms)" legend_constants[84] = "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[18] = "d/dt C in component ICaL (dimensionless)" legend_rates[19] = "d/dt O in component ICaL (dimensionless)" legend_rates[20] = "d/dt C_star in component ICaL (dimensionless)" legend_rates[21] = "d/dt O_star in component ICaL (dimensionless)" legend_rates[22] = "d/dt CI in component ICaL (dimensionless)" legend_rates[23] = "d/dt OI in component ICaL (dimensionless)" legend_rates[24] = "d/dt CI_star in component ICaL (dimensionless)" legend_rates[26] = "d/dt m in component INa_m_gate (dimensionless)" legend_rates[27] = "d/dt h in component INa_h_gate (dimensionless)" legend_rates[28] = "d/dt j in component INa_j_gate (dimensionless)" legend_rates[32] = "d/dt mL in component INaL_mL_gate (dimensionless)" legend_rates[33] = "d/dt hL in component INaL_hL_gate (dimensionless)" legend_rates[36] = "d/dt xr in component IKr_xr_gate (dimensionless)" legend_rates[37] = "d/dt a in component Ito1_a_gate (dimensionless)" legend_rates[38] = "d/dt i1f in component Ito1_i1f_gate (dimensionless)" legend_rates[39] = "d/dt i1s in component Ito1_i1s_gate (dimensionless)" legend_rates[41] = "d/dt i2f in component Ito2_i2f_gate (dimensionless)" legend_rates[40] = "d/dt Irel in component Irel (mM_per_ms)" legend_rates[17] = "d/dt Ca_i in component Ca (mM)" legend_rates[30] = "d/dt Ca_ss_sr in component Ca (mM)" legend_rates[25] = "d/dt Ca_ss_CaL in component Ca (mM)" legend_rates[43] = "d/dt Ca_NSR in component Ca (mM)" legend_rates[42] = "d/dt Ca_JSR in component Ca (mM)" legend_rates[29] = "d/dt Na_i in component Na (mM)" legend_rates[31] = "d/dt Na_ss_sr in component Na (mM)" legend_rates[35] = "d/dt Cl_i in component Cl (mM)" legend_rates[44] = "d/dt Cl_ss in component Cl (mM)" legend_rates[34] = "d/dt K_i in component K (mM)" legend_rates[45] = "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] = 96485 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.4947322902196 constants[9] = 0 constants[10] = 1000 constants[11] = 0.5 constants[12] = -80 constants[13] = 0.0826 states[1] = 0.476679784307081 states[2] = 0.255181042718489 states[3] = 0.0512272866698557 states[4] = 0.0045705849736195 states[5] = 0.000152923243503507 states[6] = 0.132814156809568 states[7] = 0.053324572164618 states[8] = 0.00713656414955778 states[9] = 0.000318368292970148 states[10] = 0.0138769647384953 states[11] = 0.00371438476499172 states[12] = 0.000248553788631871 states[13] = 0.000644426171899078 states[14] = 8.62495047666861e-5 states[15] = 1.12344645485893e-5 states[16] = 1.05292905767805e-5 states[17] = 8.38749860095482e-5 constants[14] = 0.00015552 states[18] = 0.99996982093287 states[19] = 2.26882961412491e-5 states[20] = 7.49117189549873e-6 states[21] = 1.23556404128518e-10 states[22] = 5.89853003114132e-11 states[23] = 8.01952813127322e-17 states[24] = 1.9237001017021e-9 constants[15] = 1 constants[16] = 1e-6 constants[17] = 1 constants[18] = 0.341 states[25] = 0.000119239795531548 constants[19] = 9.075 states[26] = 0.00101841101248412 states[27] = 0.991354143386887 states[28] = 0.99709036251243 constants[20] = 2.6 constants[21] = 1.5 constants[22] = 1.4 constants[23] = 1 constants[24] = -92 states[29] = 8.01031392415197 constants[25] = 0.000125 constants[26] = 4.5 constants[27] = 0.32 constants[28] = 0.27 constants[29] = 12.3 constants[30] = 87.5 constants[31] = 0.0036 constants[32] = 1.3 states[30] = 0.00011296707102434 states[31] = 8.01033434859049 constants[33] = 0.00276 constants[34] = 0.0575 constants[35] = 0.0005 constants[36] = 1.99508e-7 constants[37] = 1 constants[38] = 0.341 constants[39] = 3.2e-9 constants[40] = 0.000225 constants[41] = 0.0065 states[32] = 0.00101841101248412 states[33] = 0.319611809402137 constants[42] = 600 constants[43] = 0.01833 states[34] = 144.907134343314 states[35] = 20.6683603724432 constants[44] = 0.5 constants[45] = 2.46108e-5 constants[46] = 1.77e-5 constants[47] = 0.0138542 states[36] = 4.06959064407486e-6 constants[48] = 0.497458 states[37] = 1.76776038804228e-5 states[38] = 0.997976503910799 states[39] = 0.947581184798815 constants[49] = 9e-7 constants[50] = -1 constants[51] = 1 constants[52] = 0.4 states[40] = 0.000714227102027745 states[41] = 0.996044894628276 constants[53] = 8 constants[54] = 1 constants[55] = 4.75 constants[56] = 0.1125 constants[57] = 8 constants[58] = 10 constants[59] = 1 constants[60] = 0.28 constants[61] = 0.0123 states[42] = 0.993914988616979 constants[62] = 0.00092 constants[63] = 0.00017 constants[64] = 0.004375 constants[65] = 0.75 constants[66] = 0.15 constants[67] = 15 states[43] = 1.01475649943057 constants[68] = 25 constants[69] = 0.2 constants[70] = 2 constants[71] = 0.05 constants[72] = 0.07 constants[73] = 0.00238 constants[74] = 0.0005 constants[75] = 0.8 constants[76] = 10 constants[77] = 0.047 constants[78] = 0.00087 constants[79] = 1.124 constants[80] = 0.0087 states[44] = 20.6683605553303 constants[81] = 0.0015 states[45] = 0.0114911034744777 constants[82] = 0.05 constants[83] = 0.00068 constants[84] = 0.05 constants[85] = 0.0895383 constants[86] = 1000.00* pi*constants[8]*constants[8]*constants[7] constants[87] = constants[44]*(power(constants[3]/5.40000, 1.0/2)) constants[88] = constants[47]*(power(constants[3]/5.40000, 1.0/2)) constants[89] = constants[86]*0.0600000 constants[90] = 2.00000* pi*constants[8]*constants[8]+2.00000* pi*constants[8]*constants[7] constants[91] = constants[90]*2.00000 constants[92] = (1.00000*1.00000*constants[91])/(constants[0]*1.00000) constants[93] = constants[86]*0.678000 constants[94] = constants[86]*0.0552000 constants[95] = constants[86]*0.00480000 constants[96] = constants[86]*0.0200000 constants[97] = constants[86]*0.00200000 constants[98] = constants[3]/(constants[3]+constants[21]) return (states, constants) def computeRates(voi, states, constants): rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic algebraic[6] = 1.00000/(1.00000+exp((states[0]+91.0000)/6.10000)) rates[33] = (algebraic[6]-states[33])/constants[42] algebraic[2] = (0.320000*(states[0]+47.1300))/(1.00000-exp(-0.100000*(states[0]+47.1300))) algebraic[14] = 0.0800000*exp(-states[0]/11.0000) rates[26] = algebraic[2]*(1.00000-states[26])-algebraic[14]*states[26] algebraic[3] = custom_piecewise([greater_equal(states[0] , -40.0000), 0.00000 , True, 0.135000*exp((80.0000+states[0])/-6.80000)]) algebraic[15] = 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[27] = algebraic[3]*(1.00000-states[27])-algebraic[15]*states[27] algebraic[4] = 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[16] = 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[28] = algebraic[4]*(1.00000-states[28])-algebraic[16]*states[28] algebraic[5] = (0.320000*(states[0]+47.1300))/(1.00000-exp(-0.100000*(states[0]+47.1300))) algebraic[17] = 0.0800000*exp(-states[0]/11.0000) rates[32] = algebraic[5]*(1.00000-states[32])-algebraic[17]*states[32] algebraic[7] = 1.00000/(1.00000+exp(-(states[0]+10.0850)/4.25000)) algebraic[18] = 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[36] = (algebraic[7]-states[36])/algebraic[18] algebraic[20] = 0.0250000/(1.00000+exp((states[0]+58.0000)/5.00000)) algebraic[9] = 1.00000/(9.79530*(1.00000+exp((states[0]+19.0000)/-9.00000))) rates[38] = algebraic[20]*(1.00000-states[38])-algebraic[9]*states[38] algebraic[21] = 1.00000/(250.000*(1.00000+exp((states[0]+60.0000)/5.00000))) algebraic[10] = 1.00000/(9.79530*(1.00000+exp((states[0]+19.0000)/-9.00000))) rates[39] = algebraic[21]*(1.00000-states[39])-algebraic[10]*states[39] algebraic[22] = 0.0250000/(1.00000+exp((states[0]+58.0000)/5.00000)) algebraic[11] = 1.00000/(5.00000*(1.00000+exp((states[0]+19.0000)/-9.00000))) algebraic[26] = algebraic[22]/(algebraic[22]+algebraic[11]) rates[41] = (algebraic[26]-states[41])/constants[53] algebraic[8] = 1.00000/(1.20890*(1.00000+exp((states[0]-18.4099)/-29.3814))) algebraic[19] = 3.50000/(1.00000+exp((states[0]+100.000)/29.3814)) algebraic[25] = 1.00000/(algebraic[8]+algebraic[19]) algebraic[29] = 1.00000/(1.00000+exp((states[0]+9.43700)/-7.13300)) rates[37] = (algebraic[29]-states[37])/algebraic[25] algebraic[31] = 0.0148646*exp((0.0298773*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[34] = 0.0839863*exp((-0.0554611*states[0]*constants[0])/(constants[2]*constants[1])) rates[1] = -4.00000*algebraic[31]*states[1]+algebraic[34]*states[2] algebraic[39] = 0.00311733*exp((-0.426255*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[37] = 0.0146007*exp((0.244650*states[0]*constants[0])/(constants[2]*constants[1])) rates[2] = -(3.00000*algebraic[31]+algebraic[34]+algebraic[37])*states[2]+4.00000*algebraic[31]*states[1]+2.00000*algebraic[34]*states[3]+algebraic[39]*states[6] rates[3] = -(2.00000*algebraic[31]+2.00000*algebraic[34]+2.00000*algebraic[37])*states[3]+3.00000*algebraic[31]*states[2]+3.00000*algebraic[34]*states[4]+algebraic[39]*states[7] rates[4] = -(algebraic[31]+3.00000*algebraic[34]+3.00000*algebraic[37])*states[4]+2.00000*algebraic[31]*states[3]+4.00000*algebraic[34]*states[5]+algebraic[39]*states[8] rates[5] = -(4.00000*algebraic[34]+4.00000*algebraic[37])*states[5]+algebraic[31]*states[4]+algebraic[39]*states[9] rates[6] = -(3.00000*algebraic[31]+algebraic[39])*states[6]+algebraic[34]*states[7]+algebraic[37]*states[2] rates[7] = -(2.00000*algebraic[31]+algebraic[34]+algebraic[37]+algebraic[39])*states[7]+3.00000*algebraic[31]*states[6]+2.00000*algebraic[34]*states[8]+2.00000*algebraic[37]*states[3]+2.00000*algebraic[39]*states[10] rates[8] = -(algebraic[31]+2.00000*algebraic[34]+2.00000*algebraic[37]+algebraic[39])*states[8]+2.00000*algebraic[31]*states[7]+3.00000*algebraic[34]*states[9]+3.00000*algebraic[37]*states[4]+2.00000*algebraic[39]*states[11] rates[9] = -(3.00000*algebraic[34]+3.00000*algebraic[37]+algebraic[39])*states[9]+algebraic[31]*states[8]+4.00000*algebraic[37]*states[5]+2.00000*algebraic[39]*states[12] rates[10] = -(2.00000*algebraic[31]+2.00000*algebraic[39])*states[10]+algebraic[34]*states[11]+algebraic[37]*states[7] rates[11] = -(algebraic[31]+algebraic[34]+algebraic[37]+2.00000*algebraic[39])*states[11]+2.00000*algebraic[31]*states[10]+2.00000*algebraic[34]*states[12]+2.00000*algebraic[37]*states[8]+3.00000*algebraic[39]*states[13] rates[12] = -(2.00000*algebraic[34]+2.00000*algebraic[37]+2.00000*algebraic[39])*states[12]+algebraic[31]*states[11]+3.00000*algebraic[37]*states[9]+3.00000*algebraic[39]*states[14] rates[13] = -(algebraic[31]+3.00000*algebraic[39])*states[13]+algebraic[34]*states[14]+algebraic[37]*states[11] rates[14] = -(algebraic[34]+algebraic[37]+3.00000*algebraic[39])*states[14]+algebraic[31]*states[13]+2.00000*algebraic[37]*states[12]+4.00000*algebraic[39]*states[15] algebraic[42] = 0.0773199*exp((-0.0647261*states[0]*constants[0])/(constants[2]*constants[1])) rates[15] = -(4.00000*algebraic[39]+constants[85])*states[15]+algebraic[37]*states[14]+algebraic[42]*states[16] algebraic[27] = 1.00000-(states[1]+states[2]+states[3]+states[4]+states[5]+states[6]+states[7]+states[8]+states[9]+states[10]+states[11]+states[12]+states[13]+states[14]+states[15]+states[16]) algebraic[45] = 0.794055*exp((-0.0801738*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[48] = 0.586382*exp((0.282056*states[0]*constants[0])/(constants[2]*constants[1])) rates[16] = -(algebraic[42]+algebraic[48])*states[16]+algebraic[45]*algebraic[27]+constants[85]*states[15] algebraic[13] = 0.590000+(0.800000*exp(0.0520000*(states[0]+13.0000)))/(1.00000+exp(0.132000*(states[0]+13.0000))) algebraic[24] = 1.00000/(1.00000+exp(-(states[0]-13.5600)/9.45000)) algebraic[28] = algebraic[24]/algebraic[13] algebraic[32] = (1.00000-algebraic[24])/algebraic[13] algebraic[59] = 3.00000/(1.00000+power(0.00300000/states[25], 4.00000)) algebraic[38] = 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[35] = (1.00000/(1.00000+exp((states[0]+17.5000)/3.00000))+0.250000)/1.25000 algebraic[40] = algebraic[35]/algebraic[38] algebraic[43] = (1.00000-algebraic[35])/algebraic[38] rates[18] = -(algebraic[28]+algebraic[59]+algebraic[43])*states[18]+algebraic[32]*states[19]+constants[15]*states[20]+algebraic[40]*states[22] rates[19] = -(algebraic[32]+algebraic[59]+algebraic[43])*states[19]+algebraic[28]*states[18]+constants[15]*states[21]+algebraic[40]*states[23] algebraic[49] = 25.0000-17.5000/(1.00000+power(0.00300000/states[25], 4.00000)) algebraic[51] = 1.00000/(algebraic[49]*(1.00000+exp(-(states[0]+0.213000)/10.8070))) algebraic[53] = 1.00000/(1.00000/(24.8280*(1.00000+exp((states[0]+49.1000)/10.3490)))+algebraic[51]) algebraic[46] = (1.00000/(1.00000+exp((states[0]+17.5000)/3.00000))+0.000100000)/1.00010 algebraic[55] = algebraic[46]/algebraic[53] algebraic[57] = (1.00000-algebraic[46])/algebraic[53] rates[20] = -(algebraic[28]+constants[15]+algebraic[57])*states[20]+algebraic[59]*states[18]+algebraic[32]*states[21]+algebraic[55]*states[24] algebraic[1] = 1.00000-(states[18]+states[19]+states[20]+states[21]+states[22]+states[23]+states[24]) rates[21] = -(algebraic[32]+constants[15]+algebraic[57])*states[21]+algebraic[59]*states[19]+algebraic[28]*states[20]+algebraic[55]*algebraic[1] algebraic[61] = (constants[16]*algebraic[40]*algebraic[57]*algebraic[59])/(algebraic[43]*algebraic[55]*constants[15]) rates[22] = -(algebraic[28]+algebraic[61]+algebraic[40])*states[22]+algebraic[43]*states[18]+constants[16]*states[24]+algebraic[32]*states[23] rates[23] = -(algebraic[32]+algebraic[61]+algebraic[40])*states[23]+algebraic[43]*states[19]+constants[16]*algebraic[1]+algebraic[28]*states[22] rates[24] = -(algebraic[28]+constants[16]+algebraic[55])*states[24]+algebraic[61]*states[22]+algebraic[57]*states[20]+algebraic[32]*algebraic[1] algebraic[76] = (states[43]-states[42])/constants[68] algebraic[79] = 1.00000/(1.00000+(constants[75]*constants[76])/(power(states[42]+constants[75], 2.00000))) rates[42] = algebraic[79]*(algebraic[76]-states[40]) algebraic[62] = 0.200000*constants[26]*((power(states[31], 3.00000))*constants[4]*exp((constants[28]*states[0]*constants[0])/(constants[2]*constants[1]))-(power(constants[5], 3.00000))*states[30]*exp(((constants[28]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1]))) algebraic[63] = 1.00000+power(constants[25]/states[30], 2.00000) algebraic[64] = 1.00000+constants[27]*exp(((constants[28]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[65] = constants[32]*(power(states[31], 3.00000))+(power(constants[30], 3.00000))*states[30]+(power(constants[29], 3.00000))*constants[4]*(1.00000+states[30]/constants[31]) algebraic[66] = constants[31]*(power(constants[5], 3.00000))*(1.00000+power(states[31]/constants[29], 3.00000))+(power(states[31], 3.00000))*constants[4]+(power(constants[5], 3.00000))*states[30] algebraic[67] = algebraic[62]/(algebraic[63]*algebraic[64]*(algebraic[65]+algebraic[66])) algebraic[78] = (states[30]-states[17])/constants[69] algebraic[82] = (states[30]-states[25])/constants[70] algebraic[85] = 1.00000/(1.00000+(constants[77]*constants[78])/(power(constants[78]+states[30], 2.00000))+(constants[79]*constants[80])/(power(constants[80]+states[30], 2.00000))) rates[30] = -algebraic[85]*((algebraic[78]+algebraic[82])-((2.00000*algebraic[67]*constants[92])/(2.00000*constants[96])+(states[40]*constants[95])/constants[96])) algebraic[33] = (((constants[14]*4.00000*states[0]*(power(constants[0], 2.00000)))/(constants[2]*constants[1]))*(constants[17]*states[25]*exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-constants[18]*constants[4]))/(exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-1.00000) algebraic[36] = algebraic[33]*(states[19]+states[21]) algebraic[86] = 1.00000/(1.00000+(constants[77]*constants[78])/(power(constants[78]+states[25], 2.00000))+(constants[79]*constants[80])/(power(constants[80]+states[25], 2.00000))) rates[25] = -algebraic[86]*((algebraic[36]*constants[92])/(2.00000*constants[97])-(algebraic[82]*constants[96])/constants[97]) algebraic[84] = (constants[84]*(1.00000-states[45]))/(1.00000+constants[81]/states[30])+states[45] rates[45] = constants[82]*algebraic[84]*(algebraic[84]-states[45])-constants[83]*states[45] algebraic[71] = (constants[34]*states[17])/(constants[35]+states[17]) algebraic[72] = (((constants[36]*4.00000*states[0]*(power(constants[0], 2.00000)))/(constants[2]*constants[1]))*(constants[37]*states[17]*exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-constants[38]*constants[4]))/(exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-1.00000) algebraic[52] = 0.800000*constants[26]*((power(states[29], 3.00000))*constants[4]*exp((constants[28]*states[0]*constants[0])/(constants[2]*constants[1]))-(power(constants[5], 3.00000))*states[17]*exp(((constants[28]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1]))) algebraic[54] = 1.00000+power(constants[25]/states[17], 2.00000) algebraic[56] = 1.00000+constants[27]*exp(((constants[28]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[58] = constants[32]*(power(states[29], 3.00000))+(power(constants[30], 3.00000))*states[17]+(power(constants[29], 3.00000))*constants[4]*(1.00000+states[17]/constants[31]) algebraic[60] = constants[31]*(power(constants[5], 3.00000))*(1.00000+power(states[29]/constants[29], 3.00000))+(power(states[29], 3.00000))*constants[4]+(power(constants[5], 3.00000))*states[17] algebraic[68] = algebraic[52]/(algebraic[54]*algebraic[56]*(algebraic[58]+algebraic[60])) algebraic[69] = algebraic[68]+algebraic[67] algebraic[92] = (constants[63]*algebraic[84]*1.00000)/(constants[66]+algebraic[84]*1.00000) algebraic[89] = (constants[65]*algebraic[84]*1.00000)/(constants[66]+algebraic[84]*1.00000) algebraic[95] = ((algebraic[89]+1.00000)*constants[64]*states[17])/((states[17]+constants[62])-algebraic[92]) algebraic[74] = (0.00437500/constants[67])*states[43] algebraic[81] = 1.00000/(1.00000+(constants[71]*constants[73])/(power(states[17]+constants[73], 2.00000))+(constants[74]*constants[72])/(power(states[17]+constants[74], 2.00000))) rates[17] = algebraic[81]*((-((algebraic[72]+algebraic[71])-2.00000*algebraic[69])*constants[92])/(constants[93]*2.00000)+((algebraic[74]-algebraic[95])*constants[94])/constants[93]+(algebraic[78]*constants[96])/constants[93]) rates[43] = algebraic[95]-(algebraic[74]+(algebraic[76]*constants[95])/constants[94]) algebraic[88] = constants[59]/(1.00000+power(constants[60]/(1.00000*algebraic[84]), constants[58])) algebraic[91] = constants[55]*(1.00000+algebraic[88]) algebraic[94] = algebraic[91]*constants[56] algebraic[99] = (algebraic[36]*algebraic[94])/(1.00000+power(constants[54]/states[42], constants[57])) algebraic[97] = algebraic[91]/(1.00000+constants[61]/states[42]) rates[40] = -(algebraic[99]+states[40])/algebraic[97] algebraic[80] = ((constants[2]*constants[1])/constants[0])*log(constants[5]/states[29]) algebraic[83] = constants[19]*(power(states[26], 3.00000))*states[27]*states[28]*(states[0]-algebraic[80]) algebraic[41] = (constants[23]*(states[0]-constants[24])*constants[0])/(constants[2]*constants[1]) algebraic[44] = 1.00000/(1.00000+exp(-algebraic[41])) algebraic[47] = power(states[29]/(states[29]+constants[20]), 3.00000) algebraic[50] = constants[22]*algebraic[44]*constants[98]*algebraic[47] algebraic[87] = constants[41]*(power(states[32], 3.00000))*states[33]*(states[0]-algebraic[80]) algebraic[75] = (constants[0]*states[0])/(constants[2]*constants[1]) algebraic[77] = (constants[0]*constants[39]*algebraic[75]*(states[29]*exp(algebraic[75])-constants[5]))/(exp(algebraic[75])-1.00000) algebraic[101] = ((-constants[2]*constants[1])/constants[0])*log(constants[6]/states[35]) algebraic[107] = (constants[45]*(power(algebraic[80]-algebraic[101], 4.00000)))/(power(algebraic[80]-algebraic[101], 4.00000)+power(87.8251, 4.00000)) algebraic[109] = (states[31]-states[29])/constants[69] rates[29] = -(((3.00000*algebraic[69]+3.00000*algebraic[50]+algebraic[83]+algebraic[87]+algebraic[77])*constants[92])/constants[93]-(algebraic[107]+(algebraic[109]*constants[96])/constants[93])) rates[31] = -((3.00000*algebraic[67]*constants[92])/constants[96]+algebraic[109]) algebraic[0] = floor(voi/constants[10])*constants[10] algebraic[12] = custom_piecewise([greater_equal(voi-algebraic[0] , constants[9]) & less_equal(voi-algebraic[0] , constants[9]+constants[11]), constants[12] , True, 0.00000]) algebraic[93] = ((constants[2]*constants[1])/constants[0])*log(constants[3]/states[34]) algebraic[103] = 1.02000/(1.00000+exp(0.238500*((states[0]-algebraic[93])-59.2150))) algebraic[104] = (0.491240*exp(0.0803200*((states[0]-algebraic[93])+5.47600))+exp(0.0617500*((states[0]-algebraic[93])-594.310)))/(1.00000+exp(-0.514300*((states[0]-algebraic[93])+4.75300))) algebraic[105] = algebraic[103]/(algebraic[103]+algebraic[104]) algebraic[106] = constants[87]*algebraic[105]*(states[0]-algebraic[93]) algebraic[70] = 1.00000/(1.00000+exp((7.48800-states[0])/5.98000)) algebraic[96] = constants[33]*algebraic[70]*(states[0]-algebraic[93]) algebraic[23] = constants[13]*(1.00000+0.600000/(1.00000+power(3.80000e-05/states[17], 1.40000))) algebraic[30] = states[16]+algebraic[27] algebraic[98] = ((constants[2]*constants[1])/constants[0])*log((constants[3]+constants[43]*constants[5])/(states[34]+constants[43]*states[29])) algebraic[100] = algebraic[23]*algebraic[30]*(states[0]-algebraic[98]) algebraic[110] = 1.00000/(1.00000+exp((states[0]+10.0000)/15.4000)) algebraic[111] = constants[88]*states[36]*algebraic[110]*(states[0]-algebraic[93]) algebraic[112] = exp(states[0]/550.000) algebraic[113] = constants[48]*(power(states[37], 3.00000))*states[38]*states[39]*algebraic[112]*(states[0]-algebraic[93]) algebraic[108] = (constants[46]*(algebraic[93]-algebraic[101]))/((algebraic[93]+87.8251)-algebraic[101]) rates[34] = -((((algebraic[100]+algebraic[111]+algebraic[106]+algebraic[113]+algebraic[96]+algebraic[12])-2.00000*algebraic[50])*constants[92])/constants[93]-algebraic[108]) algebraic[73] = (algebraic[36]+algebraic[72]+algebraic[71])-2.00000*(algebraic[69]+algebraic[67]) algebraic[90] = algebraic[83]+3.00000*(algebraic[69]+algebraic[67])+3.00000*algebraic[50]+algebraic[87]+algebraic[77] algebraic[114] = algebraic[111]+algebraic[100]+algebraic[106]+algebraic[96]+-2.00000*algebraic[50]+algebraic[113]+algebraic[12] algebraic[115] = (((constants[49]*(power(constants[50], 2.00000))*states[0]*(power(constants[0], 2.00000)))/(constants[2]*constants[1]))*(states[35]-constants[6]*exp((states[0]*constants[0])/(constants[2]*constants[1]))))/(1.00000-exp((states[0]*constants[0])/(constants[2]*constants[1]))) algebraic[116] = 1.00000-1.00000/(1.00000+power(states[40]/constants[52], 2.00000)) algebraic[117] = algebraic[115]*constants[51]*states[41]*algebraic[116] algebraic[102] = constants[40]*(states[0]-algebraic[101]) algebraic[118] = algebraic[102]+algebraic[117] rates[0] = -(algebraic[90]+algebraic[114]+algebraic[73]+algebraic[118]) algebraic[119] = (states[44]-states[35])/constants[69] rates[35] = -((algebraic[102]*constants[92])/(-1.00000*constants[93])-(algebraic[107]+algebraic[108]+(algebraic[119]*constants[96])/constants[93])) rates[44] = -((algebraic[117]*constants[92])/(-1.00000*constants[96])+algebraic[119]) return(rates) def computeAlgebraic(constants, states, voi): algebraic = array([[0.0] * len(voi)] * sizeAlgebraic) states = array(states) voi = array(voi) algebraic[6] = 1.00000/(1.00000+exp((states[0]+91.0000)/6.10000)) algebraic[2] = (0.320000*(states[0]+47.1300))/(1.00000-exp(-0.100000*(states[0]+47.1300))) algebraic[14] = 0.0800000*exp(-states[0]/11.0000) algebraic[3] = custom_piecewise([greater_equal(states[0] , -40.0000), 0.00000 , True, 0.135000*exp((80.0000+states[0])/-6.80000)]) algebraic[15] = 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[4] = 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[16] = 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[5] = (0.320000*(states[0]+47.1300))/(1.00000-exp(-0.100000*(states[0]+47.1300))) algebraic[17] = 0.0800000*exp(-states[0]/11.0000) algebraic[7] = 1.00000/(1.00000+exp(-(states[0]+10.0850)/4.25000)) algebraic[18] = 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[20] = 0.0250000/(1.00000+exp((states[0]+58.0000)/5.00000)) algebraic[9] = 1.00000/(9.79530*(1.00000+exp((states[0]+19.0000)/-9.00000))) algebraic[21] = 1.00000/(250.000*(1.00000+exp((states[0]+60.0000)/5.00000))) algebraic[10] = 1.00000/(9.79530*(1.00000+exp((states[0]+19.0000)/-9.00000))) algebraic[22] = 0.0250000/(1.00000+exp((states[0]+58.0000)/5.00000)) algebraic[11] = 1.00000/(5.00000*(1.00000+exp((states[0]+19.0000)/-9.00000))) algebraic[26] = algebraic[22]/(algebraic[22]+algebraic[11]) algebraic[8] = 1.00000/(1.20890*(1.00000+exp((states[0]-18.4099)/-29.3814))) algebraic[19] = 3.50000/(1.00000+exp((states[0]+100.000)/29.3814)) algebraic[25] = 1.00000/(algebraic[8]+algebraic[19]) algebraic[29] = 1.00000/(1.00000+exp((states[0]+9.43700)/-7.13300)) algebraic[31] = 0.0148646*exp((0.0298773*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[34] = 0.0839863*exp((-0.0554611*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[39] = 0.00311733*exp((-0.426255*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[37] = 0.0146007*exp((0.244650*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[42] = 0.0773199*exp((-0.0647261*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[27] = 1.00000-(states[1]+states[2]+states[3]+states[4]+states[5]+states[6]+states[7]+states[8]+states[9]+states[10]+states[11]+states[12]+states[13]+states[14]+states[15]+states[16]) algebraic[45] = 0.794055*exp((-0.0801738*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[48] = 0.586382*exp((0.282056*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[13] = 0.590000+(0.800000*exp(0.0520000*(states[0]+13.0000)))/(1.00000+exp(0.132000*(states[0]+13.0000))) algebraic[24] = 1.00000/(1.00000+exp(-(states[0]-13.5600)/9.45000)) algebraic[28] = algebraic[24]/algebraic[13] algebraic[32] = (1.00000-algebraic[24])/algebraic[13] algebraic[59] = 3.00000/(1.00000+power(0.00300000/states[25], 4.00000)) algebraic[38] = 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[35] = (1.00000/(1.00000+exp((states[0]+17.5000)/3.00000))+0.250000)/1.25000 algebraic[40] = algebraic[35]/algebraic[38] algebraic[43] = (1.00000-algebraic[35])/algebraic[38] algebraic[49] = 25.0000-17.5000/(1.00000+power(0.00300000/states[25], 4.00000)) algebraic[51] = 1.00000/(algebraic[49]*(1.00000+exp(-(states[0]+0.213000)/10.8070))) algebraic[53] = 1.00000/(1.00000/(24.8280*(1.00000+exp((states[0]+49.1000)/10.3490)))+algebraic[51]) algebraic[46] = (1.00000/(1.00000+exp((states[0]+17.5000)/3.00000))+0.000100000)/1.00010 algebraic[55] = algebraic[46]/algebraic[53] algebraic[57] = (1.00000-algebraic[46])/algebraic[53] algebraic[1] = 1.00000-(states[18]+states[19]+states[20]+states[21]+states[22]+states[23]+states[24]) algebraic[61] = (constants[16]*algebraic[40]*algebraic[57]*algebraic[59])/(algebraic[43]*algebraic[55]*constants[15]) algebraic[76] = (states[43]-states[42])/constants[68] algebraic[79] = 1.00000/(1.00000+(constants[75]*constants[76])/(power(states[42]+constants[75], 2.00000))) algebraic[62] = 0.200000*constants[26]*((power(states[31], 3.00000))*constants[4]*exp((constants[28]*states[0]*constants[0])/(constants[2]*constants[1]))-(power(constants[5], 3.00000))*states[30]*exp(((constants[28]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1]))) algebraic[63] = 1.00000+power(constants[25]/states[30], 2.00000) algebraic[64] = 1.00000+constants[27]*exp(((constants[28]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[65] = constants[32]*(power(states[31], 3.00000))+(power(constants[30], 3.00000))*states[30]+(power(constants[29], 3.00000))*constants[4]*(1.00000+states[30]/constants[31]) algebraic[66] = constants[31]*(power(constants[5], 3.00000))*(1.00000+power(states[31]/constants[29], 3.00000))+(power(states[31], 3.00000))*constants[4]+(power(constants[5], 3.00000))*states[30] algebraic[67] = algebraic[62]/(algebraic[63]*algebraic[64]*(algebraic[65]+algebraic[66])) algebraic[78] = (states[30]-states[17])/constants[69] algebraic[82] = (states[30]-states[25])/constants[70] algebraic[85] = 1.00000/(1.00000+(constants[77]*constants[78])/(power(constants[78]+states[30], 2.00000))+(constants[79]*constants[80])/(power(constants[80]+states[30], 2.00000))) algebraic[33] = (((constants[14]*4.00000*states[0]*(power(constants[0], 2.00000)))/(constants[2]*constants[1]))*(constants[17]*states[25]*exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-constants[18]*constants[4]))/(exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-1.00000) algebraic[36] = algebraic[33]*(states[19]+states[21]) algebraic[86] = 1.00000/(1.00000+(constants[77]*constants[78])/(power(constants[78]+states[25], 2.00000))+(constants[79]*constants[80])/(power(constants[80]+states[25], 2.00000))) algebraic[84] = (constants[84]*(1.00000-states[45]))/(1.00000+constants[81]/states[30])+states[45] algebraic[71] = (constants[34]*states[17])/(constants[35]+states[17]) algebraic[72] = (((constants[36]*4.00000*states[0]*(power(constants[0], 2.00000)))/(constants[2]*constants[1]))*(constants[37]*states[17]*exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-constants[38]*constants[4]))/(exp((2.00000*states[0]*constants[0])/(constants[2]*constants[1]))-1.00000) algebraic[52] = 0.800000*constants[26]*((power(states[29], 3.00000))*constants[4]*exp((constants[28]*states[0]*constants[0])/(constants[2]*constants[1]))-(power(constants[5], 3.00000))*states[17]*exp(((constants[28]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1]))) algebraic[54] = 1.00000+power(constants[25]/states[17], 2.00000) algebraic[56] = 1.00000+constants[27]*exp(((constants[28]-1.00000)*states[0]*constants[0])/(constants[2]*constants[1])) algebraic[58] = constants[32]*(power(states[29], 3.00000))+(power(constants[30], 3.00000))*states[17]+(power(constants[29], 3.00000))*constants[4]*(1.00000+states[17]/constants[31]) algebraic[60] = constants[31]*(power(constants[5], 3.00000))*(1.00000+power(states[29]/constants[29], 3.00000))+(power(states[29], 3.00000))*constants[4]+(power(constants[5], 3.00000))*states[17] algebraic[68] = algebraic[52]/(algebraic[54]*algebraic[56]*(algebraic[58]+algebraic[60])) algebraic[69] = algebraic[68]+algebraic[67] algebraic[92] = (constants[63]*algebraic[84]*1.00000)/(constants[66]+algebraic[84]*1.00000) algebraic[89] = (constants[65]*algebraic[84]*1.00000)/(constants[66]+algebraic[84]*1.00000) algebraic[95] = ((algebraic[89]+1.00000)*constants[64]*states[17])/((states[17]+constants[62])-algebraic[92]) algebraic[74] = (0.00437500/constants[67])*states[43] algebraic[81] = 1.00000/(1.00000+(constants[71]*constants[73])/(power(states[17]+constants[73], 2.00000))+(constants[74]*constants[72])/(power(states[17]+constants[74], 2.00000))) algebraic[88] = constants[59]/(1.00000+power(constants[60]/(1.00000*algebraic[84]), constants[58])) algebraic[91] = constants[55]*(1.00000+algebraic[88]) algebraic[94] = algebraic[91]*constants[56] algebraic[99] = (algebraic[36]*algebraic[94])/(1.00000+power(constants[54]/states[42], constants[57])) algebraic[97] = algebraic[91]/(1.00000+constants[61]/states[42]) algebraic[80] = ((constants[2]*constants[1])/constants[0])*log(constants[5]/states[29]) algebraic[83] = constants[19]*(power(states[26], 3.00000))*states[27]*states[28]*(states[0]-algebraic[80]) algebraic[41] = (constants[23]*(states[0]-constants[24])*constants[0])/(constants[2]*constants[1]) algebraic[44] = 1.00000/(1.00000+exp(-algebraic[41])) algebraic[47] = power(states[29]/(states[29]+constants[20]), 3.00000) algebraic[50] = constants[22]*algebraic[44]*constants[98]*algebraic[47] algebraic[87] = constants[41]*(power(states[32], 3.00000))*states[33]*(states[0]-algebraic[80]) algebraic[75] = (constants[0]*states[0])/(constants[2]*constants[1]) algebraic[77] = (constants[0]*constants[39]*algebraic[75]*(states[29]*exp(algebraic[75])-constants[5]))/(exp(algebraic[75])-1.00000) algebraic[101] = ((-constants[2]*constants[1])/constants[0])*log(constants[6]/states[35]) algebraic[107] = (constants[45]*(power(algebraic[80]-algebraic[101], 4.00000)))/(power(algebraic[80]-algebraic[101], 4.00000)+power(87.8251, 4.00000)) algebraic[109] = (states[31]-states[29])/constants[69] algebraic[0] = floor(voi/constants[10])*constants[10] algebraic[12] = custom_piecewise([greater_equal(voi-algebraic[0] , constants[9]) & less_equal(voi-algebraic[0] , constants[9]+constants[11]), constants[12] , True, 0.00000]) algebraic[93] = ((constants[2]*constants[1])/constants[0])*log(constants[3]/states[34]) algebraic[103] = 1.02000/(1.00000+exp(0.238500*((states[0]-algebraic[93])-59.2150))) algebraic[104] = (0.491240*exp(0.0803200*((states[0]-algebraic[93])+5.47600))+exp(0.0617500*((states[0]-algebraic[93])-594.310)))/(1.00000+exp(-0.514300*((states[0]-algebraic[93])+4.75300))) algebraic[105] = algebraic[103]/(algebraic[103]+algebraic[104]) algebraic[106] = constants[87]*algebraic[105]*(states[0]-algebraic[93]) algebraic[70] = 1.00000/(1.00000+exp((7.48800-states[0])/5.98000)) algebraic[96] = constants[33]*algebraic[70]*(states[0]-algebraic[93]) algebraic[23] = constants[13]*(1.00000+0.600000/(1.00000+power(3.80000e-05/states[17], 1.40000))) algebraic[30] = states[16]+algebraic[27] algebraic[98] = ((constants[2]*constants[1])/constants[0])*log((constants[3]+constants[43]*constants[5])/(states[34]+constants[43]*states[29])) algebraic[100] = algebraic[23]*algebraic[30]*(states[0]-algebraic[98]) algebraic[110] = 1.00000/(1.00000+exp((states[0]+10.0000)/15.4000)) algebraic[111] = constants[88]*states[36]*algebraic[110]*(states[0]-algebraic[93]) algebraic[112] = exp(states[0]/550.000) algebraic[113] = constants[48]*(power(states[37], 3.00000))*states[38]*states[39]*algebraic[112]*(states[0]-algebraic[93]) algebraic[108] = (constants[46]*(algebraic[93]-algebraic[101]))/((algebraic[93]+87.8251)-algebraic[101]) algebraic[73] = (algebraic[36]+algebraic[72]+algebraic[71])-2.00000*(algebraic[69]+algebraic[67]) algebraic[90] = algebraic[83]+3.00000*(algebraic[69]+algebraic[67])+3.00000*algebraic[50]+algebraic[87]+algebraic[77] algebraic[114] = algebraic[111]+algebraic[100]+algebraic[106]+algebraic[96]+-2.00000*algebraic[50]+algebraic[113]+algebraic[12] algebraic[115] = (((constants[49]*(power(constants[50], 2.00000))*states[0]*(power(constants[0], 2.00000)))/(constants[2]*constants[1]))*(states[35]-constants[6]*exp((states[0]*constants[0])/(constants[2]*constants[1]))))/(1.00000-exp((states[0]*constants[0])/(constants[2]*constants[1]))) algebraic[116] = 1.00000-1.00000/(1.00000+power(states[40]/constants[52], 2.00000)) algebraic[117] = algebraic[115]*constants[51]*states[41]*algebraic[116] algebraic[102] = constants[40]*(states[0]-algebraic[101]) algebraic[118] = algebraic[102]+algebraic[117] algebraic[119] = (states[44]-states[35])/constants[69] 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)