Design and processor in the loop implementation of an improved control for IM driven solar PV fed water pumping system

In recent years, the improvement of photovoltaic water pumping system (PVWPS) efficiency takes the considerable interest of researchers due to its operating based on cleaner electrical energy production. In this paper, a new approach based on fuzzy logic controller incorporating loss minimization technique applied to the induction machine (IM) is developed for PVWPS applications. The proposed control selects the optimal flux magnitude by minimization of the IM losses. Moreover, Variable step size perturb and observe method is introduced. The suitability of the proposed control is approved by reducing the absorbed current; therefore, the motor losses are minimized and the efficiency is improved. The proposed control strategy is compared with the method without losses minimization. The comparison results illustrate the effectiveness of the proposed method based on losses minimization regarding the electrical speed, absorbed current, flow water and developed flux. A processor-in-the-loop (PIL) test is effectuated as an experimental test of the proposed method. It consists in implementing the generated C code on the STM32F4 discovery board. The obtained results from the embedded board are similar to numerical simulation results.


Modeling of PV system
shows the system configuration for the proposed standalone PV water pumping system. The system is composed of an IM based centrifugal pump, a PV array, two power converters [boost converters and voltage source inverter (VSI)]. In this section, the modeling of the studied PV water pumping system is presented.
Photovoltaic cell. The single diode model of cell the solar photovoltaic cell is adopted in this work. The characteristic of PV cell is expressed by [31][32][33] . www.nature.com/scientificreports/ DC-DC converter. To perform an adaptation, the boost converter is employed. The relation between input and output voltages of the DC-DC converter is given by 34 : DC-AC converter. The equations that characterize the behavior of the DC-AC converter are expressed by 35,41 : Induction motor. the mathematical model of the IM can be described in the reference frame (α,β) by the following equations 5,40 : and the electromagnetic torque developed: where l s ,l r : Stator and Rotor inductances, M: mutual inductance, R s ,I s : Stator resistance and stator current, R r ,I r : Rotor resistance and rotor current, φ s , V s : Stator flux and stator voltage, φ r , V r : Rotor flux and rotor voltage.
Pump. The load torque of the centrifugal pump which is in proportion to the square of the IM speed can be determined by:

Control strategies for the studied system
The control of the proposed water pumping system is divided into three different subsections. First section deals with the MPPT technique. The second part deals with the direct torque control based on fuzzy logic controller to drive the IM. Moreover, the third part describes a technique associated with DTC based on FLC, which allows determining the reference flux.

MPPT technique. In this work, Variable
Step Size P&O technique is employed for tracking of maximum power point. It's characterized by fast tracking and low oscillations (Fig. 2) [37][38][39] .
DTC based on fuzzy logic controller. The principal idea of the DTC is to directly command the flux and torque of the machine, but the use of the hysteresis regulators for electromagnetic torque and stator flux regulation leads to high torque and flux ripples. Thus, a fuzzy technique is introduced to enhance the DTC method (Fig. 7), The FLC can develop the adequate inverter vector state. The stator flux components can be expressed by: (5) φ αs = l s I αs + MI αs (6) φ βs = l s I βs + MI βs (7) φ αr = I αr l r + MI αr (10) φ βr = I βr l r + MI βr (11) www.nature.com/scientificreports/ The estimated electromagnetic torque can be written as: In addition, the stator flux angle and the amplitude are given by: An FLC is generally composed of four main steps: Fuzzification. During this step, the inputs are converted into fuzzy variables through membership functions (MFs) and linguistic terms.
For stator flux error. The three membership functions for the first input (ε φ ) are negative (N), positive (P) and zero (Z) as shown in Fig. 3.  Fuzzy control rules. Table 1 groups 180 fuzzy rules which are determined using membership functions of the inputs to select the suitable switching state.
Inference. The inference method is performed using Mamdani's technique. The factor of weighting for i th rule ( α i ) is given by: www.nature.com/scientificreports/   Defuzzification. Figure 6 illustrates the obtained crisp values from the fuzzy values using the max method presented by Eq. (20).
Proposed loss minimization technique. By improving the motor efficiency, it is possible to increase the flow rate and then the daily water pumped amount (Fig. 7). The purpose of the following technique is to associate a strategy based on losses minimization with the Direct Torque Control method. It is well known that the value of the flux is important for the efficiency of the motor. A high value of the flux leads to an increase in the iron losses as well as a magnetic saturation circuit. On contrary, a low flux level leads to high joule losses.
Consequently, the reduction of the losses in the IM is directly linked with the choice of the flux level. The proposed approach is based on the modeling of the joule losses in the machine which are related to the current flow through the stator windings. It consists in adjusting the value of the rotor flux to an optimal which minimizes the motor losses to increase efficiency. The joule losses can be expressed as follows (the core losses are neglected): Table 1. Fuzzy switching logic rule base. ε(φ) ε(Tem) θ 1 θ 2 θ 3 θ 4 θ 5 θ 6 θ 7 θ 8 θ 9 θ 10 θ 11 θ 12 www.nature.com/scientificreports/ The total joule losses are given by: A decrease in the current leads to a decrease in the joule losses.
The electromagnetic torque C em and the rotor flux φ r are calculated in d-q coordinate system as: From Eqs. (25-26-27), the joule losses are as follows: www.nature.com/scientificreports/ The electromagnetic torque C em and the rotor flux φ r are calculated in reference (d,q) as: By solving Eq. (30), we can find the optimal stator current which ensures both optimal rotor flux and minimal losses: Therefore, the optimal stator current is expressed by: where

