Machine Learning in Operating of Low Voltage Future Grid

: The article is a continuation of the authors’ ongoing research related to power ﬂow and voltage control in LV grids. It outlines how the Distribution System Operator (DSO) can use Machine Learning (ML) technology in a future grid. Based on supervised learning, a Selectively Coherent Model of Converter System Control for an LV grid (SCM_CSC) is proposed. This represents a fresh, new approach to combining off and on-line computing for DSOs, in line with the decarbonisation process. The main kernel of the model is a neural network developed from the initial prediction results generated by regression analysis. For selected PV system operation scenarios, the LV grid of the future dynamically controls the power ﬂow using AC/DC converter circuits for Battery Energy Storage Systems (BESS). The objective function is to maintain the required voltage conditions for high PV generation in an LV grid line area and to minimise power ﬂows to the MV grid. Based on the training and validation data prepared for artiﬁcial neural networks (ANN), a Mean Absolute Percentage Error (MAPE) of 0.15% BESS and 0.51–0.55% BESS 1 and BESS 2 were achieved, which represents a prediction error level of 170–300 VA in the speciﬁcation of the BESS power control. The results are presented for the dynamic control of BESS 1 and BESS 2 using an ANN output and closed-loop PID control including a 2nd order ﬁlter. The research work represents a further step in the digital transformation of the energy sector.


Introduction
An increasing number of authors have published studies which suggest that there are beneficial applications for AC/DC converter systems connected to low voltage grids [1][2][3][4][5][6][7][8][9][10][11][12]. Power flow in an LV grid is controlled to suit the bidirectional nature of their operation. It should be noted that every LV grid is different, due to the number of consumers, its physical parameters, or the number of prosumers. However, a number of patterns are present that have a significant impact on the operation of LV grids, i.e., PV generation power factor (p.f.) and grid capacity [13][14][15][16][17][18][19][20][21].
Poland supports the European decarbonisation process. It currently faces the challenge of reconciling the growth of distributed power generation and its local consumption for sustainable development in the energy system. The use of AC/DC converter circuits in LV grids alone is insufficient for DSOs to achieve the objectives of grid control. The dynamics of the changes in LV grids, due to the load profile and the movement of the sun during the day, require active control of converter P and Q [22][23][24][25][26]. Grid support follow-up systems become insufficient, as they are an improvement to the power/voltage grid parameters at one selected connection point of the AC/DC system [27][28][29][30]. These types of systems work very well in closed microgrid-class systems. An LV grid requires a coherent perspective, with consideration of all its nodal points, especially those at the ends of the lines.
It should be stressed that the transformation of the energy sector will force a paradigm shift in the operation of LV grids. This concerns the operating boundary conditions for PV generation in particular. The objective function for DSOs will be to maximise local generation from the PV in favour of taking this power from the TSO nodes, the opposite of what current practice dictates [31][32][33]. This is due to the volatile prices of fuel, coal and gas, or the availability of hydrogen for central power and energy generation units in the electrical power system [34][35][36][37][38][39][40]. The costs of fuels, the switching of industries to electrical power and its flow from HV to LV will become increasingly expensive. DSOs will be forced to optimally and selectively manage power and energy at the generating sites.
A review of the literature on the subject suggests that there is currently no description of dynamic control for AC/DC converters in LV grids by application of simultaneous decentralised microcontrollers. As an alternative, the literature only indicates the use of BESS by the prosumer and the possibility of cooperation for the LV grid [41][42][43][44][45][46][47][48][49][50].

•
Dynamic management of power flows in the LV grid, with high levels of distributed power generation in prosumer installations. Most papers list the static or emergency operating states due to the objective function; • Application of ANN machine learning models in LV grids for control of AC/DC power converter systems-the research hypothesis presented in this paper; • Development of new processes for the management of DSO assets in Poland in connection with the increasing digital transformation. New models of operation for actuation and control devices under the operator's supervision; • Building an architecture for the logical aggregation of metering data from LV grids, e.g., Advance Metering Infrastructure class meters in offline and online modes.

Motivation
The motivation for the research was to discover the architecture for the AC/DC converter control and through which algorithms the DSO can achieve the intended objective, being dynamic control of power flows in the LV grid. This means achieving not only a limitation of the increase in voltage ratings at the PV connection points, but also the limitation of the power flows to the MV grid. The proposal was to use regression methods and neural networks (ANN) to predict the P + Q values of a converter system operated to improve the voltage performance of the LV grid.

