Integrated Sliding Mode Control for Grid Tied Inverter Using Convolutional Neural Network

In recent years, the integration of renewable energy sources, particularly photovoltaic (PV) systems, into the power grid has gained significant momentum. The grid tied inverter serves as a critical interface between the PV array and the utility grid, converting direct current (DC) from solar panels into alternating current (AC) suitable for grid injection. Ensuring the stability, efficiency, and power quality of this grid tied inverter is paramount for reliable energy delivery. Traditional control methods, such as proportional-integral (PI) controllers, often struggle with nonlinearities, parameter uncertainties, and external disturbances inherent in PV systems. To address these challenges, this article proposes an integrated sliding mode control (SMC) approach enhanced by a Convolutional Neural Network (CNN) for single-stage grid tied inverters. The method leverages CNN for accurate fault estimation and combines it with integral sliding mode control to achieve robust performance, improved dynamic response, and enhanced disturbance rejection. Throughout this discussion, the term ‘grid tied inverter’ will be emphasized to highlight its central role in PV systems.

The core of our approach lies in the synergy between deep learning and advanced control theory. By employing a CNN, we can automatically extract fault features from the grid tied inverter’s output data, enabling precise estimation of system anomalies. This estimation then informs the design of an integral sliding mode controller, which ensures rapid convergence and robustness against uncertainties. We will delve into the mathematical modeling of the single-stage grid tied inverter, detail the CNN architecture and training process, and elaborate on the integral sliding mode controller design. Experimental results will be presented to validate the effectiveness of our method, demonstrating its superiority in terms of voltage restoration, harmonic suppression, and robustness under varying grid conditions.

Mathematical Modeling of Single-Stage Grid Tied Inverter

The single-stage grid tied inverter topology typically consists of a DC-link capacitor, an inverter bridge, and an output filter connected to the grid. For control design, a precise mathematical model is essential. Assuming a balanced three-phase grid and applying Clarke transformation to eliminate common-mode components, the dynamic equations of the grid tied inverter system can be derived. Let \(i_s\) and \(U_o\) denote the inverter output current and voltage, respectively, \(i_g\) and \(U_g\) represent the grid-side current and voltage, and \(U_C\) and \(R_C\) be the voltage and resistance of the filter capacitor \(C\). The grid tied inverter inductance and resistance are \(L_s\) and \(R_s\), while the grid-side inductance and resistance are \(L_g\) and \(R_g\). The system dynamics are described by the following differential equations:

$$ L_s \frac{di_s}{dt} + R_s i_s = U_o – U_C $$
$$ L_g \frac{di_g}{dt} + R_g i_g = U_C – U_g $$
$$ \frac{dU_C}{dt} – R_C \left( \frac{di_s}{dt} – \frac{di_g}{dt} \right) = \frac{i_s}{C} – \frac{i_g}{C} $$

To formulate a state-space representation, we define the state vector \( \mathbf{x} = [x_1, x_2, x_3]^T = [i_s, i_g, U_C]^T \). The input to the grid tied inverter is the inverter bridge voltage \(u\), and the output is typically the grid current or voltage. The state-space model is expressed as:

$$ \dot{\mathbf{x}} = \mathbf{Q} \mathbf{x} + \lambda \mathbf{B} u $$
$$ y = \mathbf{C} \mathbf{x} $$

where \(\dot{\mathbf{x}}\) is the state derivative, \(\mathbf{Q}\) is the system matrix, \(\mathbf{B}\) is the control input matrix, \(\lambda\) is a constant, and \(\mathbf{C}\) is the output matrix. However, in practical scenarios, the grid tied inverter is subject to parameter uncertainties (e.g., variations in \(L_g\), \(L_s\), \(C\), \(R_g\), \(R_s\), \(R_C\)) and actuator faults. These can be incorporated as additive uncertainties:

$$ \dot{\mathbf{x}} = (\mathbf{Q} + \Delta \mathbf{Q}) \mathbf{x} + \lambda (\mathbf{B} + \Delta \mathbf{B}) u $$
$$ y = \mathbf{C} \mathbf{x} $$

Here, \(\Delta \mathbf{Q}\) represents system matrix uncertainties, and \(\Delta \mathbf{B}\) accounts for actuator faults. For fault tolerance, we express \(\mathbf{B} + \Delta \mathbf{B} = \mathbf{B} (\mathbf{I} – \mathbf{K})\), where \(\mathbf{K} = \text{diag}(k_1, k_2, k_3)\) is the actuator effectiveness matrix. If \(k_i = 1\), the \(i\)-th actuator is fault-free; if \(k_i = 0\), it is fully faulty. This model forms the basis for designing a robust control scheme for the grid tied inverter.

