Keywords

1 Introduction

Real-time simulation (RT) is one of the frontiers of electrical system analysis. Its task is to control or react to events that occur in the real world, with the same speed as the real world clock. With the aim of having systems that can be interfaced with other software or real systems in order to simulate increasingly complex systems and on a large scale, also taking communication infrastructure into account, as in the case of smart grids [1,2,3,4].

It is necessary to be aware of the execution time of the simulation system to ensure that it is shorter or equivalent to the selected time step especially in simulating scenarios that cannot normally be performed, for example, to model the high switching characteristics of the converters, a fast processor is required to reach the minimum step size of up to microseconds [5, 6]. To simulate very quick phenomena in the order of microseconds, it is necessary to think of architectures with more than one processor, and based on FPGAs, that allow high sampling rates, a faster and parallel computing capacity [7]. As the penetration of PV generation increases, its impact on stability and security of the power system will become more and more significant, due to the characteristic of randomness and volatility [8]. Modeling and simulation are the basic technologies to study the impact on the power grid in which, large-scale PV generation systems are integrated. Simulations in the usual platform may give good results, but they are not able to deliver the results for dynamic change in input as present in real world in run time, the model may not respond for such a change. When we try to simulate to know the long-term performance of a system, the normal simulation requires a very long time to deliver the results and the accuracy of the results may also get compromised. While simulating the complex model like PV system interaction with the grid in real-time, we may encounter many problems. The important ones to mention are,

  1. 1.

    The need for a PV mathematical model that can deliver results faster to keep the real-time simulation properties during execution. Solving the algebraic loop in the PV model is an important task, as algebraic loops are not supported in the real-time hardware.

  2. 2.

    There is a need of cost-effective test bench/platform for simulating PV systems in real-time that can be used for control validation, studies of the storage system, and integration of PV system to the power drive train or grid.

  3. 3.

    Model-based design of process and systems is very popular, there are tools available, for automatic code generation for the developed model, it is required to use these tools, that can deliver C code from the model, which can be used for the cost-effective target hardware.

  4. 4.

    The memory of the real-time digital simulator (RTDS) is the main constraint while simulating a complex model, like the grid, this memory is used for storing and executing the compiled C code in real-time. It may be necessary to split the model into two or more separate systems and bridge them using an appropriate interface.

  5. 5.

    Interfacing the two models using respective interfacing algorithm introduces some errors in the execution, that results in, instability of the system during run time and also the accuracy of the results varies according to the interfacing algorithm used.

The main objective of this work is to conduct the real-time simulation of the PV considering as hardware under test (HUT), with the MPPT (Maximum Power Tracking Point) system, storage and the load connected to DC bus acting as a rest of the system (ROS) of hardware-in-the-loop (HIL) simulation methodology. The idea is that the photovoltaic system and the rest of the system are executed in parallel in real-time and the maximum power is monitored for irradiation variation in the real world and the extracted power is supplied to the DC bus to which storage element and the fixed load resistance are connected. The modeling of these systems is done in Simulink [9]. The modeled systems are compiled and deployed in NI myRIO’s FPGA [10] for real-time simulation.

The rest of this article is organized as follows: Sect. 2 deals with the modeling of photovoltaic and MPPT systems, Sect. 3 explains the real-time simulation architecture used in this work, Sect. 4 tells the real-time simulation with the results and conclusions are drawn in Sect. 5.

2 PV System Modelling

The mathematical model of the PV system is drawn accordingly with [11, 12]. The equivalent described in Fig. 1 consists of a current source in parallel with the diode and R sh and R s are the intrinsic shunt and series resistances of the cell, respectively. The IV characteristic of the cell is determined by the diode. PV cells are grouped into larger units to form PV modules, these modules are connected in series or parallel to create a PV array to obtain required electrical power.