Simulation results
Different simulations are conducted using MATLAB/Simulink software in order to evaluate the robustness and the performance of the proposed technique. The studied system is composed of eight CSUN 235-60P panels of 230 W ( Table 2) connected in series. The centrifugal pump is driven by an IM which is characterized by the parameters presented in Table 3. The components of PV pumping system are listed in Table 4.   www.nature.com/scientificreports/ In this section, the PV water pumping system using FDTC with constant flux reference is compared with the proposed system based on the optimal flux (FDTCO) in the same operating conditions. The performances of both PV systems are tested by considering the following cases: Starting performance of the proposed system. This section presents the starting up state of the proposed pumping system according to insolation of 1000 W/m 2 . Figure 8e illustrates the response of electric speed. The proposed technique provides a better rise time compared to FDTC, where the steady state is reached at 1.04 s while that with the FDTC, the steady state is reached at 1.93 s. Figure 8f shows the pumped water for both control strategies. It's seen that, the FDTCO increases the pumped water, which explains the improvement of the energy converted by the IM. Figures 8g and 8h indicate the absorbed stator currents. The starting current is 20 A using the FDTC while the proposed control strategy indicates a starting current of 10 A, which leads in reducing the joule losses. Figures 8i and 8j show the developed stator flux. The PVPWS based on FDTC operates under a constant reference flux of 1.2 Wb while in the proposed method, the reference flux is 1A which involves improving the efficiency of PV systems.
Variable solar irradiation. Solar radiation varies from 1000 to 700 W/m 2 at 3 s, then to 500 W/m 2 at 6 s ( Fig. 8a). Figure 8b shows the PV power corresponding to 1000 W/m 2 , 700 W/m 2 and 500 W/m 2 . Figures 8c and  8d illustrate the duty cycle and DC link voltage respectively. Figure 8e illustrates the electric speed of IM, we can notice that the proposed technique presents better speed and response time compared to the PV system based on FDTC. Figure 8f shows the volume of pumped water obtained using FDTC and FDTCO for various levels of irradiance. Using the FDTCO, it is possible to obtain a higher amount of pumped water than using FDTC. Figures 8g and 8h illustrate the simulated current response, with the FDTC method and the proposed control strategy. By using the suggested control technique, the current amplitude is minimized which implies the reduction of copper losses, which improves the system efficiency. Thus, a high stating current can cause a deterioration of the machine performance. Figure 8j presents the variation of developed flux responses in order to choose the optimum flux ensuring the minimization of the losses, thus, the suggested technique illustrates its performance. Contrary to Fig. 8i, the flux is constant which is not representing an optimal operation. Figures 8k and 8l indicate the evolution of the stator flux trajectory. Figure 8l illustrates the optimal flux development and explains the principal idea of the proposed control strategy.