To facilitate controller design, we apply a nonsingular transformation \(\mathbf{T}_0\) to the state vector, yielding a transformed state \(\bar{\mathbf{x}} = \mathbf{T}_0 \mathbf{x}\). The transformed system becomes:

$$ \dot{\bar{\mathbf{x}}} = (\bar{\mathbf{Q}} + \Delta \bar{\mathbf{Q}}) \bar{\mathbf{x}} + \lambda \bar{\mathbf{B}} (\mathbf{I} – \mathbf{K}) u $$
$$ y = \bar{\mathbf{C}} \bar{\mathbf{x}} $$

where \(\bar{\mathbf{Q}} = \mathbf{T}_0 \mathbf{Q} \mathbf{T}_0^{-1}\), \(\Delta \bar{\mathbf{Q}} = \mathbf{T}_0 \Delta \mathbf{Q} \mathbf{T}_0^{-1}\), \(\bar{\mathbf{B}} = \mathbf{T}_0 \mathbf{B}\), and \(\bar{\mathbf{C}} = \mathbf{C} \mathbf{T}_0^{-1}\). By partitioning \(\bar{\mathbf{B}}\) into \(\bar{\mathbf{B}}_1\) and \(\bar{\mathbf{B}}_2\) such that \(\bar{\mathbf{B}} = [\bar{\mathbf{B}}_1 \quad \bar{\mathbf{B}}_2]\), we can isolate the control channels relevant for sliding mode design. The grid tied inverter model is then rewritten as:

$$ \dot{\bar{\mathbf{x}}} = (\bar{\mathbf{Q}} + \Delta \bar{\mathbf{Q}}) \bar{\mathbf{x}} + \lambda \begin{bmatrix} \bar{\mathbf{B}}_1 \\ \bar{\mathbf{B}}_2 \end{bmatrix} (\mathbf{I} – \mathbf{K}) u $$

Introducing a fixed control allocation law \(u’ = \bar{\mathbf{B}}_2 (v_0 + v_1)\), where \(v_0\) is the nominal virtual control and \(v_1\) is the compensation for faults, we obtain a simplified model for controller synthesis:

$$ \dot{\bar{\mathbf{x}}} = (\bar{\mathbf{Q}} + \Delta \bar{\mathbf{Q}}) \bar{\mathbf{x}} + \lambda \bar{\mathbf{B}}_r v_0 $$
$$ y = \bar{\mathbf{C}} \bar{\mathbf{x}} $$

with \(\bar{\mathbf{B}}_r = [\bar{\mathbf{B}}_1 \quad \bar{\mathbf{B}}_2 \quad \mathbf{I}]^T\). This transformed model is crucial for integrating CNN-based fault estimation and integral sliding mode control for the grid tied inverter.

CNN-Based Fault Estimation for Grid Tied Inverter

Accurate fault estimation is vital for the reliable operation of a grid tied inverter. We employ a Convolutional Neural Network (CNN) to estimate fault signals from the inverter output data \(y\). The CNN automatically extracts spatial-temporal features from the data, enabling real-time detection and estimation of faults such as voltage sags, current imbalances, or parameter deviations. The architecture of our CNN consists of an input layer, multiple convolutional layers, pooling layers, and fully connected layers.

The input to the CNN is the time-series data of the grid tied inverter output, which may include voltage, current, or power measurements. Let \(h^l\) denote the feature map at layer \(l\). The forward propagation in a convolutional layer is given by:

$$ h^l = \sigma \left( h^{l-1} * \mathbf{W}^l * \gamma^l + \mathbf{b}^l \right) $$

where \(h^{l-1}\) is the previous layer’s output, \(\mathbf{W}^l\) is the weight kernel, \(\gamma^l\) is a scaling coefficient, \(\sigma(\cdot)\) is the activation function (e.g., ReLU), \(\mathbf{b}^l\) is the bias term, and \(*\) denotes the convolution operation. The convolution result \(z^l\) is computed as:

$$ z^l = h^{l-1} * \mathbf{W}^l * \gamma^l = \sigma(h^{l-1}) * \mathbf{W}^l * \gamma^l $$

To train the CNN, we use backpropagation. The gradient \(\delta^l\) at layer \(l\) is propagated backward as:

