# Generated Code

The following is python code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

# Size of variable arrays: sizeAlgebraic = 148 sizeStates = 103 sizeConstants = 96 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 (second)" legend_states[0] = "c1 in component c1 (molar)" legend_algebraic[0] = "v1 in component v1 (flux)" legend_states[1] = "c2 in component c2 (molar)" legend_algebraic[5] = "v6 in component v6 (flux)" legend_algebraic[6] = "v13 in component v13 (flux)" legend_states[2] = "c3 in component c3 (molar)" legend_algebraic[1] = "v2 in component v2 (flux)" legend_states[3] = "c4 in component c4 (molar)" legend_algebraic[2] = "v3 in component v3 (flux)" legend_states[4] = "c5 in component c5 (molar)" legend_algebraic[7] = "v7 in component v7 (flux)" legend_algebraic[8] = "v8 in component v8 (flux)" legend_states[5] = "c6 in component c6 (molar)" legend_algebraic[10] = "v10 in component v10 (flux)" legend_algebraic[11] = "v60 in component v60 (flux)" legend_states[6] = "c7 in component c7 (molar)" legend_algebraic[3] = "v4 in component v4 (flux)" legend_algebraic[4] = "v5 in component v5 (flux)" legend_states[7] = "c8 in component c8 (molar)" legend_algebraic[14] = "v12 in component v12 (flux)" legend_algebraic[15] = "v14 in component v14 (flux)" legend_algebraic[61] = "v62 in component v62 (flux)" legend_states[8] = "c9 in component c9 (molar)" legend_algebraic[16] = "v15 in component v15 (flux)" legend_algebraic[106] = "v107 in component v107 (flux)" legend_algebraic[109] = "v110 in component v110 (flux)" legend_algebraic[112] = "v113 in component v113 (flux)" legend_algebraic[115] = "v116 in component v116 (flux)" legend_algebraic[118] = "v119 in component v119 (flux)" legend_algebraic[121] = "v122 in component v122 (flux)" legend_algebraic[124] = "v125 in component v125 (flux)" legend_states[9] = "c10 in component c10 (molar)" legend_algebraic[12] = "v11 in component v11 (flux)" legend_states[10] = "c11 in component c11 (molar)" legend_states[11] = "c12 in component c12 (molar)" legend_algebraic[105] = "v106 in component v106 (flux)" legend_algebraic[108] = "v109 in component v109 (flux)" legend_algebraic[111] = "v112 in component v112 (flux)" legend_algebraic[114] = "v115 in component v115 (flux)" legend_algebraic[117] = "v118 in component v118 (flux)" legend_algebraic[120] = "v121 in component v121 (flux)" legend_algebraic[123] = "v124 in component v124 (flux)" legend_states[12] = "c13 in component c13 (molar)" legend_algebraic[13] = "v61 in component v61 (flux)" legend_states[13] = "c14 in component c14 (molar)" legend_states[14] = "c15 in component c15 (molar)" legend_algebraic[17] = "v16 in component v16 (flux)" legend_algebraic[23] = "v22 in component v22 (flux)" legend_algebraic[33] = "v32 in component v32 (flux)" legend_algebraic[35] = "v34 in component v34 (flux)" legend_algebraic[38] = "v37 in component v37 (flux)" legend_algebraic[40] = "v39 in component v39 (flux)" legend_algebraic[98] = "v102 in component v102 (flux)" legend_states[15] = "c16 in component c16 (molar)" legend_states[16] = "c17 in component c17 (molar)" legend_algebraic[62] = "v63 in component v63 (flux)" legend_algebraic[68] = "v69 in component v69 (flux)" legend_algebraic[78] = "v79 in component v79 (flux)" legend_algebraic[79] = "v80 in component v80 (flux)" legend_algebraic[80] = "v81 in component v81 (flux)" legend_algebraic[81] = "v82 in component v82 (flux)" legend_algebraic[129] = "v132 in component v132 (flux)" legend_states[17] = "c18 in component c18 (molar)" legend_algebraic[9] = "v9 in component v9 (flux)" legend_algebraic[63] = "v64 in component v64 (flux)" legend_algebraic[131] = "v133 in component v133 (flux)" legend_states[18] = "c19 in component c19 (molar)" legend_algebraic[64] = "v65 in component v65 (flux)" legend_algebraic[65] = "v66 in component v66 (flux)" legend_algebraic[66] = "v67 in component v67 (flux)" legend_algebraic[67] = "v68 in component v68 (flux)" legend_algebraic[104] = "v105 in component v105 (flux)" legend_algebraic[126] = "v127 in component v127 (flux)" legend_algebraic[133] = "v134 in component v134 (flux)" legend_states[19] = "c20 in component c20 (molar)" legend_algebraic[107] = "v108 in component v108 (flux)" legend_algebraic[135] = "v135 in component v135 (flux)" legend_states[20] = "c21 in component c21 (molar)" legend_algebraic[110] = "v111 in component v111 (flux)" legend_algebraic[137] = "v136 in component v136 (flux)" legend_states[21] = "c22 in component c22 (molar)" legend_algebraic[25] = "v24 in component v24 (flux)" legend_algebraic[36] = "v35 in component v35 (flux)" legend_algebraic[39] = "v38 in component v38 (flux)" legend_algebraic[70] = "v71 in component v71 (flux)" legend_states[22] = "c23 in component c23 (molar)" legend_algebraic[18] = "v17 in component v17 (flux)" legend_states[23] = "c24 in component c24 (molar)" legend_algebraic[71] = "v72 in component v72 (flux)" legend_algebraic[130] = "v130 in component v130 (flux)" legend_algebraic[132] = "v131 in component v131 (flux)" legend_algebraic[26] = "v25 in component v25 (flux)" legend_algebraic[41] = "v40 in component v40 (flux)" legend_states[24] = "c25 in component c25 (molar)" legend_algebraic[19] = "v18 in component v18 (flux)" legend_algebraic[20] = "v19 in component v19 (flux)" legend_algebraic[21] = "v20 in component v20 (flux)" legend_algebraic[22] = "v21 in component v21 (flux)" legend_algebraic[125] = "v126 in component v126 (flux)" legend_states[25] = "c26 in component c26 (molar)" legend_algebraic[27] = "v26 in component v26 (flux)" legend_algebraic[32] = "v31 in component v31 (flux)" legend_algebraic[77] = "v78 in component v78 (flux)" legend_algebraic[72] = "v73 in component v73 (flux)" legend_states[26] = "c27 in component c27 (molar)" legend_states[27] = "c28 in component c28 (molar)" legend_algebraic[28] = "v27 in component v27 (flux)" legend_algebraic[29] = "v28 in component v28 (flux)" legend_states[28] = "c29 in component c29 (molar)" legend_states[29] = "c30 in component c30 (molar)" legend_algebraic[34] = "v33 in component v33 (flux)" legend_algebraic[42] = "v41 in component v41 (flux)" legend_algebraic[82] = "v83 in component v83 (flux)" legend_states[30] = "c31 in component c31 (molar)" legend_algebraic[37] = "v36 in component v36 (flux)" legend_states[31] = "c32 in component c32 (molar)" legend_algebraic[24] = "v23 in component v23 (flux)" legend_algebraic[100] = "v103 in component v103 (flux)" legend_states[32] = "c33 in component c33 (molar)" legend_algebraic[102] = "v104 in component v104 (flux)" legend_states[33] = "c34 in component c34 (molar)" legend_algebraic[113] = "v114 in component v114 (flux)" legend_states[34] = "c35 in component c35 (molar)" legend_algebraic[31] = "v30 in component v30 (flux)" legend_algebraic[116] = "v117 in component v117 (flux)" legend_algebraic[127] = "v128 in component v128 (flux)" legend_states[35] = "c36 in component c36 (molar)" legend_algebraic[119] = "v120 in component v120 (flux)" legend_states[36] = "c37 in component c37 (molar)" legend_algebraic[122] = "v123 in component v123 (flux)" legend_states[37] = "c38 in component c38 (molar)" legend_states[38] = "c39 in component c39 (molar)" legend_states[39] = "c40 in component c40 (molar)" legend_states[40] = "c41 in component c41 (molar)" legend_algebraic[44] = "v43 in component v43 (flux)" legend_algebraic[74] = "v75 in component v75 (flux)" legend_algebraic[84] = "v85 in component v85 (flux)" legend_states[41] = "c42 in component c42 (molar)" legend_algebraic[30] = "v29 in component v29 (flux)" legend_states[42] = "c43 in component c43 (molar)" legend_states[43] = "c44 in component c44 (molar)" legend_algebraic[43] = "v42 in component v42 (flux)" legend_algebraic[83] = "v84 in component v84 (flux)" legend_states[44] = "c45 in component c45 (molar)" legend_algebraic[45] = "v44 in component v44 (flux)" legend_algebraic[46] = "v45 in component v45 (flux)" legend_algebraic[47] = "v46 in component v46 (flux)" legend_algebraic[48] = "v47 in component v47 (flux)" legend_states[45] = "c46 in component c46 (molar)" legend_states[46] = "c47 in component c47 (molar)" legend_algebraic[52] = "v51 in component v51 (flux)" legend_algebraic[85] = "v86 in component v86 (flux)" legend_algebraic[95] = "v93 in component v93 (flux)" legend_states[47] = "c48 in component c48 (molar)" legend_states[48] = "c49 in component c49 (molar)" legend_algebraic[50] = "v49 in component v49 (flux)" legend_algebraic[51] = "v50 in component v50 (flux)" legend_states[49] = "c50 in component c50 (molar)" legend_states[50] = "c51 in component c51 (molar)" legend_algebraic[49] = "v48 in component v48 (flux)" legend_algebraic[53] = "v52 in component v52 (flux)" legend_algebraic[54] = "v53 in component v53 (flux)" legend_algebraic[55] = "v54 in component v54 (flux)" legend_algebraic[56] = "v55 in component v55 (flux)" legend_states[51] = "c52 in component c52 (molar)" legend_states[52] = "c53 in component c53 (molar)" legend_algebraic[89] = "v90 in component v90 (flux)" legend_algebraic[91] = "v91 in component v91 (flux)" legend_algebraic[93] = "v92 in component v92 (flux)" legend_states[53] = "c54 in component c54 (molar)" legend_states[54] = "c55 in component c55 (molar)" legend_algebraic[60] = "v59 in component v59 (flux)" legend_algebraic[90] = "v94 in component v94 (flux)" legend_algebraic[103] = "v101 in component v101 (flux)" legend_states[55] = "c56 in component c56 (molar)" legend_states[56] = "c57 in component c57 (molar)" legend_algebraic[58] = "v57 in component v57 (flux)" legend_algebraic[59] = "v58 in component v58 (flux)" legend_states[57] = "c58 in component c58 (molar)" legend_states[58] = "c59 in component c59 (molar)" legend_algebraic[57] = "v56 in component v56 (flux)" legend_algebraic[134] = "v143 in component v143 (flux)" legend_algebraic[136] = "v144 in component v144 (flux)" legend_algebraic[138] = "v145 in component v145 (flux)" legend_states[59] = "c60 in component c60 (molar)" legend_algebraic[97] = "v98 in component v98 (flux)" legend_algebraic[99] = "v99 in component v99 (flux)" legend_algebraic[101] = "v100 in component v100 (flux)" legend_states[60] = "c61 in component c61 (molar)" legend_states[61] = "c62 in component c62 (molar)" legend_states[62] = "c63 in component c63 (molar)" legend_algebraic[69] = "v70 in component v70 (flux)" legend_algebraic[139] = "v137 in component v137 (flux)" legend_states[63] = "c64 in component c64 (molar)" legend_algebraic[141] = "v138 in component v138 (flux)" legend_states[64] = "c65 in component c65 (molar)" legend_algebraic[143] = "v139 in component v139 (flux)" legend_states[65] = "c66 in component c66 (molar)" legend_algebraic[73] = "v74 in component v74 (flux)" legend_algebraic[76] = "v77 in component v77 (flux)" legend_algebraic[128] = "v129 in component v129 (flux)" legend_algebraic[145] = "v140 in component v140 (flux)" legend_states[66] = "c67 in component c67 (molar)" legend_algebraic[146] = "v141 in component v141 (flux)" legend_states[67] = "c68 in component c68 (molar)" legend_algebraic[147] = "v142 in component v142 (flux)" legend_states[68] = "c69 in component c69 (molar)" legend_states[69] = "c70 in component c70 (molar)" legend_algebraic[75] = "v76 in component v76 (flux)" legend_states[70] = "c71 in component c71 (molar)" legend_states[71] = "c72 in component c72 (molar)" legend_algebraic[86] = "v87 in component v87 (flux)" legend_algebraic[87] = "v88 in component v88 (flux)" legend_algebraic[88] = "v89 in component v89 (flux)" legend_states[72] = "c73 in component c73 (molar)" legend_states[73] = "c74 in component c74 (molar)" legend_states[74] = "c75 in component c75 (molar)" legend_states[75] = "c76 in component c76 (molar)" legend_states[76] = "c77 in component c77 (molar)" legend_algebraic[92] = "v95 in component v95 (flux)" legend_algebraic[94] = "v96 in component v96 (flux)" legend_algebraic[96] = "v97 in component v97 (flux)" legend_states[77] = "c78 in component c78 (molar)" legend_states[78] = "c79 in component c79 (molar)" legend_states[79] = "c80 in component c80 (molar)" legend_states[80] = "c81 in component c81 (molar)" legend_states[81] = "c82 in component c82 (molar)" legend_states[82] = "c83 in component c83 (molar)" legend_algebraic[140] = "v146 in component v146 (flux)" legend_algebraic[142] = "v147 in component v147 (flux)" legend_algebraic[144] = "v148 in component v148 (flux)" legend_states[83] = "c84 in component c84 (molar)" legend_states[84] = "c85 in component c85 (molar)" legend_states[85] = "c86 in component c86 (molar)" legend_states[86] = "c87 in component c87 (molar)" legend_states[87] = "c88 in component c88 (molar)" legend_states[88] = "c89 in component c89 (molar)" legend_states[89] = "c90 in component c90 (molar)" legend_states[90] = "c91 in component c91 (molar)" legend_states[91] = "c92 in component c92 (molar)" legend_states[92] = "c93 in component c93 (molar)" legend_states[93] = "c94 in component c94 (molar)" legend_states[94] = "c95 in component c95 (molar)" legend_states[95] = "c96 in component c96 (molar)" legend_states[96] = "c97 in component c97 (molar)" legend_states[97] = "c98 in component c98 (molar)" legend_states[98] = "c99 in component c99 (molar)" legend_states[99] = "c100 in component c100 (molar)" legend_states[100] = "c101 in component c101 (molar)" legend_states[101] = "c102 in component c102 (molar)" legend_states[102] = "c103 in component c103 (molar)" 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_constants[8] = "k5 in component reaction_rates (second_order_rate_constant)" legend_constants[9] = "kd5 in component reaction_rates (first_order_rate_constant)" legend_constants[10] = "k6 in component reaction_rates (first_order_rate_constant)" legend_constants[11] = "kd6 in component reaction_rates (first_order_rate_constant)" legend_constants[12] = "k8 in component reaction_rates (second_order_rate_constant)" legend_constants[13] = "kd8 in component reaction_rates (first_order_rate_constant)" legend_constants[14] = "k10b in component reaction_rates (second_order_rate_constant)" legend_constants[15] = "kd10 in component reaction_rates (first_order_rate_constant)" legend_constants[16] = "k13 in component reaction_rates (first_order_rate_constant)" legend_constants[17] = "kd13 in component reaction_rates (first_order_rate_constant)" legend_constants[18] = "k15 in component reaction_rates (first_order_rate_constant)" legend_constants[19] = "kd15 in component reaction_rates (first_order_rate_constant)" legend_constants[20] = "k16 in component reaction_rates (second_order_rate_constant)" legend_constants[21] = "kd63 in component reaction_rates (first_order_rate_constant)" legend_constants[22] = "k17 in component reaction_rates (second_order_rate_constant)" legend_constants[23] = "kd17 in component reaction_rates (first_order_rate_constant)" legend_constants[24] = "k18 in component reaction_rates (second_order_rate_constant)" legend_constants[25] = "kd18 in component reaction_rates (first_order_rate_constant)" legend_constants[26] = "k19 in component reaction_rates (second_order_rate_constant)" legend_constants[27] = "kd19 in component reaction_rates (first_order_rate_constant)" legend_constants[28] = "k20 in component reaction_rates (second_order_rate_constant)" legend_constants[29] = "kd20 in component reaction_rates (first_order_rate_constant)" legend_constants[30] = "k21 in component reaction_rates (second_order_rate_constant)" legend_constants[31] = "kd21 in component reaction_rates (first_order_rate_constant)" legend_constants[32] = "k22 in component reaction_rates (second_order_rate_constant)" legend_constants[33] = "kd22 in component reaction_rates (first_order_rate_constant)" legend_constants[34] = "k23 in component reaction_rates (first_order_rate_constant)" legend_constants[35] = "kd23 in component reaction_rates (first_order_rate_constant)" legend_constants[36] = "kd24 in component reaction_rates (first_order_rate_constant)" legend_constants[37] = "k25 in component reaction_rates (second_order_rate_constant)" legend_constants[38] = "kd25 in component reaction_rates (first_order_rate_constant)" legend_constants[39] = "k28 in component reaction_rates (second_order_rate_constant)" legend_constants[40] = "kd28 in component reaction_rates (first_order_rate_constant)" legend_constants[41] = "k29 in component reaction_rates (second_order_rate_constant)" legend_constants[42] = "kd29 in component reaction_rates (first_order_rate_constant)" legend_constants[43] = "k32 in component reaction_rates (second_order_rate_constant)" legend_constants[44] = "kd32 in component reaction_rates (first_order_rate_constant)" legend_constants[45] = "k33 in component reaction_rates (second_order_rate_constant)" legend_constants[46] = "kd33 in component reaction_rates (first_order_rate_constant)" legend_constants[47] = "k34 in component reaction_rates (second_order_rate_constant)" legend_constants[48] = "kd34 in component reaction_rates (first_order_rate_constant)" legend_constants[49] = "k35 in component reaction_rates (second_order_rate_constant)" legend_constants[50] = "kd35 in component reaction_rates (first_order_rate_constant)" legend_constants[51] = "k36 in component reaction_rates (first_order_rate_constant)" legend_constants[52] = "kd36 in component reaction_rates (first_order_rate_constant)" legend_constants[53] = "k37 in component reaction_rates (second_order_rate_constant)" legend_constants[54] = "kd37 in component reaction_rates (first_order_rate_constant)" legend_constants[55] = "k40 in component reaction_rates (second_order_rate_constant)" legend_constants[56] = "kd40 in component reaction_rates (first_order_rate_constant)" legend_constants[57] = "k41 in component reaction_rates (second_order_rate_constant)" legend_constants[58] = "kd41 in component reaction_rates (first_order_rate_constant)" legend_constants[59] = "k42 in component reaction_rates (second_order_rate_constant)" legend_constants[60] = "kd42 in component reaction_rates (first_order_rate_constant)" legend_constants[61] = "k43 in component reaction_rates (second_order_rate_constant)" legend_constants[62] = "kd43 in component reaction_rates (first_order_rate_constant)" legend_constants[63] = "k44 in component reaction_rates (second_order_rate_constant)" legend_constants[64] = "kd52 in component reaction_rates (first_order_rate_constant)" legend_constants[65] = "k45 in component reaction_rates (second_order_rate_constant)" legend_constants[66] = "kd45 in component reaction_rates (first_order_rate_constant)" legend_constants[67] = "k47 in component reaction_rates (second_order_rate_constant)" legend_constants[68] = "kd47 in component reaction_rates (first_order_rate_constant)" legend_constants[69] = "k48 in component reaction_rates (second_order_rate_constant)" legend_constants[70] = "kd48 in component reaction_rates (first_order_rate_constant)" legend_constants[71] = "k49 in component reaction_rates (second_order_rate_constant)" legend_constants[72] = "kd49 in component reaction_rates (first_order_rate_constant)" legend_constants[73] = "k50 in component reaction_rates (second_order_rate_constant)" legend_constants[74] = "kd50 in component reaction_rates (first_order_rate_constant)" legend_constants[75] = "k52 in component reaction_rates (second_order_rate_constant)" legend_constants[76] = "kd44 in component reaction_rates (first_order_rate_constant)" legend_constants[77] = "k53 in component reaction_rates (second_order_rate_constant)" legend_constants[78] = "kd53 in component reaction_rates (first_order_rate_constant)" legend_constants[79] = "k55 in component reaction_rates (second_order_rate_constant)" legend_constants[80] = "kd55 in component reaction_rates (first_order_rate_constant)" legend_constants[81] = "k56 in component reaction_rates (second_order_rate_constant)" legend_constants[82] = "kd56 in component reaction_rates (first_order_rate_constant)" legend_constants[83] = "k57 in component reaction_rates (second_order_rate_constant)" legend_constants[84] = "kd57 in component reaction_rates (first_order_rate_constant)" legend_constants[85] = "k58 in component reaction_rates (second_order_rate_constant)" legend_constants[86] = "kd58 in component reaction_rates (first_order_rate_constant)" legend_constants[87] = "k60 in component reaction_rates (first_order_rate_constant)" legend_constants[88] = "kd60 in component reaction_rates (first_order_rate_constant)" legend_constants[89] = "k61 in component reaction_rates (first_order_rate_constant)" legend_constants[90] = "kd61 in component reaction_rates (first_order_rate_constant)" legend_constants[91] = "k126 in component reaction_rates (second_order_rate_constant)" legend_constants[92] = "kd126 in component reaction_rates (first_order_rate_constant)" legend_constants[93] = "k127 in component reaction_rates (second_order_rate_constant)" legend_constants[94] = "kd127 in component reaction_rates (first_order_rate_constant)" legend_rates[0] = "d/dt c1 in component c1 (molar)" legend_rates[1] = "d/dt c2 in component c2 (molar)" legend_rates[2] = "d/dt c3 in component c3 (molar)" legend_rates[3] = "d/dt c4 in component c4 (molar)" legend_rates[4] = "d/dt c5 in component c5 (molar)" legend_rates[5] = "d/dt c6 in component c6 (molar)" legend_rates[6] = "d/dt c7 in component c7 (molar)" legend_rates[7] = "d/dt c8 in component c8 (molar)" legend_rates[8] = "d/dt c9 in component c9 (molar)" legend_rates[9] = "d/dt c10 in component c10 (molar)" legend_rates[10] = "d/dt c11 in component c11 (molar)" legend_rates[11] = "d/dt c12 in component c12 (molar)" legend_rates[12] = "d/dt c13 in component c13 (molar)" legend_rates[13] = "d/dt c14 in component c14 (molar)" legend_rates[14] = "d/dt c15 in component c15 (molar)" legend_rates[15] = "d/dt c16 in component c16 (molar)" legend_rates[16] = "d/dt c17 in component c17 (molar)" legend_rates[17] = "d/dt c18 in component c18 (molar)" legend_rates[18] = "d/dt c19 in component c19 (molar)" legend_rates[19] = "d/dt c20 in component c20 (molar)" legend_rates[20] = "d/dt c21 in component c21 (molar)" legend_rates[21] = "d/dt c22 in component c22 (molar)" legend_rates[22] = "d/dt c23 in component c23 (molar)" legend_rates[23] = "d/dt c24 in component c24 (molar)" legend_rates[24] = "d/dt c25 in component c25 (molar)" legend_rates[25] = "d/dt c26 in component c26 (molar)" legend_rates[26] = "d/dt c27 in component c27 (molar)" legend_rates[27] = "d/dt c28 in component c28 (molar)" legend_rates[28] = "d/dt c29 in component c29 (molar)" legend_rates[29] = "d/dt c30 in component c30 (molar)" legend_rates[30] = "d/dt c31 in component c31 (molar)" legend_rates[31] = "d/dt c32 in component c32 (molar)" legend_rates[32] = "d/dt c33 in component c33 (molar)" legend_rates[33] = "d/dt c34 in component c34 (molar)" legend_rates[34] = "d/dt c35 in component c35 (molar)" legend_rates[35] = "d/dt c36 in component c36 (molar)" legend_rates[36] = "d/dt c37 in component c37 (molar)" legend_rates[37] = "d/dt c38 in component c38 (molar)" legend_rates[38] = "d/dt c39 in component c39 (molar)" legend_rates[39] = "d/dt c40 in component c40 (molar)" legend_rates[40] = "d/dt c41 in component c41 (molar)" legend_rates[41] = "d/dt c42 in component c42 (molar)" legend_rates[42] = "d/dt c43 in component c43 (molar)" legend_rates[43] = "d/dt c44 in component c44 (molar)" legend_rates[44] = "d/dt c45 in component c45 (molar)" legend_rates[45] = "d/dt c46 in component c46 (molar)" legend_rates[46] = "d/dt c47 in component c47 (molar)" legend_rates[47] = "d/dt c48 in component c48 (molar)" legend_rates[48] = "d/dt c49 in component c49 (molar)" legend_rates[49] = "d/dt c50 in component c50 (molar)" legend_rates[50] = "d/dt c51 in component c51 (molar)" legend_rates[51] = "d/dt c52 in component c52 (molar)" legend_rates[52] = "d/dt c53 in component c53 (molar)" legend_rates[53] = "d/dt c54 in component c54 (molar)" legend_rates[54] = "d/dt c55 in component c55 (molar)" legend_rates[55] = "d/dt c56 in component c56 (molar)" legend_rates[56] = "d/dt c57 in component c57 (molar)" legend_rates[57] = "d/dt c58 in component c58 (molar)" legend_rates[58] = "d/dt c59 in component c59 (molar)" legend_rates[59] = "d/dt c60 in component c60 (molar)" legend_rates[60] = "d/dt c61 in component c61 (molar)" legend_rates[61] = "d/dt c62 in component c62 (molar)" legend_rates[62] = "d/dt c63 in component c63 (molar)" legend_rates[63] = "d/dt c64 in component c64 (molar)" legend_rates[64] = "d/dt c65 in component c65 (molar)" legend_rates[65] = "d/dt c66 in component c66 (molar)" legend_rates[66] = "d/dt c67 in component c67 (molar)" legend_rates[67] = "d/dt c68 in component c68 (molar)" legend_rates[68] = "d/dt c69 in component c69 (molar)" legend_rates[69] = "d/dt c70 in component c70 (molar)" legend_rates[70] = "d/dt c71 in component c71 (molar)" legend_rates[71] = "d/dt c72 in component c72 (molar)" legend_rates[72] = "d/dt c73 in component c73 (molar)" legend_rates[73] = "d/dt c74 in component c74 (molar)" legend_rates[74] = "d/dt c75 in component c75 (molar)" legend_rates[75] = "d/dt c76 in component c76 (molar)" legend_rates[76] = "d/dt c77 in component c77 (molar)" legend_rates[77] = "d/dt c78 in component c78 (molar)" legend_rates[78] = "d/dt c79 in component c79 (molar)" legend_rates[79] = "d/dt c80 in component c80 (molar)" legend_rates[80] = "d/dt c81 in component c81 (molar)" legend_rates[81] = "d/dt c82 in component c82 (molar)" legend_rates[82] = "d/dt c83 in component c83 (molar)" legend_rates[83] = "d/dt c84 in component c84 (molar)" legend_rates[84] = "d/dt c85 in component c85 (molar)" legend_rates[85] = "d/dt c86 in component c86 (molar)" legend_rates[86] = "d/dt c87 in component c87 (molar)" legend_rates[87] = "d/dt c88 in component c88 (molar)" legend_rates[88] = "d/dt c89 in component c89 (molar)" legend_rates[89] = "d/dt c90 in component c90 (molar)" legend_rates[90] = "d/dt c91 in component c91 (molar)" legend_rates[91] = "d/dt c92 in component c92 (molar)" legend_rates[92] = "d/dt c93 in component c93 (molar)" legend_rates[93] = "d/dt c94 in component c94 (molar)" legend_rates[94] = "d/dt c95 in component c95 (molar)" legend_rates[95] = "d/dt c96 in component c96 (molar)" legend_rates[96] = "d/dt c97 in component c97 (molar)" legend_rates[97] = "d/dt c98 in component c98 (molar)" legend_rates[98] = "d/dt c99 in component c99 (molar)" legend_rates[99] = "d/dt c100 in component c100 (molar)" legend_rates[100] = "d/dt c101 in component c101 (molar)" legend_rates[101] = "d/dt c102 in component c102 (molar)" legend_rates[102] = "d/dt c103 in component c103 (molar)" return (legend_states, legend_algebraic, legend_voi, legend_constants) def initConsts(): constants = [0.0] * sizeConstants; states = [0.0] * sizeStates; states[0] = 5.0E-8 states[1] = 5.0E4 states[2] = 0.0 states[3] = 0.0 states[4] = 0.0 states[5] = 0.0 states[6] = 0.0 states[7] = 0.0 states[8] = 0.0 states[9] = 0.0 states[10] = 0.0 states[11] = 8.1E4 states[12] = 0.0 states[13] = 1.2E4 states[14] = 0.0 states[15] = 0.0 states[16] = 0.0 states[17] = 0.0 states[18] = 0.0 states[19] = 0.0 states[20] = 0.0 states[21] = 1.1E4 states[22] = 0.0 states[23] = 2.63E4 states[24] = 0.0 states[25] = 7.2E4 states[26] = 0.0 states[27] = 0.0 states[28] = 0.0 states[29] = 4.0E4 states[30] = 1.01E5 states[31] = 0.0 states[32] = 0.0 states[33] = 0.0 states[34] = 0.0 states[35] = 0.0 states[36] = 0.0 states[37] = 0.0 states[38] = 0.0 states[39] = 0.0 states[40] = 4.0E4 states[41] = 0.0 states[42] = 0.0 states[43] = 4.0E4 states[44] = 0.0 states[45] = 0.0 states[46] = 2.1E7 states[47] = 0.0 states[48] = 0.0 states[49] = 0.0 states[50] = 0.0 states[51] = 0.0 states[52] = 4.0E4 states[53] = 0.0 states[54] = 2.21E7 states[55] = 0.0 states[56] = 0.0 states[57] = 0.0 states[58] = 0.0 states[59] = 1.0E7 states[60] = 0.0 states[61] = 0.0 states[62] = 0.0 states[63] = 0.0 states[64] = 0.0 states[65] = 0.0 states[66] = 0.0 states[67] = 0.0 states[68] = 0.0 states[69] = 0.0 states[70] = 0.0 states[71] = 0.0 states[72] = 0.0 states[73] = 0.0 states[74] = 0.0 states[75] = 0.0 states[76] = 0.0 states[77] = 0.0 states[78] = 0.0 states[79] = 0.0 states[80] = 0.0 states[81] = 0.0 states[82] = 0.0 states[83] = 0.0 states[84] = 0.0 states[85] = 0.0 states[86] = 0.0 states[87] = 0.0 states[88] = 0.0 states[89] = 0.0 states[90] = 0.0 states[91] = 0.0 states[92] = 0.0 states[93] = 0.0 states[94] = 0.0 states[95] = 0.0 states[96] = 0.0 states[97] = 0.0 states[98] = 0.0 states[99] = 0.0 states[100] = 0.0 states[101] = 0.0 states[102] = 0.0 constants[0] = 3.0E7 constants[1] = 3.84E-3 constants[2] = 1.66E-5 constants[3] = 1E-1 constants[4] = 1E0 constants[5] = 1E-2 constants[6] = 1.73E-7 constants[7] = 1.66E-3 constants[8] = 0E0 constants[9] = 1.46E-2 constants[10] = 5E-4 constants[11] = 5E-3 constants[12] = 1.66E-6 constants[13] = 2E-1 constants[14] = 5.43E-2 constants[15] = 1.1E-2 constants[16] = 2.17E0 constants[17] = 0E0 constants[18] = 1E4 constants[19] = 0E0 constants[20] = 1.66E-5 constants[21] = 2.75E-1 constants[22] = 1.66E-5 constants[23] = 6E-2 constants[24] = 2.5E-5 constants[25] = 1.3E0 constants[26] = 1.66E-7 constants[27] = 5E-1 constants[28] = 3.5E-6 constants[29] = 4E-1 constants[30] = 3.66E-7 constants[31] = 2.3E-2 constants[32] = 3.5E-5 constants[33] = 1E-1 constants[34] = 6E0 constants[35] = 6E-2 constants[36] = 5.5E-1 constants[37] = 1.66E-5 constants[38] = 2.14E-2 constants[39] = 1.66E-6 constants[40] = 5.3E-3 constants[41] = 1.17E-6 constants[42] = 1E0 constants[43] = 4E-7 constants[44] = 1E-1 constants[45] = 3.5E-5 constants[46] = 2E-1 constants[47] = 7.5E-6 constants[48] = 3E-2 constants[49] = 7.5E-6 constants[50] = 1.5E-3 constants[51] = 5E-3 constants[52] = 0E0 constants[53] = 1.5E-6 constants[54] = 3E-1 constants[55] = 5E-5 constants[56] = 6.4E-2 constants[57] = 5E-5 constants[58] = 4.29E-2 constants[59] = 1.18E-4 constants[60] = 2E-1 constants[61] = 0E0 constants[62] = 1E0 constants[63] = 1.95E-5 constants[64] = 3.3E-2 constants[65] = 0E0 constants[66] = 3.5E0 constants[67] = 0E0 constants[68] = 2.9E0 constants[69] = 2.38E-5 constants[70] = 8E-1 constants[71] = 0E0 constants[72] = 5.68E-2 constants[73] = 4.5E-7 constants[74] = 5E-1 constants[75] = 8.91E-5 constants[76] = 1.83E-2 constants[77] = 0E0 constants[78] = 1.6E1 constants[79] = 0E0 constants[80] = 5.7E0 constants[81] = 2.35E-5 constants[82] = 6E-1 constants[83] = 0E0 constants[84] = 2.46E-1 constants[85] = 8.33E-6 constants[86] = 5E-1 constants[87] = 5.5E-3 constants[88] = 0E0 constants[89] = 6.7E-4 constants[90] = 0E0 constants[91] = 1.66E-7 constants[92] = 2E0 constants[93] = 0E0 constants[94] = 1E-4 constants[95] = 0.00000 return (states, constants) def computeRates(voi, states, constants): rates = [0.0] * sizeStates; algebraic = [0.0] * sizeAlgebraic rates[0] = constants[95] algebraic[0] = constants[0]*states[0]*states[1]-constants[1]*states[2] algebraic[1] = constants[2]*states[2]*states[2]-constants[3]*states[3] rates[2] = algebraic[0]-2.00000*algebraic[1] algebraic[2] = constants[4]*states[3]*1.00000-constants[5]*states[4] rates[3] = algebraic[1]-algebraic[2] algebraic[3] = constants[6]*states[22]*states[11]-constants[7]*states[6] algebraic[4] = constants[8]*states[17]*states[8]-constants[9]*states[6] rates[6] = algebraic[3]+algebraic[4] algebraic[5] = constants[10]*states[1]-constants[11]*states[5] algebraic[6] = constants[16]*1.00000-constants[17]*states[1] rates[1] = algebraic[6]-(algebraic[0]+algebraic[5]) algebraic[7] = constants[10]*states[4]-constants[11]*states[7] algebraic[8] = constants[12]*states[4]*states[13]-constants[13]*states[14] rates[4] = algebraic[2]-(algebraic[7]+algebraic[8]) algebraic[10] = constants[14]*states[5]*states[15]-constants[15]*states[9] algebraic[11] = constants[87]*states[5]-constants[88]*states[85] rates[5] = algebraic[5]-(algebraic[10]+algebraic[11]) algebraic[12] = constants[2]*states[9]*states[9]-constants[3]*states[10] rates[9] = algebraic[10]-2.00000*algebraic[12] algebraic[13] = constants[89]*states[15]-constants[90]*states[12] rates[12] = algebraic[13] rates[15] = -(algebraic[10]+algebraic[13]) rates[85] = algebraic[11] algebraic[14] = constants[4]*states[10]-constants[5]*states[7] rates[10] = algebraic[12]-algebraic[14] algebraic[15] = constants[12]*states[7]*states[13]-constants[13]*states[16] rates[13] = -(algebraic[8]+algebraic[15]) algebraic[17] = constants[20]*states[21]*states[14]-constants[21]*states[22] algebraic[9] = constants[10]*states[22]-constants[11]*states[17] algebraic[18] = constants[22]*states[23]*states[22]-constants[23]*states[24] rates[22] = algebraic[17]-(algebraic[3]+algebraic[9]+algebraic[18]) algebraic[20] = constants[26]*states[27]*states[24]-constants[27]*states[26] algebraic[28] = constants[26]*states[34]*states[27]-constants[27]*states[35] algebraic[29] = constants[39]*states[27]*states[40]-constants[40]*states[41] rates[27] = -(algebraic[20]+algebraic[28]+algebraic[29]) algebraic[30] = constants[41]*states[42]*states[44]-constants[42]*states[41] rates[41] = algebraic[29]+algebraic[30] algebraic[21] = constants[28]*states[24]*states[42]-constants[29]*states[28] algebraic[31] = constants[28]*states[34]*states[42]-constants[29]*states[36] rates[42] = -(algebraic[30]+algebraic[21]+algebraic[31]) algebraic[44] = constants[61]*states[40]*states[43]-constants[62]*states[45] algebraic[43] = constants[59]*states[43]*states[44]-constants[60]*states[45] rates[45] = algebraic[43]+algebraic[44] algebraic[45] = constants[63]*states[46]*states[44]-constants[64]*states[47] algebraic[46] = constants[65]*states[48]*states[44]-constants[66]*states[47] rates[47] = algebraic[45]+algebraic[46] algebraic[47] = constants[63]*states[48]*states[44]-constants[64]*states[49] algebraic[48] = constants[67]*states[50]*states[44]-constants[68]*states[49] rates[44] = -(algebraic[30]+algebraic[43]+algebraic[45]+algebraic[46]+algebraic[47]+algebraic[48]) rates[49] = algebraic[47]+algebraic[48] algebraic[50] = constants[71]*states[48]*states[52]-constants[72]*states[51] algebraic[49] = constants[69]*states[50]*states[52]-constants[70]*states[51] rates[51] = algebraic[49]+algebraic[50] algebraic[51] = constants[73]*states[52]*states[48]-constants[74]*states[53] rates[48] = -(algebraic[46]+algebraic[47]+algebraic[50]+algebraic[51]) algebraic[52] = constants[71]*states[46]*states[52]-constants[72]*states[53] rates[53] = algebraic[51]+algebraic[52] algebraic[53] = constants[75]*states[54]*states[50]-constants[76]*states[55] algebraic[54] = constants[77]*states[50]*states[56]-constants[78]*states[55] rates[55] = algebraic[53]+algebraic[54] algebraic[55] = constants[75]*states[50]*states[56]-constants[76]*states[57] algebraic[56] = constants[79]*states[58]*states[50]-constants[80]*states[57] rates[50] = -(algebraic[48]+algebraic[54]+algebraic[56]+algebraic[49]+algebraic[53]+algebraic[55]) rates[57] = algebraic[55]+algebraic[56] algebraic[58] = constants[83]*states[56]*states[59]-constants[84]*states[60] algebraic[57] = constants[81]*states[58]*states[59]-constants[82]*states[60] rates[60] = algebraic[57]+algebraic[58] algebraic[59] = constants[85]*states[59]*states[56]-constants[86]*states[61] rates[56] = -(algebraic[54]+algebraic[55]+algebraic[58]+algebraic[59]) algebraic[60] = constants[83]*states[54]*states[59]-constants[84]*states[61] rates[61] = algebraic[59]+algebraic[60] algebraic[61] = constants[87]*states[7]-constants[88]*states[86] rates[7] = (algebraic[7]+algebraic[14])-(algebraic[15]+algebraic[61]) algebraic[23] = constants[32]*states[30]*states[14]-constants[33]*states[31] algebraic[68] = constants[32]*states[30]*states[16]-constants[33]*states[62] algebraic[37] = constants[51]*states[39]-constants[52]*states[30] rates[30] = algebraic[37]-(algebraic[23]+algebraic[68]) algebraic[62] = constants[20]*states[16]*states[21]-constants[21]*states[17] algebraic[25] = constants[20]*states[21]*states[32]-constants[36]*states[33] algebraic[36] = constants[49]*states[23]*states[21]-constants[50]*states[29] algebraic[39] = constants[20]*states[21]*states[39]-constants[36]*states[38] algebraic[70] = constants[20]*states[21]*states[63]-constants[36]*states[64] rates[21] = -(algebraic[17]+algebraic[25]+algebraic[36]+algebraic[39]+algebraic[62]+algebraic[70]) algebraic[65] = constants[26]*states[68]*states[18]-constants[27]*states[19] algebraic[74] = constants[39]*states[68]*states[40]-constants[40]*states[69] algebraic[73] = constants[26]*states[65]*states[68]-constants[27]*states[66] rates[68] = -(algebraic[65]+algebraic[73]+algebraic[74]) algebraic[75] = constants[41]*states[70]*states[71]-constants[42]*states[69] rates[69] = algebraic[74]+algebraic[75] algebraic[66] = constants[28]*states[70]*states[18]-constants[29]*states[20] algebraic[76] = constants[28]*states[70]*states[65]-constants[29]*states[67] rates[70] = -(algebraic[66]+algebraic[75]+algebraic[76]) algebraic[64] = constants[24]*states[25]*states[18]-constants[25]*states[19] algebraic[67] = constants[30]*states[18]*states[25]-constants[31]*states[20] algebraic[19] = constants[24]*states[25]*states[24]-constants[25]*states[26] algebraic[22] = constants[30]*states[24]*states[25]-constants[31]*states[28] algebraic[27] = constants[24]*states[25]*states[34]-constants[25]*states[35] algebraic[32] = constants[30]*states[34]*states[25]-constants[31]*states[36] algebraic[77] = constants[30]*states[65]*states[25]-constants[31]*states[67] algebraic[72] = constants[24]*states[25]*states[65]-constants[25]*states[66] rates[25] = -(algebraic[19]+algebraic[22]+algebraic[27]+algebraic[32]+algebraic[64]+algebraic[67]+algebraic[72]+algebraic[77]) algebraic[33] = constants[43]*states[37]*states[14]-constants[44]*states[34] algebraic[78] = constants[43]*states[16]*states[37]-constants[44]*states[65] algebraic[41] = constants[55]*states[23]*states[38]-constants[56]*states[37] algebraic[34] = constants[45]*states[39]*states[29]-constants[46]*states[37] rates[37] = (algebraic[34]+algebraic[41])-(algebraic[33]+algebraic[78]) algebraic[38] = constants[53]*states[14]*states[39]-constants[54]*states[32] algebraic[80] = constants[53]*states[16]*states[39]-constants[54]*states[63] rates[39] = -(algebraic[34]+algebraic[37]+algebraic[38]+algebraic[39]+algebraic[80]) algebraic[40] = constants[53]*states[14]*states[38]-constants[54]*states[33] algebraic[81] = constants[53]*states[16]*states[38]-constants[54]*states[64] rates[38] = algebraic[39]-(algebraic[40]+algebraic[41]+algebraic[81]) algebraic[35] = constants[47]*states[14]*states[29]-constants[48]*states[24] algebraic[79] = constants[47]*states[16]*states[29]-constants[48]*states[18] algebraic[42] = constants[57]*states[29]*states[32]-constants[58]*states[34] algebraic[82] = constants[57]*states[29]*states[63]-constants[58]*states[65] rates[29] = algebraic[36]-(algebraic[34]+algebraic[35]+algebraic[42]+algebraic[79]+algebraic[82]) algebraic[84] = constants[61]*states[40]*states[43]-constants[62]*states[72] rates[40] = -(algebraic[29]+algebraic[44]+algebraic[74]+algebraic[84]) algebraic[83] = constants[59]*states[43]*states[71]-constants[60]*states[72] rates[43] = -(algebraic[43]+algebraic[44]+algebraic[83]+algebraic[84]) rates[72] = algebraic[83]+algebraic[84] algebraic[85] = constants[63]*states[46]*states[71]-constants[64]*states[73] algebraic[86] = constants[65]*states[74]*states[71]-constants[66]*states[73] rates[73] = algebraic[85]+algebraic[86] algebraic[87] = constants[63]*states[71]*states[74]-constants[64]*states[75] algebraic[88] = constants[67]*states[71]*states[76]-constants[68]*states[75] rates[71] = -(algebraic[75]+algebraic[83]+algebraic[85]+algebraic[86]+algebraic[87]+algebraic[88]) rates[75] = algebraic[87]+algebraic[88] algebraic[89] = constants[69]*states[76]*states[52]-constants[70]*states[77] algebraic[91] = constants[71]*states[74]*states[52]-constants[72]*states[77] rates[77] = algebraic[89]+algebraic[91] algebraic[93] = constants[73]*states[52]*states[74]-constants[74]*states[78] rates[74] = -(algebraic[86]+algebraic[87]+algebraic[91]+algebraic[93]) algebraic[90] = constants[75]*states[54]*states[76]-constants[76]*states[79] algebraic[92] = constants[77]*states[80]*states[76]-constants[78]*states[79] rates[79] = algebraic[90]+algebraic[92] algebraic[95] = constants[71]*states[46]*states[52]-constants[72]*states[78] rates[46] = -(algebraic[45]+algebraic[52]+algebraic[85]+algebraic[95]) rates[52] = -(algebraic[49]+algebraic[50]+algebraic[51]+algebraic[52]+algebraic[89]+algebraic[91]+algebraic[93]+algebraic[95]) rates[78] = algebraic[93]+algebraic[95] algebraic[94] = constants[75]*states[76]*states[80]-constants[76]*states[81] algebraic[96] = constants[79]*states[82]*states[76]-constants[80]*states[81] rates[76] = -(algebraic[88]+algebraic[89]+algebraic[90]+algebraic[92]+algebraic[94]+algebraic[96]) rates[81] = algebraic[94]+algebraic[96] algebraic[98] = constants[10]*states[14]-constants[11]*states[16] rates[14] = algebraic[8]-(algebraic[17]+algebraic[23]+algebraic[33]+algebraic[35]+algebraic[38]+algebraic[40]+algebraic[98]) algebraic[97] = constants[81]*states[82]*states[59]-constants[82]*states[83] algebraic[99] = constants[83]*states[80]*states[59]-constants[84]*states[83] rates[83] = algebraic[97]+algebraic[99] algebraic[24] = constants[34]*states[31]-constants[35]*states[32] algebraic[100] = constants[10]*states[31]-constants[11]*states[62] rates[31] = algebraic[23]-(algebraic[24]+algebraic[100]) algebraic[101] = constants[85]*states[59]*states[80]-constants[86]*states[84] rates[80] = -(algebraic[92]+algebraic[94]+algebraic[99]+algebraic[101]) algebraic[102] = constants[10]*states[32]-constants[11]*states[63] rates[32] = (algebraic[24]+algebraic[38])-(algebraic[25]+algebraic[42]+algebraic[102]) algebraic[103] = constants[83]*states[54]*states[59]-constants[84]*states[84] rates[54] = -(algebraic[53]+algebraic[60]+algebraic[90]+algebraic[103]) rates[59] = -(algebraic[57]+algebraic[58]+algebraic[59]+algebraic[60]+algebraic[97]+algebraic[99]+algebraic[101]+algebraic[103]) rates[84] = algebraic[101]+algebraic[103] algebraic[106] = constants[8]*states[8]*states[18]-constants[9]*states[87] algebraic[105] = constants[6]*states[24]*states[11]-constants[7]*states[87] rates[87] = algebraic[105]+algebraic[106] algebraic[108] = constants[6]*states[26]*states[11]-constants[7]*states[88] algebraic[107] = constants[10]*states[26]-constants[11]*states[19] rates[26] = (algebraic[19]+algebraic[20])-(algebraic[107]+algebraic[108]) algebraic[109] = constants[8]*states[8]*states[19]-constants[9]*states[88] rates[88] = algebraic[108]+algebraic[109] algebraic[111] = constants[6]*states[28]*states[11]-constants[7]*states[89] algebraic[110] = constants[10]*states[28]-constants[11]*states[20] rates[28] = (algebraic[21]+algebraic[22])-(algebraic[110]+algebraic[111]) algebraic[112] = constants[8]*states[8]*states[20]-constants[9]*states[89] rates[89] = algebraic[111]+algebraic[112] algebraic[114] = constants[6]*states[33]*states[11]-constants[7]*states[90] algebraic[26] = constants[37]*states[23]*states[33]-constants[38]*states[34] algebraic[113] = constants[10]*states[33]-constants[11]*states[64] rates[33] = (algebraic[40]+algebraic[25])-(algebraic[26]+algebraic[113]+algebraic[114]) algebraic[115] = constants[8]*states[8]*states[64]-constants[9]*states[90] rates[90] = algebraic[114]+algebraic[115] algebraic[118] = constants[8]*states[8]*states[65]-constants[9]*states[91] algebraic[117] = constants[6]*states[34]*states[11]-constants[7]*states[91] rates[91] = algebraic[117]+algebraic[118] algebraic[120] = constants[6]*states[35]*states[11]-constants[7]*states[92] algebraic[119] = constants[10]*states[35]-constants[11]*states[66] rates[35] = (algebraic[28]+algebraic[27])-(algebraic[119]+algebraic[120]) algebraic[121] = constants[8]*states[8]*states[66]-constants[9]*states[92] rates[92] = algebraic[120]+algebraic[121] algebraic[16] = constants[18]*states[8]-constants[19]*states[11] algebraic[123] = constants[6]*states[36]*states[11]-constants[7]*states[93] rates[11] = algebraic[16]-(algebraic[3]+algebraic[105]+algebraic[108]+algebraic[111]+algebraic[114]+algebraic[117]+algebraic[120]+algebraic[123]) algebraic[122] = constants[10]*states[36]-constants[11]*states[67] rates[36] = (algebraic[31]+algebraic[32])-(algebraic[122]+algebraic[123]) algebraic[124] = constants[8]*states[67]*states[8]-constants[9]*states[93] rates[8] = -(algebraic[4]+algebraic[16]+algebraic[106]+algebraic[109]+algebraic[112]+algebraic[115]+algebraic[118]+algebraic[121]+algebraic[124]) rates[93] = algebraic[123]+algebraic[124] algebraic[104] = constants[10]*states[24]-constants[11]*states[18] algebraic[125] = constants[91]*states[58]*states[24]-constants[92]*states[94] rates[24] = (algebraic[18]+algebraic[35])-(algebraic[19]+algebraic[20]+algebraic[21]+algebraic[22]+algebraic[104]+algebraic[105]+algebraic[125]) algebraic[116] = constants[10]*states[34]-constants[11]*states[65] algebraic[127] = constants[91]*states[58]*states[34]-constants[92]*states[96] rates[34] = (algebraic[26]+algebraic[33]+algebraic[42])-(algebraic[116]+algebraic[117]+algebraic[127]+algebraic[27]+algebraic[28]+algebraic[31]+algebraic[32]) algebraic[129] = constants[87]*states[16]-constants[88]*states[86] rates[16] = (algebraic[15]+algebraic[98])-(algebraic[62]+algebraic[68]+algebraic[78]+algebraic[79]+algebraic[80]+algebraic[81]+algebraic[129]) algebraic[63] = constants[22]*states[23]*states[17]-constants[23]*states[18] algebraic[131] = constants[87]*states[17]-constants[88]*states[86] rates[17] = (algebraic[9]+algebraic[62])-(algebraic[4]+algebraic[63]+algebraic[131]) algebraic[71] = constants[37]*states[23]*states[64]-constants[38]*states[65] algebraic[130] = constants[91]*states[58]*states[23]-constants[92]*states[100] algebraic[132] = constants[91]*states[82]*states[23]-constants[92]*states[101] rates[23] = -(algebraic[18]+algebraic[26]+algebraic[36]+algebraic[41]+algebraic[63]+algebraic[71]+algebraic[130]+algebraic[132]) algebraic[126] = constants[91]*states[82]*states[18]-constants[92]*states[95] algebraic[133] = constants[87]*states[18]-constants[88]*states[86] rates[18] = (algebraic[79]+algebraic[63]+algebraic[104])-(algebraic[64]+algebraic[65]+algebraic[66]+algebraic[67]+algebraic[106]+algebraic[126]+algebraic[133]) algebraic[134] = constants[93]*states[58]*states[98]-constants[94]*states[94] rates[94] = algebraic[125]+algebraic[134] algebraic[135] = constants[87]*states[19]-constants[88]*states[86] rates[19] = (algebraic[64]+algebraic[65]+algebraic[107])-(algebraic[109]+algebraic[135]) algebraic[136] = constants[93]*states[58]*states[98]-constants[94]*states[96] rates[96] = algebraic[127]+algebraic[136] rates[98] = -(algebraic[134]+algebraic[136]) algebraic[137] = constants[87]*states[20]-constants[88]*states[86] rates[20] = (algebraic[66]+algebraic[67]+algebraic[110])-(algebraic[112]+algebraic[137]) algebraic[138] = constants[93]*states[58]*states[102]-constants[94]*states[100] rates[58] = -(algebraic[56]+algebraic[57]+algebraic[125]+algebraic[127]+algebraic[130]+algebraic[134]+algebraic[136]+algebraic[138]) rates[100] = algebraic[130]+algebraic[138] algebraic[69] = constants[34]*states[62]-constants[35]*states[63] algebraic[139] = constants[87]*states[62]-constants[88]*states[86] rates[62] = (algebraic[68]+algebraic[100])-(algebraic[69]+algebraic[139]) algebraic[140] = constants[93]*states[82]*states[99]-constants[94]*states[95] rates[95] = algebraic[126]+algebraic[140] algebraic[141] = constants[87]*states[63]-constants[88]*states[86] rates[63] = (algebraic[69]+algebraic[80]+algebraic[102])-(algebraic[70]+algebraic[82]+algebraic[141]) algebraic[128] = constants[91]*states[82]*states[65]-constants[92]*states[97] algebraic[142] = constants[93]*states[82]*states[99]-constants[94]*states[97] rates[97] = algebraic[128]+algebraic[142] rates[99] = -(algebraic[140]+algebraic[142]) algebraic[143] = constants[87]*states[64]-constants[88]*states[86] rates[64] = (algebraic[70]+algebraic[81]+algebraic[113])-(algebraic[71]+algebraic[115]+algebraic[143]) algebraic[144] = constants[93]*states[82]*states[102]-constants[94]*states[101] rates[82] = -(algebraic[96]+algebraic[97]+algebraic[126]+algebraic[128]+algebraic[132]+algebraic[140]+algebraic[142]+algebraic[144]) rates[101] = algebraic[132]+algebraic[144] rates[102] = -(algebraic[138]+algebraic[144]) algebraic[145] = constants[87]*states[65]-constants[88]*states[86] rates[65] = (algebraic[71]+algebraic[78]+algebraic[82]+algebraic[116])-(algebraic[72]+algebraic[73]+algebraic[76]+algebraic[77]+algebraic[118]+algebraic[128]+algebraic[145]) algebraic[146] = constants[87]*states[66]-constants[88]*states[86] rates[66] = (algebraic[72]+algebraic[73]+algebraic[119])-(algebraic[121]+algebraic[146]) algebraic[147] = constants[87]*states[67]-constants[88]*states[86] rates[67] = (algebraic[76]+algebraic[77]+algebraic[122])-(algebraic[124]+algebraic[147]) rates[86] = algebraic[61]+algebraic[129]+algebraic[131]+algebraic[133]+algebraic[135]+algebraic[137]+algebraic[139]+algebraic[141]+algebraic[143]+algebraic[145]+algebraic[146]+algebraic[147] 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[1] = constants[2]*states[2]*states[2]-constants[3]*states[3] algebraic[2] = constants[4]*states[3]*1.00000-constants[5]*states[4] algebraic[3] = constants[6]*states[22]*states[11]-constants[7]*states[6] algebraic[4] = constants[8]*states[17]*states[8]-constants[9]*states[6] algebraic[5] = constants[10]*states[1]-constants[11]*states[5] algebraic[6] = constants[16]*1.00000-constants[17]*states[1] algebraic[7] = constants[10]*states[4]-constants[11]*states[7] algebraic[8] = constants[12]*states[4]*states[13]-constants[13]*states[14] algebraic[10] = constants[14]*states[5]*states[15]-constants[15]*states[9] algebraic[11] = constants[87]*states[5]-constants[88]*states[85] algebraic[12] = constants[2]*states[9]*states[9]-constants[3]*states[10] algebraic[13] = constants[89]*states[15]-constants[90]*states[12] algebraic[14] = constants[4]*states[10]-constants[5]*states[7] algebraic[15] = constants[12]*states[7]*states[13]-constants[13]*states[16] algebraic[17] = constants[20]*states[21]*states[14]-constants[21]*states[22] algebraic[9] = constants[10]*states[22]-constants[11]*states[17] algebraic[18] = constants[22]*states[23]*states[22]-constants[23]*states[24] algebraic[20] = constants[26]*states[27]*states[24]-constants[27]*states[26] algebraic[28] = constants[26]*states[34]*states[27]-constants[27]*states[35] algebraic[29] = constants[39]*states[27]*states[40]-constants[40]*states[41] algebraic[30] = constants[41]*states[42]*states[44]-constants[42]*states[41] algebraic[21] = constants[28]*states[24]*states[42]-constants[29]*states[28] algebraic[31] = constants[28]*states[34]*states[42]-constants[29]*states[36] algebraic[44] = constants[61]*states[40]*states[43]-constants[62]*states[45] algebraic[43] = constants[59]*states[43]*states[44]-constants[60]*states[45] algebraic[45] = constants[63]*states[46]*states[44]-constants[64]*states[47] algebraic[46] = constants[65]*states[48]*states[44]-constants[66]*states[47] algebraic[47] = constants[63]*states[48]*states[44]-constants[64]*states[49] algebraic[48] = constants[67]*states[50]*states[44]-constants[68]*states[49] algebraic[50] = constants[71]*states[48]*states[52]-constants[72]*states[51] algebraic[49] = constants[69]*states[50]*states[52]-constants[70]*states[51] algebraic[51] = constants[73]*states[52]*states[48]-constants[74]*states[53] algebraic[52] = constants[71]*states[46]*states[52]-constants[72]*states[53] algebraic[53] = constants[75]*states[54]*states[50]-constants[76]*states[55] algebraic[54] = constants[77]*states[50]*states[56]-constants[78]*states[55] algebraic[55] = constants[75]*states[50]*states[56]-constants[76]*states[57] algebraic[56] = constants[79]*states[58]*states[50]-constants[80]*states[57] algebraic[58] = constants[83]*states[56]*states[59]-constants[84]*states[60] algebraic[57] = constants[81]*states[58]*states[59]-constants[82]*states[60] algebraic[59] = constants[85]*states[59]*states[56]-constants[86]*states[61] algebraic[60] = constants[83]*states[54]*states[59]-constants[84]*states[61] algebraic[61] = constants[87]*states[7]-constants[88]*states[86] algebraic[23] = constants[32]*states[30]*states[14]-constants[33]*states[31] algebraic[68] = constants[32]*states[30]*states[16]-constants[33]*states[62] algebraic[37] = constants[51]*states[39]-constants[52]*states[30] algebraic[62] = constants[20]*states[16]*states[21]-constants[21]*states[17] algebraic[25] = constants[20]*states[21]*states[32]-constants[36]*states[33] algebraic[36] = constants[49]*states[23]*states[21]-constants[50]*states[29] algebraic[39] = constants[20]*states[21]*states[39]-constants[36]*states[38] algebraic[70] = constants[20]*states[21]*states[63]-constants[36]*states[64] algebraic[65] = constants[26]*states[68]*states[18]-constants[27]*states[19] algebraic[74] = constants[39]*states[68]*states[40]-constants[40]*states[69] algebraic[73] = constants[26]*states[65]*states[68]-constants[27]*states[66] algebraic[75] = constants[41]*states[70]*states[71]-constants[42]*states[69] algebraic[66] = constants[28]*states[70]*states[18]-constants[29]*states[20] algebraic[76] = constants[28]*states[70]*states[65]-constants[29]*states[67] algebraic[64] = constants[24]*states[25]*states[18]-constants[25]*states[19] algebraic[67] = constants[30]*states[18]*states[25]-constants[31]*states[20] algebraic[19] = constants[24]*states[25]*states[24]-constants[25]*states[26] algebraic[22] = constants[30]*states[24]*states[25]-constants[31]*states[28] algebraic[27] = constants[24]*states[25]*states[34]-constants[25]*states[35] algebraic[32] = constants[30]*states[34]*states[25]-constants[31]*states[36] algebraic[77] = constants[30]*states[65]*states[25]-constants[31]*states[67] algebraic[72] = constants[24]*states[25]*states[65]-constants[25]*states[66] algebraic[33] = constants[43]*states[37]*states[14]-constants[44]*states[34] algebraic[78] = constants[43]*states[16]*states[37]-constants[44]*states[65] algebraic[41] = constants[55]*states[23]*states[38]-constants[56]*states[37] algebraic[34] = constants[45]*states[39]*states[29]-constants[46]*states[37] algebraic[38] = constants[53]*states[14]*states[39]-constants[54]*states[32] algebraic[80] = constants[53]*states[16]*states[39]-constants[54]*states[63] algebraic[40] = constants[53]*states[14]*states[38]-constants[54]*states[33] algebraic[81] = constants[53]*states[16]*states[38]-constants[54]*states[64] algebraic[35] = constants[47]*states[14]*states[29]-constants[48]*states[24] algebraic[79] = constants[47]*states[16]*states[29]-constants[48]*states[18] algebraic[42] = constants[57]*states[29]*states[32]-constants[58]*states[34] algebraic[82] = constants[57]*states[29]*states[63]-constants[58]*states[65] algebraic[84] = constants[61]*states[40]*states[43]-constants[62]*states[72] algebraic[83] = constants[59]*states[43]*states[71]-constants[60]*states[72] algebraic[85] = constants[63]*states[46]*states[71]-constants[64]*states[73] algebraic[86] = constants[65]*states[74]*states[71]-constants[66]*states[73] algebraic[87] = constants[63]*states[71]*states[74]-constants[64]*states[75] algebraic[88] = constants[67]*states[71]*states[76]-constants[68]*states[75] algebraic[89] = constants[69]*states[76]*states[52]-constants[70]*states[77] algebraic[91] = constants[71]*states[74]*states[52]-constants[72]*states[77] algebraic[93] = constants[73]*states[52]*states[74]-constants[74]*states[78] algebraic[90] = constants[75]*states[54]*states[76]-constants[76]*states[79] algebraic[92] = constants[77]*states[80]*states[76]-constants[78]*states[79] algebraic[95] = constants[71]*states[46]*states[52]-constants[72]*states[78] algebraic[94] = constants[75]*states[76]*states[80]-constants[76]*states[81] algebraic[96] = constants[79]*states[82]*states[76]-constants[80]*states[81] algebraic[98] = constants[10]*states[14]-constants[11]*states[16] algebraic[97] = constants[81]*states[82]*states[59]-constants[82]*states[83] algebraic[99] = constants[83]*states[80]*states[59]-constants[84]*states[83] algebraic[24] = constants[34]*states[31]-constants[35]*states[32] algebraic[100] = constants[10]*states[31]-constants[11]*states[62] algebraic[101] = constants[85]*states[59]*states[80]-constants[86]*states[84] algebraic[102] = constants[10]*states[32]-constants[11]*states[63] algebraic[103] = constants[83]*states[54]*states[59]-constants[84]*states[84] algebraic[106] = constants[8]*states[8]*states[18]-constants[9]*states[87] algebraic[105] = constants[6]*states[24]*states[11]-constants[7]*states[87] algebraic[108] = constants[6]*states[26]*states[11]-constants[7]*states[88] algebraic[107] = constants[10]*states[26]-constants[11]*states[19] algebraic[109] = constants[8]*states[8]*states[19]-constants[9]*states[88] algebraic[111] = constants[6]*states[28]*states[11]-constants[7]*states[89] algebraic[110] = constants[10]*states[28]-constants[11]*states[20] algebraic[112] = constants[8]*states[8]*states[20]-constants[9]*states[89] algebraic[114] = constants[6]*states[33]*states[11]-constants[7]*states[90] algebraic[26] = constants[37]*states[23]*states[33]-constants[38]*states[34] algebraic[113] = constants[10]*states[33]-constants[11]*states[64] algebraic[115] = constants[8]*states[8]*states[64]-constants[9]*states[90] algebraic[118] = constants[8]*states[8]*states[65]-constants[9]*states[91] algebraic[117] = constants[6]*states[34]*states[11]-constants[7]*states[91] algebraic[120] = constants[6]*states[35]*states[11]-constants[7]*states[92] algebraic[119] = constants[10]*states[35]-constants[11]*states[66] algebraic[121] = constants[8]*states[8]*states[66]-constants[9]*states[92] algebraic[16] = constants[18]*states[8]-constants[19]*states[11] algebraic[123] = constants[6]*states[36]*states[11]-constants[7]*states[93] algebraic[122] = constants[10]*states[36]-constants[11]*states[67] algebraic[124] = constants[8]*states[67]*states[8]-constants[9]*states[93] algebraic[104] = constants[10]*states[24]-constants[11]*states[18] algebraic[125] = constants[91]*states[58]*states[24]-constants[92]*states[94] algebraic[116] = constants[10]*states[34]-constants[11]*states[65] algebraic[127] = constants[91]*states[58]*states[34]-constants[92]*states[96] algebraic[129] = constants[87]*states[16]-constants[88]*states[86] algebraic[63] = constants[22]*states[23]*states[17]-constants[23]*states[18] algebraic[131] = constants[87]*states[17]-constants[88]*states[86] algebraic[71] = constants[37]*states[23]*states[64]-constants[38]*states[65] algebraic[130] = constants[91]*states[58]*states[23]-constants[92]*states[100] algebraic[132] = constants[91]*states[82]*states[23]-constants[92]*states[101] algebraic[126] = constants[91]*states[82]*states[18]-constants[92]*states[95] algebraic[133] = constants[87]*states[18]-constants[88]*states[86] algebraic[134] = constants[93]*states[58]*states[98]-constants[94]*states[94] algebraic[135] = constants[87]*states[19]-constants[88]*states[86] algebraic[136] = constants[93]*states[58]*states[98]-constants[94]*states[96] algebraic[137] = constants[87]*states[20]-constants[88]*states[86] algebraic[138] = constants[93]*states[58]*states[102]-constants[94]*states[100] algebraic[69] = constants[34]*states[62]-constants[35]*states[63] algebraic[139] = constants[87]*states[62]-constants[88]*states[86] algebraic[140] = constants[93]*states[82]*states[99]-constants[94]*states[95] algebraic[141] = constants[87]*states[63]-constants[88]*states[86] algebraic[128] = constants[91]*states[82]*states[65]-constants[92]*states[97] algebraic[142] = constants[93]*states[82]*states[99]-constants[94]*states[97] algebraic[143] = constants[87]*states[64]-constants[88]*states[86] algebraic[144] = constants[93]*states[82]*states[102]-constants[94]*states[101] algebraic[145] = constants[87]*states[65]-constants[88]*states[86] algebraic[146] = constants[87]*states[66]-constants[88]*states[86] algebraic[147] = constants[87]*states[67]-constants[88]*states[86] 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)