MIL and SIL and PIL tests for MPPT algorithm

: This paper presents guidelines to develop the Maximum Power Point Tracking controller, as developed in the automotive and aeronautical applications, this by following the V-cycle development process, which means that our controller will be validated by using Model In the Loop/ Software In the Loop/Processor In the Loop tests. In order to have the possibility of integrating the MPPT embedded software in automotive and aeronautical areas, and on the other hand to propose a low-cost option to test the hardware implementation of the MPPT algorithm. Therefore, a modified variable step Incremental Conductance algorithm is proposed in this study, which can reduce the steady-state oscillations and increase the tracking speed under sudden irradiance variation. Then, the Model-based design of the modified algorithm is developed and connected to the plant model (photovoltaic panel and Boost converter). Next, the system model is tested and validated by using Model In the Loop process. After that, the software of this algorithm is automatically generated for the host computer using embedded coder tool, and this software


PUBLIC INTEREST STATEMENT
This work develops a modified Maximum Power Point Tracking controller as the automotive and aeronautical applications are developed, and by following a V-cycle development process, that means that our controller will be validated using Model in the loop/Software in the loop/ Processor in the loop tests. This works can be used as a reference to integrate photovoltaic energy in automotive or aeronautical fields. In addition, Processor in the loop test presented in this work, can be used a low-cost solution to test the hardware implementation of MPPT algorithm.
However, the hardware implementation of these solutions is not easy, especially the MPPT algorithm, even if the MPPT algorithm is implemented by simulation tools like Simulink or PSIM. But, once we start the hardware implementation of MPPT algorithm in digital devices like microcontroller, microprocessor, DSP and FPGA, several problems can occur due to either the mismatches which can appear between the software and the requirements during the development process, or the fact that all the components used are real (PV panel, DC/DC converter, sensors, actuators and microcontroller). Hence when a bug occurs, it is difficult to know exactly the responsible component of this bug. That can increase the time spent in debugging runtime errors. Therefore in other fields, like Automotive and Aeronautic, the software can be generated from the model tested and validated by simulation, and there are different steps between simulation and hardware implementation step. For instance, generally the automotive and aeronautical embedded software follows the V-cycle development process (Dubois, Peraldi-Frati, & Lakhal, 2010;Moy, Ledinot, Delseny, Wiels, & Monate, 2013), and as shown in Figure 1, there are three tests mostly used in these areas, MIL, SIL and PIL tests, and in each one, there is an aim to be checked. For MIL, the aim is to check the model developed from the algorithm requirements, in other words, check that the model is in accordance with the algorithm requirements. For SIL, the aim is to check that the software generated from the model in the host computer. For PIL, the aim is to check that the software generated from the model in the embedded target. That can avoid redundant testing activities while improving software quality.
Note that the development cycle is recommended by the norm applied in the aeronautical area, like DO-178C norm (DO-178C, 2011;Moy et al., 2013), it recommends that the embedded software follows development cycle in order to achieve the objective of this norm, which is producing software in accordance with its requirements (MPPT algorithm requirements in our case). Since good processes make good software, a V-cycle development process is suitable due to its accuracy, because it contains a verification process for each design process. As a result, an error may be detected through several verification activities. Consequently, we can remove a maximum of errors. If the objective is not attained, the software will not be certified (DO-178C, 2011; Moy et al., 2013); hence the software cannot be integrated in the aircraft. Therefore, when PV energy is used in hybrid electric aircraft, the MIL/SIL/PIL tests are suitable to be made by following the V-cycle development process for the MPPT software, that to check if this software is in accordance with its requirements and contribute to certify it. In addition, the tools used to generate and validate the software must be qualified by DO-178C norm (DO-178C, 2011). Therefore Matlab/Simulink is used in this work as a qualified tool (Mathworks, 2016a).
Moreover, the choice of such MPPT algorithm is based on its tracking speed, steady-state performance and its ability to be implemented in embedded board ensuring high robustness. Hence, the most used are P&O and INC algorithms; in particular, the INC algorithm which is a new version of P&O, and it is used extensively due to its ability to reduce the steady-state oscillations (Sivakumar, Kader, Kaliavaradhan, & Arutchelvi, 2015). Subsequently, in order to improve its efficiency, a variable step-size is used (Motahhir, El Ghzizal, Sebti, & Derouich, 2016). However, this variable step can show poor performance in case of sudden irradiance variation. In addition, it can increase steady-state power oscillations (Zakzouk, Elsaharty, Abdelsalam, Helal, & Williams, 2016). Therefore, this work proposes a modified variable step-size.
On the other hand, the MPPT implementation step is required to test our algorithm under controlled conditions of temperature and irradiation. PV panels are unable to reproduce power desired by the tester due to the randomly fluctuating atmospheric conditions. Therefore, solar panel simulators are frequently used in place of actual PV panels (Ahmed & Salam, 2016). Kok Soon Tey and Saad Mekhilef have used an Agilent solar array simulator for implementing a Modified incremental conductance MPPT algorithm (Tey & Mekhilef, 2014). Also, PV emulators by using programmable DC power supply are already proposed (Kadri et al., 2012;Zhou, Holland, & Igic, 2014). However, solar array simulators or programmable DC power supply are expensive instruments and they are not always affordable. Therefore, the PIL test can be used as a low-cost solution to test the hardware implementation of the MPPT algorithm under different conditions of irradiation and temperature.
Hence in this work, a modified variable step INC algorithm is used, which can reduce the steadystate oscillations and improve the tracking speed under sudden irradiance variation. In addition, this work aims to develop the proposed MPPT technique by following the V-cycle development process and using MIL/SIL/PIL tests, that for two reasons. Firstly, in order to take advantage of these kinds of tests and to provide a low-cost solution for testing MPPT. Secondly, to have a possibility of integrating the MPPT embedded software in automotive and aeronautical fields. And as a result, use it for example in hybrid electric vehicle or aircraft.