$$ \delta^{l-1} = \delta^l \cdot \frac{\partial z^l}{\partial z^{l-1}} = \delta^l \times \text{rot}_{180}(\mathbf{W}^l \gamma^l) \times \sigma’ \left( \frac{\partial z^l}{\partial z^{l-1}} \right) $$

where \(\text{rot}_{180}(\cdot)\) rotates the kernel by 180 degrees, and \(\sigma’\) is the derivative of the activation function. The gradients with respect to weights and biases are:

$$ \frac{\partial J}{\partial \mathbf{W}^l} = \frac{\partial J}{\partial z^l} \frac{\partial z^l}{\partial \mathbf{W}^l} = \delta^l \times \text{rot}_{180}(h^{l-1} * \gamma^l) $$
$$ \frac{\partial J}{\partial \mathbf{b}^l} = \sum \delta^l $$

Here, \(J\) is the objective function for feature extraction from grid tied inverter data. After convolutional layers, pooling layers are used for down-sampling and secondary feature extraction. Max-pooling is applied, with forward propagation:

$$ h’^{l+1} = \sigma \left( \text{down}(h’^l) \gamma^l \right) $$

where \(\text{down}(\cdot)\) denotes the down-sampling operation. The backward propagation for pooling is:

$$ \delta’^{l-1} = \frac{\partial J}{\partial z’^l} \cdot \frac{\partial J}{\partial h’^{l-1}} \cdot \frac{\partial h’^{l-1}}{\partial z’^{l-1}} = \text{upsample}(\delta’^l) \sigma'(z’^{l-1}) $$

where \(\text{upsample}(\cdot)\) is the up-sampling operation. Finally, fully connected layers aggregate the features and output the fault estimate \(\mathbf{O}\). The output layer computation is:

$$ \mathbf{O} = \sigma \left( \mathbf{W} z’ + \mathbf{b} \right) $$

To prevent overfitting during CNN training, we optimize the loss function using an adaptive regularization coefficient. The total loss function \(F\) combines the original loss \(F_0\) and an \(L_2\) regularization term:

$$ F = F_0 + \frac{\theta \mu \sum \mathbf{W}^2}{2n} $$

where \(n\) is the number of grid tied inverter data samples, \(\mu\) is a correction coefficient, and \(\theta\) is the regularization coefficient. We adapt \(\theta\) dynamically during training to improve generalization. The update rule for \(\theta\) at iteration \(\eta\) is:

$$ \theta_{\eta+1} = \frac{\theta_{\eta}}{K + \Delta \rho^2_{\eta}} $$

with \(K\) as an initial constant and \(\Delta \rho^2_{\eta}\) as the gradient of the loss function. This adaptive approach ensures robust fault estimation for the grid tied inverter even with limited or noisy data.

The CNN estimates faults such as actuator failures or parameter shifts, outputting a fault vector \(\mathbf{O}\). This estimate is then fed into the integral sliding mode controller to adjust the control law accordingly. The synergy between CNN and SMC enhances the grid tied inverter’s resilience to disturbances.

Integral Sliding Mode Controller Design for Grid Tied Inverter

Integral sliding mode control (ISMC) is renowned for its robustness against matched uncertainties and disturbances. For the grid tied inverter, we design an ISMC that incorporates the fault estimates from the CNN. The controller comprises two main parts: selection of the sliding surface and design of a dynamic compensation controller.

Sliding Surface Selection

Based on the fault estimate \(\mathbf{O}\) from the CNN, we define an integral sliding surface \(\phi(\mathbf{O})\) for the grid tied inverter. The surface is chosen to eliminate steady-state error and ensure fast convergence. The expression for \(\phi(\mathbf{O})\) is:

$$ \phi(\mathbf{O}) = \bar{\mathbf{B}} (\mathbf{O} – \mathbf{O}_0) – \bar{\mathbf{B}} \int_0^t \left( (\bar{\mathbf{Q}} + \Delta \bar{\mathbf{Q}}) \mathbf{O} + \bar{\mathbf{B}} u^* \right) d\tau $$

where \(\mathbf{O}_0\) is the initial fault estimate, \(t\) is time, and \(u^*\) is the dynamic compensation control law to be designed. The sliding surface must satisfy \(\phi(\mathbf{O}) = 0\) and \(\dot{\phi}(\mathbf{O}) = 0\) for ideal sliding motion. From \(\dot{\phi}(\mathbf{O}) = 0\), we derive the equivalent control law \(u_{eq}\):

