# Estimation of Frequency-Dependent Impedances in Power Grids by Deep LSTM Autoencoder and Random Forest

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

- Use of an unsupervised deep learning architecture, LSTM autoencoder, for automatic extraction of sequences of features from dynamic power grid data;
- Employing a nonlinear regressor, random forest, to estimate frequency-dependent impedances in addition to fundamental frequency;
- Providing estimation during grid disturbances as electrical faults, despite training being conducted in steady-state condition.

## 2. Proposed Method

- (1)
- An LSTM-AE architecture [15] for unsupervised automatic learning of time-dependent feature sequences form dynamic power grid data (e.g., symmetrical components of three-phase voltage and current data);
- (2)
- A non-linear RF regression method for estimation frequency-dependent grid impedance. The RF regressor takes the features extracted by the LSTM-AE module as an input and derives a nonlinear map function between input feature and values of grid impedance in a wide range of frequencies.

#### 2.1. Measurement Data

#### 2.2. Feature Extraction from Data Sequences by LSTM-AE

#### 2.3. Frequency-Dependent Grid Impedance Estimation Using RF Regressor

## 3. Simulations and Results

#### 3.1. System under Investigation

#### 3.2. Datasets

#### 3.3. Hyperparameters

#### 3.4. Results and Performance Evaluation

#### 3.4.1. Training and Validation of LSTM-AE Network

#### 3.4.2. Training and Validation of LSTM-AE Network

**(1)****Case study 1: performance of the proposed scheme**

**(2)****Case study 2: performance of the proposed scheme**

**(3)****Case study 3: performance using extracted features**

**(4)****Case study 4: performance using only local data**

**(5)****Case study 5: comparison with wide-band signal injection method**

#### 3.5. Discussion

- LSTM-AE model for automatic feature extraction: The results show that the LSTM-AE is an effective method for extracting sequential features of time series and consequently improves the RF regression estimation for time-series data.
- Data from remote locations: The results in case study 3 showed that adding measurements at remote nodes ensures the estimation during large disturbances even the RF model is trained on steady-state data. However, the main challenges for remote measurement are: (1) the latency due to data communication from remote nodes to the local area; (2) considering the related cost, it is not possible to conduct measurement at all nodes of the power grid; (3) the number and the location of best nodes for remote measuring are unknown.
- Time-delay in measurement data: The time-delay in measurement data was ignored in this study, assuming that the measurement was conducted under 5G internet protocols, which introduce the ultra-reliable low-latency communication (URLLC) system that guarantees reliability of 99.999% and latency of less than 1 ms [27].

## 4. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## Abbreviations

DFT | Discrete Fourier transform |

LSTM-AE | Long short-term memory autoencoder |

MSE | Mean square error |

PRBS | Pseudorandom binary signal |

RF | Random forest |

ReLU | Rectified linear unit |

RNN | Recursive neural network |

SVM | Support vector machine |

URLLC | Ultra-reliable low-latency communication |

## References

