# 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 = 84 sizeStates = 39 sizeConstants = 148 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] = "t_period in component Istim_parameters (ms)" legend_constants[1] = "V_ICCrest in component Istim_parameters (mV)" legend_constants[2] = "V_ICCamp in component Istim_parameters (mV)" legend_constants[3] = "t_ICCpeak in component Istim_parameters (ms)" legend_constants[4] = "t_slope in component Istim_parameters (ms)" legend_constants[5] = "f_1 in component Istim_parameters (ms)" legend_constants[6] = "f_2 in component Istim_parameters (ms)" legend_constants[7] = "Gcouple in component Istim_parameters (nS)" legend_voi = "time in component time (ms)" legend_algebraic[13] = "I_stim in component Periodic_IStim_protocol (pA)" legend_algebraic[8] = "V_ICC in component Periodic_IStim_protocol (mV)" legend_states[0] = "V in component Membrane_potential (mV)" legend_algebraic[82] = "I_ion in component Membrane_potential (pA)" legend_algebraic[37] = "I in component Ionic_currents (pA)" legend_algebraic[45] = "I in component Ionic_currents (pA)" legend_algebraic[54] = "I in component Ionic_currents (pA)" legend_algebraic[61] = "I in component Ionic_currents (pA)" legend_algebraic[67] = "I in component Ionic_currents (pA)" legend_algebraic[25] = "I_NCX in component INCX (pA)" legend_algebraic[29] = "I_NaK in component INaK (pA)" legend_algebraic[73] = "I in component Ionic_currents (pA)" legend_algebraic[79] = "I in component Ionic_currents (pA)" legend_states[1] = "Cai in component Cai (mM)" legend_states[2] = "Nai in component Nai (mM)" legend_states[3] = "Ki in component Ki (mM)" legend_states[4] = "O_CaL in component ICaL_channel_states (dimensionless)" legend_algebraic[17] = "P_CaT in component ICaT (dimensionless)" legend_states[5] = "O4 in component IBK_channel_states (dimensionless)" legend_algebraic[21] = "P_Kv in component IKv (dimensionless)" legend_states[6] = "O_Na in component INa_channel_states (dimensionless)" legend_algebraic[83] = "norm in component ICaL_channel_states (dimensionless)" legend_algebraic[81] = "norm in component IBK_channel_states (dimensionless)" legend_algebraic[56] = "norm in component INa_channel_states (dimensionless)" legend_states[7] = "X in component gating_kinetics (dimensionless)" legend_states[8] = "X in component gating_kinetics (dimensionless)" legend_states[9] = "X in component gating_kinetics (dimensionless)" legend_states[10] = "X in component gating_kinetics (dimensionless)" legend_constants[8] = "g_CaL in component g_parameters (nS)" legend_constants[9] = "g_Kv in component g_parameters (nS)" legend_constants[10] = "g_BK in component g_parameters (nS)" legend_constants[11] = "g_Na in component g_parameters (nS)" legend_constants[12] = "V_init in component initial_conditions (mV)" legend_constants[13] = "Cm in component model_parameters (pF)" legend_constants[14] = "R in component model_parameters (J_per_K_mol)" legend_constants[15] = "T in component model_parameters (kelvin)" legend_constants[16] = "F in component model_parameters (C_per_mmol)" legend_constants[17] = "T0CaL in component model_parameters (kelvin)" legend_constants[18] = "T0CaT in component model_parameters (kelvin)" legend_constants[19] = "Q10Ca in component model_parameters (dimensionless)" legend_constants[20] = "Cao in component model_parameters (mM)" legend_constants[21] = "C0_init in component initial_conditions (dimensionless)" legend_constants[22] = "C1_init in component initial_conditions (dimensionless)" legend_constants[23] = "C2_init in component initial_conditions (dimensionless)" legend_constants[24] = "C3_init in component initial_conditions (dimensionless)" legend_constants[25] = "C0Ca_init in component initial_conditions (dimensionless)" legend_constants[26] = "C1Ca_init in component initial_conditions (dimensionless)" legend_constants[27] = "C2Ca_init in component initial_conditions (dimensionless)" legend_constants[28] = "C3Ca_init in component initial_conditions (dimensionless)" legend_constants[29] = "ICa_init in component initial_conditions (dimensionless)" legend_constants[30] = "IVs_init in component initial_conditions (dimensionless)" legend_constants[31] = "IVf_init in component initial_conditions (dimensionless)" legend_constants[32] = "IVfCa_init in component initial_conditions (dimensionless)" legend_constants[33] = "IVsCa_init in component initial_conditions (dimensionless)" legend_constants[34] = "O_CaL_init in component initial_conditions (dimensionless)" legend_constants[35] = "g_CaT in component model_parameters (nS)" legend_constants[36] = "d_CaT_init in component initial_conditions (dimensionless)" legend_constants[37] = "f_CaT_init in component initial_conditions (dimensionless)" legend_constants[38] = "tau_dCaT in component model_parameters (ms)" legend_constants[39] = "T0K in component model_parameters (kelvin)" legend_constants[40] = "Q10K in component model_parameters (dimensionless)" legend_constants[41] = "Ko in component model_parameters (mM)" legend_constants[42] = "x_Kv_init in component initial_conditions (dimensionless)" legend_constants[43] = "y_Kv_init in component initial_conditions (dimensionless)" legend_constants[44] = "tau_xKv in component model_parameters (ms)" legend_constants[45] = "tau_yKv in component model_parameters (ms)" legend_constants[46] = "BK_C0_init in component initial_conditions (dimensionless)" legend_constants[47] = "BK_C1_init in component initial_conditions (dimensionless)" legend_constants[48] = "BK_C2_init in component initial_conditions (dimensionless)" legend_constants[49] = "BK_C3_init in component initial_conditions (dimensionless)" legend_constants[50] = "BK_C4_init in component initial_conditions (dimensionless)" legend_constants[51] = "O0_init in component initial_conditions (dimensionless)" legend_constants[52] = "O1_init in component initial_conditions (dimensionless)" legend_constants[53] = "O2_init in component initial_conditions (dimensionless)" legend_constants[54] = "O3_init in component initial_conditions (dimensionless)" legend_constants[55] = "O4_init in component initial_conditions (dimensionless)" legend_constants[56] = "k_on in component model_parameters (per_ms)" legend_constants[57] = "k_off_C in component model_parameters (per_ms)" legend_constants[58] = "k_off_O in component model_parameters (per_ms)" legend_constants[59] = "T0Na in component model_parameters (kelvin)" legend_constants[60] = "Q10Na in component model_parameters (dimensionless)" legend_constants[61] = "Nao in component model_parameters (mM)" legend_constants[62] = "Na_C1_init in component initial_conditions (dimensionless)" legend_constants[63] = "Na_C2_init in component initial_conditions (dimensionless)" legend_constants[64] = "Na_C3_init in component initial_conditions (dimensionless)" legend_constants[65] = "I1_init in component initial_conditions (dimensionless)" legend_constants[66] = "I2_init in component initial_conditions (dimensionless)" legend_constants[67] = "O_Na_init in component initial_conditions (dimensionless)" legend_constants[68] = "K_mCa in component model_parameters (mM)" legend_constants[69] = "K_mNai in component model_parameters (mM)" legend_constants[70] = "k_sat in component model_parameters (dimensionless)" legend_constants[71] = "gamma in component model_parameters (dimensionless)" legend_constants[72] = "P_NCX in component model_parameters (pA)" legend_constants[73] = "K_mK in component model_parameters (mM)" legend_constants[74] = "K_mNa in component model_parameters (mM)" legend_constants[75] = "P_NaK in component model_parameters (pA)" legend_constants[76] = "g_NsNa in component model_parameters (nS)" legend_constants[77] = "g_NsK in component model_parameters (nS)" legend_constants[78] = "n_CRT in component model_parameters (dimensionless)" legend_constants[79] = "n_CaM in component model_parameters (dimensionless)" legend_constants[80] = "CRT_total in component model_parameters (mM)" legend_constants[81] = "CaM_total in component model_parameters (mM)" legend_constants[82] = "K_D_CRT in component model_parameters (mM)" legend_constants[83] = "K_D_CaM in component model_parameters (mM4)" legend_constants[84] = "V_cell in component model_parameters (litre)" legend_constants[85] = "Cai_total_init in component initial_conditions (mM)" legend_constants[86] = "Cai_init in component initial_conditions (mM)" legend_constants[87] = "Nai_init in component initial_conditions (mM)" legend_constants[88] = "Ki_init in component initial_conditions (mM)" legend_algebraic[0] = "t in component Periodic_IStim_protocol (ms)" legend_constants[89] = "g_CaL in component model_parameters (nS)" legend_constants[90] = "g_Kv in component model_parameters (nS)" legend_constants[91] = "g_BK in component model_parameters (nS)" legend_constants[92] = "g_Na in component model_parameters (nS)" legend_constants[93] = "PO in component INS_Na (dimensionless)" legend_constants[94] = "PO in component INS_K (dimensionless)" legend_states[11] = "Cai_total in component Cai (mM)" legend_algebraic[52] = "Cai_total_rate in component Cai (mM_per_ms)" legend_constants[95] = "Cvt in component Cai (fM_per_s2mM_per_ms)" legend_constants[96] = "Cvt in component Nai (fM_per_s2mM_per_ms)" legend_constants[97] = "Cvt in component Ki (fM_per_s2mM_per_ms)" legend_algebraic[33] = "E in component Nernst_potential (mV)" legend_states[12] = "C0 in component ICaL_channel_states (dimensionless)" legend_states[13] = "C1 in component ICaL_channel_states (dimensionless)" legend_states[14] = "C2 in component ICaL_channel_states (dimensionless)" legend_states[15] = "C3 in component ICaL_channel_states (dimensionless)" legend_states[16] = "C0Ca in component ICaL_channel_states (dimensionless)" legend_states[17] = "C1Ca in component ICaL_channel_states (dimensionless)" legend_states[18] = "C2Ca in component ICaL_channel_states (dimensionless)" legend_states[19] = "C3Ca in component ICaL_channel_states (dimensionless)" legend_states[20] = "ICa in component ICaL_channel_states (dimensionless)" legend_states[21] = "IVs in component ICaL_channel_states (dimensionless)" legend_states[22] = "IVf in component ICaL_channel_states (dimensionless)" legend_states[23] = "IVfCa in component ICaL_channel_states (dimensionless)" legend_states[24] = "IVsCa in component ICaL_channel_states (dimensionless)" legend_algebraic[1] = "alpha in component ICaL_channel_states (per_ms)" legend_algebraic[9] = "beta in component ICaL_channel_states (per_ms)" legend_algebraic[14] = "alpha_0 in component ICaL_channel_states (per_ms)" legend_algebraic[18] = "alpha_1 in component ICaL_channel_states (per_ms)" legend_algebraic[22] = "alpha_2 in component ICaL_channel_states (per_ms)" legend_algebraic[26] = "alpha_3 in component ICaL_channel_states (per_ms)" legend_algebraic[31] = "beta_0 in component ICaL_channel_states (per_ms)" legend_algebraic[36] = "beta_1 in component ICaL_channel_states (per_ms)" legend_algebraic[40] = "beta_2 in component ICaL_channel_states (per_ms)" legend_algebraic[44] = "beta_3 in component ICaL_channel_states (per_ms)" legend_constants[147] = "delta in component ICaL_channel_states (per_ms)" legend_algebraic[80] = "theta in component ICaL_channel_states (per_ms)" legend_algebraic[53] = "phi_s in component ICaL_channel_states (per_ms)" legend_algebraic[48] = "phi_f in component ICaL_channel_states (per_ms)" legend_algebraic[71] = "omega_s in component ICaL_channel_states (per_ms)" legend_algebraic[68] = "omega_f in component ICaL_channel_states (per_ms)" legend_algebraic[77] = "omega_fs in component ICaL_channel_states (per_ms)" legend_algebraic[74] = "omega_sf in component ICaL_channel_states (per_ms)" legend_algebraic[66] = "psi_s in component ICaL_channel_states (per_ms)" legend_algebraic[63] = "psi_f in component ICaL_channel_states (per_ms)" legend_algebraic[60] = "xi_s in component ICaL_channel_states (per_ms)" legend_algebraic[57] = "xi_f in component ICaL_channel_states (per_ms)" legend_constants[133] = "phi in component temperature_factor (dimensionless)" legend_algebraic[41] = "E in component Nernst_potential (mV)" legend_algebraic[2] = "X_inf in component d_inf (dimensionless)" legend_constants[134] = "phi in component temperature_factor (dimensionless)" legend_algebraic[3] = "X_inf in component f_inf (dimensionless)" legend_algebraic[10] = "tau in component tau_f (ms)" legend_constants[135] = "phi in component temperature_factor (dimensionless)" legend_algebraic[49] = "E in component Nernst_potential (mV)" legend_algebraic[4] = "X_inf in component x_inf (dimensionless)" legend_constants[136] = "phi in component temperature_factor (dimensionless)" legend_algebraic[5] = "X_inf in component y_inf (dimensionless)" legend_constants[137] = "phi in component temperature_factor (dimensionless)" legend_algebraic[58] = "E in component Nernst_potential (mV)" legend_states[25] = "C0 in component IBK_channel_states (dimensionless)" legend_states[26] = "C1 in component IBK_channel_states (dimensionless)" legend_states[27] = "C2 in component IBK_channel_states (dimensionless)" legend_states[28] = "C3 in component IBK_channel_states (dimensionless)" legend_states[29] = "C4 in component IBK_channel_states (dimensionless)" legend_states[30] = "O0 in component IBK_channel_states (dimensionless)" legend_states[31] = "O1 in component IBK_channel_states (dimensionless)" legend_states[32] = "O2 in component IBK_channel_states (dimensionless)" legend_states[33] = "O3 in component IBK_channel_states (dimensionless)" legend_algebraic[6] = "alpha in component IBK_channel_states (per_ms)" legend_algebraic[11] = "beta in component IBK_channel_states (per_ms)" legend_algebraic[15] = "k_C0O0 in component IBK_channel_states (per_ms)" legend_algebraic[19] = "k_C1O1 in component IBK_channel_states (per_ms)" legend_algebraic[23] = "k_C2O2 in component IBK_channel_states (per_ms)" legend_algebraic[27] = "k_C3O3 in component IBK_channel_states (per_ms)" legend_algebraic[32] = "k_C4O4 in component IBK_channel_states (per_ms)" legend_algebraic[34] = "k_O0C0 in component IBK_channel_states (per_ms)" legend_algebraic[38] = "k_O1C1 in component IBK_channel_states (per_ms)" legend_algebraic[42] = "k_O2C2 in component IBK_channel_states (per_ms)" legend_algebraic[46] = "k_O3C3 in component IBK_channel_states (per_ms)" legend_algebraic[50] = "k_O4C4 in component IBK_channel_states (per_ms)" legend_algebraic[55] = "k_C0C1 in component IBK_channel_states (per_ms)" legend_algebraic[59] = "k_C1C2 in component IBK_channel_states (per_ms)" legend_algebraic[62] = "k_C2C3 in component IBK_channel_states (per_ms)" legend_algebraic[65] = "k_C3C4 in component IBK_channel_states (per_ms)" legend_constants[138] = "k_C4C3 in component IBK_channel_states (per_ms)" legend_constants[139] = "k_C3C2 in component IBK_channel_states (per_ms)" legend_constants[140] = "k_C2C1 in component IBK_channel_states (per_ms)" legend_constants[141] = "k_C1C0 in component IBK_channel_states (per_ms)" legend_algebraic[69] = "k_O0O1 in component IBK_channel_states (per_ms)" legend_algebraic[72] = "k_O1O2 in component IBK_channel_states (per_ms)" legend_algebraic[75] = "k_O2O3 in component IBK_channel_states (per_ms)" legend_algebraic[78] = "k_O3O4 in component IBK_channel_states (per_ms)" legend_constants[142] = "k_O4O3 in component IBK_channel_states (per_ms)" legend_constants[143] = "k_O3O2 in component IBK_channel_states (per_ms)" legend_constants[144] = "k_O2O1 in component IBK_channel_states (per_ms)" legend_constants[145] = "k_O1O0 in component IBK_channel_states (per_ms)" legend_algebraic[64] = "E in component Nernst_potential (mV)" legend_states[34] = "C1 in component INa_channel_states (dimensionless)" legend_states[35] = "C2 in component INa_channel_states (dimensionless)" legend_states[36] = "C3 in component INa_channel_states (dimensionless)" legend_states[37] = "I1 in component INa_channel_states (dimensionless)" legend_states[38] = "I2 in component INa_channel_states (dimensionless)" legend_algebraic[7] = "k_I2I1 in component INa_channel_states (per_ms)" legend_algebraic[12] = "k_I1O in component INa_channel_states (per_ms)" legend_algebraic[16] = "k_OC1 in component INa_channel_states (per_ms)" legend_algebraic[20] = "k_C1C2 in component INa_channel_states (per_ms)" legend_algebraic[24] = "k_C2C3 in component INa_channel_states (per_ms)" legend_algebraic[28] = "k_C3C2 in component INa_channel_states (per_ms)" legend_algebraic[30] = "k_C2C1 in component INa_channel_states (per_ms)" legend_algebraic[35] = "k_C1O in component INa_channel_states (per_ms)" legend_algebraic[39] = "k_OI1 in component INa_channel_states (per_ms)" legend_algebraic[43] = "k_I1I2 in component INa_channel_states (per_ms)" legend_algebraic[47] = "k_I1C1 in component INa_channel_states (per_ms)" legend_algebraic[51] = "k_C1I1 in component INa_channel_states (per_ms)" legend_constants[146] = "phi in component temperature_factor (dimensionless)" legend_algebraic[70] = "E in component Nernst_potential (mV)" legend_algebraic[76] = "E in component Nernst_potential (mV)" legend_constants[98] = "R in component constants (J_per_K_mol)" legend_constants[99] = "F in component constants (C_per_mmol)" legend_constants[100] = "z_Ca in component constants (dimensionless)" legend_constants[101] = "z_Na in component constants (dimensionless)" legend_constants[102] = "z_K in component constants (dimensionless)" legend_constants[103] = "R in component constants (J_per_K_mol)" legend_constants[104] = "F in component constants (C_per_mmol)" legend_constants[105] = "z_Ca in component constants (dimensionless)" legend_constants[106] = "z_Na in component constants (dimensionless)" legend_constants[107] = "z_K in component constants (dimensionless)" legend_constants[108] = "R in component constants (J_per_K_mol)" legend_constants[109] = "F in component constants (C_per_mmol)" legend_constants[110] = "z_K in component constants (dimensionless)" legend_constants[111] = "z_Na in component constants (dimensionless)" legend_constants[112] = "z_Ca in component constants (dimensionless)" legend_constants[113] = "R in component constants (J_per_K_mol)" legend_constants[114] = "F in component constants (C_per_mmol)" legend_constants[115] = "z_K in component constants (dimensionless)" legend_constants[116] = "z_Na in component constants (dimensionless)" legend_constants[117] = "z_Ca in component constants (dimensionless)" legend_constants[118] = "R in component constants (J_per_K_mol)" legend_constants[119] = "F in component constants (C_per_mmol)" legend_constants[120] = "z_Na in component constants (dimensionless)" legend_constants[121] = "z_Ca in component constants (dimensionless)" legend_constants[122] = "z_K in component constants (dimensionless)" legend_constants[123] = "R in component constants (J_per_K_mol)" legend_constants[124] = "F in component constants (C_per_mmol)" legend_constants[125] = "z_Na in component constants (dimensionless)" legend_constants[126] = "z_Ca in component constants (dimensionless)" legend_constants[127] = "z_K in component constants (dimensionless)" legend_constants[128] = "R in component constants (J_per_K_mol)" legend_constants[129] = "F in component constants (C_per_mmol)" legend_constants[130] = "z_K in component constants (dimensionless)" legend_constants[131] = "z_Na in component constants (dimensionless)" legend_constants[132] = "z_Ca in component constants (dimensionless)" legend_rates[0] = "d/dt V in component Membrane_potential (mV)" legend_rates[11] = "d/dt Cai_total in component Cai (mM)" legend_rates[1] = "d/dt Cai in component Cai (mM)" legend_rates[2] = "d/dt Nai in component Nai (mM)" legend_rates[3] = "d/dt Ki in component Ki (mM)" legend_rates[15] = "d/dt C3 in component ICaL_channel_states (dimensionless)" legend_rates[14] = "d/dt C2 in component ICaL_channel_states (dimensionless)" legend_rates[13] = "d/dt C1 in component ICaL_channel_states (dimensionless)" legend_rates[12] = "d/dt C0 in component ICaL_channel_states (dimensionless)" legend_rates[19] = "d/dt C3Ca in component ICaL_channel_states (dimensionless)" legend_rates[18] = "d/dt C2Ca in component ICaL_channel_states (dimensionless)" legend_rates[17] = "d/dt C1Ca in component ICaL_channel_states (dimensionless)" legend_rates[16] = "d/dt C0Ca in component ICaL_channel_states (dimensionless)" legend_rates[4] = "d/dt O_CaL in component ICaL_channel_states (dimensionless)" legend_rates[20] = "d/dt ICa in component ICaL_channel_states (dimensionless)" legend_rates[21] = "d/dt IVs in component ICaL_channel_states (dimensionless)" legend_rates[22] = "d/dt IVf in component ICaL_channel_states (dimensionless)" legend_rates[24] = "d/dt IVsCa in component ICaL_channel_states (dimensionless)" legend_rates[23] = "d/dt IVfCa in component ICaL_channel_states (dimensionless)" legend_rates[7] = "d/dt X in component gating_kinetics (dimensionless)" legend_rates[8] = "d/dt X in component gating_kinetics (dimensionless)" legend_rates[9] = "d/dt X in component gating_kinetics (dimensionless)" legend_rates[10] = "d/dt X in component gating_kinetics (dimensionless)" legend_rates[29] = "d/dt C4 in component IBK_channel_states (dimensionless)" legend_rates[28] = "d/dt C3 in component IBK_channel_states (dimensionless)" legend_rates[27] = "d/dt C2 in component IBK_channel_states (dimensionless)" legend_rates[26] = "d/dt C1 in component IBK_channel_states (dimensionless)" legend_rates[25] = "d/dt C0 in component IBK_channel_states (dimensionless)" legend_rates[5] = "d/dt O4 in component IBK_channel_states (dimensionless)" legend_rates[33] = "d/dt O3 in component IBK_channel_states (dimensionless)" legend_rates[32] = "d/dt O2 in component IBK_channel_states (dimensionless)" legend_rates[31] = "d/dt O1 in component IBK_channel_states (dimensionless)" legend_rates[30] = "d/dt O0 in component IBK_channel_states (dimensionless)" legend_rates[36] = "d/dt C3 in component INa_channel_states (dimensionless)" legend_rates[35] = "d/dt C2 in component INa_channel_states (dimensionless)" legend_rates[34] = "d/dt C1 in component INa_channel_states (dimensionless)" legend_rates[6] = "d/dt O_Na in component INa_channel_states (dimensionless)" legend_rates[38] = "d/dt I2 in component INa_channel_states (dimensionless)" legend_rates[37] = "d/dt I1 in component INa_channel_states (dimensionless)" return (legend_states, legend_algebraic, legend_voi, legend_constants) def initConsts(): constants = [0.0] * sizeConstants; states = [0.0] * sizeStates; constants[0] = 10000 constants[1] = -57 constants[2] = 33.5 constants[3] = 300 constants[4] = 600 constants[5] = 12000 constants[6] = 300 constants[7] = 2.6 constants[8] = 1.44 constants[9] = 1.0217 constants[10] = 80 constants[11] = 25.1 constants[12] = -73.5049651455872 constants[13] = 50 constants[14] = 8.314 constants[15] = 310 constants[16] = 96.48534 constants[17] = 310 constants[18] = 297 constants[19] = 2.1 constants[20] = 2 constants[21] = 0.815464741971086 constants[22] = 0.152399266235657 constants[23] = 0.0106805060777161 constants[24] = 0.000332673548872087 constants[25] = 0.0175888495282545 constants[26] = 0.00328711668724504 constants[27] = 0.000230369020877669 constants[28] = 7.1754726923539e-6 constants[29] = 8.38123983500905e-8 constants[30] = 1.1193313274705e-6 constants[31] = 4.0998751301597e-6 constants[32] = 8.84306615061238e-8 constants[33] = 2.41429816075123e-8 constants[34] = 3.88576045134351e-6 constants[35] = 0.0425 constants[36] = 0.0791635737410974 constants[37] = 0.377831534375835 constants[38] = 1.9508 constants[39] = 297 constants[40] = 3.1 constants[41] = 5.4 constants[42] = 0.14714161078933 constants[43] = 0.99994773314105 constants[44] = 4.7803 constants[45] = 763.7564 constants[46] = 0.48379087935899 constants[47] = 0.385183559520031 constants[48] = 0.115002824567753 constants[49] = 0.0152602714149774 constants[50] = 0.000759264410974374 constants[51] = 6.94960798375172e-7 constants[52] = 5.55636826398253e-8 constants[53] = 2.85143702125325e-8 constants[54] = 1.59832806123435e-6 constants[55] = 1.82113764497095e-6 constants[56] = 40633 constants[57] = 11 constants[58] = 1.1 constants[59] = 297 constants[60] = 2.45 constants[61] = 140 constants[62] = 0.0119443135223679 constants[63] = 0.0109545368437155 constants[64] = 0.973782548650071 constants[65] = 0.000126882921013389 constants[66] = 0.00318975045717667 constants[67] = 1.96760342050475e-6 constants[68] = 1.38 constants[69] = 87.5 constants[70] = 0.1 constants[71] = 0.35 constants[72] = 1992.1865 constants[73] = 1 constants[74] = 40 constants[75] = 16.197 constants[76] = 0.022488 constants[77] = 0.017512 constants[78] = 1 constants[79] = 4 constants[80] = 0.034 constants[81] = 0.012 constants[82] = 0.0009 constants[83] = 0.0001 constants[84] = 3.5e-12 constants[85] = 0.004914 constants[86] = 5.38843941249284e-5 constants[87] = 10.5731241425458 constants[88] = 153.604280337996 constants[89] = 1.44 constants[90] = 1.0217 constants[91] = 80 constants[92] = 25.1 constants[93] = 1 constants[94] = 1 constants[95] = 1e-15 constants[96] = 1e-15 constants[97] = 1e-15 constants[98] = 8.314 constants[99] = 96.48534 constants[100] = 2 constants[101] = 1 constants[102] = 1 constants[103] = 8.314 constants[104] = 96.48534 constants[105] = 2 constants[106] = 1 constants[107] = 1 constants[108] = 8.314 constants[109] = 96.48534 constants[110] = 1 constants[111] = 1 constants[112] = 2 constants[113] = 8.314 constants[114] = 96.48534 constants[115] = 1 constants[116] = 1 constants[117] = 2 constants[118] = 8.314 constants[119] = 96.48534 constants[120] = 1 constants[121] = 2 constants[122] = 1 constants[123] = 8.314 constants[124] = 96.48534 constants[125] = 1 constants[126] = 2 constants[127] = 1 constants[128] = 8.314 constants[129] = 96.48534 constants[130] = 1 constants[131] = 1 constants[132] = 2 constants[133] = power(constants[19], (constants[15]-constants[17])/10.0000) constants[134] = power(constants[19], (constants[15]-constants[18])/10.0000) constants[135] = power(constants[19], (constants[15]-constants[18])/10.0000) constants[136] = power(constants[40], (constants[15]-constants[39])/10.0000) constants[137] = power(constants[40], (constants[15]-constants[39])/10.0000) constants[138] = 4.00000*constants[57] constants[139] = 3.00000*constants[57] constants[140] = 2.00000*constants[57] constants[141] = 1.00000*constants[57] constants[142] = 4.00000*constants[58] constants[143] = 3.00000*constants[58] constants[144] = 2.00000*constants[58] constants[145] = 1.00000*constants[58] constants[146] = power(constants[60], (constants[15]-constants[59])/10.0000) constants[147] = constants[133]*0.0100000 states[0] = constants[12] states[1] = constants[86] states[2] = constants[87] states[3] = constants[88] states[4] = constants[34] states[5] = constants[55] states[6] = constants[67] states[7] = constants[36] states[8] = constants[37] states[9] = constants[42] states[10] = constants[43] states[11] = constants[85] states[12] = constants[21] states[13] = constants[22] states[14] = constants[23] states[15] = constants[24] states[16] = constants[25] states[17] = constants[26] states[18] = constants[27] states[19] = constants[28] states[20] = constants[29] states[21] = constants[30] states[22] = constants[31] states[23] = constants[32] states[24] = constants[32] states[25] = constants[46] states[26] = constants[47] states[27] = constants[48] states[28] = constants[49] states[29] = constants[50] states[30] = constants[51] states[31] = constants[52] states[32] = constants[53] states[33] = constants[54] states[34] = constants[62] states[35] = constants[63] states[36] = constants[64] states[37] = constants[65] states[38] = constants[66] return (states, constants) def computeRates(voi, states, constants): rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic algebraic[2] = 1.00000/(1.00000+exp(-(states[0]+60.5000)/5.30000)) rates[7] = ((algebraic[2]-states[7])/constants[38])*constants[134] algebraic[4] = 1.00000/(1.00000+exp(-(states[0]+43.0000)/17.3600)) rates[9] = ((algebraic[4]-states[9])/constants[44])*constants[136] algebraic[5] = 1.00000/(1.00000+exp((states[0]-44.9000)/12.0096)) rates[10] = ((algebraic[5]-states[10])/constants[45])*constants[137] algebraic[3] = 1.00000/(1.00000+exp((states[0]+75.5000)/4.00000)) algebraic[10] = 0.381170*(8.60000+14.7000*exp(-(power(states[0]+50.0000, 2.00000))/(900.000*1.00000))) rates[8] = ((algebraic[3]-states[8])/algebraic[10])*constants[135] algebraic[33] = ((constants[98]*constants[15])/(constants[100]*constants[99]))*log(constants[20]/states[1]) algebraic[37] = constants[8]*states[4]*(states[0]-algebraic[33]) algebraic[17] = states[7]*states[8] algebraic[41] = ((constants[103]*constants[15])/(constants[105]*constants[104]))*log(constants[20]/states[1]) algebraic[45] = constants[35]*algebraic[17]*(states[0]-algebraic[41]) algebraic[25] = (constants[72]*(exp((constants[71]*states[0]*constants[16])/(constants[14]*constants[15]))*(power(states[2], 3.00000))*constants[20]-2.50000*exp(((constants[71]-1.00000)*states[0]*constants[16])/(constants[14]*constants[15]))*(power(constants[61], 3.00000))*states[1]))/((power(constants[69], 3.00000)+power(constants[61], 3.00000))*(constants[68]+constants[20])*(1.00000+constants[70]*exp(((constants[71]-1.00000)*states[0]*constants[16])/(constants[14]*constants[15])))) rates[11] = (-((algebraic[37]+algebraic[45])-2.00000*algebraic[25])*constants[95])/(2.00000*constants[16]*constants[84]) algebraic[52] = (-((algebraic[37]+algebraic[45])-2.00000*algebraic[25])*constants[95])/(2.00000*constants[16]*constants[84]) rates[1] = algebraic[52]/(1.00000+(constants[78]*constants[80]*constants[82]*(power(states[1], constants[78]-1.00000)))/(power(power(states[1], constants[78])+constants[82], 2.00000))+(constants[79]*constants[81]*constants[83]*(power(states[1], constants[79]-1.00000)))/(power(power(states[1], constants[79])+constants[83], 2.00000))) algebraic[56] = states[6]+states[34]+states[35]+states[36]+states[37]+states[38] algebraic[24] = constants[146]*0.554320*exp(-0.0990740+0.0364410*states[0]) algebraic[28] = constants[146]*0.000525480*exp(-0.0691020+0.00319450*states[0]) rates[36] = (-algebraic[28]*states[36])/algebraic[56]+(algebraic[24]*states[35])/algebraic[56] algebraic[20] = constants[146]*3.15660*exp(0.363520+0.0771930*states[0]) algebraic[30] = constants[146]*1.44960*exp(-0.156600+0.0583530*states[0]) rates[35] = (-(algebraic[30]+algebraic[24])*states[35])/algebraic[56]+(algebraic[20]*states[34])/algebraic[56]+(algebraic[28]*states[36])/algebraic[56] algebraic[16] = constants[146]*2.39100*exp(-13.3350-0.252890*states[0]) algebraic[35] = constants[146]*1.53290*exp(0.00931930+0.0410750*states[0]) algebraic[47] = constants[146]*1.90460*exp(-2.48400+0.0204060*states[0]) algebraic[51] = constants[146]*0.000216880*exp(-0.0634380+0.00466830*states[0]) rates[34] = (-(algebraic[20]+algebraic[35]+algebraic[51])*states[34])/algebraic[56]+(algebraic[16]*states[6])/algebraic[56]+(algebraic[30]*states[35])/algebraic[56]+(algebraic[47]*states[37])/algebraic[56] algebraic[12] = constants[146]*0.120520*exp(-9.60280+0.0830250*states[0]) algebraic[39] = constants[146]*1.61640*exp(0.307630+0.00605350*states[0]) rates[6] = (-(algebraic[16]+algebraic[39])*states[6])/algebraic[56]+(algebraic[35]*states[34])/algebraic[56]+(algebraic[12]*states[37])/algebraic[56] algebraic[7] = constants[146]*0.00392390*exp(2.67930+0.00614680*states[0]) algebraic[43] = constants[146]*0.0277350*exp(0.0514900-0.0468650*states[0]) rates[38] = (-algebraic[7]*states[38])/algebraic[56]+(algebraic[43]*states[37])/algebraic[56] rates[37] = (-(algebraic[12]+algebraic[43]+algebraic[47])*states[37])/algebraic[56]+(algebraic[7]*states[38])/algebraic[56]+(algebraic[51]*states[34])/algebraic[56]+(algebraic[39]*states[6])/algebraic[56] algebraic[64] = ((constants[118]*constants[15])/(constants[120]*constants[119]))*log(constants[61]/states[2]) algebraic[67] = constants[11]*states[6]*(states[0]-algebraic[64]) algebraic[29] = (constants[75]*constants[41]*states[2])/((constants[41]+constants[73])*(constants[74]+states[2])*(1.00000+0.124500*exp((-0.100000*states[0]*constants[16])/(constants[14]*constants[15]))+0.0353000*exp((-states[0]*constants[16])/(constants[14]*constants[15])))) algebraic[70] = ((constants[123]*constants[15])/(constants[125]*constants[124]))*log(constants[61]/states[2]) algebraic[73] = constants[76]*constants[93]*(states[0]-algebraic[70]) rates[2] = (-(algebraic[67]+3.00000*algebraic[29]+3.00000*algebraic[25]+algebraic[73])*constants[96])/(constants[16]*constants[84]) algebraic[0] = voi % constants[0] algebraic[8] = custom_piecewise([less(algebraic[0] , constants[3]), constants[1]+(constants[2]*algebraic[0])/constants[6] , True, constants[1]+(constants[2]*(1.00000+exp(-constants[5]/(2.00000*constants[4]))))/(1.00000+exp(((algebraic[0]-constants[6])-0.500000*constants[5])/constants[4]))]) algebraic[13] = constants[7]*(states[0]-algebraic[8]) algebraic[21] = states[9]*states[10] algebraic[49] = ((constants[108]*constants[15])/(constants[110]*constants[109]))*log(constants[41]/states[3]) algebraic[54] = constants[9]*algebraic[21]*(states[0]-algebraic[49]) algebraic[58] = ((constants[113]*constants[15])/(constants[115]*constants[114]))*log(constants[41]/states[3]) algebraic[61] = constants[10]*states[5]*(states[0]-algebraic[58]) algebraic[76] = ((constants[128]*constants[15])/(constants[130]*constants[129]))*log(constants[41]/states[3]) algebraic[79] = constants[77]*constants[94]*(states[0]-algebraic[76]) rates[3] = (-(((algebraic[54]+algebraic[61]+algebraic[13])-2.00000*algebraic[29])+algebraic[79])*constants[97])/(constants[16]*constants[84]) algebraic[81] = states[25]+states[26]+states[27]+states[28]+states[29]+states[30]+states[31]+states[32]+states[33]+states[5] algebraic[6] = 1.00000*exp((8.47188*states[0])/(1.00000*constants[15])) algebraic[32] = 0.0443240*algebraic[6] algebraic[11] = 1.00000*exp((-7.77556*states[0])/(1.00000*constants[15])) algebraic[50] = 0.000106000*algebraic[11] algebraic[65] = 1.00000*constants[56]*states[1] rates[29] = (-(constants[138]+algebraic[32])*states[29])/algebraic[81]+(algebraic[65]*states[28])/algebraic[81]+(algebraic[50]*states[5])/algebraic[81] algebraic[27] = 0.000781000*algebraic[6] algebraic[46] = 0.0953120*algebraic[11] algebraic[62] = 2.00000*constants[56]*states[1] rates[28] = (-(constants[139]+algebraic[27]+algebraic[65])*states[28])/algebraic[81]+(algebraic[62]*states[27])/algebraic[81]+(algebraic[46]*states[33])/algebraic[81]+(constants[138]*states[29])/algebraic[81] algebraic[23] = 2.81000e-05*algebraic[6] algebraic[42] = 32.6594*algebraic[11] algebraic[59] = 3.00000*constants[56]*states[1] rates[27] = (-(constants[140]+algebraic[23]+algebraic[62])*states[27])/algebraic[81]+(algebraic[59]*states[26])/algebraic[81]+(algebraic[42]*states[32])/algebraic[81]+(constants[139]*states[28])/algebraic[81] algebraic[19] = 0.000869000*algebraic[6] algebraic[38] = 144.174*algebraic[11] algebraic[55] = 4.00000*constants[56]*states[1] rates[26] = (-(constants[141]+algebraic[19]+algebraic[59])*states[26])/algebraic[81]+(algebraic[55]*states[25])/algebraic[81]+(algebraic[38]*states[31])/algebraic[81]+(constants[140]*states[27])/algebraic[81] algebraic[15] = 0.0216200*algebraic[6] algebraic[34] = 318.108*algebraic[11] rates[25] = (-(algebraic[55]+algebraic[15])*states[25])/algebraic[81]+(constants[141]*states[26])/algebraic[81]+(algebraic[34]*states[30])/algebraic[81] algebraic[78] = 1.00000*constants[56]*states[1] rates[5] = (-(constants[142]+algebraic[50])*states[5])/algebraic[81]+(algebraic[78]*states[33])/algebraic[81]+(algebraic[32]*states[29])/algebraic[81] algebraic[75] = 2.00000*constants[56]*states[1] rates[33] = (-(constants[143]+algebraic[46]+algebraic[78])*states[33])/algebraic[81]+(algebraic[75]*states[32])/algebraic[81]+(algebraic[27]*states[28])/algebraic[81]+(constants[142]*states[5])/algebraic[81] algebraic[72] = 3.00000*constants[56]*states[1] rates[32] = (-(constants[144]+algebraic[42]+algebraic[75])*states[32])/algebraic[81]+(algebraic[72]*states[31])/algebraic[81]+(algebraic[23]*states[27])/algebraic[81]+(constants[143]*states[33])/algebraic[81] algebraic[69] = 4.00000*constants[56]*states[1] rates[31] = (-(constants[145]+algebraic[38]+algebraic[72])*states[31])/algebraic[81]+(algebraic[69]*states[30])/algebraic[81]+(algebraic[19]*states[26])/algebraic[81]+(constants[144]*states[32])/algebraic[81] rates[30] = (-(algebraic[69]+algebraic[34])*states[30])/algebraic[81]+(constants[145]*states[31])/algebraic[81]+(algebraic[15]*states[25])/algebraic[81] algebraic[82] = algebraic[37]+algebraic[45]+algebraic[54]+algebraic[61]+algebraic[67]+algebraic[25]+algebraic[29]+algebraic[73]+algebraic[79] rates[0] = -(algebraic[13]+algebraic[82])/constants[13] algebraic[83] = states[15]+states[14]+states[13]+states[12]+states[19]+states[18]+states[17]+states[16]+states[4]+states[20]+states[21]+states[22]+states[24]+states[23] algebraic[1] = constants[133]*0.731000*exp(states[0]/30.0000) algebraic[22] = 2.00000*algebraic[1] algebraic[26] = 1.00000*algebraic[1] algebraic[9] = constants[133]*0.214900*exp(-states[0]/40.0000) algebraic[40] = 3.00000*algebraic[9] algebraic[44] = 4.00000*algebraic[9] algebraic[80] = (constants[133]*4.00000)/(1.00000+1.00000/states[1]) algebraic[53] = constants[133]*0.00595600*exp(-states[0]/40.0000) algebraic[48] = constants[133]*0.474200*exp(states[0]/10.0000) algebraic[66] = constants[133]*0.00232000*exp(-states[0]/280.000) algebraic[60] = constants[133]*0.0121300*exp(states[0]/500.000) algebraic[71] = (algebraic[44]*algebraic[60]*algebraic[53])/(algebraic[26]*algebraic[66]) algebraic[63] = constants[133]*0.0219700*exp(states[0]/500.000) algebraic[57] = constants[133]*0.0140700*exp(-states[0]/300.000) algebraic[68] = (algebraic[44]*algebraic[57]*algebraic[48])/(algebraic[26]*algebraic[63]) rates[15] = ((algebraic[22]*states[14])/algebraic[83]-((algebraic[26]+algebraic[40]+algebraic[53]+algebraic[48]+algebraic[80])*states[15])/algebraic[83])+(algebraic[44]*states[4])/algebraic[83]+(algebraic[68]*states[22])/algebraic[83]+(algebraic[71]*states[21])/algebraic[83]+(constants[147]*states[19])/algebraic[83] algebraic[18] = 3.00000*algebraic[1] algebraic[36] = 2.00000*algebraic[9] rates[14] = ((algebraic[18]*states[13])/algebraic[83]-((algebraic[22]+algebraic[36]+algebraic[80])*states[14])/algebraic[83])+(algebraic[40]*states[15])/algebraic[83]+(constants[147]*states[18])/algebraic[83] algebraic[14] = 4.00000*algebraic[1] algebraic[31] = 1.00000*algebraic[9] rates[13] = ((algebraic[14]*states[12])/algebraic[83]-((algebraic[18]+algebraic[31]+algebraic[80])*states[13])/algebraic[83])+(algebraic[36]*states[14])/algebraic[83]+(constants[147]*states[17])/algebraic[83] rates[12] = (-(algebraic[14]+algebraic[80])*states[12])/algebraic[83]+(algebraic[31]*states[13])/algebraic[83]+(constants[147]*states[16])/algebraic[83] rates[19] = (((algebraic[80]*states[15])/algebraic[83]+(algebraic[22]*states[18])/algebraic[83])-((algebraic[26]+algebraic[40]+algebraic[48]+algebraic[53]+constants[147])*states[19])/algebraic[83])+(algebraic[44]*states[20])/algebraic[83]+(algebraic[68]*states[23])/algebraic[83]+(algebraic[71]*states[24])/algebraic[83] rates[18] = (((algebraic[80]*states[14])/algebraic[83]+(algebraic[18]*states[17])/algebraic[83])-((algebraic[22]+algebraic[36]+constants[147])*states[18])/algebraic[83])+(algebraic[40]*states[19])/algebraic[83] rates[17] = (((algebraic[80]*states[13])/algebraic[83]+(algebraic[14]*states[16])/algebraic[83])-((algebraic[18]+algebraic[31]+constants[147])*states[17])/algebraic[83])+(algebraic[36]*states[18])/algebraic[83] rates[16] = ((algebraic[80]*states[12])/algebraic[83]-((algebraic[14]+constants[147])*states[16])/algebraic[83])+(algebraic[31]*states[17])/algebraic[83] rates[4] = ((algebraic[26]*states[15])/algebraic[83]-((algebraic[44]+algebraic[63]+algebraic[66]+algebraic[80])*states[4])/algebraic[83])+(algebraic[57]*states[22])/algebraic[83]+(algebraic[60]*states[21])/algebraic[83]+(constants[147]*states[20])/algebraic[83] rates[20] = (((algebraic[80]*states[4])/algebraic[83]+(algebraic[26]*states[19])/algebraic[83])-((algebraic[44]+algebraic[63]+algebraic[66]+constants[147])*states[20])/algebraic[83])+(algebraic[57]*states[23])/algebraic[83]+(algebraic[60]*states[24])/algebraic[83] algebraic[77] = algebraic[66] algebraic[74] = (algebraic[60]*algebraic[63])/algebraic[57] rates[21] = (((algebraic[53]*states[15])/algebraic[83]+(algebraic[66]*states[4])/algebraic[83]+(algebraic[77]*states[22])/algebraic[83])-((algebraic[71]+algebraic[60]+algebraic[74]+algebraic[80])*states[21])/algebraic[83])+(constants[147]*states[24])/algebraic[83] rates[22] = (((algebraic[48]*states[15])/algebraic[83]+(algebraic[63]*states[4])/algebraic[83])-((algebraic[68]+algebraic[57]+algebraic[77]+algebraic[80])*states[22])/algebraic[83])+(algebraic[74]*states[21])/algebraic[83]+(constants[147]*states[23])/algebraic[83] rates[24] = ((algebraic[80]*states[21])/algebraic[83]+(algebraic[53]*states[19])/algebraic[83]+(algebraic[66]*states[20])/algebraic[83]+(algebraic[77]*states[23])/algebraic[83])-((algebraic[71]+algebraic[60]+algebraic[74]+constants[147])*states[24])/algebraic[83] rates[23] = (((algebraic[80]*states[22])/algebraic[83]+(algebraic[48]*states[19])/algebraic[83]+(algebraic[63]*states[20])/algebraic[83])-((algebraic[68]+algebraic[57]+algebraic[77]+constants[147])*states[23])/algebraic[83])+(algebraic[74]*states[24])/algebraic[83] return(rates) def computeAlgebraic(constants, states, voi): algebraic = array([[0.0] * len(voi)] * sizeAlgebraic) states = array(states) voi = array(voi) algebraic[2] = 1.00000/(1.00000+exp(-(states[0]+60.5000)/5.30000)) algebraic[4] = 1.00000/(1.00000+exp(-(states[0]+43.0000)/17.3600)) algebraic[5] = 1.00000/(1.00000+exp((states[0]-44.9000)/12.0096)) algebraic[3] = 1.00000/(1.00000+exp((states[0]+75.5000)/4.00000)) algebraic[10] = 0.381170*(8.60000+14.7000*exp(-(power(states[0]+50.0000, 2.00000))/(900.000*1.00000))) algebraic[33] = ((constants[98]*constants[15])/(constants[100]*constants[99]))*log(constants[20]/states[1]) algebraic[37] = constants[8]*states[4]*(states[0]-algebraic[33]) algebraic[17] = states[7]*states[8] algebraic[41] = ((constants[103]*constants[15])/(constants[105]*constants[104]))*log(constants[20]/states[1]) algebraic[45] = constants[35]*algebraic[17]*(states[0]-algebraic[41]) algebraic[25] = (constants[72]*(exp((constants[71]*states[0]*constants[16])/(constants[14]*constants[15]))*(power(states[2], 3.00000))*constants[20]-2.50000*exp(((constants[71]-1.00000)*states[0]*constants[16])/(constants[14]*constants[15]))*(power(constants[61], 3.00000))*states[1]))/((power(constants[69], 3.00000)+power(constants[61], 3.00000))*(constants[68]+constants[20])*(1.00000+constants[70]*exp(((constants[71]-1.00000)*states[0]*constants[16])/(constants[14]*constants[15])))) algebraic[52] = (-((algebraic[37]+algebraic[45])-2.00000*algebraic[25])*constants[95])/(2.00000*constants[16]*constants[84]) algebraic[56] = states[6]+states[34]+states[35]+states[36]+states[37]+states[38] algebraic[24] = constants[146]*0.554320*exp(-0.0990740+0.0364410*states[0]) algebraic[28] = constants[146]*0.000525480*exp(-0.0691020+0.00319450*states[0]) algebraic[20] = constants[146]*3.15660*exp(0.363520+0.0771930*states[0]) algebraic[30] = constants[146]*1.44960*exp(-0.156600+0.0583530*states[0]) algebraic[16] = constants[146]*2.39100*exp(-13.3350-0.252890*states[0]) algebraic[35] = constants[146]*1.53290*exp(0.00931930+0.0410750*states[0]) algebraic[47] = constants[146]*1.90460*exp(-2.48400+0.0204060*states[0]) algebraic[51] = constants[146]*0.000216880*exp(-0.0634380+0.00466830*states[0]) algebraic[12] = constants[146]*0.120520*exp(-9.60280+0.0830250*states[0]) algebraic[39] = constants[146]*1.61640*exp(0.307630+0.00605350*states[0]) algebraic[7] = constants[146]*0.00392390*exp(2.67930+0.00614680*states[0]) algebraic[43] = constants[146]*0.0277350*exp(0.0514900-0.0468650*states[0]) algebraic[64] = ((constants[118]*constants[15])/(constants[120]*constants[119]))*log(constants[61]/states[2]) algebraic[67] = constants[11]*states[6]*(states[0]-algebraic[64]) algebraic[29] = (constants[75]*constants[41]*states[2])/((constants[41]+constants[73])*(constants[74]+states[2])*(1.00000+0.124500*exp((-0.100000*states[0]*constants[16])/(constants[14]*constants[15]))+0.0353000*exp((-states[0]*constants[16])/(constants[14]*constants[15])))) algebraic[70] = ((constants[123]*constants[15])/(constants[125]*constants[124]))*log(constants[61]/states[2]) algebraic[73] = constants[76]*constants[93]*(states[0]-algebraic[70]) algebraic[0] = voi % constants[0] algebraic[8] = custom_piecewise([less(algebraic[0] , constants[3]), constants[1]+(constants[2]*algebraic[0])/constants[6] , True, constants[1]+(constants[2]*(1.00000+exp(-constants[5]/(2.00000*constants[4]))))/(1.00000+exp(((algebraic[0]-constants[6])-0.500000*constants[5])/constants[4]))]) algebraic[13] = constants[7]*(states[0]-algebraic[8]) algebraic[21] = states[9]*states[10] algebraic[49] = ((constants[108]*constants[15])/(constants[110]*constants[109]))*log(constants[41]/states[3]) algebraic[54] = constants[9]*algebraic[21]*(states[0]-algebraic[49]) algebraic[58] = ((constants[113]*constants[15])/(constants[115]*constants[114]))*log(constants[41]/states[3]) algebraic[61] = constants[10]*states[5]*(states[0]-algebraic[58]) algebraic[76] = ((constants[128]*constants[15])/(constants[130]*constants[129]))*log(constants[41]/states[3]) algebraic[79] = constants[77]*constants[94]*(states[0]-algebraic[76]) algebraic[81] = states[25]+states[26]+states[27]+states[28]+states[29]+states[30]+states[31]+states[32]+states[33]+states[5] algebraic[6] = 1.00000*exp((8.47188*states[0])/(1.00000*constants[15])) algebraic[32] = 0.0443240*algebraic[6] algebraic[11] = 1.00000*exp((-7.77556*states[0])/(1.00000*constants[15])) algebraic[50] = 0.000106000*algebraic[11] algebraic[65] = 1.00000*constants[56]*states[1] algebraic[27] = 0.000781000*algebraic[6] algebraic[46] = 0.0953120*algebraic[11] algebraic[62] = 2.00000*constants[56]*states[1] algebraic[23] = 2.81000e-05*algebraic[6] algebraic[42] = 32.6594*algebraic[11] algebraic[59] = 3.00000*constants[56]*states[1] algebraic[19] = 0.000869000*algebraic[6] algebraic[38] = 144.174*algebraic[11] algebraic[55] = 4.00000*constants[56]*states[1] algebraic[15] = 0.0216200*algebraic[6] algebraic[34] = 318.108*algebraic[11] algebraic[78] = 1.00000*constants[56]*states[1] algebraic[75] = 2.00000*constants[56]*states[1] algebraic[72] = 3.00000*constants[56]*states[1] algebraic[69] = 4.00000*constants[56]*states[1] algebraic[82] = algebraic[37]+algebraic[45]+algebraic[54]+algebraic[61]+algebraic[67]+algebraic[25]+algebraic[29]+algebraic[73]+algebraic[79] algebraic[83] = states[15]+states[14]+states[13]+states[12]+states[19]+states[18]+states[17]+states[16]+states[4]+states[20]+states[21]+states[22]+states[24]+states[23] algebraic[1] = constants[133]*0.731000*exp(states[0]/30.0000) algebraic[22] = 2.00000*algebraic[1] algebraic[26] = 1.00000*algebraic[1] algebraic[9] = constants[133]*0.214900*exp(-states[0]/40.0000) algebraic[40] = 3.00000*algebraic[9] algebraic[44] = 4.00000*algebraic[9] algebraic[80] = (constants[133]*4.00000)/(1.00000+1.00000/states[1]) algebraic[53] = constants[133]*0.00595600*exp(-states[0]/40.0000) algebraic[48] = constants[133]*0.474200*exp(states[0]/10.0000) algebraic[66] = constants[133]*0.00232000*exp(-states[0]/280.000) algebraic[60] = constants[133]*0.0121300*exp(states[0]/500.000) algebraic[71] = (algebraic[44]*algebraic[60]*algebraic[53])/(algebraic[26]*algebraic[66]) algebraic[63] = constants[133]*0.0219700*exp(states[0]/500.000) algebraic[57] = constants[133]*0.0140700*exp(-states[0]/300.000) algebraic[68] = (algebraic[44]*algebraic[57]*algebraic[48])/(algebraic[26]*algebraic[63]) algebraic[18] = 3.00000*algebraic[1] algebraic[36] = 2.00000*algebraic[9] algebraic[14] = 4.00000*algebraic[1] algebraic[31] = 1.00000*algebraic[9] algebraic[77] = algebraic[66] algebraic[74] = (algebraic[60]*algebraic[63])/algebraic[57] 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)