Harmonic Distortion Prediction Model of a Grid-Tie Photovoltaic Inverter Using an Artificial Neural Network

Expanding the number of photovoltaic (PV) systems integrated into a grid raises many concerns regarding protection, system safety, and power quality. In order to monitor the effects of the current harmonics generated by PV systems, this paper presents long-term current harmonic distortion prediction models. The proposed models use a multilayer perceptron neural network, a type of artificial neural network (ANN), with input parameters that are easy to measure in order to predict current harmonics. The models were trained with one-year worth of measurements of power quality at the point of common coupling of the PV system with the distribution network and the meteorological parameters measured at the test site. A total of six different models were developed, tested, and validated regarding a number of hidden layers and input parameters. The results show that the model with three input parameters and two hidden layers generates the best prediction performance.


Introduction
Renewable energy sources (RES) have developed rapidly within the last decade.Among the different types of RES, photovoltaic (PV) systems can be considered to be one of the most promising technologies due to the continuously decreasing cost of PV modules and their constantly increasing solar cell efficiency.The encouraging policies and frameworks developed by governments worldwide have spurred the continuous growth of the installed capacity of PV systems, resulting in a global installed capacity of 402 GW at the end of 2017 [1].The majority of these systems are connected with power electronics-based converters to the AC grid, which has raised many concerns regarding protection, system safety, voltage instability, and power quality [2].Because the output current of a PV plant based on power electronics is not a pure sinusoidal wave but a distorted, high-order current, harmonics are generated.These currents generate harmonic distortions of voltages flowing through the system's impedances [3,4].This has produced general concern for the grid operation, especially if large amounts of installed capacity are present in the part of the grid with low short-circuit power (i.e., the weak grid), which can be the case when there is a distribution network radial feeder [4].Additionally, actual grid code compliance requires adequate power quality of the power injected into the grid during various disturbances [5].In order to monitor the effects of the current harmonics generated by PV plants on the system voltage, current harmonic prediction models need to be developed.
Saini and Kapoor [6] and Khokhar et al. [7] provided general reviews of the application of artificial intelligence techniques in the classification of power quality disturbances.There are two main types of methodologies for current harmonic prediction: real-time application and long-term current harmonic predictions.The real-time application of current harmonic prediction is mostly used in active filters and static synchronous compensators (STATCOM) [8] and will not be the focus of this work.However, long-term current harmonic prediction methods can be used by system operators in order to address and reduce possible harmonic problems during operation [9].
Kow et al. [10] reviewed the performance of artificial intelligence and conventional methods on mitigating PV grid-tied related power quality events.A short-term current harmonic estimation method is also discussed in [11], in which the authors proposed two different techniques.The first is based on instantaneous powers, while the second is based on an ADALINE neural network.Merabet et al. [8] proposed a new method for harmonic current predictions, using impedance modeling of grid-tie inverters.The proposed method estimates the current harmonic emitted by PV plants at the point of common coupling (PCC) as a function of the background voltage harmonics.Cao et al. [12] proposed a simple method for current total harmonic distortion (THDI) prediction for small-scale grid-connected inverters.The method uses double-frequency current control pulse with modulation (PWM) technique in order to validate the estimation of the THDI.Rodway et al. [13] proposed a new method for THDI prediction based on extreme learning machine (single-layer feed-forward neural network) and random forests techniques.The proposed model uses only solar irradiance as an input.The results showed that random forests technique outperformed the extreme learning machine neural network both with respect to categorical and continuous predictions.
None of these papers, however, proposed a long-term current harmonic distortion prediction model based on easy measurable parameters; therefore, the general idea of the paper was to design a current harmonic prediction model using solar irradiance and ambient temperature as predictors.The results of this model's current harmonic prediction can be utilized by the distribution system operators (DSO) in order to predict the current harmonic distortion, especially in situations of weak radial feeders with high penetration of PV systems.On top of that, DSOs can use this current harmonic prediction model for monitoring the influence of PV plants' harmonic emissions on system voltage distortion.
As an additional benefit, the developed model's simplicity allows for it to be implemented on inverter control hardware as well.The long-term prediction will allow the system operator to request the appropriate level of power quality parameters at the PCC, while the same prediction model can be then used by the inverter to select the appropriate technique for harmonic control and the mitigation of the effects of the inverter control strategies.Because this ability is not integrated into the power quality standards related to renewables, this may lead to interferences between the grid and the power electronics-based generation sources, resulting in an unused capability [14].
The proposed model uses a type of artificial neural network (ANN) called multilayer perceptron neural network (MLPNN) with input parameters (predictors) that are easy to measure (solar irradiance and ambient temperature).The MLPNN is trained with one-year worth of power quality parameters measured at the PCC of a 10 kW PV plant with the distribution grid and meteorological data measured at the test site.The forecasting model predicts the 5th, 7th, 11th, and 13th current harmonic emitted by the PV plant, because it uses a 6-pulse transformerless three-phase grid-tie inverter.The 6-pulse inverter generates current harmonics of order 6k ± 1 where k represents integer values of which 5th, 7th, 11th, and 13th are the largest.Furthermore, triples harmonics are not present in this topology [15]; therefore, the 3rd current harmonic is not predicted by the developed model.
This paper is organized into five sections.Section 1 presents the introduction to the topic of the paper and a literature review.Section 2 describes the proposed methodology, while Section 3 analyzes the power quality and meteorological data measured at the test site.Section 4 presents a description of the MLPNN used for the current harmonic prediction and its design process.Moreover, the evaluation metrics for the model are described.In the last part of Section 4, the performance results for the different models of MLPNN are presented, analyzed, and discussed.In Section 5, concluding remarks based on the obtained results are provided.