- Harnefors, L.; Bongiorno, M.; Lundberg, S. Input-admittance calculation and shaping for controlled voltage-source converters. IEEE Trans. Ind. Electron.
**2007**, 54, 3323–3334. [Google Scholar] [CrossRef] - Xu, J.; Xie, S.; Qian, Q.; Zhang, B. Adaptive feedforward algorithm without grid impedance estimation for inverters to suppress grid current instabilities and harmonics due to grid impedance and grid voltage distortion. IEEE Trans. Ind. Electron.
**2017**, 64, 7574–7586. [Google Scholar] [CrossRef] - Cobreces, S.; Bueno, E.J.; Pizarro, D.; Rodriguez, F.J.; Huerta, F. Grid impedance monitoring system for distributed power generation electronic interfaces. IEEE Trans. Instrum. Meas.
**2009**, 58, 3112–3121. [Google Scholar] [CrossRef] - Roinila, T.; Vilkko, M.; Sun, J. Broadband methods for online grid impedance measurement. In Proceedings of the 2013 IEEE Energy Conversion Congress and Exposition, Denver, CO, USA, 15–19 September 2013; pp. 3003–3010. [Google Scholar]
- Sanchez, S.; Molinas, M. Large signal stability analysis at the common coupling point of a DC microgrid: A grid impedance estimation approach based on a recursive method. IEEE Trans. Energy Convers.
**2014**, 30, 122–131. [Google Scholar] [CrossRef] - Hoffmann, N.; Fuchs, F.W. Minimal invasive equivalent grid impedance estimation in inductive–resistive power networks using extended Kalman filter. IEEE Trans. Power Electron.
**2013**, 29, 631–641. [Google Scholar] [CrossRef] - Alves, D.K.; Ribeiro, R.L.; Costa, F.B.; Rocha TO, A. Real-time wavelet-based grid impedance estimation method. IEEE Trans. Ind. Electron.
**2018**, 66, 8263–8265. [Google Scholar] [CrossRef] - Asiminoaei, L.; Teodorescu, R.; Blaabjerg, F.; Borup, U. Implementation and test of an online embedded grid impedance estimation technique for PV inverters. IEEE Trans. Ind. Electron.
**2005**, 52, 1136–1144. [Google Scholar] [CrossRef] - Ghanem, A.; Rashed, M.; Sumner, M.; Elsayes, M.A.; Mansy, I.I. Grid impedance estimation for islanding detection and adaptive control of converters. IET Power Electron.
**2017**, 10, 1279–1288. [Google Scholar] [CrossRef] - Asiminoaei, L.; Teodorescu, R.; Blaabjerg, F.; Borup, U. A digital controlled PV-inverter with grid impedance estimation for ENS detection. IEEE Trans. Power Electron.
**2005**, 20, 1480–1490. [Google Scholar] [CrossRef] - Liserre, M.; Blaabjerg, F.; Teodorescu, R. Grid impedance estimation via excitation of LCL -filter resonance. IEEE Trans. Ind. Appl.
**2007**, 43, 1401–1407. [Google Scholar] [CrossRef] - Givaki, K.; Seyedzadeh, S. Machine learning based impedance estimation in power system. In Proceedings of the 8th Renewable Power Generation Conference (RPG 2019), Shanghai, China, 24–25 October 2019. [Google Scholar]
- Céspedes, M.; Sun, J. Online grid impedance identification for adaptive control of grid-connected inverters. In Proceedings of the 2012 IEEE Energy Conversion Congress and Exposition (ECCE), Raleigh, NC, USA, 15–20 September 2012; pp. 914–921. [Google Scholar]
- Mohammed, N.; Ciobotaru, M.; Town, G. Online parametric estimation of grid impedance under unbalanced grid conditions. Energies
**2019**, 12, 4752. [Google Scholar] [CrossRef] [Green Version] - Gensler, A.; Henze, J.; Sick, B.; Raabe, N. Deep Learning for solar power forecasting—An approach using AutoEncoder and LSTM Neural Networks. In Proceedings of the 2016 IEEE International Conference on Systems, Man, and Cybernetics (SMC), Budapest, Hungary, 9–12 October 2016; pp. 002858–002865. [Google Scholar]
- Policardi, F. MLS and Sine-Sweep measurements. Università di Bologna. Ital. Elektroteh. Vestn.
**2011**, 78, 91–95. [Google Scholar] - Srivastava, N.; Mansimov, E.; Salakhudinov, R. Unsupervised learning of video representations using lstms. In Proceedings of the International Conference on Machine Learning, Lille, France, 6–11 July 2015; pp. 843–852. [Google Scholar]
- Sagheer, A.; Kotb, M. Unsupervised pre-training of a deep LSTM-based stacked autoencoder for multivariate time series forecasting problems. Sci. Rep.
**2019**, 9, 1–16. [Google Scholar] [CrossRef] [Green Version] - Ge, C.; de Oliveira, R.A.; Gu IY, H.; Bollen, M.H. Deep Feature Clustering for Seeking Patterns in Daily Harmonic Variations. IEEE Trans. Instrum. Meas.
**2020**, 70, 1–10. [Google Scholar] [CrossRef] - Statnikov, A.; Wang, L.; Aliferis, C.F. A comprehensive comparison of random forests and support vector machines for microarray-based cancer classification. BMC Bioinform.
**2008**, 9, 1–10. [Google Scholar] [CrossRef] [Green Version] - Breiman, L. Random forests. Mach. Learn.
**2001**, 45, 5–32. [Google Scholar] [CrossRef] [Green Version] - Liaw, A.; Wiener, M. Classification and regression by random Forest. R News
**2002**, 2, 18–22. [Google Scholar] - Nowozin, S. Improved information gain estimates for decision tree induction. arXiv
**2012**, arXiv:1206.4620v1. [Google Scholar] - Bagheri, A.; Gu, I.Y.; Bollen, M.H.; Balouji, E. A robust transform-domain deep convolutional network for voltage dip classification. IEEE Trans. Power Deliv.
**2018**, 33, 2794–2802. [Google Scholar] [CrossRef] - Barker, H.A. Primitive maximum-length sequences and pseudo-random signals. Trans. Inst. Meas. Control.
**2004**, 26, 339–348. [Google Scholar] [CrossRef] - Gajić, Z.; Aganović, S. Advanced Tapchanger Control to Counteract Power System Voltage Instability 2006. Available online: https://library.e.abb.com/public/9acc3c82f0230659c125766900481ca1/1MRG001019_en_Advanced_Tapchanger_Control_To_Counteract_Power_System_Voltage_Instability.pdf (accessed on 22 May 2021).
- Sachs, J.; Wikstrom, G.; Dudda, T.; Baldemair, R.; Kittichokechai, K. 5G radio network design for ultra-reliable low-latency communication. IEEE Netw.
**2018**, 32, 24–31. [Google Scholar] [CrossRef]

