Modelling and Control of Grid-connected Solar Photovoltaic Systems

At present, photovoltaic (PV) systems are taking a leading role as a solar-based renewa‐ ble energy source (RES) because of their unique advantages. This trend is being increased especially in grid-connected applications because of the many benefits of using RESs in distributed generation (DG) systems. This new scenario imposes the requirement for an effective evaluation tool of grid-connected PV systems so as to predict accurately their dynamic performance under different operating conditions in order to make a compre‐ hensive decision on the feasibility of incorporating this technology into the electric utility grid. This implies not only to identify the characteristics curves of PV modules or arrays, but also the dynamic behaviour of the electronic power conditioning system (PCS) for connecting to the utility grid. To this aim, this chapter discusses the full detailed model‐ ling and the control design of a three-phase grid-connected photovoltaic generator (PVG). The PV array model allows predicting with high precision the I-V and P-V curves of the PV panels/arrays. Moreover, the control scheme is presented with capabilities of simultaneously and independently regulating both active and reactive power exchange with the electric grid. The modelling and control of the three-phase grid-connected PVG are implemented in the MATLAB/Simulink environment and validated by experimental tests.


Introduction
The worldwide growth of energy demand and the finite reserves of fossil fuel resources have led to the intensive use of renewable energy sources (RESs). Other major issues that have driven strongly the RES development are the ever-increasing impact of energy technologies on the environment and the fact that RESs have become today a mature technology. The necessity for having available sustainable energy systems for substituting gradually conventional ones requires changing the paradigm of energy supply by utilizing clean and renewable resources of energy. Among renewables, solar energy characterizes as a clean, pollutionfree and inexhaustible energy source, which is also abundantly available anywhere in the world. These factors have contributed to make solar energy the fastest growing renewable technology in the world [1]. At present, photovoltaic (PV) generation is playing a crucial role as a solar-based RES application because of unique benefits such as absence of fuel cost, high reliability, simplicity of allocation, low maintenance and lack of noise and wear because of the absence of moving parts. In addition to these factors are the decreasing cost of PV panels, the growing efficiency of solar PV cells, manufacturing-technology improvements and economies of scale [2][3].
The integration of photovoltaic systems into the grid is becoming today the most important application of PV systems, gaining interest over traditional stand-alone autonomous systems. This trend is being increased due to the many benefits of using RES in distributed (also known as dispersed, embedded or decentralized) generation (DG) power systems [4][5]. These advantages include the favourable fiscal and regulatory incentives established in many countries that influence straightforwardly on the commercial acceptance of grid-connected PV systems. In this sense, the growing number of distributed PV systems brings new challenges to the operation and management of the power grid, especially when this variable and intermittent energy source constitutes a significant part of the total system generation capacity [6]. This new scenario imposes the need for an effective design and performance assessment tool of grid-connected PV systems, so as to predict accurately their dynamic performance under different operating conditions in order to make a sound decision on whether or not to incorporate this technology into the electric utility grid. This implies not only to identify the current-voltage (I-V) characteristics of PV modules or arrays, but also the dynamic behaviour of the power electronics interface with the utility grid, also known as photovoltaic power conditioning system (PCS) or PV PCS, required to convert the energy produced into useful electricity and to provide requirements for connection to the grid. This PV PCS is the key component that enables to provide a more cost-effective harvest of energy from the sun and to meet specific grid code requirements. These requirements include the provision of high levels of security, quality, reliability, availability and efficiency of the electric power. Moreover, modern DG applications are increasingly incorporating new dynamic compensation issues, simultaneously and independently of the conventional active power exchange with the utility grid, including voltage control, power oscillations damping, power factor correction and harmonics filtering among others. This tendency is estimated to augment even more in future DG applications [7]. PV PCS addresses integration issues from both the distributed PV generating system side and from the utility side, numerous topologies varying in cost and complexity have been widely employed for integrating PV solar systems into the electric grid. Thus, the document includes a discussion of major PCS topologies. Moreover, the control scheme is presented with capabilities of simultaneously and independently regulating both active and reactive power exchange with the electric grid [9].
The modelling and simulation of the three-phase grid-connected PV generating system in the MATLAB/Simulink environment allows design engineers taking advantage of the capabilities for control design and electric power systems modelling already built-up in specialized toolboxes and blocksets of MATLAB, and in dedicated block libraries of Simulink. These features allows assessing the dynamic performance of detailed models of grid-connected PV generating systems used as DG, including power electronics devices and advanced control techniques for active power generation using maximum power point tracking (MPPT) and for reactive power compensation of the electric grid.