$$\displaystyle \begin{aligned} \begin{array}{rcl} {} I_{ph} &\displaystyle =&\displaystyle \left [ I_{sc}+K_{i}(T_{cell}-T_{ref}) \right ]\lambda \end{array} \end{aligned} $$
(1)
$$\displaystyle \begin{aligned} \begin{array}{rcl} {} I_{rs} &\displaystyle =&\displaystyle \frac{I_{sc}}{\left [ \exp \left ( \frac{qV_{oc}}{N_{cell}KnT_{cell}} \right ) -1\right ]} \end{array} \end{aligned} $$
(2)
$$\displaystyle \begin{aligned} \begin{array}{rcl} {} I_{o} &\displaystyle =&\displaystyle I_{rs}\left [ \frac{T_{cell}}{T_{ref}} \right ]^3\exp \left \{ \frac{qE_{g}}{nK}\left ( \frac{1}{T_{ref}} -\frac{1}{T_{cell}}\right ) \right \} \end{array} \end{aligned} $$
(3)
$$\displaystyle \begin{aligned} \begin{array}{rcl} {} V_{t} &\displaystyle =&\displaystyle \frac{KT_{cell}}{q} \end{array} \end{aligned} $$
(4)
$$\displaystyle \begin{aligned} \begin{array}{rcl} {} I_{sh} &\displaystyle =&\displaystyle \frac{V_{pv}\frac{N_{p}}{N_{cell}{N_{s}}}+I_{pv}R_{s}}{R_{sh}} \end{array} \end{aligned} $$
(5)
$$\displaystyle \begin{aligned} \begin{array}{rcl} {} I_{pv} &\displaystyle =&\displaystyle N_{p}I_{ph}-N_{p}I_{o}\left [ \exp \left ( \frac{\frac{V_{pv}}{N_{cell}N_{s}}+\frac{I_{pv}R_{s}}{N_{p}}}{nV_{t}} \right )-1 \right ]-I_{sh} \end{array} \end{aligned} $$
(6)
Fig. 1
figure 1

PV cell equivalent circuit

where

  • I pv  Cell current

  • V pv  Array terminal voltage

  • I ph  Photo current

  • I sc  Short-circuit current at 25C and 1 kW/m2

  • K i  Short-circuit current temperature coefficient

  • T cell, T ref  PV cell and reference temperature in K

  • λ  Ratio of solar irradiation to reference 1 kW/m2

  • I rs  Module reverse saturation current

  • q  Charge on electron = 1.6 × 10−19 C

  • N cell  Number series cells in a module

  • n  Diode ideal factor

  • k  Boltzmann’s constant= 1.3805 × 10−23 J/K

  • I o  Module saturation current

  • E g  Energy band gap of semiconductor material

  • V t  Diode thermal voltage

  • I sh  Shunt current

  • N s  Number of series modules connected in string

  • N p  Number of parallel string connected in array

  • V oc  Open circuit voltage

  • R s,R sh  Series and shunt resistance

The method to find the resistances of PV cell can be found in [13], the above mentioned Eq. (6) is solved using Newton Raphson method with the error tolerance of 10−5 for better accuracy. In this work Mitsubishi Electric PV-UD180MF5 PV module is selected as reference, the parameters of the module are given in Table 1. The IV curve of the modeled PV array for different irradiation is given in Fig. 2, later the same model is used for PV real-time simulation, fixed step discrete solver with the sample time of 1 ms is used in both normal and real-time simulation.

Fig. 2
figure 2

IV curve of the 100 kW array for different irradiation

Table 1 Mitsubishi electric PV-UD180MF5 PV Module details and parameters for 100 kW array

The PV panels are connected to the load using a DC/DC converter governed by an MPPT controller, based on perturb and observe (P&O) method. The choice of a DC–DC converter is based on many factors such as load resistance, resistance at the maximum power point, DC output voltage [14]. Figure 3 shows the block diagram of PV with MPPT system.

Fig. 3
figure 3

Block diagram of PV system with MPPT

3 Real-Time Simulation Architecture

In this section the test benches created for conducting HIL experiment will be presented. The mathematical model will be simulated in myRIO in real-time. FPGA IO’s are used to integrate the model in-ports and out-ports to the real world measurement systems (Fig. 4).

Fig. 4
figure 4

PV with MPPT system in myRIO

