# Size of variable arrays: sizeAlgebraic = 179 sizeStates = 17 sizeConstants = 230 from math import * from numpy import * def createLegends(): legend_states = [""] * sizeStates legend_rates = [""] * sizeStates legend_algebraic = [""] * sizeAlgebraic legend_voi = "" legend_constants = [""] * sizeConstants legend_voi = "time in component environment (day)" legend_algebraic[10] = "U_Pd_PdPs in component Q_Pd (mole_per_day)" legend_states[0] = "Q_Pd in component Q_Pd (mole)" legend_algebraic[0] = "C_Pd in component Q_Pd (molar)" legend_algebraic[8] = "U_Pd_PdEx in component Q_Pd (mole_per_day)" legend_constants[155] = "P_Pd_InPd in component Q_Pd (mole_per_day)" legend_algebraic[9] = "v_PdPs in component Q_Pd (mole_per_day)" legend_constants[0] = "v_PdPs_star in component Q_Pd (mole_per_gram_day)" legend_constants[174] = "M_Pd_PdPs in component Q_Pd (molar)" legend_constants[1] = "M_Pd_PdPs_star in component Q_Pd (molar)" legend_constants[2] = "Y_Pd_InPd in component Q_Pd (molar)" legend_constants[3] = "D_Pd in component Q_Pd (litre_per_day)" legend_constants[154] = "k_PdEx in component Q_Pd (first_order_rate_constant)" legend_constants[4] = "T_Pd in component Q_Pd (day)" legend_constants[5] = "T_Pd_star in component Q_Pd (day)" legend_states[1] = "Q_Ma in component Q_Ma (gram)" legend_states[2] = "Q_Mc in component Q_Mc (gram)" legend_constants[6] = "V_Ru in component model_parameters (litre)" legend_constants[7] = "k_SoEx in component model_parameters (first_order_rate_constant)" legend_algebraic[11] = "C_Ps in component Q_Ps (molar)" legend_algebraic[48] = "U_McPs_PsAm in component Q_Ps (mole_per_day)" legend_algebraic[36] = "U_Ps_PsMa in component Q_Ps (mole_per_day)" legend_algebraic[49] = "U_Ps_PsMc in component Q_Ps (mole_per_day)" legend_algebraic[35] = "U_MaPs_PsAm in component Q_Ps (mole_per_day)" legend_constants[8] = "M_Ha_McMa in component Q_Ps (molar)" legend_states[3] = "Q_Ps in component Q_Ps (mole)" legend_constants[176] = "P_Ps_InPs in component Q_Ps (mole_per_day)" legend_constants[179] = "P_Ps_SaPs in component Q_Ps (mole_per_day)" legend_algebraic[12] = "P_Ps_PdPs in component Q_Ps (mole_per_day)" legend_algebraic[62] = "P_Ps_MaMd in component Q_Ps (mole_per_day)" legend_algebraic[78] = "P_Ps_McPs in component Q_Ps (mole_per_day)" legend_algebraic[13] = "U_Ps_PsEx in component Q_Ps (mole_per_day)" legend_algebraic[76] = "U_Mc_McPs in component Q_Ps (mole_per_day)" legend_algebraic[14] = "v_Ma_PsAm in component Q_Ps (mole_per_day)" legend_algebraic[15] = "v_Mc_PsAm in component Q_Ps (mole_per_day)" legend_algebraic[16] = "v_PsMa in component Q_Ps (mole_per_day)" legend_algebraic[17] = "v_PsMc in component Q_Ps (mole_per_day)" legend_constants[9] = "v_PsAm_star in component Q_Ps (mole_per_gram_day)" legend_constants[10] = "v_PsMa_star in component Q_Ps (mole_per_gram_day)" legend_constants[11] = "v_PsMc_star in component Q_Ps (mole_per_gram_day)" legend_constants[156] = "k_PsEx in component Q_Ps (first_order_rate_constant)" legend_constants[12] = "Y_Ps_InPs in component Q_Ps (molar)" legend_constants[13] = "Y_Ps_SaPs in component Q_Ps (molar)" legend_constants[14] = "Y_Ps_PdPs in component Q_Ps (dimensionless)" legend_constants[15] = "Y_Ps_MaMd in component Q_Ps (mole_per_gram)" legend_constants[16] = "Y_Ps_McPs in component Q_Ps (dimensionless)" legend_constants[17] = "D_Ps in component Q_Ps (litre_per_day)" legend_constants[18] = "M_Ps_PsAm in component Q_Ps (molar)" legend_constants[19] = "M_Ps_PsMa in component Q_Ps (molar)" legend_constants[20] = "M_Ps_PsMc in component Q_Ps (molar)" legend_constants[21] = "M_Ha_PsMa in component Q_Ps (molar)" legend_constants[22] = "M_Hc_PsMc in component Q_Ps (molar)" legend_constants[23] = "J_Ha_PsAm in component Q_Ps (molar)" legend_constants[24] = "J_Hc_PsAm in component Q_Ps (molar)" legend_algebraic[75] = "U_Mc_McEg in component Q_Mc (gram_per_day)" legend_algebraic[61] = "U_Ma_MaMd in component Q_Ma (gram_per_day)" legend_algebraic[54] = "U_Hc_PsMc in component Q_Hc (mole_per_day)" legend_algebraic[82] = "U_Ha_McMa in component Q_Ha (mole_per_day)" legend_algebraic[34] = "C_Ha in component Q_Ha (molar)" legend_algebraic[47] = "C_Hc in component Q_Hc (molar)" legend_constants[25] = "k_FlEx in component model_parameters (first_order_rate_constant)" legend_constants[26] = "J_Ha_McAm in component model_parameters (molar)" legend_states[4] = "Q_Pu in component Q_Pu (mole)" legend_algebraic[1] = "C_Pu in component Q_Pu (molar)" legend_constants[157] = "P_Pu_InPu in component Q_Pu (mole_per_day)" legend_algebraic[2] = "U_Pu_PuEx in component Q_Pu (mole_per_day)" legend_constants[27] = "Y_Pu_InPu in component Q_Pu (molar)" legend_constants[28] = "D_Pu in component Q_Pu (litre_per_day)" legend_constants[158] = "k_PuEx in component Q_Pu (first_order_rate_constant)" legend_algebraic[18] = "C_Am in component Q_Am (molar)" legend_algebraic[51] = "U_Am_AmMc in component Q_Am (mole_per_day)" legend_algebraic[38] = "U_Am_AmMa in component Q_Am (mole_per_day)" legend_algebraic[77] = "U_Mc_McAm in component Q_Am (mole_per_day)" legend_states[5] = "Q_Am in component Q_Am (mole)" legend_constants[180] = "P_Am_InAm in component Q_Am (mole_per_day)" legend_algebraic[22] = "P_Am_UeAm in component Q_Am (mole_per_day)" legend_algebraic[37] = "P_MaAm_PsAm in component Q_Am (mole_per_day)" legend_algebraic[50] = "P_McAm_PsAm in component Q_Am (mole_per_day)" legend_algebraic[79] = "P_Am_McAm in component Q_Am (mole_per_day)" legend_algebraic[19] = "U_Am_AmAb in component Q_Am (mole_per_day)" legend_algebraic[20] = "U_Am_AmEx in component Q_Am (mole_per_day)" legend_algebraic[21] = "v_UeAm in component Q_Am (mole_per_day)" legend_constants[181] = "v_AmAb in component Q_Am (mole_per_day)" legend_algebraic[23] = "v_AmMa in component Q_Am (mole_per_day)" legend_algebraic[24] = "v_AmMc in component Q_Am (mole_per_day)" legend_constants[29] = "v_UeAm_star in component Q_Am (mole_per_litre_day)" legend_constants[30] = "v_AmAb_star in component Q_Am (mole_per_litre_day)" legend_constants[31] = "v_AmMa_star in component Q_Am (mole_per_gram_day)" legend_constants[32] = "v_AmMc_star in component Q_Am (mole_per_gram_day)" legend_constants[159] = "k_AmEx in component Q_Am (first_order_rate_constant)" legend_constants[33] = "Y_Am_InAm in component Q_Am (molar)" legend_constants[34] = "Y_Am_UeAm in component Q_Am (dimensionless)" legend_constants[35] = "Y_Am_PsAm in component Q_Am (dimensionless)" legend_constants[36] = "Y_Am_McAm in component Q_Am (dimensionless)" legend_constants[37] = "M_Am_AmMa in component Q_Am (molar)" legend_constants[38] = "M_Am_AmMc in component Q_Am (molar)" legend_constants[39] = "M_Am_AmAb in component Q_Am (molar)" legend_constants[40] = "M_pH_AmAb in component Q_Am (dimensionless)" legend_constants[41] = "phi_pH_AmAb in component Q_Am (dimensionless)" legend_constants[42] = "M_Ha_AmMa in component Q_Am (molar)" legend_constants[43] = "M_Hc_AmMc in component Q_Am (molar)" legend_constants[44] = "J_Am_UeAm in component Q_Am (molar)" legend_constants[45] = "D_Am in component Q_Am (litre_per_day)" legend_constants[46] = "pH in component model_parameters (dimensionless)" legend_constants[47] = "f_Po_Ma in component model_parameters (dimensionless)" legend_constants[48] = "f_Ni_Fe in component model_parameters (dimensionless)" legend_states[6] = "Q_Li in component Q_Li (mole)" legend_algebraic[3] = "C_Li in component Q_Li (molar)" legend_constants[182] = "P_Li_InLi in component Q_Li (mole_per_day)" legend_algebraic[63] = "P_Li_MaMd in component Q_Li (mole_per_day)" legend_algebraic[25] = "U_Li_LiEx in component Q_Li (mole_per_day)" legend_constants[49] = "Y_Li_InLi in component Q_Li (molar)" legend_constants[50] = "Y_Li_MaMd in component Q_Li (mole_per_gram)" legend_constants[51] = "D_Li in component Q_Li (litre_per_day)" legend_constants[160] = "k_LiEx in component Q_Li (first_order_rate_constant)" legend_algebraic[29] = "U_Sd_SdHa in component Q_Sd (mole_per_day)" legend_states[7] = "Q_Sd in component Q_Sd (mole)" legend_algebraic[26] = "C_Sd in component Q_Sd (molar)" legend_constants[183] = "P_Sd_InSd in component Q_Sd (mole_per_day)" legend_algebraic[27] = "U_Sd_SdEx in component Q_Sd (mole_per_day)" legend_constants[52] = "Y_Sd_InSd in component Q_Sd (molar)" legend_constants[53] = "D_Sd in component Q_Sd (litre_per_day)" legend_constants[161] = "k_SdEx in component Q_Sd (first_order_rate_constant)" legend_algebraic[28] = "v_SdHa in component Q_Sd (mole_per_day)" legend_constants[54] = "v_SdHa_star in component Q_Sd (mole_per_gram_day)" legend_constants[184] = "M_Sd_SdHa in component Q_Sd (molar)" legend_constants[55] = "M_Sd_SdHa_star in component Q_Sd (molar)" legend_constants[56] = "T_Sd in component Q_Sd (day)" legend_constants[57] = "T_Sd_star in component Q_Sd (day)" legend_algebraic[33] = "U_Fd_FdHc in component Q_Fd (mole_per_day)" legend_states[8] = "Q_Fd in component Q_Fd (mole)" legend_algebraic[30] = "C_Fd in component Q_Fd (molar)" legend_constants[185] = "P_Fd_InFd in component Q_Fd (mole_per_day)" legend_algebraic[31] = "U_Fd_FdEx in component Q_Fd (mole_per_day)" legend_constants[58] = "Y_Fd_InFd in component Q_Fd (molar)" legend_constants[59] = "D_Fd in component Q_Fd (litre_per_day)" legend_constants[162] = "k_FdEx in component Q_Fd (first_order_rate_constant)" legend_algebraic[32] = "v_FdHc in component Q_Fd (mole_per_day)" legend_constants[60] = "v_FdHc_star in component Q_Fd (mole_per_gram_day)" legend_constants[186] = "M_Fd_FdHc in component Q_Fd (molar)" legend_constants[61] = "M_Fd_FdHc_star in component Q_Fd (molar)" legend_constants[62] = "T_Fd in component Q_Fd (day)" legend_constants[63] = "T_Fd_star in component Q_Fd (day)" legend_constants[64] = "phi_pH_FdHc in component Q_Fd (dimensionless)" legend_constants[65] = "M_pH_FdHc in component Q_Fd (dimensionless)" legend_constants[66] = "pm in component model_parameters (dimensionless)" legend_constants[67] = "f in component model_parameters (dimensionless)" legend_states[9] = "Q_Fu in component Q_Fu (mole)" legend_algebraic[4] = "C_Fu in component Q_Fu (molar)" legend_constants[163] = "P_Fu_InFu in component Q_Fu (mole_per_day)" legend_algebraic[5] = "U_Fu_FuEx in component Q_Fu (mole_per_day)" legend_constants[68] = "Y_Fu_InFu in component Q_Fu (molar)" legend_constants[69] = "D_Fu in component Q_Fu (litre_per_day)" legend_constants[164] = "k_FuEx in component Q_Fu (first_order_rate_constant)" legend_algebraic[44] = "U_Ha_HaAs in component Q_Ha (mole_per_day)" legend_algebraic[40] = "U_Ha_AmMa in component Q_Ha (mole_per_day)" legend_algebraic[41] = "U_Ha_PsMa in component Q_Ha (mole_per_day)" legend_algebraic[46] = "U_Ha_HaVa in component Q_Ha (mole_per_day)" legend_constants[187] = "P_Ha_WrHa in component Q_Ha (mole_per_day)" legend_constants[189] = "P_Ha_LaHa in component Q_Ha (mole_per_day)" legend_constants[188] = "P_Ha_SrHa in component Q_Ha (mole_per_day)" legend_algebraic[39] = "P_Ha_SdHa in component Q_Ha (mole_per_day)" legend_algebraic[67] = "P_Ha_MaMd in component Q_Ha (mole_per_day)" legend_states[10] = "Q_Ha in component Q_Ha (mole)" legend_algebraic[42] = "U_Ha_HaEx in component Q_Ha (mole_per_day)" legend_constants[70] = "R_Ha_AmMa in component Q_Ha (dimensionless)" legend_constants[71] = "R_Ha_PsMa in component Q_Ha (dimensionless)" legend_constants[72] = "R_Ha_McMa in component Q_Ha (mole_per_gram)" legend_constants[73] = "M_Ha_HaAs in component Q_Ha (molar)" legend_constants[74] = "M_Ha_HaVa in component Q_Ha (molar)" legend_algebraic[43] = "v_HaAs in component Q_Ha (mole_per_day)" legend_algebraic[45] = "v_HaVa in component Q_Ha (mole_per_day)" legend_constants[75] = "v_HaAs_star in component Q_Ha (mole_per_gram_day)" legend_constants[76] = "v_HaVa_star in component Q_Ha (mole_per_gram_day)" legend_constants[165] = "k_HaEx in component Q_Ha (first_order_rate_constant)" legend_constants[77] = "Y_Ha_WrHa in component Q_Ha (molar)" legend_constants[78] = "Y_Ha_SrHa in component Q_Ha (molar)" legend_constants[79] = "Y_Ha_LaHa in component Q_Ha (molar)" legend_constants[80] = "Y_Ha_SdHa in component Q_Ha (dimensionless)" legend_constants[81] = "Y_Ha_MaMd in component Q_Ha (mole_per_gram)" legend_constants[82] = "D_Wr in component Q_Ha (litre_per_day)" legend_constants[83] = "D_Sr in component Q_Ha (litre_per_day)" legend_constants[84] = "D_La in component Q_Ha (litre_per_day)" legend_constants[85] = "J_Am_HaVa in component Q_Ha (molar)" legend_constants[86] = "J_Ps_HaVa in component Q_Ha (molar)" legend_algebraic[66] = "U_As_MaMd in component Q_As (gram_per_day)" legend_algebraic[80] = "U_Mc_McMa in component Q_Ma (gram_per_day)" legend_algebraic[53] = "U_Hc_AmMc in component Q_Hc (mole_per_day)" legend_algebraic[57] = "U_Hc_HcVa in component Q_Hc (mole_per_day)" legend_states[11] = "Q_Hc in component Q_Hc (mole)" legend_algebraic[52] = "P_Hc_FdHc in component Q_Hc (mole_per_day)" legend_algebraic[55] = "U_Hc_HcEx in component Q_Hc (mole_per_day)" legend_constants[87] = "R_Hc_AmMc in component Q_Hc (dimensionless)" legend_constants[88] = "R_Hc_PsMc in component Q_Hc (dimensionless)" legend_algebraic[56] = "v_HcVa in component Q_Hc (mole_per_day)" legend_constants[89] = "v_HcVa_star in component Q_Hc (mole_per_gram_day)" legend_constants[166] = "k_HcEx in component Q_Hc (first_order_rate_constant)" legend_constants[90] = "Y_Hc_FdHc in component Q_Hc (dimensionless)" legend_constants[91] = "M_Hc_HcVa in component Q_Hc (molar)" legend_constants[92] = "J_Am_HcVa in component Q_Hc (molar)" legend_constants[93] = "J_Ps_HcVa in component Q_Hc (molar)" legend_algebraic[58] = "C_Ma in component Q_Ma (gram_per_litre)" legend_algebraic[59] = "P_Ma_AmMa in component Q_Ma (gram_per_day)" legend_algebraic[60] = "P_Ma_PsMa in component Q_Ma (gram_per_day)" legend_algebraic[81] = "P_Ma_McMa in component Q_Ma (gram_per_day)" legend_algebraic[64] = "U_Ma_PoEx in component Q_Ma (gram_per_day)" legend_algebraic[6] = "U_Ma_MaEx in component Q_Ma (gram_per_day)" legend_constants[177] = "k_MaMd in component Q_Ma (first_order_rate_constant)" legend_constants[94] = "Y_Ma_AmMa in component Q_Ma (gram_per_mole)" legend_constants[95] = "Y_Ma_PsMa in component Q_Ma (gram_per_mole)" legend_constants[96] = "Y_Ma_McMa in component Q_Ma (dimensionless)" legend_constants[167] = "k_MaEx in component model_parameters (first_order_rate_constant)" legend_constants[175] = "k_PoEx in component model_parameters (first_order_rate_constant)" legend_states[12] = "Q_As in component Q_As (gram)" legend_algebraic[7] = "C_As in component Q_As (gram_per_litre)" legend_algebraic[65] = "P_As_HaAs in component Q_As (gram_per_day)" legend_algebraic[70] = "U_As_PoEx in component Q_As (gram_per_day)" legend_algebraic[68] = "U_As_AsEx in component Q_As (gram_per_day)" legend_constants[168] = "k_AsEx in component Q_As (first_order_rate_constant)" legend_constants[178] = "k_AsMd in component Q_As (first_order_rate_constant)" legend_constants[97] = "Y_As_HaAs in component Q_As (gram_per_mole)" legend_algebraic[69] = "C_Mc in component Q_Mc (gram_per_litre)" legend_algebraic[71] = "P_Mc_AmMc in component Q_Mc (gram_per_day)" legend_algebraic[72] = "P_Mc_PsMc in component Q_Mc (gram_per_day)" legend_algebraic[73] = "U_Mc_McEx in component Q_Mc (gram_per_day)" legend_constants[169] = "k_McEx in component Q_Mc (first_order_rate_constant)" legend_constants[98] = "Y_Mc_AmMc in component Q_Mc (gram_per_mole)" legend_constants[99] = "Y_Mc_PsMc in component Q_Mc (gram_per_mole)" legend_algebraic[74] = "v_McEg in component Q_Mc (gram_per_day)" legend_constants[100] = "v_McEg_star in component Q_Mc (first_order_rate_constant)" legend_constants[101] = "M_Mc_McEg in component Q_Mc (gram_per_litre)" legend_states[13] = "Q_Ac in component Q_Ac (mole)" legend_algebraic[83] = "C_Ac in component Q_Ac (molar)" legend_constants[190] = "P_Ac_InAc in component Q_Ac (mole_per_day)" legend_algebraic[159] = "P_Ac_AmMa in component Q_Ac (mole_per_day)" legend_algebraic[119] = "P_Ac_AmMc in component Q_Ac (mole_per_day)" legend_algebraic[167] = "P_Ac_PsMa in component Q_Ac (mole_per_day)" legend_algebraic[131] = "P_Ac_PsMc in component Q_Ac (mole_per_day)" legend_algebraic[175] = "P_Ac_HaAs in component Q_Ac (mole_per_day)" legend_algebraic[151] = "P_Ac_HaVa in component Q_Ac (mole_per_day)" legend_algebraic[87] = "P_Ac_HcVa in component Q_Ac (mole_per_day)" legend_algebraic[91] = "P_MaAc_PsAm in component Q_Ac (mole_per_day)" legend_algebraic[95] = "P_McAc_PsAm in component Q_Ac (mole_per_day)" legend_algebraic[143] = "P_Ac_McMa in component Q_Ac (mole_per_day)" legend_algebraic[99] = "P_Ac_McAm in component Q_Ac (mole_per_day)" legend_algebraic[103] = "U_Ac_AcAb in component Q_Ac (mole_per_day)" legend_algebraic[107] = "U_Ac_AcEx in component Q_Ac (mole_per_day)" legend_algebraic[111] = "U_Hf_AmMa in component Q_Ac (mole_per_day)" legend_algebraic[115] = "U_Hf_AmMc in component Q_Ac (mole_per_day)" legend_algebraic[123] = "U_Hf_PsMa in component Q_Ac (mole_per_day)" legend_algebraic[127] = "U_Hf_PsMc in component Q_Ac (mole_per_day)" legend_algebraic[135] = "U_Hf_HaAs in component Q_Ac (mole_per_day)" legend_algebraic[139] = "U_Hf_McMa in component Q_Ac (mole_per_day)" legend_constants[102] = "M_Ac_AcAb in component Q_Ac (molar)" legend_constants[199] = "v_AcAb in component Q_Ac (mole_per_day)" legend_constants[103] = "v_AcAb_star in component Q_Ac (mole_per_litre_day)" legend_constants[191] = "Y_Ac_LaAc in component Q_Ac (dimensionless)" legend_algebraic[147] = "Y_Ac_HaVa in component Q_Ac (dimensionless)" legend_constants[193] = "Y_Ac_PsVa in component Q_Ac (dimensionless)" legend_algebraic[155] = "Y_Ac_AmMa in component Q_Ac (dimensionless)" legend_constants[194] = "Y_Ac_AmMc in component Q_Ac (dimensionless)" legend_algebraic[163] = "Y_Ac_PsMa in component Q_Ac (dimensionless)" legend_constants[195] = "Y_Ac_PsMc in component Q_Ac (dimensionless)" legend_algebraic[171] = "Y_Ac_HaAs in component Q_Ac (dimensionless)" legend_constants[196] = "Y_Ac_McMa in component Q_Ac (dimensionless)" legend_constants[197] = "Y_Ac_PsAm in component Q_Ac (dimensionless)" legend_constants[198] = "Y_Ac_McAm in component Q_Ac (dimensionless)" legend_constants[104] = "Y_Ac_WrAc in component Q_Ac (dimensionless)" legend_constants[105] = "Y_Ac_InAc in component Q_Ac (molar)" legend_constants[106] = "Y_Ac_StAc in component Q_Ac (dimensionless)" legend_constants[107] = "Y_Ac_CeAc in component Q_Ac (dimensionless)" legend_constants[108] = "Y_Ac_HeAc in component Q_Ac (dimensionless)" legend_constants[109] = "Y_Ac_PsAc in component Q_Ac (dimensionless)" legend_constants[192] = "Y_Ac_HcVa in component Q_Ac (dimensionless)" legend_constants[170] = "k_AcEx in component Q_Ac (first_order_rate_constant)" legend_constants[110] = "D_Ac in component Q_Ac (litre_per_day)" legend_constants[111] = "J_pH_AcAb in component Q_Ac (dimensionless)" legend_constants[112] = "phi_pH_AcAb in component Q_Ac (dimensionless)" legend_constants[113] = "f_Hf_AmMa in component model_parameters (dimensionless)" legend_constants[114] = "f_Hf_AmMc in component model_parameters (dimensionless)" legend_constants[115] = "f_Hf_PsMa in component model_parameters (dimensionless)" legend_constants[116] = "f_Hf_PsMc in component model_parameters (dimensionless)" legend_constants[117] = "f_Hf_HaAs in component model_parameters (dimensionless)" legend_constants[118] = "f_Hf_McMa in component model_parameters (dimensionless)" legend_constants[119] = "f_Lc_Le in component model_parameters (dimensionless)" legend_constants[120] = "f_Ce_Fd in component model_parameters (dimensionless)" legend_states[14] = "Q_Pr in component Q_Pr (mole)" legend_algebraic[84] = "C_Pr in component Q_Pr (molar)" legend_constants[200] = "P_Pr_InPr in component Q_Pr (mole_per_day)" legend_algebraic[160] = "P_Pr_AmMa in component Q_Pr (mole_per_day)" legend_algebraic[120] = "P_Pr_AmMc in component Q_Pr (mole_per_day)" legend_algebraic[168] = "P_Pr_PsMa in component Q_Pr (mole_per_day)" legend_algebraic[132] = "P_Pr_PsMc in component Q_Pr (mole_per_day)" legend_algebraic[176] = "P_Pr_HaAs in component Q_Pr (mole_per_day)" legend_algebraic[152] = "P_Pr_HaVa in component Q_Pr (mole_per_day)" legend_algebraic[88] = "P_Pr_HcVa in component Q_Pr (mole_per_day)" legend_algebraic[92] = "P_MaPr_PsAm in component Q_Pr (mole_per_day)" legend_algebraic[96] = "P_McPr_PsAm in component Q_Pr (mole_per_day)" legend_algebraic[144] = "P_Pr_McMa in component Q_Pr (mole_per_day)" legend_algebraic[100] = "P_Pr_McAm in component Q_Pr (mole_per_day)" legend_algebraic[104] = "U_Pr_PrAb in component Q_Pr (mole_per_day)" legend_algebraic[108] = "U_Pr_PrEx in component Q_Pr (mole_per_day)" legend_algebraic[112] = "U_Hf_AmMa in component Q_Pr (mole_per_day)" legend_algebraic[116] = "U_Hf_AmMc in component Q_Pr (mole_per_day)" legend_algebraic[124] = "U_Hf_PsMa in component Q_Pr (mole_per_day)" legend_algebraic[128] = "U_Hf_PsMc in component Q_Pr (mole_per_day)" legend_algebraic[136] = "U_Hf_HaAs in component Q_Pr (mole_per_day)" legend_algebraic[140] = "U_Hf_McMa in component Q_Pr (mole_per_day)" legend_constants[121] = "M_Pr_PrAb in component Q_Pr (molar)" legend_constants[209] = "v_PrAb in component Q_Pr (mole_per_day)" legend_constants[122] = "v_PrAb_star in component Q_Pr (mole_per_litre_day)" legend_constants[201] = "Y_Pr_LaPr in component Q_Pr (dimensionless)" legend_algebraic[148] = "Y_Pr_HaVa in component Q_Pr (dimensionless)" legend_constants[203] = "Y_Pr_PsVa in component Q_Pr (dimensionless)" legend_algebraic[156] = "Y_Pr_AmMa in component Q_Pr (dimensionless)" legend_constants[204] = "Y_Pr_AmMc in component Q_Pr (dimensionless)" legend_algebraic[164] = "Y_Pr_PsMa in component Q_Pr (dimensionless)" legend_constants[205] = "Y_Pr_PsMc in component Q_Pr (dimensionless)" legend_algebraic[172] = "Y_Pr_HaAs in component Q_Pr (dimensionless)" legend_constants[206] = "Y_Pr_McMa in component Q_Pr (dimensionless)" legend_constants[207] = "Y_Pr_PsAm in component Q_Pr (dimensionless)" legend_constants[208] = "Y_Pr_McAm in component Q_Pr (dimensionless)" legend_constants[123] = "Y_Pr_WrPr in component Q_Pr (dimensionless)" legend_constants[124] = "Y_Pr_InPr in component Q_Pr (molar)" legend_constants[202] = "Y_Pr_HcVa in component Q_Pr (dimensionless)" legend_constants[125] = "Y_Pr_StPr in component Q_Pr (dimensionless)" legend_constants[126] = "Y_Pr_CePr in component Q_Pr (dimensionless)" legend_constants[127] = "Y_Pr_HePr in component Q_Pr (dimensionless)" legend_constants[128] = "Y_Pr_PsPr in component Q_Pr (dimensionless)" legend_constants[171] = "k_PrEx in component Q_Pr (first_order_rate_constant)" legend_constants[129] = "D_Pr in component Q_Pr (litre_per_day)" legend_constants[130] = "phi_pH_PrAb in component Q_Pr (dimensionless)" legend_constants[131] = "J_pH_PrAb in component Q_Pr (dimensionless)" legend_states[15] = "Q_Bu in component Q_Bu (mole)" legend_algebraic[85] = "C_Bu in component Q_Bu (molar)" legend_constants[210] = "P_Bu_InBu in component Q_Bu (mole_per_day)" legend_algebraic[161] = "P_Bu_AmMa in component Q_Bu (mole_per_day)" legend_algebraic[121] = "P_Bu_AmMc in component Q_Bu (mole_per_day)" legend_algebraic[169] = "P_Bu_PsMa in component Q_Bu (mole_per_day)" legend_algebraic[133] = "P_Bu_PsMc in component Q_Bu (mole_per_day)" legend_algebraic[177] = "P_Bu_HaAs in component Q_Bu (mole_per_day)" legend_algebraic[153] = "P_Bu_HaVa in component Q_Bu (mole_per_day)" legend_algebraic[89] = "P_Bu_HcVa in component Q_Bu (mole_per_day)" legend_algebraic[93] = "P_MaBu_PsAm in component Q_Bu (mole_per_day)" legend_algebraic[97] = "P_McBu_PsAm in component Q_Bu (mole_per_day)" legend_algebraic[145] = "P_Bu_McMa in component Q_Bu (mole_per_day)" legend_algebraic[101] = "P_Bu_McAm in component Q_Bu (mole_per_day)" legend_algebraic[105] = "U_Bu_BuAb in component Q_Bu (mole_per_day)" legend_algebraic[109] = "U_Bu_BuEx in component Q_Bu (mole_per_day)" legend_algebraic[113] = "U_Hf_AmMa in component Q_Bu (mole_per_day)" legend_algebraic[117] = "U_Hf_AmMc in component Q_Bu (mole_per_day)" legend_algebraic[125] = "U_Hf_PsMa in component Q_Bu (mole_per_day)" legend_algebraic[129] = "U_Hf_PsMc in component Q_Bu (mole_per_day)" legend_algebraic[137] = "U_Hf_HaAs in component Q_Bu (mole_per_day)" legend_algebraic[141] = "U_Hf_McMa in component Q_Bu (mole_per_day)" legend_constants[132] = "M_Bu_BuAb in component Q_Bu (molar)" legend_constants[219] = "v_BuAb in component Q_Bu (mole_per_day)" legend_constants[133] = "v_BuAb_star in component Q_Bu (mole_per_litre_day)" legend_constants[211] = "Y_Bu_LaBu in component Q_Bu (dimensionless)" legend_algebraic[149] = "Y_Bu_HaVa in component Q_Bu (dimensionless)" legend_constants[213] = "Y_Bu_PsVa in component Q_Bu (dimensionless)" legend_algebraic[157] = "Y_Bu_AmMa in component Q_Bu (dimensionless)" legend_constants[214] = "Y_Bu_AmMc in component Q_Bu (dimensionless)" legend_algebraic[165] = "Y_Bu_PsMa in component Q_Bu (dimensionless)" legend_constants[215] = "Y_Bu_PsMc in component Q_Bu (dimensionless)" legend_algebraic[173] = "Y_Bu_HaAs in component Q_Bu (dimensionless)" legend_constants[216] = "Y_Bu_McMa in component Q_Bu (dimensionless)" legend_constants[217] = "Y_Bu_PsAm in component Q_Bu (dimensionless)" legend_constants[218] = "Y_Bu_McAm in component Q_Bu (dimensionless)" legend_constants[134] = "Y_Bu_WrBu in component Q_Bu (dimensionless)" legend_constants[135] = "Y_Bu_InBu in component Q_Bu (molar)" legend_constants[212] = "Y_Bu_HcVa in component Q_Bu (dimensionless)" legend_constants[136] = "Y_Bu_StBu in component Q_Bu (dimensionless)" legend_constants[137] = "Y_Bu_CeBu in component Q_Bu (dimensionless)" legend_constants[138] = "Y_Bu_HeBu in component Q_Bu (dimensionless)" legend_constants[139] = "Y_Bu_PsBu in component Q_Bu (dimensionless)" legend_constants[172] = "k_BuEx in component Q_Bu (first_order_rate_constant)" legend_constants[140] = "D_Bu in component Q_Bu (litre_per_day)" legend_constants[141] = "phi_pH_BuAb in component Q_Bu (dimensionless)" legend_constants[142] = "J_pH_BuAb in component Q_Bu (dimensionless)" legend_states[16] = "Q_Vl in component Q_Vl (mole)" legend_algebraic[86] = "C_Vl in component Q_Vl (molar)" legend_constants[220] = "P_Vl_InVl in component Q_Vl (mole_per_day)" legend_algebraic[162] = "P_Vl_AmMa in component Q_Vl (mole_per_day)" legend_algebraic[122] = "P_Vl_AmMc in component Q_Vl (mole_per_day)" legend_algebraic[170] = "P_Vl_PsMa in component Q_Vl (mole_per_day)" legend_algebraic[134] = "P_Vl_PsMc in component Q_Vl (mole_per_day)" legend_algebraic[178] = "P_Vl_HaAs in component Q_Vl (mole_per_day)" legend_algebraic[154] = "P_Vl_HaVa in component Q_Vl (mole_per_day)" legend_algebraic[90] = "P_Vl_HcVa in component Q_Vl (mole_per_day)" legend_algebraic[94] = "P_MaVl_PsAm in component Q_Vl (mole_per_day)" legend_algebraic[98] = "P_McVl_PsAm in component Q_Vl (mole_per_day)" legend_algebraic[146] = "P_Vl_McMa in component Q_Vl (mole_per_day)" legend_algebraic[102] = "P_Vl_McAm in component Q_Vl (mole_per_day)" legend_algebraic[106] = "U_Vl_VlAb in component Q_Vl (mole_per_day)" legend_algebraic[110] = "U_Vl_VlEx in component Q_Vl (mole_per_day)" legend_algebraic[114] = "U_Hf_AmMa in component Q_Vl (mole_per_day)" legend_algebraic[118] = "U_Hf_AmMc in component Q_Vl (mole_per_day)" legend_algebraic[126] = "U_Hf_PsMa in component Q_Vl (mole_per_day)" legend_algebraic[130] = "U_Hf_PsMc in component Q_Vl (mole_per_day)" legend_algebraic[138] = "U_Hf_HaAs in component Q_Vl (mole_per_day)" legend_algebraic[142] = "U_Hf_McMa in component Q_Vl (mole_per_day)" legend_constants[143] = "M_Vl_VlAb in component Q_Vl (molar)" legend_constants[229] = "v_VlAb in component Q_Vl (mole_per_day)" legend_constants[144] = "v_VlAb_star in component Q_Vl (mole_per_litre_day)" legend_constants[221] = "Y_Vl_LaVl in component Q_Vl (dimensionless)" legend_algebraic[150] = "Y_Vl_HaVa in component Q_Vl (dimensionless)" legend_constants[223] = "Y_Vl_PsVa in component Q_Vl (dimensionless)" legend_algebraic[158] = "Y_Vl_AmMa in component Q_Vl (dimensionless)" legend_constants[224] = "Y_Vl_AmMc in component Q_Vl (dimensionless)" legend_algebraic[166] = "Y_Vl_PsMa in component Q_Vl (dimensionless)" legend_constants[225] = "Y_Vl_PsMc in component Q_Vl (dimensionless)" legend_algebraic[174] = "Y_Vl_HaAs in component Q_Vl (dimensionless)" legend_constants[226] = "Y_Vl_McMa in component Q_Vl (dimensionless)" legend_constants[227] = "Y_Vl_PsAm in component Q_Vl (dimensionless)" legend_constants[228] = "Y_Vl_McAm in component Q_Vl (dimensionless)" legend_constants[145] = "Y_Vl_WrVl in component Q_Vl (dimensionless)" legend_constants[146] = "Y_Vl_InVl in component Q_Vl (molar)" legend_constants[222] = "Y_Vl_HcVa in component Q_Vl (dimensionless)" legend_constants[147] = "Y_Vl_StVl in component Q_Vl (dimensionless)" legend_constants[148] = "Y_Vl_CeVl in component Q_Vl (dimensionless)" legend_constants[149] = "Y_Vl_HeVl in component Q_Vl (dimensionless)" legend_constants[150] = "Y_Vl_PsVl in component Q_Vl (dimensionless)" legend_constants[173] = "k_VlEx in component Q_Vl (first_order_rate_constant)" legend_constants[151] = "D_Vl in component Q_Vl (litre_per_day)" legend_constants[152] = "phi_pH_VlAb in component Q_Vl (dimensionless)" legend_constants[153] = "J_pH_VlAb in component Q_Vl (dimensionless)" legend_rates[0] = "d/dt Q_Pd in component Q_Pd (mole)" legend_rates[3] = "d/dt Q_Ps in component Q_Ps (mole)" legend_rates[4] = "d/dt Q_Pu in component Q_Pu (mole)" legend_rates[5] = "d/dt Q_Am in component Q_Am (mole)" legend_rates[6] = "d/dt Q_Li in component Q_Li (mole)" legend_rates[7] = "d/dt Q_Sd in component Q_Sd (mole)" legend_rates[8] = "d/dt Q_Fd in component Q_Fd (mole)" legend_rates[9] = "d/dt Q_Fu in component Q_Fu (mole)" legend_rates[10] = "d/dt Q_Ha in component Q_Ha (mole)" legend_rates[11] = "d/dt Q_Hc in component Q_Hc (mole)" legend_rates[1] = "d/dt Q_Ma in component Q_Ma (gram)" legend_rates[12] = "d/dt Q_As in component Q_As (gram)" legend_rates[2] = "d/dt Q_Mc in component Q_Mc (gram)" legend_rates[13] = "d/dt Q_Ac in component Q_Ac (mole)" legend_rates[14] = "d/dt Q_Pr in component Q_Pr (mole)" legend_rates[15] = "d/dt Q_Bu in component Q_Bu (mole)" legend_rates[16] = "d/dt Q_Vl in component Q_Vl (mole)" return (legend_states, legend_algebraic, legend_voi, legend_constants) def initConsts(): constants = [0.0] * sizeConstants; states = [0.0] * sizeStates; states[0] = 1.000 constants[0] = 0.0576 constants[1] = 0.264 constants[2] = 0.0091 constants[3] = 1.000 constants[4] = 1.000 constants[5] = 0.66 states[1] = 1.000 states[2] = 1.000 constants[6] = 1.000 constants[7] = 1.000 constants[8] = 0.0248 states[3] = 1.000 constants[9] = 0.0144 constants[10] = 0.0576 constants[11] = 0.0576 constants[12] = 0.0091 constants[13] = 0.0010 constants[14] = 1.0 constants[15] = 0.0067 constants[16] = 0.0067 constants[17] = 1.000 constants[18] = 0.0289 constants[19] = 0.0224 constants[20] = 0.0224 constants[21] = 0.0248 constants[22] = 0.0248 constants[23] = 0.0165 constants[24] = 0.0165 constants[25] = 1.000 constants[26] = 0.0165 states[4] = 1.000 constants[27] = 0.0091 constants[28] = 1.000 states[5] = 1.000 constants[29] = 0.00165 constants[30] = 1.10 constants[31] = 0.0528 constants[32] = 0.0528 constants[33] = 0.0588 constants[34] = 2.0 constants[35] = 1.257 constants[36] = 0.0084 constants[37] = 0.00135 constants[38] = 0.00135 constants[39] = 0.0132 constants[40] = 7.5 constants[41] = 7.85 constants[42] = 0.0159 constants[43] = 0.0159 constants[44] = 0.00621 constants[45] = 1.000 constants[46] = 7.000 constants[47] = 0.35 constants[48] = 1.000 states[6] = 1.000 constants[49] = 0.0015 constants[50] = 0.00021 constants[51] = 1.000 states[7] = 1.000 constants[52] = 0.0062 constants[53] = 1.000 constants[54] = 0.2179 constants[55] = 0.416 constants[56] = 1.000 constants[57] = 1.04 states[8] = 1.000 constants[58] = 0.0062 constants[59] = 1.000 constants[60] = 0.1646 constants[61] = 0.332 constants[62] = 1.000 constants[63] = 0.83 constants[64] = 22.9 constants[65] = 5.97 constants[66] = 1.000 constants[67] = 1.000 states[9] = 1.000 constants[68] = 0.0062 constants[69] = 1.000 states[10] = 1.000 constants[70] = 1.793 constants[71] = 1.291 constants[72] = 0.0086 constants[73] = 0.0268 constants[74] = 0.055 constants[75] = 0.053 constants[76] = 0.1646 constants[77] = 0.0062 constants[78] = 0.0062 constants[79] = 0.0025 constants[80] = 1.0 constants[81] = 0.0062 constants[82] = 1.000 constants[83] = 1.000 constants[84] = 1.000 constants[85] = 0.00861 constants[86] = 0.01465 states[11] = 1.000 constants[87] = 1.793 constants[88] = 1.291 constants[89] = 0.1646 constants[90] = 1.0 constants[91] = 0.055 constants[92] = 0.00861 constants[93] = 0.01465 constants[94] = 118.91 constants[95] = 149.48 constants[96] = 149.48 states[12] = 1.000 constants[97] = 112.5 constants[98] = 118.91 constants[99] = 149.48 constants[100] = 15.439 constants[101] = 34.694 states[13] = 1.000 constants[102] = 0.338 constants[103] = 7.86 constants[104] = 1.000 constants[105] = 0.0167 constants[106] = 1.000 constants[107] = 1.000 constants[108] = 1.000 constants[109] = 1.000 constants[110] = 1.000 constants[111] = 6.45 constants[112] = 6.48 constants[113] = 0.526 constants[114] = 0.526 constants[115] = 0.711 constants[116] = 0.711 constants[117] = 0.306 constants[118] = 0.711 constants[119] = 2.250 constants[120] = 1.000 states[14] = 1.000 constants[121] = 0.338 constants[122] = 7.86 constants[123] = 1.000 constants[124] = 0.0135 constants[125] = 1.000 constants[126] = 1.000 constants[127] = 1.000 constants[128] = 1.000 constants[129] = 1.000 constants[130] = 6.48 constants[131] = 6.45 states[15] = 1.000 constants[132] = 0.338 constants[133] = 7.86 constants[134] = 1.000 constants[135] = 0.0114 constants[136] = 1.000 constants[137] = 1.000 constants[138] = 1.000 constants[139] = 1.000 constants[140] = 1.000 constants[141] = 6.48 constants[142] = 6.45 states[16] = 1.000 constants[143] = 0.338 constants[144] = 7.86 constants[145] = 1.000 constants[146] = 0.0098 constants[147] = 1.000 constants[148] = 1.000 constants[149] = 1.000 constants[150] = 1.000 constants[151] = 1.000 constants[152] = 6.48 constants[153] = 6.45 constants[154] = constants[7] constants[155] = constants[2]*constants[3] constants[156] = constants[25] constants[157] = constants[27]*constants[28] constants[158] = constants[7] constants[159] = constants[25] constants[160] = constants[25] constants[161] = constants[7] constants[162] = constants[7] constants[163] = constants[68]*constants[69] constants[164] = constants[7] constants[165] = constants[25] constants[166] = constants[25] constants[167] = constants[25] constants[168] = constants[25] constants[169] = constants[7] constants[170] = constants[25] constants[171] = constants[25] constants[172] = constants[25] constants[173] = constants[25] constants[174] = constants[1]*(constants[4]/constants[5]) constants[175] = constants[7]/2.00000 constants[176] = constants[12]*constants[17] constants[177] = constants[167]-constants[175] constants[178] = constants[167]-constants[175] constants[179] = constants[13]*constants[17] constants[180] = constants[33]*constants[45] constants[181] = constants[30]*(power(1.00000, 0.250000))*(power(constants[6], 0.750000))*(1.00000+power(constants[40]/constants[46], constants[41])) constants[182] = constants[49]*constants[51] constants[183] = constants[52]*constants[53] constants[184] = constants[55]*(constants[56]/constants[57]) constants[185] = constants[58]*constants[59] constants[186] = constants[61]*(constants[62]/constants[63]) constants[187] = constants[77]*constants[82] constants[188] = constants[78]*constants[83] constants[189] = constants[79]*constants[84] constants[190] = constants[105]*constants[110] constants[191] = constants[119]*constants[104] constants[192] = constants[120]*constants[107]+(1.00000-constants[120])*constants[108] constants[193] = constants[109] constants[194] = constants[192] constants[195] = constants[192] constants[196] = constants[192] constants[197] = constants[193] constants[198] = constants[193] constants[199] = constants[103]*(power(1.00000, 0.250000))*((power(constants[6], 0.750000))/(1.00000+power(constants[46]/constants[111], constants[112]))) constants[200] = constants[124]*constants[129] constants[201] = constants[119]*constants[123] constants[202] = constants[120]*constants[126]+(1.00000-constants[120])*constants[127] constants[203] = constants[128] constants[204] = constants[202] constants[205] = constants[202] constants[206] = constants[202] constants[207] = constants[203] constants[208] = constants[203] constants[209] = constants[122]*(power(1.00000, 0.250000))*((power(constants[6], 0.750000))/(1.00000+power(constants[46]/constants[131], constants[130]))) constants[210] = constants[135]*constants[140] constants[211] = constants[119]*constants[134] constants[212] = constants[120]*constants[137]+(1.00000-constants[120])*constants[138] constants[213] = constants[139] constants[214] = constants[212] constants[215] = constants[212] constants[216] = constants[212] constants[217] = constants[213] constants[218] = constants[213] constants[219] = constants[133]*(power(1.00000, 0.250000))*((power(constants[6], 0.750000))/(1.00000+power(constants[46]/constants[142], constants[141]))) constants[220] = constants[146]*constants[151] constants[221] = constants[119]*constants[145] constants[222] = constants[120]*constants[148]+(1.00000-constants[120])*constants[149] constants[223] = constants[150] constants[224] = constants[222] constants[225] = constants[222] constants[226] = constants[222] constants[227] = constants[223] constants[228] = constants[223] constants[229] = constants[144]*(power(1.00000, 0.250000))*((power(constants[6], 0.750000))/(1.00000+power(constants[46]/constants[153], constants[152]))) return (states, constants) def computeRates(voi, states, constants): rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic algebraic[2] = constants[158]*states[4] rates[4] = constants[157]-algebraic[2] algebraic[5] = constants[164]*states[9] rates[9] = constants[163]-algebraic[5] algebraic[0] = states[0]/constants[6] algebraic[9] = constants[0]*(states[1]+states[2]) algebraic[10] = algebraic[9]/(1.00000+constants[174]/algebraic[0]) algebraic[8] = constants[154]*states[0] rates[0] = constants[155]-(algebraic[10]+algebraic[8]) algebraic[26] = states[7]/constants[6] algebraic[28] = constants[54]*states[1] algebraic[29] = algebraic[28]/(1.00000+constants[184]/algebraic[26]) algebraic[27] = constants[161]*states[7] rates[7] = constants[183]-(algebraic[29]+algebraic[27]) algebraic[30] = states[8]/constants[6] algebraic[32] = constants[60]*states[2]*((1.00000-(voi*constants[67])/1.00000)+((voi*constants[67])/1.00000)/(1.00000+power(constants[65]/constants[66], constants[64]))) algebraic[33] = algebraic[32]/(1.00000+constants[186]/algebraic[30]) algebraic[31] = constants[162]*states[8] rates[8] = constants[185]-(algebraic[33]+algebraic[31]) algebraic[11] = states[3]/constants[6] algebraic[17] = constants[11]*states[2] algebraic[47] = states[11]/constants[6] algebraic[49] = algebraic[17]/(1.00000+constants[20]/algebraic[11]+constants[22]/algebraic[47]) algebraic[54] = constants[88]*algebraic[49] algebraic[18] = states[5]/constants[6] algebraic[24] = constants[32]*states[2] algebraic[51] = algebraic[24]/(1.00000+constants[38]/algebraic[18]+constants[43]/algebraic[47]) algebraic[53] = constants[87]*algebraic[51] algebraic[56] = constants[89]*states[2] algebraic[57] = algebraic[56]/((1.00000+constants[91]/algebraic[47])*(1.00000+algebraic[18]/constants[92]+algebraic[11]/constants[93])) algebraic[52] = constants[90]*algebraic[33] algebraic[55] = constants[166]*states[11] rates[11] = algebraic[52]-(algebraic[53]+algebraic[54]+algebraic[57]+algebraic[55]) algebraic[61] = constants[177]*states[1]*constants[47] algebraic[63] = constants[50]*algebraic[61] algebraic[25] = constants[160]*states[6] rates[6] = (constants[182]+algebraic[63])-algebraic[25] algebraic[66] = constants[178]*states[12]*constants[47] algebraic[34] = states[10]/constants[6] algebraic[43] = constants[75]*states[1] algebraic[44] = algebraic[43]/(1.00000+constants[73]/algebraic[34]) algebraic[65] = constants[97]*algebraic[44] algebraic[70] = constants[175]*states[12]*constants[47] algebraic[68] = constants[168]*states[12]*(1.00000-constants[47]) rates[12] = algebraic[65]-(algebraic[66]+algebraic[68]+algebraic[70]) algebraic[58] = states[1]/constants[6] algebraic[69] = states[2]/constants[6] algebraic[74] = (constants[100]*states[1]*constants[47]*algebraic[69])/(algebraic[69]+algebraic[58]*(1.00000-constants[47])) algebraic[75] = algebraic[74]/(1.00000+constants[101]/(algebraic[69]+algebraic[58]*(1.00000-constants[47]))) algebraic[71] = constants[98]*algebraic[51] algebraic[72] = constants[99]*algebraic[49] algebraic[73] = constants[169]*states[2] rates[2] = (algebraic[71]+algebraic[72])-(algebraic[75]+algebraic[73]) algebraic[15] = constants[9]*states[2] algebraic[48] = algebraic[15]/(1.00000+constants[18]/algebraic[11]+algebraic[47]/constants[24]) algebraic[16] = constants[10]*states[1] algebraic[36] = algebraic[16]/(1.00000+constants[19]/algebraic[11]+constants[21]/algebraic[34]) algebraic[14] = constants[9]*states[1] algebraic[35] = algebraic[14]/(1.00000+constants[18]/algebraic[11]+algebraic[34]/constants[23]) algebraic[12] = constants[14]*algebraic[10] algebraic[62] = constants[15]*algebraic[61] algebraic[76] = algebraic[75]*(1.00000-(1.00000/(1.00000+algebraic[34]/constants[26])+1.00000/(1.00000+constants[8]/algebraic[34]))) algebraic[78] = constants[16]*algebraic[76] algebraic[13] = constants[156]*states[3] rates[3] = (constants[176]+algebraic[12]+algebraic[62]+constants[179]+algebraic[78])-(algebraic[35]+algebraic[48]+algebraic[36]+algebraic[49]+algebraic[13]) algebraic[23] = constants[31]*states[1]*(1.00000-constants[47]) algebraic[38] = algebraic[23]/(1.00000+constants[37]/algebraic[18]+constants[42]/algebraic[34]) algebraic[21] = constants[29]*constants[6]*(constants[48]/(1.00000+algebraic[18]/constants[44])) algebraic[22] = constants[34]*algebraic[21] algebraic[37] = constants[35]*algebraic[35] algebraic[50] = constants[35]*algebraic[48] algebraic[77] = (1.00000*algebraic[75])/(1.00000+algebraic[34]/constants[26]) algebraic[79] = constants[36]*algebraic[77] algebraic[19] = constants[181]/(1.00000+constants[39]/algebraic[18]) algebraic[20] = constants[159]*states[5] rates[5] = (constants[180]+algebraic[37]+algebraic[50]+algebraic[22]+algebraic[79])-(algebraic[19]+algebraic[38]+algebraic[51]+algebraic[20]) algebraic[80] = algebraic[75]/(1.00000+constants[8]/algebraic[34]) algebraic[82] = constants[72]*algebraic[80] algebraic[40] = constants[70]*algebraic[38] algebraic[41] = constants[71]*algebraic[36] algebraic[45] = constants[76]*states[1] algebraic[46] = algebraic[45]*((1.00000-constants[47])/((1.00000+constants[74]/algebraic[34])*(1.00000+algebraic[18]/constants[85])*(algebraic[11]/constants[86])))+(algebraic[45]*constants[47])/(1.00000+constants[74]/algebraic[34]) algebraic[39] = constants[80]*algebraic[29] algebraic[67] = constants[81]*algebraic[66] algebraic[42] = constants[165]*states[10] rates[10] = (constants[187]+constants[188]+algebraic[39]+algebraic[67]+constants[189])-(algebraic[40]+algebraic[41]+algebraic[82]+algebraic[44]+algebraic[46]+algebraic[42]) algebraic[59] = constants[94]*algebraic[38] algebraic[60] = constants[95]*algebraic[36] algebraic[81] = constants[96]*algebraic[80] algebraic[64] = constants[175]*states[1]*constants[47] rates[1] = (algebraic[59]+algebraic[60]+algebraic[81])-(algebraic[61]+algebraic[80]+algebraic[64]) algebraic[111] = constants[113]*algebraic[40] algebraic[147] = (constants[104]*constants[187]+constants[191]*constants[189]+constants[106]*(constants[188]+algebraic[39]+algebraic[67]))/(constants[187]+constants[189]+constants[188]+algebraic[39]+algebraic[67]) algebraic[155] = algebraic[147] algebraic[159] = algebraic[155]*algebraic[111] algebraic[115] = constants[114]*algebraic[53] algebraic[119] = constants[194]*algebraic[115] algebraic[123] = constants[115]*algebraic[41] algebraic[163] = algebraic[147] algebraic[167] = algebraic[163]*algebraic[123] algebraic[127] = constants[116]*algebraic[54] algebraic[131] = constants[195]*algebraic[127] algebraic[135] = constants[117]*algebraic[44] algebraic[171] = algebraic[147] algebraic[175] = algebraic[171]*algebraic[135] algebraic[151] = algebraic[147]*algebraic[46] algebraic[87] = constants[192]*algebraic[57] algebraic[91] = constants[197]*algebraic[35] algebraic[95] = constants[197]*algebraic[48] algebraic[139] = constants[118]*algebraic[82] algebraic[143] = constants[196]*algebraic[139] algebraic[99] = constants[198]*algebraic[77] algebraic[83] = states[13]/constants[6] algebraic[103] = constants[199]/(1.00000+constants[102]/algebraic[83]) algebraic[107] = constants[170]*states[13] rates[13] = (constants[190]+algebraic[159]+algebraic[119]+algebraic[167]+algebraic[131]+algebraic[175]+algebraic[151]+algebraic[87]+algebraic[91]+algebraic[95]+algebraic[143]+algebraic[99])-(algebraic[103]+algebraic[107]) algebraic[112] = constants[113]*algebraic[40] algebraic[148] = (constants[123]*constants[187]+constants[201]*constants[189]+constants[125]*(constants[188]+algebraic[39]+algebraic[67]))/(constants[187]+constants[189]+constants[188]+algebraic[39]+algebraic[67]) algebraic[156] = algebraic[148] algebraic[160] = algebraic[156]*algebraic[112] algebraic[116] = constants[114]*algebraic[53] algebraic[120] = constants[204]*algebraic[116] algebraic[124] = constants[115]*algebraic[41] algebraic[164] = algebraic[148] algebraic[168] = algebraic[164]*algebraic[124] algebraic[128] = constants[116]*algebraic[54] algebraic[132] = constants[205]*algebraic[128] algebraic[136] = constants[117]*algebraic[44] algebraic[172] = algebraic[148] algebraic[176] = algebraic[172]*algebraic[136] algebraic[152] = algebraic[148]*algebraic[46] algebraic[88] = constants[202]*algebraic[57] algebraic[92] = constants[207]*algebraic[35] algebraic[96] = constants[207]*algebraic[48] algebraic[140] = constants[118]*algebraic[82] algebraic[144] = constants[206]*algebraic[140] algebraic[100] = constants[208]*algebraic[77] algebraic[84] = states[14]/constants[6] algebraic[104] = constants[209]/(1.00000+constants[121]/algebraic[84]) algebraic[108] = constants[171]*states[14] rates[14] = (constants[200]+algebraic[160]+algebraic[120]+algebraic[168]+algebraic[132]+algebraic[176]+algebraic[152]+algebraic[88]+algebraic[92]+algebraic[96]+algebraic[144]+algebraic[100])-(algebraic[104]+algebraic[108]) algebraic[113] = constants[113]*algebraic[40] algebraic[149] = (constants[134]*constants[187]+constants[211]*constants[189]+constants[136]*(constants[188]+algebraic[39]+algebraic[67]))/(constants[187]+constants[189]+constants[188]+algebraic[39]+algebraic[67]) algebraic[157] = algebraic[149] algebraic[161] = algebraic[157]*algebraic[113] algebraic[117] = constants[114]*algebraic[53] algebraic[121] = constants[214]*algebraic[117] algebraic[125] = constants[115]*algebraic[41] algebraic[165] = algebraic[149] algebraic[169] = algebraic[165]*algebraic[125] algebraic[129] = constants[116]*algebraic[54] algebraic[133] = constants[215]*algebraic[129] algebraic[137] = constants[117]*algebraic[44] algebraic[173] = algebraic[149] algebraic[177] = algebraic[173]*algebraic[137] algebraic[153] = algebraic[149]*algebraic[46] algebraic[89] = constants[212]*algebraic[57] algebraic[93] = constants[217]*algebraic[35] algebraic[97] = constants[217]*algebraic[48] algebraic[141] = constants[118]*algebraic[82] algebraic[145] = constants[216]*algebraic[141] algebraic[101] = constants[218]*algebraic[77] algebraic[85] = states[15]/constants[6] algebraic[105] = constants[219]/(1.00000+constants[132]/algebraic[85]) algebraic[109] = constants[172]*states[15] rates[15] = (constants[210]+algebraic[161]+algebraic[121]+algebraic[169]+algebraic[133]+algebraic[177]+algebraic[153]+algebraic[89]+algebraic[93]+algebraic[97]+algebraic[145]+algebraic[101])-(algebraic[105]+algebraic[109]) algebraic[114] = constants[113]*algebraic[40] algebraic[150] = (constants[145]*constants[187]+constants[221]*constants[189]+constants[147]*(constants[188]+algebraic[39]+algebraic[67]))/(constants[187]+constants[189]+constants[188]+algebraic[39]+algebraic[67]) algebraic[158] = algebraic[150] algebraic[162] = algebraic[158]*algebraic[114] algebraic[118] = constants[114]*algebraic[53] algebraic[122] = constants[224]*algebraic[118] algebraic[126] = constants[115]*algebraic[41] algebraic[166] = algebraic[150] algebraic[170] = algebraic[166]*algebraic[126] algebraic[130] = constants[116]*algebraic[54] algebraic[134] = constants[225]*algebraic[130] algebraic[138] = constants[117]*algebraic[44] algebraic[174] = algebraic[150] algebraic[178] = algebraic[174]*algebraic[138] algebraic[154] = algebraic[150]*algebraic[46] algebraic[90] = constants[222]*algebraic[57] algebraic[94] = constants[227]*algebraic[35] algebraic[98] = constants[227]*algebraic[48] algebraic[142] = constants[118]*algebraic[82] algebraic[146] = constants[226]*algebraic[142] algebraic[102] = constants[228]*algebraic[77] algebraic[86] = states[16]/constants[6] algebraic[106] = constants[229]/(1.00000+constants[143]/algebraic[86]) algebraic[110] = constants[173]*states[16] rates[16] = (constants[220]+algebraic[162]+algebraic[122]+algebraic[170]+algebraic[134]+algebraic[178]+algebraic[154]+algebraic[90]+algebraic[94]+algebraic[98]+algebraic[146]+algebraic[102])-(algebraic[106]+algebraic[110]) return(rates) def computeAlgebraic(constants, states, voi): algebraic = array([[0.0] * len(voi)] * sizeAlgebraic) states = array(states) voi = array(voi) algebraic[2] = constants[158]*states[4] algebraic[5] = constants[164]*states[9] algebraic[0] = states[0]/constants[6] algebraic[9] = constants[0]*(states[1]+states[2]) algebraic[10] = algebraic[9]/(1.00000+constants[174]/algebraic[0]) algebraic[8] = constants[154]*states[0] algebraic[26] = states[7]/constants[6] algebraic[28] = constants[54]*states[1] algebraic[29] = algebraic[28]/(1.00000+constants[184]/algebraic[26]) algebraic[27] = constants[161]*states[7] algebraic[30] = states[8]/constants[6] algebraic[32] = constants[60]*states[2]*((1.00000-(voi*constants[67])/1.00000)+((voi*constants[67])/1.00000)/(1.00000+power(constants[65]/constants[66], constants[64]))) algebraic[33] = algebraic[32]/(1.00000+constants[186]/algebraic[30]) algebraic[31] = constants[162]*states[8] algebraic[11] = states[3]/constants[6] algebraic[17] = constants[11]*states[2] algebraic[47] = states[11]/constants[6] algebraic[49] = algebraic[17]/(1.00000+constants[20]/algebraic[11]+constants[22]/algebraic[47]) algebraic[54] = constants[88]*algebraic[49] algebraic[18] = states[5]/constants[6] algebraic[24] = constants[32]*states[2] algebraic[51] = algebraic[24]/(1.00000+constants[38]/algebraic[18]+constants[43]/algebraic[47]) algebraic[53] = constants[87]*algebraic[51] algebraic[56] = constants[89]*states[2] algebraic[57] = algebraic[56]/((1.00000+constants[91]/algebraic[47])*(1.00000+algebraic[18]/constants[92]+algebraic[11]/constants[93])) algebraic[52] = constants[90]*algebraic[33] algebraic[55] = constants[166]*states[11] algebraic[61] = constants[177]*states[1]*constants[47] algebraic[63] = constants[50]*algebraic[61] algebraic[25] = constants[160]*states[6] algebraic[66] = constants[178]*states[12]*constants[47] algebraic[34] = states[10]/constants[6] algebraic[43] = constants[75]*states[1] algebraic[44] = algebraic[43]/(1.00000+constants[73]/algebraic[34]) algebraic[65] = constants[97]*algebraic[44] algebraic[70] = constants[175]*states[12]*constants[47] algebraic[68] = constants[168]*states[12]*(1.00000-constants[47]) algebraic[58] = states[1]/constants[6] algebraic[69] = states[2]/constants[6] algebraic[74] = (constants[100]*states[1]*constants[47]*algebraic[69])/(algebraic[69]+algebraic[58]*(1.00000-constants[47])) algebraic[75] = algebraic[74]/(1.00000+constants[101]/(algebraic[69]+algebraic[58]*(1.00000-constants[47]))) algebraic[71] = constants[98]*algebraic[51] algebraic[72] = constants[99]*algebraic[49] algebraic[73] = constants[169]*states[2] algebraic[15] = constants[9]*states[2] algebraic[48] = algebraic[15]/(1.00000+constants[18]/algebraic[11]+algebraic[47]/constants[24]) algebraic[16] = constants[10]*states[1] algebraic[36] = algebraic[16]/(1.00000+constants[19]/algebraic[11]+constants[21]/algebraic[34]) algebraic[14] = constants[9]*states[1] algebraic[35] = algebraic[14]/(1.00000+constants[18]/algebraic[11]+algebraic[34]/constants[23]) algebraic[12] = constants[14]*algebraic[10] algebraic[62] = constants[15]*algebraic[61] algebraic[76] = algebraic[75]*(1.00000-(1.00000/(1.00000+algebraic[34]/constants[26])+1.00000/(1.00000+constants[8]/algebraic[34]))) algebraic[78] = constants[16]*algebraic[76] algebraic[13] = constants[156]*states[3] algebraic[23] = constants[31]*states[1]*(1.00000-constants[47]) algebraic[38] = algebraic[23]/(1.00000+constants[37]/algebraic[18]+constants[42]/algebraic[34]) algebraic[21] = constants[29]*constants[6]*(constants[48]/(1.00000+algebraic[18]/constants[44])) algebraic[22] = constants[34]*algebraic[21] algebraic[37] = constants[35]*algebraic[35] algebraic[50] = constants[35]*algebraic[48] algebraic[77] = (1.00000*algebraic[75])/(1.00000+algebraic[34]/constants[26]) algebraic[79] = constants[36]*algebraic[77] algebraic[19] = constants[181]/(1.00000+constants[39]/algebraic[18]) algebraic[20] = constants[159]*states[5] algebraic[80] = algebraic[75]/(1.00000+constants[8]/algebraic[34]) algebraic[82] = constants[72]*algebraic[80] algebraic[40] = constants[70]*algebraic[38] algebraic[41] = constants[71]*algebraic[36] algebraic[45] = constants[76]*states[1] algebraic[46] = algebraic[45]*((1.00000-constants[47])/((1.00000+constants[74]/algebraic[34])*(1.00000+algebraic[18]/constants[85])*(algebraic[11]/constants[86])))+(algebraic[45]*constants[47])/(1.00000+constants[74]/algebraic[34]) algebraic[39] = constants[80]*algebraic[29] algebraic[67] = constants[81]*algebraic[66] algebraic[42] = constants[165]*states[10] algebraic[59] = constants[94]*algebraic[38] algebraic[60] = constants[95]*algebraic[36] algebraic[81] = constants[96]*algebraic[80] algebraic[64] = constants[175]*states[1]*constants[47] algebraic[111] = constants[113]*algebraic[40] algebraic[147] = (constants[104]*constants[187]+constants[191]*constants[189]+constants[106]*(constants[188]+algebraic[39]+algebraic[67]))/(constants[187]+constants[189]+constants[188]+algebraic[39]+algebraic[67]) algebraic[155] = algebraic[147] algebraic[159] = algebraic[155]*algebraic[111] algebraic[115] = constants[114]*algebraic[53] algebraic[119] = constants[194]*algebraic[115] algebraic[123] = constants[115]*algebraic[41] algebraic[163] = algebraic[147] algebraic[167] = algebraic[163]*algebraic[123] algebraic[127] = constants[116]*algebraic[54] algebraic[131] = constants[195]*algebraic[127] algebraic[135] = constants[117]*algebraic[44] algebraic[171] = algebraic[147] algebraic[175] = algebraic[171]*algebraic[135] algebraic[151] = algebraic[147]*algebraic[46] algebraic[87] = constants[192]*algebraic[57] algebraic[91] = constants[197]*algebraic[35] algebraic[95] = constants[197]*algebraic[48] algebraic[139] = constants[118]*algebraic[82] algebraic[143] = constants[196]*algebraic[139] algebraic[99] = constants[198]*algebraic[77] algebraic[83] = states[13]/constants[6] algebraic[103] = constants[199]/(1.00000+constants[102]/algebraic[83]) algebraic[107] = constants[170]*states[13] algebraic[112] = constants[113]*algebraic[40] algebraic[148] = (constants[123]*constants[187]+constants[201]*constants[189]+constants[125]*(constants[188]+algebraic[39]+algebraic[67]))/(constants[187]+constants[189]+constants[188]+algebraic[39]+algebraic[67]) algebraic[156] = algebraic[148] algebraic[160] = algebraic[156]*algebraic[112] algebraic[116] = constants[114]*algebraic[53] algebraic[120] = constants[204]*algebraic[116] algebraic[124] = constants[115]*algebraic[41] algebraic[164] = algebraic[148] algebraic[168] = algebraic[164]*algebraic[124] algebraic[128] = constants[116]*algebraic[54] algebraic[132] = constants[205]*algebraic[128] algebraic[136] = constants[117]*algebraic[44] algebraic[172] = algebraic[148] algebraic[176] = algebraic[172]*algebraic[136] algebraic[152] = algebraic[148]*algebraic[46] algebraic[88] = constants[202]*algebraic[57] algebraic[92] = constants[207]*algebraic[35] algebraic[96] = constants[207]*algebraic[48] algebraic[140] = constants[118]*algebraic[82] algebraic[144] = constants[206]*algebraic[140] algebraic[100] = constants[208]*algebraic[77] algebraic[84] = states[14]/constants[6] algebraic[104] = constants[209]/(1.00000+constants[121]/algebraic[84]) algebraic[108] = constants[171]*states[14] algebraic[113] = constants[113]*algebraic[40] algebraic[149] = (constants[134]*constants[187]+constants[211]*constants[189]+constants[136]*(constants[188]+algebraic[39]+algebraic[67]))/(constants[187]+constants[189]+constants[188]+algebraic[39]+algebraic[67]) algebraic[157] = algebraic[149] algebraic[161] = algebraic[157]*algebraic[113] algebraic[117] = constants[114]*algebraic[53] algebraic[121] = constants[214]*algebraic[117] algebraic[125] = constants[115]*algebraic[41] algebraic[165] = algebraic[149] algebraic[169] = algebraic[165]*algebraic[125] algebraic[129] = constants[116]*algebraic[54] algebraic[133] = constants[215]*algebraic[129] algebraic[137] = constants[117]*algebraic[44] algebraic[173] = algebraic[149] algebraic[177] = algebraic[173]*algebraic[137] algebraic[153] = algebraic[149]*algebraic[46] algebraic[89] = constants[212]*algebraic[57] algebraic[93] = constants[217]*algebraic[35] algebraic[97] = constants[217]*algebraic[48] algebraic[141] = constants[118]*algebraic[82] algebraic[145] = constants[216]*algebraic[141] algebraic[101] = constants[218]*algebraic[77] algebraic[85] = states[15]/constants[6] algebraic[105] = constants[219]/(1.00000+constants[132]/algebraic[85]) algebraic[109] = constants[172]*states[15] algebraic[114] = constants[113]*algebraic[40] algebraic[150] = (constants[145]*constants[187]+constants[221]*constants[189]+constants[147]*(constants[188]+algebraic[39]+algebraic[67]))/(constants[187]+constants[189]+constants[188]+algebraic[39]+algebraic[67]) algebraic[158] = algebraic[150] algebraic[162] = algebraic[158]*algebraic[114] algebraic[118] = constants[114]*algebraic[53] algebraic[122] = constants[224]*algebraic[118] algebraic[126] = constants[115]*algebraic[41] algebraic[166] = algebraic[150] algebraic[170] = algebraic[166]*algebraic[126] algebraic[130] = constants[116]*algebraic[54] algebraic[134] = constants[225]*algebraic[130] algebraic[138] = constants[117]*algebraic[44] algebraic[174] = algebraic[150] algebraic[178] = algebraic[174]*algebraic[138] algebraic[154] = algebraic[150]*algebraic[46] algebraic[90] = constants[222]*algebraic[57] algebraic[94] = constants[227]*algebraic[35] algebraic[98] = constants[227]*algebraic[48] algebraic[142] = constants[118]*algebraic[82] algebraic[146] = constants[226]*algebraic[142] algebraic[102] = constants[228]*algebraic[77] algebraic[86] = states[16]/constants[6] algebraic[106] = constants[229]/(1.00000+constants[143]/algebraic[86]) algebraic[110] = constants[173]*states[16] algebraic[1] = states[4]/constants[6] algebraic[3] = states[6]/constants[6] algebraic[4] = states[9]/constants[6] algebraic[6] = constants[167]*states[1]*(1.00000-constants[47]) algebraic[7] = states[12]/constants[6] return algebraic 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)