Photovoltaic Generator (PVG) model
The building block of the PV generator is the solar cell, which is basically a P-N semiconductor junction that directly converts solar radiation into DC current using the photovoltaic effect. The most common model used to predict energy production in photovoltaic cells is the single diode lumped circuit model, which is derived from physical principles, as depicted in Fig. 1. In this model, the PV cell is usually represented by an equivalent circuit composed of a lightgenerated current source, a single diode representing the nonlinear impedance of the P-N junction, and series and parallel intrinsic resistances accounting for resistive losses [10][11]. PV cells are grouped together in larger units called modules (also known as panels), and modules are grouped together in larger units known as PV arrays (or often generalized as PV generator), which are combined in series and parallel to provide the desired output voltage where: This nonlinear equation can be solved using the Newton Raphson iterative method. The parameters I Ph , I RS , R S , R P , and A are commonly referred to as "the five parameters" from which the term "five-parameter model" originates. These five parameters must be known in order to determine the current and voltage characteristic, and therefore the power generation of the PV generator for different operating conditions. Thus, in order to obtain a complete model for the electrical performance of the PV generator over all solar radiation and temperature conditions, Eq.
(1) is supplemented with equations that define how each of the five parameters changes with solar radiation and/or cell temperature. These equations introduce additional parameters and thus complexity to the model.
The five parameters in Eq.
(1) depend on the incident solar radiation, the cell temperature, and on their reference values. Manufacturers of PV modules normally provide these reference values for specified operating conditions known as Standard Test Conditions (STC), which make it possible to conduct uniform comparisons of photovoltaic modules by different manufacturers. These uniform test conditions are defined with a solar radiation of 1000 W/m², a solar cell temperature of 25 °C and an air mass AM (a measure of the amount of atmosphere the sun rays have to pass through) of 1.5.
Actual operating conditions, especially for outdoor conditions, are always different from STC, and mismatch effects can affect the real values of these reference parameters. Consequently, the evaluation of the five parameters in real operating conditions is of major interest in order to provide an accurate mathematical model of the PV generator.

Dependence of the PV array photocurrent on the operating conditions
The photocurrent I Ph for any operating conditions of the PV array is assumed to be related to the photocurrent at standard test conditions as follows: where: The absolute air mass function f AM a accounting for the solar spectral influence on the "effective" irradiance absorbed on the PV array surface is described through an empirical polynomial function, as expressed in Eq. (3) [10]. The pressure modifier corrects the air mass by the site pressure in order to yield the absolute air mass. This factor is computed as the ratio of the site pressure to the standard pressure at sea level.
The air mass AM is the term used to describe the path length that the solar radiation beam has to pass through the atmosphere before reaching the earth, relative to its overhead path length. This ratio measures the attenuation of solar radiation by scattering and absorption in atmosphere; the more atmosphere the light travels through, the greater the attenuation. As can be noted, the air mass indicates a relative measurement and is calculated from the solar zenith angle which is a function of time.
The incidence angle function f IA describes the optical effects related to the solar incidence angle (I A ) on the radiation effectively transmitted to the PV array surface and converted to electricity through the panel photocurrent. This modifier accounts for the effect of reflection and absorption of solar radiation and is defined as the ratio of the radiation absorbed by the solar cell at some incident angle θ I to the radiation absorbed at normal incidence. The incidence angle is defined between the solar radiation beam direction (or direct radiation) and the normal to the PV array surface (or POA), as can be seen from Fig. 3. By using the geometric relationships between the plane at any particular orientation relative to the earth and the beam solar radiation, both the incidence angle and the zenith angle can be accurately computed at any time.
An algorithm for computing the solar incidence angle for both fixed and solar-tracking modules has been documented in [11]. In the same way, the optical influence of the PV module surface, typically glass, was empirically described through the incidence angle function [10], as shown in Eq. (3) for different incident angle θ I (in degrees). where: b 1 -b 5 : Polynomial coefficients for fitting the incidence angle function of the analysed PV cell material, dimensionless Even though the correlation of Eq. (4) is cell material-dependant, most modules with glass front surfaces share approximately the same f IA function, so that no extra experimentation is required for a specific module [11]. An alternative theoretical form for estimating the incidence angle function without requiring specific experimental information was proposed in [12].

Dependence of the PV array reverse saturation current on the operating conditions
The solar cell reverse saturation current I RS varies with temperature according to the following equation [13]: where: I RR : Solar cell reverse saturation current at STC, in A E G : Energy band-gap of the PV cell semiconductor at absolute temperature (TC), in eV The energy band-gap of the PV array semiconductor, E G is a temperature-dependence parameter. The band-gap tends to decrease as the temperature increases. This behaviour can be better understood when it is considered that the interatomic spacing increases as the  amplitude of the atomic vibrations augments due to the increased thermal energy. The increased interatomic spacing decreases the average potential seen by the electrons in the material, which in turn reduces the size of the energy band-gap.

