# Design and Optimization of a Neuro-Fuzzy System for the Control of an Electromechanical Plant
## 3 Fuzzy Control System  
The neuro-fuzzy controller uses the structure of a compact fuzzy system based on Boolean relations such as that presented in [21], which can be used for the identification and control of dynamic systems. Fuzzy systems based on Boolean relations are based on a  
Figure 8: System characteristics with PI control.  
system design considering possible Boolean regions in the discourse universes; then this system is extended using fuzzy sets for implementation, making it possible to consider the operation of sensors and actuators present in the control system [22]. The output of these systems can be calculated as:  
\[y=\sum_{i=1}^{N}v_{i}Y_{i} \tag{19}\]  
where \(v_{i}\) corresponds to the virtual actuator and \(Y_{i}\) the activation output that depends on the membership functions \(\mu_{l,j}(x_{l})\) associated with inputs \(x_{l}\) for \(l=1,2,\ldots,L\) and \(j=1,2,\ldots,M_{l}\).  
In order to establish the activation functions \(Y_{i}\), a truth table and various design considerations are used as well as the manipulation of the system equations using Boolean and Kleene algebras [22]. By using a compact structure, direct equivalence can be performed with the structure of a dynamic discrete time system, which allows the implementation of fuzzy controllers [21].  
In this way, fuzzy control design consists of modifying (extending) a linear (discrete time) controller using fuzzy sets to model the controller non-linear relations. This design principle is used in [23] to control an automatic voltage regulator. The general diagram of the control system can be seen in Figure 9.  
The fuzzy controller schema consists of modifying the non-linear relations that exist for the input and feedback signals. To carry out the design of the neuro-fuzzy controller, a linear PI (Proportional Integral) controller given by Equation (20) is considered.  
\[C(s)=K_{p}+\frac{K_{i}}{s}=\frac{sK_{p}+K_{i}}{s} \tag{20}\]  
Considering the controller in discrete time, the respective transfer function of the PI controller is:  
\[C(z)=\frac{U(z)}{E(z)}=\frac{b_{0}-b_{1}z^{-1}}{1-z^{-1}} \tag{21}\]  
The difference equation of this controller corresponds to:  
\[u[n]=b_{0}e[n]-b_{1}e[n-1]+u[n-1] \tag{22}\]  
where the respective coefficients \(b_{0}\), \(b_{1}\) are constant. For the fuzzy controller, these constants are replaced by non-linear relations given by fuzzy membership functions, such that:  
\[u[n]=f_{1}(e[n])-f_{2}(e[n-1])+f_{3}(u[n-1])) \tag{23}\]  
Fuzzy sets shown in Figures 10 and 11 are employed for the fuzzy control system. Particularly, Figure 10 shows a sigmoidal fuzzy set to model positive values of the universe of discourse \(e\) and \(u\), while in Figure 11 the negative values are represented for the error \(e\) and control action \(u\).  
Figure 9: General diagram of the control system.  
Considering the fuzzy sets described in Figures 10 and 11, as well as the controller structure given by Equation (23), the scheme of Figure 12 is obtained, where the proposed fuzzy controller is shown.  
The controller output can be calculated with Equation (24) where the inputs to the fuzzy system are \(x_{i}\in\left\{e[n],e[n-1],u[n-1]\right\}\).  
\[u[n]=\sum_{i=1}^{3}\sum_{j=1}^{2}v_{ij}\mu_{ij}(x_{i})=\sum_{i=1}^{3}f_{i}(x_{i}) \tag{24}\]  
Figure 11: Membership function to model negative values.  
Figure 12: Neuro-fuzzy control system scheme.  
Figure 10: Membership function to model positive values.  
For each input \(x_{i}\) it is possible to define a function \(f_{i}\) as presented in Equation (25).  
\[f_{i}=v_{i1}\mu_{i1}(x_{i})+v_{i2}\mu_{i2}(x_{i}) \tag{25}\]  
To carry out the respective calculations, the membership function is given by equation \(\mu_{ij}(x_{i})=(1+e^{-\mu_{ij}(x_{i}-x_{ij})})^{-1}\); in this way, the set of controller parameters is \(\mathbf{H}_{c}=\{v_{ij},\rho_{ij},x_{ij}\}\).