Description of the Site
In this paper, a 10-kWp PV plant, considered to be a residential-scale system, is studied.The PV plant is an outdoor component of the Laboratory for Renewable Energy Sources at the Faculty of Electrical Engineering, Computer Science, and Information Technology (FERIT) Osijek in Osijek, Croatia.Osijek is located in the eastern part of Croatia (latitude 45 • 33 17" N, longitude 18 • 41 43 E), and it has a European, humid continental climate [16].The PV plant is installed on the roof of the FERIT Osijek building with a 7 • tilt angle.It consists of 2 5-kWp PV arrays connected to a three-phase grid-tie inverter, which is connected to a 230 V AC, 50 Hz distribution network via the building's electrical switchboard.Each array consists of 20 series-connected 250 Wp PV modules.The first array consists of monocrystalline silicon, while the second consists of polycrystalline silicon PV modules.The technical characteristics of the three-phase grid-tie inverter of the PV plant are given in Table 1.

Measurement Procedure
The measurements used for our analysis were obtained by the data acquisition system developed by the Laboratory for Renewable Energy Sources of the FERIT Osijek.The data acquisition system simultaneously and continuously measures, analyzes, and stores electrical and meteorological data at the test site in local and cloud databases [18].This paper used measurements of solar irradiance and ambient temperature and power quality measurements.The solar irradiance was measured by a Kipp&Zonnen SMP3 pyranometer, while the ambient temperature was measured by a weather station, which uses a DB18B20 digital thermometer.The power quality was measured by a class-A three-phase power quality analyzer Fluke 1760 compliant with IEC 61000-4-30 standards [19].The solar irradiance and ambient temperature were recorded and stored every second and later averaged (every 10 min) in the data acquisition system.Figure 1 shows the layout of the 10-kWp PV plant and part of the data acquisition system used for the electrical and meteorological measurements, while Figure 2 shows the actual equipment used to obtain the measurements for our paper analysis (PV plant strings, PV plant inverter, pyranometer, and power quality analyzer).In this paper, the measurements recorded during the period of 1 year (1 January 2018-31 December 2018) were used for the MLPNN models' training.Each point of measurement represents the 10-min average value of the measured parameter.

Meteorological Data
In this section, the analysis of the meteorological data measured at the test site is described.The daily mean values of the solar irradiation and ambient temperatures of 2018 are given in Figure 3.The analysis of the results shows higher solar irradiation and ambient temperatures during the summer months, which is an expected feature of a European, humid continental climate.Furthermore, Table 2 gives the statistical analysis of the solar irradiance and ambient temperatures, which are later used as input parameters for the MLPNN models.In this section, the analysis of the meteorological data measured at the test site is described.The daily mean values of the solar irradiation and ambient temperatures of 2018 are given in Figure 3.The analysis of the results shows higher solar irradiation and ambient temperatures during the summer months, which is an expected feature of a European, humid continental climate.Furthermore, Table 2 gives the statistical analysis of the solar irradiance and ambient temperatures, which are later used as input parameters for the MLPNN models.

Power Quality Measurement Analysis
The power quality measurements were taken at the PCC of the PV plant's inverter with the AC distribution grid.In order to address the problem of the current harmonic prediction, a time series of 1st, 5th, 7th, 11th, and 13th current harmonics on 2 selected days (sunny and partially cloudy days) were analyzed.Figure 4 shows 1st, 5th, 7th, 11th and 13th current harmonics on 21 August 2018 (sunny day), while Figure 5 shows those on 15 April 2018 (partially cloudy day).It is visible in Figure 4 that there is a certain pattern of the current harmonics during the sunny day, while in Figure 5 (partially cloudy day), such pattern does not exist because of the solar irradiance intermittence.This behavior is the main driver for the current harmonic prediction model development based on ANN.

Power Quality Measurement Analysis
The power quality measurements were taken at the PCC of the PV plant's inverter with the AC distribution grid.In order to address the problem of the current harmonic prediction, a time series of 1st, 5th, 7th, 11th, and 13th current harmonics on 2 selected days (sunny and partially cloudy days) were analyzed.Figure 4 shows 1st, 5th, 7th, 11th and 13th current harmonics on 21 August 2018 (sunny day), while Figure 5 shows those on 15 April 2018 (partially cloudy day).It is visible in Figure 4 that there is a certain pattern of the current harmonics during the sunny day, while in Figure 5 (partially cloudy day), such pattern does not exist because of the solar irradiance intermittence.This behavior is the main driver for the current harmonic prediction model development based on ANN.   Figure 6 gives a comparison of the current harmonic spectrum for the 2 analyzed days (sunny and partially cloudy days).It is evident that the 2 compared days have similar patterns where the 5th, 7th, 11th, and 13th current harmonics are the highest.This behavior was described in Section 1.   Figure 6 gives a comparison of the current harmonic spectrum for the 2 analyzed days (sunny and partially cloudy days).It is evident that the 2 compared days have similar patterns where the 5th, 7th, 11th, and 13th current harmonics are the highest.This behavior was described in Section 1.  Figure 7 gives comparison of absolute THDI calculated from the 2nd to the 40th current harmonic using Equation ( 1) and the absolute THDI calculated only from the 5th, 7th, 11th, and 13th current harmonics using Equation ( 2), where i represents the order of the current harmonic and Ii represents the effective current of the harmonic order i: The relation of THDI is given for the period of 14 August 2018-17 August 2018.It is clear that the 5th, 7th, 11th, and 13th current harmonics generate the majority of the THDI.The annual share of THDI calculated considering only the 5th, 7th, 11th, and 13th current harmonics, calculated as in Equation ( 2), in THDI calculated considering the 2nd to the 40th current harmonics, calculated as in Equation ( 1), is 82.04% (only for daytime when the PV plant is operating).
Figures 8 and 9 give the dependency of the 5th, 7th, 11th, and 13th current harmonics' amplitudes on the 2 input parameters of the MLPNN from 2018, i.e., solar irradiance and ambient temperature.Each point on the scatterplots represent a 10-min average value of the parameters measured at that time.The scatterplots given in Figures 8 and 9 show large dispersions of the current harmonics, especially in relation to the ambient temperature.This dispersion is also confirmed for both Figures 8 and 9 with the coefficient of correlation R. The coefficient of correlation in this case represents the correlation of each current harmonic amplitude to the meteorological parameter (solar irradiance or ambient temperature).The stronger the coefficient of correlation R, the stronger the dependency of the current harmonic amplitude on the meteorological parameter.It can be observed that larger coefficients of correlation R are present in the current harmonic amplitudes in relation to solar irradiance rather than in those in relation to ambient temperature.Furthermore, it can be seen that largest coefficients of correlation R occur for 5th current harmonic amplitude in relation to solar irradiance.Figure 7 gives comparison of absolute THDI calculated from the 2nd to the 40th current harmonic using Equation ( 1) and the absolute THDI calculated only from the 5th, 7th, 11th, and 13th current harmonics using Equation ( 2), where i represents the order of the current harmonic and I i represents the effective current of the harmonic order i: The relation of THDI is given for the period of 14 August 2018-17 August 2018.It is clear that the 5th, 7th, 11th, and 13th current harmonics generate the majority of the THDI.The annual share of THDI calculated considering only the 5th, 7th, 11th, and 13th current harmonics, calculated as in Equation ( 2), in THDI calculated considering the 2nd to the 40th current harmonics, calculated as in Equation ( 1), is 82.04% (only for daytime when the PV plant is operating).
Figures 8 and 9 give the dependency of the 5th, 7th, 11th, and 13th current harmonics' amplitudes on the 2 input parameters of the MLPNN from 2018, i.e., solar irradiance and ambient temperature.Each point on the scatterplots represent a 10-min average value of the parameters measured at that time.The scatterplots given in Figures 8 and 9 show large dispersions of the current harmonics, especially in relation to the ambient temperature.This dispersion is also confirmed for both Figures 8 and 9 with the coefficient of correlation R. The coefficient of correlation in this case represents the correlation of each current harmonic amplitude to the meteorological parameter (solar irradiance or ambient temperature).The stronger the coefficient of correlation R, the stronger the dependency of the current harmonic amplitude on the meteorological parameter.It can be observed that larger coefficients of correlation R are present in the current harmonic amplitudes in relation to solar irradiance rather than in those in relation to ambient temperature.Furthermore, it can be seen that largest coefficients of correlation R occur for 5th current harmonic amplitude in relation to solar irradiance.The statistical analysis of the 5th, 7th, 11th, and 13th current harmonics is given in Table 3.The statistical indices given in Table 3 show the distribution of the measured current harmonic amplitudes.It can be seen that the current harmonics have different ranges of values.For example, the 5th current harmonic has the biggest amplitude range, from 0.1354 A to 0.8489 A, while the 13th current harmonic has the lowest, from 0.0437 A to 0.2915 A. Furthermore, it can be seen that the observed current harmonics have a large standard deviation and coefficient of variation, which depict the high dispersion of the measurement data and thus the complexity of current harmonic prediction.

Current Harmonics Forecasting with ANN
The most well-known approach for non-linear robust models is an ANN.ANNs are inspired by the function of the human brain, which uses an indefinite number of information-processing units called neurons.Every ANN consists of neurons which are organized in different numbers and types of layers.In this paper, a MLPNN that uses an input layer, a different number of hidden layers, and an output layer is used (Figure 10) [20].The statistical analysis of the 5th, 7th, 11th, and 13th current harmonics is given in Table 3.The statistical indices given in Table 3 show the distribution of the measured current harmonic amplitudes.It can be seen that the current harmonics have different ranges of values.For example, the 5th current harmonic has the biggest amplitude range, from 0.1354 A to 0.8489 A, while the 13th current harmonic has the lowest, from 0.0437 A to 0.2915 A. Furthermore, it can be seen that the observed current harmonics have a large standard deviation and coefficient of variation, which depict the high dispersion of the measurement data and thus the complexity of current harmonic prediction.

Current Harmonics Forecasting with ANN
The most well-known approach for non-linear robust models is an ANN.ANNs are inspired by the function of the human brain, which uses an indefinite number of information-processing units called neurons.Every ANN consists of neurons which are organized in different numbers and types of layers.In this paper, a MLPNN that uses an input layer, a different number of hidden layers, and an output layer is used (Figure 10) [20].A diagram of the neuron model that is used in the MLPNN is given in Figure 11, where x1, x2, …, xn are input values, wk1, wk2, …, wkn are synaptic weights, bk is a bias, and G(uk) is the activation function [20].The output value uk is defined as in Equation ( 3), while the output of the neuron yk is calculated as in Equation ( 4).
( ) The proposed ANN uses back-propagation for learning (training).Training or the learning of the ANN is a process in which free parameters of neurons (weights and biases) in hidden layers of the ANN are adjusted through each iteration of the learning process in order to make the ANN more knowledgeable about its environment.In this paper, a type of error correction learning algorithm was used for the ANN training [20].This learning algorithm adjusts the synaptic weights and biases of the neurons in order to minimize the error function [21].The learning algorithm was implemented through an optimizer, which minimizes the objective function, i.e., the error function.The ANN proposed in this paper uses the most commonly used error function for learning, the mean squared error (MSE), which given in Equation ( 5): where N is the number of samples, Ipred is the predicted value, and Imeas is the experimentally measured value.A diagram of the neuron model that is used in the MLPNN is given in Figure 11, where x 1 , x 2 , . . ., x n are input values, w k1 , w k2 , . . ., w kn are synaptic weights, b k is a bias, and G(u k ) is the activation function [20].The output value u k is defined as in Equation ( 3), while the output of the neuron y k is calculated as in Equation ( 4).A diagram of the neuron model that is used in the MLPNN is given in Figure 11, where x1, x2, …, xn are input values, wk1, wk2, …, wkn are synaptic weights, bk is a bias, and G(uk) is the activation function [20].The output value uk is defined as in Equation ( 3), while the output of the neuron yk is calculated as in Equation ( 4).The proposed ANN uses back-propagation for learning (training).Training or the learning of the ANN is a process in which free parameters of neurons (weights and biases) in hidden layers of the ANN are adjusted through each iteration of the learning process in order to make the ANN more knowledgeable about its environment.In this paper, a type of error correction learning algorithm was used for the ANN training [20].This learning algorithm adjusts the synaptic weights and biases of the neurons in order to minimize the error function [21].The learning algorithm was implemented through an optimizer, which minimizes the objective function, i.e., the error function.The ANN proposed in this paper uses the most commonly used error function for learning, the mean squared error (MSE), which given in Equation ( 5): where N is the number of samples, Ipred is the predicted value, and Imeas is the experimentally measured value.The proposed ANN uses back-propagation for learning (training).Training or the learning of the ANN is a process in which free parameters of neurons (weights and biases) in hidden layers of the ANN are adjusted through each iteration of the learning process in order to make the ANN more knowledgeable about its environment.In this paper, a type of error correction learning algorithm was used for the ANN training [20].This learning algorithm adjusts the synaptic weights and biases of the neurons in order to minimize the error function [21].The learning algorithm was implemented through an optimizer, which minimizes the objective function, i.e., the error function.The ANN proposed in this paper uses the most commonly used error function for learning, the mean squared error (MSE), which given in Equation ( 5): where N is the number of samples, I pred is the predicted value, and I meas is the experimentally measured value.
A very important step in the ANN set-up is data pre-processing, because it removes dimensional differences between the input data and increases ANN prediction accuracy [21].Because of this, the input data for the proposed ANN in this paper is pre-processed according to Equation (6), i.e., every input parameter has a value between 0 and 1: where y i is the i-th output value between 0 and 1, x i is the i-th input value of parameter, x min is the minimum input value of the parameter in a set, and x max is the maximum input value of the parameter in a set.
Because of this kind of pre-processing of input data (between 0 and 1), sigmoid activation function is used for every node in each hidden layer of the proposed ANN, because it transfers the input value into a value between 0 and 1 and has the best performance among the other activation functions (based on trial and error).The sigmoid activation function, also called the logistic activation function, is calculated as in Equation ( 7) and shown in Figure 12 [20]: where G(x) is the output of the sigmoid function and x is the input of the sigmoid function.A very important step in the ANN set-up is data pre-processing, because it removes dimensional differences between the input data and increases ANN prediction accuracy [21].Because of this, the input data for the proposed ANN in this paper is pre-processed according to Equation (6), i.e., every input parameter has a value between 0 and 1: where yi is the i-th output value between 0 and 1, xi is the i-th input value of parameter, xmin is the minimum input value of the parameter in a set, and xmax is the maximum input value of the parameter in a set.
Because of this kind of pre-processing of input data (between 0 and 1), sigmoid activation function is used for every node in each hidden layer of the proposed ANN, because it transfers the input value into a value between 0 and 1 and has the best performance among the other activation functions (based on trial and error).The sigmoid activation function, also called the logistic activation function, is calculated as in Equation ( 7) and shown in Figure 12 [20]: ( ) where G(x) is the output of the sigmoid function and x is the input of the sigmoid function.The most challenging problem when modeling an ANN is to determine the architecture, i.e., the optimal number of hidden layers, number of neurons in each layer, and the activation function of each layer.Furthermore,

an ANN can use different numbers of parameters for input variables (predictors) and a different type of optimizer for error function minimization (training).
There are many different types of optimizers, which perform differently depending on the task for which they are used.The determination of the best optimizer for current harmonic prediction was determined based on trial and error.The optimizer that best minimizes the error function was determined to be the best for this task.Furthermore, optimizers with default parameters were tested on the same ANN (1 hidden layer with 11 nodes, input parameter G, and sigmoid activation function).Figure 13 shows the MSE of the ANN training with different types of gradient descent optimizers over 100 epochs and with batch size of 8.An epoch is an iteration over all the training datasets (input and output).The batch size defines the number of samples that will be propagated through the neural network at once.The most challenging problem when modeling an ANN is to determine the architecture, i.e., the optimal number of hidden layers, number of neurons in each layer, and the activation function of each layer.Furthermore,

an ANN can use different numbers of parameters for input variables (predictors) and a different type of optimizer for error function minimization (training).
There are many different types of optimizers, which perform differently depending on the task for which they are used.The determination of the best optimizer for current harmonic prediction was determined based on trial and error.The optimizer that best minimizes the error function was determined to be the best for this task.Furthermore, optimizers with default parameters were tested on the same ANN (1 hidden layer with 11 nodes, input parameter G, and sigmoid activation function).Figure 13 shows the MSE of the ANN training with different types of gradient descent optimizers over 100 epochs and with batch size of 8.An epoch is an iteration over all the training datasets (input and output).The batch size defines the number of samples that will be propagated through the neural network at once. Figure 13 shows that Nadam is the best performing optimizer for current harmonic forecasting.Nadam is type of Adam optimizer that incorporates Nesterov momentum [22].Adam is a first-order gradient-based optimizer of stochastic objective function based on adaptive estimates of lower-order moments.Adam combines the advantages of two other types of stochastic gradient descent optimizers: Adagrad (adaptive gradient algorithm) [23] and RMSprop (root-mean-square propagation).

ANN Model Evaluation
ANN performance was evaluated with following statistical error metrics: the coefficient of correlation (R) given in Equation ( 8), Willmott index of agreement [24] (d) given in Equation ( 9), rootmean-square error (RMSE) given in Equation (10), and mean absolute error (MAE) given in Equation (11).The coefficient of correlation R evaluates the correlation between two parameters.In this case, a coefficient of correlation equal to 1 means that the predicted values of the current harmonic amplitudes are exactly the same as the measured ones for the same 10-min average value, i.e., the performance of the model is ideal.A coefficient of correlation R equal to 0 means that the prediction model is totally inaccurate.An analogy can be drawn for the Willmott index of agreement d.Indices RMSE and MAE are statistical error metrics, which also compare the accuracy of the predicted values of the current harmonic amplitudes with the measured ones for the same 10-min average value.The lower the RMSE and MAE, the better (more accurate) the prediction model.The RMSE and MAE of an ideally performing prediction model would be 0 A.  Figure 13 shows that Nadam is the best performing optimizer for current harmonic forecasting.Nadam is type of Adam optimizer that incorporates Nesterov momentum [22].Adam is a first-order gradient-based optimizer of stochastic objective function based on adaptive estimates of lower-order moments.Adam combines the advantages of two other types of stochastic gradient descent optimizers: Adagrad (adaptive gradient algorithm) [23] and RMSprop (root-mean-square propagation).

ANN Model Evaluation
ANN performance was evaluated with following statistical error metrics: the coefficient of correlation (R) given in Equation ( 8), Willmott index of agreement [24] (d) given in Equation ( 9), root-mean-square error (RMSE) given in Equation (10), and mean absolute error (MAE) given in Equation (11).The coefficient of correlation R evaluates the correlation between two parameters.In this case, a coefficient of correlation equal to 1 means that the predicted values of the current harmonic amplitudes are exactly the same as the measured ones for the same 10-min average value, i.e., the performance of the model is ideal.A coefficient of correlation R equal to 0 means that the prediction model is totally inaccurate.An analogy can be drawn for the Willmott index of agreement d.Indices RMSE and MAE are statistical error metrics, which also compare the accuracy of the predicted values of the current harmonic amplitudes with the measured ones for the same 10-min average value.The lower the RMSE and MAE, the better (more accurate) the prediction model.The RMSE and MAE of an ideally performing prediction model would be 0 A.
Energies 2019, 12, 790 where I is the sample number, N is the number of samples in a set, I meas,i is the experimentally measured value of sample I, I pred,i is the predicted value of sample i, I meas is the average of the experimentally measured values, and I pred is the average of predicted values.

Simulations, Results, and Discussion
The current harmonics of the PV plant presented in Section 2 were predicted using MLPNN models.The models were built with Keras library, which was run on top of TensorFlow in Python programming language [25,26].Every MLPNN model predicts the 5th, 7th, 11th, and 13th current harmonic; therefore, they have four output variables.A total of three versions of MLPNN were developed with the following input parameters: version 1 with only one input variable, i.e., solar irradiance (G); version 2 with two input variables, i.e., solar irradiance and ambient temperature (T amb ); and version 3 with three input variables, i.e., solar irradiance, ambient temperature, and time of the day (t).
Each version uses two MLPNN architectures: a version with one hidden layer and 11 nodes and a version with two hidden layers with 11 and five nodes per hidden layer, respectively.The two aforementioned architectures of the MLPNN were chosen as the best performing architectures, determined by trial and error simulations.
Thus, overall, we developed 6 different MLPNN models using the input parameters and architectures, which are described in Table 4.In Table 4, the MLPNN architecture is defined as follows: the first and last numbers represent number of input and output parameters, respectively, while the other numbers represent number of nodes in the hidden layer/s.It is important to emphasize that prediction of current harmonics was performed only for periods of daylight (when the PV plant was operating), i.e., nights were excluded in order to rule out the possibility of misconception of the output results of the model performance (night periods increase the model performance, because the current harmonics are constant and very predictable).The input variable of time of the day (t) is represented as value between 0 and 1, where 0 is the beginning of the day 00:00 and 1 is the end of the day 24:00, but because nights were excluded from the MLPNN training, this value is never 0 or 1.
Every model of MLPNN is trained over 100 epochs and with a batch size of 8 in order to achieve comparability of the results.The proposed models were executed on a PC equipped with a 64-bit operating system, i5-7200U 2.5 GHz processor, and 8 GB of DDR4 RAM memory.The training time of each MLPNN model was 350 s, while the prediction of the current harmonics lasted for 3 s, meaning that the total time of the simulation was 353 s.The computational time did not vary significantly for the different types of MLPNN models developed and evaluated in this paper.
The performance of the MLPNN models was compared with four statistical indices (R, d, RMSE, and MAE), as described in Section 4.1.Tables 5 and 6 show the performance of the MLPNN with one (G) and two (G and T amb ) input variables, respectively, while Table 7 shows the performance of the MLPNN with three input variables (G, T amb , and t).The performance results obtained for the six different versions of the MLPNN models given in Tables 5-7 show that MLPNN 6 with three input parameters (G, T amb , and t) and two hidden layers produced the best results considering the overall accuracy (all four current harmonics).If we observe the prediction accuracy of each current harmonic individually, MLPNN 3 demonstrated the best performance for the prediction of the 5th current harmonic.If we compare the results by the coefficient of correlation R (0.9381).MLPNN 1 had the best performance for the prediction of the 7th current harmonic (R = 0.971), while MLPNN 6 showed the best performance for the predictions of the 11th (R = 0.9469) and 13th (R = 0.8801) current harmonics.
The results show that the introduction of the third input to the MLPNN (time of the day) model resulted in slightly better performance (accuracy) of the model.Furthermore, regarding the number of hidden layers in the MLPNN, the results show that there is no general conclusion as to whether one or two hidden layers is better.For the 5th current harmonic prediction, it is clear that MLPNN 3 (one hidden layer) had the best R value (0.9381), while MLPNN 1 (one hidden layer) has the lowest R value (0.9356).If we observe the other current harmonic predictions (7th, 11th, and 13th), a similar conclusion can be drawn: there is no the superior number of hidden layers.A graphical interpretation of the overall results is given in Figure 14, where the coefficients of correlation R for the predictions of the 5th, 7th, 11th, and 13th current harmonics of every MLPNN model are shown.The coefficients of correlation evaluate the accuracy of the prediction of each current harmonic amplitude by comparing it to the measured value of the current harmonic amplitude for the same 10-min sample.
of hidden layers in the MLPNN, the results show that there is no general conclusion as to whether one or two hidden layers is better.For the 5th current harmonic prediction, it is clear that MLPNN 3 (one hidden layer) had the best R value (0.9381), while MLPNN 1 (one hidden layer) has the lowest R value (0.9356).If we observe the other current harmonic predictions (7th, 11th, and 13th), a similar conclusion can be drawn: there is no the superior number of hidden layers.A graphical interpretation of the overall results is given in Figure 14, where the coefficients of correlation R for the predictions of the 5th, 7th, 11th, and 13th current harmonics of every MLPNN model are shown.The coefficients of correlation evaluate the accuracy of the prediction of each current harmonic amplitude by comparing it to the measured value of the current harmonic amplitude for the same 10-min sample.Figure 15 shows the scatterplot between the measured and predicted current harmonics for MLPNN 6, which showed the best overall prediction accuracy of the current harmonic amplitudes.The plots represent the accuracy of MLPNN 6's prediction for each current harmonic (5th, 7th, 11th, and 13th).Each scatterplot compares the predicted values of the current harmonic amplitude with the measured ones.This means that the input parameters (solar irradiance, ambient temperature, and time of the day) used to generate the predicted values of the current harmonics with the MLPNN model are measured at the same time as the current harmonics, which are used to compare the performance of the model.Each point on the plots represent a 10-min average value of the predicted and measured current harmonic amplitudes.The ideal performance of the model would generate exactly the same amplitudes as the measured amplitudes of the compared current harmonics; thus, the points on the scatterplots would be located on the same line (R = 1) that starts in the origin of the coordinate system.The results given in Figure 15 show that MLPNN 6 demonstrates the best accuracy with respect to predicting the 7th current harmonic.It can also be seen that the model performs better in the area of lower amplitudes, while in the area of larger amplitudes of the current harmonics, the results are more dispersed.Regardless, the overall accuracy of the prediction model is very high.Figure 15 shows the scatterplot between the measured and predicted current harmonics for MLPNN 6, which showed the best overall prediction accuracy of the current harmonic amplitudes.The plots represent the accuracy of MLPNN 6's prediction for each current harmonic (5th, 7th, 11th, and 13th).Each scatterplot compares the predicted values of the current harmonic amplitude with the measured ones.This means that the input parameters (solar irradiance, ambient temperature, and time of the day) used to generate the predicted values of the current harmonics with the MLPNN model are measured at the same time as the current harmonics, which are used to compare the performance of the model.Each point on the plots represent a 10-min average value of the predicted and measured current harmonic amplitudes.The ideal performance of the model would generate exactly the same amplitudes as the measured amplitudes of the compared current harmonics; thus, the points on the scatterplots would be located on the same line (R = 1) that starts in the origin of the coordinate system.The results given in Figure 15 show that MLPNN 6 demonstrates the best accuracy with respect to predicting the 7th current harmonic.It can also be seen that the model performs better in the area of lower amplitudes, while in the area of larger amplitudes of the current harmonics, the results are more dispersed.Regardless, the overall accuracy of the prediction model is very high.Figures 16 and 17 show the scatterplot and time series plot of the measured and predicted THDI, respectively.Furthermore, Figures 16 and 17 show THDI only for daytime (nighttime is excluded, because the current harmonics were not predicted for that period of the day).The predicted THDI was only calculated with the predicted 5th, 7th, 11th, and 13th current harmonics, given by Equation (2), while the measured THDI was calculated from the measured 2nd to 40th current harmonics, given by Equation (1).The scatterplot given in Figure 16 represents the accuracy of MLPNN 6's prediction of THDI.It compares the THDI calculated with the predicted values of the 5th, 7th, 11th, and 13th current harmonics with the THDI calculated with the measured values from the 2nd to the 40th current harmonic.Each point on the plot represents the 10-min average value of the THDI calculated with the predicted current harmonic values and the THDI calculated with the measured ones.As is the case for Figure 15, the ideal performance of the model would generate exactly the same values of THDI, which would be located on the same line (R = 1) that starts in the origin of the coordinate system.It can be seen in Figure 16 that the model performs better in the area of the lower amplitudes of THDI, while in the area of the larger amplitudes of the current harmonics, the results are more dispersed.Regardless, the accuracy of the prediction model is very high, resulting in a coefficient of correlation R of 0.8827 and a Willmott index of agreement d equal to 0.8826.Figures 16 and 17 show the scatterplot and time series plot of the measured and predicted THDI, respectively.Furthermore, Figures 16 and 17 show THDI only for daytime (nighttime is excluded, because the current harmonics were not predicted for that period of the day).The predicted THDI was only calculated with the predicted 5th, 7th, 11th, and 13th current harmonics, given by Equation (2), while the measured THDI was calculated from the measured 2nd to 40th current harmonics, given by Equation (1).The scatterplot given in Figure 16 represents the accuracy of MLPNN 6's prediction of THDI.It compares the THDI calculated with the predicted values of the 5th, 7th, 11th, and 13th current harmonics with the THDI calculated with the measured values from the 2nd to the 40th current harmonic.Each point on the plot represents the 10-min average value of the THDI calculated with the predicted current harmonic values and the THDI calculated with the measured ones.As is the case for Figure 15, the ideal performance of the model would generate exactly the same values of THDI, which would be located on the same line (R = 1) that starts in the origin of the coordinate system.It can be seen in Figure 16 that the model performs better in the area of the lower amplitudes of THDI, while in the area of the larger amplitudes of the current harmonics, the results are more dispersed.Regardless, the accuracy of the prediction model is very high, resulting in a coefficient of correlation R of 0.8827 and a Willmott index of agreement d equal to 0.8826.

Conclusions
In this paper, a novel method for the prediction of current harmonics is presented.The proposed method uses MLPNN in order to predict the 5th, 7th, 11th and 13th current harmonics generated by a three-phase, grid-tie PV plant inverter.A total of six different models depending on the number of hidden layers and number of input parameters were trained and validated based on one-year worth of measurements (1 January-31 December 2018) of power quality and meteorological parameters.The power quality was measured at the point of common coupling of a 10-kWp PV plant with the distribution network, while the meteorological parameters (solar irradiance and ambient temperature) were measured at the test site.
The results of the MLPNN model prediction show that the introduction of the third input parameter (time of the day) into the models encouraged slightly better performance.Furthermore, there was no general conclusion as to whether one or two hidden layers in the MLPNN results in better performance.If the overall performance of the harmonic prediction is considered, then MLPNN 6 with three input parameters (solar irradiance, ambient temperature, and time of the day) and two hidden layers demonstrates the best accuracy.In case of individual current harmonic

Conclusions
In this paper, a novel method for the prediction of current harmonics is presented.The proposed method uses MLPNN in order to predict the 5th, 7th, 11th and 13th current harmonics generated by a three-phase, grid-tie PV plant inverter.A total of six different models depending on the number of hidden layers and number of input parameters were trained and validated based on one-year worth of measurements (1 January-31 December 2018) of power quality and meteorological parameters.The power quality was measured at the point of common coupling of a 10-kWp PV plant with the distribution network, while the meteorological parameters (solar irradiance and ambient temperature) were measured at the test site.
The results of the MLPNN model prediction show that the introduction of the third input parameter (time of the day) into the models encouraged slightly better performance.Furthermore, there was no general conclusion as to whether one or two hidden layers in the MLPNN results in better performance.If the overall performance of the harmonic prediction is considered, then MLPNN 6 with three input parameters (solar irradiance, ambient temperature, and time of the day) and two hidden layers demonstrates the best accuracy.In case of individual current harmonic

Conclusions
In this paper, a novel method for the prediction of current harmonics is presented.The proposed method uses MLPNN in order to predict the 5th, 7th, 11th and 13th current harmonics generated by a three-phase, grid-tie PV plant inverter.A total of six different models depending on the number of hidden layers and number of input parameters were trained and validated based on one-year worth of measurements (1 January-31 December 2018) of power quality and meteorological parameters.The power quality was measured at the point of common coupling of a 10-kWp PV plant with the distribution network, while the meteorological parameters (solar irradiance and ambient temperature) were measured at the test site.
The results of the MLPNN model prediction show that the introduction of the third input parameter (time of the day) into the models encouraged slightly better performance.Furthermore, there was no general conclusion as to whether one or two hidden layers in the MLPNN results in better performance.If the overall performance of the harmonic prediction is considered, then MLPNN 6 with three input parameters (solar irradiance, ambient temperature, and time of the day) and two hidden layers demonstrates the best accuracy.In case of individual current harmonic prediction accuracy, MLPNN 3 produces the best performance for the prediction of the 5th current harmonic if we compare the results of the coefficient of correlation R. MLPNN 1 showed the best performance for the predictions of the 7th current harmonic, while MLPNN 6 produced the best performance for the predictions of the 11th and 13th current harmonics.
Although the MLPNN models were trained by measurements obtained for a geographical region with a European, humid continental climate, they can be trained for regions with different climates.The models for current harmonic prediction proposed in this paper provide very good accuracy in general.Further research is planned in order to increase the prediction accuracy.We also plan to develop a prediction model for voltage harmonics generated by the injection of the current harmonics by the PV plants in a distribution grid.

Figure 1 .
Figure 1.Scheme of the 10-kWp PV plant and part of the data acquisition system used for the measurements.

Figure 1 .Figure 1 .
Figure 1.Scheme of the 10-kWp PV plant and part of the data acquisition system used for the measurements.

Figure 3 .
Figure 3. Daily mean values of the solar irradiation and ambient temperatures of 2018.

Figure 3 .
Figure 3. Daily mean values of the solar irradiation and ambient temperatures of 2018.

Figure 6 19 Figure 6 .
Figure6gives a comparison of the current harmonic spectrum for the 2 analyzed days (sunny and partially cloudy days).It is evident that the 2 compared days have similar patterns where the 5th, 7th, 11th, and 13th current harmonics are the highest.This behavior was described in Section 1.

Figure 6 .
Figure 6.The current harmonic spectrum on a partially cloudy day (15 April 2018) and a sunny day (21 August 2018).

Figure 7 .
Figure 7.The absolute THDI calculated from the 2nd to the 40th current harmonics and the absolute THDI calculated from 5th, 7th, 11th, and 13th current harmonic.

Figure 7 . 19 Figure 7 .
Figure 7.The absolute THDI calculated from the 2nd to the 40th current harmonics and the absolute THDI calculated from 5th, 7th, 11th, and 13th current harmonic.

Figure 13 .
Figure 13.The mean squared error (MSE) of the artificial neural network (ANN) training for different types of optimizers.

Figure 13 .
Figure 13.The mean squared error (MSE) of the artificial neural network (ANN) training for different types of optimizers.

Figure 14 .
Figure 14.Coefficients of correlation R of the predictions of the 5th, 7th, 11th, and 13th current harmonics of the MLPNN models.

Figure 14 .
Figure 14.Coefficients of correlation R of the predictions of the 5th, 7th, 11th, and 13th current harmonics of the MLPNN models.

Figure 15 .
Figure 15.Scatterplots of the measured and predicted current harmonics by the MLPNN 6 model.

Figure 15 .
Figure 15.Scatterplots of the measured and predicted current harmonics by the MLPNN 6 model.

Figure 16 .
Figure 16.Scatterplot of the measured and predicted THDI by the MLPNN 6 model.

Figure 17 .
Figure 17.Time series plot of the measured and predicted THDI by the MLPNN 6 model.

Figure 17 .
Figure 17.Time series plot of the measured and predicted THDI by the MLPNN 6 model.

Figure 17 .
Figure 17.Time series plot of the measured and predicted THDI by the MLPNN 6 model.

Table 2 .
Statistical parameters of the solar irradiance and ambient temperatures of 2018.

Table 2 .
Statistical parameters of the solar irradiance and ambient temperatures of 2018.

Table 4 .
Description of the MLPNN models.

Table 5 .
Performance of the MLPNN with one input variable (G).

Table 6 .
Performance of the MLPNN with two input variables (G and T amb ).

Table 7 .
Performance of the MLPNN with three input variables (G, T amb , and t).