The model will be implemented in MATLAB-Simulink [9] and translated in into C code with its internal C code generating tool using the NI VeriStand compilers which adds on to the MATLAB and it can generate the file “.SO” which defines our model with the libraries. NI VeriStand Engine has to be deployed in the RT target to make it compatible to run with the host computer. .lvbitx file defines the custom FPGA personality used for the simulation in the RT target. The main operation is shown in Fig. 5. National Instruments myRIO-1900 is a Linux based device, it comes with built-in Xilinx Z-7010 FPGA [10] and it also allows us to build custom FPGA applications with real-time capabilities. In this study, the real-time simulation of PV system is done in myRIO using NI VeriStand [10], it is a configuration-based testing software, specifically designed to run the real-time testing application, thus allowing us to develop and test control system using hardware I/O and simulation models.

Fig. 5
figure 5

Functional scheme of the procedure

4 Simulation and Results

This test bench consists of a 100 kW PV array model as HUT, whose interaction with the ROS for the change in temperature and the irradiation is studied. The ROS consists of MPPT, DC–DC converter, DC bus is created where the load and the storage are connected with the breaker and the bi-directional intelligent converter, respectively. The temperature and the irradiation data are measured using a temperature sensor and a small 5 W PV cell, respectively. The model used to simulate using this test bench is shown in Fig. 6.

Fig. 6
figure 6

Block diagram of the simulated model

The power rating and other parameters of the proposed RT simulated system are given in Table 2, the voltage of DC bus is maintained at 250 V all the time with the help of storage and the bi-directional DC-DC converter, which allows the power flow in both the directions. PID control is used for the voltage control of the converter. When the power required by the load is more than the generation, DC bus voltage drops. Power will be compensated by the energy stored and the voltage is brought regulated. When the power generated is more than the load requirement, the DC bus voltage increases, and the controller takes action to bring back the voltage to the set reference of 250 V. In this experiment, the fixed resistive load of 1 Ω is connected to the DC bus at 5th s, the outputs are driven to the real world using FPGA IO and read using the digital oscilloscope, the test bench setup is shown in Fig. 7.

Fig. 7
figure 7

Test bench used for HIL simulation

Table 2 Parameters of electric system

The irradiation and the temperature measured in real-time are given in Fig. 8. They both are measured by myRIO and fed to the model during run time.

Fig. 8
figure 8

Irradiation and temperature measured in real-time

The load is connected to the DC bus at 5th s, the DC bus voltage and its variations during run time is given in Fig. 9. It can be observed that the controller is able to maintain the bus voltage constant even after connecting load at 5th s.

Fig. 9
figure 9

Voltage measured across DC bus in real-time

To ensure the simulation running in real-time the bus voltage is also measured using a digital oscilloscope as shown in Fig. 10. The real-time simulation started at − 9 s, this corresponds to 0th s of the model time, the load is configured to get connected to the DC bus at 5th s of the model time, and in the oscilloscope the voltage variation due to load application is recorded at − 4th s, this proves that the simulation is running in real-time, just the voltage is scaled down by 100 V as 1 V to drive output through DAC, finally the simulation is stopped at 1.6 s as seen in oscilloscope.

Fig. 10
figure 10

Voltage measured across DC bus using oscilloscope

The maximum power delivered by PV and the power consumed by the load after connecting it to the DC bus is shown in Fig. 11. The power delivered by PV before connecting the load is used to charge the storage system of 10 Ah. The state of charge measured in the storage system and the current flowing to the batteries are given in Fig. 12. Initial SOC is about 50% and raised rapidly till connecting the load to the DC bus, later the slope of SOC decreases since the flow of current is decreased to the storage system. The voltage seen across the storage system throughout the simulation is given in Fig. 13.

Fig. 11
figure 11

Power delivered by PV and consumed by load

Fig. 12
figure 12

SOC and the battery current

Fig. 13
figure 13

Battery terminal voltage

5 Conclusion

This article presents a methodology for real-time simulation, based on a model created in Simulink environment and then downloaded to the hardware of National Instruments. The step is done through VeriStand tool, to demonstrate that, it is possible to create small real-time simulators for laboratory or educational use. In the article, the methodology is illustrated in detail and accompanied by the results.