Dependence of the PV array series and shunt resistances on the operating conditions
Series and shunt resistances are very significant in evaluating the solar array performance since they have direct effect on the PV module fill factor (FF). The fill factor is defined as the ratio of the power at the maximum power point (MPP) divided by the short-circuit current (I sc ) and the open-circuit voltage (V oc ). In this way, the FF serves as a quantifier of the shape of the I-V characteristic curve and consequently of the degradation of the PV array efficiency.
The series resistance R S describes the semiconductor layer internal losses and losses due to contacts. It influences straightforwardly the shape of the PV array I-V characteristic curve around the MPP and thus the fill factor. As the series resistance increases, its deteriorative effects on the short-circuit current will be increased, especially at high intensities of radiation, while not affecting the open-circuit voltage. This unwanted feature causes a reduction of the peak power and thus the degradation of the PV array efficiency. The dependence of the PV array series resistance on the cell temperature can be characterized by Eq. (6).
( ) where: R SR : Solar cell series resistance at STC, in Ω α SR : PV array temperature coefficient of the series resistance, Ω/module/diff. temp. (in K or°C ) The shunt (or parallel) resistance R P accounts for leakage currents on the PV cell surface or in PN junctions. It influences the slope of the I-V characteristic curve near the short-circuit current point and therefore the FF, although its practical effect on the PV array performance is less noticeable than the series resistance. As the shunt resistance decreases, its degrading effects on the open-circuit current voltage will be increased, especially at the low voltages region, while not affecting the short-circuit current. The shunt resistance is dependent upon the absorbed solar radiation. As indicated in [14], the shunt resistance is approximately inversely proportional to the short-circuit current, and thus to the absorbed radiation, at very low intensities. As the absorbed radiation increases, the slope of the I-V characteristic curve near the short-circuit current point decreases and then the effective shunt resistance proportionally decreases. In this way, this phenomenon can be empirically characterized by Eq. (7).

Dependence of the PV array material ideality factor on the operating conditions
The P-N junction ideality factor A of PV cells is generally assumed to be constant and independent of temperature. However, as reported by [15] the ideality factor varies with temperature for most semiconductor materials by the following general expression, as given in Eq. (8). where: A R : Ideality factor of the PV cell semiconductor at absolute zero temperature, 0 K (-273.15°C), dimensionless, assumed 1.9 for silicon cells α A : Temperature coefficient of the ideality factor, for silicon 0.789e-3 K -1 β D : Temperature constant approximately equal to the 0 K Debye's temperature, for silicon 636 K The analysis of the five parameters I Ph , I RS , R S , R P , and A has permitted to complete the detailed five-parameter model representative of the PV solar array for different operating conditions.

Photovoltaic Power Conditioning System (PCS) model
Usually, one of the major challenges of grid-connected or utility-scale solar photovoltaic systems is to attain an optimal compatibility of PV arrays with the electricity grid. Since a PV array produces an output DC voltage with variable amplitude, an additional conditioning circuit is required to meet the amplitude and frequency requirements of the stiff utility AC grid and inject synchronized power into the grid. As the output of PV panels are direct current, the PV PCS is typically a DC-AC converter (or inverter) which inverts the DC output current generated by the PV arrays into a synchronized sinusoidal waveform. This PV interface must generate high quality electric power and at the same time be flexible, efficient and reliable.
Another key challenge of grid-connected PV systems is the procedure employed for power extraction from solar radiation and is mostly related to the nature of PV arrays. Each PV module is a nonlinear system with an output power mostly influenced by atmospheric conditions, such as solar radiation and temperature. To transfer the maximum solar array power into the utility grid for all operating conditions, a maximum power point tracking (MPPT) technique is usually implemented. Therefore, each grid-connected PV generating system has to perform two essential functions, i.e. to extract the maximum output power from the PV array, and to inject a sinusoidal current into the grid.
The photovoltaic PCS can be classified with respect to the number of power stages of its structure into three classes, known as single-stage, dual-stage and multi-stage topologies, as depicted in Fig. 4 [16].
The first structure of the PV PCS connects the PV array directly to the DC bus of a power inverter. Consequently, the maximum power point tracking of the PV modules and the inverter control loops (current and voltage control loops) are handled all in one single stage. The second topology employs a DC-DC converter (or chopper) as interface between the PV array and the static inverter. In this case, the additional DC-DC converter connecting the PV panels and the inverter handles the MPPT control. The third arrangement uses one DC-DC converter for connecting each string of PV modules to the inverter. For these multi-stage inverters, a DC-DC converter implements the maximum MPPT control of each string and one power inverter handles the current and voltage control loops.
The two distinct categories of the inverter are known as voltage source inverter (VSI) and current source inverter (CSI). Voltage source inverters are named so because the independently controlled output is a voltage waveform. In this structure, the VSI is fed from a DC-link capacitor, which is connected in parallel with the PV panels. Similarly, current source inverters control the AC current waveform. In this arrangement, the inverter is fed from a large DC-link inductor. In industrial markets, the VSI design has proven to be more efficient and to have higher reliability and faster dynamic response.
Since applications of modern distributed energy resources introduce new constraints of high quality electric power, flexibility and reliability to the PV-based distributed generator, a twostage PV PCS topology using voltage source inverters has been mostly applied in the literature. This configuration of two cascade stages offers an additional degree of freedom in the operation of the grid-connected PV system when compared with the one-stage configuration. Hence, by including the DC-DC boost converter, various control objectives, as reactive power compensation, voltage control, and power oscillations damping among others, are possible to be pursued simultaneously with the typical PV system operation without changing the PCS topology [17].
The detailed model of a grid-connected PV system is illustrated in Fig. 5, and consists of the solar PV arrangement and its PCS to the electric utility grid [8]. PV panels are electrically combined in series to form a string (and sometimes stacked in parallel) in order to provide the desired output power required for the DG application. The PV array is implemented using the aggregated model previously described, by directly computing the total internal resistances, non-linear integrated characteristic and total generated solar cell photocurrent according to the series and parallel contribution of each parameter. A three-phase DC-AC voltage source inverter is employed for connecting to the grid. This three-phase static device is shuntconnected to the distribution network by means of a coupling transformer and the corresponding line sinusoidal filter. The output voltage control of this VSI can be efficiently performed using pulse width modulation (PWM) techniques [18].

