# Fuzzy Regulator for Two-Phase Gas-Liquid Pipe Flows Control
## 4 Fuzzy Regulator Principles  
The classic fuzzy regulators consist of fuzzification, inference, and defuzzification modules. In the inference module, the defined fuzzy rules set is used to determine the behavior of the regulator. The task for the fuzzification module is to change the input signals domain from crisp (i.e., numerical values) into fuzzy (i.e., linguistic terms: _small_, _middle_, or _large_). The defuzzification module, in turn, changes the output fuzzy signal into  
Figure 1: The flow rig diagnostic control system schema. the crisp one. The inference realized in the fuzzy regulator depends on the type of applied fuzzy rules. In practice, the following types of rules are used most often [61]. \[ \begin{array}{c}\text{if }(S_{G}=t1_{SG})\text{ and }(S_{L}=t1_{SL})\text{ then }(F_{3}=t1_{ FC})\\ \text{if }(S_{G}=t1_{SG})\text{ or }(S_{G}=t2_{SG})\text{ and }(S_{L}=t1_{SL})\text{ then }(F_{c}=t3_{ FC})\end{array}  \tag{1}\]  
Specificity of physical phenomena of two-phase pipe flows requires adapting the classical approach to the fuzzy regulator to enable control of the flow in the most effective and precise way. To achieve that, the authors decided to use two types of the regulator input signals. The first type (class) describes the current state of the flow, namely, the values of the signals that supply the process. Both signals in the first class are provided as linguistic variables, \(S_{G}\) and \(S_{L}\), which terms are described by experimentally determined membership functions. Both linguistic variables are classically defined as a five-elements set: \((V,T,D,G,M)\), where:  
\(V\)--variable name, e.g., _gas stream_,  
\(T\)--set of variable terms, e.g., _small_, _medium_, or _big_  
\(D\)--crisp domain of a linguistic variable, e.g., \(D\in(0;50)\frac{m^{3}}{n}\),  
\(G\)--the syntactic rule, whose grammar generates the derivative terms--the \(T\) labels, e.g., \(T\)(_gas stream_) = {..., _\"medium small\"_, _\"medium\"_,... }  
\(M\)--the semantic rule that sets the meaning \(M(l)\) to each linguistic value \(l\). Moreover, \(M(l)\) describes the fuzzy set defined in \(D\). The example for \(l\) = \"_medium_\":  
\[ \begin{array}{c}M:\text{medium}\to SR;\\ \mu_{SR}(x);\;\;x\in D,\end{array}  \tag{2}\]  
where, \(SR\) is the fuzzy set defined with the membership function \(\mu_{SR}\) in the domain \(D\). Crisp values of signals for the gas and the liquid streams provided into the mixture (before fuzzification) are provided by the measurement system mounted in the flow rig. Unfortunately, the nature of crisp values acquired by the measurement system influences the classic fuzzification method and can be imprecise regarding the measurement system's sensitivity. Retrieved crisp values cannot be treated as correct ones since the measurement system provides the set of temporary values (this situation is strongly connected with the dynamic nature of flow). The first approach was to calculate an average value for the measurements set and use it as an input value for the fuzzification process. Unfortunately, this approach did not reflect the dynamics of the rig state properly. The next challenge associated with the classic approach for fuzzification was the lack of possibility of changing the shape and type of membership functions to split the linguistic variable representing the input signals into terms [60]. Moreover, the linguistic variables representing the current state of the flow are not the subject of the classic fuzzification approach, and their conclusions always depend only on its value (i.e., _current flow is a slug flow_). Since the input signal \(S\) is not a classical crisp value, it is provided in the form of a fuzzy number defined with the following membership function:  
\[\mu_{S}(x)=\left\{ \begin{array}{c}0\to x\leq\overline{x}-\sigma\\ \frac{1}{\sigma}x-(\frac{\overline{x}}{\sigma}+1)\to x\in(\overline{x}- \sigma;\overline{x})\\ -\frac{1}{\sigma}x+(\frac{\overline{x}}{\sigma}+1)\;\to x\in(\overline{x}; \overline{x}+\sigma)\\ 0\to x\geq\overline{x}+\sigma\end{array}