# A Predictive Model Using Long Short-Time Memory (LSTM) Technique for Power System Voltage Stability
## 2 The Proposed System Methodology
\[V_{x}^{\prime}=\sqrt{\frac{{V_{y}^{\prime 2}}}{2}-\left(P_{i}^{\prime}\tan \theta\right)X\pm\sqrt{\frac{{V_{y}^{\prime 2}}}{4}-{P_{i}^{\prime}}^{2}X^{2}-X{V_{y}^{ \prime}}^{2}\left(P_{i}^{\prime}\tan\theta\right)}} \tag{10}\]  
where \(\theta\) is the power factor angle, the \(V_{x}^{\prime}\), and \(P_{i}^{\prime}\) represents the constant power factor of the Pv curves. The importance of implementing an artificial intelligence strategy in the electric power system is growing, driven by its effectiveness across various domains, including load prediction, assessment of the power system, fault detection, and more. To address essential protocol changes and create visual representations, the use of three distinct machine learning frameworks--Scikit-learn, TensorFlow, and PyTorch 3.0--is indispensable. The proposed model for assessing VS using LSTM consists of five primary components: an input layer, LSTM layer, fully connected (FC) layer, softmax layer, and output layer. The frameworks utilized in this model include various tools such as the regular scaler for statistical normalization, the confusion matrix for evaluating performance, and cross-validation for the K-Fold. Figure 3 illustrates the typical structure of the deep learning models used. The LSTM approach was used to forecast the PV curves based on VS assessments of the electrical system, as shown in Figure 4. In addition, a comparison was made with other machine learning (ML) and deep learning (DL) models, including support vector machines (SVMs), Naive Bayes, K-nearest neighbors (KNN), and convolutional neural networks (CNNs), to evaluate the efficacy of the long short-term memory (LSTM) algorithm. The power-voltage curve (P-V) analysis is a widely used method for assessing voltage stability in power systems. This curve illustrates the relationship between power transfer in lines and voltage magnitudes at buses. The characterization of the PV curve shows that a steep curve reveals voltage sensitivity, while a flat slope indicates approaching instability. During the data study procedure, the scikit learn library was employed with a labeled contribution dataset. In this specific case, a supplementary dataset consisting of 30,000 observations was used as an independent variable. In this framework, a numerical value of 1 represents a state of stability (stable), whereas a value of 0 indicates a state of instability (unstable). The assessment of features involved generating graphical representations for the 12 features, providing visual insights into their distribution and their correlation with the dependent variable 'Control Action'. This section provides a visual representation of how these 12 numerical values relate to the dependent variable. The dataset was divided into two distinct subsets using the DL algorithm, one for training and the other for evaluation. The algorithm was trained on the first subset of 24,000 data points and then tested on the remaining 6000 data points. The analytical variables in the dataset included the notional power that each participant in the network created (positive) or consumed (negative), ranging from \(-3.0\) to \(-0.5\) for the data labeled for the national power grid load value to calculate the stability or instability of the IEEE 33-bus system, and the reaction time each participant experienced, ranging from 0.5 to 1.0. The dataset also included the price elasticity of demand for each node in the network, ranging from 0.05 to 1.0 as a continuous variable. Figure 3: Structure of deep learning models. The principle of energy conservation resulted in the overall load demand being identical to the total generation capacity. A non-linear activation function was used to help the system modify its input consequences to its environment. The dataset underwent an initial filtering process to eliminate missing values, such as blank or zero values within its features, thereby ensuring the accuracy and validity of the results.