$$ u_{eq} = – \left( \bar{\mathbf{B}} (\bar{\mathbf{B}} + \Delta \bar{\mathbf{B}}) \right)^{-1} \bar{\mathbf{B}} \left( (\Delta \bar{\mathbf{Q}} + \Delta \bar{\mathbf{Q}}_g) \mathbf{O} – \bar{\mathbf{B}} u^* \right) $$

Assuming that the fault estimate \(\mathbf{O}\) aligns with the subspace spanned by \(\bar{\mathbf{B}}_2\), this simplifies to:

$$ u_{eq} = – (\mathbf{I} + \Delta \bar{\mathbf{B}})^{-1} (\Delta \bar{\mathbf{Q}} \mathbf{O} – u^*) $$

Substituting \(u_{eq}\) into the grid tied inverter dynamics yields the closed-loop behavior on the sliding surface:

$$ \dot{\bar{\mathbf{x}}} = (\bar{\mathbf{Q}} + \Delta \bar{\mathbf{Q}}) \mathbf{O} + \bar{\mathbf{B}} u_{eq} + \xi $$

where \(\xi\) represents unmatched uncertainties. This shows that once the sliding surface is reached, the grid tied inverter’s dynamics are governed by the dynamic compensation controller, independent of matched faults.

Dynamic Compensation Controller Design

The dynamic compensation controller aims to achieve accurate tracking of reference signals (e.g., grid current or voltage) for the grid tied inverter while rejecting external disturbances. Let the tracking error be \(\mathbf{e} = \mathbf{y}_{ref} – \mathbf{y}\), where \(\mathbf{y}_{ref}\) is the reference output. External disturbances, such as load changes or grid voltage variations, are modeled as \(\mathbf{p} = [I’ \quad V]^T\), where \(I’\) is the load current and \(V\) is the grid voltage. The disturbance coefficient matrix is \(\mathbf{M}\), and the disturbance input matrix is \(\mathbf{P}\).

We augment the grid tied inverter state equation to include disturbances:

$$ \dot{\mathbf{O}} = (\bar{\mathbf{Q}} + \Delta \bar{\mathbf{Q}}) \mathbf{O} + \bar{\mathbf{B}} u’ + \mathbf{N} \mathbf{P} $$
$$ \mathbf{e} = \bar{\mathbf{C}} \dot{\mathbf{O}} + \mathbf{D} \mathbf{P} $$

where \(\mathbf{N} = [\mathbf{G} \quad \mathbf{0}]\), \(\mathbf{G} = \begin{bmatrix} -\frac{1}{C_f} & 0 \\ 0 & -\frac{1}{C_f} \\ 0 & 0 \end{bmatrix}\), \(C_f\) is the filter capacitance, and \(\mathbf{D} = \begin{bmatrix} 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & -1 \end{bmatrix}\). The goal is to design a state feedback matrix \(\mathbf{G}_x\) and a compensation matrix \(\mathbf{G}_p\) such that the closed-loop grid tied inverter system is stable and the steady-state error due to disturbances is zero. The matrices must satisfy:

$$ \bar{\mathbf{C}} \mathbf{E} = \mathbf{D} $$
$$ \mathbf{N} = (\bar{\mathbf{Q}} + \Delta \bar{\mathbf{Q}}) \mathbf{E} – \mathbf{E} \mathbf{M} + \bar{\mathbf{B}} \mathbf{A} $$

where \(\mathbf{E}\) is a matrix relating disturbances to states, and \(\mathbf{A}\) is an auxiliary matrix. The compensation matrix \(\mathbf{G}_p\) is computed as:

$$ \mathbf{G}_p = \mathbf{A} + \mathbf{G}_x \mathbf{E} $$

Thus, the dynamic compensation control law \(u^*\) is:

$$ u^* = -\mathbf{G}_x \mathbf{O} – \mathbf{G}_p \mathbf{P} $$

Inserting \(u^*\) into the sliding surface definition completes the integral sliding mode controller. The overall control input \(u\) for the grid tied inverter is then a combination of the equivalent control and the compensation law, ensuring robust performance against faults and disturbances.

Experimental Analysis and Results

To validate the proposed CNN-based integral sliding mode control method for grid tied inverters, we conducted simulations using MATLAB/Simulink. The grid tied inverter parameters are based on a typical PV system, as summarized in Table 1.

Table 1: Parameters of the Grid Tied Inverter System
Parameter Value Unit
Grid Frequency 50 Hz
Rated Power 70 W
Rated Voltage 500 V
Rated Current 40 A
DC-Link Capacitance 0.006 F
Grid-Side Inductance 0.007 H
Battery Temperature 50 °C
Series Resistance 0.32 Ω
Line Resistance 0.2 Ω