Figure 1. MIL, SIL and PIL tests in V-cycle development process.
This paper is organized as follows: after introduction, section two provides a general recall on a PV panel and a Boost converter, next a modified variable step is proposed in this section. Finally, section three focuses on the implementation of modified variable step INC algorithm and test it by using MIL/SIL/PIL techniques.

PV panel model
A PV panel is a component that can convert a solar energy into direct current electricity by using semiconducting materials that exhibit the PV effect. In order to model mathematically a PV panel, we derive the fundamental equation from the equivalent circuit of the PV panel shown in Figure 2 (Motahhir, Chalh, El Ghzizal, Sebti, & Derouich, 2017;Villalva, Gazoli, & Filho, 2009).
The current generated by the panel can be given as (Motahhir et al., 2017;Villalva et al., 2009): where: (1)  In this study, the MSX-60 panel is used, and as shown in Table 1, manufacturers of PV panel offer only some parameters. Hence, several parameters mandatory for modeling PV panel are missed in the manufacturers' specification, namely the diode saturation current, the light-generated current, the diode ideality factor and the series and shunt resistances. Therefore, many researchers have worked on the adjustment of theses parameters (Ishaque & Salam, 2011;Villalva et al., 2009), actually thanks to Mathworks that provides in the new version of Simulink (2016) a tool (PV Array) that can help us to extract these parameters (Mathworks, 2016b). Therefore, as shown in Figure 3, once the parameters mentioned in manufacturer specification are provided to this tool, the latter adjusts and displays the missing parameters.
Based on the Equations (1), (2) and (3), Figure 4 shows the model developed by Matlab/Simulink tool. Figure 5 presents the I-V and P-V curves obtained by the PV Panel Simulink model and as presented in P-V curve, the point where the power drawn from the panel is the highest is called MPP. This characteristic is depending on the temperature and solar irradiation. Also, the own characteristic of the load is usually different from the MPP. Therefore, the MPPT controller is used in order to remove this mismatch between the load and MPP. Which in turn, to operate the PV panel at this point, the Boost converter controlled by the MPPT algorithm is inserted between the PV panel and the load (Glasner & Appelbaum, 1996).

Boost converter
It should be mentioned that the PV energy is not like a conventional energy source because in a conventional energy source, energy which is not delivered to the load it is not consumed and remains in the source, in PV energy source the energy is wasted since it is available for free. Thus by using the Boost converter, current flows constantly into the input port due the use of parallel switch in its topology, however by using Buck converter for example, there are times where current is not flowing into the input port due the use of series switch, which in turn the energy is not delivered to the load when the switch is open and the energy is wasted since it is available for free. Hence, in PV system, the energy efficiency of the Boost converter may be higher than of the Buck converter (Glasner & Appelbaum, 1996).
The Boost converter is required to convert DC voltage (V) to another DC voltage (V o ). As shown in Figure 6, this converter contains a MOSFET switch, which is controlled by PWM signal. Once the switch is ON, the inductor stores energy from the PV module, Moreover, the reverse biased diode detaches the output from the PV generator and output capacitor provides current to the load. However, if the switch is OFF, the inductor is in a discharge state and the forward biased diode connects the output to PV generator. The PV panel voltage and inductor voltage (discharging state) contribute together for the output voltage; therefore, it is always greater than input voltage (Abusorrah et al., 2013;Du & Lu, 2011;Fathabadi, 2016b;Glasner & Appelbaum, 1996;Motahhir, El Ghzizal, Sebti, & Derouich, 2015;Santos, Antunes, Chehab, & Cruz, 2006). This converter operates by the following equations (Mohan & Undeland, 2007): The input capacitor value can be designed as below (Mohan & Undeland, 2007): The inductor value can be calculated as mentioned by Equation (7) (Mohan & Undeland, 2007), where r is between [0.3, 0.5] (Sanjaya, 2006): The minimum value of the output capacitor can be designed as mentioned by Equation (8) (Mohan & Undeland, 2007): The duty cycle for the peak power transfer at STC is determined by using Equation (9): The parameters of the designed Boost converter used in this work are given in Table 2:

Modified variable step incremental conductance algorithm
As shown in Figure 7, the used MPPT algorithm is based on the conventional INC algorithm, in which the controller gauges incremental variations in PV current and voltage to predict the impact of the command (Radjai, Rahmani, Mekhilef, & Gaubert, 2014;Soon & Mekhilef, 2015). This algorithm needs more calculation but can follow changing conditions faster than P&O method (Soon & Mekhilef, 2015). However, like P&O algorithm, INC can produce oscillations in the output power since the oscillations in steady-state are proportional to the step-size (Offset). If the step-size is high, then oscillations are high. Otherwise, the oscillations would be low, but the variation of the duty cycle (α) will be very low; this may slow down the tracking process. As a result, by using fixed step-size a trade-off problem exists between faster response and steady-state oscillations. Hence to improve MPPT algorithm performance a variable step-size was used as mentioned by (10) (Motahhir et al., 2016), where Ofsset 0 is the scaling factor. However, this conventional variable step-size shown in (8) depends on the change of the PV power and PV voltage. Consequently, this conventional step-size can increase steady-state power oscillations. In addition, it can show poor performance in case of sudden irradiance variation. We can explain that as follows:

In case of stable irradiance
As shown in Figure 5, in the area near to MPP and in voltage source region, the PV voltage change (ΔV) is very low; as a result, the ΔP/ΔV steps will be large. Therefore, these large step-sizes can increase steady-state power oscillations; as a result, the algorithm efficiency is decreased.

In case of irradiance variation
The conventional variable step can decrease the performance in case of sudden irradiance variation. As shown in Figure 8, during the variation in irradiance, the PV voltage change (ΔV) is very low whereas there is a significant PV power variation (ΔP) because the change in irradiance affects PV current instead of PV voltage. Consequently, the ΔP/ΔV steps will be large. Therefore, this moves the operating point far away from the new MPP, which in turn increases the time to reach the new MPP. Therefore, the algorithm efficiency is decreased.
In order to overcome this problem, a modified variable step-size is used in this work, which depends only on the PV power change (ΔP) (11): (11) Offset = Offset 1 × abs(ΔP)  Where Ofsset 1 is the scaling factor which is adjusted to compromise between the response time and reducing the steady-state oscillations.
As well, the Figure 9 describes the PV system implementing the modified variable step-size INC algorithm using Model-Based Design in order to control the Boost converter.

Model in the loop
The INC algorithm with modified variable step is modeled and it is connected to the plant model (PV panel and Boost converter). In this step, the MPPT model is tested in a simulation environment (Simulink) and this process is called MIL test. This means that the controller model and the plant model are simulated on the host computer without any real hardware components (Bringmann & Krämer, 2008).
The result obtained using MIL test under STC is presented in Figure 10, and as shown in the steadystate, the PV power is equal to 60.54 W, which is the maximum power of the Solarex MSX-60 panel under STC (1,000 W/m² and 25°C). In addition, as shown the variable step-size used gives a fast response without steady-state oscillations. Secondly, the MIL test is made under sudden irradiance variation, Firstly, the solar irradiation is suddenly modified from 500 to 1,000 W/m², and next from 1,000 to 800 W/m², and finally from 800 to 600 W/m². Figure 11 presents the test result, and as shown the modified algorithm presents faster response during irradiance changes and the steady-state oscillations are almost neglected.

Software in the loop
Once the model of the modified INC algorithm is validated using MIL method, the SIL method is the next step in order to check the code automatically generated from the MPPT model. SIL test means that the code is generated from the model for x86 target using Microsoft Windows SDK (Software Development Kit) and embedded coder tools as shown in Figure 12. That to test this code on the host computer without any hardware (Bringmann & Krämer, 2008). Figure 13, in order to generate the SIL block, the option "Create Software-in-the-loop (SIL) block" must be selected before building the modified variable step INC model. Figure 14, the code generated is implemented in the S-function block provided by Simulink, and this block is connected to the plant model (PV panel and the Boost).

As displayed in
The result obtained using SIL test is presented in Figure 15. The result of this test is compared with that of the MIL test. And as shown, the SIL result is in accordance with MIL result.