Voltage source inverter
Since the DC-DC converter acts as a buffer between the PV array and the power static inverter by turning the highly nonlinear radiation and temperature-dependent I-V characteristic curve of the PV system into a quasi-ideal atmospheric factors-controlled voltage source characteris-   tic, the natural selection for the inverter topology is the voltage source-type. This solution is more cost-effective than alternatives like hybrid current source inverters (HCSI).  The voltage source inverter presented in Fig. 5 consists of a multi-level DC-AC power inverter built with insulated-gate bipolar transistors (IGBTs) technology. This semiconductor device offers a cost-effective solution for distributed generation applications since it has lower conduction and switching losses with reduced size than other switching devices. Furthermore, as the power of the inverter is in the range of low to medium level for the proposed application, it can be efficiently driven by sinusoidal pulse width modulation (SPWM) techniques.
The VSI utilizes a diode-clamped multi-level (DCML) inverter topology, also commonly called neutral point clamped (NPC), instead of a standard inverter structure with two levels and six pulses. The three-level twelve-pulse VSI structure employed is very popular especially in high power and medium voltage applications. Each one of the three-phase outputs of the inverter shares a common DC bus voltage that has been divided into three levels over two DC bus capacitors. The middle point of the two capacitors constitute the neutral point of inverter and output voltages have three voltage states referring to this neutral point. The general concept of this multi-level inverter is to synthesize a sinusoidal voltage from several levels of voltages. Thus, the three-level structure attempts to address some restrictions of the standard two-level one by providing the flexibility of an extra level in the output voltage, which can be controlled in duration to vary the fundamental output voltage or to assist in the output waveform construction. This extra feature allows generating a more sinusoidal output voltage waveform than conventional structures without increasing the switching frequency. In this way, the voltage stress on the switching devices is reduced and the output harmonics distortion is minimized [19].
The connection of the inverter to the distribution network in the so-called point of common coupling (PCC) is made by means of a typical step-up Δ-Y power transformer with line sinusoidal filters. The design of this single three-phase coupling transformer employs a deltaconnected windings on its primary and a wye/star connected windings with neutral wire on its secondary. The delta winding allows third-harmonic currents to be effectively absorbed in the winding and prevents from propagating them onto the power supply. In the same way, high frequency switching harmonics generated by the PWM control of the VSI are attenuated by providing second-order low-pass sine wave filters. Since there are two possibilities of fit ting the filters, i.e. placing them in the primary and in the secondary of the coupling transformer, it is normally preferred the first option because it reduces notably the harmonics contents in the transformer windings, thus reducing losses as heat and avoiding its overrating.
The mathematical equations describing and representing the operation of the VSI can be derived from the detailed model shown in Fig. 5 by taking into account some assumptions with respect to the operating conditions of the inverter [20]. For this purpose, a simplified scheme of the VSI connected to the electric system is developed, also referred to as the averaged model, which is presented in Fig. 6. The power inverter operation under balanced conditions is considered as ideal, i.e. the VSI is seen as an ideal sinusoidal voltage source operating at fundamental frequency. This consideration is valid since the high-frequency harmonics produced by the inverter as result of the sinusoidal PWM control techniques are mostly filtered by the low pass sine wave filters and the net instantaneous output voltages at the point of common coupling resembles three sinusoidal waveforms spaced 120° apart. At the output terminals of the low pass filters, the voltage total harmonic distortion (VTHD) is reduced to as low as 1%, decreasing this quantity to even a half at the coupling transformer output terminals (or PCC).  The equivalent ideal inverter depicted in Fig. 6 is shunt-connected to the AC network through the inductance L S , accounting for the equivalent leakage of the step-up coupling transformer and the series resistance R S , representing the transformer winding resistance and VSI IGBTs conduction losses. The magnetizing inductance of the step-up transformer takes account of the mutual equivalent inductance M. On the DC side, the equivalent capacitance of the two DC bus capacitors, C 1 and C 2 (C 1 =C 2 ), is described through C=C 1 /2=C 2 /2 whereas the switching losses of the VSI and power loss in the DC capacitors are represented by R p .
The dynamic equations governing the instantaneous values of the three-phase output voltages on the AC side of the VSI and the current exchanged with the utility grid can be directly derived by applying Kirchhoff's voltage law (KVL) as follows: where: Under the assumption that the system has no zero sequence components, all currents and voltages can be uniquely transformed into the synchronous-rotating orthogonal two-axes reference frame, in which each vector is described by means of its d and q components, instead of its three a, b, c components. Consequently, as depicted in Fig. 7  By applying Park's transformation stated by Eq. (11), Eqs. 9 through 10 can be transformed into the synchronous rotating d-q reference frame as follows (Eqs. (12) through (14)): s   2  2  cos  cos  cos  3  3   2  2  2  K  sin  sin  sin  3  3  3  1 1 with: By neglecting the zero sequence components, Eqs. (13) and (14) are obtained. where: It is to be noted that the coupling of phases abc through the term M in matrix L s (Eq. (10)), was eliminated in the dq reference frame when the inverter transformer is magnetically symmetric, as is usually the case. This decoupling of phases in the synchronous-rotating system simplifies the control system design.
By rewriting Eq. (13), the state-space representation of the inverter is obtained as follows: A further major issue of the dq transformation is its frequency dependence (ω). In this way, with appropriate synchronization to the network (through angle θ), the control variables in steady state are transformed into DC quantities. This feature is quite useful to develop an efficient decoupled control system of the two current components. Although the model is fundamental frequency-dependent, the instantaneous variables in the dq reference frame contain all the information concerning the three-phase variables, including steady-state unbalance, harmonic distortions and transient components.
The AC and DC sides of the VSI are related by the power balance between the input and the output on an instantaneous basis. In this way, the ac power should be equal to the sum of the DC resistance power and to the charging rate of the DC capacitors, as described by Eq. (16).

