1. Introduction
With the advancement of technology and the development of society, there is an increasing demand for electrical energy across various sectors, accompanied by a higher expectation for the quality of electrical power from consumers [
1,
2]. Electrical power quality encompasses phenomena such as surges, flickers, harmonics, and voltage sags (also known as voltage dips), among which voltage sags occur the most frequently [
3,
4,
5]. Dynamic voltage restorers (DVRs) have the capability to compensate for both the magnitude and phase of voltage sags, making them the most economically effective power equipment for addressing voltage sag issues [
6,
7,
8,
9]. Furthermore, with the increasing utilization of large-scale grid-connected wind power generation, the low-voltage ride-through capability of wind power generation has received more attention, and DVRs, as voltage compensation devices, have found widespread application in this field as well [
10,
11].
Currently, research on dynamic voltage restorers (DVRs) primarily focuses on voltage detection algorithms, topology structures, control algorithms, and so forth [
12,
13,
14,
15,
16]. The compensation performance of DVR systems mainly depends on their control systems [
17,
18]. Among the various control strategies studied, prevalent ones include feedforward control, feedback control, dual feedforward combined with feedback control, H-infinity control [
19,
20,
21,
22], fuzzy control, artificial neural network control, and other methods [
23,
24]. Each of these control methods has its own advantages and disadvantages concerning steady-state error, dynamic response, robustness, adaptability to changes in control and hardware, and practicality.
In [
1], a detailed overview of power quality analysis and control technologies for the smart grid is provided, emphasizing the potential of new technologies in addressing power quality challenges. It is shown in [
2] that the use of custom power devices can significantly reduce voltage sags and momentary interruptions, thereby improving overall power quality. Similarly, the implementation of a dynamic voltage restorer (DVR) in an off-grid hybrid renewable energy system enhances both power quality and system stability, as demonstrated in [
3]. The role of custom power devices in mitigating power quality issues within distributed generation systems is explored in [
4], highlighting their importance in improving system reliability and stability. Moreover, the application of a battery-based DVR in grid-integrated PV systems has been shown to effectively reduce voltage fluctuations and harmonics, improving voltage quality, as discussed in [
5].
In the context of wind turbine systems, [
6] presents the design of parallel powertrains, which are shown to enhance system availability and reliability, particularly in high-demand environments. The zero active power tracking technique, explored in [
7], significantly enhances the performance of DVRs by improving their voltage sag compensation capabilities. Further, the integration of an isolated H-bridge DC-DC converter into a transformerless DVR system, as outlined in [
8], results in substantial improvements in power quality by mitigating voltage disturbances. A comprehensive review of DVR topologies, power converters, and control methods is provided in [
9], summarizing their applications and contributions to enhancing power quality.
The fault ride-through capability of grid-connected PV systems can be improved using DVRs, as demonstrated in [
10], where system stability under fault conditions is significantly enhanced. Similarly, in [
11], the integration of battery and superconducting magnetic energy storage (SMES) with DVRs substantially improves the voltage sag performance of grid-connected hybrid PV–wind power systems. A conventional three-wire DVR is shown in [
12] to effectively attenuate zero-sequence voltage, further improving power quality. In [
13], the power quality of grid-connected photovoltaic systems under partial shading conditions is addressed using a Trans-z-source inverter. A linearly decoupled control method for DVRs without energy storage is proposed in [
14], which improves power quality while simplifying the control system design.
Reviews of DVR technology, such as the one in [
15], trace its development and applications, suggesting future research directions for enhancing power quality. The high-frequency link cycloconverter-based DVR proposed in [
16] is effective in mitigating voltage sags and improving power quality. The fault ride-through capability of grid-connected systems using a Third-Harmonic Injection Pulse Width Modulation (THIPWM)-fired Five-Level Diode Clamped Multilevel Inverter (DCMLI)-based Doubly Fed Induction Generator (DFIG) is enhanced through the use of DVRs, as explored in [
17]. In [
18], a robust control design using quantitative feedback theory is proposed for multi-functional DVRs, improving both power quality and system robustness.
Further advancements in DVR control systems are discussed in [
19], where high-performance stationary-frame controllers are compared, revealing significant enhancements in voltage recovery capabilities. Similarly, the use of flying capacitor multilevel converters operated by repetitive control in DVR applications, as discussed in [
20], leads to notable improvements in voltage quality. The integration of fuzzy neural and neuro-fuzzy controllers in DVR systems, as explored in [
21,
22], results in significant improvements in power quality, particularly when dealing with nonlinear loads.
Sliding mode control is introduced in [
23] for its effectiveness in improving the robustness and disturbance rejection capabilities of electromechanical systems. In [
24], a three-phase DVR utilizing sliding mode control and an adaptive notch filter is shown to protect sensitive loads and enhance power quality. Furthermore, the study in [
25] proposes time-varying and constant switching frequency-based sliding mode control methods for transformerless DVRs employing half-bridge voltage source inverters (VSIs), significantly improving voltage control performance.
The model predictive control of packed U cells in transformerless single-phase DVRs, as presented in [
26], proves effective in compensating for voltage sags. A series-side three-phase decoupling unified power quality controller is proposed in [
27], which significantly reduces voltage and current fluctuations, thus improving power quality. A data-driven approach for predicting voltage sag residual voltage, detailed in [
28], shows high accuracy and feasibility using real grid data from East China. Additionally, a method for identifying voltage sag causes, utilizing bidirectional Long Short-Term Memory (LSTM) and the attention mechanism, is presented in [
29], focusing on accurate cause identification.
Real-time methods for predicting voltage sag probability are explored in [
28], where high prediction accuracy is achieved using new voltage sag characteristics and actual measurement data. In [
30], sliding mode control technology is applied to improve the accuracy of rotor speed and position estimation in high-performance permanent magnet synchronous motor (PMSM) applications, enhancing system robustness and adaptability. Finally, in [
31], an improved non-singular fast terminal sliding mode controller combined with a sliding mode disturbance observer is used for load disturbance compensation, significantly improving dynamic response and disturbance rejection capabilities while reducing chattering.
Rapidly identifying voltage sags and providing timely compensation is of significant importance. LSTM (Long Short-Term Memory) networks, with their memory characteristics, are better suited to learning the features of time series data. This enhances the model’s ability to process temporal data and improves recognition accuracy. The sliding mode control (SMC) strategy is recognized as an effective nonlinear control strategy, characterized by rapid response, insensitivity to parameter variations and disturbances, and simplicity in physical implementation [
21]. However, traditional SMC control strategies suffer from serious chattering phenomena. Although the SMC method proposed in [
22] exhibits good performance, replacing the sign function with a hysteresis function cannot completely eliminate chattering, which consequently leads to a time-varying switching frequency. Another method proposed in [
23] is based on the variable boundary layer approach, but the selection of the boundary layer is not based on equation analysis. However, inaccurate boundary layer selection may result in steady-state errors [
25].
In response to the aforementioned issues, this paper proposes a dynamic voltage restorer based on LSTM neural networks for voltage prediction and novel sliding mode variable structure control. Additionally, a novel reaching law is designed, which significantly enhances the system’s response speed and reduces chattering.
2. Topology Structure and Operating Principle of DVR System
The DVR mainly consists of a voltage detection module, energy storage device, inverter unit, control section, filter, series transformer, etc. [
9]. The system structure is shown in
Figure 1.
The operational principle of the dynamic voltage restorer (DVR) involves the energy provision from the energy storage unit. The control section utilizes the detected characteristics of voltage sags to compute the required compensatory voltage difference. It then generates control signals to trigger the conduction of the inverter, thereby producing corresponding compensatory voltage. This voltage is appropriately filtered through an LC filtering circuit to remove high-order harmonics generated by the inverter section, forming compensatory voltage that meets the requirements. Subsequently, this compensatory voltage is serially connected to the distribution network via a secondary loop with a boosting transformer. This process enables the overlay of the voltage on the distribution network side with the compensatory voltage, ensuring that the load receives qualified voltage and guaranteeing the reliability of load power consumption.
When no voltage sag is detected, the switching device of the dynamic voltage restorer (DVR) remains open. During this time, the DVR operates in bypass standby mode. The detection module continuously monitors the amplitude and phase variations in the voltage at the power supply side of the distribution network. Upon detecting a voltage sag in the distribution network, the bypass switch is swiftly closed, initiating the compensation process of the DVR. At this point, the DVR is serially connected to the distribution network, and the control unit calculates the required compensatory voltage signal based on the detection signal. It then drives the inverter to generate compensatory waveforms, ensuring stable voltage at the load side and avoiding equipment shutdowns caused by voltage sags.
The following equations can clearly express the working principle of the DVR, where the grid voltage is denoted as
, the voltage at the load side of the system is denoted as
, and the compensating voltage is denoted as
. When the grid voltage drops by
, if there is no DVR, the load voltage is as follows:
When the DVR is connected to the system, the load voltage is
Setting the compensating voltage allows for voltage compensation to be achieved.
3. Mathematical Model of DVR
The main circuit of the DVR employs a fully controlled SPWM (Sinusoidal Pulse Width Modulation) inverter configuration. Each phase is connected to the grid via an isolation transformer in series. The basic circuit structure of the three-phase, three-wire DVR is depicted in
Figure 2.
In this figure,
,
, and
represent the grid-side voltages;
,
denote the voltages output by the voltage source inverter;
,
, and
signify the compensating voltages after passing through the
LC output filter of the voltage source inverter;
,
, and
and
and
represent the inductor currents and capacitor currents, respectively; and
and
denote the filtering inductance and filtering capacitance. According to the defined voltage and current directions in
Figure 2, and by converting leakage impedance and losses to the secondary side of the transformer, neglecting excitation current and system inductance, the system mathematical model of the DVR can be established based on Kirchhoff’s law:
In Equation (1), k = 1, 2, 3 represents the three phases.
Considering the lack of independence among the three-phase variables in a symmetrical three-phase system, which is not conducive to the design of control systems, Equation (1) is transformed into the classical Park transformation to convert it into the synchronous rotating d-q coordinate system. The mathematical model is as follows [
29]:
and are the d-q axis components of the compensating voltage after passing through the LC output filter of the voltage source inverter. and are the d-q axis components of the voltage output by the voltage source inverter. , , , and are the d-q axis components of the inductor currents and capacitor currents, respectively. is the angular velocity of the grid voltage.
4. Voltage Sag Prediction Based on LSTM Neural Network Model
LSTM (Long Short-Term Memory) is a specialized type of recurrent neural network (RNN) designed to capture long-term dependencies in sequential data, making it particularly well suited for tasks such as time series analysis. Unlike traditional RNNs, which often struggle to retain important information over longer sequences due to issues like vanishing gradients, LSTM introduces a gating mechanism that enables it to selectively retain, update, or discard information as needed. This mechanism includes three types of gates: the forget gate, input gate, and output gate. These gates allow LSTM to control the flow of information, ensuring that critical historical data are retained while irrelevant or redundant information is discarded.
The forget gate decides which parts of the previous memory to retain, while the input gate determines what new information should be stored. The output gate controls the amount of information that will be passed on as the current output. By regulating the interaction between these gates, LSTM models can adapt quickly to changing trends and maintain long-term dependencies, even in the presence of significant fluctuations in the data.
This makes LSTM particularly effective in tasks like predicting voltage trends in power grids, where sudden changes and long-term patterns are both crucial. Through multiple iterations and by minimizing errors during training, LSTM models can provide highly accurate predictions based on time-varying data.
Figure 3 shows the flowchart of the LSTM prediction neural network designed in this paper for forecasting voltage sag.
In this study, based on the voltage sag data of the 10 kV A-phase voltage that occurred in a certain region of mainland China on 25 May 2024, at 14:36, we constructed and trained a Long Short-Term Memory (LSTM) network model to predict the voltage state. The detailed logic and methodology of this process are as follows:
First, during the data preprocessing stage, the voltage data were collected, cleaned, and normalized. This step is crucial before training the model, ensuring the stability and efficiency of the data during the training process. We extracted the time and voltage columns from the dataset and normalized the voltage data to a specific range.
Next, we created the time series data by structuring the normalized voltage data into input and output sequences. This step involved pairing each data point in the voltage series with its subsequent data point, forming the time series data necessary for training the LSTM network.
In the model construction phase, we designed an LSTM network architecture consisting of an input layer, an LSTM layer, and a fully connected layer. The input layer receives the normalized voltage data, the LSTM layer captures the long-term dependencies in the time series data, and the fully connected layer generates the final prediction results.
For model compilation, we selected the Adam optimizer and the Mean Squared Error (MSE) loss function. The Adam optimizer is an adaptive learning rate optimization algorithm suitable for handling sparse gradients, while the MSE loss function measures the error between the predicted values and the actual values.
During the model training phase, we trained the LSTM network using the training dataset. By setting parameters such as the maximum number of epochs, gradient threshold, and learning rate, we gradually optimized the model parameters to minimize the loss function. We employed a learning rate schedule that reduces the learning rate periodically to ensure better convergence towards the optimal solution in the later stages of training.
After training the model, we used it to make predictions. In the prediction phase, the time series data were input into the model to generate the corresponding predicted voltage values. To facilitate comparison, we denormalized the prediction results, restoring them to the original range of the voltage data.
Finally, we plotted a comparison between the actual and predicted voltage values to visually demonstrate the model’s prediction performance. The comparison plot shows that the LSTM model can accurately fit the voltage data, validating its effectiveness in time series data prediction.
Through the aforementioned steps, we successfully constructed and validated an LSTM-based voltage data prediction model, providing an effective method for analyzing and predicting time series data.
In this study, a Long Short-Term Memory (LSTM) network model was constructed and trained to achieve high-precision predictions of voltage data. The evaluation metrics show that the Mean Absolute Error (MAE) is 0.1030, and the coefficient of determination (R2) is 0.9956. These results indicate that the model has a low prediction error and a very high degree of fit.
As shown in
Figure 4, the predicted curve closely matches the actual curve, further validating the model’s effectiveness and stability. This demonstrates that the LSTM model can accurately predict voltage data and fully meets the prediction requirements. In summary, the constructed LSTM model performs exceptionally well in time series data prediction, indicating its broad application potential.
5. DQ Voltage Sag Detection Algorithm Based on Three-Phase Instantaneous Reactive Power Theory
By applying the instantaneous reactive power theory to a three-phase system, the three-phase voltage can be transformed as follows.
is the transformation matrix, specifically expressed as follows.
Since the voltage in the distribution network can be understood as the superposition of the fundamental voltage and harmonic voltages at various frequencies, the three-phase voltages a, b, and c can be expressed as follows:
is the root mean square (RMS) value of the fundamental voltage, and is the RMS value of the harmonic voltage.
After transforming Equations (3–19), the following equation is obtained:
The amplitude and phase information of the fundamental component can be obtained from
and
in the above equation. First, after applying a low-pass filter to filter out the higher harmonic components,
and
are obtained, with values
and
, respectively. Therefore,
is the RMS value of the voltage sag, and is the phase angle.
After being transformed using the C matrix, the three-phase AC current and voltage vectors are converted into DC vectors. The transformation principle is illustrated in
Figure 5 as follows:
Firstly, and are obtained by sampling the grid-side voltage, followed by Clarke and Park transformations. The harmonic components are filtered out using a low-pass filter (LPF) to obtain the DC components and . By applying the inverse coordinate transformation, the three-phase fundamental voltage can be derived. Then, by subtracting the reference voltages , , and , the compensation voltage required by the DVR can be obtained.
5.1. Voltage Sag Simulation Experiment and Analysis
From 0 to 0.1 s, no voltage sag occurs, and the voltage peak value is 311 V. From 0.1 to 0.2 s, the grid voltage drops by 20%, and from 0.2 to 0.3 s, the grid voltage returns to normal.
When the grid voltage sags by 20%, the grid voltage peak value is
, and the compensation voltage is
. The simulated experimental waveform is shown in
Figure 6.
As seen in
Figure 6, the comparison between the expected compensation voltage of 62.23 V and the detected output value of 62.2 V shows a difference of 0.03 V, which is 0.048% of the expected value. The dq transformation voltage sag detection method, based on instantaneous reactive power theory, effectively detects voltage sags and provides the correct compensation voltage, offering an accurate compensation voltage reference value.
5.2. Voltage Swell Simulation Experiment and Analysis
From 0 to 0.1 s, no voltage swell occurs, and the peak value is 311 V. From 0.1 to 0.2 s, the grid voltage swells by 20%, and from 0.2 to 0.3 s, the grid voltage returns to its normal value.
When the grid voltage swells by 20%, the peak grid voltage is
, and the compensation voltage is
. The three-phase compensation voltage is shown in
Figure 7.
As seen in
Figure 7, when a 20% voltage swell occurs, the expected compensation voltage is 62.21 V, while the detected output value is 62.22 V, resulting in a difference of 0.01 V, which is 0.016% of the expected value. The dq transformation voltage detection method, based on instantaneous reactive power theory, can effectively detect voltage swell and provide the correct compensation voltage, offering an accurate compensation voltage reference value.
6. Analysis of DVR Control System Design
This paper addresses the challenges posed by traditional PI controllers in optimizing controller parameters and system performance for inherently nonlinear, multivariable, and strongly coupled DVR systems, especially in the presence of significant nonlinear load disturbances. To overcome these challenges, sliding mode control is introduced into the voltage outer loop, and a novel reaching law is designed to expedite system response time and reduce oscillations.
Consider the following controlled object:
where
and
are both known, and
.
The sliding mode function is given by the following:
where c > 0 and satisfies the Hurwitz condition.
The tracking error is as follows:
where
represents the ideal position signal.
An exponential reaching law
, a constant velocity reaching law
, and an improved new reaching law
are used as follows:
The novel approach law adapts to system state changes by altering the shape of the sliding mode surface, thereby reducing chattering. The exponential approaching term ensures that the system state converges to the sliding mode surface within a finite time, improving rapidity. The absolute value and sign function terms effectively suppress disturbances and uncertainties in the system, enhancing robustness.
Therefore, the classical sliding mode convergence law is
The sliding mode controller based on the uniform convergence law is as follows:
The sliding mode controller based on the novel exponential convergence law proposed in this paper is
Taking the command signal as
, with the initial state of the controlled object as [−0.15 0.15], the controllers given by Equations (18–20) are employed, where
, respectively. The simulation results are shown in
Figure 8.
6.1. Dynamic Voltage Restorer Control System
The DVR output voltage error is defined as follows:
where
and
are the reference values of compensation voltage in the d-q coordinate system, and
and
are the actual output values of compensation voltage from the DVR.
Then, the dynamic equation of the output voltage error is given by the following:
We take the sliding surface as the proportional–integral form of the output voltage error, i.e., the integral sliding surface:
The purpose of adding the constant terms and is to ensure that the sliding surface also satisfies the sliding condition under the initial conditions of the system so that the sliding surface is only in the sliding phase and does not yet reach the reaching phase, thereby improving the system’s response speed and ensuring robustness.
Then, the expression for the derivative of the sliding surface is as follows:
The convergence law is as follows:
Combining Equations (24) and (25), the inner loop current reference value can be obtained as follows:
Once the reference values for the inner loop currents are obtained, the dual-loop control of the DVR system can be constructed. The voltage outer loop adopts sliding mode control, while the current inner loop adopts PI control. A control block diagram of the system is shown in
Figure 9:
6.2. Stability Proof
Define the Lyapunov function as follows:
Because
,
Because all parameters are positive,
Thus, it is proven that the designed controller is stable in the sense of Lyapunov.
8. Conclusions
LSTM is a type of neural network, and like any other neural network, it requires a large number of data points for proper training. To further improve prediction accuracy, increasing the data volume is necessary. Despite this, LSTM is highly effective in handling long-term and short-term dependencies in time series data, such as power grid voltage. It adapts well to sudden trend changes, has a low prediction error, and exhibits high fitting accuracy. This makes it particularly suitable for predicting fluctuating voltage trends and meeting the requirements for power grid voltage forecasting, thereby minimizing the impact of sudden voltage drops on industrial production.
Additionally, the novel reaching law dynamically adjusts the shape of the sliding surface based on changes in the system state, reducing chattering. The exponential approach term ensures that the system state converges to the sliding surface within a finite time, enhancing the response speed. The absolute value and sign function terms effectively suppress disturbances and uncertainties in the system, improving robustness. The dynamic voltage restorer based on the novel reaching law of sliding mode variable structure control accelerates the system response speed, reduces oscillations, and demonstrates strong robustness. It can adapt to various levels of voltage sags and surges, efficiently compensating for the load-side voltage to the desired setpoint.
However, while LSTM and sliding mode control offer significant advantages, they also have limitations. LSTM models struggle to train effectively on small datasets, and the reaching law in sliding mode control may not fully suppress all disturbances under extreme conditions. Therefore, despite their strengths in many applications, it is important to consider factors such as data volume, system complexity, and environmental disturbances when applying these methods in real-world scenarios.