# Optimized Dissolved Oxygen Fuzzy Control for Recombinant _Escherichia coli_ Cultivations
## 3 Material and Methods
### Fuzzy Controller
By applying completeness and consistency principles, ANFIS created nine \"If-Then\" fuzzy rules, as shown in Table 1.  
Here, LP, MP, HP, and VHP are the linguistic values Low and Positive, Medium and Positive, High and Positive, and Very High and Positive (respectively). Fi is represented by the generalized linear Equation (5), with parameters a, b, and c for F1 up till F9, presented in Table 2:  
Figure 2 illustrates the surface response of Delta fuzzy system in relation to the input variables AgitSp and DO. Analyzing the behavior of delta, its peak (point A) is reached when the DOC is on its lowest value, with maximum agitation speed. In this case, air flow rate should be increased (by a value around 0.28 L/min). The region around point B is characterized by a low dissolved oxygen concentration under low agitation speed. The strategy determines that the correction is conducted by an increase in the agitation speed (via PID controller), instead \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Rule** & **AgitSp** & **DOC** & **Output (Delta)** \\ \hline
1 & LP & LP & F1 \\
2 & LP & MP & F2 \\
3 & LP & HP & F3 \\
4 & HP & LP & F4 \\
5 & HP & MP & F5 \\
6 & HP & HP & F6 \\
7 & VHP & LP & F7 \\
8 & VHP & MP & F8 \\
9 & VHP & HP & F9 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Rule table of Delta fuzzy system. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Function** & **a** & **b** & **c** \\ \hline F1 & \(-4.23\times 10^{-4}\) & \(-1.40\times 10^{-2}\) & 0.25 \\ F2 & \(-2.73\times 10^{-4}\) & \(3.92\times 10^{-4}\) & 0.15 \\ F3 & \(4.20\times 10^{-5}\) & \(1.54\times 10^{-2}\) & \(-0.89\) \\ F4 & \(-5.76\times 10^{-4}\) & \(8.00\times 10^{-3}\) & 0.25 \\ F5 & \(6.24\times 10^{-4}\) & \(1.71\times 10^{-2}\) & 0.93 \\ F6 & \(3.54\times 10^{-7}\) & \(2.32\times 10^{-2}\) & \(-1.45\) \\ F7 & \(0.87\times 10^{-4}\) & \(5.17\times 10^{-4}\) & \(-0.34\) \\ F8 & \(8.06\times 10^{-4}\) & \(1.54\times 10^{-2}\) & \(-1.27\) \\ F9 & \(1.65\times 10^{-4}\) & \(2.08\times 10^{-2}\) & \(-1.43\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Output linear function parameters values from Delta fuzzy system fitted by ANFIS. Figure 2: Delta surface response after ANFIS training. of gas flow variation (therefore, delta is 0). Point C is located in the safety mechanism region. Once the dissolved oxygen supersaturation is detected, Delta inference system infers a positive output (delta, in size), in order to decrease gas flow rates. To train Princ1 and Princ2 fuzzy systems, the matrices were built with experimental data of agitation speed, DOC, microorganism concentration, specific grow rate (acquired from A16 dataset), and QairIF values (estimated based on the comparison between the maximum gas flow rate and the actual gas flow rate). QairIF values close to 0.10 indicate gas unsaturation (therefore, a possibility of increasing air flow rate). On the other hand, QairIF values close to 0.9 indicate gas saturation (therefore, a necessity of replacing air by pure oxygen enrichment). The targets (QairVar or QQ\({}_{2}\)Var) were estimated based on input analysis and air and oxygen flow rates variations. After loading the matrices into the ANFIS tool, the number of linguistic values was selected (based on expert knowledge) with Gaussian type-1 membership functions Equation (4). The output membership functions were also linear equations, as shown by generalized Equation (6). \[Ft_{i}=a\ AgitSp_{i}+b\ DOC_{i}+c\ QairIF_{i}+d\ CX_{i}+e\ Mi_{i}+f, \tag{6}\]  
where \(a\), \(b\), \(c\), \(d\), and \(e\) are the coefficients for variables \(AgitSp\), \(DOC\), \(QairIF\), \(CX\), and \(Mi\) (respectively), and \(f\) is the linear coefficient [26]. Optimization method chosen was a hybrid one with at least 25 training epochs. The root mean squared error (rmse) of the training was 0.10 for Princ1 and 0.12 for Princ2, which express an almost perfect match between observed and predicted values.