**Figure 1.**The overall schematic of the proposed method: power grid (red dashed line box), the deep-learning-based nonlinear estimator (blue dashed line box).

**Figure 2.**The proposed LSTM autoencoder; (

**a**) the overall architecture of LSTM-AE (input layer + 1 LSTM-AE layer); (

**b**) 10 concatenated sequences of time-dependent features extracted for 1 cycle data; (

**c**) the LSTM-AE architecture during the training process.

**Figure 3.**Decision trees of RF regressor, obtained from the training process of the proposed scheme.

**Figure 4.**Performance from the training and validation in the proposed LSTM-AE; (

**left**) loss versus epochs, (

**right**) accuracy versus epochs.

**Figure 5.**The result of estimating the fundamental (50 Hz) grid impedance magnitude at node B1, due to step change in Load 1, compared with true impedance (True Imp.).

**Figure 6.**The result of estimating the frequency-dependent grid impedance at node B1 compared with true impedance (True Imp.) obtained by sine sweep; (

**a**) three-phase fault is located at F1, impedance magnitudes (

**top**), phase angles (

**bottom**); (

**b**) three-phase fault located at F2, impedance magnitudes (

**top**), phase angles (

**bottom**).

**Figure 7.**Case study 5: The result of estimating the frequency-dependent grid impedance magnitude (

**top**) and angle (

**bottom**) at node B1, at steady-state condition, using the proposed method and PRBS injection method; (

**b**) voltage signals were measured at node B1, and the PRBS magnitude was 0.01 pu, (

**a**) voltage signals were measured at the point between the filter’s RL and RC networks, and the PRBS magnitude was 0.1 pu.

Layers | Number of Cells | Number of Units/Cell | Unit Input | Unit Output |
---|---|---|---|---|

