# Optimized Dissolved Oxygen Fuzzy Control for Recombinant _Escherichia coli_ Cultivations
## 3 Material and Methods
### Fuzzy Controller  
The fuzzy control system was developed using Fuzzy Logic Toolbox (MATLAB) and its tools: FIS and ANFIS. Based on the decision tree algorithm (Figure 1) [22; 47], a strategy for the fuzzy controller was defined. The fuzzy DOC control was divided in three independent Sugeno-type inference systems [53]. The first, Delta, not only determines the size variations in air and oxygen flow rates (delta, in L/min) but also guides the controller through three possible scenarios. The closer the measured DOC value is to its setpoint, the lower delta value will be. On the other hand, if the measured DOC value is below the setpoint value, Delta will infer a delta value used by the next two inference systems (Princ1 and Princ2) in order to determine whether there will be an increment or a reduction of delta (in size) in air (Princ1) or oxygen (Princ2) flow rates. The last scenario is safety mechanism. For DOC values above the setpoint, either one or both flow rates will be decreased (by delta). The first inference system, Delta, was evaluated based on two input variables: current dissolved oxygen concentration and agitation speed. The three linguistic values for each input were defined based on cultivation data observation and expert's knowledge. The output of Delta fuzzy system was the size variations in air and oxygen flow rates (delta). Both Princ1 and Princ2 inference systems are described by the same set of input variables, and their output (QairVar and QQ\({}_{2}\)Var, respectively) do not define air or oxygen flow rates directly. Instead, these values must be compared with certain limits, mimicking the decision tree. For instance, if QairVar is equal to or higher than a limit (heuristically determined), the controller issues an increase of delta in air flow rate. If not, the controller is set to decrease air flow rate by the same value. Similar reasoning applies to QQ\({}_{2}\)Var range values (but with the additional possibility of maintaining the same O\({}_{2}\) flow rate, besides the possibilities of increasing or decreasing it). This comparison approach is highly efficient, since QairVar and QQ\({}_{2}\)Var are sensitive to mild disturbances. By stablishing actuation ranges (and limited delta steps), we hoped to avoid severe oscillations. For Princ1 and Princ2, AgitSp, DOC, and QairIF (an auxiliary variable responsible for indicating the threshold for exchanging aeration for oxygen enrichment) were considered as the main input variables. The linguistic values for each one of them were chosen based on the decision tree strategy. Besides, comparing the proposed strategy with the decision tree, microorganism concentration (CX) and specific growth rate (Mi) were also considered as inputs for the fuzzy controller. This seemingly increased the complexity of the system. However, it granted a new depth to the fuzzy controller regarding the culture phase and its specificities. For both inputs, two linguistic values were attributed. For Delta inference system training an experimental data matrix was loaded into the ANFIS tool. The inputs were defined based on three linguistic values each with Gaussian type-1 shape membership functions Equation (4):  
\[(x,\sigma,c)=e^{-\frac{(x-c)^{2}}{2\sigma^{2}}}, \tag{4}\]  
where \(\sigma\) is the standard deviation (that controls the width of the bell shape), and \(c\) is the mean (that defines the peak center position). The output functions were linear equations as shown by generalized Equation (5). \[F_{i}=a\ AgitSp_{i}+b\ DOC_{i}+c, \tag{5}\]  
where \(a\) and \(b\) are the coefficients for variables \(AgitSp\) and \(DOC\) (respectively), whereas \(c\) is the linear coefficient. Optimization method chosen was a hybrid one (backpropagation and least squares) with at least 25 training epochs. The root mean squared error (_rmse_) of the training was 0.035, which express an almost perfect match between observed and predicted values.