# State Estimation for DC Microgrids using Modified Long Short-Term Memory Networks
## 1 Introduction
With the offline training phase, the state estimator proved to be able to run in real time with affordable training and minimal tuning, which resulted in improved performance compared with existing alternatives. In [19], a shallow neural network is used in a distribution system state estimator to produce an approximation of the system's state. The state is then sent into the Gauss-Newton algorithm for refinements, which results in fast convergence to an optimal solution of SE. Different deep learning methods for distribution grid SE were tested in [20]. In the literature, an auto-associative neural network (AANN), or autoencoder-based state estimator, was shown to have the advantage of being independent of the network parameters and topology, which resulted in effective and accurate estimation. In electric power systems, deep learning applications are not limited to SE only. A multilayer perceptron (MLP) neural network was adopted in [21] for short-term load forecasting, which produces minimal estimation errors. Another deep learning method, namely the long short-term memory (LSTM) network, was used in [22] for residential load forecasting, which outperformed the listed rival algorithm in forecasting individual residential households in terms of forecasting performance. Meanwhile, in [23], LSTM was used to forecast solar irradiance for microgrids based on widely available weather data only. The literature showed higher accuracy compared to the simple feedforward neural network (FFNN) method. From all the previous works, one can notice that neural networks and deep learning approaches can provide better results over the conventional methods in some applications in terms of accuracy and computational speed. Additionally, in microgrid SE, one problem with the conventional method is the usage of pseudo-measurement. Out of several measurement types used as the SE input, the pseudo-measurement has the highest error variance, which could cause a sub-optimal SE result. For application of the deep learning method for SE in the microgrid system, the historical data is used in the training process of the state estimator, unlike the conventional WLS SE, which only uses the present time data. However, even though both methods used pseudo-measurement, the deep learning method training process disregarded the error variance of all measurement types. Hence, the deep learning method, if applied for SE in microgrid systems, might give improved SE results. A lot of studies have been done on SE, such as TSSE, distribution system SE, and microgrid SE in general. However, not many studies have discussed DC microgrid SE. In particular, this paper proposes a DC microgrid state estimator using a modified LSTM network. LSTM is chosen as its structure allows the capability to learn the long-term dependencies in sequential data [24; 25; 26]. This ability makes LSTM especially good at learning time-series data, which conveniently, in the case of microgrid SE, is the structure of the measurement data as the historical data. LSTM predicts an output based on the current input and previous calculated output. In comparison, MLP only considers the current input to predict an output and does not utilize its previous output to improve its prediction accuracy. Furthermore, there had not been any previous attempt at using the LSTM method for SE. To estimate the state of a DC microgrid, measurements of the bus voltage magnitude and current flow are collected to train our LSTM state estimator. Additionally, in order to demonstrate the algorithm's ability to solve the observability problem in microgrid systems, the pseudo-measurements are included to increase the accuracy of the SE. In this paper, a loss function resembling the objection function of the conventional WLS state estimator is used to train the network model. A set of weights is applied to the loss function, in which certain weight values correspond to certain measurement types.