## 2 System Description
### Fuzzy Logic System Description
#### 2.4.2 Improvement of Control Loop with Fuzzy PI Controllers  
In order to control the single-phase inverter, the control loop based on fuzzy logic was implemented. In the InC system, the control of the inverter was based on PI controllers. A detailed analysis of that system discovered some inefficiency aspects, namely a fairly pronounced transient regime in the output signals [23]. This was largely due to the PI controllers and the MPPT incremental conductance algorithm. That is why the classic PI controllers have been substituted by PI controllers based on fuzzy logic, these being more practical and efficient [24]. In the first step, the fuzzy inference system (FIS) is configured to generate a linear control interface from the E (error) and CE (error change) inputs to the output. The design of the fuzzy inference system is based on the following hypothesis [24]: The Mamdani inference method is used; an algebraic product is used for AND operation; inputs are normalized in the range \([-10,10]\); the membership functions corresponding to the inputs are triangular; the output is defined in the range \([-20,20]\) of singleton type and is determined by the sum of the peak positions corresponding to the input sets; center of gravity (CGG) method is used for defuzzification [25]. The fuzzy logic designer function from Figure 8a is based on the above premise. The rule base includes nine rules defined in terms: _\"If...Then\"_, using the logical AND operator [25]. \begin{table} \begin{tabular}{c c c c c c c c c} \hline \hline \multirow{2}{*}{_\(Ppv\)_} & \multicolumn{2}{c}{\(\Delta Vpv\)} & \multirow{2}{*}{**NB**} & \multirow{2}{*}{**NM**} & \multirow{2}{*}{**NS**} & \multirow{2}{*}{**ZE**} & \multirow{2}{*}{**PS**} & \multirow{2}{*}{**PM**} & \multirow{2}{*}{**PB**} \\  & & & & & & & & & \\ \hline NB & NB & NB & NM & NM & NS & NS & ZE \\  & NM & NB & NM & NM & NS & NE & ZE & PS \\  & NS & NM & NS & NS & ZE & PS & PS \\  & ZE & NM & NS & NS & ZE & PS & PS & PM \\  & PS & NS & ZE & PS & PS & PM & PM \\  & PN & ZE & PS & PS & PM & PM & PB \\  & PB & ZE & PS & PS & PM & PM & PB \\ \hline \hline \end{tabular}   
Figure 8b shows the membership functions of the input variables E and CE, each with three fuzzy subsets. These subsets are expressed in linguistic terms such as NEG--Negative, ZERO, and POZ--Positive. The membership function in Figure 8c corresponding to the output variable is of singleton type. It is formulated by the following linguistic terms: LargeNeg--Large Negative, SmallNeg--Small Negative, ZERO, SmallPoz--Small Positive, and LargePoz--Large Positive [25]:  
To implement PI controllers based on fuzzy logic, we recalculate the gains \(kp\), \(ki\), corresponding to the conventional PI controllers in the incremental conductance system. The gains of the regulator, PI in the voltage loop were determined by the trial-and-error technique, establishing the values \(kp=-5\) and \(ki=-30\). To calculate the PI regulator gains corresponding to the current loop, a constant time, \(\tau\_i\), of 50 us, a load inductance of 200 uH, and a load resistance of 20 mG are chosen. Figure 8: Implementation of fuzzy PI controllers: (**a**) Fuzzy logic designer fuzzy PI function, (**b**) The membership functions of input variables E and CE, (**c**) The output membership functions. The inductance value is sufficient because the work implies modeling a low-power photovoltaic system. Using Formulas (19) and (20), the gains \(kp\) and \(ki\) can be calculated as follows [25]:  
\[k_{p}=\frac{L}{\tau_{i}}=\frac{200\cdot 10^{-6}}{50\cdot 10^{-6}}=4\, \tag{19}\]  
\[k_{i}=\frac{R+r_{on}}{\tau_{i}}=\frac{20\cdot 10^{-3}}{50\cdot 10^{-6}}=400, \tag{20}\]  
To design the Fuzzy PI controller in Simulink, we need the scaling factors \(GE\) (error gain) and \(GCE\) (error change gains) for the fuzzy inputs and the output \(GCU\) (output gain). The scaling factors are calculated based on the gains \(kp\), \(ki\), assuming the maximum reference step 1, and therefore, the maximum error E is 1.