Research Procedures
The object of analyses and research work was an actual LV grid (see description in Section 2.1). Power flow analyses were performed in terms of the changes in p.f. 0.95 − 1 , PV power (0 − 8 kW and load scenarios (see Table 1). The observations of voltage conditions were the datasets used for machine learning (see Table 2). The training, validation and test data X → R had a single PowerWord data source; however, they were not common sets as they were independent. MATLAB was used as the modelling environment for ANN machines and SIMULINK for the signal control dynamics.

Original Infrastructure-Research Environment
In practice, there were two models for DSO management for the on/off actuators or technical parameter control (see Figure 1). The first mode was "A", or centralised control. The master computing unit performed the parameterisation calculations for a defined condition and objective function. This required building an advanced computing unit, but the calculation results were close to the real ones. In this case, it was voltage optimization of the nN grid nodes for the values of P and Q [51][52][53][54][55][56][57] of the given converter in time window t. The second model, "B", was decentralised control, which dispersed the decision-making locally in the place where control was required directly. The local unit, a microcontroller, controlled the operation of the converter system in a simplified way, as it was unable to run advanced calculations by itself, as in the case of model A. It was possible to combine the two models as one hybrid. This enabled use of the best features of models A and B. The fixed parameters of the LV grid and its development will eventually be allocated centrally in a dedicated domain environment, while the optimal output set responses for the converter control function will be made local.
With these operational activities and assumed logic of operation, a change was required in the processes relevant to the management of the DSO assets in the LV and MV grids [58][59][60][61]. The LV grid mapped in GIS class systems had to have functionalities which enabled analysis of the power flows with distributed power generation. The purpose of the new functionalities was to collect training data for the building of machines learning local control as a function of the adopted objective. The hybrid operation system for the two possible locations of BESS in the LV grid is shown in Figure 2.
The LV grid model was adopted from the authors' publication [62], which involved a grid studied for power flows using the PowerWorld environment (the test object). The power generation capacity for a system of PV modules installed by the prosumers changed dynamically with the movement of the sun on a given day of the year. During this work, it was assumed that the day would be 22 June for the geographical location of the LV grid specified below: Latitude: 52.10.04, Longitude: 22.16.17 UTC + 1. A mathematical model of the transition from the PV physical quantities (P gN ) to the actual value P gc (t) is shown in Figure 3.
Where:  PV systems in Poland have typically been installed facing south, allowing the maximum generation capacity to be achieved with θ = 90 • . The solar motion (see Figure 3) made the operation of the test object dynamic, due to the change in P gc (t). As the power flow changed, consequently, the voltage conditions of the test object increased. The determinants for the overrun of temporal voltage conditions, U n < 1.1 p.u., for the connection points were: P gc , load and power factor (see Table 1). The data were obtained with the assumption of zero cloud cover and full operational performance for all PVs within the test object. The calculation error compared to the actual data for the tested day could be affected by the ambient temperature, reducing the nominal capacity of the PV panels.
The time-stamped measurement data from the test object had to be transmitted to the BESS controller from the overvoltage overruns according to a 10-min average (see EN-50549-1). This means that a communication line had to be set up with AC/DC PV converter systems for RMS U n measurement towards the BESS controller. To develop the boundary conditions, the authors assumed 10-min measurement sequences of the test object for time window t of the BESS control (see Table 1).
A review of the scientific literature suggested that On-Load Tap Changer (OLTC) operation had a direct effect on the variation in the RMS voltage value of an LV grid that was highly penetrated by PVs [63][64][65][66][67]. To confirm this, simulations were carried out on the test object. For this purpose, the feasibility of OLTC control was applied with TAP = 2.5% in the ∆U p.u. change from the voltage rating, resulting from the transformer ratio (MV/LV transformer primary voltage rating). The change in voltage ratio was simulated in the PowerWord environment at the TAP:2 upward (5% U n ) and TAP:3 upward (7.5% U n ) positions. Two main scenarios were adopted for the analysis of power flow in the test object: SF and R (see Table 1). The power generation capacity P gc was 8, 9 and 10 kW per consumer. Figures 4-7 show the RMS p.u. voltage waveforms independently for the two branches (Feeder 1: 13 connection points, Feeder 2: 10 connection points).    Figure 4: Note the evident improvement in U n values with TAP-3, even with considerable values of P gc = 10 kW.

Analysis of
Analysis of Figure 5: Note that for Feeder 1, TAP-3 reduced the overrun of 1.1 U n to 9 kW. For Feeder 2, there was a reduction at P gc = 8 kW.
Analysis of Figure 6: Note the evident improvement in U n values with TAP-3, even with considerable values of P gc .
Analysis of Figure 7: Note that for Feeder 1, TAP-3 improved U n only at 8 kW and 9 kW per connection point. For Feeder 2, only TAP-3 provided an improvement, yet only up to a power of P gc = 8 kW.

Research Methodology
The Selectively Coherent Model of Converter System Control for LV grid-SCM_CSC, shown in Figure 8, was proposed for the construction of a logic topology for a microcontroller to implement dynamic control of the power flow in an LV grid using an AC/DC power converter system(s) [62]. The model consisted of three instances of operation, presented in three sequential blocks. Optimal AC Power Flow for a 3-phase LV grid: Building a database for machine learning using a genetic algorithm, for example [68][69][70][71][72][73][74][75][76]; The final product of the instance was the P + Q values for the BESS (Battery Energy Storage System), which was optimal given the type, load, p.f., Pgc and the LV grid power flow. Block B1: Artificial Neural Network: Using the FNN BP [77][78][79][80][81] to build a class ML machine [82][83][84][85][86][87]; The final product of the instance was a tested neural network according to defined predictors; Preparation of the ML for verification on a dataset without a BESS. Block B2: Power Flow dataset of the LV grid without a BESS or any optimisation applied. Block C: ML output: The system response to the B2 data; Comparison of MAPE B1 and B2 results.).
The first two instances of the SCM_CSC model had to be made offline and were used to prepare the target control for the third instance. The final instance ran online through a GPU microcontroller-type actuator [88][89][90][91]. The SCM_CSC model was based on Machine Learning (ML) technology by collecting predictors according to a predefined classification and the expected response for the control system. SCM_CSC Block A-this required offline preparation of two categories of measurement data from the grid system (training data and testing data). The training data were a matrix which represented the prediction data (predictors) with the optimal P + Q selection for the BESS in the hybrid operation system (see Figure 2a,b). The matrix was built based on pre-developed scenarios of the test object operation considering p.f. 0.95 − 1 , apparent power S for PV (0 − 8 kVA, increment 0.25 kW and the load characteristics on the prosumer side (load-SF/R) [62].
The preparation of the training data for the tests included the selection of the data characteristics and their regularities between each other. Principal Component Analysis (PCA) was used for this purpose [92][93][94][95][96]. The extract of the analysis gave the identified clusters of converging characteristics and their common hierarchical relationship to the BESS, p.f. P gc .
The analysis showed an existing data linkage between each other, as the future predictors (see Figures 9 and 10). The control variables for the data model (p.f. and P gc ) interacted differently through the hierarchy with the different nodes in the feeders. Furthermore, future prediction would have to learn these relationships in order to recognise them correctly. The datasets presented were systems of non-linear functions. Due to the number of input parameters (16)(17)(18)(19)(20)(21)(22)(23)(24)(25)(26) of the predictors, a mathematical description in the form of a polynomial up to the 26th order would be difficult. The ability to control a system through equations of state with this number of variables would be infeasible. To assess the quality of prediction by the future machines and their application, Figures 11 and 12 show the training data distribution separately for BESS and BESS 2. The granularity of the data collected for training had a direct impact on the quality of the control as well as on the distribution of the AC OPF results. The empty spaces between the data in Figures 11 and 12 would hinder correct machine predictions. Despite the limitations, continuity and predictive validity could be demonstrated. The reason for this work was that the application of machine learning to LV grid data ( Table 2) would enable dynamic control of BESS.

Results
For analytical purposes, regression-based mathematical models (mdl) were used to verify and compare the validity of machine learning. Measures for the learning quality of a machine were MAPE and MSE [97][98][99][100][101]:

Regression Models-Data Training
Three groups of regression-based machines were built for the development of the SCM_CSC product 2. This was because three independent microcontrollers were used, working for the two potential operation systems of the LV grid. One microcontroller was used for BESS at an MV/LV substation and two independent microcontrollers for BESS 1 and BESS 2.

First LV Grid Operation System with BESS
The objective for mdl was to predict the P + Q values for control under BESS in order maintain the voltage condition value. See Table 3 for the results of the mdl machine calculations. A model based on Gaussian fitting and squared exponential kernel with a separate length scale per predictor (kernel) achieved the best MAPE results. For the MAPE values (Tables 3-5), no uncertainly error was calculated, because DATA TRAINING was obtained only through simulation and not a physical measurement [62]. Table 3. Computational results for mdl in the operation system of the test object with a single BESS.

Regression Model MAPE [%]
Gaussian  The Gaussian Processes Model is a regression algorithm with probability distribution P according to the following notation: where: x i ∈ R d -training data, y-response variable, σ 2 -error variance, β-coefficient estimated from data x, f (x i )-latent variables i = 1, 2, . . . , n, h-explicit basis functions. The mdl machine learning results were obtained by dividing the training data into: mdl teaching data for 80% of the population (actual); mdl validation data for 20% of the population (predicted).
The distribution of the data for the BESS control values did not take a linear value, as shown in Figure 13

Second LV Grid Operation System with BESS 1 and BESS 2
In the second operation system of the test object, there were two independent mdls for BESS 1 and BESS 2. The training data had fewer predictors: 16 for BESS 1 and 13 for BESS 2. The results obtained for BESS 1 are given in Table 4 and those for BESS 2 are given in Table 5. Again, the Gaussian Processes Model mdl achieved the best MAPE results for BESS 1 with the kernel function and for BESS 2 without this function.
The MAPE for BESS 1 at 0.7423% (see Figure 14) and a maximum 33.5 kVA operating level gave a prediction error of about 0.25 kVA. For BESS 2, the MAPE achieved was 0.6012% (see Figure 15), for a maximum of 37.5 kVA with an error of approximately 0.22 kVA.

Neural Networks-Data Training
A feedforward neural network was used to map the input-output data with forward coupling. A description of the FNN algorithm is shown in Figure 16. Two algorithms for machine training by FNN were then applied. The procedure for calculating the cost function, J, was implemented in a different way. The first algorithm was applied to the operation system of the test object with a single BESS, the second algorithm to the two independent BESSs. Difficulties were found in machine learning with fewer predictors due to the control of a different part of the LV grid, where the number of connection points was different and lower than in the case with a single BESS. The first method used for function optimization was the Levenberg-Marquardt algorithm, with the following notation: where: x i ∈ R d -training data λ-attenuation factor The second was the Bayesian regularization backpropagation algorithm, with the following notation: where: w l ij -weight for perceptron j in layer l for incoming node i, b l i -bias for perception i in layer l, z l i -neuron value for perception i in layer l.

First LV Grid Operation System with BESS
A MAPE of 0.15% (see Figure 17) with a maximum BESS of 200 kVA in this system gave a control underestimation of approximately 0.3 kVA.

Second LV Grid Operation System with BESS 1 and BESS 2
The MAPE for BESS 1 at 0.5105% (see Figure 18) and a maximum 33.5 kVA operating level gave a prediction error of about 0.17 kVA. For BESS 2, the MAPE achieved was 0.5557% (see Figure 19), for a maximum of 37.5 kVA with an error of approximately 0.2 kVA. The results obtained cause optimism, as they indicated the applicability of ANN for P + Q prediction for BESS. Figure 19. FNN machine learning results for BESS 2.

Neural Networks-Data Testing
Data testing was developed to verify correct operation of the FNN machine models and to develop the final control results for BESS. This is a set of flow data from U n overruns for individual nodes of the test object without BESS control, as corrections to the operation of the LV grid (SCM_CSC Block B2). The dynamics of the P gc changes are described in Section 2 of the paper-see Figure 3. The control scenarios for BESS are shown in Table 1. This represents the implementation of the tasks of Block C for SCM_CSC, where actual values were provided as a data testing set in order for BESS to respond dynamically to changes in the nN grid. Figure 20 presents the operation system for the FNN BackPropagation (FNN BP) machine. x1-input, data testing; y1-output, FNN response signal; PID-signal controller from FNN. For the tests in the SIMULINK environment, the dynamics used for a change in P (kW) were evaluated on the time axis in seconds from the data described in Section 2 of the paper. The flow data were counted sequentially with a 10-min change in P gc during the movement of the sun.
The control of BESS and BESS 2 is shown in seconds. This approach made it possible to observe the entire control period and to assess the stability of the control loop (PID with a 2nd order filter).

LV Grid Operation System with BESS
The signal control results for BESS are presented for the four scenarios shown in Table 1. Figure 21 shows the stability of signal control from the FNN machine for the test data. The proposed control system mitigated the stepped nature of the machine. Figure 22 shows the comparison of predictions to the training data. This example of control discontinuity was caused by underestimation in the prediction by the machine. This was because there was insufficient training data in the P gc area, ranging from 7.75 to 8 kW-see Figure 11, area A1. With the test object operation at p.f. = 1, there remained a narrow control band for BESS and thus a small volume of training data. However, the machine sought to approximate the control.   Figure 23 shows stable control. The comparison of the predictions for the training data in Figure 24 revealed the correct prediction. The machine followed the logic of the training data, with a larger data range from 6 to 8 kW.   Figure 25 shows the operation of the machine with the starting point for the BESS returning power to the LV grid. The controller reacted in a stable manner to the signal from the machine. Figure 26 shows a correct prediction with slight underestimation in the range from 7.5 to 7.75 kW-see also Figure 11, area A2. Similar to Figure 22, there were no training data and the machine shifted the prediction to the nearest data present.  The too-wide control range for 0.25 kW grain introduced underestimations in the results. There was no control undershoot in the range from 4.5 to 6 kW. Despite this, the signal control was stable over the full control range (see Figures 27 and 28).

LV Grid Operation System with BESS 2
According to Figure 2, the second operation system was BESS 1, regulating operation for feeder 1 and BESS 2, regulating operation for feeder 2. This paper presents only the signal control results for BESS 2 and the four scenarios listed in Table 1. It was deemed more difficult for the machine to control BESS 2 as the operating conditions were close to 1.1 U n p.u. (RMS 253 VAC). To illustrate the problem, Figure 29 shows the distribution of the optimal value of the U n p.u. predictors for individual connection points and under different load type scenarios (SF, R, etc.) and p.f. values. BESS 2 was controlled by an ANN machine built on three hidden layers, see Figure 19.  Figure 30 presents the stability of signal control from the FNN machine for the test data, with a control period of 6 s. The machine behaved identically for BESS 2 to the case with BESS-see Figure 22. The limitation was the volume of data for optimising feeder 2 operation at p.f. = 1 (see Figure 12, area A4). Nevertheless, the machine was able to regressively follow the control trend, which confirmed its application was correct (see Figure 31).     Figure 34 shows the stability of the signal control from the FNN for the test data. The proposed control system mitigated the stepped nature of the FNN. Figure 35 compares the predictions in the training data. Control discontinuity was evident, caused by underestimation of the FNN prediction. This was due to the insufficient training data in the P gc area, ranging from 7.75 to 8 kW-see Figure 12, area A5.   Figure 36 presents the stability of signal control for the FNN over the test data. It followed the test data, meaning correct prediction of the system (see Figure 37).

Discussion
The solution proposed here features new technical requirements for future LV grids. For the SCM_CSC to function correctly, synchronous RMS voltage measurement at the nodal points is essential. A common clock is required to read the voltage RMS value. For real systems, observation of the LV grid and acquisition of load profiles representative of the LV grid part is required. The application of the SCM_CSC model will require-for Block A-to collect data at a smaller grain size than 0.25 kW to fully characterise the control.
There are technologically less expensive solutions to control the voltage in the LV grid, such as by using OLTCH (on-load tap changers) together with an upgrade to the LV grid to 50-70 mm 2 wiring. However, this requires the use of STATCOM for reactive power management to maintain a power factor of 1 (see Figures 4-7). Unfortunately, the solution has limitations in PV production of about 8 kW per prosumer-type A RfG NC [102]. Furthermore, such a solution will not facilitate power balancing at the MV/LV substation, the power being sent to a section of the MV network. A summary of the functionality of the available technologies is shown in Table 6.

Conclusions
The collected simulation data clearly indicate that the power factor for PV generation and the movement of the sun directly affect the overrun times in the LV grid (see Table 1). The larger the p.f. value (closer to 1) and the higher the instantaneous load value (the load profile-e.g., SF), the shorter the U N p.u. overrun time in the LV grid operation. The analysis of the training and validation data used for machine learning shows that the data became clustered (see Figures 9 and 10). This makes 'room' for application of these correlations in LV grid control. These data indicate that the use of class ANN FNN and FNN BP machines has great potential for BESS control (see . The adopted hypothesis (see Research Gap) was confirmed by the results obtained (see  and in terms of dynamic control of BESS (see . Moreover, the work indicates that the correct approach is for DSOs to seek solutions for balancing locally generated electricity, rather than restricting it. This would improve the energy efficiency and the grid loss parameters by reducing the upstream transfers needed. Voltage overruns at the connection point, with more than 1.1 p.f. (253 VAC) on the source side, according to PN-EN 50438:2014-02, trip the automatic disconnect system. A static AC/DC inverter then ceases to perform the inverter functionality towards the LV grid. This solution reduces the voltage spikes in the LV grid and improves the PV productivity, as there are no electricity generation interruptions.
The work presented here opens a new avenue for the application of ML in the power grids of the future. It represents a fresh approach to DSO management and implements the Network Code on Demand Side Flexibility [32][33][34]. Consequently, further work by the authors will focus on the application of deep learning with significantly increased volumes of data for machine learning.