Processor in the loop
Once the software of the modified variable step INC algorithm is validated using SIL method, the PIL method is the next step in order to check the automatically generated embedded software and to test the implementation of our MPPT algorithm.
PIL test means that the code is generated from the model for the embedded target by using the target's compiler and embedded coder tool, in order to load and run the generated hex file on the embedded board. However, the plant model is simulated on the host computer. And they are connected by USB cable. The PIL test process is a fundamental step of the development cycle to check that the comportment of the deployment code covers the requirements of our algorithm (Bringmann & Krämer, 2008;Hu, Zeng, Yao, & Tang, 2010).    memory, 192Kbytes SRAM and a maximum clock frequency of 168 MHz, and with FPU (Floating Point Unit) and DSP instructions. It provides also communication interfaces like CAN/USB (Von Maurich & Güneysu, 2014). So the more calculation needed by the modified INC algorithm can be covered by this board due to the hardware resources that contains.
So the hex file is generated from the Simulink model for this board by using its tool chain (GNU Tools for ARM Embedded Processors) and embedded coder tools.
Since the PIL test means that the MPPT software will be run on the STM32F4 Discovery board, and the plant model will be simulated on the host computer, the communication interface between the two parts is needed. Therefore, the ST-LINK communication is used as shown in Figure 17, which does not require any additional cables or hardware besides a USB type A to Mini-B cable.
To configure Simulink to run PIL test, we have to enable PIL verification as shown in Figure 18.
As shown in Figure 19, in order to create a PIL block for the MPPT Controller, the STM32F4 Discovery is selected as a target hardware.
As shown in Figure 20, Baremetal or CMSIS-RTOS RTX can be used as an operating system (OS). Both OS will offer similar performance, however, each OS use different scheduling algorithm. For efficiency and full visibility of the scheduler code choose Baremetal, and prefer CMSIS-RTOS RTX to generate code compatible with legacy code.
As presented in Figure 21, the PIL block is generated and connected to the plant model so as to acquire the PV voltage and current, after that the PIL block will compute the duty cycle by using the modified algorithm and send it to the plant model through the ST-Link interface.
The result obtained using PIL test is presented in Figure 22. And it is compared with that of the MIL and SIL tests, and as shown the PIL result is in accordance with MIL and SIL results.  By using PIL test, both Simulink and STM32F4 board will run at the same time and will exchange data based on the modified MPPT algorithm implemented by the PIL block. Therefore, PIL test can be used as a low-cost solution to test the hardware implementation of MPPT algorithm under different conditions of irradiation and temperature.

Recapitulation
Note that, if the tests' results (MIL/SIL/PIL) are different or they are not in accordance with the algorithm requirements, it means that somewhere in the process there is a problem. For example, if MIL behavior is not in accordance with the algorithm requirements, it means that there is a mismatch between Simulink model and algorithm. Therefore, it is required to correct the model according to the algorithm requirements. Thus, if SIL result is not in accordance with MIL result, that means that the software generated from the model for the host computer is not in accordance with the model. Therefore, it is required to correct the software according to the algorithm requirements. The same for PIL, if its result is not in accordance with MIL and SIL results, it means that the software generated from the model for the STM32F4 Board is not in accordance with the model. Therefore, it is required to correct the software according to the algorithm requirements. Anyway, according to DO-178C, the objective is to produce software which is compliant with its requirements (MPPT algorithm) (DO-178C, 2011).
On the other hand, the performances of the modified variable step INC algorithm are compared to the performances of different variable step INC algorithms proposed in some existing works in Table  3. As shown, our proposed presents the faster response and one of the highest efficiencies of more than 98%, thus the power ripples is almost neglected.

Conclusion
Three manners of tests (MIL/SIL/PIL) mostly used for automotive and aeronautical embedded system are employed in this work, that in order to validate the functionality and robustness of the modified variable step INC algorithm. As a result, the responses of the three tests are in accordance with the MPPT algorithm requirements, which in turn this work contributes to achieve the objective of DO-178C norm. In addition, the results show that the modified algorithm avoids the steady-state oscillations and increases the tracking speed under sudden irradiance variation. In the light of that, the MPPT is tested on STM32F4 Discovery board; therefore the performance obtained will be the same by using a real PV panel. Subsequently, the PIL test can be used as a low-cost solution to test the hardware implementation of MPPT algorithm under different conditions of irradiation and temperature.
So by using these kinds of tests, we took advantage of safety level integrated in automotive and aeronautical embedded system, and note that by using this work, the MPPT system can be integrated in the aeronautical area.   Faraji et al. (2014) Choose between ΔD 1 and ΔD 2 Xilinx XC3S400 FPGA 2.7 W 98.8% 2.5 ms Soon and Mekhilef (2015) Step = N* abs (ΔP/ΔV) PIC18F4520 2 W 97.97% 0.4 s Loukriz et al. (2016) Step