Generated Code
The following is python code generated by the CellML API from this CellML file. (Back to language selection)
The raw code is available.
# Size of variable arrays: sizeAlgebraic = 120 sizeStates = 41 sizeConstants = 137 from math import * from numpy import * def createLegends(): legend_states = [""] * sizeStates legend_rates = [""] * sizeStates legend_algebraic = [""] * sizeAlgebraic legend_voi = "" legend_constants = [""] * sizeConstants legend_constants[0] = "Bmax_CaM in component buffca (mM)" legend_constants[128] = "Bmax_SLhighj in component buffca (mM)" legend_constants[133] = "Bmax_SLhighsl in component buffca (mM)" legend_constants[129] = "Bmax_SLlowj in component buffca (mM)" legend_constants[134] = "Bmax_SLlowsl in component buffca (mM)" legend_constants[1] = "Bmax_SR in component buffca (mM)" legend_constants[2] = "Bmax_TnChigh in component buffca (mM)" legend_constants[3] = "Bmax_TnClow in component buffca (mM)" legend_constants[4] = "Bmax_myosin in component buffca (mM)" legend_states[0] = "CaM in component buffca (mM)" legend_algebraic[35] = "J_CaB_cytosol in component buffca (mM_per_ms)" legend_algebraic[33] = "J_CaB_jntion in component buffca (mM_per_ms)" legend_algebraic[34] = "J_CaB_sl in component buffca (mM_per_ms)" legend_states[1] = "Myoc in component buffca (mM)" legend_states[2] = "Myom in component buffca (mM)" legend_states[3] = "SLH_jn in component buffca (mM)" legend_states[4] = "SLH_sl in component buffca (mM)" legend_states[5] = "SLL_jn in component buffca (mM)" legend_states[6] = "SLL_sl in component buffca (mM)" legend_states[7] = "SRB in component buffca (mM)" legend_states[8] = "TnCHc in component buffca (mM)" legend_states[9] = "TnCHm in component buffca (mM)" legend_states[10] = "TnCL in component buffca (mM)" legend_constants[5] = "koff_cam in component buffca (mS_per_uF)" legend_constants[6] = "koff_myoca in component buffca (mS_per_uF)" legend_constants[7] = "koff_myomg in component buffca (mS_per_uF)" legend_constants[8] = "koff_slh in component buffca (mS_per_uF)" legend_constants[9] = "koff_sll in component buffca (mS_per_uF)" legend_constants[10] = "koff_sr in component buffca (mS_per_uF)" legend_constants[11] = "koff_tnchca in component buffca (mS_per_uF)" legend_constants[12] = "koff_tnchmg in component buffca (mS_per_uF)" legend_constants[102] = "koff_tncl in component buffca (mS_per_uF)" legend_constants[13] = "kon_cam in component buffca (per_mM_per_ms)" legend_constants[14] = "kon_myoca in component buffca (per_mM_per_ms)" legend_constants[15] = "kon_myomg in component buffca (per_mM_per_ms)" legend_constants[16] = "kon_slh in component buffca (per_mM_per_ms)" legend_constants[17] = "kon_sll in component buffca (per_mM_per_ms)" legend_constants[18] = "kon_sr in component buffca (per_mM_per_ms)" legend_constants[19] = "kon_tnchca in component buffca (per_mM_per_ms)" legend_constants[20] = "kon_tnchmg in component buffca (per_mM_per_ms)" legend_constants[21] = "kon_tncl in component buffca (per_mM_per_ms)" legend_constants[123] = "Vjn in component geom (liter)" legend_constants[126] = "Vmyo in component geom (liter)" legend_constants[130] = "Vsl in component geom (liter)" legend_states[11] = "Ca_i in component calcium (mM)" legend_voi = "time in component engine (ms)" legend_constants[22] = "Mg_i in component ion (mM)" legend_states[12] = "Ca_jn in component calcium (mM)" legend_states[13] = "Ca_sl in component calcium (mM)" legend_constants[23] = "ISO in component cell (dimensionless)" legend_constants[24] = "Bmax_Na_jn in component buffna (mM)" legend_constants[25] = "Bmax_Na_sl in component buffna (mM)" legend_states[14] = "NaB_jn in component buffna (mM)" legend_states[15] = "NaB_sl in component buffna (mM)" legend_constants[26] = "koff_na in component buffna (mS_per_uF)" legend_constants[27] = "kon_na in component buffna (per_mM_per_ms)" legend_states[16] = "Na_jn in component sodium (mM)" legend_states[17] = "Na_sl in component sodium (mM)" legend_states[18] = "Ca_sr in component calcium (mM)" legend_states[19] = "Csqn in component calcium (mM)" legend_algebraic[82] = "ICa_tot_jn in component calcium (A_per_F)" legend_algebraic[89] = "ICa_tot_sl in component calcium (A_per_F)" legend_constants[28] = "JCa_slmyo in component geom (m3_per_s)" legend_constants[131] = "Vsr in component geom (liter)" legend_algebraic[87] = "J_serca in component ryr (mM_per_ms)" legend_constants[29] = "C in component cell (farad)" legend_constants[30] = "JCa_jnsl in component geom (m3_per_s)" legend_constants[31] = "F in component phys (C_per_mol)" legend_algebraic[83] = "J_SRCarel in component ryr (mM_per_ms)" legend_algebraic[85] = "J_SR_leak in component ryr (mM_per_ms)" legend_constants[135] = "Bmax_Csqn in component calcium_Csqn (mM)" legend_constants[32] = "koff_csqn in component calcium_Csqn (mS_per_uF)" legend_constants[33] = "kon_csqn in component calcium_Csqn (per_mM_per_ms)" legend_algebraic[81] = "ICaB_jn in component icab (A_per_F)" legend_algebraic[37] = "ICaL_Ca_jn in component ical (A_per_F)" legend_algebraic[64] = "INaCa_jn in component inaca (A_per_F)" legend_algebraic[75] = "IpCa_jn in component ipca (A_per_F)" legend_algebraic[86] = "ICaB_sl in component icab (A_per_F)" legend_algebraic[39] = "ICaL_Ca_sl in component ical (A_per_F)" legend_algebraic[68] = "INaCa_sl in component inaca (A_per_F)" legend_algebraic[77] = "IpCa_sl in component ipca (A_per_F)" legend_constants[34] = "AF in component cell (dimensionless)" legend_constants[35] = "RA in component cell (dimensionless)" legend_constants[36] = "JNa_jnsl in component geom (m3_per_s)" legend_constants[37] = "JNa_slmyo in component geom (m3_per_s)" legend_constants[103] = "Vcell in component geom (liter)" legend_constants[38] = "cell_length in component geom (um)" legend_constants[39] = "cell_radius in component geom (um)" legend_constants[40] = "pi in component geom (dimensionless)" legend_algebraic[88] = "ICaB in component icab (A_per_F)" legend_constants[41] = "gCaB in component icab (mS_per_uF)" legend_constants[42] = "Fjn in component junc (dimensionless)" legend_states[20] = "V in component membrane (mV)" legend_algebraic[80] = "ECa_jn in component nernst (mV)" legend_constants[127] = "Fsl in component junc (dimensionless)" legend_algebraic[84] = "ECa_sl in component nernst (mV)" legend_algebraic[50] = "ICaL in component ical (A_per_F)" legend_algebraic[40] = "ICaL_Ca in component ical (A_per_F)" legend_algebraic[42] = "ICaL_K in component ical (A_per_F)" legend_algebraic[48] = "ICaL_Na in component ical (A_per_F)" legend_algebraic[44] = "ICaL_Na_jn in component ical (A_per_F)" legend_algebraic[46] = "ICaL_Na_sl in component ical (A_per_F)" legend_constants[43] = "Q10CaL in component ical (dimensionless)" legend_states[21] = "d in component ical (dimensionless)" legend_states[22] = "f in component ical (dimensionless)" legend_states[23] = "fCaB_jn in component ical (dimensionless)" legend_states[24] = "fCaB_sl in component ical (dimensionless)" legend_constants[44] = "f_conducting in component ical (dimensionless)" legend_constants[45] = "fcaCaMSL in component ical (dimensionless)" legend_constants[46] = "fcaCaj in component ical (dimensionless)" legend_algebraic[36] = "ibarca_jn in component ical (uA_per_cm2)" legend_algebraic[38] = "ibarca_sl in component ical (uA_per_cm2)" legend_algebraic[41] = "ibark in component ical (uA_per_cm2)" legend_algebraic[43] = "ibarna_jn in component ical (uA_per_cm2)" legend_algebraic[45] = "ibarna_sl in component ical (uA_per_cm2)" legend_constants[105] = "pCa in component ical (cm_per_s)" legend_constants[47] = "pCa_max in component ical (cm_per_s)" legend_constants[106] = "pK in component ical (cm_per_s)" legend_constants[48] = "pK_max in component ical (cm_per_s)" legend_constants[107] = "pNa in component ical (cm_per_s)" legend_constants[49] = "pNa_max in component ical (cm_per_s)" legend_constants[50] = "Fjn_CaL in component junc (dimensionless)" legend_constants[132] = "Q in component phys (dimensionless)" legend_constants[108] = "Fsl_CaL in component junc (dimensionless)" legend_algebraic[0] = "ical_d_inf in component ical_d (dimensionless)" legend_algebraic[14] = "ical_d_tau in component ical_d (ms)" legend_algebraic[1] = "ical_f_inf in component ical_f (dimensionless)" legend_algebraic[15] = "ical_f_tau in component ical_f (ms)" legend_constants[51] = "Ca_o in component ion (mM)" legend_constants[109] = "FRT in component phys (per_mV)" legend_constants[52] = "K_o in component ion (mM)" legend_states[25] = "K_i in component potassium (mM)" legend_constants[53] = "Na_o in component ion (mM)" legend_algebraic[47] = "IClB in component iclb (A_per_F)" legend_constants[54] = "gClB in component iclb (mS_per_uF)" legend_constants[125] = "ECl in component nernst (mV)" legend_constants[55] = "GClCa in component iclca (mS_per_uF)" legend_algebraic[52] = "IClCa in component iclca (A_per_F)" legend_algebraic[49] = "IClCa_jn in component iclca (A_per_F)" legend_algebraic[51] = "IClCa_sl in component iclca (A_per_F)" legend_constants[56] = "KdClCa in component iclca (mM)" legend_algebraic[95] = "IK1 in component ik1 (A_per_F)" legend_constants[110] = "gK1 in component ik1 (mS_per_uF)" legend_constants[57] = "gK1_max in component ik1 (mS_per_uF)" legend_algebraic[94] = "ik1_inf in component ik1 (dimensionless)" legend_algebraic[91] = "EK in component nernst (mV)" legend_algebraic[92] = "ik1_inf_a in component ik1_ik1_inf (mS_per_uF)" legend_algebraic[93] = "ik1_inf_b in component ik1_ik1_inf (mS_per_uF)" legend_algebraic[98] = "IKp in component ikp (A_per_F)" legend_algebraic[96] = "IKp_jn in component ikp (A_per_F)" legend_algebraic[97] = "IKp_sl in component ikp (A_per_F)" legend_constants[58] = "gKp in component ikp (mS_per_uF)" legend_algebraic[53] = "kp in component ikp (dimensionless)" legend_algebraic[99] = "IKr in component ikr (A_per_F)" legend_constants[111] = "gKr in component ikr (mS_per_uF)" legend_constants[59] = "gKr_max in component ikr (mS_per_uF)" legend_algebraic[54] = "rr in component ikr (dimensionless)" legend_states[26] = "xr in component ikr (dimensionless)" legend_algebraic[2] = "ikr_xr_inf in component ikr_xr (dimensionless)" legend_algebraic[16] = "ikr_xr_tau in component ikr_xr (ms)" legend_algebraic[55] = "EKs in component iks (mV)" legend_algebraic[58] = "IKs in component iks (A_per_F)" legend_algebraic[56] = "IKs_jn in component iks (A_per_F)" legend_algebraic[57] = "IKs_sl in component iks (A_per_F)" legend_constants[112] = "gKs_jn in component iks (mS_per_uF)" legend_constants[60] = "gKs_max in component iks (mS_per_uF)" legend_constants[113] = "gKs_sl in component iks (mS_per_uF)" legend_constants[61] = "pNaK in component iks (dimensionless)" legend_states[27] = "xs in component iks (dimensionless)" legend_states[28] = "Na_i in component sodium (mM)" legend_algebraic[3] = "iks_xs_inf in component iks_xs (dimensionless)" legend_algebraic[17] = "iks_xs_tau in component iks_xs (ms)" legend_algebraic[100] = "IKur in component ikur (A_per_F)" legend_constants[114] = "gKur in component ikur (mS_per_uF)" legend_constants[62] = "gKur_max in component ikur (mS_per_uF)" legend_states[29] = "ikur_r in component ikur (dimensionless)" legend_states[30] = "s in component ikur (dimensionless)" legend_algebraic[4] = "ikur_r_inf in component ikur_ikur_r (dimensionless)" legend_algebraic[18] = "ikur_r_tau in component ikur_ikur_r (ms)" legend_algebraic[5] = "ikur_s_inf in component ikur_s (dimensionless)" legend_algebraic[19] = "ikur_s_tau in component ikur_s (ms)" legend_algebraic[108] = "INa in component ina (A_per_F)" legend_algebraic[103] = "INa_jn in component ina (A_per_F)" legend_algebraic[107] = "INa_sl in component ina (A_per_F)" legend_constants[115] = "gNa in component ina (mS_per_uF)" legend_constants[63] = "gNa_max in component ina (mS_per_uF)" legend_states[31] = "h in component ina (dimensionless)" legend_states[32] = "j in component ina (dimensionless)" legend_states[33] = "m in component ina (dimensionless)" legend_algebraic[102] = "ENa_jn in component nernst (mV)" legend_algebraic[106] = "ENa_sl in component nernst (mV)" legend_algebraic[27] = "ina_h_inf in component ina_h (dimensionless)" legend_algebraic[30] = "ina_h_tau in component ina_h (ms)" legend_algebraic[28] = "ina_j_inf in component ina_j (dimensionless)" legend_algebraic[31] = "ina_j_tau in component ina_j (ms)" legend_algebraic[8] = "ina_m_inf in component ina_m (dimensionless)" legend_algebraic[22] = "ina_m_tau in component ina_m (ms)" legend_algebraic[6] = "ina_h_a in component ina_h (mS_per_uF)" legend_algebraic[20] = "ina_h_b in component ina_h (mS_per_uF)" legend_algebraic[7] = "ina_j_a in component ina_j (mS_per_uF)" legend_algebraic[21] = "ina_j_b in component ina_j (mS_per_uF)" legend_algebraic[110] = "INaB in component inab (A_per_F)" legend_algebraic[104] = "INaB_jn in component inab (A_per_F)" legend_algebraic[109] = "INaB_sl in component inab (A_per_F)" legend_constants[64] = "gNaB in component inab (mS_per_uF)" legend_algebraic[70] = "INaCa in component inaca (A_per_F)" legend_constants[116] = "IbarNCX in component inaca (A_per_F)" legend_constants[65] = "IbarNCX_max in component inaca (A_per_F)" legend_algebraic[59] = "Ka_jn in component inaca (dimensionless)" legend_algebraic[60] = "Ka_sl in component inaca (dimensionless)" legend_constants[66] = "Kdact in component inaca (mM)" legend_constants[67] = "KmCai in component inaca (mM)" legend_constants[68] = "KmCao in component inaca (mM)" legend_constants[69] = "KmNai in component inaca (mM)" legend_constants[70] = "KmNao in component inaca (mM)" legend_constants[71] = "Q10NCX in component inaca (dimensionless)" legend_constants[72] = "ksat in component inaca (dimensionless)" legend_constants[73] = "nu in component inaca (dimensionless)" legend_algebraic[61] = "s1_jn in component inaca_INaCa_jn (mol4_per_m12)" legend_algebraic[62] = "s2_jn in component inaca_INaCa_jn (mol4_per_m12)" legend_algebraic[63] = "s3_jn in component inaca_INaCa_jn (mol4_per_m12)" legend_algebraic[65] = "s1_sl in component inaca_INaCa_sl (mol4_per_m12)" legend_algebraic[66] = "s2_sl in component inaca_INaCa_sl (mol4_per_m12)" legend_algebraic[67] = "s3_sl in component inaca_INaCa_sl (mol4_per_m12)" legend_algebraic[73] = "INaK in component inak (A_per_F)" legend_algebraic[71] = "INaK_jn in component inak (A_per_F)" legend_algebraic[72] = "INaK_sl in component inak (A_per_F)" legend_constants[74] = "IbarNaK in component inak (A_per_F)" legend_constants[75] = "KmKo in component inak (mM)" legend_constants[117] = "KmNaip in component inak (mM)" legend_algebraic[69] = "fnak in component inak (dimensionless)" legend_constants[118] = "sigma in component inak (dimensionless)" legend_algebraic[112] = "INaL in component inal (A_per_F)" legend_algebraic[105] = "INaL_jn in component inal (A_per_F)" legend_algebraic[111] = "INaL_sl in component inal (A_per_F)" legend_constants[119] = "gNaL in component inal (mS_per_uF)" legend_constants[76] = "gNaL_max in component inal (mS_per_uF)" legend_states[34] = "hl in component inal (dimensionless)" legend_states[35] = "ml in component inal (dimensionless)" legend_algebraic[9] = "inal_hl_inf in component inal_hl (dimensionless)" legend_constants[77] = "inal_hl_tau in component inal_hl (ms)" legend_algebraic[10] = "inal_ml_a in component inal_ml (mS_per_uF)" legend_algebraic[23] = "inal_ml_b in component inal_ml (mS_per_uF)" legend_constants[78] = "Cl_i in component ion (mM)" legend_constants[79] = "Cl_o in component ion (mM)" legend_constants[80] = "IbarSLCaP in component ipca (A_per_F)" legend_algebraic[79] = "IpCa in component ipca (A_per_F)" legend_constants[81] = "KmPCa in component ipca (mM)" legend_constants[82] = "Q10SLCaP in component ipca (dimensionless)" legend_algebraic[74] = "ipca_IpCa_jn_a in component ipca_IpCa_jn (dimensionless)" legend_constants[104] = "ipca_IpCa_jn_b in component ipca_IpCa_jn (dimensionless)" legend_algebraic[76] = "ipca_IpCa_sl_a in component ipca_IpCa_sl (dimensionless)" legend_constants[124] = "ipca_IpCa_sl_b in component ipca_IpCa_sl (dimensionless)" legend_algebraic[101] = "Ito in component ito (A_per_F)" legend_constants[120] = "gto in component ito (mS_per_uF)" legend_constants[83] = "gto_max in component ito (mS_per_uF)" legend_states[36] = "x in component ito (dimensionless)" legend_states[37] = "y in component ito (dimensionless)" legend_algebraic[11] = "ito_x_inf in component ito_x (dimensionless)" legend_algebraic[24] = "ito_x_tau in component ito_x (ms)" legend_algebraic[12] = "ito_y_inf in component ito_y (dimensionless)" legend_algebraic[25] = "ito_y_tau in component ito_y (ms)" legend_algebraic[90] = "ICa_tot in component membrane (A_per_F)" legend_algebraic[78] = "ICl_tot in component membrane (A_per_F)" legend_algebraic[116] = "INa_tot in component membrane (A_per_F)" legend_algebraic[117] = "I_tot in component membrane (A_per_F)" legend_algebraic[114] = "INa_tot_jn in component sodium (A_per_F)" legend_algebraic[115] = "INa_tot_sl in component sodium (A_per_F)" legend_algebraic[113] = "IK_tot in component potassium (A_per_F)" legend_algebraic[119] = "I_stim in component stimulus (A_per_F)" legend_constants[84] = "R in component phys (mJ_per_mol_per_K)" legend_constants[85] = "T in component phys (kelvin)" legend_constants[86] = "J_SR_leak_max in component ryr (mS_per_uF)" legend_constants[121] = "Kmf in component ryr (mM)" legend_constants[87] = "Kmr in component ryr (mM)" legend_constants[88] = "MaxSR in component ryr (dimensionless)" legend_constants[89] = "MinSR in component ryr (dimensionless)" legend_constants[90] = "Q10SRCaP in component ryr (dimensionless)" legend_algebraic[13] = "RI in component ryr (dimensionless)" legend_constants[91] = "Vmax_SRCaP in component ryr (mM_per_ms)" legend_constants[92] = "ec50SR in component ryr (mM)" legend_constants[93] = "hillSRCaP in component ryr (dimensionless)" legend_states[38] = "i in component ryr (dimensionless)" legend_algebraic[26] = "kCaSR in component ryr (dimensionless)" legend_constants[94] = "kiCa in component ryr (per_mM_per_ms)" legend_algebraic[29] = "kiSRCa in component ryr (per_mM_per_ms)" legend_constants[95] = "kim in component ryr (mS_per_uF)" legend_constants[122] = "koCa in component ryr (per_mM2_per_ms)" legend_algebraic[32] = "koSRCa in component ryr (per_mM2_per_ms)" legend_constants[96] = "kom in component ryr (mS_per_uF)" legend_constants[97] = "ks in component ryr (mS_per_uF)" legend_states[39] = "o in component ryr (dimensionless)" legend_states[40] = "ryr_r in component ryr (dimensionless)" legend_constants[98] = "amplitude in component stimulus (A_per_F)" legend_algebraic[118] = "pace in component stimulus (dimensionless)" legend_constants[99] = "stim_duration in component stimulus (ms)" legend_constants[100] = "stim_offset in component stimulus (ms)" legend_constants[101] = "stim_period in component stimulus (ms)" legend_rates[0] = "d/dt CaM in component buffca (mM)" legend_rates[10] = "d/dt TnCL in component buffca (mM)" legend_rates[8] = "d/dt TnCHc in component buffca (mM)" legend_rates[9] = "d/dt TnCHm in component buffca (mM)" legend_rates[1] = "d/dt Myoc in component buffca (mM)" legend_rates[2] = "d/dt Myom in component buffca (mM)" legend_rates[7] = "d/dt SRB in component buffca (mM)" legend_rates[5] = "d/dt SLL_jn in component buffca (mM)" legend_rates[3] = "d/dt SLH_jn in component buffca (mM)" legend_rates[6] = "d/dt SLL_sl in component buffca (mM)" legend_rates[4] = "d/dt SLH_sl in component buffca (mM)" legend_rates[14] = "d/dt NaB_jn in component buffna (mM)" legend_rates[15] = "d/dt NaB_sl in component buffna (mM)" legend_rates[11] = "d/dt Ca_i in component calcium (mM)" legend_rates[12] = "d/dt Ca_jn in component calcium (mM)" legend_rates[13] = "d/dt Ca_sl in component calcium (mM)" legend_rates[18] = "d/dt Ca_sr in component calcium (mM)" legend_rates[19] = "d/dt Csqn in component calcium (mM)" legend_rates[21] = "d/dt d in component ical (dimensionless)" legend_rates[22] = "d/dt f in component ical (dimensionless)" legend_rates[23] = "d/dt fCaB_jn in component ical (dimensionless)" legend_rates[24] = "d/dt fCaB_sl in component ical (dimensionless)" legend_rates[26] = "d/dt xr in component ikr (dimensionless)" legend_rates[27] = "d/dt xs in component iks (dimensionless)" legend_rates[29] = "d/dt ikur_r in component ikur (dimensionless)" legend_rates[30] = "d/dt s in component ikur (dimensionless)" legend_rates[31] = "d/dt h in component ina (dimensionless)" legend_rates[32] = "d/dt j in component ina (dimensionless)" legend_rates[33] = "d/dt m in component ina (dimensionless)" legend_rates[34] = "d/dt hl in component inal (dimensionless)" legend_rates[35] = "d/dt ml in component inal (dimensionless)" legend_rates[36] = "d/dt x in component ito (dimensionless)" legend_rates[37] = "d/dt y in component ito (dimensionless)" legend_rates[20] = "d/dt V in component membrane (mV)" legend_rates[25] = "d/dt K_i in component potassium (mM)" legend_rates[38] = "d/dt i in component ryr (dimensionless)" legend_rates[39] = "d/dt o in component ryr (dimensionless)" legend_rates[40] = "d/dt ryr_r in component ryr (dimensionless)" legend_rates[28] = "d/dt Na_i in component sodium (mM)" legend_rates[16] = "d/dt Na_jn in component sodium (mM)" legend_rates[17] = "d/dt Na_sl in component sodium (mM)" return (legend_states, legend_algebraic, legend_voi, legend_constants) def initConsts(): constants = [0.0] * sizeConstants; states = [0.0] * sizeStates; constants[0] = 0.024 constants[1] = 0.0171 constants[2] = 0.14 constants[3] = 0.07 constants[4] = 0.14 states[0] = 7.02128101897185673e-04 states[1] = 3.94923428392655786e-03 states[2] = 1.35538532457244482e-01 states[3] = 1.03674364292988680e-01 states[4] = 1.90759804527589089e-01 states[5] = 1.35640688636079511e-02 states[6] = 2.14063418881809235e-02 states[7] = 4.45327242854324807e-03 states[8] = 1.27856586024588575e-01 states[9] = 5.69999505293381902e-03 states[10] = 1.83143535034222225e-02 constants[5] = 0.238 constants[6] = 0.00046 constants[7] = 5.7e-05 constants[8] = 0.03 constants[9] = 1.3 constants[10] = 0.06 constants[11] = 3.2e-05 constants[12] = 0.00333 constants[13] = 34.0 constants[14] = 13.8 constants[15] = 0.0157 constants[16] = 100.0 constants[17] = 100.0 constants[18] = 100.0 constants[19] = 2.37 constants[20] = 0.003 constants[21] = 32.7 states[11] = 2.10808768153058460e-04 constants[22] = 1.0 states[12] = 3.25814677291117296e-04 states[13] = 2.33018340557575125e-04 constants[23] = 0.0 constants[24] = 7.561 constants[25] = 1.65 states[14] = 3.61396062660070427e+00 states[15] = 7.88607791910409195e-01 constants[26] = 0.001 constants[27] = 0.0001 states[16] = 9.15153381546177336e+00 states[17] = 9.15182798281732346e+00 states[18] = 5.02305826642838293e-01 states[19] = 1.13337536953687845e+00 constants[28] = 3.72425607984805052e-12 constants[29] = 1.1e-10 constants[30] = 8.24130542277896849e-13 constants[31] = 96485.0 constants[32] = 65.0 constants[33] = 100.0 constants[34] = 0.0 constants[35] = 0.0 constants[36] = 1.83127823220607955e-14 constants[37] = 1.63862792221979433e-12 constants[38] = 100.0 constants[39] = 10.25 constants[40] = 3.14159265358979312e+00 constants[41] = 6.06430000000000033e-04 constants[42] = 0.11 states[20] = -7.34336366728778671e+01 constants[43] = 1.8 states[21] = 2.16850216379767157e-05 states[22] = 9.98384427312367095e-01 states[23] = 4.49572164109603364e-02 states[24] = 3.28512098597005947e-02 constants[44] = 1.0 constants[45] = 0.0 constants[46] = 0.0 constants[47] = 0.00027 constants[48] = 1.35e-07 constants[49] = 7.5e-09 constants[50] = 0.9 constants[51] = 1.8 constants[52] = 5.4 states[25] = 120.0 constants[53] = 140.0 constants[54] = 0.009 constants[55] = 0.0548 constants[56] = 0.1 constants[57] = 0.0525 constants[58] = 0.002 constants[59] = 0.035 states[26] = 1.31290096227093382e-03 constants[60] = 0.0035 constants[61] = 0.01833 states[27] = 7.49436760722081534e-03 states[28] = 9.15199678386256998e+00 constants[62] = 0.045 states[29] = 3.93548562883350357e-04 states[30] = 9.58234428284286399e-01 constants[63] = 23.0 states[31] = 3.15482710277587786e-01 states[32] = 2.48034071360795916e-01 states[33] = 1.89326933812916480e-02 constants[64] = 0.000597 constants[65] = 3.15 constants[66] = 0.000384 constants[67] = 0.00359 constants[68] = 1.3 constants[69] = 12.29 constants[70] = 87.5 constants[71] = 1.57 constants[72] = 0.27 constants[73] = 0.35 constants[74] = 1.26 constants[75] = 1.5 constants[76] = 0.0025 states[34] = 3.79829335413739144e-02 states[35] = 1.01974216400706526e-02 constants[77] = 600.0 constants[78] = 15.0 constants[79] = 150.0 constants[80] = 0.0471 constants[81] = 0.0005 constants[82] = 2.35 constants[83] = 0.165 states[36] = 1.37939236359928058e-03 states[37] = 9.45874848392074696e-01 constants[84] = 8314.0 constants[85] = 310.0 constants[86] = 5.348e-06 constants[87] = 1.7 constants[88] = 15.0 constants[89] = 1.0 constants[90] = 2.6 constants[91] = 0.0053114 constants[92] = 0.45 constants[93] = 1.787 states[38] = 5.01323282772066123e-07 constants[94] = 0.5 constants[95] = 0.005 constants[96] = 0.06 constants[97] = 25.0 states[39] = 2.01567245823636694e-06 states[40] = 8.00819151705148946e-01 constants[98] = -12.5 constants[99] = 5.0 constants[100] = 50.0 constants[101] = 1000.0 constants[102] = (1.00000+0.500000*constants[23])*0.0196000 constants[103] = ((constants[40]*(power(constants[39], 2.00000)))*constants[38])*1.00000e-15 constants[104] = power(constants[81]*1.00000, 1.60000) constants[105] = ((1.00000+0.500000*constants[23])*(1.00000-0.500000*constants[34]))*constants[47] constants[106] = ((1.00000+0.500000*constants[23])*(1.00000-0.500000*constants[34]))*constants[48] constants[107] = ((1.00000+0.500000*constants[23])*(1.00000-0.500000*constants[34]))*constants[49] constants[108] = 1.00000-constants[50] constants[109] = (constants[31]/constants[84])/constants[85] constants[110] = ((1.00000+constants[34])*(power(constants[52]/5.40000, 1.0/2)))*constants[57] constants[111] = constants[59]*(power(constants[52]/5.40000, 1.0/2)) constants[112] = ((1.00000+constants[34])+2.00000*constants[23])*constants[60] constants[113] = ((1.00000+constants[34])+2.00000*constants[23])*constants[60] constants[114] = (((1.00000-0.500000*constants[34])*(1.00000+2.00000*constants[23]))*(1.00000+0.200000*constants[35]))*constants[62] constants[115] = constants[63]*(1.00000-0.100000*constants[34]) constants[116] = (1.00000+0.400000*constants[34])*constants[65] constants[117] = 11.0000*(1.00000-0.250000*constants[23]) constants[118] = (exp(constants[53]/67.3000)-1.00000)/7.00000 constants[119] = constants[76]*constants[34] constants[120] = (1.00000-0.700000*constants[34])*constants[83] constants[121] = (2.50000-1.25000*constants[23])*0.000246000 constants[122] = ((10.0000+20.0000*constants[34])+(10.0000*constants[23])*(1.00000-constants[34]))*1.00000 constants[136] = 0.00000 constants[123] = (0.0539000*0.0100000)*constants[103] constants[124] = power(constants[81]*1.00000, 1.60000) constants[125] = (1.00000/constants[109])*log(constants[78]/constants[79]) constants[126] = 0.650000*constants[103] constants[127] = 1.00000-constants[42] constants[128] = ((0.00165000*constants[126])/constants[123])*0.100000 constants[129] = ((0.00460000*constants[126])/constants[123])*0.100000 constants[130] = 0.0200000*constants[103] constants[131] = 0.0350000*constants[103] constants[132] = (constants[85]-310.000)/10.0000 constants[133] = (constants[126]/constants[130])*0.0134000 constants[134] = (constants[126]/constants[130])*0.0374000 constants[135] = (constants[126]/constants[131])*0.140000 return (states, constants) def computeRates(voi, states, constants): rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic rates[25] = constants[136] rates[0] = (constants[13]*states[11])*(constants[0]-states[0])-constants[5]*states[0] rates[23] = ((1.70000*states[12])*(1.00000-states[23])-0.0119000*states[23])*1.00000 rates[24] = ((1.70000*states[13])*(1.00000-states[24])-0.0119000*states[24])*1.00000 rates[28] = (constants[37]/constants[126])*(states[17]-states[28]) rates[1] = (constants[14]*states[11])*((constants[4]-states[1])-states[2])-constants[6]*states[1] algebraic[9] = 1.00000/(1.00000+exp((states[20]+91.0000)/6.10000)) rates[34] = (algebraic[9]-states[34])/constants[77] rates[2] = (constants[15]*constants[22])*((constants[4]-states[1])-states[2])-constants[7]*states[2] algebraic[0] = 1.00000/(1.00000+exp(-((states[20]+3.00000*constants[23])+9.00000)/6.00000)) algebraic[14] = (algebraic[0]*(1.00000-exp(-((states[20]+3.00000*constants[23])+9.00000)/6.00000)))/(0.0350000*((states[20]+3.00000*constants[23])+9.00000)) rates[21] = (algebraic[0]-states[21])/algebraic[14] algebraic[1] = 1.00000/(1.00000+exp(((states[20]+3.00000*constants[23])+30.0000)/7.00000))+0.200000/(1.00000+exp(((50.0000-states[20])-3.00000*constants[23])/20.0000)) algebraic[15] = 1.00000/(0.0197000*exp(-(power(0.0337000*((states[20]+3.00000*constants[23])+25.0000), 2.00000)))+0.0200000) rates[22] = (algebraic[1]-states[22])/algebraic[15] algebraic[2] = 1.00000/(1.00000+exp(-(states[20]+10.0000)/5.00000)) algebraic[16] = (((550.000)/(1.00000+exp((-22.0000-states[20])/9.00000)))*6.00000)/(1.00000+exp((states[20]+11.0000)/9.00000))+230.000/(1.00000+exp((states[20]+40.0000)/20.0000)) rates[26] = (algebraic[2]-states[26])/algebraic[16] algebraic[3] = 1.00000/(1.00000+exp(-((states[20]+40.0000*constants[23])+3.80000)/14.2500)) algebraic[17] = 990.100/(1.00000+exp(-((states[20]+40.0000*constants[23])+2.43600)/14.1200)) rates[27] = (algebraic[3]-states[27])/algebraic[17] algebraic[4] = 1.00000/(1.00000+exp((states[20]+6.00000)/-8.60000)) algebraic[18] = 9.00000/(1.00000+exp((states[20]+5.00000)/12.0000))+0.500000 rates[29] = (algebraic[4]-states[29])/algebraic[18] algebraic[5] = 1.00000/(1.00000+exp((states[20]+7.50000)/10.0000)) algebraic[19] = 590.000/(1.00000+exp((states[20]+60.0000)/10.0000))+3050.00 rates[30] = (algebraic[5]-states[30])/algebraic[19] algebraic[8] = 1.00000/(power(1.00000+exp(-(56.8600+states[20])/9.03000), 2.00000)) algebraic[22] = 0.129200*exp(-(power((states[20]+45.7900)/15.5400, 2.00000)))+0.0648700*exp(-(power((states[20]-4.82300)/51.1200, 2.00000))) rates[33] = (algebraic[8]-states[33])/algebraic[22] algebraic[10] = (0.320000*(states[20]+47.1300))/(1.00000-exp(-0.100000*(states[20]+47.1300))) algebraic[23] = 0.0800000*exp(-states[20]/11.0000) rates[35] = algebraic[10]*(1.00000-states[35])-algebraic[23]*states[35] algebraic[11] = 1.00000/(1.00000+exp(-(states[20]+1.00000)/11.0000)) algebraic[24] = 3.50000*exp(-(power(states[20]/30.0000, 2.00000)))+1.50000 rates[36] = (algebraic[11]-states[36])/algebraic[24] algebraic[12] = 1.00000/(1.00000+exp((states[20]+40.5000)/11.5000)) algebraic[25] = 25.6350*exp(-(power((states[20]+52.4500)/15.8827, 2.00000)))+24.1400 rates[37] = (algebraic[12]-states[37])/algebraic[25] rates[3] = (constants[16]*states[12])*(constants[128]-states[3])-constants[8]*states[3] rates[4] = (constants[16]*states[13])*(constants[133]-states[4])-constants[8]*states[4] algebraic[27] = 1.00000/(power(1.00000+exp((states[20]+71.5500)/7.43000), 2.00000)) algebraic[6] = (custom_piecewise([greater_equal(states[20] , -40.0000), 0.00000 , True, 0.0570000*exp(-(states[20]+80.0000)/6.80000)]))*1.00000 algebraic[20] = (custom_piecewise([greater_equal(states[20] , -40.0000), 0.770000/(0.130000*(1.00000+exp(-(states[20]+10.6600)/11.1000))) , True, 2.70000*exp(0.0790000*states[20])+(3.10000*(power(10.0000, 5.00000)))*exp(0.348500*states[20])]))*1.00000 algebraic[30] = 1.00000/(algebraic[6]+algebraic[20]) rates[31] = (algebraic[27]-states[31])/algebraic[30] algebraic[28] = 1.00000/(power(1.00000+exp((states[20]+71.5500)/7.43000), 2.00000)) algebraic[7] = (custom_piecewise([greater_equal(states[20] , -40.0000), 0.00000 , True, ((((-2.54280*(power(10.0000, 4.00000)))*exp(0.244400*states[20])-(6.94800*(power(10.0000, -6.00000)))*exp(-0.0439100*states[20]))*(states[20]+37.7800))/(1.00000+exp(0.311000*(states[20]+79.2300))))*1.00000]))*1.00000 algebraic[21] = (custom_piecewise([greater_equal(states[20] , -40.0000), (0.600000*exp(0.0570000*states[20]))/(1.00000+exp(-0.100000*(states[20]+32.0000))) , True, (0.0242400*exp(-0.0105200*states[20]))/(1.00000+exp(-0.137800*(states[20]+40.1400)))]))*1.00000 algebraic[31] = 1.00000/(algebraic[7]+algebraic[21]) rates[32] = (algebraic[28]-states[32])/algebraic[31] algebraic[13] = ((1.00000-states[40])-states[39])-states[38] algebraic[26] = constants[88]-(constants[88]-constants[89])/(1.00000+power(constants[92]/states[18], 2.50000)) algebraic[29] = constants[94]*algebraic[26] algebraic[32] = constants[122]/algebraic[26] rates[38] = ((algebraic[29]*states[12])*states[39]-constants[95]*states[38])-(constants[96]*states[38]-(algebraic[32]*(power(states[12], 2.00000)))*algebraic[13]) rates[39] = ((algebraic[32]*(power(states[12], 2.00000)))*states[40]-constants[96]*states[39])-((algebraic[29]*states[12])*states[39]-constants[95]*states[38]) rates[40] = (constants[95]*algebraic[13]-(algebraic[29]*states[12])*states[40])-((algebraic[32]*(power(states[12], 2.00000)))*states[40]-constants[96]*states[39]) rates[5] = (constants[17]*states[12])*(constants[129]-states[5])-constants[9]*states[5] rates[6] = (constants[17]*states[13])*(constants[134]-states[6])-constants[9]*states[6] rates[7] = (constants[18]*states[11])*(constants[1]-states[7])-constants[10]*states[7] rates[8] = (constants[19]*states[11])*((constants[2]-states[8])-states[9])-constants[11]*states[8] rates[9] = (constants[20]*constants[22])*((constants[2]-states[8])-states[9])-constants[12]*states[9] rates[10] = (constants[21]*states[11])*(constants[3]-states[10])-constants[102]*states[10] rates[14] = (constants[27]*states[16])*(constants[24]-states[14])-constants[26]*states[14] rates[15] = (constants[27]*states[17])*(constants[25]-states[15])-constants[26]*states[15] rates[19] = (constants[33]*states[18])*(constants[135]-states[19])-constants[32]*states[19] algebraic[33] = rates[5]+rates[3] algebraic[80] = ((1.00000/constants[109])/2.00000)*log(constants[51]/states[12]) algebraic[81] = (constants[42]*constants[41])*(states[20]-algebraic[80]) algebraic[36] = ((((constants[105]*4.00000)*((states[20]*constants[31])*constants[109]))*((0.341000*states[12])*exp((2.00000*states[20])*constants[109])-0.341000*constants[51]))/(exp((2.00000*states[20])*constants[109])-1.00000))*constants[44] algebraic[37] = (((((constants[50]*algebraic[36])*states[21])*states[22])*((1.00000-states[23])+constants[46]))*(power(constants[43], constants[132])))*0.450000 algebraic[59] = 1.00000/(1.00000+power(constants[66]/states[12], 2.00000)) algebraic[61] = (exp((constants[73]*states[20])*constants[109])*(power(states[16], 3.00000)))*constants[51] algebraic[62] = (exp(((constants[73]-1.00000)*states[20])*constants[109])*(power(constants[53], 3.00000)))*states[12] algebraic[63] = ((((constants[67]*(power(constants[53], 3.00000)))*(1.00000+power(states[16]/constants[69], 3.00000))+((power(constants[70], 3.00000))*states[12])*(1.00000+states[12]/constants[67]))+constants[68]*(power(states[16], 3.00000)))+(power(states[16], 3.00000))*constants[51])+(power(constants[53], 3.00000))*states[12] algebraic[64] = (((((constants[42]*constants[116])*(power(constants[71], constants[132])))*algebraic[59])*(algebraic[61]-algebraic[62]))/algebraic[63])/(1.00000+constants[72]*exp(((constants[73]-1.00000)*states[20])*constants[109])) algebraic[74] = power(states[12]*1.00000, 1.60000) algebraic[75] = (((constants[42]*(power(constants[82], constants[132])))*constants[80])*algebraic[74])/(algebraic[74]+constants[104]) algebraic[82] = ((algebraic[37]+algebraic[81])+algebraic[75])-2.00000*algebraic[64] algebraic[83] = (constants[97]*states[39])*(states[18]-states[12]) algebraic[85] = ((1.00000+0.250000*constants[34])*(states[18]-states[12]))*constants[86] rates[12] = ((((-algebraic[82]*constants[29])/((constants[123]*2.00000)*constants[31])+(constants[30]/constants[123])*(states[13]-states[12]))-algebraic[33])+(algebraic[83]*constants[131])/constants[123])+(algebraic[85]*constants[126])/constants[123] algebraic[35] = (((((rates[10]+rates[8])+rates[9])+rates[0])+rates[1])+rates[2])+rates[7] algebraic[87] = (((power(constants[90], constants[132]))*constants[91])*(power(states[11]/constants[121], constants[93])-power(states[18]/constants[87], constants[93])))/((1.00000+power(states[11]/constants[121], constants[93]))+power(states[18]/constants[87], constants[93])) rates[11] = ((-algebraic[87]*constants[131])/constants[126]-algebraic[35])+(constants[28]/constants[126])*(states[13]-states[11]) algebraic[34] = rates[6]+rates[4] algebraic[84] = ((1.00000/constants[109])/2.00000)*log(constants[51]/states[13]) algebraic[86] = (constants[127]*constants[41])*(states[20]-algebraic[84]) algebraic[38] = ((((constants[105]*4.00000)*((states[20]*constants[31])*constants[109]))*((0.341000*states[13])*exp((2.00000*states[20])*constants[109])-0.341000*constants[51]))/(exp((2.00000*states[20])*constants[109])-1.00000))*constants[44] algebraic[39] = (((((constants[108]*algebraic[38])*states[21])*states[22])*((1.00000-states[24])+constants[45]))*(power(constants[43], constants[132])))*0.450000 algebraic[60] = 1.00000/(1.00000+power(constants[66]/states[13], 2.00000)) algebraic[65] = (exp((constants[73]*states[20])*constants[109])*(power(states[17], 3.00000)))*constants[51] algebraic[66] = (exp(((constants[73]-1.00000)*states[20])*constants[109])*(power(constants[53], 3.00000)))*states[13] algebraic[67] = ((((constants[67]*(power(constants[53], 3.00000)))*(1.00000+power(states[17]/constants[69], 3.00000))+((power(constants[70], 3.00000))*states[13])*(1.00000+states[13]/constants[67]))+constants[68]*(power(states[17], 3.00000)))+(power(states[17], 3.00000))*constants[51])+(power(constants[53], 3.00000))*states[13] algebraic[68] = (((((constants[127]*constants[116])*(power(constants[71], constants[132])))*algebraic[60])*(algebraic[65]-algebraic[66]))/algebraic[67])/(1.00000+constants[72]*exp(((constants[73]-1.00000)*states[20])*constants[109])) algebraic[76] = power(states[13]*1.00000, 1.60000) algebraic[77] = (((constants[127]*(power(constants[82], constants[132])))*constants[80])*algebraic[76])/(algebraic[76]+constants[124]) algebraic[89] = ((algebraic[39]+algebraic[86])+algebraic[77])-2.00000*algebraic[68] rates[13] = (((-algebraic[89]*constants[29])/((constants[130]*2.00000)*constants[31])+(constants[30]/constants[130])*(states[12]-states[13]))+(constants[28]/constants[130])*(states[11]-states[13]))-algebraic[34] rates[18] = (algebraic[87]-((algebraic[85]*constants[126])/constants[131]+algebraic[83]))-rates[19] algebraic[43] = (((((constants[107]*states[20])*constants[31])*constants[109])*((0.750000*states[16])*exp(states[20]*constants[109])-0.750000*constants[53]))/(exp(states[20]*constants[109])-1.00000))*constants[44] algebraic[44] = (((((constants[50]*algebraic[43])*states[21])*states[22])*((1.00000-states[23])+constants[46]))*(power(constants[43], constants[132])))*0.450000 algebraic[102] = (1.00000/constants[109])*log(constants[53]/states[16]) algebraic[103] = ((((constants[42]*constants[115])*(power(states[33], 3.00000)))*states[31])*states[32])*(states[20]-algebraic[102]) algebraic[104] = (constants[42]*constants[64])*(states[20]-algebraic[102]) algebraic[69] = 1.00000/((1.00000+0.124500*exp((-0.100000*states[20])*constants[109]))+(0.0365000*constants[118])*exp(-states[20]*constants[109])) algebraic[71] = ((((constants[42]*constants[74])*algebraic[69])*constants[52])/(1.00000+power(constants[117]/states[16], 4.00000)))/(constants[52]+constants[75]) algebraic[105] = (((constants[42]*constants[119])*(power(states[35], 3.00000)))*states[34])*(states[20]-algebraic[102]) algebraic[114] = ((((algebraic[103]+algebraic[104])+3.00000*algebraic[64])+3.00000*algebraic[71])+algebraic[44])+algebraic[105] rates[16] = ((-algebraic[114]*constants[29])/(constants[123]*constants[31])+(constants[36]/constants[123])*(states[17]-states[16]))-rates[14] algebraic[45] = (((((constants[107]*states[20])*constants[31])*constants[109])*((0.750000*states[17])*exp(states[20]*constants[109])-0.750000*constants[53]))/(exp(states[20]*constants[109])-1.00000))*constants[44] algebraic[46] = (((((constants[108]*algebraic[45])*states[21])*states[22])*((1.00000-states[24])+constants[45]))*(power(constants[43], constants[132])))*0.450000 algebraic[106] = (1.00000/constants[109])*log(constants[53]/states[17]) algebraic[107] = ((((constants[127]*constants[115])*(power(states[33], 3.00000)))*states[31])*states[32])*(states[20]-algebraic[106]) algebraic[109] = (constants[127]*constants[64])*(states[20]-algebraic[106]) algebraic[72] = ((((constants[127]*constants[74])*algebraic[69])*constants[52])/(1.00000+power(constants[117]/states[17], 4.00000)))/(constants[52]+constants[75]) algebraic[111] = (((constants[127]*constants[119])*(power(states[35], 3.00000)))*states[34])*(states[20]-algebraic[106]) algebraic[115] = ((((algebraic[107]+algebraic[109])+3.00000*algebraic[68])+3.00000*algebraic[72])+algebraic[46])+algebraic[111] rates[17] = (((-algebraic[115]*constants[29])/(constants[130]*constants[31])+(constants[36]/constants[130])*(states[16]-states[17]))+(constants[37]/constants[130])*(states[28]-states[17]))-rates[15] algebraic[90] = algebraic[82]+algebraic[89] algebraic[47] = constants[54]*(states[20]-constants[125]) algebraic[49] = ((constants[42]*constants[55])/(1.00000+constants[56]/states[12]))*(states[20]-constants[125]) algebraic[51] = ((constants[127]*constants[55])/(1.00000+constants[56]/states[13]))*(states[20]-constants[125]) algebraic[52] = algebraic[49]+algebraic[51] algebraic[78] = algebraic[52]+algebraic[47] algebraic[116] = algebraic[114]+algebraic[115] algebraic[41] = (((((constants[106]*states[20])*constants[31])*constants[109])*((0.750000*states[25])*exp(states[20]*constants[109])-0.750000*constants[52]))/(exp(states[20]*constants[109])-1.00000))*constants[44] algebraic[42] = ((((algebraic[41]*states[21])*states[22])*(constants[50]*(constants[46]+(1.00000-states[23]))+constants[108]*(constants[45]+(1.00000-states[24]))))*(power(constants[43], constants[132])))*0.450000 algebraic[91] = (1.00000/constants[109])*log(constants[52]/states[25]) algebraic[92] = 1.00000*(1.02000/(1.00000+exp(0.238500*((states[20]-algebraic[91])-59.2150)))) algebraic[93] = 1.00000*((0.491240*exp(0.0803200*((states[20]+5.47600)-algebraic[91]))+exp(0.0617500*((states[20]-algebraic[91])-594.310)))/(1.00000+exp(-0.514300*((states[20]-algebraic[91])+4.75300)))) algebraic[94] = algebraic[92]/(algebraic[92]+algebraic[93]) algebraic[95] = (constants[110]*algebraic[94])*(states[20]-algebraic[91]) algebraic[53] = 1.00000/(1.00000+exp(7.48800-states[20]/5.98000)) algebraic[96] = ((constants[42]*constants[58])*algebraic[53])*(states[20]-algebraic[91]) algebraic[97] = ((constants[127]*constants[58])*algebraic[53])*(states[20]-algebraic[91]) algebraic[98] = algebraic[96]+algebraic[97] algebraic[54] = 1.00000/(1.00000+exp((states[20]+74.0000)/24.0000)) algebraic[99] = ((constants[111]*states[26])*algebraic[54])*(states[20]-algebraic[91]) algebraic[55] = (1.00000/constants[109])*log((constants[52]+constants[61]*constants[53])/(states[25]+constants[61]*states[28])) algebraic[56] = ((constants[42]*constants[112])*(power(states[27], 2.00000)))*(states[20]-algebraic[55]) algebraic[57] = ((constants[127]*constants[113])*(power(states[27], 2.00000)))*(states[20]-algebraic[55]) algebraic[58] = algebraic[56]+algebraic[57] algebraic[100] = ((constants[114]*states[29])*states[30])*(states[20]-algebraic[91]) algebraic[73] = algebraic[71]+algebraic[72] algebraic[101] = ((constants[120]*states[36])*states[37])*(states[20]-algebraic[91]) algebraic[113] = ((((((algebraic[101]+algebraic[99])+algebraic[58])+algebraic[95])-2.00000*algebraic[73])+algebraic[42])+algebraic[98])+algebraic[100] algebraic[117] = ((algebraic[116]+algebraic[78])+algebraic[90])+algebraic[113] algebraic[118] = custom_piecewise([less((voi-constants[100])-constants[101]*floor((voi-constants[100])/constants[101]) , constants[99]), 1.00000 , True, 0.00000]) algebraic[119] = algebraic[118]*constants[98] rates[20] = -(algebraic[117]+algebraic[119]) return(rates) def computeAlgebraic(constants, states, voi): algebraic = array([[0.0] * len(voi)] * sizeAlgebraic) states = array(states) voi = array(voi) algebraic[9] = 1.00000/(1.00000+exp((states[20]+91.0000)/6.10000)) algebraic[0] = 1.00000/(1.00000+exp(-((states[20]+3.00000*constants[23])+9.00000)/6.00000)) algebraic[14] = (algebraic[0]*(1.00000-exp(-((states[20]+3.00000*constants[23])+9.00000)/6.00000)))/(0.0350000*((states[20]+3.00000*constants[23])+9.00000)) algebraic[1] = 1.00000/(1.00000+exp(((states[20]+3.00000*constants[23])+30.0000)/7.00000))+0.200000/(1.00000+exp(((50.0000-states[20])-3.00000*constants[23])/20.0000)) algebraic[15] = 1.00000/(0.0197000*exp(-(power(0.0337000*((states[20]+3.00000*constants[23])+25.0000), 2.00000)))+0.0200000) algebraic[2] = 1.00000/(1.00000+exp(-(states[20]+10.0000)/5.00000)) algebraic[16] = (((550.000)/(1.00000+exp((-22.0000-states[20])/9.00000)))*6.00000)/(1.00000+exp((states[20]+11.0000)/9.00000))+230.000/(1.00000+exp((states[20]+40.0000)/20.0000)) algebraic[3] = 1.00000/(1.00000+exp(-((states[20]+40.0000*constants[23])+3.80000)/14.2500)) algebraic[17] = 990.100/(1.00000+exp(-((states[20]+40.0000*constants[23])+2.43600)/14.1200)) algebraic[4] = 1.00000/(1.00000+exp((states[20]+6.00000)/-8.60000)) algebraic[18] = 9.00000/(1.00000+exp((states[20]+5.00000)/12.0000))+0.500000 algebraic[5] = 1.00000/(1.00000+exp((states[20]+7.50000)/10.0000)) algebraic[19] = 590.000/(1.00000+exp((states[20]+60.0000)/10.0000))+3050.00 algebraic[8] = 1.00000/(power(1.00000+exp(-(56.8600+states[20])/9.03000), 2.00000)) algebraic[22] = 0.129200*exp(-(power((states[20]+45.7900)/15.5400, 2.00000)))+0.0648700*exp(-(power((states[20]-4.82300)/51.1200, 2.00000))) algebraic[10] = (0.320000*(states[20]+47.1300))/(1.00000-exp(-0.100000*(states[20]+47.1300))) algebraic[23] = 0.0800000*exp(-states[20]/11.0000) algebraic[11] = 1.00000/(1.00000+exp(-(states[20]+1.00000)/11.0000)) algebraic[24] = 3.50000*exp(-(power(states[20]/30.0000, 2.00000)))+1.50000 algebraic[12] = 1.00000/(1.00000+exp((states[20]+40.5000)/11.5000)) algebraic[25] = 25.6350*exp(-(power((states[20]+52.4500)/15.8827, 2.00000)))+24.1400 algebraic[27] = 1.00000/(power(1.00000+exp((states[20]+71.5500)/7.43000), 2.00000)) algebraic[6] = (custom_piecewise([greater_equal(states[20] , -40.0000), 0.00000 , True, 0.0570000*exp(-(states[20]+80.0000)/6.80000)]))*1.00000 algebraic[20] = (custom_piecewise([greater_equal(states[20] , -40.0000), 0.770000/(0.130000*(1.00000+exp(-(states[20]+10.6600)/11.1000))) , True, 2.70000*exp(0.0790000*states[20])+(3.10000*(power(10.0000, 5.00000)))*exp(0.348500*states[20])]))*1.00000 algebraic[30] = 1.00000/(algebraic[6]+algebraic[20]) algebraic[28] = 1.00000/(power(1.00000+exp((states[20]+71.5500)/7.43000), 2.00000)) algebraic[7] = (custom_piecewise([greater_equal(states[20] , -40.0000), 0.00000 , True, ((((-2.54280*(power(10.0000, 4.00000)))*exp(0.244400*states[20])-(6.94800*(power(10.0000, -6.00000)))*exp(-0.0439100*states[20]))*(states[20]+37.7800))/(1.00000+exp(0.311000*(states[20]+79.2300))))*1.00000]))*1.00000 algebraic[21] = (custom_piecewise([greater_equal(states[20] , -40.0000), (0.600000*exp(0.0570000*states[20]))/(1.00000+exp(-0.100000*(states[20]+32.0000))) , True, (0.0242400*exp(-0.0105200*states[20]))/(1.00000+exp(-0.137800*(states[20]+40.1400)))]))*1.00000 algebraic[31] = 1.00000/(algebraic[7]+algebraic[21]) algebraic[13] = ((1.00000-states[40])-states[39])-states[38] algebraic[26] = constants[88]-(constants[88]-constants[89])/(1.00000+power(constants[92]/states[18], 2.50000)) algebraic[29] = constants[94]*algebraic[26] algebraic[32] = constants[122]/algebraic[26] algebraic[33] = rates[5]+rates[3] algebraic[80] = ((1.00000/constants[109])/2.00000)*log(constants[51]/states[12]) algebraic[81] = (constants[42]*constants[41])*(states[20]-algebraic[80]) algebraic[36] = ((((constants[105]*4.00000)*((states[20]*constants[31])*constants[109]))*((0.341000*states[12])*exp((2.00000*states[20])*constants[109])-0.341000*constants[51]))/(exp((2.00000*states[20])*constants[109])-1.00000))*constants[44] algebraic[37] = (((((constants[50]*algebraic[36])*states[21])*states[22])*((1.00000-states[23])+constants[46]))*(power(constants[43], constants[132])))*0.450000 algebraic[59] = 1.00000/(1.00000+power(constants[66]/states[12], 2.00000)) algebraic[61] = (exp((constants[73]*states[20])*constants[109])*(power(states[16], 3.00000)))*constants[51] algebraic[62] = (exp(((constants[73]-1.00000)*states[20])*constants[109])*(power(constants[53], 3.00000)))*states[12] algebraic[63] = ((((constants[67]*(power(constants[53], 3.00000)))*(1.00000+power(states[16]/constants[69], 3.00000))+((power(constants[70], 3.00000))*states[12])*(1.00000+states[12]/constants[67]))+constants[68]*(power(states[16], 3.00000)))+(power(states[16], 3.00000))*constants[51])+(power(constants[53], 3.00000))*states[12] algebraic[64] = (((((constants[42]*constants[116])*(power(constants[71], constants[132])))*algebraic[59])*(algebraic[61]-algebraic[62]))/algebraic[63])/(1.00000+constants[72]*exp(((constants[73]-1.00000)*states[20])*constants[109])) algebraic[74] = power(states[12]*1.00000, 1.60000) algebraic[75] = (((constants[42]*(power(constants[82], constants[132])))*constants[80])*algebraic[74])/(algebraic[74]+constants[104]) algebraic[82] = ((algebraic[37]+algebraic[81])+algebraic[75])-2.00000*algebraic[64] algebraic[83] = (constants[97]*states[39])*(states[18]-states[12]) algebraic[85] = ((1.00000+0.250000*constants[34])*(states[18]-states[12]))*constants[86] algebraic[35] = (((((rates[10]+rates[8])+rates[9])+rates[0])+rates[1])+rates[2])+rates[7] algebraic[87] = (((power(constants[90], constants[132]))*constants[91])*(power(states[11]/constants[121], constants[93])-power(states[18]/constants[87], constants[93])))/((1.00000+power(states[11]/constants[121], constants[93]))+power(states[18]/constants[87], constants[93])) algebraic[34] = rates[6]+rates[4] algebraic[84] = ((1.00000/constants[109])/2.00000)*log(constants[51]/states[13]) algebraic[86] = (constants[127]*constants[41])*(states[20]-algebraic[84]) algebraic[38] = ((((constants[105]*4.00000)*((states[20]*constants[31])*constants[109]))*((0.341000*states[13])*exp((2.00000*states[20])*constants[109])-0.341000*constants[51]))/(exp((2.00000*states[20])*constants[109])-1.00000))*constants[44] algebraic[39] = (((((constants[108]*algebraic[38])*states[21])*states[22])*((1.00000-states[24])+constants[45]))*(power(constants[43], constants[132])))*0.450000 algebraic[60] = 1.00000/(1.00000+power(constants[66]/states[13], 2.00000)) algebraic[65] = (exp((constants[73]*states[20])*constants[109])*(power(states[17], 3.00000)))*constants[51] algebraic[66] = (exp(((constants[73]-1.00000)*states[20])*constants[109])*(power(constants[53], 3.00000)))*states[13] algebraic[67] = ((((constants[67]*(power(constants[53], 3.00000)))*(1.00000+power(states[17]/constants[69], 3.00000))+((power(constants[70], 3.00000))*states[13])*(1.00000+states[13]/constants[67]))+constants[68]*(power(states[17], 3.00000)))+(power(states[17], 3.00000))*constants[51])+(power(constants[53], 3.00000))*states[13] algebraic[68] = (((((constants[127]*constants[116])*(power(constants[71], constants[132])))*algebraic[60])*(algebraic[65]-algebraic[66]))/algebraic[67])/(1.00000+constants[72]*exp(((constants[73]-1.00000)*states[20])*constants[109])) algebraic[76] = power(states[13]*1.00000, 1.60000) algebraic[77] = (((constants[127]*(power(constants[82], constants[132])))*constants[80])*algebraic[76])/(algebraic[76]+constants[124]) algebraic[89] = ((algebraic[39]+algebraic[86])+algebraic[77])-2.00000*algebraic[68] algebraic[43] = (((((constants[107]*states[20])*constants[31])*constants[109])*((0.750000*states[16])*exp(states[20]*constants[109])-0.750000*constants[53]))/(exp(states[20]*constants[109])-1.00000))*constants[44] algebraic[44] = (((((constants[50]*algebraic[43])*states[21])*states[22])*((1.00000-states[23])+constants[46]))*(power(constants[43], constants[132])))*0.450000 algebraic[102] = (1.00000/constants[109])*log(constants[53]/states[16]) algebraic[103] = ((((constants[42]*constants[115])*(power(states[33], 3.00000)))*states[31])*states[32])*(states[20]-algebraic[102]) algebraic[104] = (constants[42]*constants[64])*(states[20]-algebraic[102]) algebraic[69] = 1.00000/((1.00000+0.124500*exp((-0.100000*states[20])*constants[109]))+(0.0365000*constants[118])*exp(-states[20]*constants[109])) algebraic[71] = ((((constants[42]*constants[74])*algebraic[69])*constants[52])/(1.00000+power(constants[117]/states[16], 4.00000)))/(constants[52]+constants[75]) algebraic[105] = (((constants[42]*constants[119])*(power(states[35], 3.00000)))*states[34])*(states[20]-algebraic[102]) algebraic[114] = ((((algebraic[103]+algebraic[104])+3.00000*algebraic[64])+3.00000*algebraic[71])+algebraic[44])+algebraic[105] algebraic[45] = (((((constants[107]*states[20])*constants[31])*constants[109])*((0.750000*states[17])*exp(states[20]*constants[109])-0.750000*constants[53]))/(exp(states[20]*constants[109])-1.00000))*constants[44] algebraic[46] = (((((constants[108]*algebraic[45])*states[21])*states[22])*((1.00000-states[24])+constants[45]))*(power(constants[43], constants[132])))*0.450000 algebraic[106] = (1.00000/constants[109])*log(constants[53]/states[17]) algebraic[107] = ((((constants[127]*constants[115])*(power(states[33], 3.00000)))*states[31])*states[32])*(states[20]-algebraic[106]) algebraic[109] = (constants[127]*constants[64])*(states[20]-algebraic[106]) algebraic[72] = ((((constants[127]*constants[74])*algebraic[69])*constants[52])/(1.00000+power(constants[117]/states[17], 4.00000)))/(constants[52]+constants[75]) algebraic[111] = (((constants[127]*constants[119])*(power(states[35], 3.00000)))*states[34])*(states[20]-algebraic[106]) algebraic[115] = ((((algebraic[107]+algebraic[109])+3.00000*algebraic[68])+3.00000*algebraic[72])+algebraic[46])+algebraic[111] algebraic[90] = algebraic[82]+algebraic[89] algebraic[47] = constants[54]*(states[20]-constants[125]) algebraic[49] = ((constants[42]*constants[55])/(1.00000+constants[56]/states[12]))*(states[20]-constants[125]) algebraic[51] = ((constants[127]*constants[55])/(1.00000+constants[56]/states[13]))*(states[20]-constants[125]) algebraic[52] = algebraic[49]+algebraic[51] algebraic[78] = algebraic[52]+algebraic[47] algebraic[116] = algebraic[114]+algebraic[115] algebraic[41] = (((((constants[106]*states[20])*constants[31])*constants[109])*((0.750000*states[25])*exp(states[20]*constants[109])-0.750000*constants[52]))/(exp(states[20]*constants[109])-1.00000))*constants[44] algebraic[42] = ((((algebraic[41]*states[21])*states[22])*(constants[50]*(constants[46]+(1.00000-states[23]))+constants[108]*(constants[45]+(1.00000-states[24]))))*(power(constants[43], constants[132])))*0.450000 algebraic[91] = (1.00000/constants[109])*log(constants[52]/states[25]) algebraic[92] = 1.00000*(1.02000/(1.00000+exp(0.238500*((states[20]-algebraic[91])-59.2150)))) algebraic[93] = 1.00000*((0.491240*exp(0.0803200*((states[20]+5.47600)-algebraic[91]))+exp(0.0617500*((states[20]-algebraic[91])-594.310)))/(1.00000+exp(-0.514300*((states[20]-algebraic[91])+4.75300)))) algebraic[94] = algebraic[92]/(algebraic[92]+algebraic[93]) algebraic[95] = (constants[110]*algebraic[94])*(states[20]-algebraic[91]) algebraic[53] = 1.00000/(1.00000+exp(7.48800-states[20]/5.98000)) algebraic[96] = ((constants[42]*constants[58])*algebraic[53])*(states[20]-algebraic[91]) algebraic[97] = ((constants[127]*constants[58])*algebraic[53])*(states[20]-algebraic[91]) algebraic[98] = algebraic[96]+algebraic[97] algebraic[54] = 1.00000/(1.00000+exp((states[20]+74.0000)/24.0000)) algebraic[99] = ((constants[111]*states[26])*algebraic[54])*(states[20]-algebraic[91]) algebraic[55] = (1.00000/constants[109])*log((constants[52]+constants[61]*constants[53])/(states[25]+constants[61]*states[28])) algebraic[56] = ((constants[42]*constants[112])*(power(states[27], 2.00000)))*(states[20]-algebraic[55]) algebraic[57] = ((constants[127]*constants[113])*(power(states[27], 2.00000)))*(states[20]-algebraic[55]) algebraic[58] = algebraic[56]+algebraic[57] algebraic[100] = ((constants[114]*states[29])*states[30])*(states[20]-algebraic[91]) algebraic[73] = algebraic[71]+algebraic[72] algebraic[101] = ((constants[120]*states[36])*states[37])*(states[20]-algebraic[91]) algebraic[113] = ((((((algebraic[101]+algebraic[99])+algebraic[58])+algebraic[95])-2.00000*algebraic[73])+algebraic[42])+algebraic[98])+algebraic[100] algebraic[117] = ((algebraic[116]+algebraic[78])+algebraic[90])+algebraic[113] algebraic[118] = custom_piecewise([less((voi-constants[100])-constants[101]*floor((voi-constants[100])/constants[101]) , constants[99]), 1.00000 , True, 0.00000]) algebraic[119] = algebraic[118]*constants[98] algebraic[40] = algebraic[37]+algebraic[39] algebraic[48] = algebraic[44]+algebraic[46] algebraic[50] = (algebraic[40]+algebraic[42])+algebraic[48] algebraic[70] = algebraic[64]+algebraic[68] algebraic[79] = algebraic[75]+algebraic[77] algebraic[88] = algebraic[81]+algebraic[86] algebraic[108] = algebraic[103]+algebraic[107] algebraic[110] = algebraic[104]+algebraic[109] algebraic[112] = algebraic[105]+algebraic[111] 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)