# Size of variable arrays: sizeAlgebraic = 233 sizeStates = 44 sizeConstants = 186 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] = "kappa_R_TRPNCa in component BG_parameters (fmol_per_sec)" legend_constants[1] = "kappa_R_BU in component BG_parameters (fmol_per_sec)" legend_constants[2] = "kappa_R_UW in component BG_parameters (fmol_per_sec)" legend_constants[3] = "kappa_R_WS in component BG_parameters (fmol_per_sec)" legend_constants[4] = "kappa_R_SU in component BG_parameters (fmol_per_sec)" legend_constants[5] = "kappa_LCC_Ca1 in component BG_parameters (fmol_per_sec)" legend_constants[6] = "kappa_LCC_Ca2 in component BG_parameters (fmol_per_sec)" legend_constants[7] = "kappa_LCC_K1 in component BG_parameters (fmol_per_sec)" legend_constants[8] = "kappa_LCC_K2 in component BG_parameters (fmol_per_sec)" legend_constants[9] = "kappa_d000 in component BG_parameters (fmol_per_sec)" legend_constants[10] = "kappa_d010 in component BG_parameters (fmol_per_sec)" legend_constants[11] = "kappa_d020 in component BG_parameters (fmol_per_sec)" legend_constants[12] = "kappa_d001 in component BG_parameters (fmol_per_sec)" legend_constants[13] = "kappa_d011 in component BG_parameters (fmol_per_sec)" legend_constants[14] = "kappa_d021 in component BG_parameters (fmol_per_sec)" legend_constants[15] = "kappa_f1_000 in component BG_parameters (fmol_per_sec)" legend_constants[16] = "kappa_f1_100 in component BG_parameters (fmol_per_sec)" legend_constants[17] = "kappa_f1_001 in component BG_parameters (fmol_per_sec)" legend_constants[18] = "kappa_f1_101 in component BG_parameters (fmol_per_sec)" legend_constants[19] = "kappa_f2_000 in component BG_parameters (fmol_per_sec)" legend_constants[20] = "kappa_f2_100 in component BG_parameters (fmol_per_sec)" legend_constants[21] = "kappa_f2_001 in component BG_parameters (fmol_per_sec)" legend_constants[22] = "kappa_f2_101 in component BG_parameters (fmol_per_sec)" legend_constants[23] = "kappa_f3_010 in component BG_parameters (fmol_per_sec)" legend_constants[24] = "kappa_f3_110 in component BG_parameters (fmol_per_sec)" legend_constants[25] = "kappa_f3_011 in component BG_parameters (fmol_per_sec)" legend_constants[26] = "kappa_f3_111 in component BG_parameters (fmol_per_sec)" legend_constants[27] = "kappa_fCa000 in component BG_parameters (fmol_per_sec)" legend_constants[28] = "kappa_fCa100 in component BG_parameters (fmol_per_sec)" legend_constants[29] = "kappa_fCa010 in component BG_parameters (fmol_per_sec)" legend_constants[30] = "kappa_fCa110 in component BG_parameters (fmol_per_sec)" legend_constants[31] = "kappa_fCa020 in component BG_parameters (fmol_per_sec)" legend_constants[32] = "kappa_fCa120 in component BG_parameters (fmol_per_sec)" legend_constants[33] = "kappa_PLBph1 in component BG_parameters (fmol_per_sec)" legend_constants[34] = "kappa_PLBph2 in component BG_parameters (fmol_per_sec)" legend_constants[35] = "kappa_PLBd1 in component BG_parameters (fmol_per_sec)" legend_constants[36] = "kappa_PLBd2 in component BG_parameters (fmol_per_sec)" legend_constants[37] = "kappa_Inh in component BG_parameters (fmol_per_sec)" legend_constants[38] = "kappa_RyR in component BG_parameters (fmol_per_sec)" legend_constants[39] = "kappa_OC in component BG_parameters (fmol_per_sec)" legend_constants[40] = "kappa_CCI in component BG_parameters (fmol_per_sec)" legend_constants[41] = "kappa_CII in component BG_parameters (fmol_per_sec)" legend_constants[42] = "kappa_IO in component BG_parameters (fmol_per_sec)" legend_constants[43] = "kappa_SERCA_R1_2 in component BG_parameters (fmol_per_sec)" legend_constants[44] = "kappa_SERCA_R2_4 in component BG_parameters (fmol_per_sec)" legend_constants[45] = "kappa_SERCA_R2_2a in component BG_parameters (fmol_per_sec)" legend_constants[46] = "kappa_SERCA_R4_5 in component BG_parameters (fmol_per_sec)" legend_constants[47] = "kappa_SERCA_R5_6 in component BG_parameters (fmol_per_sec)" legend_constants[48] = "kappa_SERCA_R6_8 in component BG_parameters (fmol_per_sec)" legend_constants[49] = "kappa_SERCA_R8_9 in component BG_parameters (fmol_per_sec)" legend_constants[50] = "kappa_SERCA_R9_10 in component BG_parameters (fmol_per_sec)" legend_constants[51] = "kappa_SERCA_R10_1 in component BG_parameters (fmol_per_sec)" legend_constants[52] = "K_TRPN in component BG_parameters (per_fmol)" legend_constants[53] = "K_Cai in component BG_parameters (per_fmol)" legend_constants[54] = "K_Ca_TRPN in component BG_parameters (per_fmol)" legend_constants[55] = "K_B in component BG_parameters (per_fmol)" legend_constants[56] = "K_U in component BG_parameters (per_fmol)" legend_constants[57] = "K_W in component BG_parameters (per_fmol)" legend_constants[58] = "K_S in component BG_parameters (per_fmol)" legend_constants[59] = "K_Ca_i in component BG_parameters (per_fmol)" legend_constants[60] = "K_Ca_o in component BG_parameters (per_fmol)" legend_constants[61] = "K_K_i in component BG_parameters (per_fmol)" legend_constants[62] = "K_K_o in component BG_parameters (per_fmol)" legend_constants[63] = "K_000_LCC in component BG_parameters (per_fmol)" legend_constants[64] = "K_010_LCC in component BG_parameters (per_fmol)" legend_constants[65] = "K_020_LCC in component BG_parameters (per_fmol)" legend_constants[66] = "K_100_LCC in component BG_parameters (per_fmol)" legend_constants[67] = "K_110_LCC in component BG_parameters (per_fmol)" legend_constants[68] = "K_120_LCC in component BG_parameters (per_fmol)" legend_constants[69] = "K_001_LCC in component BG_parameters (per_fmol)" legend_constants[70] = "K_011_LCC in component BG_parameters (per_fmol)" legend_constants[71] = "K_021_LCC in component BG_parameters (per_fmol)" legend_constants[72] = "K_101_LCC in component BG_parameters (per_fmol)" legend_constants[73] = "K_111_LCC in component BG_parameters (per_fmol)" legend_constants[74] = "K_121_LCC in component BG_parameters (per_fmol)" legend_constants[75] = "K_PLB in component BG_parameters (per_fmol)" legend_constants[76] = "K_PKACI in component BG_parameters (per_fmol)" legend_constants[77] = "K_PLB_PKACI in component BG_parameters (per_fmol)" legend_constants[78] = "K_PP1 in component BG_parameters (per_fmol)" legend_constants[79] = "K_PLBp_PP1 in component BG_parameters (per_fmol)" legend_constants[80] = "K_PLBp in component BG_parameters (per_fmol)" legend_constants[81] = "K_Ip in component BG_parameters (per_fmol)" legend_constants[82] = "K_Ip_PP1 in component BG_parameters (per_fmol)" legend_constants[83] = "K_Ca_SR in component BG_parameters (per_fmol)" legend_constants[84] = "K_C_RyR in component BG_parameters (per_fmol)" legend_constants[85] = "K_CI_RyR in component BG_parameters (per_fmol)" legend_constants[86] = "K_I_RyR in component BG_parameters (per_fmol)" legend_constants[87] = "K_O_RyR in component BG_parameters (per_fmol)" legend_constants[88] = "K_P1_SERCA in component BG_parameters (per_fmol)" legend_constants[89] = "K_P2_SERCA in component BG_parameters (per_fmol)" legend_constants[90] = "K_P2a_SERCA in component BG_parameters (per_fmol)" legend_constants[91] = "K_P4_SERCA in component BG_parameters (per_fmol)" legend_constants[92] = "K_P5_SERCA in component BG_parameters (per_fmol)" legend_constants[93] = "K_P6_SERCA in component BG_parameters (per_fmol)" legend_constants[94] = "K_P8_SERCA in component BG_parameters (per_fmol)" legend_constants[95] = "K_P9_SERCA in component BG_parameters (per_fmol)" legend_constants[96] = "K_P10_SERCA in component BG_parameters (per_fmol)" legend_constants[97] = "K_H in component BG_parameters (per_fmol)" legend_constants[98] = "K_MgATP in component BG_parameters (per_fmol)" legend_constants[99] = "K_MgADP in component BG_parameters (per_fmol)" legend_constants[100] = "K_Pi in component BG_parameters (per_fmol)" legend_constants[101] = "z_rCa in component BG_parameters (dimensionless)" legend_constants[102] = "z_fd in component BG_parameters (dimensionless)" legend_constants[103] = "z_ff1 in component BG_parameters (dimensionless)" legend_constants[104] = "z_ff2 in component BG_parameters (dimensionless)" legend_constants[105] = "z_ff3 in component BG_parameters (dimensionless)" legend_constants[106] = "z_rd in component BG_parameters (dimensionless)" legend_constants[107] = "z_rf1 in component BG_parameters (dimensionless)" legend_constants[108] = "z_rf2 in component BG_parameters (dimensionless)" legend_constants[109] = "z_rf3 in component BG_parameters (dimensionless)" legend_voi = "time in component environment (second)" legend_constants[110] = "vol_myo in component environment (pL)" legend_constants[111] = "freq in component environment (dimensionless)" legend_constants[112] = "C_m in component environment (fF)" legend_constants[113] = "F in component constants (C_per_mol)" legend_states[0] = "q_membrane in component environment (fC)" legend_algebraic[0] = "V_m in component environment (volt)" legend_states[1] = "q_TRPN in component environment (fmol)" legend_states[2] = "q_Ca_TRPN in component environment (fmol)" legend_states[3] = "q_Cai in component environment (fmol)" legend_states[4] = "q_B in component environment (fmol)" legend_states[5] = "q_U in component environment (fmol)" legend_states[6] = "q_W in component environment (fmol)" legend_states[7] = "q_S in component environment (fmol)" legend_states[8] = "q_Cao in component environment (fmol)" legend_states[9] = "q_Ki in component environment (fmol)" legend_states[10] = "q_Ko in component environment (fmol)" legend_states[11] = "q_PLB in component environment (fmol)" legend_states[12] = "q_PKACI in component environment (fmol)" legend_states[13] = "q_PLB_PKACI in component environment (fmol)" legend_states[14] = "q_PP1 in component environment (fmol)" legend_states[15] = "q_PLBp_PP1 in component environment (fmol)" legend_states[16] = "q_PLBp in component environment (fmol)" legend_states[17] = "q_Ip in component environment (fmol)" legend_states[18] = "q_Ip_PP1 in component environment (fmol)" legend_states[19] = "q_Ca_SR in component environment (fmol)" legend_states[20] = "q_H in component environment (fmol)" legend_states[21] = "q_P in component environment (fmol)" legend_states[22] = "q_MgADP in component environment (fmol)" legend_states[23] = "q_MgATP in component environment (fmol)" legend_states[24] = "q_000_LCC in component environment (fmol)" legend_states[25] = "q_010_LCC in component environment (fmol)" legend_states[26] = "q_020_LCC in component environment (fmol)" legend_states[27] = "q_100_LCC in component environment (fmol)" legend_states[28] = "q_110_LCC in component environment (fmol)" legend_states[29] = "q_120_LCC in component environment (fmol)" legend_states[30] = "q_001_LCC in component environment (fmol)" legend_states[31] = "q_011_LCC in component environment (fmol)" legend_states[32] = "q_021_LCC in component environment (fmol)" legend_states[33] = "q_101_LCC in component environment (fmol)" legend_states[34] = "q_111_LCC in component environment (fmol)" legend_states[35] = "q_121_LCC in component environment (fmol)" legend_states[36] = "q_C_RyR in component environment (fmol)" legend_states[37] = "q_CI_RyR in component environment (fmol)" legend_states[38] = "q_I_RyR in component environment (fmol)" legend_states[39] = "q_O_RyR in component environment (fmol)" legend_constants[114] = "q_P1_SERCA in component environment (fmol)" legend_constants[115] = "q_P2_SERCA in component environment (fmol)" legend_constants[116] = "q_P2a_SERCA in component environment (fmol)" legend_constants[117] = "q_P4_SERCA in component environment (fmol)" legend_constants[118] = "q_P5_SERCA in component environment (fmol)" legend_constants[119] = "q_P6_SERCA in component environment (fmol)" legend_constants[120] = "q_P8_SERCA in component environment (fmol)" legend_constants[121] = "q_P9_SERCA in component environment (fmol)" legend_constants[122] = "q_P10_SERCA in component environment (fmol)" legend_algebraic[232] = "v_R_TRPNCa in component crossbridge_TRPN (fmol_per_sec)" legend_algebraic[43] = "v_R_BU in component crossbridge_TRPN (fmol_per_sec)" legend_algebraic[46] = "v_R_UW in component crossbridge_TRPN (fmol_per_sec)" legend_algebraic[49] = "v_R_WS in component crossbridge_TRPN (fmol_per_sec)" legend_algebraic[52] = "v_R_SU in component crossbridge_TRPN (fmol_per_sec)" legend_algebraic[229] = "T_total in component crossbridge_TRPN (kPa)" legend_states[40] = "SL in component crossbridge_TRPN (metre)" legend_algebraic[163] = "v_Ca_i_LCC in component LCC (fmol_per_sec)" legend_algebraic[161] = "v_Ca_o_LCC in component LCC (fmol_per_sec)" legend_algebraic[167] = "v_K_i_LCC in component LCC (fmol_per_sec)" legend_algebraic[168] = "v_K_o_LCC in component LCC (fmol_per_sec)" legend_algebraic[169] = "I_mem_LCC in component LCC (fA)" legend_algebraic[44] = "v_PLBph1 in component PLB (fmol_per_sec)" legend_algebraic[47] = "v_PLBph2 in component PLB (fmol_per_sec)" legend_algebraic[50] = "v_PLBd1 in component PLB (fmol_per_sec)" legend_algebraic[53] = "v_PLBd2 in component PLB (fmol_per_sec)" legend_algebraic[55] = "v_Inh in component PLB (fmol_per_sec)" legend_algebraic[177] = "v_RyR in component RyR (fmol_per_sec)" legend_algebraic[182] = "v_RyRgate_Ca_i in component RyR (fmol_per_sec)" legend_algebraic[209] = "v_Ca_i_SERCA in component SERCA (fmol_per_sec)" legend_algebraic[219] = "v_Ca_SR_SERCA in component SERCA (fmol_per_sec)" legend_algebraic[226] = "v_H_SERCA in component SERCA (fmol_per_sec)" legend_algebraic[204] = "v_MgADP_SERCA in component SERCA (fmol_per_sec)" legend_algebraic[201] = "v_MgATP_SERCA in component SERCA (fmol_per_sec)" legend_algebraic[199] = "v_Pi_SERCA in component SERCA (fmol_per_sec)" legend_algebraic[9] = "I_pulse in component environment (fA)" legend_constants[123] = "pulse_start in component environment (second)" legend_constants[124] = "pulse_end in component environment (second)" legend_constants[125] = "pulseMag in component environment (fA)" legend_constants[126] = "pulseHolding in component environment (fA)" legend_algebraic[172] = "sum_I in component environment (fA)" legend_constants[127] = "zCa in component ion_valences (dimensionless)" legend_constants[128] = "zK in component ion_valences (dimensionless)" legend_algebraic[2] = "PLB_T in component environment (fmol)" legend_algebraic[3] = "PKACI_T in component environment (fmol)" legend_algebraic[4] = "Ip_T in component environment (fmol)" legend_algebraic[5] = "K_i_T in component environment (fmol)" legend_algebraic[6] = "K_o_T in component environment (fmol)" legend_constants[129] = "R in component constants (J_per_K_per_mol)" legend_constants[130] = "T in component constants (kelvin)" legend_constants[131] = "zNa in component ion_valences (dimensionless)" legend_constants[132] = "zCl in component ion_valences (dimensionless)" legend_constants[133] = "n_Tm in component crossbridge_TRPN (dimensionless)" legend_algebraic[24] = "mu_TRPN in component crossbridge_TRPN (J_per_mol)" legend_algebraic[28] = "mu_Cai in component crossbridge_TRPN (J_per_mol)" legend_algebraic[30] = "mu_Ca_TRPN in component crossbridge_TRPN (J_per_mol)" legend_algebraic[31] = "mu_B in component crossbridge_TRPN (J_per_mol)" legend_algebraic[34] = "mu_U in component crossbridge_TRPN (J_per_mol)" legend_algebraic[37] = "mu_W in component crossbridge_TRPN (J_per_mol)" legend_algebraic[40] = "mu_S in component crossbridge_TRPN (J_per_mol)" legend_algebraic[230] = "tension in component crossbridge_TRPN (N_per_mm2)" legend_algebraic[231] = "mu_tension in component crossbridge_TRPN (J_per_mol)" legend_constants[134] = "kf_coeff in component crossbridge_TRPN (dimensionless)" legend_constants[160] = "n in component crossbridge_TRPN (J_per_mol)" legend_constants[135] = "hh in component crossbridge_TRPN (mm2_per_N)" legend_constants[136] = "SL_0 in component crossbridge_TRPN (metre)" legend_constants[137] = "q_MS in component crossbridge_TRPN (fmol)" legend_constants[138] = "r_s in component crossbridge_TRPN (dimensionless)" legend_constants[139] = "r_w in component crossbridge_TRPN (dimensionless)" legend_constants[140] = "A_eff in component crossbridge_TRPN (dimensionless)" legend_constants[141] = "phi in component crossbridge_TRPN (dimensionless)" legend_constants[142] = "k_uw in component crossbridge_TRPN (per_sec)" legend_constants[143] = "k_ws in component crossbridge_TRPN (per_sec)" legend_states[41] = "G_w in component crossbridge_TRPN (metre)" legend_states[42] = "G_s in component crossbridge_TRPN (metre)" legend_constants[157] = "c_w in component crossbridge_TRPN (per_sec)" legend_constants[158] = "c_s in component crossbridge_TRPN (per_sec)" legend_constants[159] = "A_w in component crossbridge_TRPN (dimensionless)" legend_constants[163] = "A_s in component crossbridge_TRPN (dimensionless)" legend_algebraic[22] = "mu_1 in component crossbridge_TRPN (J_per_m)" legend_constants[164] = "mu_2 in component crossbridge_TRPN (J_per_m)" legend_algebraic[7] = "mu_3 in component crossbridge_TRPN (J_per_m)" legend_algebraic[23] = "mu_4 in component crossbridge_TRPN (J_per_m)" legend_constants[167] = "mu_5 in component crossbridge_TRPN (J_per_m)" legend_algebraic[8] = "mu_6 in component crossbridge_TRPN (J_per_m)" legend_algebraic[26] = "v_1 in component crossbridge_TRPN (m_per_s)" legend_constants[144] = "v_2 in component crossbridge_TRPN (m_per_s)" legend_algebraic[27] = "v_4 in component crossbridge_TRPN (m_per_s)" legend_constants[145] = "v_to_mu in component crossbridge_TRPN (Js_per_m2)" legend_algebraic[42] = "T_active in component crossbridge_TRPN (kPa)" legend_constants[146] = "T_ref in component crossbridge_TRPN (kPa)" legend_algebraic[39] = "mu_T_a in component crossbridge_TRPN (kPa)" legend_algebraic[33] = "mu_T_S in component crossbridge_TRPN (kPa)" legend_algebraic[36] = "mu_T_W in component crossbridge_TRPN (kPa)" legend_states[43] = "Cdd in component crossbridge_TRPN (metre)" legend_algebraic[212] = "eta in component crossbridge_TRPN (per_sec)" legend_constants[147] = "eta_l in component crossbridge_TRPN (per_sec)" legend_constants[148] = "eta_s in component crossbridge_TRPN (per_sec)" legend_constants[149] = "k in component crossbridge_TRPN (dimensionless)" legend_constants[150] = "alpha in component crossbridge_TRPN (kPa)" legend_algebraic[218] = "v_Cdd in component crossbridge_TRPN (m_per_s)" legend_algebraic[213] = "mu_d in component crossbridge_TRPN (J_per_m)" legend_algebraic[214] = "mu_k in component crossbridge_TRPN (J_per_m)" legend_algebraic[215] = "mu_f in component crossbridge_TRPN (J_per_m)" legend_algebraic[222] = "mu_T_passive in component crossbridge_TRPN (kPa)" legend_algebraic[225] = "T_passive in component crossbridge_TRPN (kPa)" legend_algebraic[48] = "mu_Ca_o in component LCC (J_per_mol)" legend_algebraic[51] = "mu_Ca_i in component LCC (J_per_mol)" legend_algebraic[54] = "mu_K_o in component LCC (J_per_mol)" legend_algebraic[56] = "mu_K_i in component LCC (J_per_mol)" legend_algebraic[45] = "V_mem in component LCC (volt)" legend_algebraic[65] = "Af_LCC_Ca1 in component LCC (J_per_mol)" legend_algebraic[97] = "Ar_LCC_Ca1 in component LCC (J_per_mol)" legend_algebraic[93] = "Am_LCC_Ca1 in component LCC (J_per_mol)" legend_algebraic[158] = "v_LCC_Ca1 in component LCC (fmol_per_sec)" legend_algebraic[66] = "Af_LCC_Ca2 in component LCC (J_per_mol)" legend_algebraic[98] = "Ar_LCC_Ca2 in component LCC (J_per_mol)" legend_algebraic[94] = "Am_LCC_Ca2 in component LCC (J_per_mol)" legend_algebraic[160] = "v_LCC_Ca2 in component LCC (fmol_per_sec)" legend_algebraic[67] = "Af_LCC_K1 in component LCC (J_per_mol)" legend_algebraic[99] = "Ar_LCC_K1 in component LCC (J_per_mol)" legend_algebraic[95] = "Am_LCC_K1 in component LCC (J_per_mol)" legend_algebraic[162] = "v_LCC_K1 in component LCC (fmol_per_sec)" legend_algebraic[68] = "Af_LCC_K2 in component LCC (J_per_mol)" legend_algebraic[100] = "Ar_LCC_K2 in component LCC (J_per_mol)" legend_algebraic[96] = "Am_LCC_K2 in component LCC (J_per_mol)" legend_algebraic[164] = "v_LCC_K2 in component LCC (fmol_per_sec)" legend_algebraic[87] = "Af_fCa00 in component LCC (J_per_mol)" legend_algebraic[137] = "Ar_fCa00 in component LCC (J_per_mol)" legend_algebraic[138] = "v_fCa00 in component LCC (fmol_per_sec)" legend_algebraic[88] = "Af_fCa01 in component LCC (J_per_mol)" legend_algebraic[139] = "Ar_fCa01 in component LCC (J_per_mol)" legend_algebraic[142] = "v_fCa01 in component LCC (fmol_per_sec)" legend_algebraic[89] = "Af_fCa02 in component LCC (J_per_mol)" legend_algebraic[143] = "Ar_fCa02 in component LCC (J_per_mol)" legend_algebraic[146] = "v_fCa02 in component LCC (fmol_per_sec)" legend_algebraic[90] = "Af_fCa10 in component LCC (J_per_mol)" legend_algebraic[147] = "Ar_fCa10 in component LCC (J_per_mol)" legend_algebraic[150] = "v_fCa10 in component LCC (fmol_per_sec)" legend_algebraic[91] = "Af_fCa11 in component LCC (J_per_mol)" legend_algebraic[151] = "Ar_fCa11 in component LCC (J_per_mol)" legend_algebraic[154] = "v_fCa11 in component LCC (fmol_per_sec)" legend_algebraic[92] = "Af_fCa12 in component LCC (J_per_mol)" legend_algebraic[155] = "Ar_fCa12 in component LCC (J_per_mol)" legend_algebraic[157] = "v_fCa12 in component LCC (fmol_per_sec)" legend_algebraic[57] = "mu_S000_LCC in component LCC (J_per_mol)" legend_algebraic[140] = "v_S000_LCC in component LCC (fmol_per_sec)" legend_algebraic[58] = "mu_S010_LCC in component LCC (J_per_mol)" legend_algebraic[144] = "v_S010_LCC in component LCC (fmol_per_sec)" legend_algebraic[59] = "mu_S020_LCC in component LCC (J_per_mol)" legend_algebraic[148] = "v_S020_LCC in component LCC (fmol_per_sec)" legend_algebraic[60] = "mu_S100_LCC in component LCC (J_per_mol)" legend_algebraic[152] = "v_S100_LCC in component LCC (fmol_per_sec)" legend_algebraic[61] = "mu_S110_LCC in component LCC (J_per_mol)" legend_algebraic[156] = "v_S110_LCC in component LCC (fmol_per_sec)" legend_algebraic[63] = "mu_S120_LCC in component LCC (J_per_mol)" legend_algebraic[159] = "v_S120_LCC in component LCC (fmol_per_sec)" legend_algebraic[10] = "mu_S001_LCC in component LCC (J_per_mol)" legend_algebraic[141] = "v_S001_LCC in component LCC (fmol_per_sec)" legend_algebraic[11] = "mu_S011_LCC in component LCC (J_per_mol)" legend_algebraic[145] = "v_S011_LCC in component LCC (fmol_per_sec)" legend_algebraic[12] = "mu_S021_LCC in component LCC (J_per_mol)" legend_algebraic[149] = "v_S021_LCC in component LCC (fmol_per_sec)" legend_algebraic[13] = "mu_S101_LCC in component LCC (J_per_mol)" legend_algebraic[153] = "v_S101_LCC in component LCC (fmol_per_sec)" legend_algebraic[62] = "mu_S111_LCC in component LCC (J_per_mol)" legend_algebraic[166] = "v_S111_LCC in component LCC (fmol_per_sec)" legend_algebraic[64] = "mu_S121_LCC in component LCC (J_per_mol)" legend_algebraic[171] = "v_S121_LCC in component LCC (fmol_per_sec)" legend_algebraic[69] = "Af_d000 in component LCC (J_per_mol)" legend_algebraic[101] = "Ar_d000 in component LCC (J_per_mol)" legend_algebraic[102] = "v_d000 in component LCC (fmol_per_sec)" legend_algebraic[71] = "Af_d010 in component LCC (J_per_mol)" legend_algebraic[105] = "Ar_d010 in component LCC (J_per_mol)" legend_algebraic[106] = "v_d010 in component LCC (fmol_per_sec)" legend_algebraic[73] = "Af_d020 in component LCC (J_per_mol)" legend_algebraic[109] = "Ar_d020 in component LCC (J_per_mol)" legend_algebraic[110] = "v_d020 in component LCC (fmol_per_sec)" legend_algebraic[75] = "Af_f1_000 in component LCC (J_per_mol)" legend_algebraic[113] = "Ar_f1_000 in component LCC (J_per_mol)" legend_algebraic[114] = "v_f1_000 in component LCC (fmol_per_sec)" legend_algebraic[79] = "Af_f2_000 in component LCC (J_per_mol)" legend_algebraic[121] = "Ar_f2_000 in component LCC (J_per_mol)" legend_algebraic[122] = "v_f2_000 in component LCC (fmol_per_sec)" legend_algebraic[83] = "Af_f3_010 in component LCC (J_per_mol)" legend_algebraic[129] = "Ar_f3_010 in component LCC (J_per_mol)" legend_algebraic[130] = "v_f3_010 in component LCC (fmol_per_sec)" legend_algebraic[77] = "Af_f1_100 in component LCC (J_per_mol)" legend_algebraic[117] = "Ar_f1_100 in component LCC (J_per_mol)" legend_algebraic[118] = "v_f1_100 in component LCC (fmol_per_sec)" legend_algebraic[81] = "Af_f2_100 in component LCC (J_per_mol)" legend_algebraic[125] = "Ar_f2_100 in component LCC (J_per_mol)" legend_algebraic[126] = "v_f2_100 in component LCC (fmol_per_sec)" legend_algebraic[85] = "Af_f3_110 in component LCC (J_per_mol)" legend_algebraic[133] = "Ar_f3_110 in component LCC (J_per_mol)" legend_algebraic[134] = "v_f3_110 in component LCC (fmol_per_sec)" legend_algebraic[70] = "Af_d001 in component LCC (J_per_mol)" legend_algebraic[103] = "Ar_d001 in component LCC (J_per_mol)" legend_algebraic[104] = "v_d001 in component LCC (fmol_per_sec)" legend_algebraic[72] = "Af_d011 in component LCC (J_per_mol)" legend_algebraic[107] = "Ar_d011 in component LCC (J_per_mol)" legend_algebraic[108] = "v_d011 in component LCC (fmol_per_sec)" legend_algebraic[74] = "Af_d021 in component LCC (J_per_mol)" legend_algebraic[111] = "Ar_d021 in component LCC (J_per_mol)" legend_algebraic[112] = "v_d021 in component LCC (fmol_per_sec)" legend_algebraic[76] = "Af_f1_001 in component LCC (J_per_mol)" legend_algebraic[115] = "Ar_f1_001 in component LCC (J_per_mol)" legend_algebraic[116] = "v_f1_001 in component LCC (fmol_per_sec)" legend_algebraic[80] = "Af_f2_001 in component LCC (J_per_mol)" legend_algebraic[123] = "Ar_f2_001 in component LCC (J_per_mol)" legend_algebraic[124] = "v_f2_001 in component LCC (fmol_per_sec)" legend_algebraic[84] = "Af_f3_011 in component LCC (J_per_mol)" legend_algebraic[131] = "Ar_f3_011 in component LCC (J_per_mol)" legend_algebraic[132] = "v_f3_011 in component LCC (fmol_per_sec)" legend_algebraic[78] = "Af_f1_101 in component LCC (J_per_mol)" legend_algebraic[119] = "Ar_f1_101 in component LCC (J_per_mol)" legend_algebraic[120] = "v_f1_101 in component LCC (fmol_per_sec)" legend_algebraic[82] = "Af_f2_101 in component LCC (J_per_mol)" legend_algebraic[127] = "Ar_f2_101 in component LCC (J_per_mol)" legend_algebraic[128] = "v_f2_101 in component LCC (fmol_per_sec)" legend_algebraic[86] = "Af_f3_111 in component LCC (J_per_mol)" legend_algebraic[135] = "Ar_f3_111 in component LCC (J_per_mol)" legend_algebraic[136] = "v_f3_111 in component LCC (fmol_per_sec)" legend_algebraic[1] = "mu_PLB in component PLB (J_per_mol)" legend_algebraic[21] = "mu_PKACI in component PLB (J_per_mol)" legend_algebraic[25] = "mu_PLB_PKACI in component PLB (J_per_mol)" legend_algebraic[29] = "mu_PP1 in component PLB (J_per_mol)" legend_algebraic[32] = "mu_PLBp_PP1 in component PLB (J_per_mol)" legend_algebraic[35] = "mu_PLBp in component PLB (J_per_mol)" legend_algebraic[38] = "mu_Ip in component PLB (J_per_mol)" legend_algebraic[41] = "mu_Ip_PP1 in component PLB (J_per_mol)" legend_constants[151] = "nCa_1 in component RyR (dimensionless)" legend_constants[152] = "nCa_2 in component RyR (dimensionless)" legend_algebraic[165] = "mu_Ca_SR in component RyR (J_per_mol)" legend_algebraic[170] = "mu_Ca_i in component RyR (J_per_mol)" legend_algebraic[14] = "q_Ca_gate_complexes in component RyR (fmol)" legend_algebraic[173] = "mu_C_RyR in component RyR (J_per_mol)" legend_algebraic[174] = "mu_CI_RyR in component RyR (J_per_mol)" legend_algebraic[175] = "mu_I_RyR in component RyR (J_per_mol)" legend_algebraic[176] = "mu_O_RyR in component RyR (J_per_mol)" legend_algebraic[178] = "v_OC in component RyR (fmol_per_sec)" legend_algebraic[179] = "v_CCI in component RyR (fmol_per_sec)" legend_algebraic[180] = "v_CII in component RyR (fmol_per_sec)" legend_algebraic[181] = "v_IO in component RyR (fmol_per_sec)" legend_constants[153] = "n_Ca_i in component SERCA (dimensionless)" legend_constants[154] = "n_Ca_SR in component SERCA (dimensionless)" legend_constants[155] = "n_H in component SERCA (dimensionless)" legend_constants[161] = "q_SERCA_Ca_complexes in component SERCA (fmol)" legend_algebraic[15] = "c_Ca_i in component SERCA (mM)" legend_algebraic[16] = "c_Ca_SR in component SERCA (mM)" legend_algebraic[17] = "c_H in component SERCA (mM)" legend_algebraic[18] = "c_MgADP in component SERCA (mM)" legend_algebraic[19] = "c_MgATP in component SERCA (mM)" legend_algebraic[20] = "c_Pi in component SERCA (mM)" legend_constants[156] = "vol_i in component SERCA (pL)" legend_constants[162] = "vol_sr in component SERCA (pL)" legend_constants[166] = "vol_isr in component SERCA (pL)" legend_algebraic[183] = "mu_Ca_i in component SERCA (J_per_mol)" legend_algebraic[184] = "mu_Ca_SR in component SERCA (J_per_mol)" legend_algebraic[185] = "mu_H in component SERCA (J_per_mol)" legend_algebraic[186] = "mu_MgADP in component SERCA (J_per_mol)" legend_algebraic[187] = "mu_MgATP in component SERCA (J_per_mol)" legend_constants[165] = "mu_P1 in component SERCA (J_per_mol)" legend_algebraic[203] = "v_P1 in component SERCA (fmol_per_sec)" legend_algebraic[188] = "mu_Pi in component SERCA (J_per_mol)" legend_constants[168] = "mu_P2 in component SERCA (J_per_mol)" legend_algebraic[210] = "v_P2 in component SERCA (fmol_per_sec)" legend_constants[169] = "mu_P2a in component SERCA (J_per_mol)" legend_algebraic[207] = "v_P2a in component SERCA (fmol_per_sec)" legend_constants[170] = "mu_P4 in component SERCA (J_per_mol)" legend_algebraic[216] = "v_P4 in component SERCA (fmol_per_sec)" legend_constants[171] = "mu_P5 in component SERCA (J_per_mol)" legend_algebraic[217] = "v_P5 in component SERCA (fmol_per_sec)" legend_constants[173] = "mu_P6 in component SERCA (J_per_mol)" legend_algebraic[221] = "v_P6 in component SERCA (fmol_per_sec)" legend_constants[174] = "mu_P8 in component SERCA (J_per_mol)" legend_algebraic[224] = "v_P8 in component SERCA (fmol_per_sec)" legend_constants[175] = "mu_P9 in component SERCA (J_per_mol)" legend_algebraic[227] = "v_P9 in component SERCA (fmol_per_sec)" legend_constants[172] = "mu_P10 in component SERCA (J_per_mol)" legend_algebraic[228] = "v_P10 in component SERCA (fmol_per_sec)" legend_algebraic[190] = "Af_R1_2 in component SERCA (J_per_mol)" legend_constants[177] = "Ar_R1_2 in component SERCA (J_per_mol)" legend_algebraic[200] = "v_SERCA_R1_2 in component SERCA (fmol_per_sec)" legend_constants[178] = "Af_R5_6 in component SERCA (J_per_mol)" legend_algebraic[191] = "Ar_R5_6 in component SERCA (J_per_mol)" legend_algebraic[202] = "v_SERCA_R5_6 in component SERCA (fmol_per_sec)" legend_algebraic[192] = "Af_R2_2a in component SERCA (J_per_mol)" legend_constants[179] = "Ar_R2_2a in component SERCA (J_per_mol)" legend_algebraic[205] = "v_SERCA_R2_2a in component SERCA (fmol_per_sec)" legend_algebraic[193] = "Af_R2_4 in component SERCA (J_per_mol)" legend_constants[180] = "Ar_R2_4 in component SERCA (J_per_mol)" legend_algebraic[206] = "v_SERCA_R2_4 in component SERCA (fmol_per_sec)" legend_constants[181] = "Af_R4_5 in component SERCA (J_per_mol)" legend_algebraic[194] = "Ar_R4_5 in component SERCA (J_per_mol)" legend_algebraic[208] = "v_SERCA_R4_5 in component SERCA (fmol_per_sec)" legend_constants[182] = "Af_R6_8 in component SERCA (J_per_mol)" legend_algebraic[195] = "Ar_R6_8 in component SERCA (J_per_mol)" legend_algebraic[211] = "v_SERCA_R6_8 in component SERCA (fmol_per_sec)" legend_algebraic[196] = "Af_R8_9 in component SERCA (J_per_mol)" legend_constants[183] = "Ar_R8_9 in component SERCA (J_per_mol)" legend_algebraic[220] = "v_SERCA_R8_9 in component SERCA (fmol_per_sec)" legend_constants[184] = "Af_R9_10 in component SERCA (J_per_mol)" legend_algebraic[197] = "Ar_R9_10 in component SERCA (J_per_mol)" legend_algebraic[223] = "v_SERCA_R9_10 in component SERCA (fmol_per_sec)" legend_constants[176] = "Af_R10_1 in component SERCA (J_per_mol)" legend_algebraic[189] = "Ar_R10_1 in component SERCA (J_per_mol)" legend_algebraic[198] = "v_SERCA_R10_1 in component SERCA (fmol_per_sec)" legend_rates[3] = "d/dt q_Cai in component environment (fmol)" legend_rates[1] = "d/dt q_TRPN in component environment (fmol)" legend_rates[2] = "d/dt q_Ca_TRPN in component environment (fmol)" legend_rates[4] = "d/dt q_B in component environment (fmol)" legend_rates[5] = "d/dt q_U in component environment (fmol)" legend_rates[6] = "d/dt q_W in component environment (fmol)" legend_rates[7] = "d/dt q_S in component environment (fmol)" legend_rates[8] = "d/dt q_Cao in component environment (fmol)" legend_rates[9] = "d/dt q_Ki in component environment (fmol)" legend_rates[10] = "d/dt q_Ko in component environment (fmol)" legend_rates[11] = "d/dt q_PLB in component environment (fmol)" legend_rates[12] = "d/dt q_PKACI in component environment (fmol)" legend_rates[13] = "d/dt q_PLB_PKACI in component environment (fmol)" legend_rates[14] = "d/dt q_PP1 in component environment (fmol)" legend_rates[15] = "d/dt q_PLBp_PP1 in component environment (fmol)" legend_rates[16] = "d/dt q_PLBp in component environment (fmol)" legend_rates[17] = "d/dt q_Ip in component environment (fmol)" legend_rates[18] = "d/dt q_Ip_PP1 in component environment (fmol)" legend_rates[19] = "d/dt q_Ca_SR in component environment (fmol)" legend_rates[20] = "d/dt q_H in component environment (fmol)" legend_rates[22] = "d/dt q_MgADP in component environment (fmol)" legend_rates[23] = "d/dt q_MgATP in component environment (fmol)" legend_rates[21] = "d/dt q_P in component environment (fmol)" legend_rates[0] = "d/dt q_membrane in component environment (fC)" legend_rates[41] = "d/dt G_w in component crossbridge_TRPN (metre)" legend_rates[40] = "d/dt SL in component crossbridge_TRPN (metre)" legend_rates[42] = "d/dt G_s in component crossbridge_TRPN (metre)" legend_rates[43] = "d/dt Cdd in component crossbridge_TRPN (metre)" legend_rates[24] = "d/dt q_000_LCC in component environment (fmol)" legend_rates[25] = "d/dt q_010_LCC in component environment (fmol)" legend_rates[26] = "d/dt q_020_LCC in component environment (fmol)" legend_rates[27] = "d/dt q_100_LCC in component environment (fmol)" legend_rates[28] = "d/dt q_110_LCC in component environment (fmol)" legend_rates[29] = "d/dt q_120_LCC in component environment (fmol)" legend_rates[30] = "d/dt q_001_LCC in component environment (fmol)" legend_rates[31] = "d/dt q_011_LCC in component environment (fmol)" legend_rates[32] = "d/dt q_021_LCC in component environment (fmol)" legend_rates[33] = "d/dt q_101_LCC in component environment (fmol)" legend_rates[34] = "d/dt q_111_LCC in component environment (fmol)" legend_rates[35] = "d/dt q_121_LCC in component environment (fmol)" legend_rates[39] = "d/dt q_O_RyR in component environment (fmol)" legend_rates[36] = "d/dt q_C_RyR in component environment (fmol)" legend_rates[37] = "d/dt q_CI_RyR in component environment (fmol)" legend_rates[38] = "d/dt q_I_RyR in component environment (fmol)" return (legend_states, legend_algebraic, legend_voi, legend_constants) def initConsts(): constants = [0.0] * sizeConstants; states = [0.0] * sizeStates; constants[0] = 52.0453 constants[1] = 2.90875 constants[2] = 0.332501 constants[3] = 0.00782356 constants[4] = 140824 constants[5] = 0.756518 constants[6] = 0.996063 constants[7] = 0.0247377 constants[8] = 0.0325707 constants[9] = 329.349 constants[10] = 16.6321 constants[11] = 21.8985 constants[12] = 0.141736 constants[13] = 0.00715766 constants[14] = 0.00942408 constants[15] = 31.7244 constants[16] = 157.535 constants[17] = 0.0136527 constants[18] = 0.0677958 constants[19] = 2.06197 constants[20] = 10.2392 constants[21] = 0.000887375 constants[22] = 0.00440648 constants[23] = 4498.81 constants[24] = 22339.9 constants[25] = 1.93608 constants[26] = 9.61406 constants[27] = 48530.3 constants[28] = 240989 constants[29] = 2450.77 constants[30] = 12169.9 constants[31] = 3226.79 constants[32] = 16023.4 constants[33] = 45.5263 constants[34] = 6.55904 constants[35] = 0.386674 constants[36] = 1.21269 constants[37] = 431.435 constants[38] = 2.85549e+06 constants[39] = 8.83262 constants[40] = 0.12618 constants[41] = 883.262 constants[42] = 73.6052 constants[43] = 1.57289e-05 constants[44] = 175018 constants[45] = 2.44679e+06 constants[46] = 175018 constants[47] = 3487.81 constants[48] = 4.39557e+06 constants[49] = 1.01676e+07 constants[50] = 1.01676e+07 constants[51] = 0.00441447 constants[52] = 1.27424 constants[53] = 1.27424 constants[54] = 0.11171 constants[55] = 6.06164 constants[56] = 2.27312 constants[57] = 14.8627 constants[58] = 3.71567e-06 constants[59] = 0.0343245 constants[60] = 0.227859 constants[61] = 0.000825154 constants[62] = 0.00547767 constants[63] = 1.47795 constants[64] = 29.2665 constants[65] = 22.2281 constants[66] = 0.297629 constants[67] = 5.89367 constants[68] = 4.47629 constants[69] = 3434.28 constants[70] = 68005.7 constants[71] = 51650.9 constants[72] = 691.593 constants[73] = 13695 constants[74] = 10401.4 constants[75] = 0.00235741 constants[76] = 0.395191 constants[77] = 0.638527 constants[78] = 0.361989 constants[79] = 0.203757 constants[80] = 0.326014 constants[81] = 5.41093 constants[82] = 0.0673793 constants[83] = 0.980701 constants[84] = 3962.58 constants[85] = 39.6258 constants[86] = 0.06793 constants[87] = 6.793 constants[88] = 38162.5 constants[89] = 128177 constants[90] = 10585.3 constants[91] = 147985 constants[92] = 0.728251 constants[93] = 29565.2 constants[94] = 4226.28 constants[95] = 2547.31 constants[96] = 4643.82 constants[97] = 212.798 constants[98] = 1254.32 constants[99] = 1.89443e-05 constants[100] = 0.0257106 constants[101] = 2 constants[102] = 2.1404 constants[103] = -1.1495 constants[104] = 0.72162 constants[105] = 4.2933 constants[106] = -2.1404 constants[107] = 1.8993 constants[108] = -0.52288 constants[109] = 0 constants[110] = 34.4 constants[111] = 500 constants[112] = 1.381e5 constants[113] = 96485 states[0] = -13039 states[1] = 2.57 states[2] = 1e-18 states[3] = 6.82e-3 states[4] = 1 states[5] = 0 states[6] = 0 states[7] = 0 states[8] = 6.84 states[9] = 5.51E+03 states[10] = 2.05E+02 states[11] = 4.028E+00 states[12] = 2.234E-03 states[13] = 1e-18 states[14] = 3.382E-02 states[15] = 1e-18 states[16] = 1e-18 states[17] = 1.999E-03 states[18] = 1e-18 states[19] = 0.641 states[20] = 0.004028 states[21] = 570 states[22] = 1.3794 states[23] = 3.8 states[24] = 1.3798e-05 states[25] = 1.3798e-05 states[26] = 1.3798e-05 states[27] = 1.3798e-05 states[28] = 1.3798e-05 states[29] = 1.3798e-05 states[30] = 1.3798e-05 states[31] = 1.3798e-05 states[32] = 1.3798e-05 states[33] = 1.3798e-05 states[34] = 1.3798e-05 states[35] = 1.3798e-05 states[36] = 4.13941e-05 states[37] = 4.13941e-05 states[38] = 4.13941e-05 states[39] = 4.13941e-05 constants[114] = 2.83036e-14 constants[115] = 2.83036e-14 constants[116] = 2.83036e-14 constants[117] = 2.83036e-14 constants[118] = 2.83036e-14 constants[119] = 2.83036e-14 constants[120] = 2.83036e-14 constants[121] = 2.83036e-14 constants[122] = 2.83036e-14 states[40] = 1e-6 constants[123] = 4e-2 constants[124] = 4.1e-2 constants[125] = 1e8 constants[126] = 0 constants[127] = 2 constants[128] = 1 constants[129] = 8.31 constants[130] = 310 constants[131] = 1 constants[132] = -1 constants[133] = 1.1 constants[134] = -0.0118 constants[135] = 1 constants[136] = 2e-6 constants[137] = 1e-6 constants[138] = 0.25 constants[139] = 0.5 constants[140] = 25 constants[141] = 2.23 constants[142] = 26 constants[143] = 4 states[41] = 1e-6 states[42] = 1e-6 constants[144] = 0 constants[145] = 1 constants[146] = 40.5 states[43] = 0 constants[147] = 200e3 constants[148] = 200e3 constants[149] = 7 constants[150] = 2.1 constants[151] = 1 constants[152] = 2 constants[153] = 2 constants[154] = 2 constants[155] = 2 constants[156] = 34.0 constants[157] = (constants[141]*constants[142]*(1.00000-constants[139]))/constants[139] constants[158] = (constants[141]*constants[143]*(1.00000-constants[138])*constants[139])/constants[138] constants[159] = (constants[140]*constants[138])/((1.00000-constants[138])*constants[139]+constants[138]) constants[160] = constants[134]*constants[129]*constants[130] constants[161] = constants[153]*constants[117]+constants[153]*constants[118]+constants[154]*constants[119] constants[162] = constants[156]*0.0350000 constants[185] = constants[144] constants[163] = constants[159] constants[164] = -constants[159]*constants[144]*constants[145] constants[165] = constants[129]*constants[130]*log(constants[88]*constants[114]) constants[166] = constants[156]+constants[162] constants[167] = -constants[163]*constants[144]*constants[145] constants[168] = constants[129]*constants[130]*log(constants[89]*constants[115]) constants[169] = constants[129]*constants[130]*log(constants[90]*constants[116]) constants[170] = constants[129]*constants[130]*log(constants[91]*constants[117]) constants[171] = constants[129]*constants[130]*log(constants[92]*constants[118]) constants[172] = constants[129]*constants[130]*log(constants[96]*constants[122]) constants[173] = constants[129]*constants[130]*log(constants[93]*constants[119]) constants[174] = constants[129]*constants[130]*log(constants[94]*constants[120]) constants[175] = constants[129]*constants[130]*log(constants[95]*constants[121]) constants[176] = constants[172] constants[177] = constants[168] constants[178] = constants[171] constants[179] = constants[169] constants[180] = constants[170] constants[181] = constants[170] constants[182] = constants[173] constants[183] = constants[175] constants[184] = constants[175] return (states, constants) def computeRates(voi, states, constants): rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic rates[40] = constants[185] algebraic[7] = constants[157]*states[41]*constants[145] algebraic[22] = -constants[164]-algebraic[7] algebraic[26] = algebraic[22]/constants[145] rates[41] = algebraic[26] algebraic[8] = constants[158]*states[42]*constants[145] algebraic[23] = -constants[167]-algebraic[8] algebraic[27] = algebraic[23]/constants[145] rates[42] = algebraic[27] algebraic[30] = constants[129]*constants[130]*log(constants[54]*states[2]) algebraic[31] = constants[129]*constants[130]*log(constants[55]*states[4]) algebraic[34] = constants[129]*constants[130]*log(constants[56]*states[5]) algebraic[43] = constants[1]*(exp((algebraic[31]+constants[133]*algebraic[30])/(constants[129]*constants[130]))-exp((algebraic[34]+constants[133]*algebraic[30])/(constants[129]*constants[130]))) rates[4] = -algebraic[43] algebraic[1] = constants[129]*constants[130]*log(constants[75]*states[11]) algebraic[21] = constants[129]*constants[130]*log(constants[76]*states[12]) algebraic[25] = constants[129]*constants[130]*log(constants[77]*states[13]) algebraic[44] = constants[33]*(exp((algebraic[1]+algebraic[21])/(constants[129]*constants[130]))-exp(algebraic[25]/(constants[129]*constants[130]))) algebraic[35] = constants[129]*constants[130]*log(constants[80]*states[16]) algebraic[47] = constants[34]*(exp(algebraic[25]/(constants[129]*constants[130]))-exp((algebraic[35]+algebraic[21])/(constants[129]*constants[130]))) rates[12] = algebraic[47]-algebraic[44] rates[13] = algebraic[44]-algebraic[47] algebraic[37] = constants[129]*constants[130]*log(constants[57]*states[6]) algebraic[46] = constants[2]*(exp(algebraic[34]/(constants[129]*constants[130]))-exp(algebraic[37]/(constants[129]*constants[130]))) algebraic[40] = constants[129]*constants[130]*log(constants[58]*states[7]) algebraic[49] = constants[3]*(exp(algebraic[37]/(constants[129]*constants[130]))-exp(algebraic[40]/(constants[129]*constants[130]))) rates[6] = algebraic[46]-algebraic[49] algebraic[29] = constants[129]*constants[130]*log(constants[78]*states[14]) algebraic[32] = constants[129]*constants[130]*log(constants[79]*states[15]) algebraic[50] = constants[35]*(exp((algebraic[35]+algebraic[29])/(constants[129]*constants[130]))-exp(algebraic[32]/(constants[129]*constants[130]))) rates[16] = algebraic[47]-algebraic[50] algebraic[52] = constants[4]*(exp(algebraic[40]/(constants[129]*constants[130]))-exp(algebraic[34]/(constants[129]*constants[130]))) rates[5] = (algebraic[43]-algebraic[46])+algebraic[52] rates[7] = algebraic[49]-algebraic[52] algebraic[53] = constants[36]*(exp(algebraic[32]/(constants[129]*constants[130]))-exp((algebraic[1]+algebraic[29])/(constants[129]*constants[130]))) rates[11] = algebraic[53]-algebraic[44] rates[15] = algebraic[50]-algebraic[53] algebraic[38] = constants[129]*constants[130]*log(constants[81]*states[17]) algebraic[41] = constants[129]*constants[130]*log(constants[82]*states[18]) algebraic[55] = constants[37]*(exp((algebraic[29]+algebraic[38])/(constants[129]*constants[130]))-exp(algebraic[41]/(constants[129]*constants[130]))) rates[14] = (algebraic[53]-algebraic[50])-algebraic[55] rates[17] = -algebraic[55] rates[18] = algebraic[55] algebraic[57] = constants[129]*constants[130]*log(constants[63]*states[24]) algebraic[87] = algebraic[57] algebraic[51] = constants[129]*constants[130]*log(constants[59]*states[3]) algebraic[137] = constants[129]*constants[130]*log(constants[69]*states[30])+constants[101]*algebraic[51] algebraic[138] = constants[27]*(exp(algebraic[87]/(constants[129]*constants[130]))-exp(algebraic[137]/(constants[129]*constants[130]))) algebraic[45] = states[0]/constants[112] algebraic[69] = constants[129]*constants[130]*log(constants[63]*states[24])+constants[102]*constants[113]*algebraic[45] algebraic[101] = constants[129]*constants[130]*log(constants[66]*states[27])+constants[106]*constants[113]*algebraic[45] algebraic[102] = constants[9]*(exp(algebraic[69]/(constants[129]*constants[130]))-exp(algebraic[101]/(constants[129]*constants[130]))) algebraic[75] = constants[129]*constants[130]*log(constants[63]*states[24])+constants[103]*constants[113]*algebraic[45] algebraic[113] = constants[129]*constants[130]*log(constants[64]*states[25])+constants[107]*constants[113]*algebraic[45] algebraic[114] = constants[15]*(exp(algebraic[75]/(constants[129]*constants[130]))-exp(algebraic[113]/(constants[129]*constants[130]))) algebraic[79] = constants[129]*constants[130]*log(constants[63]*states[24])+constants[104]*constants[113]*algebraic[45] algebraic[121] = constants[129]*constants[130]*log(constants[65]*states[26])+constants[108]*constants[113]*algebraic[45] algebraic[122] = constants[19]*(exp(algebraic[79]/(constants[129]*constants[130]))-exp(algebraic[121]/(constants[129]*constants[130]))) algebraic[140] = ((-algebraic[102]-algebraic[114])-algebraic[122])-algebraic[138] rates[24] = algebraic[140] algebraic[70] = constants[129]*constants[130]*log(constants[69]*states[30])+constants[102]*constants[113]*algebraic[45] algebraic[103] = constants[129]*constants[130]*log(constants[72]*states[33])+constants[106]*constants[113]*algebraic[45] algebraic[104] = constants[12]*(exp(algebraic[70]/(constants[129]*constants[130]))-exp(algebraic[103]/(constants[129]*constants[130]))) algebraic[76] = constants[129]*constants[130]*log(constants[69]*states[30])+constants[103]*constants[113]*algebraic[45] algebraic[115] = constants[129]*constants[130]*log(constants[70]*states[31])+constants[107]*constants[113]*algebraic[45] algebraic[116] = constants[17]*(exp(algebraic[76]/(constants[129]*constants[130]))-exp(algebraic[115]/(constants[129]*constants[130]))) algebraic[80] = constants[129]*constants[130]*log(constants[69]*states[30])+constants[104]*constants[113]*algebraic[45] algebraic[123] = constants[129]*constants[130]*log(constants[71]*states[32])+constants[108]*constants[113]*algebraic[45] algebraic[124] = constants[21]*(exp(algebraic[80]/(constants[129]*constants[130]))-exp(algebraic[123]/(constants[129]*constants[130]))) algebraic[141] = ((-algebraic[104]-algebraic[116])-algebraic[124])--algebraic[138] rates[30] = algebraic[141] algebraic[58] = constants[129]*constants[130]*log(constants[64]*states[25]) algebraic[88] = algebraic[58] algebraic[139] = constants[129]*constants[130]*log(constants[70]*states[31])+constants[101]*algebraic[51] algebraic[142] = constants[29]*(exp(algebraic[88]/(constants[129]*constants[130]))-exp(algebraic[139]/(constants[129]*constants[130]))) algebraic[71] = constants[129]*constants[130]*log(constants[64]*states[25])+constants[102]*constants[113]*algebraic[45] algebraic[105] = constants[129]*constants[130]*log(constants[67]*states[28])+constants[106]*constants[113]*algebraic[45] algebraic[106] = constants[10]*(exp(algebraic[71]/(constants[129]*constants[130]))-exp(algebraic[105]/(constants[129]*constants[130]))) algebraic[83] = constants[129]*constants[130]*log(constants[64]*states[25])+constants[105]*constants[113]*algebraic[45] algebraic[129] = constants[129]*constants[130]*log(constants[65]*states[26])+constants[109]*constants[113]*algebraic[45] algebraic[130] = constants[23]*(exp(algebraic[83]/(constants[129]*constants[130]))-exp(algebraic[129]/(constants[129]*constants[130]))) algebraic[144] = ((-algebraic[106]+algebraic[114])-algebraic[142])-algebraic[130] rates[25] = algebraic[144] algebraic[72] = constants[129]*constants[130]*log(constants[70]*states[31])+constants[102]*constants[113]*algebraic[45] algebraic[107] = constants[129]*constants[130]*log(constants[73]*states[34])+constants[106]*constants[113]*algebraic[45] algebraic[108] = constants[13]*(exp(algebraic[72]/(constants[129]*constants[130]))-exp(algebraic[107]/(constants[129]*constants[130]))) algebraic[84] = constants[129]*constants[130]*log(constants[70]*states[31])+constants[105]*constants[113]*algebraic[45] algebraic[131] = constants[129]*constants[130]*log(constants[71]*states[32])+constants[109]*constants[113]*algebraic[45] algebraic[132] = constants[25]*(exp(algebraic[84]/(constants[129]*constants[130]))-exp(algebraic[131]/(constants[129]*constants[130]))) algebraic[145] = ((-algebraic[108]+algebraic[116])--algebraic[142])-algebraic[132] rates[31] = algebraic[145] algebraic[59] = constants[129]*constants[130]*log(constants[65]*states[26]) algebraic[89] = algebraic[59] algebraic[143] = constants[129]*constants[130]*log(constants[71]*states[32])+constants[101]*algebraic[51] algebraic[146] = constants[31]*(exp(algebraic[89]/(constants[129]*constants[130]))-exp(algebraic[143]/(constants[129]*constants[130]))) algebraic[73] = constants[129]*constants[130]*log(constants[65]*states[26])+constants[102]*constants[113]*algebraic[45] algebraic[109] = constants[129]*constants[130]*log(constants[68]*states[29])+constants[106]*constants[113]*algebraic[45] algebraic[110] = constants[11]*(exp(algebraic[73]/(constants[129]*constants[130]))-exp(algebraic[109]/(constants[129]*constants[130]))) algebraic[148] = ((-algebraic[110]+algebraic[122])-algebraic[146])+algebraic[130] rates[26] = algebraic[148] algebraic[74] = constants[129]*constants[130]*log(constants[71]*states[32])+constants[102]*constants[113]*algebraic[45] algebraic[111] = constants[129]*constants[130]*log(constants[74]*states[35])+constants[106]*constants[113]*algebraic[45] algebraic[112] = constants[14]*(exp(algebraic[74]/(constants[129]*constants[130]))-exp(algebraic[111]/(constants[129]*constants[130]))) algebraic[149] = ((-algebraic[112]+algebraic[124])--algebraic[146])+algebraic[132] rates[32] = algebraic[149] algebraic[60] = constants[129]*constants[130]*log(constants[66]*states[27]) algebraic[90] = algebraic[60] algebraic[147] = constants[129]*constants[130]*log(constants[72]*states[33])+constants[101]*algebraic[51] algebraic[150] = constants[28]*(exp(algebraic[90]/(constants[129]*constants[130]))-exp(algebraic[147]/(constants[129]*constants[130]))) algebraic[77] = constants[129]*constants[130]*log(constants[66]*states[27])+constants[103]*constants[113]*algebraic[45] algebraic[117] = constants[129]*constants[130]*log(constants[67]*states[28])+constants[107]*constants[113]*algebraic[45] algebraic[118] = constants[16]*(exp(algebraic[77]/(constants[129]*constants[130]))-exp(algebraic[117]/(constants[129]*constants[130]))) algebraic[81] = constants[129]*constants[130]*log(constants[66]*states[27])+constants[104]*constants[113]*algebraic[45] algebraic[125] = constants[129]*constants[130]*log(constants[68]*states[29])+constants[108]*constants[113]*algebraic[45] algebraic[126] = constants[20]*(exp(algebraic[81]/(constants[129]*constants[130]))-exp(algebraic[125]/(constants[129]*constants[130]))) algebraic[152] = ((-algebraic[126]+algebraic[102])-algebraic[118])-algebraic[150] rates[27] = algebraic[152] algebraic[78] = constants[129]*constants[130]*log(constants[72]*states[33])+constants[103]*constants[113]*algebraic[45] algebraic[119] = constants[129]*constants[130]*log(constants[73]*states[34])+constants[107]*constants[113]*algebraic[45] algebraic[120] = constants[18]*(exp(algebraic[78]/(constants[129]*constants[130]))-exp(algebraic[119]/(constants[129]*constants[130]))) algebraic[82] = constants[129]*constants[130]*log(constants[72]*states[33])+constants[104]*constants[113]*algebraic[45] algebraic[127] = constants[129]*constants[130]*log(constants[74]*states[35])+constants[108]*constants[113]*algebraic[45] algebraic[128] = constants[22]*(exp(algebraic[82]/(constants[129]*constants[130]))-exp(algebraic[127]/(constants[129]*constants[130]))) algebraic[153] = ((-algebraic[128]+algebraic[104])-algebraic[120])--algebraic[150] rates[33] = algebraic[153] algebraic[61] = constants[129]*constants[130]*log(constants[67]*states[28]) algebraic[91] = algebraic[61] algebraic[151] = constants[129]*constants[130]*log(constants[73]*states[34])+constants[101]*algebraic[51] algebraic[154] = constants[30]*(exp(algebraic[91]/(constants[129]*constants[130]))-exp(algebraic[151]/(constants[129]*constants[130]))) algebraic[85] = constants[129]*constants[130]*log(constants[67]*states[28])+constants[105]*constants[113]*algebraic[45] algebraic[133] = constants[129]*constants[130]*log(constants[68]*states[29])+constants[109]*constants[113]*algebraic[45] algebraic[134] = constants[24]*(exp(algebraic[85]/(constants[129]*constants[130]))-exp(algebraic[133]/(constants[129]*constants[130]))) algebraic[156] = ((algebraic[118]+algebraic[106])-algebraic[154])-algebraic[134] rates[28] = algebraic[156] algebraic[63] = constants[129]*constants[130]*log(constants[68]*states[29]) algebraic[92] = algebraic[63] algebraic[155] = constants[129]*constants[130]*log(constants[74]*states[35])+constants[101]*algebraic[51] algebraic[157] = constants[32]*(exp(algebraic[92]/(constants[129]*constants[130]))-exp(algebraic[155]/(constants[129]*constants[130]))) algebraic[159] = ((algebraic[126]+algebraic[110])-algebraic[157])+algebraic[134] rates[29] = algebraic[159] algebraic[62] = constants[129]*constants[130]*log(constants[73]*states[34]) algebraic[65] = algebraic[51]+constants[127]*constants[113]*algebraic[45]+algebraic[62] algebraic[48] = constants[129]*constants[130]*log(constants[60]*states[8]) algebraic[97] = algebraic[48]+algebraic[62] algebraic[93] = constants[127]*constants[113]*algebraic[45] algebraic[158] = custom_piecewise([equal(algebraic[93] , 0.00000), constants[5]*(exp(algebraic[65]/(constants[129]*constants[130]))-exp(algebraic[97]/(constants[129]*constants[130]))) , True, (((constants[5]*algebraic[93])/(constants[129]*constants[130]))/(exp(algebraic[93]/(constants[129]*constants[130]))-1.00000))*(exp(algebraic[65]/(constants[129]*constants[130]))-exp(algebraic[97]/(constants[129]*constants[130])))]) algebraic[64] = constants[129]*constants[130]*log(constants[74]*states[35]) algebraic[66] = algebraic[51]+constants[127]*constants[113]*algebraic[45]+algebraic[64] algebraic[98] = algebraic[48]+algebraic[64] algebraic[94] = constants[127]*constants[113]*algebraic[45] algebraic[160] = custom_piecewise([equal(algebraic[94] , 0.00000), constants[6]*(exp(algebraic[66]/(constants[129]*constants[130]))-exp(algebraic[98]/(constants[129]*constants[130]))) , True, (((constants[6]*algebraic[94])/(constants[129]*constants[130]))/(exp(algebraic[94]/(constants[129]*constants[130]))-1.00000))*(exp(algebraic[66]/(constants[129]*constants[130]))-exp(algebraic[98]/(constants[129]*constants[130])))]) algebraic[161] = algebraic[160]+algebraic[158] rates[8] = algebraic[161] algebraic[56] = constants[129]*constants[130]*log(constants[61]*states[9]) algebraic[67] = algebraic[56]+constants[128]*constants[113]*algebraic[45]+algebraic[62] algebraic[54] = constants[129]*constants[130]*log(constants[62]*states[10]) algebraic[99] = algebraic[54]+algebraic[62] algebraic[95] = constants[128]*constants[113]*algebraic[45] algebraic[162] = custom_piecewise([equal(algebraic[95] , 0.00000), constants[7]*(exp(algebraic[67]/(constants[129]*constants[130]))-exp(algebraic[99]/(constants[129]*constants[130]))) , True, (((constants[7]*algebraic[95])/(constants[129]*constants[130]))/(exp(algebraic[95]/(constants[129]*constants[130]))-1.00000))*(exp(algebraic[67]/(constants[129]*constants[130]))-exp(algebraic[99]/(constants[129]*constants[130])))]) algebraic[86] = constants[129]*constants[130]*log(constants[73]*states[34])+constants[105]*constants[113]*algebraic[45] algebraic[135] = constants[129]*constants[130]*log(constants[74]*states[35])+constants[109]*constants[113]*algebraic[45] algebraic[136] = constants[26]*(exp(algebraic[86]/(constants[129]*constants[130]))-exp(algebraic[135]/(constants[129]*constants[130]))) algebraic[166] = ((algebraic[120]+algebraic[108])-((((-algebraic[154]+algebraic[158])-algebraic[158])+algebraic[162])-algebraic[162]))-algebraic[136] rates[34] = algebraic[166] algebraic[68] = algebraic[56]+constants[128]*constants[113]*algebraic[45]+algebraic[64] algebraic[100] = algebraic[54]+algebraic[64] algebraic[96] = constants[128]*constants[113]*algebraic[45] algebraic[164] = custom_piecewise([equal(algebraic[96] , 0.00000), constants[8]*(exp(algebraic[68]/(constants[129]*constants[130]))-exp(algebraic[100]/(constants[129]*constants[130]))) , True, (((constants[8]*algebraic[96])/(constants[129]*constants[130]))/(exp(algebraic[96]/(constants[129]*constants[130]))-1.00000))*(exp(algebraic[68]/(constants[129]*constants[130]))-exp(algebraic[100]/(constants[129]*constants[130])))]) algebraic[167] = -algebraic[162]-algebraic[164] rates[9] = algebraic[167] algebraic[168] = algebraic[164]+algebraic[162] rates[10] = algebraic[168] algebraic[171] = ((algebraic[128]+algebraic[112])-((((-algebraic[157]+algebraic[160])-algebraic[160])+algebraic[164])-algebraic[164]))+algebraic[136] rates[35] = algebraic[171] algebraic[169] = constants[113]*(((((((((((((((((((((((((((((((((((((constants[108]*algebraic[124]-constants[104]*algebraic[124])+constants[109]*algebraic[132])-constants[105]*algebraic[132])+constants[107]*algebraic[120])-constants[103]*algebraic[120])+constants[108]*algebraic[128])-constants[104]*algebraic[128])+constants[109]*algebraic[136])-constants[105]*algebraic[136])+constants[107]*algebraic[116])-constants[103]*algebraic[116])+constants[106]*algebraic[112])-constants[102]*algebraic[112])+constants[106]*algebraic[108])-constants[102]*algebraic[108])+constants[106]*algebraic[104])-constants[102]*algebraic[104])+constants[109]*algebraic[134])-constants[105]*algebraic[134])+constants[108]*algebraic[126])-constants[104]*algebraic[126])+constants[107]*algebraic[118])-constants[103]*algebraic[118])+constants[109]*algebraic[130])-constants[105]*algebraic[130])+constants[108]*algebraic[122])-constants[104]*algebraic[122])+constants[107]*algebraic[114])-constants[103]*algebraic[114])+constants[106]*algebraic[110])-constants[102]*algebraic[110])+constants[106]*algebraic[106])-constants[102]*algebraic[106])+constants[106]*algebraic[102])-constants[102]*algebraic[102])-(constants[127]*algebraic[158]+constants[127]*algebraic[160]))-(constants[128]*algebraic[162]+constants[128]*algebraic[164])) algebraic[9] = custom_piecewise([greater(voi , constants[123]) & less(voi , constants[124]), constants[125] , True, constants[126]]) algebraic[172] = -algebraic[169]+algebraic[9] rates[0] = algebraic[172] algebraic[170] = constants[129]*constants[130]*log(constants[59]*states[3]) algebraic[173] = constants[129]*constants[130]*log(constants[84]*states[36]) algebraic[176] = constants[129]*constants[130]*log(constants[87]*states[39]) algebraic[178] = constants[39]*(exp(algebraic[176]/(constants[129]*constants[130]))-exp((algebraic[173]+constants[152]*algebraic[170])/(constants[129]*constants[130]))) algebraic[174] = constants[129]*constants[130]*log(constants[85]*states[37]) algebraic[179] = constants[40]*(exp((algebraic[173]+constants[151]*algebraic[170])/(constants[129]*constants[130]))-exp(algebraic[174]/(constants[129]*constants[130]))) rates[36] = algebraic[178]-algebraic[179] algebraic[175] = constants[129]*constants[130]*log(constants[86]*states[38]) algebraic[180] = constants[41]*(exp((algebraic[174]+constants[152]*algebraic[170])/(constants[129]*constants[130]))-exp(algebraic[175]/(constants[129]*constants[130]))) rates[37] = algebraic[179]-algebraic[180] algebraic[181] = constants[42]*(exp(algebraic[175]/(constants[129]*constants[130]))-exp((algebraic[176]+constants[151]*algebraic[170])/(constants[129]*constants[130]))) rates[39] = algebraic[181]-algebraic[178] rates[38] = algebraic[180]-algebraic[181] algebraic[188] = constants[129]*constants[130]*log(constants[100]*states[21]) algebraic[189] = constants[165]+algebraic[188] algebraic[198] = constants[51]*(exp(constants[176]/(constants[129]*constants[130]))-exp(algebraic[189]/(constants[129]*constants[130]))) algebraic[199] = algebraic[198] rates[21] = algebraic[199] algebraic[187] = constants[129]*constants[130]*log(constants[98]*states[23]) algebraic[190] = constants[165]+algebraic[187] algebraic[200] = constants[43]*(exp(algebraic[190]/(constants[129]*constants[130]))-exp(constants[177]/(constants[129]*constants[130]))) algebraic[201] = -algebraic[200] rates[23] = algebraic[201] algebraic[186] = constants[129]*constants[130]*log(constants[99]*states[22]) algebraic[191] = algebraic[186]+constants[173] algebraic[202] = constants[47]*(exp(constants[178]/(constants[129]*constants[130]))-exp(algebraic[191]/(constants[129]*constants[130]))) algebraic[204] = algebraic[202] rates[22] = algebraic[204] algebraic[165] = constants[129]*constants[130]*log(constants[83]*states[19]) algebraic[177] = constants[38]*exp(algebraic[176]/(constants[129]*constants[130]))*(exp(algebraic[165]/(constants[129]*constants[130]))-exp(algebraic[170]/(constants[129]*constants[130]))) algebraic[184] = constants[129]*constants[130]*log(constants[83]*states[19]) algebraic[195] = constants[174]+constants[154]*algebraic[184] algebraic[211] = constants[48]*(exp(constants[182]/(constants[129]*constants[130]))-exp(algebraic[195]/(constants[129]*constants[130]))) algebraic[219] = constants[154]*algebraic[211] rates[19] = -algebraic[177]+algebraic[219] rootfind_0(voi, constants, rates, states, algebraic) algebraic[218] = algebraic[213]/constants[145] rates[43] = algebraic[218] algebraic[185] = constants[129]*constants[130]*log(constants[97]*states[20]) algebraic[192] = constants[168]+algebraic[185] algebraic[205] = constants[45]*(exp(algebraic[192]/(constants[129]*constants[130]))-exp(constants[179]/(constants[129]*constants[130]))) algebraic[194] = constants[171]+constants[155]*algebraic[185] algebraic[208] = constants[46]*(exp(constants[181]/(constants[129]*constants[130]))-exp(algebraic[194]/(constants[129]*constants[130]))) algebraic[196] = constants[174]+constants[155]*algebraic[185] algebraic[220] = constants[49]*(exp(algebraic[196]/(constants[129]*constants[130]))-exp(constants[183]/(constants[129]*constants[130]))) algebraic[197] = algebraic[185]+constants[172] algebraic[223] = constants[50]*(exp(constants[184]/(constants[129]*constants[130]))-exp(algebraic[197]/(constants[129]*constants[130]))) algebraic[226] = ((constants[155]*algebraic[208]-algebraic[205])-constants[155]*algebraic[220])+algebraic[223] rates[20] = algebraic[226] algebraic[24] = constants[129]*constants[130]*log(constants[52]*states[1]) algebraic[28] = constants[129]*constants[130]*log(constants[59]*states[3]) algebraic[33] = (constants[146]/(constants[136]*constants[137]*constants[138]))*states[7]*(states[42]+constants[136]) algebraic[36] = (constants[146]/(constants[136]*constants[137]*constants[138]))*states[6]*states[41] algebraic[39] = algebraic[33]+algebraic[36] algebraic[42] = algebraic[39] algebraic[222] = ((constants[150]*algebraic[212])/constants[136])*algebraic[218] algebraic[225] = algebraic[222] algebraic[229] = algebraic[42]+algebraic[225] algebraic[230] = algebraic[229]*1000.00 algebraic[231] = constants[135]*constants[160]*algebraic[230] algebraic[232] = constants[0]*(exp((algebraic[28]+algebraic[24])/(constants[129]*constants[130]))-exp((algebraic[30]+algebraic[231])/(constants[129]*constants[130]))) algebraic[163] = (((constants[101])*algebraic[150]+constants[101]*algebraic[154]+constants[101]*algebraic[146]+constants[101]*algebraic[142]+constants[101]*algebraic[138]+constants[101]*algebraic[157])-algebraic[158])-algebraic[160] algebraic[182] = ((constants[152]*algebraic[178]-constants[151]*algebraic[179])-constants[152]*algebraic[180])+constants[151]*algebraic[181] algebraic[183] = constants[129]*constants[130]*log(constants[59]*states[3]) algebraic[193] = constants[168]+constants[153]*algebraic[183] algebraic[206] = constants[44]*(exp(algebraic[193]/(constants[129]*constants[130]))-exp(constants[180]/(constants[129]*constants[130]))) algebraic[209] = -constants[153]*algebraic[206] rates[3] = -algebraic[232]+algebraic[163]+algebraic[177]+algebraic[182]+algebraic[209] rates[1] = -algebraic[232] rates[2] = algebraic[232] return(rates) def computeAlgebraic(constants, states, voi): algebraic = array([[0.0] * len(voi)] * sizeAlgebraic) states = array(states) voi = array(voi) algebraic[7] = constants[157]*states[41]*constants[145] algebraic[22] = -constants[164]-algebraic[7] algebraic[26] = algebraic[22]/constants[145] algebraic[8] = constants[158]*states[42]*constants[145] algebraic[23] = -constants[167]-algebraic[8] algebraic[27] = algebraic[23]/constants[145] algebraic[30] = constants[129]*constants[130]*log(constants[54]*states[2]) algebraic[31] = constants[129]*constants[130]*log(constants[55]*states[4]) algebraic[34] = constants[129]*constants[130]*log(constants[56]*states[5]) algebraic[43] = constants[1]*(exp((algebraic[31]+constants[133]*algebraic[30])/(constants[129]*constants[130]))-exp((algebraic[34]+constants[133]*algebraic[30])/(constants[129]*constants[130]))) algebraic[1] = constants[129]*constants[130]*log(constants[75]*states[11]) algebraic[21] = constants[129]*constants[130]*log(constants[76]*states[12]) algebraic[25] = constants[129]*constants[130]*log(constants[77]*states[13]) algebraic[44] = constants[33]*(exp((algebraic[1]+algebraic[21])/(constants[129]*constants[130]))-exp(algebraic[25]/(constants[129]*constants[130]))) algebraic[35] = constants[129]*constants[130]*log(constants[80]*states[16]) algebraic[47] = constants[34]*(exp(algebraic[25]/(constants[129]*constants[130]))-exp((algebraic[35]+algebraic[21])/(constants[129]*constants[130]))) algebraic[37] = constants[129]*constants[130]*log(constants[57]*states[6]) algebraic[46] = constants[2]*(exp(algebraic[34]/(constants[129]*constants[130]))-exp(algebraic[37]/(constants[129]*constants[130]))) algebraic[40] = constants[129]*constants[130]*log(constants[58]*states[7]) algebraic[49] = constants[3]*(exp(algebraic[37]/(constants[129]*constants[130]))-exp(algebraic[40]/(constants[129]*constants[130]))) algebraic[29] = constants[129]*constants[130]*log(constants[78]*states[14]) algebraic[32] = constants[129]*constants[130]*log(constants[79]*states[15]) algebraic[50] = constants[35]*(exp((algebraic[35]+algebraic[29])/(constants[129]*constants[130]))-exp(algebraic[32]/(constants[129]*constants[130]))) algebraic[52] = constants[4]*(exp(algebraic[40]/(constants[129]*constants[130]))-exp(algebraic[34]/(constants[129]*constants[130]))) algebraic[53] = constants[36]*(exp(algebraic[32]/(constants[129]*constants[130]))-exp((algebraic[1]+algebraic[29])/(constants[129]*constants[130]))) algebraic[38] = constants[129]*constants[130]*log(constants[81]*states[17]) algebraic[41] = constants[129]*constants[130]*log(constants[82]*states[18]) algebraic[55] = constants[37]*(exp((algebraic[29]+algebraic[38])/(constants[129]*constants[130]))-exp(algebraic[41]/(constants[129]*constants[130]))) algebraic[57] = constants[129]*constants[130]*log(constants[63]*states[24]) algebraic[87] = algebraic[57] algebraic[51] = constants[129]*constants[130]*log(constants[59]*states[3]) algebraic[137] = constants[129]*constants[130]*log(constants[69]*states[30])+constants[101]*algebraic[51] algebraic[138] = constants[27]*(exp(algebraic[87]/(constants[129]*constants[130]))-exp(algebraic[137]/(constants[129]*constants[130]))) algebraic[45] = states[0]/constants[112] algebraic[69] = constants[129]*constants[130]*log(constants[63]*states[24])+constants[102]*constants[113]*algebraic[45] algebraic[101] = constants[129]*constants[130]*log(constants[66]*states[27])+constants[106]*constants[113]*algebraic[45] algebraic[102] = constants[9]*(exp(algebraic[69]/(constants[129]*constants[130]))-exp(algebraic[101]/(constants[129]*constants[130]))) algebraic[75] = constants[129]*constants[130]*log(constants[63]*states[24])+constants[103]*constants[113]*algebraic[45] algebraic[113] = constants[129]*constants[130]*log(constants[64]*states[25])+constants[107]*constants[113]*algebraic[45] algebraic[114] = constants[15]*(exp(algebraic[75]/(constants[129]*constants[130]))-exp(algebraic[113]/(constants[129]*constants[130]))) algebraic[79] = constants[129]*constants[130]*log(constants[63]*states[24])+constants[104]*constants[113]*algebraic[45] algebraic[121] = constants[129]*constants[130]*log(constants[65]*states[26])+constants[108]*constants[113]*algebraic[45] algebraic[122] = constants[19]*(exp(algebraic[79]/(constants[129]*constants[130]))-exp(algebraic[121]/(constants[129]*constants[130]))) algebraic[140] = ((-algebraic[102]-algebraic[114])-algebraic[122])-algebraic[138] algebraic[70] = constants[129]*constants[130]*log(constants[69]*states[30])+constants[102]*constants[113]*algebraic[45] algebraic[103] = constants[129]*constants[130]*log(constants[72]*states[33])+constants[106]*constants[113]*algebraic[45] algebraic[104] = constants[12]*(exp(algebraic[70]/(constants[129]*constants[130]))-exp(algebraic[103]/(constants[129]*constants[130]))) algebraic[76] = constants[129]*constants[130]*log(constants[69]*states[30])+constants[103]*constants[113]*algebraic[45] algebraic[115] = constants[129]*constants[130]*log(constants[70]*states[31])+constants[107]*constants[113]*algebraic[45] algebraic[116] = constants[17]*(exp(algebraic[76]/(constants[129]*constants[130]))-exp(algebraic[115]/(constants[129]*constants[130]))) algebraic[80] = constants[129]*constants[130]*log(constants[69]*states[30])+constants[104]*constants[113]*algebraic[45] algebraic[123] = constants[129]*constants[130]*log(constants[71]*states[32])+constants[108]*constants[113]*algebraic[45] algebraic[124] = constants[21]*(exp(algebraic[80]/(constants[129]*constants[130]))-exp(algebraic[123]/(constants[129]*constants[130]))) algebraic[141] = ((-algebraic[104]-algebraic[116])-algebraic[124])--algebraic[138] algebraic[58] = constants[129]*constants[130]*log(constants[64]*states[25]) algebraic[88] = algebraic[58] algebraic[139] = constants[129]*constants[130]*log(constants[70]*states[31])+constants[101]*algebraic[51] algebraic[142] = constants[29]*(exp(algebraic[88]/(constants[129]*constants[130]))-exp(algebraic[139]/(constants[129]*constants[130]))) algebraic[71] = constants[129]*constants[130]*log(constants[64]*states[25])+constants[102]*constants[113]*algebraic[45] algebraic[105] = constants[129]*constants[130]*log(constants[67]*states[28])+constants[106]*constants[113]*algebraic[45] algebraic[106] = constants[10]*(exp(algebraic[71]/(constants[129]*constants[130]))-exp(algebraic[105]/(constants[129]*constants[130]))) algebraic[83] = constants[129]*constants[130]*log(constants[64]*states[25])+constants[105]*constants[113]*algebraic[45] algebraic[129] = constants[129]*constants[130]*log(constants[65]*states[26])+constants[109]*constants[113]*algebraic[45] algebraic[130] = constants[23]*(exp(algebraic[83]/(constants[129]*constants[130]))-exp(algebraic[129]/(constants[129]*constants[130]))) algebraic[144] = ((-algebraic[106]+algebraic[114])-algebraic[142])-algebraic[130] algebraic[72] = constants[129]*constants[130]*log(constants[70]*states[31])+constants[102]*constants[113]*algebraic[45] algebraic[107] = constants[129]*constants[130]*log(constants[73]*states[34])+constants[106]*constants[113]*algebraic[45] algebraic[108] = constants[13]*(exp(algebraic[72]/(constants[129]*constants[130]))-exp(algebraic[107]/(constants[129]*constants[130]))) algebraic[84] = constants[129]*constants[130]*log(constants[70]*states[31])+constants[105]*constants[113]*algebraic[45] algebraic[131] = constants[129]*constants[130]*log(constants[71]*states[32])+constants[109]*constants[113]*algebraic[45] algebraic[132] = constants[25]*(exp(algebraic[84]/(constants[129]*constants[130]))-exp(algebraic[131]/(constants[129]*constants[130]))) algebraic[145] = ((-algebraic[108]+algebraic[116])--algebraic[142])-algebraic[132] algebraic[59] = constants[129]*constants[130]*log(constants[65]*states[26]) algebraic[89] = algebraic[59] algebraic[143] = constants[129]*constants[130]*log(constants[71]*states[32])+constants[101]*algebraic[51] algebraic[146] = constants[31]*(exp(algebraic[89]/(constants[129]*constants[130]))-exp(algebraic[143]/(constants[129]*constants[130]))) algebraic[73] = constants[129]*constants[130]*log(constants[65]*states[26])+constants[102]*constants[113]*algebraic[45] algebraic[109] = constants[129]*constants[130]*log(constants[68]*states[29])+constants[106]*constants[113]*algebraic[45] algebraic[110] = constants[11]*(exp(algebraic[73]/(constants[129]*constants[130]))-exp(algebraic[109]/(constants[129]*constants[130]))) algebraic[148] = ((-algebraic[110]+algebraic[122])-algebraic[146])+algebraic[130] algebraic[74] = constants[129]*constants[130]*log(constants[71]*states[32])+constants[102]*constants[113]*algebraic[45] algebraic[111] = constants[129]*constants[130]*log(constants[74]*states[35])+constants[106]*constants[113]*algebraic[45] algebraic[112] = constants[14]*(exp(algebraic[74]/(constants[129]*constants[130]))-exp(algebraic[111]/(constants[129]*constants[130]))) algebraic[149] = ((-algebraic[112]+algebraic[124])--algebraic[146])+algebraic[132] algebraic[60] = constants[129]*constants[130]*log(constants[66]*states[27]) algebraic[90] = algebraic[60] algebraic[147] = constants[129]*constants[130]*log(constants[72]*states[33])+constants[101]*algebraic[51] algebraic[150] = constants[28]*(exp(algebraic[90]/(constants[129]*constants[130]))-exp(algebraic[147]/(constants[129]*constants[130]))) algebraic[77] = constants[129]*constants[130]*log(constants[66]*states[27])+constants[103]*constants[113]*algebraic[45] algebraic[117] = constants[129]*constants[130]*log(constants[67]*states[28])+constants[107]*constants[113]*algebraic[45] algebraic[118] = constants[16]*(exp(algebraic[77]/(constants[129]*constants[130]))-exp(algebraic[117]/(constants[129]*constants[130]))) algebraic[81] = constants[129]*constants[130]*log(constants[66]*states[27])+constants[104]*constants[113]*algebraic[45] algebraic[125] = constants[129]*constants[130]*log(constants[68]*states[29])+constants[108]*constants[113]*algebraic[45] algebraic[126] = constants[20]*(exp(algebraic[81]/(constants[129]*constants[130]))-exp(algebraic[125]/(constants[129]*constants[130]))) algebraic[152] = ((-algebraic[126]+algebraic[102])-algebraic[118])-algebraic[150] algebraic[78] = constants[129]*constants[130]*log(constants[72]*states[33])+constants[103]*constants[113]*algebraic[45] algebraic[119] = constants[129]*constants[130]*log(constants[73]*states[34])+constants[107]*constants[113]*algebraic[45] algebraic[120] = constants[18]*(exp(algebraic[78]/(constants[129]*constants[130]))-exp(algebraic[119]/(constants[129]*constants[130]))) algebraic[82] = constants[129]*constants[130]*log(constants[72]*states[33])+constants[104]*constants[113]*algebraic[45] algebraic[127] = constants[129]*constants[130]*log(constants[74]*states[35])+constants[108]*constants[113]*algebraic[45] algebraic[128] = constants[22]*(exp(algebraic[82]/(constants[129]*constants[130]))-exp(algebraic[127]/(constants[129]*constants[130]))) algebraic[153] = ((-algebraic[128]+algebraic[104])-algebraic[120])--algebraic[150] algebraic[61] = constants[129]*constants[130]*log(constants[67]*states[28]) algebraic[91] = algebraic[61] algebraic[151] = constants[129]*constants[130]*log(constants[73]*states[34])+constants[101]*algebraic[51] algebraic[154] = constants[30]*(exp(algebraic[91]/(constants[129]*constants[130]))-exp(algebraic[151]/(constants[129]*constants[130]))) algebraic[85] = constants[129]*constants[130]*log(constants[67]*states[28])+constants[105]*constants[113]*algebraic[45] algebraic[133] = constants[129]*constants[130]*log(constants[68]*states[29])+constants[109]*constants[113]*algebraic[45] algebraic[134] = constants[24]*(exp(algebraic[85]/(constants[129]*constants[130]))-exp(algebraic[133]/(constants[129]*constants[130]))) algebraic[156] = ((algebraic[118]+algebraic[106])-algebraic[154])-algebraic[134] algebraic[63] = constants[129]*constants[130]*log(constants[68]*states[29]) algebraic[92] = algebraic[63] algebraic[155] = constants[129]*constants[130]*log(constants[74]*states[35])+constants[101]*algebraic[51] algebraic[157] = constants[32]*(exp(algebraic[92]/(constants[129]*constants[130]))-exp(algebraic[155]/(constants[129]*constants[130]))) algebraic[159] = ((algebraic[126]+algebraic[110])-algebraic[157])+algebraic[134] algebraic[62] = constants[129]*constants[130]*log(constants[73]*states[34]) algebraic[65] = algebraic[51]+constants[127]*constants[113]*algebraic[45]+algebraic[62] algebraic[48] = constants[129]*constants[130]*log(constants[60]*states[8]) algebraic[97] = algebraic[48]+algebraic[62] algebraic[93] = constants[127]*constants[113]*algebraic[45] algebraic[158] = custom_piecewise([equal(algebraic[93] , 0.00000), constants[5]*(exp(algebraic[65]/(constants[129]*constants[130]))-exp(algebraic[97]/(constants[129]*constants[130]))) , True, (((constants[5]*algebraic[93])/(constants[129]*constants[130]))/(exp(algebraic[93]/(constants[129]*constants[130]))-1.00000))*(exp(algebraic[65]/(constants[129]*constants[130]))-exp(algebraic[97]/(constants[129]*constants[130])))]) algebraic[64] = constants[129]*constants[130]*log(constants[74]*states[35]) algebraic[66] = algebraic[51]+constants[127]*constants[113]*algebraic[45]+algebraic[64] algebraic[98] = algebraic[48]+algebraic[64] algebraic[94] = constants[127]*constants[113]*algebraic[45] algebraic[160] = custom_piecewise([equal(algebraic[94] , 0.00000), constants[6]*(exp(algebraic[66]/(constants[129]*constants[130]))-exp(algebraic[98]/(constants[129]*constants[130]))) , True, (((constants[6]*algebraic[94])/(constants[129]*constants[130]))/(exp(algebraic[94]/(constants[129]*constants[130]))-1.00000))*(exp(algebraic[66]/(constants[129]*constants[130]))-exp(algebraic[98]/(constants[129]*constants[130])))]) algebraic[161] = algebraic[160]+algebraic[158] algebraic[56] = constants[129]*constants[130]*log(constants[61]*states[9]) algebraic[67] = algebraic[56]+constants[128]*constants[113]*algebraic[45]+algebraic[62] algebraic[54] = constants[129]*constants[130]*log(constants[62]*states[10]) algebraic[99] = algebraic[54]+algebraic[62] algebraic[95] = constants[128]*constants[113]*algebraic[45] algebraic[162] = custom_piecewise([equal(algebraic[95] , 0.00000), constants[7]*(exp(algebraic[67]/(constants[129]*constants[130]))-exp(algebraic[99]/(constants[129]*constants[130]))) , True, (((constants[7]*algebraic[95])/(constants[129]*constants[130]))/(exp(algebraic[95]/(constants[129]*constants[130]))-1.00000))*(exp(algebraic[67]/(constants[129]*constants[130]))-exp(algebraic[99]/(constants[129]*constants[130])))]) algebraic[86] = constants[129]*constants[130]*log(constants[73]*states[34])+constants[105]*constants[113]*algebraic[45] algebraic[135] = constants[129]*constants[130]*log(constants[74]*states[35])+constants[109]*constants[113]*algebraic[45] algebraic[136] = constants[26]*(exp(algebraic[86]/(constants[129]*constants[130]))-exp(algebraic[135]/(constants[129]*constants[130]))) algebraic[166] = ((algebraic[120]+algebraic[108])-((((-algebraic[154]+algebraic[158])-algebraic[158])+algebraic[162])-algebraic[162]))-algebraic[136] algebraic[68] = algebraic[56]+constants[128]*constants[113]*algebraic[45]+algebraic[64] algebraic[100] = algebraic[54]+algebraic[64] algebraic[96] = constants[128]*constants[113]*algebraic[45] algebraic[164] = custom_piecewise([equal(algebraic[96] , 0.00000), constants[8]*(exp(algebraic[68]/(constants[129]*constants[130]))-exp(algebraic[100]/(constants[129]*constants[130]))) , True, (((constants[8]*algebraic[96])/(constants[129]*constants[130]))/(exp(algebraic[96]/(constants[129]*constants[130]))-1.00000))*(exp(algebraic[68]/(constants[129]*constants[130]))-exp(algebraic[100]/(constants[129]*constants[130])))]) algebraic[167] = -algebraic[162]-algebraic[164] algebraic[168] = algebraic[164]+algebraic[162] algebraic[171] = ((algebraic[128]+algebraic[112])-((((-algebraic[157]+algebraic[160])-algebraic[160])+algebraic[164])-algebraic[164]))+algebraic[136] algebraic[169] = constants[113]*(((((((((((((((((((((((((((((((((((((constants[108]*algebraic[124]-constants[104]*algebraic[124])+constants[109]*algebraic[132])-constants[105]*algebraic[132])+constants[107]*algebraic[120])-constants[103]*algebraic[120])+constants[108]*algebraic[128])-constants[104]*algebraic[128])+constants[109]*algebraic[136])-constants[105]*algebraic[136])+constants[107]*algebraic[116])-constants[103]*algebraic[116])+constants[106]*algebraic[112])-constants[102]*algebraic[112])+constants[106]*algebraic[108])-constants[102]*algebraic[108])+constants[106]*algebraic[104])-constants[102]*algebraic[104])+constants[109]*algebraic[134])-constants[105]*algebraic[134])+constants[108]*algebraic[126])-constants[104]*algebraic[126])+constants[107]*algebraic[118])-constants[103]*algebraic[118])+constants[109]*algebraic[130])-constants[105]*algebraic[130])+constants[108]*algebraic[122])-constants[104]*algebraic[122])+constants[107]*algebraic[114])-constants[103]*algebraic[114])+constants[106]*algebraic[110])-constants[102]*algebraic[110])+constants[106]*algebraic[106])-constants[102]*algebraic[106])+constants[106]*algebraic[102])-constants[102]*algebraic[102])-(constants[127]*algebraic[158]+constants[127]*algebraic[160]))-(constants[128]*algebraic[162]+constants[128]*algebraic[164])) algebraic[9] = custom_piecewise([greater(voi , constants[123]) & less(voi , constants[124]), constants[125] , True, constants[126]]) algebraic[172] = -algebraic[169]+algebraic[9] algebraic[170] = constants[129]*constants[130]*log(constants[59]*states[3]) algebraic[173] = constants[129]*constants[130]*log(constants[84]*states[36]) algebraic[176] = constants[129]*constants[130]*log(constants[87]*states[39]) algebraic[178] = constants[39]*(exp(algebraic[176]/(constants[129]*constants[130]))-exp((algebraic[173]+constants[152]*algebraic[170])/(constants[129]*constants[130]))) algebraic[174] = constants[129]*constants[130]*log(constants[85]*states[37]) algebraic[179] = constants[40]*(exp((algebraic[173]+constants[151]*algebraic[170])/(constants[129]*constants[130]))-exp(algebraic[174]/(constants[129]*constants[130]))) algebraic[175] = constants[129]*constants[130]*log(constants[86]*states[38]) algebraic[180] = constants[41]*(exp((algebraic[174]+constants[152]*algebraic[170])/(constants[129]*constants[130]))-exp(algebraic[175]/(constants[129]*constants[130]))) algebraic[181] = constants[42]*(exp(algebraic[175]/(constants[129]*constants[130]))-exp((algebraic[176]+constants[151]*algebraic[170])/(constants[129]*constants[130]))) algebraic[188] = constants[129]*constants[130]*log(constants[100]*states[21]) algebraic[189] = constants[165]+algebraic[188] algebraic[198] = constants[51]*(exp(constants[176]/(constants[129]*constants[130]))-exp(algebraic[189]/(constants[129]*constants[130]))) algebraic[199] = algebraic[198] algebraic[187] = constants[129]*constants[130]*log(constants[98]*states[23]) algebraic[190] = constants[165]+algebraic[187] algebraic[200] = constants[43]*(exp(algebraic[190]/(constants[129]*constants[130]))-exp(constants[177]/(constants[129]*constants[130]))) algebraic[201] = -algebraic[200] algebraic[186] = constants[129]*constants[130]*log(constants[99]*states[22]) algebraic[191] = algebraic[186]+constants[173] algebraic[202] = constants[47]*(exp(constants[178]/(constants[129]*constants[130]))-exp(algebraic[191]/(constants[129]*constants[130]))) algebraic[204] = algebraic[202] algebraic[165] = constants[129]*constants[130]*log(constants[83]*states[19]) algebraic[177] = constants[38]*exp(algebraic[176]/(constants[129]*constants[130]))*(exp(algebraic[165]/(constants[129]*constants[130]))-exp(algebraic[170]/(constants[129]*constants[130]))) algebraic[184] = constants[129]*constants[130]*log(constants[83]*states[19]) algebraic[195] = constants[174]+constants[154]*algebraic[184] algebraic[211] = constants[48]*(exp(constants[182]/(constants[129]*constants[130]))-exp(algebraic[195]/(constants[129]*constants[130]))) algebraic[219] = constants[154]*algebraic[211] algebraic[218] = algebraic[213]/constants[145] algebraic[185] = constants[129]*constants[130]*log(constants[97]*states[20]) algebraic[192] = constants[168]+algebraic[185] algebraic[205] = constants[45]*(exp(algebraic[192]/(constants[129]*constants[130]))-exp(constants[179]/(constants[129]*constants[130]))) algebraic[194] = constants[171]+constants[155]*algebraic[185] algebraic[208] = constants[46]*(exp(constants[181]/(constants[129]*constants[130]))-exp(algebraic[194]/(constants[129]*constants[130]))) algebraic[196] = constants[174]+constants[155]*algebraic[185] algebraic[220] = constants[49]*(exp(algebraic[196]/(constants[129]*constants[130]))-exp(constants[183]/(constants[129]*constants[130]))) algebraic[197] = algebraic[185]+constants[172] algebraic[223] = constants[50]*(exp(constants[184]/(constants[129]*constants[130]))-exp(algebraic[197]/(constants[129]*constants[130]))) algebraic[226] = ((constants[155]*algebraic[208]-algebraic[205])-constants[155]*algebraic[220])+algebraic[223] algebraic[24] = constants[129]*constants[130]*log(constants[52]*states[1]) algebraic[28] = constants[129]*constants[130]*log(constants[59]*states[3]) algebraic[33] = (constants[146]/(constants[136]*constants[137]*constants[138]))*states[7]*(states[42]+constants[136]) algebraic[36] = (constants[146]/(constants[136]*constants[137]*constants[138]))*states[6]*states[41] algebraic[39] = algebraic[33]+algebraic[36] algebraic[42] = algebraic[39] algebraic[222] = ((constants[150]*algebraic[212])/constants[136])*algebraic[218] algebraic[225] = algebraic[222] algebraic[229] = algebraic[42]+algebraic[225] algebraic[230] = algebraic[229]*1000.00 algebraic[231] = constants[135]*constants[160]*algebraic[230] algebraic[232] = constants[0]*(exp((algebraic[28]+algebraic[24])/(constants[129]*constants[130]))-exp((algebraic[30]+algebraic[231])/(constants[129]*constants[130]))) algebraic[163] = (((constants[101])*algebraic[150]+constants[101]*algebraic[154]+constants[101]*algebraic[146]+constants[101]*algebraic[142]+constants[101]*algebraic[138]+constants[101]*algebraic[157])-algebraic[158])-algebraic[160] algebraic[182] = ((constants[152]*algebraic[178]-constants[151]*algebraic[179])-constants[152]*algebraic[180])+constants[151]*algebraic[181] algebraic[183] = constants[129]*constants[130]*log(constants[59]*states[3]) algebraic[193] = constants[168]+constants[153]*algebraic[183] algebraic[206] = constants[44]*(exp(algebraic[193]/(constants[129]*constants[130]))-exp(constants[180]/(constants[129]*constants[130]))) algebraic[209] = -constants[153]*algebraic[206] algebraic[0] = states[0]/constants[112] algebraic[2] = states[11]+states[13]+states[16]+states[15] algebraic[3] = states[12]+states[13] algebraic[4] = states[17]+states[18] algebraic[5] = states[9] algebraic[6] = states[10] algebraic[10] = constants[129]*constants[130]*log(constants[69]*states[30]) algebraic[11] = constants[129]*constants[130]*log(constants[70]*states[31]) algebraic[12] = constants[129]*constants[130]*log(constants[71]*states[32]) algebraic[13] = constants[129]*constants[130]*log(constants[72]*states[33]) algebraic[14] = constants[152]*states[39]+constants[151]*states[37]+(constants[151]+constants[152])*states[38] algebraic[15] = states[3]/constants[156] algebraic[16] = states[19]/constants[162] algebraic[17] = states[20]/constants[166] algebraic[18] = states[22]/constants[156] algebraic[19] = states[23]/constants[156] algebraic[20] = states[21]/constants[156] algebraic[203] = algebraic[198]-algebraic[200] algebraic[207] = algebraic[205] algebraic[210] = algebraic[200]-algebraic[206] algebraic[216] = algebraic[206]-algebraic[208] algebraic[217] = algebraic[208]-algebraic[202] algebraic[221] = algebraic[202]-algebraic[211] algebraic[224] = algebraic[211]-algebraic[220] algebraic[227] = algebraic[220]-algebraic[223] algebraic[228] = algebraic[223]-algebraic[198] return algebraic initialGuess0 = None def rootfind_0(voi, constants, rates, states, algebraic): """Calculate values of algebraic variables for DAE""" from scipy.optimize import fsolve global initialGuess0 if initialGuess0 is None: initialGuess0 = ones(4)*0.1 if not iterable(voi): soln = fsolve(residualSN_0, initialGuess0, args=(algebraic, voi, constants, rates, states), xtol=1E-6) initialGuess0 = soln algebraic[212] = soln[0] algebraic[213] = soln[1] algebraic[214] = soln[2] algebraic[215] = soln[3] else: for (i,t) in enumerate(voi): soln = fsolve(residualSN_0, initialGuess0, args=(algebraic[:,i], voi[i], constants, rates[:i], states[:,i]), xtol=1E-6) initialGuess0 = soln algebraic[212][i] = soln[0] algebraic[213][i] = soln[1] algebraic[214][i] = soln[2] algebraic[215][i] = soln[3] def residualSN_0(algebraicCandidate, algebraic, voi, constants, rates, states): resid = array([0.0] * 4) algebraic[212] = algebraicCandidate[0] algebraic[213] = algebraicCandidate[1] algebraic[214] = algebraicCandidate[2] algebraic[215] = algebraicCandidate[3] resid[0] = (algebraic[212]-(custom_piecewise([greater(algebraic[213] , 0.00000), constants[147] , True, constants[148]]))) resid[1] = (algebraic[214]-(constants[149]/algebraic[212])*states[43]*constants[145]) resid[2] = (algebraic[215]-(constants[149]/algebraic[212])*(states[40]-constants[136])*constants[145]) resid[3] = (algebraic[213]-(-algebraic[214]+algebraic[215])) return resid 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)