( )
The VSI basically generates the AC voltage v inv from the DC voltage V d , in such a way that the connection between the DC-side voltage and the generated AC voltage can be described by using the average switching function matrix in the dq reference frameS av,dq , as given by Eqs.
Inspection of Eq. (20) shows a cross-coupling of both components of the VSI output current through the term ω. This issue of the d-q reference frame modelling approach must be counteracted by the control system. Furthermore, it can be observed an additional coupling resulting from the DC capacitors voltage V d . Moreover, average switching functions (S d and S q ) introduce nonlinear responses in the inverter states i d , i q and V d when α is regarded as an input variable. This difficulty demands to keep the DC bus voltage as constant as possible, in order to decrease the influence of the dynamics of V d . There are two ways of dealing with this problem. One way is to have a large capacitance for the DC capacitors, since bigger capacitors value results in slower variation of the capacitors voltage. However, this solution makes the compensator larger and more expensive. Another way is to design a controller of the DC bus voltage. In this fashion, the capacitors can be kept relatively small. This last solution is employed here for the control scheme.

DC-DC boost converter
The intermediate DC-DC boost converter fitted between the PV array and the inverter acts as an interface between the output DC voltage of the PV modules and the DC link voltage at the input of the voltage source inverter. The voltage of the PV array is variable with unpredictable atmospheric factors, while the VSI DC bus voltage is controlled to be kept constant at all load conditions. In this way, in order to deliver the required output DC voltage to the VSI link, a standard unidirectional topology of a DC-DC boost converter (also known as step-up converter or chopper) is employed. This switching-mode power device contains basically two semiconductor switches (a rectifier diode and a power transistor) and two energy storage devices (an inductor and a smoothing capacitor) for producing an output DC voltage at a level greater than its input DC voltage. The basic structure of the DC-DC boost converter, using an IGBT as the main power switch, is shown in Fig. 5.
The converter produces a chopped output voltage through pulse-width modulation (PWM) control techniques in order to control the average DC voltage relation between its input and output. Thus, the chopper is capable of continuously matching the characteristic of the PV system to the equivalent impedance presented by the DC bus of the inverter. In this way, by varying the duty cycle of the DC-DC converter it is feasibly to operate the PV system near the MPP at any atmospheric conditions and load.
The operation of the converter in the continuous (current) conduction mode (CCM), i.e. with the current flowing continuously through the inductor during the entire switching cycle, facilitates the development of the state-space model. The reason for this is that only two switch states are possible during a switching cycle, namely, (i) the power switch T b is on and the diode D b is off, or (ii) T b is off and D b is on. In steady-state CCM operation and neglecting the parasitic components, the state-space equation that describes the dynamics of the DC-DC boost converter is given by Eq. (21) [21]. where: If the switching frequency of T b is significantly higher than the natural frequencies of the DC-DC boost converter, this discontinuous model can be approximated by a continuous statespace averaged (SSA) model, where a new variable D is introduced. In the [0, 1] subinterval, D is a continuous function and represents the duty cycle D of the DC-DC converter. It is defined as the ratio of time during which the power switch T b is turned-on to the period of one complete switching cycle, T S . This variable is used for replacing the switching function of the power converter in Eq. (21), yielding the following SSA expression: The DC-DC converter produces a chopped output voltage for controlling the average DC voltage relation between its input and output. In this way, it is significant to derive the steadystate input-to-output conversion relationship of the boost converter in the CCM. Since in steady-state conditions the inductor current variation during on and off times of the switch T b are essentially equal, and assuming a constant DC output voltage of the boost converter, the voltage conversion relationship can be easily derived. To this aim, the state-derivative vector in Eq. (23) is set to zero, yielding the following expression: In the same way, by assuming analogous considerations, the current conversion relationship of the boost converter in the CCM is given by Eq. (25).

