# Size of variable arrays:
sizeAlgebraic = 132
sizeStates = 94
sizeConstants = 82
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 (minute)"
legend_states[0] = "c1 in component c1 (molecules)"
legend_algebraic[0] = "v1 in component v1 (flux)"
legend_states[1] = "c2 in component c2 (molecules)"
legend_algebraic[10] = "v6 in component v6 (flux)"
legend_constants[80] = "v13 in component v13 (flux)"
legend_states[2] = "c3 in component c3 (molecules)"
legend_algebraic[7] = "v2 in component v2 (flux)"
legend_states[3] = "c4 in component c4 (molecules)"
legend_algebraic[8] = "v3 in component v3 (flux)"
legend_states[4] = "c5 in component c5 (molecules)"
legend_algebraic[11] = "v7 in component v7 (flux)"
legend_algebraic[12] = "v8 in component v8 (flux)"
legend_states[5] = "c6 in component c6 (molecules)"
legend_algebraic[14] = "v10 in component v10 (flux)"
legend_algebraic[15] = "v60 in component v60 (flux)"
legend_states[6] = "c7 in component c7 (molecules)"
legend_algebraic[9] = "v4 in component v4 (flux)"
legend_algebraic[124] = "v5 in component v5 (flux)"
legend_states[7] = "c8 in component c8 (molecules)"
legend_algebraic[18] = "v12 in component v12 (flux)"
legend_algebraic[19] = "v14 in component v14 (flux)"
legend_algebraic[20] = "v62 in component v62 (flux)"
legend_states[8] = "c9 in component c9 (molecules)"
legend_algebraic[21] = "v15 in component v15 (flux)"
legend_algebraic[125] = "v107 in component v107 (flux)"
legend_algebraic[126] = "v110 in component v110 (flux)"
legend_algebraic[127] = "v113 in component v113 (flux)"
legend_algebraic[128] = "v116 in component v116 (flux)"
legend_algebraic[129] = "v119 in component v119 (flux)"
legend_algebraic[130] = "v122 in component v122 (flux)"
legend_algebraic[131] = "v125 in component v125 (flux)"
legend_states[9] = "c10 in component c10 (molecules)"
legend_algebraic[16] = "v11 in component v11 (flux)"
legend_states[10] = "c11 in component c11 (molecules)"
legend_states[11] = "c12 in component c12 (molecules)"
legend_algebraic[102] = "v106 in component v106 (flux)"
legend_algebraic[107] = "v109 in component v109 (flux)"
legend_algebraic[111] = "v112 in component v112 (flux)"
legend_algebraic[115] = "v115 in component v115 (flux)"
legend_algebraic[117] = "v118 in component v118 (flux)"
legend_algebraic[119] = "v121 in component v121 (flux)"
legend_algebraic[121] = "v124 in component v124 (flux)"
legend_states[12] = "c13 in component c13 (molecules)"
legend_algebraic[17] = "v61 in component v61 (flux)"
legend_states[13] = "c14 in component c14 (molecules)"
legend_states[14] = "c15 in component c15 (molecules)"
legend_algebraic[22] = "v16 in component v16 (flux)"
legend_algebraic[28] = "v22 in component v22 (flux)"
legend_algebraic[38] = "v32 in component v32 (flux)"
legend_algebraic[40] = "v34 in component v34 (flux)"
legend_algebraic[43] = "v37 in component v37 (flux)"
legend_algebraic[45] = "v39 in component v39 (flux)"
legend_algebraic[95] = "v102 in component v102 (flux)"
legend_states[15] = "c16 in component c16 (molecules)"
legend_states[16] = "c17 in component c17 (molecules)"
legend_algebraic[66] = "v63 in component v63 (flux)"
legend_algebraic[72] = "v69 in component v69 (flux)"
legend_algebraic[86] = "v79 in component v79 (flux)"
legend_algebraic[88] = "v80 in component v80 (flux)"
legend_algebraic[90] = "v81 in component v81 (flux)"
legend_algebraic[92] = "v82 in component v82 (flux)"
legend_states[17] = "c18 in component c18 (molecules)"
legend_algebraic[13] = "v9 in component v9 (flux)"
legend_algebraic[67] = "v64 in component v64 (flux)"
legend_states[18] = "c19 in component c19 (molecules)"
legend_algebraic[68] = "v65 in component v65 (flux)"
legend_algebraic[69] = "v66 in component v66 (flux)"
legend_algebraic[70] = "v67 in component v67 (flux)"
legend_algebraic[71] = "v68 in component v68 (flux)"
legend_algebraic[98] = "v105 in component v105 (flux)"
legend_states[19] = "c20 in component c20 (molecules)"
legend_algebraic[105] = "v108 in component v108 (flux)"
legend_states[20] = "c21 in component c21 (molecules)"
legend_algebraic[109] = "v111 in component v111 (flux)"
legend_states[21] = "c22 in component c22 (molecules)"
legend_algebraic[30] = "v24 in component v24 (flux)"
legend_algebraic[41] = "v35 in component v35 (flux)"
legend_algebraic[44] = "v38 in component v38 (flux)"
legend_algebraic[74] = "v71 in component v71 (flux)"
legend_states[22] = "c23 in component c23 (molecules)"
legend_algebraic[23] = "v17 in component v17 (flux)"
legend_states[23] = "c24 in component c24 (molecules)"
legend_algebraic[76] = "v72 in component v72 (flux)"
legend_algebraic[31] = "v25 in component v25 (flux)"
legend_algebraic[46] = "v40 in component v40 (flux)"
legend_states[24] = "c25 in component c25 (molecules)"
legend_algebraic[24] = "v18 in component v18 (flux)"
legend_algebraic[25] = "v19 in component v19 (flux)"
legend_algebraic[26] = "v20 in component v20 (flux)"
legend_algebraic[27] = "v21 in component v21 (flux)"
legend_states[25] = "c26 in component c26 (molecules)"
legend_algebraic[32] = "v26 in component v26 (flux)"
legend_algebraic[37] = "v31 in component v31 (flux)"
legend_algebraic[83] = "v78 in component v78 (flux)"
legend_algebraic[77] = "v73 in component v73 (flux)"
legend_states[26] = "c27 in component c27 (molecules)"
legend_states[27] = "c28 in component c28 (molecules)"
legend_algebraic[33] = "v27 in component v27 (flux)"
legend_algebraic[34] = "v28 in component v28 (flux)"
legend_states[28] = "c29 in component c29 (molecules)"
legend_states[29] = "c30 in component c30 (molecules)"
legend_algebraic[39] = "v33 in component v33 (flux)"
legend_algebraic[47] = "v41 in component v41 (flux)"
legend_algebraic[94] = "v83 in component v83 (flux)"
legend_states[30] = "c31 in component c31 (molecules)"
legend_algebraic[42] = "v36 in component v36 (flux)"
legend_states[31] = "c32 in component c32 (molecules)"
legend_algebraic[29] = "v23 in component v23 (flux)"
legend_algebraic[75] = "v103 in component v103 (flux)"
legend_states[32] = "c33 in component c33 (molecules)"
legend_algebraic[99] = "v104 in component v104 (flux)"
legend_states[33] = "c34 in component c34 (molecules)"
legend_algebraic[113] = "v114 in component v114 (flux)"
legend_states[34] = "c35 in component c35 (molecules)"
legend_algebraic[36] = "v30 in component v30 (flux)"
legend_algebraic[116] = "v117 in component v117 (flux)"
legend_states[35] = "c36 in component c36 (molecules)"
legend_algebraic[118] = "v120 in component v120 (flux)"
legend_states[36] = "c37 in component c37 (molecules)"
legend_algebraic[120] = "v123 in component v123 (flux)"
legend_states[37] = "c38 in component c38 (molecules)"
legend_states[38] = "c39 in component c39 (molecules)"
legend_states[39] = "c40 in component c40 (molecules)"
legend_states[40] = "c41 in component c41 (molecules)"
legend_algebraic[49] = "v43 in component v43 (flux)"
legend_algebraic[79] = "v75 in component v75 (flux)"
legend_algebraic[84] = "v85 in component v85 (flux)"
legend_states[41] = "c42 in component c42 (molecules)"
legend_algebraic[35] = "v29 in component v29 (flux)"
legend_states[42] = "c43 in component c43 (molecules)"
legend_states[43] = "c44 in component c44 (molecules)"
legend_algebraic[48] = "v42 in component v42 (flux)"
legend_algebraic[82] = "v84 in component v84 (flux)"
legend_states[44] = "c45 in component c45 (molecules)"
legend_algebraic[50] = "v44 in component v44 (flux)"
legend_algebraic[51] = "v45 in component v45 (flux)"
legend_algebraic[52] = "v46 in component v46 (flux)"
legend_algebraic[53] = "v47 in component v47 (flux)"
legend_states[45] = "c46 in component c46 (molecules)"
legend_states[46] = "c47 in component c47 (molecules)"
legend_algebraic[57] = "v51 in component v51 (flux)"
legend_algebraic[85] = "v86 in component v86 (flux)"
legend_algebraic[103] = "v93 in component v93 (flux)"
legend_states[47] = "c48 in component c48 (molecules)"
legend_states[48] = "c49 in component c49 (molecules)"
legend_algebraic[55] = "v49 in component v49 (flux)"
legend_algebraic[56] = "v50 in component v50 (flux)"
legend_states[49] = "c50 in component c50 (molecules)"
legend_states[50] = "c51 in component c51 (molecules)"
legend_algebraic[54] = "v48 in component v48 (flux)"
legend_algebraic[58] = "v52 in component v52 (flux)"
legend_algebraic[59] = "v53 in component v53 (flux)"
legend_algebraic[60] = "v54 in component v54 (flux)"
legend_algebraic[61] = "v55 in component v55 (flux)"
legend_states[51] = "c52 in component c52 (molecules)"
legend_states[52] = "c53 in component c53 (molecules)"
legend_algebraic[93] = "v90 in component v90 (flux)"
legend_algebraic[96] = "v91 in component v91 (flux)"
legend_algebraic[100] = "v92 in component v92 (flux)"
legend_states[53] = "c54 in component c54 (molecules)"
legend_states[54] = "c55 in component c55 (molecules)"
legend_algebraic[65] = "v59 in component v59 (flux)"
legend_algebraic[97] = "v94 in component v94 (flux)"
legend_algebraic[114] = "v101 in component v101 (flux)"
legend_states[55] = "c56 in component c56 (molecules)"
legend_states[56] = "c57 in component c57 (molecules)"
legend_algebraic[63] = "v57 in component v57 (flux)"
legend_algebraic[64] = "v58 in component v58 (flux)"
legend_states[57] = "c58 in component c58 (molecules)"
legend_states[58] = "c59 in component c59 (molecules)"
legend_algebraic[62] = "v56 in component v56 (flux)"
legend_states[59] = "c60 in component c60 (molecules)"
legend_algebraic[108] = "v98 in component v98 (flux)"
legend_algebraic[110] = "v99 in component v99 (flux)"
legend_algebraic[112] = "v100 in component v100 (flux)"
legend_states[60] = "c61 in component c61 (molecules)"
legend_states[61] = "c62 in component c62 (molecules)"
legend_states[62] = "c63 in component c63 (molecules)"
legend_algebraic[73] = "v70 in component v70 (flux)"
legend_states[63] = "c64 in component c64 (molecules)"
legend_states[64] = "c65 in component c65 (molecules)"
legend_states[65] = "c66 in component c66 (molecules)"
legend_algebraic[78] = "v74 in component v74 (flux)"
legend_algebraic[81] = "v77 in component v77 (flux)"
legend_states[66] = "c67 in component c67 (molecules)"
legend_states[67] = "c68 in component c68 (molecules)"
legend_states[68] = "c69 in component c69 (molecules)"
legend_states[69] = "c70 in component c70 (molecules)"
legend_algebraic[80] = "v76 in component v76 (flux)"
legend_states[70] = "c71 in component c71 (molecules)"
legend_states[71] = "c72 in component c72 (molecules)"
legend_algebraic[87] = "v87 in component v87 (flux)"
legend_algebraic[89] = "v88 in component v88 (flux)"
legend_algebraic[91] = "v89 in component v89 (flux)"
legend_states[72] = "c73 in component c73 (molecules)"
legend_states[73] = "c74 in component c74 (molecules)"
legend_states[74] = "c75 in component c75 (molecules)"
legend_states[75] = "c76 in component c76 (molecules)"
legend_states[76] = "c77 in component c77 (molecules)"
legend_algebraic[101] = "v95 in component v95 (flux)"
legend_algebraic[104] = "v96 in component v96 (flux)"
legend_algebraic[106] = "v97 in component v97 (flux)"
legend_states[77] = "c78 in component c78 (molecules)"
legend_states[78] = "c79 in component c79 (molecules)"
legend_states[79] = "c80 in component c80 (molecules)"
legend_states[80] = "c81 in component c81 (molecules)"
legend_states[81] = "c82 in component c82 (molecules)"
legend_states[82] = "c83 in component c83 (molecules)"
legend_states[83] = "c84 in component c84 (molecules)"
legend_states[84] = "c85 in component c85 (molecules)"
legend_states[85] = "c86 in component c86 (molecules)"
legend_states[86] = "c87 in component c87 (molecules)"
legend_states[87] = "c88 in component c88 (molecules)"
legend_states[88] = "c89 in component c89 (molecules)"
legend_states[89] = "c90 in component c90 (molecules)"
legend_states[90] = "c91 in component c91 (molecules)"
legend_states[91] = "c92 in component c92 (molecules)"
legend_states[92] = "c93 in component c93 (molecules)"
legend_states[93] = "c94 in component c94 (molecules)"
legend_algebraic[1] = "Raf_activation in component Raf_activation (molecules)"
legend_algebraic[2] = "MEKPP_total in component MEKPP_total (molecules)"
legend_algebraic[3] = "ERKPP_total in component ERKPP_total (molecules)"
legend_algebraic[4] = "Ras_GTP_total in component Ras_GTP_total (molecules)"
legend_algebraic[5] = "ShcP_total in component ShcP_total (molecules)"
legend_algebraic[6] = "EGF_EGFR_totalx2 in component EGF_EGFR_totalx2 (molecules)"
legend_constants[0] = "k1 in component reaction_rates (second_order_rate_constant)"
legend_constants[1] = "kd1 in component reaction_rates (first_order_rate_constant)"
legend_constants[2] = "k2 in component reaction_rates (second_order_rate_constant)"
legend_constants[3] = "kd2 in component reaction_rates (first_order_rate_constant)"
legend_constants[4] = "k3 in component reaction_rates (first_order_rate_constant)"
legend_constants[5] = "kd3 in component reaction_rates (first_order_rate_constant)"
legend_constants[6] = "k4 in component reaction_rates (second_order_rate_constant)"
legend_constants[7] = "kd4 in component reaction_rates (first_order_rate_constant)"
legend_algebraic[123] = "k5 in component reaction_rates (first_order_rate_constant)"
legend_constants[8] = "k6 in component reaction_rates (first_order_rate_constant)"
legend_constants[9] = "kd6 in component reaction_rates (first_order_rate_constant)"
legend_constants[10] = "k8 in component reaction_rates (second_order_rate_constant)"
legend_constants[11] = "kd8 in component reaction_rates (first_order_rate_constant)"
legend_constants[12] = "k10b in component reaction_rates (second_order_rate_constant)"
legend_constants[13] = "kd10 in component reaction_rates (first_order_rate_constant)"
legend_constants[14] = "k13 in component reaction_rates (first_order_rate_constant)"
legend_constants[15] = "k15 in component reaction_rates (first_order_rate_constant)"
legend_constants[16] = "k16 in component reaction_rates (second_order_rate_constant)"
legend_constants[17] = "kd16 in component reaction_rates (first_order_rate_constant)"
legend_constants[18] = "k17 in component reaction_rates (second_order_rate_constant)"
legend_constants[19] = "kd17 in component reaction_rates (first_order_rate_constant)"
legend_constants[20] = "k18 in component reaction_rates (second_order_rate_constant)"
legend_constants[21] = "kd18 in component reaction_rates (first_order_rate_constant)"
legend_constants[22] = "k19 in component reaction_rates (first_order_rate_constant)"
legend_constants[23] = "kd19 in component reaction_rates (second_order_rate_constant)"
legend_constants[24] = "k20 in component reaction_rates (second_order_rate_constant)"
legend_constants[25] = "kd20 in component reaction_rates (first_order_rate_constant)"
legend_constants[26] = "k21 in component reaction_rates (first_order_rate_constant)"
legend_constants[27] = "kd21 in component reaction_rates (second_order_rate_constant)"
legend_constants[28] = "k22 in component reaction_rates (second_order_rate_constant)"
legend_constants[29] = "kd22 in component reaction_rates (first_order_rate_constant)"
legend_constants[30] = "k23 in component reaction_rates (first_order_rate_constant)"
legend_constants[31] = "kd23 in component reaction_rates (first_order_rate_constant)"
legend_constants[32] = "kd24 in component reaction_rates (first_order_rate_constant)"
legend_constants[33] = "k25 in component reaction_rates (second_order_rate_constant)"
legend_constants[34] = "kd25 in component reaction_rates (first_order_rate_constant)"
legend_constants[35] = "k28 in component reaction_rates (second_order_rate_constant)"
legend_constants[36] = "kd28 in component reaction_rates (first_order_rate_constant)"
legend_constants[37] = "k29 in component reaction_rates (first_order_rate_constant)"
legend_constants[38] = "kd29 in component reaction_rates (second_order_rate_constant)"
legend_constants[39] = "k32 in component reaction_rates (first_order_rate_constant)"
legend_constants[40] = "kd32 in component reaction_rates (second_order_rate_constant)"
legend_constants[41] = "k33 in component reaction_rates (first_order_rate_constant)"
legend_constants[42] = "kd33 in component reaction_rates (second_order_rate_constant)"
legend_constants[43] = "k34 in component reaction_rates (first_order_rate_constant)"
legend_constants[44] = "kd34 in component reaction_rates (second_order_rate_constant)"
legend_constants[45] = "k35 in component reaction_rates (first_order_rate_constant)"
legend_constants[46] = "kd35 in component reaction_rates (second_order_rate_constant)"
legend_constants[47] = "Km36 in component reaction_rates (molecules)"
legend_constants[48] = "Vm36 in component reaction_rates (flux)"
legend_constants[49] = "k37 in component reaction_rates (first_order_rate_constant)"
legend_constants[50] = "kd37 in component reaction_rates (second_order_rate_constant)"
legend_constants[51] = "k40 in component reaction_rates (second_order_rate_constant)"
legend_constants[52] = "kd40 in component reaction_rates (first_order_rate_constant)"
legend_constants[53] = "k41 in component reaction_rates (second_order_rate_constant)"
legend_constants[54] = "kd41 in component reaction_rates (first_order_rate_constant)"
legend_constants[55] = "k42 in component reaction_rates (second_order_rate_constant)"
legend_constants[56] = "kd42 in component reaction_rates (first_order_rate_constant)"
legend_constants[57] = "k43 in component reaction_rates (first_order_rate_constant)"
legend_constants[58] = "k44 in component reaction_rates (second_order_rate_constant)"
legend_constants[59] = "kd44 in component reaction_rates (first_order_rate_constant)"
legend_constants[60] = "k45 in component reaction_rates (first_order_rate_constant)"
legend_constants[61] = "k47 in component reaction_rates (first_order_rate_constant)"
legend_constants[62] = "k48 in component reaction_rates (second_order_rate_constant)"
legend_constants[63] = "kd48 in component reaction_rates (first_order_rate_constant)"
legend_constants[64] = "k49 in component reaction_rates (first_order_rate_constant)"
legend_constants[65] = "k50 in component reaction_rates (second_order_rate_constant)"
legend_constants[66] = "kd50 in component reaction_rates (first_order_rate_constant)"
legend_constants[67] = "k52 in component reaction_rates (second_order_rate_constant)"
legend_constants[68] = "kd52 in component reaction_rates (first_order_rate_constant)"
legend_constants[69] = "k53 in component reaction_rates (first_order_rate_constant)"
legend_constants[70] = "k55 in component reaction_rates (first_order_rate_constant)"
legend_constants[71] = "k56 in component reaction_rates (second_order_rate_constant)"
legend_constants[72] = "kd56 in component reaction_rates (first_order_rate_constant)"
legend_constants[73] = "k57 in component reaction_rates (first_order_rate_constant)"
legend_constants[74] = "k58 in component reaction_rates (second_order_rate_constant)"
legend_constants[75] = "kd58 in component reaction_rates (first_order_rate_constant)"
legend_constants[76] = "k59 in component reaction_rates (first_order_rate_constant)"
legend_constants[77] = "k60 in component reaction_rates (first_order_rate_constant)"
legend_constants[78] = "k61 in component reaction_rates (first_order_rate_constant)"
legend_algebraic[122] = "C in component C (flux)"
legend_constants[79] = "RT in component C (molecules)"
legend_rates[0] = "d/dt c1 in component c1 (molecules)"
legend_rates[1] = "d/dt c2 in component c2 (molecules)"
legend_rates[2] = "d/dt c3 in component c3 (molecules)"
legend_rates[3] = "d/dt c4 in component c4 (molecules)"
legend_rates[4] = "d/dt c5 in component c5 (molecules)"
legend_rates[5] = "d/dt c6 in component c6 (molecules)"
legend_rates[6] = "d/dt c7 in component c7 (molecules)"
legend_rates[7] = "d/dt c8 in component c8 (molecules)"
legend_rates[8] = "d/dt c9 in component c9 (molecules)"
legend_rates[9] = "d/dt c10 in component c10 (molecules)"
legend_rates[10] = "d/dt c11 in component c11 (molecules)"
legend_rates[11] = "d/dt c12 in component c12 (molecules)"
legend_rates[12] = "d/dt c13 in component c13 (molecules)"
legend_rates[13] = "d/dt c14 in component c14 (molecules)"
legend_rates[14] = "d/dt c15 in component c15 (molecules)"
legend_rates[15] = "d/dt c16 in component c16 (molecules)"
legend_rates[16] = "d/dt c17 in component c17 (molecules)"
legend_rates[17] = "d/dt c18 in component c18 (molecules)"
legend_rates[18] = "d/dt c19 in component c19 (molecules)"
legend_rates[19] = "d/dt c20 in component c20 (molecules)"
legend_rates[20] = "d/dt c21 in component c21 (molecules)"
legend_rates[21] = "d/dt c22 in component c22 (molecules)"
legend_rates[22] = "d/dt c23 in component c23 (molecules)"
legend_rates[23] = "d/dt c24 in component c24 (molecules)"
legend_rates[24] = "d/dt c25 in component c25 (molecules)"
legend_rates[25] = "d/dt c26 in component c26 (molecules)"
legend_rates[26] = "d/dt c27 in component c27 (molecules)"
legend_rates[27] = "d/dt c28 in component c28 (molecules)"
legend_rates[28] = "d/dt c29 in component c29 (molecules)"
legend_rates[29] = "d/dt c30 in component c30 (molecules)"
legend_rates[30] = "d/dt c31 in component c31 (molecules)"
legend_rates[31] = "d/dt c32 in component c32 (molecules)"
legend_rates[32] = "d/dt c33 in component c33 (molecules)"
legend_rates[33] = "d/dt c34 in component c34 (molecules)"
legend_rates[34] = "d/dt c35 in component c35 (molecules)"
legend_rates[35] = "d/dt c36 in component c36 (molecules)"
legend_rates[36] = "d/dt c37 in component c37 (molecules)"
legend_rates[37] = "d/dt c38 in component c38 (molecules)"
legend_rates[38] = "d/dt c39 in component c39 (molecules)"
legend_rates[39] = "d/dt c40 in component c40 (molecules)"
legend_rates[40] = "d/dt c41 in component c41 (molecules)"
legend_rates[41] = "d/dt c42 in component c42 (molecules)"
legend_rates[42] = "d/dt c43 in component c43 (molecules)"
legend_rates[43] = "d/dt c44 in component c44 (molecules)"
legend_rates[44] = "d/dt c45 in component c45 (molecules)"
legend_rates[45] = "d/dt c46 in component c46 (molecules)"
legend_rates[46] = "d/dt c47 in component c47 (molecules)"
legend_rates[47] = "d/dt c48 in component c48 (molecules)"
legend_rates[48] = "d/dt c49 in component c49 (molecules)"
legend_rates[49] = "d/dt c50 in component c50 (molecules)"
legend_rates[50] = "d/dt c51 in component c51 (molecules)"
legend_rates[51] = "d/dt c52 in component c52 (molecules)"
legend_rates[52] = "d/dt c53 in component c53 (molecules)"
legend_rates[53] = "d/dt c54 in component c54 (molecules)"
legend_rates[54] = "d/dt c55 in component c55 (molecules)"
legend_rates[55] = "d/dt c56 in component c56 (molecules)"
legend_rates[56] = "d/dt c57 in component c57 (molecules)"
legend_rates[57] = "d/dt c58 in component c58 (molecules)"
legend_rates[58] = "d/dt c59 in component c59 (molecules)"
legend_rates[59] = "d/dt c60 in component c60 (molecules)"
legend_rates[60] = "d/dt c61 in component c61 (molecules)"
legend_rates[61] = "d/dt c62 in component c62 (molecules)"
legend_rates[62] = "d/dt c63 in component c63 (molecules)"
legend_rates[63] = "d/dt c64 in component c64 (molecules)"
legend_rates[64] = "d/dt c65 in component c65 (molecules)"
legend_rates[65] = "d/dt c66 in component c66 (molecules)"
legend_rates[66] = "d/dt c67 in component c67 (molecules)"
legend_rates[67] = "d/dt c68 in component c68 (molecules)"
legend_rates[68] = "d/dt c69 in component c69 (molecules)"
legend_rates[69] = "d/dt c70 in component c70 (molecules)"
legend_rates[70] = "d/dt c71 in component c71 (molecules)"
legend_rates[71] = "d/dt c72 in component c72 (molecules)"
legend_rates[72] = "d/dt c73 in component c73 (molecules)"
legend_rates[73] = "d/dt c74 in component c74 (molecules)"
legend_rates[74] = "d/dt c75 in component c75 (molecules)"
legend_rates[75] = "d/dt c76 in component c76 (molecules)"
legend_rates[76] = "d/dt c77 in component c77 (molecules)"
legend_rates[77] = "d/dt c78 in component c78 (molecules)"
legend_rates[78] = "d/dt c79 in component c79 (molecules)"
legend_rates[79] = "d/dt c80 in component c80 (molecules)"
legend_rates[80] = "d/dt c81 in component c81 (molecules)"
legend_rates[81] = "d/dt c82 in component c82 (molecules)"
legend_rates[82] = "d/dt c83 in component c83 (molecules)"
legend_rates[83] = "d/dt c84 in component c84 (molecules)"
legend_rates[84] = "d/dt c85 in component c85 (molecules)"
legend_rates[85] = "d/dt c86 in component c86 (molecules)"
legend_rates[86] = "d/dt c87 in component c87 (molecules)"
legend_rates[87] = "d/dt c88 in component c88 (molecules)"
legend_rates[88] = "d/dt c89 in component c89 (molecules)"
legend_rates[89] = "d/dt c90 in component c90 (molecules)"
legend_rates[90] = "d/dt c91 in component c91 (molecules)"
legend_rates[91] = "d/dt c92 in component c92 (molecules)"
legend_rates[92] = "d/dt c93 in component c93 (molecules)"
legend_rates[93] = "d/dt c94 in component c94 (molecules)"
return (legend_states, legend_algebraic, legend_voi, legend_constants)
def initConsts():
constants = [0.0] * sizeConstants; states = [0.0] * sizeStates;
states[0] = 4962
states[1] = 5e4
states[2] = 0
states[3] = 0
states[4] = 0
states[5] = 0
states[6] = 0
states[7] = 0
states[8] = 0
states[9] = 0
states[10] = 0
states[11] = 8.1e4
states[12] = 0
states[13] = 1.2e4
states[14] = 0
states[15] = 0
states[16] = 0
states[17] = 0
states[18] = 0
states[19] = 0
states[20] = 0
states[21] = 1.1e4
states[22] = 0
states[23] = 2.63e4
states[24] = 0
states[25] = 7.2e4
states[26] = 0
states[27] = 0
states[28] = 0
states[29] = 4e4
states[30] = 1.01e5
states[31] = 0
states[32] = 0
states[33] = 0
states[34] = 0
states[35] = 0
states[36] = 0
states[37] = 0
states[38] = 0
states[39] = 0
states[40] = 4e4
states[41] = 0
states[42] = 0
states[43] = 4e4
states[44] = 0
states[45] = 0
states[46] = 2.2e7
states[47] = 0
states[48] = 0
states[49] = 0
states[50] = 0
states[51] = 0
states[52] = 4e4
states[53] = 0
states[54] = 2.1e7
states[55] = 0
states[56] = 0
states[57] = 0
states[58] = 0
states[59] = 1e7
states[60] = 0
states[61] = 0
states[62] = 0
states[63] = 0
states[64] = 0
states[65] = 0
states[66] = 0
states[67] = 0
states[68] = 0
states[69] = 0
states[70] = 0
states[71] = 0
states[72] = 0
states[73] = 0
states[74] = 0
states[75] = 0
states[76] = 0
states[77] = 0
states[78] = 0
states[79] = 0
states[80] = 0
states[81] = 0
states[82] = 0
states[83] = 0
states[84] = 0
states[85] = 0
states[86] = 0
states[87] = 0
states[88] = 0
states[89] = 0
states[90] = 0
states[91] = 0
states[92] = 0
states[93] = 0
constants[0] = 3e-3
constants[1] = 0.228
constants[2] = 1e-3
constants[3] = 6
constants[4] = 60
constants[5] = 0.6
constants[6] = 1.038e-5
constants[7] = 0.0996
constants[8] = 3e-3
constants[9] = 0.3
constants[10] = 1e-4
constants[11] = 12
constants[12] = 3.25581
constants[13] = 0.66
constants[14] = 130.2
constants[15] = 600000
constants[16] = 0.001
constants[17] = 16.5
constants[18] = 0.001
constants[19] = 3.6
constants[20] = 0.0015
constants[21] = 78
constants[22] = 30
constants[23] = 1e-5
constants[24] = 2.1e-4
constants[25] = 24
constants[26] = 1.38
constants[27] = 2.2e-5
constants[28] = 0.0021
constants[29] = 6
constants[30] = 360
constants[31] = 36
constants[32] = 33
constants[33] = 0.001
constants[34] = 1.284
constants[35] = 1e-4
constants[36] = 0.318
constants[37] = 60
constants[38] = 7e-5
constants[39] = 6
constants[40] = 2.4e-5
constants[41] = 12
constants[42] = 0.0021
constants[43] = 1.8
constants[44] = 4.5e-4
constants[45] = 0.09
constants[46] = 4.5e-4
constants[47] = 2e14
constants[48] = 61200
constants[49] = 18
constants[50] = 9e-5
constants[51] = 0.003
constants[52] = 3.84
constants[53] = 0.003
constants[54] = 2.574
constants[55] = 0.007
constants[56] = 12
constants[57] = 60
constants[58] = 0.00111
constants[59] = 1.0998
constants[60] = 210
constants[61] = 174
constants[62] = 0.00143
constants[63] = 48
constants[64] = 3.48
constants[65] = 2.5e-5
constants[66] = 30
constants[67] = 0.00534
constants[68] = 1.98
constants[69] = 960
constants[70] = 342
constants[71] = 0.00145
constants[72] = 36
constants[73] = 16.2
constants[74] = 5e-4
constants[75] = 30
constants[76] = 18
constants[77] = 0.04002
constants[78] = 0.01002
constants[79] = 50000
constants[80] = constants[14]*1.00000
constants[81] = 0.00000
return (states, constants)
def computeRates(voi, states, constants):
rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic
rates[0] = constants[81]
algebraic[0] = constants[0]*states[0]*states[1]-constants[1]*states[2]
algebraic[7] = constants[2]*states[2]*states[2]-constants[3]*states[3]
rates[2] = algebraic[0]-2.00000*algebraic[7]
algebraic[8] = constants[4]*states[3]-constants[5]*states[4]
rates[3] = algebraic[7]-algebraic[8]
algebraic[10] = constants[8]*states[1]-constants[9]*states[5]
rates[1] = constants[80]-(algebraic[0]+algebraic[10])
algebraic[11] = constants[8]*states[4]
algebraic[12] = constants[10]*states[4]*states[13]-constants[11]*states[14]
rates[4] = algebraic[8]-(algebraic[11]+algebraic[12])
algebraic[14] = constants[12]*states[5]*states[15]-constants[13]*states[9]
algebraic[15] = constants[77]*states[5]
rates[5] = algebraic[10]-(algebraic[14]+algebraic[15])
algebraic[16] = constants[2]*states[9]*states[9]-constants[3]*states[10]
rates[9] = algebraic[14]-2.00000*algebraic[16]
algebraic[17] = constants[78]*states[15]
rates[12] = algebraic[17]
rates[15] = -(algebraic[14]+algebraic[17])
rates[85] = algebraic[15]
algebraic[18] = constants[4]*states[10]-constants[5]*states[7]
rates[10] = algebraic[16]-algebraic[18]
algebraic[19] = constants[10]*states[7]*states[13]-constants[11]*states[16]
rates[13] = -(algebraic[12]+algebraic[19])
algebraic[20] = constants[77]*states[7]
rates[7] = (algebraic[11]+algebraic[18])-(algebraic[19]+algebraic[20])
rates[86] = algebraic[20]
algebraic[9] = constants[6]*states[22]*states[11]-constants[7]*states[6]
algebraic[22] = constants[16]*states[21]*states[14]-constants[17]*states[22]
algebraic[13] = constants[8]*states[22]
algebraic[23] = constants[18]*states[23]*states[22]-constants[19]*states[24]
rates[22] = algebraic[22]-(algebraic[9]+algebraic[13]+algebraic[23])
algebraic[25] = constants[22]*states[26]-constants[23]*states[27]*states[24]
algebraic[33] = constants[22]*states[35]-constants[23]*states[34]*states[27]
algebraic[34] = constants[35]*states[27]*states[40]-constants[36]*states[41]
rates[27] = (algebraic[25]+algebraic[33])-algebraic[34]
algebraic[35] = constants[37]*states[41]-constants[38]*states[42]*states[44]
rates[41] = algebraic[34]-algebraic[35]
algebraic[26] = constants[24]*states[24]*states[42]-constants[25]*states[28]
algebraic[36] = constants[24]*states[34]*states[42]-constants[25]*states[36]
rates[42] = algebraic[35]-(algebraic[26]+algebraic[36])
algebraic[49] = constants[57]*states[45]
algebraic[48] = constants[55]*states[43]*states[44]-constants[56]*states[45]
rates[45] = algebraic[48]-algebraic[49]
algebraic[50] = constants[58]*states[46]*states[44]-constants[59]*states[47]
algebraic[51] = constants[60]*states[47]
rates[47] = algebraic[50]-algebraic[51]
algebraic[52] = constants[58]*states[48]*states[44]-constants[59]*states[49]
algebraic[53] = constants[61]*states[49]
rates[44] = (algebraic[35]+algebraic[51]+algebraic[53])-(algebraic[48]+algebraic[50]+algebraic[52])
rates[49] = algebraic[52]-algebraic[53]
algebraic[55] = constants[64]*states[51]
algebraic[54] = constants[62]*states[50]*states[52]-constants[63]*states[51]
rates[51] = algebraic[54]-algebraic[55]
algebraic[56] = constants[65]*states[52]*states[48]-constants[66]*states[53]
rates[48] = (algebraic[51]+algebraic[55])-(algebraic[52]+algebraic[56])
algebraic[57] = constants[64]*states[53]
rates[53] = algebraic[56]-algebraic[57]
algebraic[58] = constants[67]*states[54]*states[50]-constants[68]*states[55]
algebraic[59] = constants[69]*states[55]
rates[55] = algebraic[58]-algebraic[59]
algebraic[60] = constants[67]*states[50]*states[56]-constants[68]*states[57]
algebraic[61] = constants[70]*states[57]
rates[50] = (algebraic[53]+algebraic[59]+algebraic[61])-(algebraic[54]+algebraic[58]+algebraic[60])
rates[57] = algebraic[60]-algebraic[61]
algebraic[62] = constants[71]*states[58]*states[59]-constants[72]*states[60]
rates[58] = algebraic[61]-algebraic[62]
algebraic[63] = constants[73]*states[60]
rates[60] = algebraic[62]-algebraic[63]
algebraic[64] = constants[74]*states[59]*states[56]-constants[75]*states[61]
rates[56] = (algebraic[59]+algebraic[63])-(algebraic[60]+algebraic[64])
algebraic[65] = constants[76]*states[61]
rates[61] = algebraic[64]-algebraic[65]
algebraic[28] = constants[28]*states[30]*states[14]-constants[29]*states[31]
algebraic[72] = constants[28]*states[30]*states[16]-constants[29]*states[62]
algebraic[42] = (constants[48]*states[39])/(constants[47]+states[39])
rates[30] = algebraic[42]-(algebraic[28]+algebraic[72])
algebraic[66] = constants[16]*states[16]*states[21]-constants[17]*states[17]
algebraic[30] = constants[16]*states[21]*states[32]-constants[32]*states[33]
algebraic[41] = constants[45]*states[29]-constants[46]*states[23]*states[21]
algebraic[44] = constants[16]*states[21]*states[39]-constants[32]*states[38]
algebraic[74] = constants[16]*states[21]*states[63]-constants[32]*states[64]
rates[21] = algebraic[41]-(algebraic[22]+algebraic[30]+algebraic[44]+algebraic[66]+algebraic[74])
algebraic[29] = constants[30]*states[31]-constants[31]*states[32]
algebraic[75] = constants[8]*states[31]-constants[9]*states[62]
rates[31] = algebraic[28]-(algebraic[29]+algebraic[75])
algebraic[73] = constants[30]*states[62]-constants[31]*states[63]
rates[62] = (algebraic[72]+algebraic[75])-algebraic[73]
algebraic[67] = constants[18]*states[23]*states[17]-constants[19]*states[18]
algebraic[76] = constants[33]*states[23]*states[64]-constants[34]*states[65]
algebraic[31] = constants[33]*states[23]*states[33]-constants[34]*states[34]
algebraic[46] = constants[51]*states[23]*states[38]-constants[52]*states[37]
rates[23] = algebraic[41]-(algebraic[23]+algebraic[31]+algebraic[46]+algebraic[67]+algebraic[76])
algebraic[69] = constants[22]*states[19]-constants[23]*states[68]*states[18]
algebraic[79] = constants[35]*states[68]*states[40]-constants[36]*states[69]
algebraic[78] = constants[22]*states[66]-constants[23]*states[65]*states[68]
rates[68] = (algebraic[69]+algebraic[78])-algebraic[79]
algebraic[80] = constants[37]*states[69]-constants[38]*states[70]*states[71]
rates[69] = algebraic[79]-algebraic[80]
algebraic[70] = constants[24]*states[70]*states[18]-constants[25]*states[20]
algebraic[81] = constants[24]*states[70]*states[65]-constants[25]*states[67]
rates[70] = algebraic[80]-(algebraic[70]+algebraic[81])
algebraic[68] = constants[20]*states[25]*states[18]-constants[21]*states[19]
algebraic[71] = constants[26]*states[20]-constants[27]*states[18]*states[25]
algebraic[24] = constants[20]*states[25]*states[24]-constants[21]*states[26]
algebraic[27] = constants[26]*states[28]-constants[27]*states[24]*states[25]
algebraic[32] = constants[20]*states[25]*states[34]-constants[21]*states[35]
algebraic[37] = constants[26]*states[36]-constants[27]*states[34]*states[25]
algebraic[83] = constants[26]*states[67]-states[25]*constants[27]*states[65]
algebraic[77] = constants[20]*states[25]*states[65]-constants[21]*states[66]
rates[25] = (algebraic[27]+algebraic[37]+algebraic[71]+algebraic[83])-(algebraic[24]+algebraic[32]+algebraic[68]+algebraic[77])
algebraic[84] = constants[57]*states[72]
rates[40] = (algebraic[49]+algebraic[84])-(algebraic[34]+algebraic[79])
algebraic[82] = constants[55]*states[43]*states[71]-constants[56]*states[72]
rates[43] = (algebraic[49]+algebraic[84])-(algebraic[48]+algebraic[82])
rates[72] = algebraic[82]-algebraic[84]
algebraic[38] = constants[39]*states[34]-constants[40]*states[37]*states[14]
algebraic[86] = constants[39]*states[65]-constants[40]*states[16]*states[37]
algebraic[39] = constants[41]*states[37]-constants[42]*states[39]*states[29]
rates[37] = (algebraic[38]+algebraic[46]+algebraic[86])-algebraic[39]
algebraic[85] = constants[58]*states[46]*states[71]-constants[59]*states[73]
algebraic[87] = constants[60]*states[73]
rates[73] = algebraic[85]-algebraic[87]
algebraic[43] = constants[49]*states[32]-constants[50]*states[14]*states[39]
algebraic[90] = constants[49]*states[63]-constants[50]*states[16]*states[39]
rates[39] = (algebraic[39]+algebraic[43]+algebraic[90])-(algebraic[42]+algebraic[44])
algebraic[89] = constants[58]*states[71]*states[74]-constants[59]*states[75]
algebraic[91] = constants[61]*states[75]
rates[71] = (algebraic[80]+algebraic[87]+algebraic[91])-(algebraic[82]+algebraic[85]+algebraic[89])
rates[75] = algebraic[89]-algebraic[91]
algebraic[45] = constants[49]*states[33]-constants[50]*states[14]*states[38]
algebraic[92] = constants[49]*states[64]-constants[50]*states[16]*states[38]
rates[38] = (algebraic[44]+algebraic[45]+algebraic[92])-algebraic[46]
algebraic[40] = constants[43]*states[24]-constants[44]*states[14]*states[29]
algebraic[95] = constants[8]*states[14]-constants[9]*states[16]
rates[14] = (algebraic[12]+algebraic[38]+algebraic[40]+algebraic[43]+algebraic[45])-(algebraic[22]+algebraic[28]+algebraic[95])
algebraic[88] = constants[43]*states[18]-constants[44]*states[16]*states[29]
rates[16] = (algebraic[19]+algebraic[86]+algebraic[88]+algebraic[90]+algebraic[92]+algebraic[95])-(algebraic[66]+algebraic[72])
algebraic[47] = constants[53]*states[29]*states[32]-constants[54]*states[34]
algebraic[94] = constants[53]*states[29]*states[63]-constants[54]*states[65]
rates[29] = (algebraic[39]+algebraic[40]+algebraic[88])-(algebraic[41]+algebraic[47]+algebraic[94])
algebraic[93] = constants[62]*states[76]*states[52]-constants[63]*states[77]
algebraic[96] = constants[64]*states[77]
rates[77] = algebraic[93]-algebraic[96]
algebraic[99] = constants[8]*states[32]-constants[9]*states[63]
rates[32] = algebraic[29]-(algebraic[30]+algebraic[43]+algebraic[47]+algebraic[99])
rates[63] = (algebraic[73]+algebraic[99])-(algebraic[74]+algebraic[90]+algebraic[94])
algebraic[100] = constants[65]*states[52]*states[74]-constants[66]*states[78]
rates[74] = (algebraic[87]+algebraic[96])-(algebraic[100]+algebraic[89])
algebraic[97] = constants[67]*states[54]*states[76]-constants[68]*states[79]
algebraic[101] = constants[69]*states[79]
rates[79] = algebraic[97]-algebraic[101]
algebraic[102] = constants[6]*states[24]*states[11]-constants[7]*states[87]
algebraic[98] = constants[8]*states[24]-constants[9]*states[18]
rates[24] = (algebraic[23]+algebraic[25]+algebraic[27])-(algebraic[24]+algebraic[26]+algebraic[40]+algebraic[98]+algebraic[102])
algebraic[103] = constants[64]*states[78]
rates[46] = (algebraic[57]+algebraic[103])-(algebraic[50]+algebraic[85])
rates[52] = (algebraic[55]+algebraic[57]+algebraic[96]+algebraic[103])-(algebraic[54]+algebraic[56]+algebraic[93]+algebraic[100])
rates[78] = algebraic[100]-algebraic[103]
algebraic[104] = constants[67]*states[76]*states[80]-constants[68]*states[81]
algebraic[106] = constants[70]*states[81]
rates[76] = (algebraic[91]+algebraic[101]+algebraic[106])-(algebraic[93]+algebraic[97]+algebraic[104])
rates[81] = algebraic[104]-algebraic[106]
algebraic[107] = constants[6]*states[26]*states[11]-constants[7]*states[88]
algebraic[105] = constants[8]*states[26]-constants[9]*states[19]
rates[26] = algebraic[24]-(algebraic[25]+algebraic[105]+algebraic[107])
algebraic[108] = constants[71]*states[82]*states[59]-constants[72]*states[83]
rates[82] = algebraic[106]-algebraic[108]
algebraic[110] = constants[73]*states[83]
rates[83] = algebraic[108]-algebraic[110]
algebraic[111] = constants[6]*states[28]*states[11]-constants[7]*states[89]
algebraic[109] = constants[8]*states[28]-constants[9]*states[20]
rates[28] = algebraic[26]-(algebraic[27]+algebraic[109]+algebraic[111])
algebraic[112] = constants[74]*states[59]*states[80]-constants[75]*states[84]
rates[80] = (algebraic[101]+algebraic[110])-(algebraic[104]+algebraic[112])
algebraic[114] = constants[76]*states[84]
rates[54] = (algebraic[65]+algebraic[114])-(algebraic[58]+algebraic[97])
rates[59] = (algebraic[63]+algebraic[65]+algebraic[110]+algebraic[114])-(algebraic[62]+algebraic[64]+algebraic[108]+algebraic[112])
rates[84] = algebraic[112]-algebraic[114]
algebraic[115] = constants[6]*states[33]*states[11]-constants[7]*states[90]
algebraic[113] = constants[8]*states[33]-constants[9]*states[64]
rates[33] = algebraic[30]-(algebraic[31]+algebraic[45]+algebraic[113]+algebraic[115])
algebraic[117] = constants[6]*states[34]*states[11]-constants[7]*states[91]
algebraic[116] = constants[8]*states[34]-constants[9]*states[65]
rates[34] = (algebraic[31]+algebraic[33]+algebraic[37]+algebraic[47])-(algebraic[116]+algebraic[117]+algebraic[32]+algebraic[36]+algebraic[38])
algebraic[119] = constants[6]*states[35]*states[11]-constants[7]*states[92]
algebraic[118] = constants[8]*states[35]-constants[9]*states[66]
rates[35] = algebraic[32]-(algebraic[33]+algebraic[118]+algebraic[119])
algebraic[21] = constants[15]*states[8]
algebraic[121] = constants[6]*states[36]*states[11]-constants[7]*states[93]
rates[11] = algebraic[21]-(algebraic[9]+algebraic[102]+algebraic[107]+algebraic[111]+algebraic[115]+algebraic[117]+algebraic[119]+algebraic[121])
algebraic[120] = constants[8]*states[36]-constants[9]*states[67]
rates[36] = algebraic[36]-(algebraic[37]+algebraic[120]+algebraic[121])
algebraic[122] = (constants[79]*1.00000)/(constants[1]/(constants[0]*states[0])+1.00000)
algebraic[123] = custom_piecewise([less(algebraic[122] , 3100.00), 1.55000 , greater(algebraic[122] , 100000.), 0.200000 , True, (algebraic[122]*-1.35000e-05+1.55000)/1.00000])
algebraic[124] = algebraic[123]*states[6]
rates[6] = algebraic[9]-algebraic[124]
rates[17] = (algebraic[124]+algebraic[13]+algebraic[66])-algebraic[67]
algebraic[125] = algebraic[123]*states[87]
rates[18] = (algebraic[69]+algebraic[67]+algebraic[71]+algebraic[98]+algebraic[125])-(algebraic[68]+algebraic[70]+algebraic[88])
rates[87] = algebraic[102]-algebraic[125]
algebraic[126] = algebraic[123]*states[88]
rates[19] = (algebraic[68]+algebraic[105]+algebraic[126])-algebraic[69]
rates[88] = algebraic[107]-algebraic[126]
algebraic[127] = algebraic[123]*states[89]
rates[20] = (algebraic[70]+algebraic[109]+algebraic[127])-algebraic[71]
rates[89] = algebraic[111]-algebraic[127]
algebraic[128] = algebraic[123]*states[90]
rates[64] = (algebraic[74]+algebraic[113]+algebraic[128])-(algebraic[76]+algebraic[92])
rates[90] = algebraic[115]-algebraic[128]
algebraic[129] = algebraic[123]*states[91]
rates[65] = (algebraic[76]+algebraic[78]+algebraic[83]+algebraic[94]+algebraic[116]+algebraic[129])-(algebraic[77]+algebraic[81]+algebraic[86])
rates[91] = algebraic[117]-algebraic[129]
algebraic[130] = algebraic[123]*states[92]
rates[66] = (algebraic[77]+algebraic[118]+algebraic[130])-algebraic[78]
rates[92] = algebraic[119]-algebraic[130]
algebraic[131] = algebraic[123]*states[93]
rates[8] = (algebraic[124]+algebraic[125]+algebraic[126]+algebraic[127]+algebraic[128]+algebraic[129]+algebraic[130]+algebraic[131])-algebraic[21]
rates[67] = (algebraic[81]+algebraic[120]+algebraic[131])-algebraic[83]
rates[93] = algebraic[121]-algebraic[131]
return(rates)
def computeAlgebraic(constants, states, voi):
algebraic = array([[0.0] * len(voi)] * sizeAlgebraic)
states = array(states)
voi = array(voi)
algebraic[0] = constants[0]*states[0]*states[1]-constants[1]*states[2]
algebraic[7] = constants[2]*states[2]*states[2]-constants[3]*states[3]
algebraic[8] = constants[4]*states[3]-constants[5]*states[4]
algebraic[10] = constants[8]*states[1]-constants[9]*states[5]
algebraic[11] = constants[8]*states[4]
algebraic[12] = constants[10]*states[4]*states[13]-constants[11]*states[14]
algebraic[14] = constants[12]*states[5]*states[15]-constants[13]*states[9]
algebraic[15] = constants[77]*states[5]
algebraic[16] = constants[2]*states[9]*states[9]-constants[3]*states[10]
algebraic[17] = constants[78]*states[15]
algebraic[18] = constants[4]*states[10]-constants[5]*states[7]
algebraic[19] = constants[10]*states[7]*states[13]-constants[11]*states[16]
algebraic[20] = constants[77]*states[7]
algebraic[9] = constants[6]*states[22]*states[11]-constants[7]*states[6]
algebraic[22] = constants[16]*states[21]*states[14]-constants[17]*states[22]
algebraic[13] = constants[8]*states[22]
algebraic[23] = constants[18]*states[23]*states[22]-constants[19]*states[24]
algebraic[25] = constants[22]*states[26]-constants[23]*states[27]*states[24]
algebraic[33] = constants[22]*states[35]-constants[23]*states[34]*states[27]
algebraic[34] = constants[35]*states[27]*states[40]-constants[36]*states[41]
algebraic[35] = constants[37]*states[41]-constants[38]*states[42]*states[44]
algebraic[26] = constants[24]*states[24]*states[42]-constants[25]*states[28]
algebraic[36] = constants[24]*states[34]*states[42]-constants[25]*states[36]
algebraic[49] = constants[57]*states[45]
algebraic[48] = constants[55]*states[43]*states[44]-constants[56]*states[45]
algebraic[50] = constants[58]*states[46]*states[44]-constants[59]*states[47]
algebraic[51] = constants[60]*states[47]
algebraic[52] = constants[58]*states[48]*states[44]-constants[59]*states[49]
algebraic[53] = constants[61]*states[49]
algebraic[55] = constants[64]*states[51]
algebraic[54] = constants[62]*states[50]*states[52]-constants[63]*states[51]
algebraic[56] = constants[65]*states[52]*states[48]-constants[66]*states[53]
algebraic[57] = constants[64]*states[53]
algebraic[58] = constants[67]*states[54]*states[50]-constants[68]*states[55]
algebraic[59] = constants[69]*states[55]
algebraic[60] = constants[67]*states[50]*states[56]-constants[68]*states[57]
algebraic[61] = constants[70]*states[57]
algebraic[62] = constants[71]*states[58]*states[59]-constants[72]*states[60]
algebraic[63] = constants[73]*states[60]
algebraic[64] = constants[74]*states[59]*states[56]-constants[75]*states[61]
algebraic[65] = constants[76]*states[61]
algebraic[28] = constants[28]*states[30]*states[14]-constants[29]*states[31]
algebraic[72] = constants[28]*states[30]*states[16]-constants[29]*states[62]
algebraic[42] = (constants[48]*states[39])/(constants[47]+states[39])
algebraic[66] = constants[16]*states[16]*states[21]-constants[17]*states[17]
algebraic[30] = constants[16]*states[21]*states[32]-constants[32]*states[33]
algebraic[41] = constants[45]*states[29]-constants[46]*states[23]*states[21]
algebraic[44] = constants[16]*states[21]*states[39]-constants[32]*states[38]
algebraic[74] = constants[16]*states[21]*states[63]-constants[32]*states[64]
algebraic[29] = constants[30]*states[31]-constants[31]*states[32]
algebraic[75] = constants[8]*states[31]-constants[9]*states[62]
algebraic[73] = constants[30]*states[62]-constants[31]*states[63]
algebraic[67] = constants[18]*states[23]*states[17]-constants[19]*states[18]
algebraic[76] = constants[33]*states[23]*states[64]-constants[34]*states[65]
algebraic[31] = constants[33]*states[23]*states[33]-constants[34]*states[34]
algebraic[46] = constants[51]*states[23]*states[38]-constants[52]*states[37]
algebraic[69] = constants[22]*states[19]-constants[23]*states[68]*states[18]
algebraic[79] = constants[35]*states[68]*states[40]-constants[36]*states[69]
algebraic[78] = constants[22]*states[66]-constants[23]*states[65]*states[68]
algebraic[80] = constants[37]*states[69]-constants[38]*states[70]*states[71]
algebraic[70] = constants[24]*states[70]*states[18]-constants[25]*states[20]
algebraic[81] = constants[24]*states[70]*states[65]-constants[25]*states[67]
algebraic[68] = constants[20]*states[25]*states[18]-constants[21]*states[19]
algebraic[71] = constants[26]*states[20]-constants[27]*states[18]*states[25]
algebraic[24] = constants[20]*states[25]*states[24]-constants[21]*states[26]
algebraic[27] = constants[26]*states[28]-constants[27]*states[24]*states[25]
algebraic[32] = constants[20]*states[25]*states[34]-constants[21]*states[35]
algebraic[37] = constants[26]*states[36]-constants[27]*states[34]*states[25]
algebraic[83] = constants[26]*states[67]-states[25]*constants[27]*states[65]
algebraic[77] = constants[20]*states[25]*states[65]-constants[21]*states[66]
algebraic[84] = constants[57]*states[72]
algebraic[82] = constants[55]*states[43]*states[71]-constants[56]*states[72]
algebraic[38] = constants[39]*states[34]-constants[40]*states[37]*states[14]
algebraic[86] = constants[39]*states[65]-constants[40]*states[16]*states[37]
algebraic[39] = constants[41]*states[37]-constants[42]*states[39]*states[29]
algebraic[85] = constants[58]*states[46]*states[71]-constants[59]*states[73]
algebraic[87] = constants[60]*states[73]
algebraic[43] = constants[49]*states[32]-constants[50]*states[14]*states[39]
algebraic[90] = constants[49]*states[63]-constants[50]*states[16]*states[39]
algebraic[89] = constants[58]*states[71]*states[74]-constants[59]*states[75]
algebraic[91] = constants[61]*states[75]
algebraic[45] = constants[49]*states[33]-constants[50]*states[14]*states[38]
algebraic[92] = constants[49]*states[64]-constants[50]*states[16]*states[38]
algebraic[40] = constants[43]*states[24]-constants[44]*states[14]*states[29]
algebraic[95] = constants[8]*states[14]-constants[9]*states[16]
algebraic[88] = constants[43]*states[18]-constants[44]*states[16]*states[29]
algebraic[47] = constants[53]*states[29]*states[32]-constants[54]*states[34]
algebraic[94] = constants[53]*states[29]*states[63]-constants[54]*states[65]
algebraic[93] = constants[62]*states[76]*states[52]-constants[63]*states[77]
algebraic[96] = constants[64]*states[77]
algebraic[99] = constants[8]*states[32]-constants[9]*states[63]
algebraic[100] = constants[65]*states[52]*states[74]-constants[66]*states[78]
algebraic[97] = constants[67]*states[54]*states[76]-constants[68]*states[79]
algebraic[101] = constants[69]*states[79]
algebraic[102] = constants[6]*states[24]*states[11]-constants[7]*states[87]
algebraic[98] = constants[8]*states[24]-constants[9]*states[18]
algebraic[103] = constants[64]*states[78]
algebraic[104] = constants[67]*states[76]*states[80]-constants[68]*states[81]
algebraic[106] = constants[70]*states[81]
algebraic[107] = constants[6]*states[26]*states[11]-constants[7]*states[88]
algebraic[105] = constants[8]*states[26]-constants[9]*states[19]
algebraic[108] = constants[71]*states[82]*states[59]-constants[72]*states[83]
algebraic[110] = constants[73]*states[83]
algebraic[111] = constants[6]*states[28]*states[11]-constants[7]*states[89]
algebraic[109] = constants[8]*states[28]-constants[9]*states[20]
algebraic[112] = constants[74]*states[59]*states[80]-constants[75]*states[84]
algebraic[114] = constants[76]*states[84]
algebraic[115] = constants[6]*states[33]*states[11]-constants[7]*states[90]
algebraic[113] = constants[8]*states[33]-constants[9]*states[64]
algebraic[117] = constants[6]*states[34]*states[11]-constants[7]*states[91]
algebraic[116] = constants[8]*states[34]-constants[9]*states[65]
algebraic[119] = constants[6]*states[35]*states[11]-constants[7]*states[92]
algebraic[118] = constants[8]*states[35]-constants[9]*states[66]
algebraic[21] = constants[15]*states[8]
algebraic[121] = constants[6]*states[36]*states[11]-constants[7]*states[93]
algebraic[120] = constants[8]*states[36]-constants[9]*states[67]
algebraic[122] = (constants[79]*1.00000)/(constants[1]/(constants[0]*states[0])+1.00000)
algebraic[123] = custom_piecewise([less(algebraic[122] , 3100.00), 1.55000 , greater(algebraic[122] , 100000.), 0.200000 , True, (algebraic[122]*-1.35000e-05+1.55000)/1.00000])
algebraic[124] = algebraic[123]*states[6]
algebraic[125] = algebraic[123]*states[87]
algebraic[126] = algebraic[123]*states[88]
algebraic[127] = algebraic[123]*states[89]
algebraic[128] = algebraic[123]*states[90]
algebraic[129] = algebraic[123]*states[91]
algebraic[130] = algebraic[123]*states[92]
algebraic[131] = algebraic[123]*states[93]
algebraic[1] = states[44]+states[45]+states[47]+states[49]+states[71]+states[72]+states[73]+states[75]
algebraic[2] = states[50]+states[76]
algebraic[3] = states[58]+states[82]
algebraic[4] = states[41]+states[27]+states[69]+states[68]
algebraic[5] = states[32]+states[33]+states[34]+states[35]+states[36]+states[37]+states[38]+states[39]+states[63]+states[64]+states[65]+states[66]+states[67]+states[90]+states[91]+states[92]+states[93]
algebraic[6] = 2.00000*(states[4]+states[6]+states[7]+states[10]+states[14]+states[16]+states[17]+states[18]+states[19]+states[20]+states[22]+states[24]+states[26]+states[28]+states[31]+states[32]+states[33]+states[34]+states[35]+states[36]+states[62]+states[63]+states[64]+states[65]+states[66]+states[67]+states[87]+states[88]+states[89]+states[90]+states[91]+states[92]+states[93])
return algebraic
def custom_piecewise(cases):
"""Compute result of a piecewise function"""
return select(cases[0::2],cases[1::2])
def solve_model():
"""Solve model with ODE solver"""
from scipy.integrate import ode
# Initialise constants and state variables
(init_states, constants) = initConsts()
# Set timespan to solve over
voi = linspace(0, 10, 500)
# Construct ODE object to solve
r = ode(computeRates)
r.set_integrator('vode', method='bdf', atol=1e-06, rtol=1e-06, max_step=1)
r.set_initial_value(init_states, voi[0])
r.set_f_params(constants)
# Solve model
states = array([[0.0] * len(voi)] * sizeStates)
states[:,0] = init_states
for (i,t) in enumerate(voi[1:]):
if r.successful():
r.integrate(t)
states[:,i+1] = r.y
else:
break
# Compute algebraic variables
algebraic = computeAlgebraic(constants, states, voi)
return (voi, states, algebraic)
def plot_model(voi, states, algebraic):
"""Plot variables against variable of integration"""
import pylab
(legend_states, legend_algebraic, legend_voi, legend_constants) = createLegends()
pylab.figure(1)
pylab.plot(voi,vstack((states,algebraic)).T)
pylab.xlabel(legend_voi)
pylab.legend(legend_states + legend_algebraic, loc='best')
pylab.show()
if __name__ == "__main__":
(voi, states, algebraic) = solve_model()
plot_model(voi, states, algebraic)