## 3 A Technique for Prediction of Branch Power Consumption Change  
To determine the PCC of distribution grid \(dP_{n}\) a two steps approach is applied. First, in the reference conditions when sum and smart meter readings are trusted to be within their accuracy class limits, the so-called training phase is performed. Assuming the equivalent DG branch schematic as shown in Figure 4, the equivalent resistance \(R_{eq}\) is estimated and a data-driven model for \(dP_{nL}\) prediction using consumer meter readings is derived (see also (2)). \(P_{eqm}\) aims to model the total of all loads connected in the DG branch (\(P_{Li}\), \(i=\overline{1,6}\) in Figure 1). \(dP_{nL}\) denotes PCC of \(P_{eqm}\) after a consumer power event. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Dataset Case** & **Training Data Set** & **Testing Data Set** \\ \hline T1 & \begin{tabular}{c} 500 samples/50\% (odd samples, sample numbers \\ 2n - 1, n is integer number from 1 to \(N/2\)) \\ \end{tabular} & \begin{tabular}{c} 500 samples/50\% (even samples, sample numbers 2n, \(n\) is integer number from 1 to N/2) \\ \end{tabular} \\ \hline T2 & \begin{tabular}{c} 500 samples/50\% (odd samples) \\ \end{tabular} & \begin{tabular}{c} 250 samples/25\% (sample numbers 4n, n integer number from 1 to \(N/4\)) \\ \end{tabular} \\ \hline T3 & \
\begin{tabular}{c} 500 samples/50\% (odd samples) \\ \end{tabular} &
\begin{tabular}{c} 125 samples/12.5\% (sample numbers 8n, \(n\) integer number from 1 to \(N/8\)) \\ \end{tabular} \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Cases of training and testing synthesized datasets (total number of samples and percentage of the full dataset). Second, in a testing (or monitoring) phase, \(dP_{n}\) is estimated using average \(R_{eq}\) and \(dP_{nL}\) prediction model. These two procedures are described in detail below. In the training phase using training dataset, estimates of \(R_{eq}\) and \(dP_{nL}\) are determined:  
1. The equivalent resistance \(R_{eq}\) is calculated according to expression \[R_{eq}=\frac{dV_{c}-dV_{s}}{dI_{s}},\] (18) where \(\mathrm{d}V_{s}=V_{s2}-V_{s1}\) represents voltage change, and \(\mathrm{d}I_{s}=I_{s2}-I_{s1}\) denotes the current change measured by the sum meter. Similarly, \(\mathrm{d}V_{c}=V_{c2}-V_{c1}\) corresponds to the voltage change measured by the consumer's meter. After processing a set of consumer load changes, the mean value \(\overline{R_{eq}}\) is calculated. 2. A data-driven linear regression model for predicting \(dP_{nL}\) \[d\hat{P}_{nL}=\mathrm{f}(V_{c2},V_{c1},P_{c2},\ P_{c1})\] (19) is built using stepwise regression (Matlab stewiselm training function) with the target attribute obtained from training data using equation \[dP_{nL}=dP_{s}-dP_{c}-dP_{w}=(P_{s2}-P_{s1})-(P_{c2}-P_{c1})-\frac{(V_{s2}-V_{ c2})^{2}-(V_{s1}-V_{c1})^{2}}{\overline{R_{eq}}},\] (20) and predictor variables including voltage and active power after and before the power event \(V_{c2}\), \(V_{c1}\), \(P_{c2}\), \(P_{c1}\) and their following multiplications \(V_{c2}\):\(V_{c1}\), \(V_{c2}\):\(P_{c2}\), \(V_{c2}\):\(P_{c1}\), \(V_{c1}\):\(P_{c2}\), and \(V_{c1}\):\(P_{c1}\) that were selected by the training function as the most relevant predictors. The set of predictors (input features) was determined using the dataset synthesized T1 (see Table 5) and M3 (see Table 4) cases and afterwards was maintained fixed for other examined training datasets. The model (19) exhibited a coefficient of determination (R-squared) equal to 0.989. This way we attempt to avoid variations of model's structure dependent on training data, because we do not have any evidence or expectation that underlying phenomena are influencing relationships between physical quantities somehow differ when synthesizing different data sets using the same equivalent circuit. No other non-default settings were chosen for the regression model training. In the testing (or monitoring) phase, smart meter current, voltage, and power gain errors can appear, and they influence \(dP_{n}\) estimation error.