PVG control strategy
The hierarchical control of the three-phase grid-connected PV generator consists of an external, middle and internal level, as depicted in Fig. 8 [21].

External level control
The external level control, which is outlined in the left part of Fig. 8 in a simplified form, is responsible for determining the active and reactive power exchange between the PV generator and the utility electric system. This control strategy is designed for performing two major control objectives, namely the voltage control mode (VCM) with only reactive power compensation capabilities and the active power control mode (APCM) for dynamic active power exchange between the PV array and the electric power system. To this aim, the instantaneous voltage at the PCC is computed by employing a synchronous-rotating reference frame. As a consequence, the instantaneous values of the three-phase AC bus voltages are transformed into d-q components, v d and v q respectively. Since the d-axis is always synchronized with the instantaneous voltage vector v m , the d-axis current component of the VSI contributes to the instantaneous active power p while the q-axis current component represents the instantaneous reactive power q. Thus, to achieve a decoupled active and reactive power control, it is required to provide a decoupled control strategy for i d and i q . In this way, only v d is used for computing the resultant current reference signals required for the desired PV output active and reactive power flows. Additionally, the instantaneous actual output currents of the PV system, i d and i q , are obtained and used in the middle level control.  In many modern electricity grids with high integration of intermittent renewable-based distributed generation, voltage regulation is becoming a necessary task at the distribution level. Since the inverter-interfaced sources are deployed to regulate the voltage at the point of common coupling of each inverter, the PVG can easily perform this control action and participate in the voltage control of the grid. To this aim, a control loop of the external level is the VCM, also called Automatic Voltage Regulation (AVR). It controls (supports and regulates) the voltage at the PCC through the modulation of the reactive component of the inverter output current, i q . Since only reactive power is exchanged with the grid in this control mode, there is no need for the PV array or any other external energy source. In fact, this reactive power is locally generated just by the inverter and can be controlled simultaneously and independently of the active power generated by the PV array. The design of the control loop in the rotating frame employs a standard proportional-integral (PI) compensator including an anti-windup system. This control mode eliminates the steady-state voltage offset via the PI compensator. A voltage regulation droop is included in order to allow the terminal voltage of the PV inverter (PCC) to vary in proportion with the compensating reactive current. Thus, the PI controller with droop characteristics becomes a simple phase-lag compensator.
The main objective of the grid-connected solar photovoltaic generating system is to exchange with the electric utility grid the maximum available power for the given atmospheric conditions, independently of the reactive power generated by the inverter. In this way, the APCM allows dynamically controlling the active power flow by constantly matching the active power exchanged by the inverter with the maximum instant power generated by the PV array. This implies a continuous knowledge of not only the PV panel internal resistances but also the voltage generated by the PV array. This requirement is very difficult to meet in practice and would increase complexity and costs to the DG application. It would require additional sensing of the cell temperature and solar radiation jointly with precise data of its characteristic curve. Even more, PV parameters vary with time, making it difficult for real-time prediction.
Many MPPT methods have been reported in literature. These methods can be classified into three main categories: lookup table methods, computational methods (neural networks, fuzzy logic, etc.) and hill climbing methods [22][23][24][25]. These vary in the degree of sophistication, processing time and memory requirements. Among them, hill climbing methods are indirect methods with a good combination of flexibility, accuracy and simplicity. They are efficient and robust in tracking the MPP of solar photovoltaic systems and have the additional advantages of control flexibility and easiness of application with different types of PV arrays. The power efficiency of these techniques relies on the control algorithm that tracks the MPP by measuring some array quantities.
The simplest MPPT using climbing methods is the "Perturbation and Observation" (P&O) method. This MPPT strategy uses a simple structure and few measured variables for implementing an iterative method that permits matching the load with the output impedance of the PV array by continuously adjusting the DC-DC converter duty cycle. This MPPT algorithm operates by constantly perturbing, i.e. increasing or decreasing, the output voltage of the PV array via the DC-DC boost converter duty cycle D and comparing the actual output power with the previous perturbation sample, as depicted in Fig. 9. If the power is increasing, the perturbation will continue in the same direction in the following cycle, otherwise the perturbation direction will be inverted. This means that the PV output voltage is perturbed every MPPT iteration cycle k at sample intervals T trck , while maintaining always constant the VSI DC bus voltage by means of the middle level control. Therefore, when the optimal power for the specific operating conditions is reached, the P&O algorithm will have tracked the MPP (the climb of the PV array output power curve) and then will settle at this point but oscillating slightly around it. The output power measured in every iteration step is employed as a reference power signal P r and then converted to a direct current reference i dr for the middle level control.

No Yes
Program Variables Initialization:

Middle level control
The middle level control generates the expected output, particularly the actual active and reactive power exchange between the PV VSI and the AC system, to dynamically track the reference values set by the external level. This level control, which is depicted in the middle part of Fig. 8, is based on a linearization of the state-space mathematical model of the PV system in the d-q reference frame, described in Eq. (20).
In order to achieve a decoupled active and reactive power control, it is required to provide a decoupled current control strategy for i d and i q . Inspection of Eq. (20) shows a cross-coupling of both components of the PV VSI output current through ω. Therefore, appropriate control signals have to be generated. To this aim, it is proposed to use two control signals x 1 and x 2 , which are derived from assumption of zero derivatives of currents in the upper part (AC side) of (20). In this way, using two conventional PI controllers with proper feedback of the VSI output current components allows eliminating the cross-coupling effect in steady state. Eq. (20) also shows an additional coupling of derivatives of i d and i q with respect to the DC voltage V d . This issue requires maintaining the DC bus voltage constant in order to decrease the influence of V d . The solution to this problem is obtained by using a DC bus voltage controller via a PI controller for eliminating the steady-state voltage variations at the DC bus. This DC bus voltage control is achieved by forcing a small active power exchange with the electric grid for compensating the VSI switching losses and the transformer ones, through the contribution of a corrective signal i dr* .

Internal level control
The internal level provides dynamic control of input signals to the DC-DC and DC-AC converters. This control level, which is depicted in the right part of Fig. 8, is responsible for generating the switching signals for the twelve valves of the three-level VSI, according to the control mode (PWM) and types of valves used (IGBTs). This level is mainly composed of a three-phase three-level sinusoidal PWM generator for the VSI IGBTs, and a two-level PWM generator for the single IGBT of the boost DC-DC converter. Furthermore, it includes a line synchronization module, which consists mainly of a phase locked loop (PLL). This circuit is a feedback control system used to automatically synchronize the converter switching pulses with the positive sequence components of the AC voltage vector at the PCC. This is achieved by using the phase θ s of the inverse coordinate transformation from dq to abc components.

PVG model and control implementation in MATLAB/Simulink
The complete detailed model and control scheme of the three-phase grid-connected PVG is implemented in the MATLAB/Simulink software environment using the SimPowerSystems (SPS) [8], as depicted in Figs. 10 to 11. SPS was designed to provide a modern design tool that allows scientists and engineers to rapidly and easily build models that simulate power systems. SimPowerSystems uses the Simulink environment, which is a tool based on a graphical user interface (GUI) that permits interactions between mechanical, thermal, control, and other disciplines. This is possible because all the electrical parts of the simulation interact with the extensive Simulink modelling library. These libraries contain models of typical power equipment such as transformers, lines, machines, and power electronics among others. As Simulink uses MATLAB as the computational engine, designers can also use MATLAB toolboxes and other Simulink blocksets.
Since the detailed model of the proposed PVG application contains many states and non-linear blocks such as power electronics switches, the discretization of the electrical system with fixedstep is required so as to allow much faster simulation than using variable time-step methods. Two sample times are employed in order to enhance the simulation, Ts_Power= 5 µs for the simulation of the power system, the VSI and the DC-DC converter, and Ts_Control= 100 µs for the simulation of the multi-level control blocks.
The three-phase grid-connected PV energy conversion system is implemented basically with the Three-Level Bridge block. The three-phase three-level Voltage Source Inverter makes uses of three arms of power switching devices, being IGBTs in this work. In the same way, the DC-DC converter is implemented through the Three-Level Bridge but using only one arm of IGBTs. From the four power switching devices of each arm, just one device is activated for accomplishing the chopping function while the other three are kept off all the time. With this implementation approach, the turn-on and turn-off times (Fall time, Tail time) of the power switching device are not modelled, resulting in a faster simulation when compared to a single IGBT mask using an increased state-space model.

Simulation and experimental results
In order to analyze the effectiveness of the proposed models and control algorithms of the three-phase grid-connected PV system, time-discrete dynamic simulation tests have been performed in the MATLAB/Simulink environment. To this aim, the simulation of a 250 Wp (peak power) PVG has been compared with experimental data collected from a laboratoryscale prototype, which is presented in Fig. 12.
The PV array implemented consists of a single string of 5 high-efficiency polycrystalline PV modules (NS=5, NP=1) of 50 Wp (Solartec KS50T, built with Kyocera cells) [27]. This array makes up a peak installed power of 250 W and is linked to a 110 V DC bus of a three-phase three-level PWM voltage source inverter through a DC-DC boost converter. The resulting dualstage converter is connected to a 380 V/50 Hz three-phase electric system using three 60 V/220 V step-up coupling transformers connected in a Δ-Yg configuration. The VSI has been rated at 1 KVA and designed to operate at 5 kHz with sinusoidal PWM. It is built with IGBTs with internal anti-parallel diodes and fast clamping diodes, and includes an output inductivecapacitive low pass filter. The DC-DC boost converter interfacing the PV string with the DC bus of the VSI is also built with IGBTs and fast diodes, and has been designed to operate at 5 kHz. The three-phase grid-connected PV energy conversion system is implemented basically with the Three-Level Bridge block. The three-phase three-level Voltage Source Inverter makes uses of three arms of power switching devices, being IGBTs in this work. In the same way, the DC-DC converter is implemented through the Three-Level Bridge but using only one arm of IGBTs. From the four power switching devices of each arm, just one device is activated for accomplishing the chopping function while the other three are kept off all the time. With this implementation approach, the turn-on and turn-off times (Fall time, Tail time) of the power switching device are not modelled, resulting in a faster simulation when compared to a single IGBT mask using an increased state-space model.