Sudden change in solar radiation.
A sudden change in solar radiation is applied, where the irradiance is 1000 W/m 2 at the beginning, after 1.5 s, is decreased suddenly to 500 W/m 2 (Fig. 9a). Figure 9b shows the extracted PV power from the PV panel corresponding to 1000 W/m 2 and 500 W/m 2 . Figures 9c and 9d illustrate the duty cycle and DC link voltage respectively. From Fig. 9e, the proposed method offers a better response time.  www.nature.com/scientificreports/ Figure 9f shows the pumped water volume obtained for both control strategies. Using the FDTCO, the amount of pumped water is higher than using FDTC, where the pumped volume water is 0.01 m3/s when the irradiance is 1000 W/m 2 while, the pumped volume water is 0.009 m 3 /s for FDTC; moreover, the pumped volume water is 0.0079 m 3 /s for FDTCO when the irradiance is 500 W/m 2 , while the pumped volume water is 0.0077 m 3 /s for FDTC. Figures 9g and 9h. illustrate the simulated current response using the FDTC method and the suggested control strategy. We can notice that the proposed control strategy indicates a reduction in current amplitude under sudden irradiance variations, which leads in reducing the copper losses. Figure 9j presents the variation of developed flux responses in order to choose the optimum flux ensuring the minimization of the losses, thus, the proposed technique illustrates its performance, where the flux is 1Wb where the irradiance is 1000 W/m 2 while, the flux is 0.83Wb where the irradiance is 500 W/m 2 . Contrary to Fig. 9i, the flux is constant of 1.2 Wb which does not represent an optimal functioning. Figures 9k and 9l indicate the evolution of the stator flux trajectory. Figure 9l illustrates the optimal flux development and explains the principal idea of the proposed control strategy and the improvement of the proposed water pumping system. The comparative analysis of both techniques in terms of flux value, current amplitude and pumped water are presented in Table 5, which illustrates that PVWPS based on the proposed technique provides high performances with increasing pumped water flow, minimizing the amplitude current and losses, owing to the optimal flux choice.

PIL test using STM32F4 discovery board
In order to validate and test the proposed control strategy, the PIL test based on the STM32F4 board is effectuated. It consists in generating the code that will be loaded and run on an embedded board. This board contains a 32-bit microcontroller with 1 Mbyte flash memory, clock frequency of 168 MHz, floating point unit, DSP instructions, 192 Kbytes SRAM. During this test, a developed PIL block is created in the control system incorporating the generated code based on the STM32F4 discovery hardware board and introduced on Simulink software. The steps allowing to configure the PIL test using STM32F4 board are illustrated in Fig. 10.
The co-simulation PIL test using STM32F4 can be utilized as a low-cost technique to validate the proposed technique. In this paper, the optimization block which provides the optimal reference flux is executed in the STMicroelectronics Discovery board (STM32F4). This latter and Simulink and are executed at the similar period and exchanged the information using of proposed method for PVWPS in the co-simulation process. Figure 12 illustrates the implementation of the optimization technique subsystem in STM32F4.
Only the proposed technique of the optimal reference flux has been displayed in this co-simulation because it is the main control variable of this work that demonstrates the PV water pumping system control behavior. Figure 11a,b show the PIL test results for the proposed method under Variable and sudden change in solar radiation. The numerical simulation results indicate a similar behavior to those obtained through PIL co-simulation test, showing that the proposed control strategy is powerful (Fig. 12). Consequently, the co-simulation PIL process can be utilized as an experimental setup to validate the hardware implementation of various control strategies.

Conclusion
An improved DTC strategy for PVPWS applications is presented here. The proposed technique is based on FLC which aims to operate the motor at the optimal value of flux. The simulation has been carried out in Matlab/ Simulink to evaluate the performance of the proposed control strategy and compared to FDTC with constant flux reference under different operating conditions. A co-simulation PIL validation based on STM32F4 board has been carried out. Numerical simulation results indicate a similar behavior to those obtained through the PIL co-simulation test, which can be employed as a great implement, experimental setup and low-cost technique to evaluate the control strategies. www.nature.com/scientificreports/ According to the obtained results, the main improvements are: • The stator current is reduced, consequently the motor losses are minimized.
• The optimizing of the rotor flux • The pumped water is increased under different operating conditions • The efficiency of the proposed PV water pumping system is improved.