# Fuzzy Regulator for Two-Phase Gas-Liquid Pipe Flows Control
## 5 Implementation
\tag{12}\]  
where:  
\[funLoG(a)=0.089a+0.011 \tag{13}\]  
\[funMLoG1(a)=0.056a+0.444 \tag{14}\]  
\[funMLoG2(a)=0.11a+0.389 \tag{15}\]  
\[funMLaG1(a)=0.078a+0.122 \tag{16}\]  
\[funMLaG2(a)=0.078a+0.122 \tag{17}\]  
\[funLaG(a)=0.444a+0.556 \tag{18}\]  
where: \(1\leq a\leq 10\)  
\(\bullet\) For the linguistic variable--fuzzified liquid stream:  
\[\mu_{small\;liquid^{\prime}}(x)=\left\{ \begin{array}{c}1\to\;x\leq 3.75\\ (-2x+8.5)^{funLoL(a)}\to x\in(3.75;4.25)\\ 0\to\;x\geq 4.25\end{array} \right. \tag{19}\]  
\[\mu_{middle\;small\;liquid^{\prime}}(x)=\left\{ \begin{array}{c}0\to\;x\leq 3.5\;m^{3}/h\\ (x-3.5)^{funMLoL1(a)}\to x\in(3.5;4.5)\\ 1\to x\in\langle 4.5;5.25\rangle\\ (-2x+11.5)^{funMLoL2(a)}\to x\in(5.25;5.75)\\ 0\to x\geq 5.75\end{array} \right. \tag{20}\]  
\[\mu_{middle\;large\;liquid^{\prime}}(x)=\left\{ \begin{array}{c}0\to\;x\leq 5 \\ (x-5)^{funMLaL1(a)}\to x\in(5;6)\\ 1\to\;x\in\langle 6;6.25\rangle\\ (-2x+13.5)^{funMLaL2(a)}\to x\in(6.25;6.75)\\ 0\to\;x\geq 6.75\end{array} \right. \tag{21}\]  
\[\mu_{large\;liquid^{\prime}}(x)=\left\{ \begin{array}{c}0\to x\geq 6\\ (x-6)^{funLal(a)}\to x\in(6;7)\\ 0\to\;x\leq 7\end{array} \right. \tag{22}\]  
where:  
\[funLoL(a)=0.1a \tag{23}\]  
\[funMLoL1(a)=0.556a+2.444 \tag{24}\]  
\[funMLoL2(a)=0.889a+2.111 \tag{25}\]  
\[funMLaL1(a)=0.556a+2.444 \tag{26}\]  
\[funMLaL2(a)=0.089a+0.011 \tag{27}\]  
\[funLaL(a)=0.778a+0.222 \tag{28}\]  
where: \(1\leq a\leq 10\). When the scaled membership functions and measurement data are combined into one chart, it is possible to achieve a series of consistent areas that include only one flow type (see Figure 4). The fuzzy relation that represents the flow type to reproduce it within the measurement range of the rig (second class signals) can be defined with previously determined membership functions. This relation should have two-dimensional nature such as \(R=\sum\limits_{U\
eq V}\frac{\mu_{B}(U,V)}{(U,V)}\), where \(U\) and \(V\) are the measurement values of the gas and liquid stream, respectively. The membership function of the relation should be an aggregation of the membership function values calculated according to the previous step for the streams: gas and liquid. The membership function, which represents each of the flow types (i.e., the terms of the second-class input signal), should look like:  
\[\mu_{f_{1(x,y)}=\min(\max(\mu_{G\Pi}(x),\,\mu_{G\Omega}(x),\mu_{G\Omega}(x), \mu_{G\Pi}(x)),\,\max(\mu_{L\Pi}(y),\,\mu_{L\Omega}(y),\mu_{L\Pi}(y)))}, \tag{29}\]  
where:  
* \(x\)--is the gas stream value,
* \(y\)--is the liquid stream value,
* \(\mu_{f_{1(x,y)}}\)--is the membership level of the flow type achieved for the gas stream \(x\) and liquid stream \(y\),
* \(\mu_{G\Pi}(x)\)--is the membership level determined for \(i\)-th term of the fuzzified gas stream for the measured value \(x\) of the gas stream,
* \(\mu_{L\Pi}(y)\)--is the membership level determined for \(i\)-th term of the fuzzified liquid stream for the measured value \(y\) of the liquid stream. The considered membership functions must be determined for each flow type that may occur in the entire measurement range of the flow rig. Next, it is required to define the fuzzy rules that consider the fuzzy relations and membership functions for the linguistic  
Figure 4: The series of measurement data for flows split as in Figure 3 with the scaled membership functions (9)–(12) and (19)–(22) for the parameter \(a\) equals 5.  
variables: _fuzzy gas stream_ and _fuzzy liquid stream_. The inference structure of each rule should be derived from the Equation (1), for instance:  
\[ \begin{split}\textbf{if }\textit{fuzzified gas stream is small}\textbf{ and }\textit{fuzzified liquid stream is small}\\ \textbf{and }\textit{flow type is plug and required flow type is slug}\\ \textbf{then }\textit{fuzzy gas stream is large and fuzzy liquid stream is large}\\ \end{split}