Simulation and Experimental Results
In order to analyze the effectiveness of the proposed models and control algorithms of the three-phase grid-connected PV system, time-discrete dynamic simulation tests have been performed in the MATLAB/Simulink environment. To this aim, the simulation of a 250 Wp (peak power) PVG has been compared with experimental data collected from a laboratoryscale prototype, which is presented in Fig. 12.  be continuously operated within the MPP locus (shaded region) for an optimized application of the system. In this way, a continuous adjustment of the array terminal voltage is required for providing maximum power to the electric grid.   The three-level control scheme was entirely implemented on a high-performance 32-bit fixedpoint digital signal processor (DSP) operating at 150 MHz (Texas Instruments TMS320F2812) [28]. This processor includes an advanced 12-bit analog-to-digital converter with a fast conversion time which makes it possible real time sampling with high accuracy and real time abc to synchronous dq frame coordinate transformation. The DSP is operated with a selected sample rate of 160 ksps and low-pass filters were implemented using 5th order low-pass filters based on a Sallen & key designs. The control pulses for the VSI and the DC-DC chopper has been generated by employing two DSP integrated pattern generators (event managers). The gate driver board of the IGBTs has been designed to adapt the wide differences of voltage and current levels with the DSP and to provide digital and analog isolation using optically coupled isolators. All the source code was written in C++ by using the build-in highly efficient DSP compiler. Fig. 13 depicts the I-V and P-V characteristic curves of the 250 W PV array for given climatic conditions, such as the level of solar radiation and the cell temperature. The characteristic curve at 25°C and 200/600/1000 W/m 2 have been evaluated using the proposed model (blue solid line) with the software developed and measurements obtained from the experimental set-up (blue dotted line). The experimental data have been obtained using a peak power measuring device and I-V curve tracer for PV modules and strings (PVE PVPM 1000C40) [29]. As can be observed, the proposed model of the PV array shows a very good agreement with measured data at all the given levels of solar radiation.
As can be derived from both characteristic curves of the PV system, there exist a specific point at which the generated power is maximized (i.e. MPP) and where the output I-V characteristic curve is divided into two parts: the left part is defined as the current source region in which the output current approximates to a constant, and the right part is the voltage source region in which the output voltage hardly changes. Since the MPP changes with variations in solar radiation and solar cell operating temperature, the PV array have to be continuously operated within the MPP locus (shaded region) for an optimized application of the system. In this way, a continuous adjustment of the array terminal voltage is required for providing maximum power to the electric grid.  Fig. 14 presents a comparison of actual, measured and simulated output power trajectory within a 10-hour period of analysis for a cloudy day with high fluctuations of solar radiation, for the proposed 250 W PV system with and without the implementation of the MPPT algorithm. The time data series shown in light blue solid line represents the actual maximum power available from the PV array for the specific climatic conditions, i.e. the MPP to be tracked at all times by the MPPT. Simulation results obtained with the MPPT algorithm are shown in red solid lines. In the same way, the two time data series shown in black and green solid lines, respectively represents the measurements obtained from the experimental setup with the control system with the MPPT activated (black) and with no MPPT (green). As can be observed, the MPPT algorithm (measurements and simulation) follows accurately the maximum power (actual available power) that is proportional to the solar radiation and temperature variations. In this sense, it can be noted from measurements and simulation a very precise MPP tracking when soft variations in the solar radiation take place, while differing slightly when these variations are very fast and of a certain magnitude. It can be also derived that there is a good correlation between the experimental and the simulation data. In addition, the deactivation of the MPPT control results in a constant voltage operation of the PV array output at about 60 V for the given prototype conditions. In this last case, a significant reduction of the installation efficiency is obtained, which is worsen with the increase of the solar radiation. This preceding feature validates the use of an efficient MPPT scheme for maximum exploitation of the PV system.

Conclusion
This chapter has presented a full detailed mathematical model of a three-phase grid-connected photovoltaic generator, including the PV array and the electronic power conditioning system. The model of the PV array uses theoretical and empirical equations together with data provided by manufacturers and meteorological data (solar radiation and cell temperature among others) in order to accurately predict the PV array characteristic curve. Moreover, it has presented the control scheme of the PVG with capabilities of simultaneously and independently regulating both active and reactive power exchange with the electric grid. The control algorithms incorporate a maximum power point tracker (MPPT) for dynamic active power generation jointly with reactive power compensation of distribution utility system. The model and control strategy of the PVG have been implemented using the MATLAB/Simulink environment and validated by experimental tests.