Input layer [20 × 18] | - | - | ||

LSTM-AE 1 + ReLU | 20 | 16 | 20 × 18 | 20 × 16 |

LSTM-AE 2 + ReLU | 20 | 8 | 20 × 16 | 1 × 8 |

Description | Values |
---|---|

$\mathrm{Overhead}\mathrm{line}(\mathrm{positive}\mathrm{seq}.),{l}_{1},{c}_{1},{r}_{1}$ | $1.05\mathrm{mH}$, $0.33\mathsf{\mu}\mathrm{F}$, 0.1153 Ω |

$\mathrm{Overhead}\mathrm{line}(\mathrm{zero}\mathrm{seq}.),{l}_{0},{c}_{0},{r}_{0}$ | $3.32\mathrm{mH}$, $5.01\mathrm{nF}$, 0.413 Ω |

Load 1: voltage, P | 33 kV, 250 kW |

Load 2: voltage, P | 33 kV, 2 MW |

$\mathrm{Converter}:\mathrm{DC}\mathrm{link}\mathrm{voltage},{f}_{pwm}$, S | 600 V, 1980 Hz, 250 kVA |

Transformer 1: V_{1}/V_{2}, S | 415 V/33 kV, 250 kVA |

Transformer 2: V_{1}/V_{2}, S | 132/33 kV, 63 MVA |

Dataset | Size | Models | |
---|---|---|---|

LSTM-AE | RF | ||

Training (Dataset 1) | Input size | [1200, [10, 20], 18] | [1200, 80] |

Output size | [1200, [10, 20], 18] | [1200, 306] | |

Validation (Dataset 1) | Input size | [800, [10, 20], 18] | [800, 80] |

Output size | [800, [10, 20], 18] | [800, 306] | |

Testing (Dataset 2) | Input size | [600, [10, 20], 18] | [600, 80] |

Output size | [600, [10, 20], 18] | [600, 306] |

Depth of Trees | |||
---|---|---|---|

Number of Decision Trees | 10 | 25 | 50 |

25 | 20.0 | 8.32 | 7.13 |

50 | 5.46 | 3.20 | 4.86 |

75 | 9.14 | 8.41 | 9.69 |

100 | 5.37 | 6.36 | 8.80 |

**Table 5.**The overall performance of proposed method in terms of mean square error (MSE) over total test dataset.

Mean Square Error | ||
---|---|---|

Fault location | F1 | F2 |

Case study 1 | 1.3 | 3.2 |

Case study 2 | 8.4 | 8.67 |

Case study 3 | 20.2 | 46.8 |

**Table 6.**Time required for training different modules of the proposed method, feature extraction and impedance estimation.

Process | Task | Time (s) |
---|---|---|

Training | LSTM-AE | 10,800 (or 180 min) |

Training | RF regressor | 1800 (or 30 min) |

Testing | Feature extraction for one datapoint | 0.02 |

Testing | Grid impedance estimation for one datapoint | 0.01 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Bagheri, A.; Bongiorno, M.; Gu, I.Y.H.; Svensson, J.R.
Estimation of Frequency-Dependent Impedances in Power Grids by Deep LSTM Autoencoder and Random Forest. *Energies* **2021**, *14*, 3829.
https://doi.org/10.3390/en14133829

**AMA Style**

Bagheri A, Bongiorno M, Gu IYH, Svensson JR.
Estimation of Frequency-Dependent Impedances in Power Grids by Deep LSTM Autoencoder and Random Forest. *Energies*. 2021; 14(13):3829.
https://doi.org/10.3390/en14133829

**Chicago/Turabian Style**

Bagheri, Azam, Massimo Bongiorno, Irene Y. H. Gu, and Jan R. Svensson.
2021. "Estimation of Frequency-Dependent Impedances in Power Grids by Deep LSTM Autoencoder and Random Forest" *Energies* 14, no. 13: 3829.
https://doi.org/10.3390/en14133829