# Size of variable arrays: sizeAlgebraic = 215 sizeStates = 80 sizeConstants = 125 from math import * from numpy import * def createLegends(): legend_states = [""] * sizeStates legend_rates = [""] * sizeStates legend_algebraic = [""] * sizeAlgebraic legend_voi = "" legend_constants = [""] * sizeConstants legend_states[0] = "CaJSR in component calcium (mM)" legend_states[1] = "CaNSR in component calcium (mM)" legend_states[2] = "CaSS in component calcium (mM)" legend_states[3] = "Cai in component calcium (mM)" legend_states[4] = "HTRPNCa in component caflux (dimensionless)" legend_constants[0] = "HTRPNtot in component caflux (mM)" legend_algebraic[0] = "Jtr in component caflux (mM_per_ms)" legend_algebraic[51] = "Jtrpn in component caflux (mM_per_ms)" legend_algebraic[12] = "Jxfer in component caflux (mM_per_ms)" legend_states[5] = "LTRPNCa in component caflux (dimensionless)" legend_constants[1] = "LTRPNtot in component caflux (mM)" legend_algebraic[25] = "caflux_HTRPNCa_a1 in component caflux (mS_per_uF)" legend_algebraic[39] = "caflux_LTRPNCa_a1 in component caflux (mS_per_uF)" legend_constants[2] = "khtrpn_minus in component caflux (mS_per_uF)" legend_constants[3] = "khtrpn_plus in component caflux (per_mM_per_ms)" legend_constants[4] = "kltrpn_minus in component caflux (mS_per_uF)" legend_constants[5] = "kltrpn_plus in component caflux (per_mM_per_ms)" legend_constants[6] = "tautr in component caflux (ms)" legend_constants[7] = "tauxfer in component caflux (ms)" legend_voi = "time in component engine (ms)" legend_constants[8] = "CMDNtot in component calcium (mM)" legend_constants[9] = "CSQNtot in component calcium (mM)" legend_constants[10] = "EGTAtot in component calcium (mM)" legend_algebraic[205] = "ICa in component ical (A_per_F)" legend_algebraic[192] = "INaCa in component inaca (A_per_F)" legend_algebraic[105] = "IpCa in component ipca (A_per_F)" legend_algebraic[211] = "Jrel in component ryr (mM_per_ms)" legend_algebraic[200] = "Jup in component serca (mM_per_ms)" legend_constants[11] = "KmCMDN in component calcium (mM)" legend_constants[12] = "KmCSQN in component calcium (mM)" legend_constants[13] = "KmEGTA in component calcium (mM)" legend_constants[14] = "VJSR in component cell (uL)" legend_constants[15] = "VNSR in component cell (uL)" legend_constants[16] = "VSS in component cell (uL)" legend_constants[17] = "Vmyo in component cell (uL)" legend_algebraic[66] = "beta_JSR in component calcium (dimensionless)" legend_algebraic[81] = "beta_SS in component calcium (dimensionless)" legend_algebraic[96] = "beta_i in component calcium (dimensionless)" legend_algebraic[213] = "calcium_CaSS_a3 in component calcium (mM_per_ms)" legend_algebraic[194] = "calcium_Cai_a3 in component calcium (A_per_F)" legend_algebraic[59] = "calcium_beta_JSR_b1 in component calcium (dimensionless)" legend_algebraic[71] = "calcium_beta_SS_b1 in component calcium (dimensionless)" legend_algebraic[76] = "calcium_beta_SS_b2 in component calcium (dimensionless)" legend_algebraic[86] = "calcium_beta_i_b1 in component calcium (dimensionless)" legend_algebraic[91] = "calcium_beta_i_b2 in component calcium (dimensionless)" legend_constants[103] = "a1 in component cell (s3_A_mol_per_g_per_m5)" legend_constants[113] = "a2 in component cell (s3_A_mol_per_g_per_m5)" legend_algebraic[209] = "I in component icat (A_per_F)" legend_constants[18] = "Acap in component cell (cm2)" legend_constants[19] = "F in component phys (C_per_mmol)" legend_states[6] = "O2 in component ryr (dimensionless)" legend_states[7] = "C1 in component ryr (dimensionless)" legend_states[8] = "C2 in component ryr (dimensionless)" legend_constants[20] = "Cao in component extra (mM)" legend_constants[21] = "Ko in component extra (mM)" legend_constants[22] = "Nao in component extra (mM)" legend_states[9] = "C0 in component ical (dimensionless)" legend_algebraic[13] = "C0_to_C1 in component ical (mS_per_uF)" legend_algebraic[118] = "C0_to_CCa0 in component ical (mS_per_uF)" legend_states[10] = "C1 in component ical (dimensionless)" legend_algebraic[82] = "C1_to_C0 in component ical (mS_per_uF)" legend_algebraic[26] = "C1_to_C2 in component ical (mS_per_uF)" legend_algebraic[121] = "C1_to_CCa1 in component ical (mS_per_uF)" legend_states[11] = "C2 in component ical (dimensionless)" legend_algebraic[87] = "C2_to_C1 in component ical (mS_per_uF)" legend_algebraic[32] = "C2_to_C3 in component ical (mS_per_uF)" legend_algebraic[126] = "C2_to_CCa2 in component ical (mS_per_uF)" legend_states[12] = "C3 in component ical (dimensionless)" legend_algebraic[92] = "C3_to_C2 in component ical (mS_per_uF)" legend_algebraic[40] = "C3_to_C4 in component ical (mS_per_uF)" legend_algebraic[133] = "C3_to_CCa3 in component ical (mS_per_uF)" legend_states[13] = "C4 in component ical (dimensionless)" legend_algebraic[97] = "C4_to_C3 in component ical (mS_per_uF)" legend_algebraic[142] = "C4_to_CCa4 in component ical (mS_per_uF)" legend_states[14] = "CCa0 in component ical (dimensionless)" legend_constants[102] = "CCa0_to_C0 in component ical (mS_per_uF)" legend_algebraic[52] = "CCa0_to_CCa1 in component ical (mS_per_uF)" legend_states[15] = "CCa1 in component ical (dimensionless)" legend_constants[112] = "CCa1_to_C1 in component ical (mS_per_uF)" legend_algebraic[103] = "CCa1_to_CCa0 in component ical (mS_per_uF)" legend_algebraic[60] = "CCa1_to_CCa2 in component ical (mS_per_uF)" legend_states[16] = "CCa2 in component ical (dimensionless)" legend_constants[114] = "CCa2_to_C2 in component ical (mS_per_uF)" legend_algebraic[106] = "CCa2_to_CCa1 in component ical (mS_per_uF)" legend_algebraic[67] = "CCa2_to_CCa3 in component ical (mS_per_uF)" legend_states[17] = "CCa3 in component ical (dimensionless)" legend_constants[116] = "CCa3_to_C3 in component ical (mS_per_uF)" legend_algebraic[109] = "CCa3_to_CCa2 in component ical (mS_per_uF)" legend_algebraic[72] = "CCa3_to_CCa4 in component ical (mS_per_uF)" legend_states[18] = "CCa4 in component ical (dimensionless)" legend_constants[118] = "CCa4_to_C4 in component ical (mS_per_uF)" legend_algebraic[112] = "CCa4_to_CCa3 in component ical (mS_per_uF)" legend_algebraic[208] = "ICaK in component ical (A_per_F)" legend_constants[115] = "ICahalf in component ical (A_per_F)" legend_algebraic[204] = "ICamax in component ical (A_per_F)" legend_states[19] = "Ki in component potassium (mM)" legend_states[20] = "Open in component ical (dimensionless)" legend_constants[117] = "PCa in component ical (L_per_F_per_ms_times_1e0)" legend_constants[119] = "PK in component ical (L_per_F_per_ms_times_1e0)" legend_algebraic[207] = "PKprime in component ical (L_per_F_per_ms_times_1e0)" legend_constants[23] = "Pscale in component ical (dimensionless)" legend_states[21] = "V in component membrane (mV)" legend_algebraic[203] = "VFFRT in component phys (C_per_mmol)" legend_algebraic[180] = "VFRT in component phys (dimensionless)" legend_constants[24] = "aL in component ical (dimensionless)" legend_algebraic[1] = "alpha in component ical (mS_per_uF)" legend_algebraic[45] = "alpha_prime in component ical (mS_per_uF)" legend_constants[25] = "bL in component ical (dimensionless)" legend_algebraic[77] = "beta in component ical (mS_per_uF)" legend_algebraic[99] = "beta_prime in component ical (mS_per_uF)" legend_constants[26] = "fL in component ical (mS_per_uF)" legend_constants[27] = "gL in component ical (mS_per_uF)" legend_algebraic[115] = "gamma in component ical (mS_per_uF)" legend_algebraic[122] = "ical_C0_a1 in component ical (mS_per_uF)" legend_algebraic[127] = "ical_C0_a2 in component ical (mS_per_uF)" legend_algebraic[128] = "ical_C1_a1 in component ical (mS_per_uF)" legend_algebraic[134] = "ical_C1_a2 in component ical (mS_per_uF)" legend_algebraic[135] = "ical_C2_a1 in component ical (mS_per_uF)" legend_algebraic[140] = "ical_C2_a2 in component ical (mS_per_uF)" legend_algebraic[141] = "ical_C3_a1 in component ical (mS_per_uF)" legend_algebraic[151] = "ical_C3_a2 in component ical (mS_per_uF)" legend_algebraic[152] = "ical_C4_a1 in component ical (mS_per_uF)" legend_algebraic[166] = "ical_C4_a2 in component ical (mS_per_uF)" legend_algebraic[123] = "ical_CCa0_a1 in component ical (mS_per_uF)" legend_algebraic[129] = "ical_CCa0_a2 in component ical (mS_per_uF)" legend_algebraic[130] = "ical_CCa1_a1 in component ical (mS_per_uF)" legend_algebraic[136] = "ical_CCa1_a2 in component ical (mS_per_uF)" legend_algebraic[137] = "ical_CCa2_a1 in component ical (mS_per_uF)" legend_algebraic[143] = "ical_CCa2_a2 in component ical (mS_per_uF)" legend_algebraic[144] = "ical_CCa3_a1 in component ical (mS_per_uF)" legend_algebraic[153] = "ical_CCa3_a2 in component ical (mS_per_uF)" legend_algebraic[154] = "ical_CCa4_a1 in component ical (mS_per_uF)" legend_algebraic[167] = "ical_CCa4_a2 in component ical (mS_per_uF)" legend_algebraic[182] = "ical_ICaK_a1 in component ical (mM)" legend_algebraic[184] = "ical_ICaK_a2 in component ical (dimensionless)" legend_algebraic[186] = "ical_ICamax_a1 in component ical (mM)" legend_algebraic[188] = "ical_ICamax_a2 in component ical (dimensionless)" legend_constants[28] = "ical_yCa_yCa_inf_a1 in component ical (dimensionless)" legend_algebraic[206] = "imax in component ical (A_per_F)" legend_constants[29] = "omega in component ical (mS_per_uF)" legend_algebraic[2] = "tau_yCa in component ical (ms)" legend_states[22] = "yCa in component ical (dimensionless)" legend_algebraic[14] = "yCa_inf in component ical (dimensionless)" legend_constants[30] = "Ttypescale in component icat (L_per_F_per_ms_times_1e0)" legend_algebraic[3] = "icat_l_inf in component icat (dimensionless)" legend_algebraic[15] = "icat_l_tau in component icat (ms)" legend_algebraic[4] = "icat_n_inf in component icat (dimensionless)" legend_algebraic[16] = "icat_n_tau in component icat (ms)" legend_states[23] = "l in component icat (dimensionless)" legend_states[24] = "n in component icat (dimensionless)" legend_algebraic[114] = "EK in component nernst (mV)" legend_algebraic[150] = "ENa in component nernst (mV)" legend_algebraic[165] = "IHCN in component ihcn (A_per_F)" legend_constants[31] = "IHCNmax in component ihcn (mS_per_uF)" legend_algebraic[181] = "h_alpha in component ihcn (mS_per_uF)" legend_algebraic[183] = "h_beta in component ihcn (mS_per_uF)" legend_algebraic[185] = "h_delta in component ihcn (mS_per_uF)" legend_constants[32] = "h_f in component ihcn (dimensionless)" legend_algebraic[187] = "h_gamma in component ihcn (mS_per_uF)" legend_states[25] = "hcn1 in component ihcn (dimensionless)" legend_states[26] = "hcn10 in component ihcn (dimensionless)" legend_states[27] = "hcn2 in component ihcn (dimensionless)" legend_states[28] = "hcn3 in component ihcn (dimensionless)" legend_states[29] = "hcn4 in component ihcn (dimensionless)" legend_states[30] = "hcn5 in component ihcn (dimensionless)" legend_states[31] = "hcn6 in component ihcn (dimensionless)" legend_states[32] = "hcn7 in component ihcn (dimensionless)" legend_states[33] = "hcn8 in component ihcn (dimensionless)" legend_states[34] = "hcn9 in component ihcn (dimensionless)" legend_constants[33] = "GK1 in component ik1 (mS_per_uF)" legend_algebraic[117] = "IK1 in component ik1 (A_per_F)" legend_algebraic[100] = "ik1_IK1_inf in component ik1 (dimensionless)" legend_constants[34] = "A0 in component ikr (mS_per_uF)" legend_constants[35] = "A1 in component ikr (mS_per_uF)" legend_constants[36] = "A2 in component ikr (mS_per_uF)" legend_constants[37] = "A3 in component ikr (mS_per_uF)" legend_constants[38] = "A4 in component ikr (mS_per_uF)" legend_constants[39] = "A5 in component ikr (mS_per_uF)" legend_constants[40] = "A6 in component ikr (mS_per_uF)" legend_constants[41] = "B0 in component ikr (per_mV)" legend_constants[104] = "B1 in component ikr (per_mV)" legend_constants[42] = "B2 in component ikr (per_mV)" legend_constants[105] = "B3 in component ikr (per_mV)" legend_constants[43] = "B4 in component ikr (per_mV)" legend_constants[106] = "B5 in component ikr (per_mV)" legend_constants[44] = "B6 in component ikr (per_mV)" legend_states[35] = "C1 in component ikr (dimensionless)" legend_algebraic[5] = "C1H_to_C2H in component ikr (mS_per_uF)" legend_states[36] = "C2 in component ikr (dimensionless)" legend_algebraic[17] = "C2H_to_C1H in component ikr (mS_per_uF)" legend_constants[107] = "C2H_to_C3H in component ikr (mS_per_uF)" legend_states[37] = "C3 in component ikr (dimensionless)" legend_constants[108] = "C3H_to_C2H in component ikr (mS_per_uF)" legend_algebraic[6] = "C3H_to_IH in component ikr (mS_per_uF)" legend_algebraic[18] = "C3H_to_OH in component ikr (mS_per_uF)" legend_constants[45] = "GKr in component ikr (mS_per_uF)" legend_states[38] = "I in component ikr (dimensionless)" legend_algebraic[46] = "IH_to_C3H in component ikr (mS_per_uF)" legend_algebraic[27] = "IH_to_OH in component ikr (mS_per_uF)" legend_algebraic[120] = "IKr in component ikr (A_per_F)" legend_states[39] = "O in component ikr (dimensionless)" legend_algebraic[33] = "OH_to_C3H in component ikr (mS_per_uF)" legend_algebraic[41] = "OH_to_IH in component ikr (mS_per_uF)" legend_constants[46] = "T_Const in component ikr (dimensionless)" legend_constants[109] = "fKo in component ikr (dimensionless)" legend_algebraic[28] = "ikr_C2_a1 in component ikr (mS_per_uF)" legend_algebraic[34] = "ikr_C2_a2 in component ikr (mS_per_uF)" legend_algebraic[53] = "ikr_C3_a1 in component ikr (mS_per_uF)" legend_algebraic[61] = "ikr_C3_a2 in component ikr (mS_per_uF)" legend_algebraic[54] = "ikr_I_a1 in component ikr (mS_per_uF)" legend_algebraic[62] = "ikr_I_a2 in component ikr (mS_per_uF)" legend_algebraic[47] = "ikr_O_a1 in component ikr (mS_per_uF)" legend_algebraic[55] = "ikr_O_a2 in component ikr (mS_per_uF)" legend_constants[47] = "GKs in component iks (mS_per_uF)" legend_algebraic[125] = "IKs in component iks (A_per_F)" legend_algebraic[7] = "iks_xf_wt_alpha in component iks (mS_per_uF)" legend_algebraic[19] = "iks_xf_wt_beta in component iks (mS_per_uF)" legend_algebraic[8] = "iks_xs_wt_alpha in component iks (mS_per_uF)" legend_algebraic[20] = "iks_xs_wt_beta in component iks (mS_per_uF)" legend_states[40] = "xf_wt in component iks (dimensionless)" legend_states[41] = "xs_wt in component iks (dimensionless)" legend_constants[48] = "KmCa in component inaca (mM)" legend_constants[49] = "KmNa in component inaca (mM)" legend_states[42] = "Nai in component sodium (mM)" legend_algebraic[189] = "a1 in component inaca (mol4_per_m12)" legend_algebraic[190] = "a2 in component inaca (mol4_per_m12)" legend_algebraic[191] = "a3 in component inaca (dimensionless)" legend_constants[120] = "a4 in component inaca (mM)" legend_constants[122] = "a5 in component inaca (m9_per_mol3)" legend_constants[50] = "eta in component inaca (dimensionless)" legend_constants[51] = "kNaCa in component inaca (A_per_F)" legend_constants[52] = "ksat in component inaca (dimensionless)" legend_constants[121] = "nao3 in component inaca (mM3)" legend_algebraic[199] = "INaK in component inak (A_per_F)" legend_constants[53] = "INaKmax in component inak (A_per_F)" legend_constants[54] = "KmKo in component inak (mM)" legend_constants[55] = "KmNai in component inak (mM)" legend_algebraic[197] = "fNaK in component inak (dimensionless)" legend_constants[123] = "inak_INaK_a1 in component inak (dimensionless)" legend_algebraic[102] = "inak_INaK_a2 in component inak (dimensionless)" legend_algebraic[193] = "inak_fNaK_a1 in component inak (dimensionless)" legend_algebraic[195] = "inak_fNaK_a2 in component inak (dimensionless)" legend_constants[124] = "sigma in component inak (dimensionless)" legend_constants[56] = "IpCamax in component ipca (A_per_F)" legend_constants[57] = "KmpCa in component ipca (mM)" legend_algebraic[132] = "Isus in component isus (A_per_F)" legend_constants[58] = "Isusmax in component isus (mS_per_uF)" legend_states[43] = "C0 in component ito (dimensionless)" legend_algebraic[21] = "C0_to_C1 in component ito (mS_per_uF)" legend_algebraic[145] = "C0_to_CI0 in component ito (mS_per_uF)" legend_states[44] = "C1 in component ito (dimensionless)" legend_algebraic[104] = "C1_to_C0 in component ito (mS_per_uF)" legend_algebraic[29] = "C1_to_C2 in component ito (mS_per_uF)" legend_algebraic[146] = "C1_to_CI1 in component ito (mS_per_uF)" legend_states[45] = "C2 in component ito (dimensionless)" legend_algebraic[107] = "C2_to_C1 in component ito (mS_per_uF)" legend_algebraic[35] = "C2_to_C3 in component ito (mS_per_uF)" legend_algebraic[147] = "C2_to_CI2 in component ito (mS_per_uF)" legend_states[46] = "C3 in component ito (dimensionless)" legend_algebraic[110] = "C3_to_C2 in component ito (mS_per_uF)" legend_algebraic[148] = "C3_to_CI3 in component ito (mS_per_uF)" legend_algebraic[42] = "C3_to_O in component ito (mS_per_uF)" legend_states[47] = "CI0 in component ito (dimensionless)" legend_algebraic[78] = "CI0_to_C0 in component ito (mS_per_uF)" legend_algebraic[48] = "CI0_to_CI1 in component ito (mS_per_uF)" legend_states[48] = "CI1 in component ito (dimensionless)" legend_algebraic[83] = "CI1_to_C1 in component ito (mS_per_uF)" legend_algebraic[113] = "CI1_to_CI0 in component ito (mS_per_uF)" legend_algebraic[56] = "CI1_to_CI2 in component ito (mS_per_uF)" legend_states[49] = "CI2 in component ito (dimensionless)" legend_algebraic[88] = "CI2_to_C2 in component ito (mS_per_uF)" legend_algebraic[116] = "CI2_to_CI1 in component ito (mS_per_uF)" legend_algebraic[63] = "CI2_to_CI3 in component ito (mS_per_uF)" legend_states[50] = "CI3 in component ito (dimensionless)" legend_algebraic[93] = "CI3_to_C3 in component ito (mS_per_uF)" legend_algebraic[119] = "CI3_to_CI2 in component ito (mS_per_uF)" legend_algebraic[68] = "CI3_to_OI in component ito (mS_per_uF)" legend_constants[59] = "G in component ito (mS_per_uF)" legend_algebraic[139] = "Ito1 in component ito (A_per_F)" legend_states[51] = "O in component ito (dimensionless)" legend_states[52] = "OI in component ito (dimensionless)" legend_algebraic[124] = "OI_to_CI3 in component ito (mS_per_uF)" legend_algebraic[98] = "OI_to_O in component ito (mS_per_uF)" legend_algebraic[131] = "O_to_C3 in component ito (mS_per_uF)" legend_algebraic[149] = "O_to_OI in component ito (mS_per_uF)" legend_constants[60] = "aa in component ito (per_mV)" legend_constants[61] = "ai in component ito (per_mV)" legend_algebraic[9] = "alpha_act43 in component ito (mS_per_uF)" legend_algebraic[73] = "alpha_inact43 in component ito (mS_per_uF)" legend_constants[62] = "alphaa0 in component ito (mS_per_uF)" legend_constants[63] = "alphai0 in component ito (mS_per_uF)" legend_constants[64] = "b1 in component ito (dimensionless)" legend_constants[65] = "b2 in component ito (dimensionless)" legend_constants[66] = "b3 in component ito (dimensionless)" legend_constants[67] = "b4 in component ito (dimensionless)" legend_constants[68] = "ba in component ito (per_mV)" legend_algebraic[101] = "beta_act43 in component ito (mS_per_uF)" legend_algebraic[138] = "beta_inact43 in component ito (mS_per_uF)" legend_constants[69] = "betaa0 in component ito (mS_per_uF)" legend_constants[70] = "betai0 in component ito (mS_per_uF)" legend_constants[71] = "bi in component ito (per_mV)" legend_constants[72] = "f1 in component ito (dimensionless)" legend_constants[73] = "f2 in component ito (dimensionless)" legend_constants[74] = "f3 in component ito (dimensionless)" legend_constants[75] = "f4 in component ito (dimensionless)" legend_algebraic[155] = "ito_C0_a1 in component ito (mS_per_uF)" legend_algebraic[168] = "ito_C0_a2 in component ito (mS_per_uF)" legend_algebraic[156] = "ito_C1_a1 in component ito (mS_per_uF)" legend_algebraic[169] = "ito_C1_a2 in component ito (mS_per_uF)" legend_algebraic[157] = "ito_C2_a1 in component ito (mS_per_uF)" legend_algebraic[170] = "ito_C2_a2 in component ito (mS_per_uF)" legend_algebraic[158] = "ito_C3_a1 in component ito (mS_per_uF)" legend_algebraic[171] = "ito_C3_a2 in component ito (mS_per_uF)" legend_algebraic[159] = "ito_CI0_a1 in component ito (mS_per_uF)" legend_algebraic[172] = "ito_CI0_a2 in component ito (mS_per_uF)" legend_algebraic[160] = "ito_CI1_a1 in component ito (mS_per_uF)" legend_algebraic[173] = "ito_CI1_a2 in component ito (mS_per_uF)" legend_algebraic[161] = "ito_CI2_a1 in component ito (mS_per_uF)" legend_algebraic[174] = "ito_CI2_a2 in component ito (mS_per_uF)" legend_algebraic[162] = "ito_CI3_a1 in component ito (mS_per_uF)" legend_algebraic[175] = "ito_CI3_a2 in component ito (mS_per_uF)" legend_algebraic[163] = "ito_OI_a1 in component ito (mS_per_uF)" legend_algebraic[176] = "ito_OI_a2 in component ito (mS_per_uF)" legend_algebraic[164] = "ito_O_a1 in component ito (mS_per_uF)" legend_algebraic[177] = "ito_O_a2 in component ito (mS_per_uF)" legend_algebraic[179] = "INa in component nav15 (A_per_F)" legend_algebraic[178] = "INa1 in component nav11 (A_per_F)" legend_algebraic[212] = "a1 in component membrane (A_per_F)" legend_algebraic[201] = "a2 in component membrane (A_per_F)" legend_algebraic[108] = "a3 in component membrane (A_per_F)" legend_constants[110] = "amplitude in component membrane (A_per_F)" legend_constants[76] = "duration in component membrane (ms)" legend_constants[77] = "i_diff in component membrane (A_per_F)" legend_algebraic[214] = "i_ion in component membrane (A_per_F)" legend_algebraic[111] = "i_stim in component membrane (A_per_F)" legend_constants[78] = "offset in component membrane (ms)" legend_constants[79] = "period in component membrane (ms)" legend_states[53] = "BC1 in component nav11 (dimensionless)" legend_states[54] = "BC2 in component nav11 (dimensionless)" legend_states[55] = "BC3 in component nav11 (dimensionless)" legend_states[56] = "BO in component nav11 (dimensionless)" legend_states[57] = "C1 in component nav11 (dimensionless)" legend_states[58] = "C2 in component nav11 (dimensionless)" legend_states[59] = "C3 in component nav11 (dimensionless)" legend_constants[80] = "GNa1 in component nav11 (mS_per_uF)" legend_states[60] = "IC2 in component nav11 (dimensionless)" legend_states[61] = "IC3 in component nav11 (dimensionless)" legend_states[62] = "IF in component nav11 (dimensionless)" legend_states[63] = "IS1 in component nav11 (dimensionless)" legend_states[64] = "IS2 in component nav11 (dimensionless)" legend_states[65] = "O in component nav11 (dimensionless)" legend_algebraic[10] = "a11 in component nav11 (mS_per_uF)" legend_algebraic[22] = "a12 in component nav11 (mS_per_uF)" legend_algebraic[30] = "a13 in component nav11 (mS_per_uF)" legend_algebraic[36] = "a2 in component nav11 (mS_per_uF)" legend_algebraic[43] = "a3 in component nav11 (mS_per_uF)" legend_algebraic[49] = "a4 in component nav11 (mS_per_uF)" legend_algebraic[57] = "a5 in component nav11 (mS_per_uF)" legend_algebraic[64] = "b11 in component nav11 (mS_per_uF)" legend_algebraic[69] = "b12 in component nav11 (mS_per_uF)" legend_algebraic[74] = "b13 in component nav11 (mS_per_uF)" legend_algebraic[84] = "b2 in component nav11 (mS_per_uF)" legend_algebraic[79] = "b3 in component nav11 (mS_per_uF)" legend_algebraic[89] = "b4 in component nav11 (mS_per_uF)" legend_algebraic[94] = "b5 in component nav11 (mS_per_uF)" legend_constants[81] = "mu1 in component nav11 (mS_per_uF)" legend_constants[82] = "mu2 in component nav11 (mS_per_uF)" legend_states[66] = "BC1 in component nav15 (dimensionless)" legend_states[67] = "BC2 in component nav15 (dimensionless)" legend_states[68] = "BC3 in component nav15 (dimensionless)" legend_states[69] = "BO in component nav15 (dimensionless)" legend_states[70] = "C1 in component nav15 (dimensionless)" legend_states[71] = "C2 in component nav15 (dimensionless)" legend_states[72] = "C3 in component nav15 (dimensionless)" legend_constants[83] = "GNa in component nav15 (mS_per_uF)" legend_states[73] = "IC2 in component nav15 (dimensionless)" legend_states[74] = "IC3 in component nav15 (dimensionless)" legend_states[75] = "IF in component nav15 (dimensionless)" legend_states[76] = "IS1 in component nav15 (dimensionless)" legend_states[77] = "IS2 in component nav15 (dimensionless)" legend_states[78] = "O in component nav15 (dimensionless)" legend_algebraic[11] = "a11 in component nav15 (mS_per_uF)" legend_algebraic[23] = "a12 in component nav15 (mS_per_uF)" legend_algebraic[31] = "a13 in component nav15 (mS_per_uF)" legend_algebraic[37] = "a2 in component nav15 (mS_per_uF)" legend_algebraic[44] = "a3 in component nav15 (mS_per_uF)" legend_algebraic[50] = "a4 in component nav15 (mS_per_uF)" legend_algebraic[58] = "a5 in component nav15 (mS_per_uF)" legend_algebraic[65] = "b11 in component nav15 (mS_per_uF)" legend_algebraic[70] = "b12 in component nav15 (mS_per_uF)" legend_algebraic[75] = "b13 in component nav15 (mS_per_uF)" legend_algebraic[85] = "b2 in component nav15 (mS_per_uF)" legend_algebraic[80] = "b3 in component nav15 (mS_per_uF)" legend_algebraic[90] = "b4 in component nav15 (mS_per_uF)" legend_algebraic[95] = "b5 in component nav15 (mS_per_uF)" legend_constants[84] = "mu1 in component nav15 (mS_per_uF)" legend_constants[85] = "mu2 in component nav15 (mS_per_uF)" legend_constants[111] = "RTF in component phys (mV)" legend_constants[86] = "R in component phys (J_per_mol_per_K)" legend_constants[87] = "T in component phys (kelvin)" legend_algebraic[210] = "IK_tot in component potassium (A_per_F)" legend_states[79] = "O1 in component ryr (dimensionless)" legend_constants[88] = "kaminus in component ryr (mS_per_uF)" legend_constants[89] = "kaplus in component ryr (m12_per_s_per_mol4_times_1e15)" legend_constants[90] = "kbminus in component ryr (mS_per_uF)" legend_constants[91] = "kbplus in component ryr (m9_per_s_per_mol3_times_1e12)" legend_constants[92] = "kcminus in component ryr (mS_per_uF)" legend_constants[93] = "kcplus in component ryr (mS_per_uF)" legend_algebraic[24] = "ryr_C1_a2 in component ryr (mol4_per_m12_times_1e_minus_12)" legend_algebraic[38] = "ryr_O2_a1 in component ryr (mM3_times_1e_minus_9)" legend_constants[94] = "v1 in component ryr (mS_per_uF)" legend_constants[95] = "KSR in component serca (dimensionless)" legend_constants[96] = "Kfb in component serca (mM)" legend_constants[97] = "Krb in component serca (mM)" legend_constants[98] = "Nfb in component serca (dimensionless)" legend_constants[99] = "Nrb in component serca (dimensionless)" legend_algebraic[196] = "fb in component serca (dimensionless)" legend_algebraic[198] = "rb in component serca (dimensionless)" legend_constants[100] = "vmaxf in component serca (mM_per_ms)" legend_constants[101] = "vmaxr in component serca (mM_per_ms)" legend_algebraic[202] = "INa_tot in component sodium (A_per_F)" legend_rates[4] = "d/dt HTRPNCa in component caflux (dimensionless)" legend_rates[5] = "d/dt LTRPNCa in component caflux (dimensionless)" legend_rates[0] = "d/dt CaJSR in component calcium (mM)" legend_rates[1] = "d/dt CaNSR in component calcium (mM)" legend_rates[2] = "d/dt CaSS in component calcium (mM)" legend_rates[3] = "d/dt Cai in component calcium (mM)" legend_rates[9] = "d/dt C0 in component ical (dimensionless)" legend_rates[10] = "d/dt C1 in component ical (dimensionless)" legend_rates[11] = "d/dt C2 in component ical (dimensionless)" legend_rates[12] = "d/dt C3 in component ical (dimensionless)" legend_rates[13] = "d/dt C4 in component ical (dimensionless)" legend_rates[14] = "d/dt CCa0 in component ical (dimensionless)" legend_rates[15] = "d/dt CCa1 in component ical (dimensionless)" legend_rates[16] = "d/dt CCa2 in component ical (dimensionless)" legend_rates[17] = "d/dt CCa3 in component ical (dimensionless)" legend_rates[18] = "d/dt CCa4 in component ical (dimensionless)" legend_rates[20] = "d/dt Open in component ical (dimensionless)" legend_rates[22] = "d/dt yCa in component ical (dimensionless)" legend_rates[23] = "d/dt l in component icat (dimensionless)" legend_rates[24] = "d/dt n in component icat (dimensionless)" legend_rates[25] = "d/dt hcn1 in component ihcn (dimensionless)" legend_rates[26] = "d/dt hcn10 in component ihcn (dimensionless)" legend_rates[27] = "d/dt hcn2 in component ihcn (dimensionless)" legend_rates[28] = "d/dt hcn3 in component ihcn (dimensionless)" legend_rates[29] = "d/dt hcn4 in component ihcn (dimensionless)" legend_rates[30] = "d/dt hcn5 in component ihcn (dimensionless)" legend_rates[31] = "d/dt hcn6 in component ihcn (dimensionless)" legend_rates[32] = "d/dt hcn7 in component ihcn (dimensionless)" legend_rates[33] = "d/dt hcn8 in component ihcn (dimensionless)" legend_rates[34] = "d/dt hcn9 in component ihcn (dimensionless)" legend_rates[35] = "d/dt C1 in component ikr (dimensionless)" legend_rates[36] = "d/dt C2 in component ikr (dimensionless)" legend_rates[37] = "d/dt C3 in component ikr (dimensionless)" legend_rates[38] = "d/dt I in component ikr (dimensionless)" legend_rates[39] = "d/dt O in component ikr (dimensionless)" legend_rates[40] = "d/dt xf_wt in component iks (dimensionless)" legend_rates[41] = "d/dt xs_wt in component iks (dimensionless)" legend_rates[43] = "d/dt C0 in component ito (dimensionless)" legend_rates[44] = "d/dt C1 in component ito (dimensionless)" legend_rates[45] = "d/dt C2 in component ito (dimensionless)" legend_rates[46] = "d/dt C3 in component ito (dimensionless)" legend_rates[47] = "d/dt CI0 in component ito (dimensionless)" legend_rates[48] = "d/dt CI1 in component ito (dimensionless)" legend_rates[49] = "d/dt CI2 in component ito (dimensionless)" legend_rates[50] = "d/dt CI3 in component ito (dimensionless)" legend_rates[51] = "d/dt O in component ito (dimensionless)" legend_rates[52] = "d/dt OI in component ito (dimensionless)" legend_rates[21] = "d/dt V in component membrane (mV)" legend_rates[53] = "d/dt BC1 in component nav11 (dimensionless)" legend_rates[54] = "d/dt BC2 in component nav11 (dimensionless)" legend_rates[55] = "d/dt BC3 in component nav11 (dimensionless)" legend_rates[56] = "d/dt BO in component nav11 (dimensionless)" legend_rates[57] = "d/dt C1 in component nav11 (dimensionless)" legend_rates[58] = "d/dt C2 in component nav11 (dimensionless)" legend_rates[59] = "d/dt C3 in component nav11 (dimensionless)" legend_rates[60] = "d/dt IC2 in component nav11 (dimensionless)" legend_rates[61] = "d/dt IC3 in component nav11 (dimensionless)" legend_rates[62] = "d/dt IF in component nav11 (dimensionless)" legend_rates[63] = "d/dt IS1 in component nav11 (dimensionless)" legend_rates[64] = "d/dt IS2 in component nav11 (dimensionless)" legend_rates[65] = "d/dt O in component nav11 (dimensionless)" legend_rates[66] = "d/dt BC1 in component nav15 (dimensionless)" legend_rates[67] = "d/dt BC2 in component nav15 (dimensionless)" legend_rates[68] = "d/dt BC3 in component nav15 (dimensionless)" legend_rates[69] = "d/dt BO in component nav15 (dimensionless)" legend_rates[70] = "d/dt C1 in component nav15 (dimensionless)" legend_rates[71] = "d/dt C2 in component nav15 (dimensionless)" legend_rates[72] = "d/dt C3 in component nav15 (dimensionless)" legend_rates[73] = "d/dt IC2 in component nav15 (dimensionless)" legend_rates[74] = "d/dt IC3 in component nav15 (dimensionless)" legend_rates[75] = "d/dt IF in component nav15 (dimensionless)" legend_rates[76] = "d/dt IS1 in component nav15 (dimensionless)" legend_rates[77] = "d/dt IS2 in component nav15 (dimensionless)" legend_rates[78] = "d/dt O in component nav15 (dimensionless)" legend_rates[19] = "d/dt Ki in component potassium (mM)" legend_rates[7] = "d/dt C1 in component ryr (dimensionless)" legend_rates[8] = "d/dt C2 in component ryr (dimensionless)" legend_rates[79] = "d/dt O1 in component ryr (dimensionless)" legend_rates[6] = "d/dt O2 in component ryr (dimensionless)" legend_rates[42] = "d/dt Nai in component sodium (mM)" return (legend_states, legend_algebraic, legend_voi, legend_constants) def initConsts(): constants = [0.0] * sizeConstants; states = [0.0] * sizeStates; states[0] = 2.59679515799999983e-01 states[1] = 2.59898837400000027e-01 states[2] = 1.24655751999999995e-04 states[3] = 7.56225546699999958e-05 states[4] = 9.74145534599999974e-01 constants[0] = 0.14 states[5] = 7.05428108299999967e-02 constants[1] = 0.07 constants[2] = 6.6e-05 constants[3] = 20.0 constants[4] = 0.04 constants[5] = 40.0 constants[6] = 0.5747 constants[7] = 26.7 constants[8] = 0.05 constants[9] = 15.0 constants[10] = 0.0 constants[11] = 0.00238 constants[12] = 0.8 constants[13] = 0.00015 constants[14] = 1.36e-07 constants[15] = 1.785e-06 constants[16] = 1.08e-09 constants[17] = 2.196e-05 constants[18] = 0.0003912 constants[19] = 96.5 states[6] = 2.58066283699999986e-09 states[7] = 4.65590390899999984e-01 states[8] = 5.33775261499999987e-01 constants[20] = 2.0 constants[21] = 4.0 constants[22] = 138.0 states[9] = 8.74379838900000039e-01 states[10] = 2.55268330899999993e-02 states[11] = 2.79463949400000000e-04 states[12] = 1.35979496400000004e-06 states[13] = 2.48115507400000008e-09 states[14] = 8.89536543300000065e-02 states[15] = 1.03878563100000005e-02 states[16] = 4.54899679899999998e-04 states[17] = 8.85360913299999938e-06 states[18] = 6.46181672899999939e-08 states[19] = 1.22483450199999993e+02 states[20] = 1.85837559400000008e-10 constants[23] = 1.8 states[21] = -8.03864711399999976e+01 constants[24] = 2.0 constants[25] = 2.0 constants[26] = 0.3 constants[27] = 4.0 constants[28] = 0.82 constants[29] = 0.0025 states[22] = 9.98998351100000015e-01 constants[30] = 0.0075614 states[23] = 5.48343768800000020e-01 states[24] = 2.08213191599999990e-03 constants[31] = 0.3225 constants[32] = 2.2361 states[25] = 3.45377576399999997e-01 states[26] = 2.64074099199999987e-03 states[27] = 4.08547201099999979e-01 states[28] = 1.80893426200000013e-01 states[29] = 3.54868422399999967e-02 states[30] = 2.59639364999999980e-03 states[31] = 1.13417300900000000e-03 states[32] = 5.28665430399999966e-03 states[33] = 9.66413904500000066e-03 states[34] = 8.13729668700000075e-03 constants[33] = 0.0226 constants[34] = 1.71476417330859998e-02 constants[35] = 3.96932838114099976e-02 constants[36] = 2.05744860597700009e-02 constants[37] = 1.34366604422999996e-03 constants[38] = 1.06663164912879999e-01 constants[39] = 6.46393910049000014e-03 constants[40] = 8.03937440300000057e-05 constants[41] = 3.30460803883500034e-02 constants[42] = 2.61741271511800010e-02 constants[43] = 5.68908859717000021e-03 constants[44] = 6.98089239999999969e-07 states[35] = 7.89638103000000036e-01 states[36] = 7.51317227500000002e-04 states[37] = 1.31802129699999990e-04 constants[45] = 0.0383724 states[38] = 7.34187676599999975e-06 states[39] = 2.70143786700000017e-05 constants[46] = 5.32000000100000037e+00 constants[47] = 2.80819022457099998e-02 states[40] = 7.40047161399999998e-04 states[41] = 1.95694799400000008e-01 constants[48] = 1.38 constants[49] = 87.5 states[42] = 1.20687050500000002e+01 constants[50] = 0.35 constants[51] = 0.44 constants[52] = 0.2 constants[53] = 1.5 constants[54] = 1.5 constants[55] = 20.0 constants[56] = 0.05 constants[57] = 0.0005 constants[58] = 0.0919908 states[43] = 9.12446021800000007e-01 states[44] = 5.57395224500000022e-02 states[45] = 1.27681665400000005e-03 states[46] = 1.29938504799999993e-05 states[47] = 1.41240034599999995e-02 states[48] = 1.10576340999999998e-02 states[49] = 4.37517185700000023e-03 states[50] = 9.10523457199999969e-04 constants[59] = 1.52138159999999995e-01 states[51] = 4.95957872400000005e-08 states[52] = 5.71714766299999999e-05 constants[60] = 0.028983 constants[61] = 3.73015999999999994e-04 constants[62] = 0.543708 constants[63] = 0.0498424 constants[64] = 6.77348 constants[65] = 1.56212705152000009e+01 constants[66] = 2.87532603313000017e+01 constants[67] = 5.24576206679000052e+02 constants[68] = 0.0468437 constants[69] = 0.080185 constants[70] = 8.19481999999999958e-04 constants[71] = 5.374e-08 constants[72] = 1.8936 constants[73] = 1.42246474559999996e+01 constants[74] = 1.58574378389000003e+02 constants[75] = 1.42936645351000010e+02 constants[76] = 0.5 constants[77] = 0.0 constants[78] = 0.0 constants[79] = 1000.0 states[53] = 3.66022597099999997e-10 states[54] = 1.72916501500000004e-07 states[55] = 3.12749104299999976e-05 states[56] = 6.60499340399999993e-13 states[57] = 4.69401528400000025e-06 states[58] = 2.21514457499999992e-03 states[59] = 4.00644227700000022e-01 constants[80] = 9.0 states[60] = 3.35246803199999981e-04 states[61] = 5.99583493199999998e-02 states[62] = 3.65674332999999992e-06 states[63] = 8.87492239200000053e-03 states[64] = 5.26928426500000047e-01 states[65] = 9.08194443799999939e-09 constants[81] = 4.3e-08 constants[82] = 0.0003 states[66] = 2.08587473400000016e-08 states[67] = 1.63649800299999998e-06 states[68] = 5.17784203000000017e-05 states[69] = 5.01137449999999989e-11 states[70] = 2.47138734400000005e-04 states[71] = 1.93896494799999999e-02 states[72] = 6.13484026399999993e-01 constants[83] = 35.0 states[73] = 9.13117952200000020e-03 states[74] = 2.88855704800000002e-01 states[75] = 1.17674846899999997e-04 states[76] = 1.38841821899999998e-03 states[77] = 6.62152358299999966e-02 states[78] = 5.92094839499999983e-07 constants[84] = 4.3e-08 constants[85] = 0.0003 constants[86] = 8.315 constants[87] = 310.0 states[79] = 6.34345983199999957e-04 constants[88] = 0.576 constants[89] = 0.01215 constants[90] = 1.93 constants[91] = 0.00405 constants[92] = 0.0008 constants[93] = 0.1 constants[94] = 1.8 constants[95] = 1.2 constants[96] = 0.000168 constants[97] = 3.29 constants[98] = 1.2 constants[99] = 1.0 constants[100] = 7.48e-05 constants[101] = 0.000318 constants[102] = constants[29] constants[103] = constants[18]/((constants[17]*constants[19])*1000.00) constants[104] = -0.0430605 constants[105] = -0.0269139 constants[106] = -0.0453664 constants[107] = constants[46]*0.0260836 constants[108] = constants[46]*0.148330 constants[109] = power(constants[21]/4.00000, 1.0/2) constants[110] = -100.000 constants[111] = (constants[86]*constants[87])/constants[19] constants[112] = constants[102]/constants[25] constants[113] = constants[18]/(((2.00000*constants[16])*constants[19])*1000.00) constants[114] = constants[112]/constants[25] constants[115] = -0.265000 constants[116] = constants[114]/constants[25] constants[117] = constants[23]*0.246900 constants[118] = constants[116]/constants[25] constants[119] = constants[23]*0.000457400 constants[120] = constants[48]+constants[20] constants[121] = power(constants[22], 3.00000) constants[122] = 5000.00/(power(constants[49], 3.00000)+constants[121]) constants[123] = constants[21]/(constants[21]+constants[54]) constants[124] = (exp(constants[22]/67.3000)-1.00000)/7.00000 return (states, constants) def computeRates(voi, states, constants): rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic rates[8] = constants[93]*states[79]-constants[92]*states[8] rates[20] = constants[26]*states[13]-constants[27]*states[20] algebraic[2] = 1.00000/(0.00336336/(0.500000+exp(states[21]/-5.53900))+0.00779047*exp(states[21]/-49.5104)) algebraic[14] = constants[28]/(1.00000+exp((states[21]+28.5000)/7.80000))+(1.00000-constants[28]) rates[22] = (algebraic[14]-states[22])/algebraic[2] algebraic[3] = 1.00000/(1.00000+exp((states[21]+75.6000)/6.20000)) algebraic[15] = custom_piecewise([less(states[21] , -60.0000), 500.000 , True, 18.3000+0.00500000*exp(-states[21]/6.20000)]) rates[23] = (algebraic[3]-states[23])/algebraic[15] algebraic[4] = 1.00000/(1.00000+exp(-(states[21]+48.4000)/5.20000)) algebraic[16] = custom_piecewise([less(states[21] , -56.0000), 2.44000*exp((states[21]+120.000)/40.0000) , True, 1.34000+0.0350000*exp(-states[21]/11.8000)]) rates[24] = (algebraic[4]-states[24])/algebraic[16] algebraic[5] = (constants[46]*constants[34])*exp(constants[41]*states[21]) algebraic[17] = (constants[46]*constants[35])*exp(constants[104]*states[21]) rates[35] = algebraic[17]*states[36]-algebraic[5]*states[35] algebraic[7] = custom_piecewise([equal(states[21] , 21.0000), 0.000146000/0.0780000 , True, (0.000146000*(states[21]-21.0000))/(1.00000-exp(-0.0780000*(states[21]-21.0000)))]) algebraic[19] = 0.000910000*exp(-0.0280000*states[21]) rates[40] = algebraic[7]*(1.00000-states[40])-algebraic[19]*states[40] algebraic[8] = custom_piecewise([equal(states[21] , -11.0000), 3.30000e-05/0.130000 , True, (3.30000e-05*(states[21]+11.0000))/(1.00000-exp(-0.130000*(states[21]+11.0000)))]) algebraic[20] = 0.000100000*exp(-0.0150000*states[21]) rates[41] = algebraic[8]*(1.00000-states[41])-algebraic[20]*states[41] algebraic[24] = power(states[2]*1000.00, 4.00000) rates[7] = (-constants[89]*algebraic[24])*states[7]+constants[88]*states[79] algebraic[25] = constants[2]*states[4] rates[4] = (constants[3]*states[3])*(1.00000-states[4])-algebraic[25] algebraic[28] = algebraic[5]*states[35]+constants[108]*states[37] algebraic[34] = (algebraic[17]+constants[107])*states[36] rates[36] = algebraic[28]-algebraic[34] algebraic[38] = power(states[2]*1000.00, 3.00000) rates[6] = (constants[91]*algebraic[38])*states[79]-constants[90]*states[6] algebraic[39] = constants[4]*states[5] rates[5] = (constants[5]*states[3])*(1.00000-states[5])-algebraic[39] rates[79] = -((rates[7]+rates[6])+rates[8]) algebraic[18] = (constants[46]*constants[36])*exp(constants[42]*states[21]) algebraic[27] = (constants[46]*constants[39])*exp(constants[106]*states[21]) algebraic[47] = algebraic[18]*states[37]+algebraic[27]*states[38] algebraic[33] = (constants[46]*constants[37])*exp(constants[105]*states[21]) algebraic[41] = (constants[46]*constants[38])*exp(constants[43]*states[21]) algebraic[55] = (algebraic[33]+algebraic[41])*states[39] rates[39] = algebraic[47]-algebraic[55] algebraic[6] = (constants[46]*constants[40])*exp(constants[44]*states[21]) algebraic[46] = ((algebraic[33]*algebraic[27])*algebraic[6])/(algebraic[18]*algebraic[41]) algebraic[53] = (constants[107]*states[36]+algebraic[33]*states[39])+algebraic[46]*states[38] algebraic[61] = ((algebraic[6]+algebraic[18])+constants[108])*states[37] rates[37] = algebraic[53]-algebraic[61] algebraic[54] = algebraic[6]*states[37]+algebraic[41]*states[39] algebraic[62] = (algebraic[46]+algebraic[27])*states[38] rates[38] = algebraic[54]-algebraic[62] algebraic[10] = 2.80200/(0.210000*exp(-states[21]/17.0000)+0.230000*exp(-states[21]/150.000)) algebraic[64] = 0.400000*exp(-states[21]/20.3000) rates[55] = (states[54]*algebraic[64]+states[59]*constants[81])-states[55]*(algebraic[10]+constants[82]) algebraic[11] = 3.80200/(0.102700*exp(-states[21]/17.0000)+0.200000*exp(-states[21]/150.000)) algebraic[65] = 0.191700*exp(-states[21]/20.3000) rates[68] = (states[67]*algebraic[65]+states[72]*constants[84])-states[68]*(algebraic[11]+constants[85]) algebraic[22] = 2.80200/(0.230000*exp(-states[21]/15.0000)+0.250000*exp(-states[21]/150.000)) algebraic[69] = 0.400000*exp(-(states[21]-5.00000)/20.3000) rates[54] = ((states[53]*algebraic[69]+states[55]*algebraic[10])+states[58]*constants[81])-states[54]*((algebraic[22]+algebraic[64])+constants[82]) algebraic[23] = 3.80200/(0.102700*exp(-states[21]/15.0000)+0.230000*exp(-states[21]/150.000)) algebraic[70] = 0.200000*exp(-(states[21]-5.00000)/20.3000) rates[67] = ((states[66]*algebraic[70]+states[68]*algebraic[11])+states[71]*constants[84])-states[67]*((algebraic[23]+algebraic[65])+constants[85]) algebraic[30] = 2.80200/(0.250000*exp(-states[21]/12.0000)+0.270000*exp(-states[21]/150.000)) algebraic[74] = (0.400000*exp(-(states[21]-10.0000)/20.3000))/4.50000 rates[53] = ((states[56]*algebraic[74]+states[54]*algebraic[22])+states[57]*constants[81])-states[53]*((algebraic[30]+algebraic[69])+constants[82]) rates[56] = (states[53]*algebraic[30]+states[65]*constants[81])-states[56]*(algebraic[74]+constants[82]) algebraic[31] = 3.80200/(0.102700*exp(-states[21]/12.0000)+0.250000*exp(-states[21]/150.000)) algebraic[75] = 0.220000*exp(-(states[21]-10.0000)/20.3000) rates[66] = ((states[69]*algebraic[75]+states[67]*algebraic[23])+states[70]*constants[84])-states[66]*((algebraic[31]+algebraic[70])+constants[85]) rates[69] = (states[66]*algebraic[31]+states[78]*constants[84])-states[69]*(algebraic[75]+constants[85]) algebraic[43] = (3.79330e-07*exp(-states[21]/7.60000))*3.00000 algebraic[79] = 0.00840000+2.00000e-05*states[21] rates[57] = (((states[62]*algebraic[43]+states[53]*constants[82])+states[65]*algebraic[74])+states[58]*algebraic[22])-states[57]*(((algebraic[30]+algebraic[79])+constants[81])+algebraic[69]) rates[58] = (((states[60]*algebraic[43]+states[54]*constants[82])+states[57]*algebraic[69])+states[59]*algebraic[10])-states[58]*(((algebraic[22]+algebraic[79])+constants[81])+algebraic[64]) rates[59] = ((states[61]*algebraic[43]+states[55]*constants[82])+states[58]*algebraic[64])-states[59]*((algebraic[10]+algebraic[79])+constants[81]) rates[60] = ((states[62]*algebraic[69]+states[58]*algebraic[79])+states[61]*algebraic[10])-states[60]*((algebraic[22]+algebraic[43])+algebraic[64]) rates[61] = (states[60]*algebraic[64]+states[59]*algebraic[79])-states[61]*(algebraic[10]+algebraic[43]) algebraic[44] = 3.79330e-07*exp(-states[21]/7.70000) algebraic[80] = 0.00840000+2.00000e-05*states[21] rates[70] = (((states[75]*algebraic[44]+states[66]*constants[85])+states[78]*algebraic[75])+states[71]*algebraic[23])-states[70]*(((algebraic[31]+algebraic[80])+constants[84])+algebraic[70]) rates[71] = (((states[73]*algebraic[44]+states[67]*constants[85])+states[70]*algebraic[70])+states[72]*algebraic[11])-states[71]*(((algebraic[23]+algebraic[80])+constants[84])+algebraic[65]) rates[72] = ((states[74]*algebraic[44]+states[68]*constants[85])+states[71]*algebraic[65])-states[72]*((algebraic[11]+algebraic[80])+constants[84]) rates[73] = ((states[75]*algebraic[70]+states[71]*algebraic[80])+states[74]*algebraic[11])-states[73]*((algebraic[23]+algebraic[44])+algebraic[65]) rates[74] = (states[73]*algebraic[65]+states[72]*algebraic[80])-states[74]*(algebraic[11]+algebraic[44]) algebraic[36] = (9.17800*exp(states[21]/29.6800))/4.50000 algebraic[84] = ((algebraic[43]*algebraic[36])*algebraic[30])/(algebraic[79]*algebraic[74]) rates[65] = ((states[62]*algebraic[84]+states[56]*constants[82])+states[57]*algebraic[30])-states[65]*((algebraic[36]+algebraic[74])+constants[81]) algebraic[37] = 9.17800*exp(states[21]/29.6800) algebraic[85] = ((algebraic[44]*algebraic[37])*algebraic[31])/(algebraic[80]*algebraic[75]) rates[78] = ((states[75]*algebraic[85]+states[69]*constants[85])+states[70]*algebraic[31])-states[78]*((algebraic[37]+algebraic[75])+constants[84]) algebraic[49] = ((algebraic[36]/100.000)*1.50000)*0.285000 algebraic[89] = algebraic[43]/5.00000 rates[62] = (((states[63]*algebraic[89]+states[65]*algebraic[36])+states[60]*algebraic[22])+states[57]*algebraic[79])-states[62]*(((algebraic[49]+algebraic[84])+algebraic[69])+algebraic[43]) algebraic[50] = algebraic[37]/100.000 algebraic[90] = algebraic[44] rates[75] = (((states[76]*algebraic[90]+states[78]*algebraic[37])+states[73]*algebraic[23])+states[70]*algebraic[80])-states[75]*(((algebraic[50]+algebraic[85])+algebraic[70])+algebraic[44]) algebraic[57] = (algebraic[36]/95000.0)*80.0000 algebraic[94] = (algebraic[43]/30.0000)/10.0000 rates[63] = (states[64]*algebraic[94]+states[62]*algebraic[49])-states[63]*(algebraic[57]+algebraic[89]) rates[64] = states[63]*algebraic[57]-states[64]*algebraic[94] algebraic[58] = algebraic[37]/95000.0 algebraic[95] = algebraic[44]/50.0000 rates[76] = (states[77]*algebraic[95]+states[75]*algebraic[50])-states[76]*(algebraic[58]+algebraic[90]) rates[77] = states[76]*algebraic[58]-states[77]*algebraic[95] algebraic[1] = ((4.00000*1.20000)*0.416000)*exp(0.0120000*(states[21]-35.0000)) algebraic[13] = 4.00000*algebraic[1] algebraic[115] = (0.600000*0.0923300)*states[2] algebraic[118] = algebraic[115] algebraic[122] = (algebraic[13]+algebraic[118])*states[9] algebraic[77] = ((4.00000*0.450000)*0.0490000)*exp(-0.0650000*(states[21]-22.0000)) algebraic[82] = algebraic[77] algebraic[127] = algebraic[82]*states[10]+constants[102]*states[14] rates[9] = algebraic[127]-algebraic[122] algebraic[45] = constants[24]*algebraic[1] algebraic[52] = 4.00000*algebraic[45] algebraic[123] = (algebraic[52]+constants[102])*states[14] algebraic[99] = algebraic[77]/constants[25] algebraic[103] = algebraic[99] algebraic[129] = algebraic[103]*states[15]+algebraic[118]*states[9] rates[14] = algebraic[129]-algebraic[123] algebraic[26] = 3.00000*algebraic[1] algebraic[121] = constants[24]*algebraic[118] algebraic[128] = ((algebraic[82]+algebraic[26])+algebraic[121])*states[10] algebraic[87] = 2.00000*algebraic[77] algebraic[134] = (algebraic[13]*states[9]+algebraic[87]*states[11])+constants[112]*states[15] rates[10] = algebraic[134]-algebraic[128] algebraic[60] = 3.00000*algebraic[45] algebraic[130] = ((algebraic[103]+algebraic[60])+constants[112])*states[15] algebraic[106] = 2.00000*algebraic[99] algebraic[136] = (algebraic[52]*states[14]+algebraic[106]*states[16])+algebraic[121]*states[10] rates[15] = algebraic[136]-algebraic[130] algebraic[32] = 2.00000*algebraic[1] algebraic[126] = constants[24]*algebraic[121] algebraic[135] = ((algebraic[87]+algebraic[32])+algebraic[126])*states[11] algebraic[92] = 3.00000*algebraic[77] algebraic[140] = (algebraic[26]*states[10]+algebraic[92]*states[12])+constants[114]*states[16] rates[11] = algebraic[140]-algebraic[135] algebraic[67] = 2.00000*algebraic[45] algebraic[137] = ((algebraic[106]+algebraic[67])+constants[114])*states[16] algebraic[109] = 3.00000*algebraic[99] algebraic[143] = (algebraic[60]*states[15]+algebraic[109]*states[17])+algebraic[126]*states[11] rates[16] = algebraic[143]-algebraic[137] algebraic[40] = algebraic[1] algebraic[133] = constants[24]*algebraic[126] algebraic[141] = ((algebraic[92]+algebraic[40])+algebraic[133])*states[12] algebraic[97] = 4.00000*algebraic[77] algebraic[151] = (algebraic[32]*states[11]+algebraic[97]*states[13])+constants[116]*states[17] rates[12] = algebraic[151]-algebraic[141] algebraic[72] = algebraic[45] algebraic[144] = ((algebraic[109]+algebraic[72])+constants[116])*states[17] algebraic[112] = 4.00000*algebraic[99] algebraic[153] = (algebraic[67]*states[16]+algebraic[112]*states[18])+algebraic[133]*states[12] rates[17] = algebraic[153]-algebraic[144] algebraic[142] = constants[24]*algebraic[133] algebraic[152] = ((algebraic[97]+constants[26])+algebraic[142])*states[13] algebraic[166] = (algebraic[40]*states[12]+constants[27]*states[20])+constants[118]*states[18] rates[13] = algebraic[166]-algebraic[152] algebraic[154] = (algebraic[112]+constants[118])*states[18] algebraic[167] = algebraic[72]*states[17]+algebraic[142]*states[13] rates[18] = algebraic[167]-algebraic[154] algebraic[9] = constants[62]*exp(constants[60]*states[21]) algebraic[21] = 4.00000*algebraic[9] algebraic[138] = constants[70]*exp(constants[71]*states[21]) algebraic[145] = algebraic[138] algebraic[155] = (algebraic[21]+algebraic[145])*states[43] algebraic[101] = constants[69]*exp(-constants[68]*states[21]) algebraic[104] = algebraic[101] algebraic[73] = constants[63]*exp(-constants[61]*states[21]) algebraic[78] = algebraic[73] algebraic[168] = algebraic[104]*states[44]+algebraic[78]*states[47] rates[43] = algebraic[168]-algebraic[155] algebraic[29] = 3.00000*algebraic[9] algebraic[146] = constants[72]*algebraic[138] algebraic[156] = ((algebraic[29]+algebraic[104])+algebraic[146])*states[44] algebraic[107] = 2.00000*algebraic[101] algebraic[83] = algebraic[73]/constants[64] algebraic[169] = (algebraic[107]*states[45]+algebraic[83]*states[48])+algebraic[21]*states[43] rates[44] = algebraic[169]-algebraic[156] algebraic[35] = 2.00000*algebraic[9] algebraic[147] = constants[73]*algebraic[138] algebraic[157] = ((algebraic[35]+algebraic[107])+algebraic[147])*states[45] algebraic[110] = 3.00000*algebraic[101] algebraic[88] = algebraic[73]/constants[65] algebraic[170] = (algebraic[110]*states[46]+algebraic[88]*states[49])+algebraic[29]*states[44] rates[45] = algebraic[170]-algebraic[157] algebraic[148] = constants[74]*algebraic[138] algebraic[42] = algebraic[9] algebraic[158] = ((algebraic[42]+algebraic[110])+algebraic[148])*states[46] algebraic[93] = algebraic[73]/constants[66] algebraic[131] = 4.00000*algebraic[101] algebraic[171] = (algebraic[131]*states[51]+algebraic[93]*states[50])+algebraic[35]*states[45] rates[46] = algebraic[171]-algebraic[158] algebraic[48] = (4.00000*constants[64])*algebraic[9] algebraic[159] = (algebraic[78]+algebraic[48])*states[47] algebraic[113] = algebraic[101]/constants[72] algebraic[172] = algebraic[145]*states[43]+algebraic[113]*states[48] rates[47] = algebraic[172]-algebraic[159] algebraic[56] = ((3.00000*constants[65])*algebraic[9])/constants[64] algebraic[160] = ((algebraic[56]+algebraic[83])+algebraic[113])*states[48] algebraic[116] = ((2.00000*constants[72])*algebraic[101])/constants[73] algebraic[173] = (algebraic[116]*states[49]+algebraic[146]*states[44])+algebraic[48]*states[47] rates[48] = algebraic[173]-algebraic[160] algebraic[63] = ((2.00000*constants[66])*algebraic[9])/constants[65] algebraic[161] = ((algebraic[63]+algebraic[88])+algebraic[116])*states[49] algebraic[119] = ((3.00000*constants[73])*algebraic[101])/constants[74] algebraic[174] = (algebraic[119]*states[50]+algebraic[147]*states[45])+algebraic[56]*states[48] rates[49] = algebraic[174]-algebraic[161] algebraic[68] = (constants[67]*algebraic[9])/constants[66] algebraic[162] = ((algebraic[68]+algebraic[93])+algebraic[119])*states[50] algebraic[124] = ((4.00000*constants[74])*algebraic[101])/constants[75] algebraic[175] = (algebraic[124]*states[52]+algebraic[148]*states[46])+algebraic[63]*states[49] rates[50] = algebraic[175]-algebraic[162] algebraic[149] = constants[75]*algebraic[138] algebraic[164] = (algebraic[131]+algebraic[149])*states[51] algebraic[98] = algebraic[73]/constants[67] algebraic[177] = algebraic[42]*states[46]+algebraic[98]*states[52] rates[51] = algebraic[177]-algebraic[164] algebraic[163] = (algebraic[98]+algebraic[124])*states[52] algebraic[176] = algebraic[149]*states[51]+algebraic[68]*states[50] rates[52] = algebraic[176]-algebraic[163] algebraic[180] = states[21]/constants[111] algebraic[181] = (0.000171200*exp(-1.46500*algebraic[180]))/1000.00 algebraic[183] = (26.1700*exp(1.46500*algebraic[180]))/1000.00 algebraic[185] = (287.500*exp(1.24200*algebraic[180]))/1000.00 algebraic[187] = (0.0402500*exp(-1.24200*algebraic[180]))/1000.00 rates[25] = (-(4.00000*algebraic[187]+algebraic[181])*states[25]+algebraic[185]*states[27])+algebraic[183]*states[31] rates[26] = (-(algebraic[183]/(power(constants[32], 4.00000))+(4.00000*algebraic[185])/constants[32])*states[26]+(algebraic[181]*(power(constants[32], 4.00000)))*states[30])+(algebraic[187]*constants[32])*states[34] rates[27] = ((-((algebraic[185]+3.00000*algebraic[187])+algebraic[181]*constants[32])*states[27]+(4.00000*algebraic[187])*states[25])+(2.00000*algebraic[185])*states[28])+(algebraic[183]/constants[32])*states[32] rates[28] = ((-((2.00000*algebraic[185]+2.00000*algebraic[187])+algebraic[181]*(power(constants[32], 2.00000)))*states[28]+(3.00000*algebraic[187])*states[27])+(3.00000*algebraic[185])*states[29])+(algebraic[183]/(power(constants[32], 2.00000)))*states[33] rates[29] = ((-((3.00000*algebraic[185]+algebraic[187])+algebraic[181]*(power(constants[32], 3.00000)))*states[29]+(2.00000*algebraic[187])*states[28])+(4.00000*algebraic[185])*states[30])+(algebraic[183]/(power(constants[32], 3.00000)))*states[34] rates[30] = (-(4.00000*algebraic[185]+algebraic[181]*(power(constants[32], 4.00000)))*states[30]+algebraic[187]*states[29])+(algebraic[183]/(power(constants[32], 4.00000)))*states[26] rates[31] = (-(algebraic[183]+(4.00000*algebraic[187])*constants[32])*states[31]+algebraic[181]*states[25])+(algebraic[185]/constants[32])*states[32] rates[32] = ((-((algebraic[183]/constants[32]+algebraic[185]/constants[32])+(3.00000*algebraic[187])*constants[32])*states[32]+(algebraic[181]*constants[32])*states[27])+((4.00000*algebraic[187])*constants[32])*states[31])+((2.00000*algebraic[185])/constants[32])*states[33] rates[33] = ((-((algebraic[183]/(power(constants[32], 2.00000))+(2.00000*algebraic[185])/constants[32])+(2.00000*algebraic[187])*constants[32])*states[33]+(algebraic[181]*(power(constants[32], 2.00000)))*states[28])+((3.00000*algebraic[187])*constants[32])*states[32])+((3.00000*algebraic[185])/constants[32])*states[34] rates[34] = ((-((algebraic[183]/(power(constants[32], 3.00000))+(3.00000*algebraic[185])/constants[32])+algebraic[187]*constants[32])*states[34]+(algebraic[181]*(power(constants[32], 3.00000)))*states[29])+((2.00000*algebraic[187])*constants[32])*states[33])+((4.00000*algebraic[185])/constants[32])*states[26] algebraic[0] = (states[1]-states[0])/constants[6] algebraic[196] = power(states[3]/constants[96], constants[98]) algebraic[198] = power(states[1]/constants[97], constants[99]) algebraic[200] = (constants[95]*(constants[100]*algebraic[196]-constants[101]*algebraic[198]))/((1.00000+algebraic[196])+algebraic[198]) rates[1] = (algebraic[200]*constants[17])/constants[15]-(algebraic[0]*constants[14])/constants[15] algebraic[51] = constants[1]*rates[5]+constants[0]*rates[4] algebraic[12] = (states[2]-states[3])/constants[7] algebraic[86] = (constants[8]*constants[11])/(power(states[3]+constants[11], 2.00000)) algebraic[91] = (constants[10]*constants[13])/(power(states[3]+constants[13], 2.00000)) algebraic[96] = 1.00000/((1.00000+algebraic[86])+algebraic[91]) algebraic[189] = (exp(constants[50]*algebraic[180])*(power(states[42], 3.00000)))*constants[20] algebraic[190] = (exp((constants[50]-1.00000)*algebraic[180])*constants[121])*states[3] algebraic[191] = 1.00000+constants[52]*exp((constants[50]-1.00000)*algebraic[180]) algebraic[192] = ((constants[51]*constants[122])*(algebraic[189]-algebraic[190]))/(constants[120]*algebraic[191]) algebraic[105] = (constants[56]*states[3])/(constants[57]+states[3]) algebraic[194] = -2.00000*algebraic[192]+algebraic[105] rates[3] = algebraic[96]*(((algebraic[12]-algebraic[200])-algebraic[51])-(algebraic[194]*0.500000)*constants[103]) algebraic[114] = constants[111]*log(constants[21]/states[19]) algebraic[150] = constants[111]*log(constants[22]/states[42]) algebraic[165] = (constants[31]*((((states[31]+states[32])+states[33])+states[34])+states[26]))*(states[21]-(algebraic[150]/3.00000+(2.00000*algebraic[114])/3.00000)) algebraic[193] = 1.00000+0.124500*exp(-0.100000*algebraic[180]) algebraic[195] = (0.0365000*constants[124])*exp(-1.33000*algebraic[180]) algebraic[197] = 1.00000/(algebraic[193]+algebraic[195]) algebraic[102] = 1.00000+power(constants[55]/states[42], 1.50000) algebraic[199] = (constants[53]*algebraic[197])*(constants[123]/algebraic[102]) algebraic[179] = (constants[83]*(states[78]+states[69]))*(states[21]-algebraic[150]) algebraic[178] = (constants[80]*(states[65]+states[56]))*(states[21]-algebraic[150]) algebraic[202] = ((algebraic[179]+algebraic[178])+algebraic[165]/3.00000)+3.00000*(algebraic[192]+algebraic[199]) rates[42] = -constants[103]*algebraic[202] algebraic[203] = constants[19]*algebraic[180] algebraic[186] = 0.00100000*exp(2.00000*algebraic[180])-constants[20]*0.341000 algebraic[188] = exp(2.00000*algebraic[180])-1.00000 algebraic[204] = ((constants[117]*4.00000)*algebraic[203])*(algebraic[186]/algebraic[188]) algebraic[206] = custom_piecewise([greater(algebraic[204] , 0.00000), 0.00000 , True, algebraic[204]]) algebraic[207] = constants[119]/(1.00000+algebraic[206]/constants[115]) algebraic[182] = states[19]*exp(algebraic[180])-constants[21] algebraic[184] = exp(algebraic[180])-1.00000 algebraic[208] = (((algebraic[207]*states[20])*states[22])*algebraic[203])*(algebraic[182]/algebraic[184]) algebraic[100] = 1.00000/(0.968100+exp((states[21]+82.1862)/15.8864)) algebraic[117] = ((constants[33]*(power(constants[21]*1.00000, 1.0/2)))*algebraic[100])*(states[21]-algebraic[114]) algebraic[120] = ((constants[45]*constants[109])*states[39])*(states[21]-algebraic[114]) algebraic[125] = ((constants[47]*states[41])*states[40])*(states[21]-algebraic[114]) algebraic[132] = (constants[58]*(1.00000/(1.00000+exp(-(states[21]-20.0000)/12.0000))))*(states[21]-algebraic[114]) algebraic[139] = (constants[59]*states[51])*(states[21]-algebraic[114]) algebraic[111] = (custom_piecewise([less((voi-constants[78])-constants[79]*floor((voi-constants[78])/constants[79]) , constants[76]), 1.00000 , True, 0.00000]))*constants[110] algebraic[210] = (((((((algebraic[120]+algebraic[125])+algebraic[117])+algebraic[208])+(2.00000*algebraic[165])/3.00000)+algebraic[132])+algebraic[111])-2.00000*algebraic[199])+algebraic[139] rates[19] = -constants[103]*algebraic[210] algebraic[211] = (constants[94]*(states[79]+states[6]))*(states[0]-states[2]) algebraic[59] = (constants[9]*constants[12])/(power(states[0]+constants[12], 2.00000)) algebraic[66] = 1.00000/(1.00000+algebraic[59]) rates[0] = algebraic[66]*(algebraic[0]-algebraic[211]) algebraic[205] = (algebraic[204]*states[22])*states[20] algebraic[71] = (constants[8]*constants[11])/(power(states[2]+constants[11], 2.00000)) algebraic[76] = (constants[10]*constants[13])/(power(states[2]+constants[13], 2.00000)) algebraic[81] = 1.00000/((1.00000+algebraic[71])+algebraic[76]) algebraic[213] = (algebraic[211]*constants[14])/constants[16]-(algebraic[12]*constants[17])/constants[16] algebraic[209] = ((((algebraic[204]/constants[117])*constants[30])*states[24])*states[24])*states[23] rates[2] = algebraic[81]*((algebraic[213]-algebraic[205]*constants[113])-algebraic[209]*constants[113]) algebraic[212] = ((((((algebraic[179]+algebraic[178])+algebraic[205])+algebraic[209])+algebraic[208])+algebraic[120])+algebraic[125])+algebraic[165] algebraic[201] = (((algebraic[117]+algebraic[192])+algebraic[199])+algebraic[139])+algebraic[132] algebraic[108] = algebraic[105] algebraic[214] = (algebraic[212]+algebraic[201])+algebraic[108] rates[21] = -((algebraic[214]+constants[77])+algebraic[111]) return(rates) def computeAlgebraic(constants, states, voi): algebraic = array([[0.0] * len(voi)] * sizeAlgebraic) states = array(states) voi = array(voi) algebraic[2] = 1.00000/(0.00336336/(0.500000+exp(states[21]/-5.53900))+0.00779047*exp(states[21]/-49.5104)) algebraic[14] = constants[28]/(1.00000+exp((states[21]+28.5000)/7.80000))+(1.00000-constants[28]) algebraic[3] = 1.00000/(1.00000+exp((states[21]+75.6000)/6.20000)) algebraic[15] = custom_piecewise([less(states[21] , -60.0000), 500.000 , True, 18.3000+0.00500000*exp(-states[21]/6.20000)]) algebraic[4] = 1.00000/(1.00000+exp(-(states[21]+48.4000)/5.20000)) algebraic[16] = custom_piecewise([less(states[21] , -56.0000), 2.44000*exp((states[21]+120.000)/40.0000) , True, 1.34000+0.0350000*exp(-states[21]/11.8000)]) algebraic[5] = (constants[46]*constants[34])*exp(constants[41]*states[21]) algebraic[17] = (constants[46]*constants[35])*exp(constants[104]*states[21]) algebraic[7] = custom_piecewise([equal(states[21] , 21.0000), 0.000146000/0.0780000 , True, (0.000146000*(states[21]-21.0000))/(1.00000-exp(-0.0780000*(states[21]-21.0000)))]) algebraic[19] = 0.000910000*exp(-0.0280000*states[21]) algebraic[8] = custom_piecewise([equal(states[21] , -11.0000), 3.30000e-05/0.130000 , True, (3.30000e-05*(states[21]+11.0000))/(1.00000-exp(-0.130000*(states[21]+11.0000)))]) algebraic[20] = 0.000100000*exp(-0.0150000*states[21]) algebraic[24] = power(states[2]*1000.00, 4.00000) algebraic[25] = constants[2]*states[4] algebraic[28] = algebraic[5]*states[35]+constants[108]*states[37] algebraic[34] = (algebraic[17]+constants[107])*states[36] algebraic[38] = power(states[2]*1000.00, 3.00000) algebraic[39] = constants[4]*states[5] algebraic[18] = (constants[46]*constants[36])*exp(constants[42]*states[21]) algebraic[27] = (constants[46]*constants[39])*exp(constants[106]*states[21]) algebraic[47] = algebraic[18]*states[37]+algebraic[27]*states[38] algebraic[33] = (constants[46]*constants[37])*exp(constants[105]*states[21]) algebraic[41] = (constants[46]*constants[38])*exp(constants[43]*states[21]) algebraic[55] = (algebraic[33]+algebraic[41])*states[39] algebraic[6] = (constants[46]*constants[40])*exp(constants[44]*states[21]) algebraic[46] = ((algebraic[33]*algebraic[27])*algebraic[6])/(algebraic[18]*algebraic[41]) algebraic[53] = (constants[107]*states[36]+algebraic[33]*states[39])+algebraic[46]*states[38] algebraic[61] = ((algebraic[6]+algebraic[18])+constants[108])*states[37] algebraic[54] = algebraic[6]*states[37]+algebraic[41]*states[39] algebraic[62] = (algebraic[46]+algebraic[27])*states[38] algebraic[10] = 2.80200/(0.210000*exp(-states[21]/17.0000)+0.230000*exp(-states[21]/150.000)) algebraic[64] = 0.400000*exp(-states[21]/20.3000) algebraic[11] = 3.80200/(0.102700*exp(-states[21]/17.0000)+0.200000*exp(-states[21]/150.000)) algebraic[65] = 0.191700*exp(-states[21]/20.3000) algebraic[22] = 2.80200/(0.230000*exp(-states[21]/15.0000)+0.250000*exp(-states[21]/150.000)) algebraic[69] = 0.400000*exp(-(states[21]-5.00000)/20.3000) algebraic[23] = 3.80200/(0.102700*exp(-states[21]/15.0000)+0.230000*exp(-states[21]/150.000)) algebraic[70] = 0.200000*exp(-(states[21]-5.00000)/20.3000) algebraic[30] = 2.80200/(0.250000*exp(-states[21]/12.0000)+0.270000*exp(-states[21]/150.000)) algebraic[74] = (0.400000*exp(-(states[21]-10.0000)/20.3000))/4.50000 algebraic[31] = 3.80200/(0.102700*exp(-states[21]/12.0000)+0.250000*exp(-states[21]/150.000)) algebraic[75] = 0.220000*exp(-(states[21]-10.0000)/20.3000) algebraic[43] = (3.79330e-07*exp(-states[21]/7.60000))*3.00000 algebraic[79] = 0.00840000+2.00000e-05*states[21] algebraic[44] = 3.79330e-07*exp(-states[21]/7.70000) algebraic[80] = 0.00840000+2.00000e-05*states[21] algebraic[36] = (9.17800*exp(states[21]/29.6800))/4.50000 algebraic[84] = ((algebraic[43]*algebraic[36])*algebraic[30])/(algebraic[79]*algebraic[74]) algebraic[37] = 9.17800*exp(states[21]/29.6800) algebraic[85] = ((algebraic[44]*algebraic[37])*algebraic[31])/(algebraic[80]*algebraic[75]) algebraic[49] = ((algebraic[36]/100.000)*1.50000)*0.285000 algebraic[89] = algebraic[43]/5.00000 algebraic[50] = algebraic[37]/100.000 algebraic[90] = algebraic[44] algebraic[57] = (algebraic[36]/95000.0)*80.0000 algebraic[94] = (algebraic[43]/30.0000)/10.0000 algebraic[58] = algebraic[37]/95000.0 algebraic[95] = algebraic[44]/50.0000 algebraic[1] = ((4.00000*1.20000)*0.416000)*exp(0.0120000*(states[21]-35.0000)) algebraic[13] = 4.00000*algebraic[1] algebraic[115] = (0.600000*0.0923300)*states[2] algebraic[118] = algebraic[115] algebraic[122] = (algebraic[13]+algebraic[118])*states[9] algebraic[77] = ((4.00000*0.450000)*0.0490000)*exp(-0.0650000*(states[21]-22.0000)) algebraic[82] = algebraic[77] algebraic[127] = algebraic[82]*states[10]+constants[102]*states[14] algebraic[45] = constants[24]*algebraic[1] algebraic[52] = 4.00000*algebraic[45] algebraic[123] = (algebraic[52]+constants[102])*states[14] algebraic[99] = algebraic[77]/constants[25] algebraic[103] = algebraic[99] algebraic[129] = algebraic[103]*states[15]+algebraic[118]*states[9] algebraic[26] = 3.00000*algebraic[1] algebraic[121] = constants[24]*algebraic[118] algebraic[128] = ((algebraic[82]+algebraic[26])+algebraic[121])*states[10] algebraic[87] = 2.00000*algebraic[77] algebraic[134] = (algebraic[13]*states[9]+algebraic[87]*states[11])+constants[112]*states[15] algebraic[60] = 3.00000*algebraic[45] algebraic[130] = ((algebraic[103]+algebraic[60])+constants[112])*states[15] algebraic[106] = 2.00000*algebraic[99] algebraic[136] = (algebraic[52]*states[14]+algebraic[106]*states[16])+algebraic[121]*states[10] algebraic[32] = 2.00000*algebraic[1] algebraic[126] = constants[24]*algebraic[121] algebraic[135] = ((algebraic[87]+algebraic[32])+algebraic[126])*states[11] algebraic[92] = 3.00000*algebraic[77] algebraic[140] = (algebraic[26]*states[10]+algebraic[92]*states[12])+constants[114]*states[16] algebraic[67] = 2.00000*algebraic[45] algebraic[137] = ((algebraic[106]+algebraic[67])+constants[114])*states[16] algebraic[109] = 3.00000*algebraic[99] algebraic[143] = (algebraic[60]*states[15]+algebraic[109]*states[17])+algebraic[126]*states[11] algebraic[40] = algebraic[1] algebraic[133] = constants[24]*algebraic[126] algebraic[141] = ((algebraic[92]+algebraic[40])+algebraic[133])*states[12] algebraic[97] = 4.00000*algebraic[77] algebraic[151] = (algebraic[32]*states[11]+algebraic[97]*states[13])+constants[116]*states[17] algebraic[72] = algebraic[45] algebraic[144] = ((algebraic[109]+algebraic[72])+constants[116])*states[17] algebraic[112] = 4.00000*algebraic[99] algebraic[153] = (algebraic[67]*states[16]+algebraic[112]*states[18])+algebraic[133]*states[12] algebraic[142] = constants[24]*algebraic[133] algebraic[152] = ((algebraic[97]+constants[26])+algebraic[142])*states[13] algebraic[166] = (algebraic[40]*states[12]+constants[27]*states[20])+constants[118]*states[18] algebraic[154] = (algebraic[112]+constants[118])*states[18] algebraic[167] = algebraic[72]*states[17]+algebraic[142]*states[13] algebraic[9] = constants[62]*exp(constants[60]*states[21]) algebraic[21] = 4.00000*algebraic[9] algebraic[138] = constants[70]*exp(constants[71]*states[21]) algebraic[145] = algebraic[138] algebraic[155] = (algebraic[21]+algebraic[145])*states[43] algebraic[101] = constants[69]*exp(-constants[68]*states[21]) algebraic[104] = algebraic[101] algebraic[73] = constants[63]*exp(-constants[61]*states[21]) algebraic[78] = algebraic[73] algebraic[168] = algebraic[104]*states[44]+algebraic[78]*states[47] algebraic[29] = 3.00000*algebraic[9] algebraic[146] = constants[72]*algebraic[138] algebraic[156] = ((algebraic[29]+algebraic[104])+algebraic[146])*states[44] algebraic[107] = 2.00000*algebraic[101] algebraic[83] = algebraic[73]/constants[64] algebraic[169] = (algebraic[107]*states[45]+algebraic[83]*states[48])+algebraic[21]*states[43] algebraic[35] = 2.00000*algebraic[9] algebraic[147] = constants[73]*algebraic[138] algebraic[157] = ((algebraic[35]+algebraic[107])+algebraic[147])*states[45] algebraic[110] = 3.00000*algebraic[101] algebraic[88] = algebraic[73]/constants[65] algebraic[170] = (algebraic[110]*states[46]+algebraic[88]*states[49])+algebraic[29]*states[44] algebraic[148] = constants[74]*algebraic[138] algebraic[42] = algebraic[9] algebraic[158] = ((algebraic[42]+algebraic[110])+algebraic[148])*states[46] algebraic[93] = algebraic[73]/constants[66] algebraic[131] = 4.00000*algebraic[101] algebraic[171] = (algebraic[131]*states[51]+algebraic[93]*states[50])+algebraic[35]*states[45] algebraic[48] = (4.00000*constants[64])*algebraic[9] algebraic[159] = (algebraic[78]+algebraic[48])*states[47] algebraic[113] = algebraic[101]/constants[72] algebraic[172] = algebraic[145]*states[43]+algebraic[113]*states[48] algebraic[56] = ((3.00000*constants[65])*algebraic[9])/constants[64] algebraic[160] = ((algebraic[56]+algebraic[83])+algebraic[113])*states[48] algebraic[116] = ((2.00000*constants[72])*algebraic[101])/constants[73] algebraic[173] = (algebraic[116]*states[49]+algebraic[146]*states[44])+algebraic[48]*states[47] algebraic[63] = ((2.00000*constants[66])*algebraic[9])/constants[65] algebraic[161] = ((algebraic[63]+algebraic[88])+algebraic[116])*states[49] algebraic[119] = ((3.00000*constants[73])*algebraic[101])/constants[74] algebraic[174] = (algebraic[119]*states[50]+algebraic[147]*states[45])+algebraic[56]*states[48] algebraic[68] = (constants[67]*algebraic[9])/constants[66] algebraic[162] = ((algebraic[68]+algebraic[93])+algebraic[119])*states[50] algebraic[124] = ((4.00000*constants[74])*algebraic[101])/constants[75] algebraic[175] = (algebraic[124]*states[52]+algebraic[148]*states[46])+algebraic[63]*states[49] algebraic[149] = constants[75]*algebraic[138] algebraic[164] = (algebraic[131]+algebraic[149])*states[51] algebraic[98] = algebraic[73]/constants[67] algebraic[177] = algebraic[42]*states[46]+algebraic[98]*states[52] algebraic[163] = (algebraic[98]+algebraic[124])*states[52] algebraic[176] = algebraic[149]*states[51]+algebraic[68]*states[50] algebraic[180] = states[21]/constants[111] algebraic[181] = (0.000171200*exp(-1.46500*algebraic[180]))/1000.00 algebraic[183] = (26.1700*exp(1.46500*algebraic[180]))/1000.00 algebraic[185] = (287.500*exp(1.24200*algebraic[180]))/1000.00 algebraic[187] = (0.0402500*exp(-1.24200*algebraic[180]))/1000.00 algebraic[0] = (states[1]-states[0])/constants[6] algebraic[196] = power(states[3]/constants[96], constants[98]) algebraic[198] = power(states[1]/constants[97], constants[99]) algebraic[200] = (constants[95]*(constants[100]*algebraic[196]-constants[101]*algebraic[198]))/((1.00000+algebraic[196])+algebraic[198]) algebraic[51] = constants[1]*rates[5]+constants[0]*rates[4] algebraic[12] = (states[2]-states[3])/constants[7] algebraic[86] = (constants[8]*constants[11])/(power(states[3]+constants[11], 2.00000)) algebraic[91] = (constants[10]*constants[13])/(power(states[3]+constants[13], 2.00000)) algebraic[96] = 1.00000/((1.00000+algebraic[86])+algebraic[91]) algebraic[189] = (exp(constants[50]*algebraic[180])*(power(states[42], 3.00000)))*constants[20] algebraic[190] = (exp((constants[50]-1.00000)*algebraic[180])*constants[121])*states[3] algebraic[191] = 1.00000+constants[52]*exp((constants[50]-1.00000)*algebraic[180]) algebraic[192] = ((constants[51]*constants[122])*(algebraic[189]-algebraic[190]))/(constants[120]*algebraic[191]) algebraic[105] = (constants[56]*states[3])/(constants[57]+states[3]) algebraic[194] = -2.00000*algebraic[192]+algebraic[105] algebraic[114] = constants[111]*log(constants[21]/states[19]) algebraic[150] = constants[111]*log(constants[22]/states[42]) algebraic[165] = (constants[31]*((((states[31]+states[32])+states[33])+states[34])+states[26]))*(states[21]-(algebraic[150]/3.00000+(2.00000*algebraic[114])/3.00000)) algebraic[193] = 1.00000+0.124500*exp(-0.100000*algebraic[180]) algebraic[195] = (0.0365000*constants[124])*exp(-1.33000*algebraic[180]) algebraic[197] = 1.00000/(algebraic[193]+algebraic[195]) algebraic[102] = 1.00000+power(constants[55]/states[42], 1.50000) algebraic[199] = (constants[53]*algebraic[197])*(constants[123]/algebraic[102]) algebraic[179] = (constants[83]*(states[78]+states[69]))*(states[21]-algebraic[150]) algebraic[178] = (constants[80]*(states[65]+states[56]))*(states[21]-algebraic[150]) algebraic[202] = ((algebraic[179]+algebraic[178])+algebraic[165]/3.00000)+3.00000*(algebraic[192]+algebraic[199]) algebraic[203] = constants[19]*algebraic[180] algebraic[186] = 0.00100000*exp(2.00000*algebraic[180])-constants[20]*0.341000 algebraic[188] = exp(2.00000*algebraic[180])-1.00000 algebraic[204] = ((constants[117]*4.00000)*algebraic[203])*(algebraic[186]/algebraic[188]) algebraic[206] = custom_piecewise([greater(algebraic[204] , 0.00000), 0.00000 , True, algebraic[204]]) algebraic[207] = constants[119]/(1.00000+algebraic[206]/constants[115]) algebraic[182] = states[19]*exp(algebraic[180])-constants[21] algebraic[184] = exp(algebraic[180])-1.00000 algebraic[208] = (((algebraic[207]*states[20])*states[22])*algebraic[203])*(algebraic[182]/algebraic[184]) algebraic[100] = 1.00000/(0.968100+exp((states[21]+82.1862)/15.8864)) algebraic[117] = ((constants[33]*(power(constants[21]*1.00000, 1.0/2)))*algebraic[100])*(states[21]-algebraic[114]) algebraic[120] = ((constants[45]*constants[109])*states[39])*(states[21]-algebraic[114]) algebraic[125] = ((constants[47]*states[41])*states[40])*(states[21]-algebraic[114]) algebraic[132] = (constants[58]*(1.00000/(1.00000+exp(-(states[21]-20.0000)/12.0000))))*(states[21]-algebraic[114]) algebraic[139] = (constants[59]*states[51])*(states[21]-algebraic[114]) algebraic[111] = (custom_piecewise([less((voi-constants[78])-constants[79]*floor((voi-constants[78])/constants[79]) , constants[76]), 1.00000 , True, 0.00000]))*constants[110] algebraic[210] = (((((((algebraic[120]+algebraic[125])+algebraic[117])+algebraic[208])+(2.00000*algebraic[165])/3.00000)+algebraic[132])+algebraic[111])-2.00000*algebraic[199])+algebraic[139] algebraic[211] = (constants[94]*(states[79]+states[6]))*(states[0]-states[2]) algebraic[59] = (constants[9]*constants[12])/(power(states[0]+constants[12], 2.00000)) algebraic[66] = 1.00000/(1.00000+algebraic[59]) algebraic[205] = (algebraic[204]*states[22])*states[20] algebraic[71] = (constants[8]*constants[11])/(power(states[2]+constants[11], 2.00000)) algebraic[76] = (constants[10]*constants[13])/(power(states[2]+constants[13], 2.00000)) algebraic[81] = 1.00000/((1.00000+algebraic[71])+algebraic[76]) algebraic[213] = (algebraic[211]*constants[14])/constants[16]-(algebraic[12]*constants[17])/constants[16] algebraic[209] = ((((algebraic[204]/constants[117])*constants[30])*states[24])*states[24])*states[23] algebraic[212] = ((((((algebraic[179]+algebraic[178])+algebraic[205])+algebraic[209])+algebraic[208])+algebraic[120])+algebraic[125])+algebraic[165] algebraic[201] = (((algebraic[117]+algebraic[192])+algebraic[199])+algebraic[139])+algebraic[132] algebraic[108] = algebraic[105] algebraic[214] = (algebraic[212]+algebraic[201])+algebraic[108] 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)