The grid tied inverter was tested under nominal conditions and during fault scenarios. First, we applied the proposed control method to the grid tied inverter operating at rated parameters. The resulting voltage and current waveforms are sinusoidal with minimal distortion, confirming effective control. The total harmonic distortion (THD) was calculated to assess power quality. The THD for voltage and current under nominal operation is given by:

$$ \text{THD} = \sqrt{\frac{\sum_{h=2}^{H} V_h^2}{V_1^2}} \times 100\% $$

where \(V_h\) is the harmonic voltage amplitude and \(V_1\) is the fundamental amplitude. Our method achieved a THD below 2%, meeting IEEE standards for grid tied inverters.

Next, we introduced a 30% voltage sag fault at the grid tied inverter output. The CNN accurately estimated the fault, as shown in Figure 1, where the estimated voltage closely matches the actual sagged voltage of 350 V. The fault estimation error \(e_f\) is defined as:

$$ e_f = \frac{|V_{\text{actual}} – V_{\text{estimated}}|}{V_{\text{rated}}} \times 100\% $$

For the voltage sag case, \(e_f\) was less than 1%, demonstrating high precision. With the fault estimate, the integral sliding mode controller quickly compensated, restoring the grid tied inverter voltage to the nominal 500 V within 0.01 seconds. The transition was smooth, without overshoot or distortion.

To test disturbance rejection, we applied a step load disturbance of 380 V at 0.04 s for 0.06 s. The grid tied inverter voltage exhibited oscillations initially, but our controller stabilized it within 0.05 s. The control performance metrics, such as settling time \(t_s\) and peak overshoot \(M_p\), are summarized in Table 2.

Table 2: Performance Metrics of Grid Tied Inverter Control Under Disturbances
Scenario Settling Time \(t_s\) (s) Peak Overshoot \(M_p\) (%) THD (%)
Nominal Operation 0.005 0.5 1.8
30% Voltage Sag 0.01 1.2 2.1
Load Disturbance 0.05 2.0 2.3

Robustness was evaluated by varying the grid resistance \(R_g\) and inductance \(L_g\) within ±30% of their nominal values. The uncertainty probability \(p_u\) was defined as the deviation percentage. We measured the peak active power \(P_{\text{peak}}\) in per unit (p.u.), with a maximum allowable value of 1.5 p.u. The results, plotted in Figure 2, show that \(P_{\text{peak}}\) remains below 1.5 p.u. across all uncertainty levels, confirming the robustness of our method for grid tied inverters. The relationship between \(P_{\text{peak}}\) and \(p_u\) can be approximated by:

$$ P_{\text{peak}} = P_0 + \alpha p_u^2 $$

where \(P_0\) is the nominal peak power and \(\alpha\) is a small coefficient. Our controller maintains \(\alpha < 0.1\), indicating minimal sensitivity to parameter variations.

Furthermore, we compared our CNN-based ISMC with traditional PI control and conventional SMC. The comparison focused on response time, error reduction, and robustness. The integral absolute error (IAE) for grid current tracking was computed as:

$$ \text{IAE} = \int_0^T |e(t)| dt $$

where \(e(t)\) is the tracking error and \(T\) is the simulation time. Our method reduced IAE by over 40% compared to PI control and 25% compared to conventional SMC, highlighting its superiority for grid tied inverter applications.

Conclusion

In this article, we have presented a novel integrated sliding mode control method for single-stage grid tied inverters, enhanced by a Convolutional Neural Network. The approach effectively combines the fault estimation capabilities of CNN with the robustness of integral sliding mode control, addressing key challenges in PV grid integration. Through detailed mathematical modeling, we derived the state-space equations for the grid tied inverter and incorporated uncertainties and faults. The CNN, trained with adaptive regularization, accurately estimates faults from inverter output data, enabling proactive control adjustments. The integral sliding mode controller, designed with a dynamic compensation law, ensures fast convergence, disturbance rejection, and zero steady-state error.

Experimental results demonstrated that our method can swiftly restore normal operation under voltage sags and load disturbances, with minimal harmonic distortion and high robustness against parameter uncertainties. The grid tied inverter controlled by our approach maintains stable voltage and current waveforms, meeting power quality standards. Future work may explore real-time implementation on hardware platforms and extension to multi-level grid tied inverters. Overall, this research contributes to advancing control strategies for grid tied inverters, promoting the reliable integration of solar energy into the power grid.

Scroll to Top