Next Article in Journal
Investigating the Impact of Demand for the Internet of Things on the Saudi Digital Economy: Panel ARDL Approach
Previous Article in Journal
Ranking Port Criticality Under Climate Change: An Assessment of Greece
Previous Article in Special Issue
Enhancing Processing Time for Uncertainty Cost Quantification: Demonstration in a Scheduling Approach for Energy Management Systems
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Online Data-Driven Intelligent Control of Microgrids Using Koopman Operator Learning

by
Vladimir Toro
1,
Duvan Tellez-Castro
2 and
Eduardo Mojica-Nava
3,*
1
Department of Electronics Engineering, Universidad Santo Tomás, Cra. 9 No. 51-11, Bogotá 110311, Colombia
2
Systems Engineering, Universidad Distrital Francisco José de Caldas, Carrera 8 No. 40-62, Bogotá 110321, Colombia
3
Department of Electrical and Electronics Engineering, Universidad Nacional de Colombia, Cra. 30 No. 45-03, Bogotá 111321, Colombia
*
Author to whom correspondence should be addressed.
Sustainability 2025, 17(24), 11114; https://doi.org/10.3390/su172411114
Submission received: 8 November 2025 / Revised: 5 December 2025 / Accepted: 9 December 2025 / Published: 11 December 2025
(This article belongs to the Special Issue Intelligent Control for Sustainable Energy Management Systems)

Abstract

This paper presents a voltage controller for an alternating current microgrid, where the nonlinear optimization problem of voltage regulation is transformed into a linear one by employing a linear predictor based on an online extended dynamic mode decomposition algorithm. This approach enables an online finite-dimensional representation of the Koopman operator. The voltage regulator operates online by updating the state matrix with past and current measurements. The system dynamics are updated in real time using the most recent data pair, with a regularization term included to prevent ill-posedness. Furthermore, this paper proposes an online data-driven control scheme for voltage regulation in a microgrid, which leverages model predictive control to handle transmission line faults and load variations, while ensuring conditions for convergence and stability. The main results are validated by simulation in a 14-node IEEE testbed microgrid.

1. Introduction

Accurate voltage regulation in AC microgrids is essential for ensuring power quality, reliability, and system stability, especially under dynamic operating conditions and uncertain disturbance [1]. The growing integration of distributed energy resources has positioned microgrids as key building blocks of modern sustainable energy systems. Their ability to operate in both grid-connected and islanded modes improves resilience, power quality, and flexibility in energy management [2]. However, the proliferation of renewable sources such as solar and wind introduces significant operational challenges due to intermittency and the nonlinear behavior of power electronic converters. Among these challenges, voltage regulation in AC microgrids remains a critical problem, as it directly affects system stability, load sharing, and power quality under dynamic conditions [3]. Ensuring stable voltage profiles in the presence of varying loads, transmission line faults, and parameter uncertainties demands control strategies capable of adapting to rapidly changing system dynamics [4].
Traditional voltage control methods, including droop-based techniques, hierarchical control, and centralized model predictive control (MPC), have demonstrated satisfactory performance under nominal conditions [4]. Nevertheless, these approaches often rely on precise analytical models of the inverter and network dynamics, which are difficult to obtain in practice and prone to degradation as system parameters evolve [5,6]. Furthermore, purely model-based MPC formulations can become computationally intensive and less effective in the presence of modeling errors or unmodeled nonlinearities. As microgrids increasingly operate in uncertain and data-rich environments, there is a growing interest in data-driven control and learning-based modeling techniques that can capture complex dynamics directly from measurements while maintaining interpretability and stability guarantees.
Recently, the Koopman operator framework has emerged as a powerful data-driven approach for representing nonlinear dynamical systems in a lifted linear space, allowing the use of a linear control strategy for systems with nonlinear behaviors [7,8,9,10]. It also enables the identification of the dynamics of nonlinear systems and to design linear predictors for analysis and control [11,12,13]. The Extended Dynamic Mode Decomposition (EDMD) algorithm provides a practical numerical method to approximate the Koopman operator from measured data with explicit error bounds [14,15,16,17]. However, most Koopman-based identification and control methods are implemented offline, assuming stationary dynamics and fixed model parameters and using data obtained from detailed simulations or experimental environments [18]. In practice, this can be infeasible, since system parameters often change during operation, rendering the system time-varying. In [19], four algorithms are proposed to update the Koopman matrix online using system measurements: batch, windowed, minibatch, and online. The main objective is to update the state matrix while keeping the input and output matrices fixed, thereby reducing the computational cost per cycle. These algorithms were originally proposed for use with Dynamic Mode Decomposition (DMD) for simplicity, but depending on the chosen dictionary of functions, they can also be applied to EDMD. In each case, the state matrix is updated using the most recent pair of measurements, while the input and output matrices remain constant [20]. In least-squares-based techniques, the characteristics of the collected data may lead to an ill-posed problem or to overfitting. One common form of regularization addresses this by adding a penalty term to the objective function, favoring solutions with smaller norms. Following this approach, the online algorithm for updating the state matrix is enhanced by incorporating a regularization term. Once the linear state-space representation of the system is obtained, it can be used to design an MPC [11]. The resulting optimization problem features a convex cost function and linear constraints. To ensure convergence and stability of the algorithm, several conditions must be satisfied, such as the existence of the inverse of the data matrix when computing the Koopman operator via EDMD.
In Microgrid (MG) applications, where disturbances can abruptly alter system conditions, an online Koopman learning mechanism is essential to maintain accuracy and adaptivity. Particularly in islanded MGs, inverters interact by sharing power while maintaining voltage and frequency regulation [5]. The interconnected nature of MGs makes it difficult to construct accurate system models, especially in the presence of transmission line changes, system faults, load variations, and parameter modifications. Consequently, online algorithms are well-suited for secondary and supervisory control, as they allow certain system parameters to be updated in real-time. Recently, several works have applied the Koopman operator and its data-driven framework to control design in the context of power systems and microgrids [3,21,22,23,24,25,26,27,28]. A large-signal linear model of an MG based on the Koopman operator is presented in [22], where the selection of observables and control inputs is considered for voltage regulation using a linear quadratic integrator. Unlike the analytically derived Koopman-based large-signal model, the proposed approach is fully data-driven and updated in real time. An alternative approach is proposed in [23,26], where online data-driven secondary controllers based on an observer Kalman filter for voltage regulation in MGs are introduced, but with the same computational limitations as traditional DMD. Finally, secondary voltage control for MGs [3] and for active distribution networks [28], using a static Koopman-based approach, is presented.
In this paper, we propose an online data-driven voltage control scheme for AC microgrids that combines Koopman operator learning with MPC. The proposed framework transforms the nonlinear voltage regulation problem into a linear optimization problem by employing an EDMD-based linear predictor that captures the microgrid’s nonlinear inverter dynamics. The Koopman state matrix is updated in real-time using the most recent pair of measurements, ensuring the controller continuously adapts to system variations. To mitigate potential ill-conditioning during online updates, a regularization term is incorporated into the learning process, guaranteeing numerical stability. The updated Koopman model is then embedded into an MPC structure to compute the optimal control inputs that minimize voltage deviations and maintain system performance under load disturbances.
The main contribution of this paper lies in the development of an online data-driven voltage control framework for AC microgrids that combines Koopman operator theory with MPC to address nonlinear dynamics and operational uncertainties. Compared with traditional online DMD [19], the proposed online regularized EDMD features three improvements. First, while online DMD relies on linear state measurements, our method uses a richer set of nonlinear observables, enabling more accurate representation of inverter and microgrid dynamics under large-signal and weak-grid conditions. Second, the inclusion of a regularization term in the recursive update mitigates numerical drift, noise amplification, and ill-conditioning issues that commonly degrade online DMD during persistent adaptation. Third, the proposed scheme maintains stable model updates even when excitation is low or operating points evolve slowly, whereas online DMD typically suffers from loss of prediction fidelity in these scenarios. As a result, the online regularized EDMD provides more reliable real-time prediction and control compatibility for inverter-dominated microgrids than traditional online DMD.
The remainder of this paper is organized as follows. Section 2 describes the general features of microgrids and the associated control approaches. Section 3 presents the online algorithm for determining the Koopman operator and its main features. Section 4 details the design of the online Koopman controller along with the conditions for convergence and stability. Section 5 discusses simulation scenarios under several cases. Finally, Section 6 provides the conclusions.

2. Microgrid Voltage Control

The MG is defined as a cyber-physical system within a specific area that integrates generators, storage systems, and loads. Its proper operation requires a hierarchical control framework. The lower levels are associated with voltage and current regulation, synchronization with the utility grid, and the provision of virtual inertia. The first layer is typically implemented through droop control, which enables the parallel connection of sources while ensuring proper power-sharing. The second layer maintains voltage and frequency at their reference values [29].
The general scheme of the AC MG is shown in Figure 1. The blocks represent the hierarchical framework for primary, voltage, and current control, and also include the LC output filter. The power flow among inverters is governed by a set of nonlinear equations involving the phase differences between inverter voltages, the voltage magnitudes, and the transmission line impedances. The general expressions for active and reactive power are given by
P i = G i i V i 2 k N i n ( G i k cos ( δ i k ) + B i k sin ( δ i k ) ) V k V i
Q i = B i i V i 2 + k N i n ( B i k cos ( δ i k ) + G i k sin ( δ i k ) ) V k V i ,
where G i i denotes the self-admittance, V i is the voltage magnitude, and N i is the set of neighboring nodes of the i th bus. Similarly, V k is the voltage magnitude of the k th node, G i k and B i k are the conductance and susceptance of the line connecting nodes i and k, respectively, and δ i k is the phase angle difference between them.
The instantaneous power in (1) and (2) can be simplified by assuming a predominantly inductive transmission line, where R i k 0 and X i k R i k . These conditions can be achieved by introducing a feedback loop with a virtual impedance that emulates the effect of an inductance, Z v ( s ) = L v s where L v is proportional to the magnitude of the current measured at the inverter output. Although this behavior can be approximated by placing a large physical inductor at the inverter terminals, the use of virtual impedance allows emulating significantly larger inductance values without increasing the hardware size. Under the additional assumption of δ i k π 2 , which guarantees a synchronized motion state, i.e., coordinated evolution of generator phase angles and frequencies [30]. Under synchronized motion, all inverter-based distributed generators converge to a common steady-state synchronization frequency, and their electrical angles exhibit a uniform phase shift consistent with coherent network operation. This condition reflects the fundamental requirement that all sources supplying an islanded microgrid operate in synchronism to sustain voltage, maintain frequency, and preserve active and reactive power balance. Therefore, establishing synchronized motion is a prerequisite for ensuring feasible power exchange among units and guaranteeing stable power balance within the islanded microgrid.
Based on the previous assumptions, the power equations are simplified as follows
P i = G i i V i 2 k N i n B i k V k V i
Q i = B i i V i 2 + k N i n G i k V k V i .
Then, the instantaneous reactive power becomes directly related to the voltage magnitude. One of the main advantages of this approach is the elimination of phase-angle dependence, thereby avoiding the inherent difficulty of measuring this variable.
By adopting the decoupling of active and reactive power implied by the lossless condition in the transmission lines, the reactive power in the network is controlled by adjusting the voltage set point of each inverter. The voltage droop equation is of the form
V i = V r e f n q i Q m , i + u i ,
where V ref is the reference voltage, n q i is the droop coefficient for reactive power, u i is the secondary control input, and Q m , i is the average reactive power.
The average reactive power is obtained by filtering the instantaneous reactive power from (4).
Q m , i = Q i 1 τ s + 1 .
The previous expression can be expressed as a differential equation as follows:
Q m , i τ s + Q m , i = Q i τ Q ˙ m , i + Q m , i = Q i .
Reorganizing
τ i V ˙ i = V r e f , i n q i ( Q i ) + u i .
Equation (8) is presented in discrete-time as follows
V k + 1 i = V k i + T s V k i n q i Q k i + u k i ,
where T s is the sampling time, and u i is the secondary control input. Finally, replacing the reactive power (4) we obtain
V k + 1 i = V k i + T s V k i n q i B i i ( V i ) 2 + j N i n G i j V j V i + u k i .
Therefore, the voltage at the i th node depends on the product of the voltage measured at that node and the voltages of its neighboring nodes, the square of the voltage at that node, and the susceptance between nodes. The voltage is governed by a nonlinear equation, which implies a non-convex optimization problem leading to several well-known limitations that hinder both analysis and real-time implementation. On the ond hand, nonconvexity introduces multiple local minima, meaning that optimization algorithms can converge to suboptimal solutions depending on the initial conditions. On the other hand, nonconvex optimization problems are generally computationally intractable for real-time control, as they require iterative nonlinear solvers that may not converge within practical time limits. In microgrid control, where decision horizons are small and control loops operate at millisecond scales, such computational delays can compromise system stability.
To overcome these challenges, this paper reformulates the nonlinear voltage regulation problem into a linear predictive control problem using the Koopman operator framework. By lifting the nonlinear microgrid dynamics into a higher-dimensional but linear space via online EDMD, the proposed approach preserves essential nonlinear behavior while enabling convex optimization in the lifted coordinates. This transformation eliminates the dependence on local linearization around equilibrium points, ensures a globally linear prediction model, and allows the use of efficient programming solvers within an MPC framework. Consequently, the controller achieves real-time performance, theoretical tractability, and robustness to modeling uncertainties, thereby addressing the main limitations of nonconvex formulations in microgrid voltage control. In the next section, the main theoretical foundations of the proposed online EDMD for MPC of microgrids is introduced.

3. Online Extended Dynamic Mode Decomposition

Dynamic Mode Decomposition has become a powerful technique for analyzing nonlinear systems. It is based on Arnoldi’s algorithm and is closely related to the Koopman operator. DMD provides a finite-dimensional approximation of the Koopman operator in matrix form. The most common DMD algorithm relies on Singular Value Decomposition (SVD), which also enables dimensionality reduction by retaining only the most significant singular values [31]. Consider a dynamical discrete-time system of the form
x k + 1 = T x k ,
where T : x x is a nonlinear mapping, with x C n . A set of M measurements from the system is collected and organized as
X = x 1 x 2 x M 1 , Y = x 2 x 3 x M .
The exact DMD algorithm determines the system matrix by directly applying the pseudo-inverse of the data matrix
A = Y X ,
where † denotes the Moore–Penrose pseudo-inverse of X. This problem can be formulated as the following minimization problem
min A | | A X Y | | F ,
where | | · | | F denotes the Frobenius norm. DMD uses direct measurements from the system. This approach can be extended by employing a dictionary of basis functions, which may be nonlinear, known as EDMD. The dictionary of N k functions is defined as
D = ψ 1 , ψ 2 , , ψ N k ,
where each ψ i F spans the function space F , with F D F [32]. Then, the set of measurements is evaluated using the following vector-valued function
Ψ ( x ) = ψ 1 ( x ) ψ 2 ( x ) ψ N k ( x ) ,
where Ψ : M C 1 × N k . The following two matrices are defined as
G = 1 M m = 1 M Ψ ( x m ) Ψ ( x m ) , H = 1 M m = 1 M Ψ ( y m ) Ψ ( y m ) ,
and the approximate Koopman matrix A is given by
A = G H ,
where G, H, and A C N k × N k . This data-driven approach can be employed to obtain a finite-dimensional Koopman approximation, where the nonlinear system is approximated by a linear one. The same method can be extended to include input terms, leading to the following representation
min A , B A X + B U Y F ,
where the input vector is defined as
U = [ u 1 , u 2 , , u M 1 ] .
After establishing the data-driven formulation of DMD and EDMD, the next subsection presents their extension to an online framework that enables recursive real-time updates of the Koopman matrix.

3.1. Online EDMD Algorithm

As mentioned in the previous section, the voltage regulation problem in AC microgrids is inherently nonlinear due to the complex dynamics of power electronic inverters, the coupling between distributed generation units, and the nonlinear characteristics of loads and transmission lines. These limitations collectively restrict the scalability and robustness of conventional nonlinear voltage controllers. A key contribution of this paper is the introduction of an online EDMD algorithm that continuously updates the Koopman operator as new data become available. First, recall that the Koopman matrix is determined using DMD or EDMD by solving A = Y X . This relation can be rearranged to establish the following assumption.
Assumption 1.
X k is full rank with X k X k invertible.
The inverse matrix can be written as
X k = X k ( X k X k ) 1
The set of measurements is arranged using the last pair of samples from the system. At time k, the measurements are given by
X k = [ x 1 x 2 x k ] , Y k = [ y 1 y 2 y k ] ,
and the vector containing the last pair of arriving measurements is written as
X k + 1 = [ x 1 x 2 x k + 1 ] , Y k + 1 = [ y 1 y 2 y k + 1 ] ,
then matrix A k is updated as A k + 1 at time k + 1 . Combining (12) and (20), the state matrix is written as
A = Y k X k ( X k X k ) 1 = Q K P k ,
where Q k , and P k are given by
Q k = Y k X k P k = ( X k X k ) 1 ,
where P k , Q k C n × n are full rank, which guarantees the existence of the inverse of P k . As the new measurements x k + 1 and y k + 1 arrive, Q k + 1 and P k + 1 are set by adding an extra column as follows
Q k + 1 = Y k + 1 X k + 1 = Y k X k + y k + 1 x k + 1 ,
P k + 1 1 = X k + 1 X k + 1 = X k X k + x k + 1 x k + 1 .
Matrices Q k + 1 , P k + 1 can be found as
Q k + 1 = Q k + y k + 1 x k + 1 , P k + 1 1 = P k 1 + x k + 1 x k + 1 .
Finally, the DMD matrix is given by
A k + 1 = Q k + 1 P k + 1 = ( Q k + y k + 1 x k + 1 ) ( P k 1 + x k + 1 x k + 1 ) 1 .
The previous update requires computing two matrix inverses, which is computationally demanding with complexity O ( n 3 ) . This inverse can be simplified by applying the Sherman–Morrison formula. The final expression for the matrix A k + 1 is given by
A k + 1 = A k + γ k + 1 ( y k + 1 A k x k + 1 ) + x k + 1 P k ,
with
γ k + 1 = 1 1 + x k + 1 P k x k + 1 .
Updating the matrix A k + 1 requires P k to be well-defined. The construction of the vector X k requires a sufficient number of samples so that the inverse exists. The initial matrix A 0 can be set as a random matrix, while P 0 = α I , where α is a large positive scalar [19]. This online DMD algorithm can be extended to EDMD by replacing the direct measurements with those obtained from the dictionary of functions [19].

3.2. Ridge (Tikhonov) Regularization Method

To avoid overfitting and to reduce the computational complexity, we introduce a regularization procedure for the online EDMD as follows. From data points x k with perturbation norm bounded, the deterministic perturbation is defined as
δ x k = x k + δ , δ Δ ,
where Δ is the uncertainty set. The uncertainty set can be defined as
Δ : = δ R n : | | δ | | 2 ρ ,
where ρ is a restriction value for the 2-norm of δ . The presence of uncertainty enlarges the residual term, whereas the approximation of the Koopman operator seeks to minimize it. Consider matrices G and H introduced in (16). Hence, the problem can be cast as the following min–max optimization problem
min A max δ Δ ¯ | | ( G + δ G ) A H | | F ,
where G R K × K , A C K × K , and δ G R K × K is the new perturbation term assumed to belong to Δ ¯ and perturbing the entries of matrix G.
The above problem is usually non-convex and depends on the choice of dictionary functions. By selecting functions such as Gaussian, radial, and linear functions, the min–max optimization problem becomes convex. The equivalence between the robust optimization problem (33) and the ridge regularization can be established, which implies that the following two optimization problems are equivalent
min A max δ G Δ ¯ | | ( G + δ G ) A A | | F min A | | G A H | | F 2 + c | | A | | F 2 .
Solving the optimization problem to determine the state matrix using the EDMD algorithm requires computing an inverse matrix. However, the characteristics of the collected data may lead to ill-conditioned systems. To obtain a more reliable solution, it is necessary to use regularization methods, such as ridge regression (34). Regularization favors solution matrices with smaller norms. As the parameter c increases, the variance decreases, but the bias increases. Conversely, as c decreases, the variance grows while the bias decreases. Thus, there is a trade-off between these two factors depending on the selection of c [33,34]. In this way, we obtain the following optimization problem
min A k k = 1 K | | A k X k Y k | | F 2 + c | | A k | | F 2 ,
whose solution is given by
A k = P k Q k = Y k X k ( X k X k + c I ) 1 ,
with
P k = ( X k X k + c I ) 1 Q k = Y k X k
Similarly, the next step is given by
P k + 1 1 = X k + 1 X k + 1 + c I = ( X k X k + c I ) + x k + 1 x k + 1 = P k 1 + x k + 1 x k + 1
Q k + 1 = Y k + 1 X k + 1 = Y k X k + y k + 1 x k + 1 = Q k + y k + 1 x k + 1
Following the structure used in [19], the updated matrix is given by
A k + 1 = Q k + 1 P k + 1 = ( Q k + y k + 1 x k + 1 ) ( P k γ k + 1 P k x k + 1 x k + 1 P k ) = Q k P k γ k + 1 Q k P k x k + 1 x k + 1 P k + y k + 1 x k + 1 P k γ k + 1 y k + 1 x k + 1 P k x k + 1 x k + 1 P k = A k γ k + 1 A k x k + 1 x k + 1 P k + y k + 1 x k + 1 P k γ k + 1 y k + 1 x k + 1 P k x k + 1 x k + 1 P k = A k γ k + 1 ( A k x k + 1 ) ( x k + 1 P k ) + γ k + 1 ( y k + 1 A k x k + 1 ) ( x k + 1 P k ) = A k + γ k + 1 ( y k + 1 A k x k + 1 ) ( x k + 1 P k ) .
with
γ k + 1 = 1 1 + x k + 1 P k x k + 1 .
We then obtain
A k + 1 = A k + 1 1 + x k + 1 ( X k X k + c I ) 1 x k + 1 y k + 1 A k x k + 1 x k + 1 ( X k X k + c I ) 1 .
The regularization process can be applied to the identification of controlled models. For an input vector U = [ u 0 , , u m ] , the state and input matrices can then be obtained by solving the following optimization problem
[ A B ] = arg min i = 0 M | | y i A x i B u i | | .
The previous problem can be extended to the lifted space using a set of basis functions. The state and input matrices in the lifted space, A and B , can be calculated with regularization by solving the following problem
min A , B | | Ψ ( Y ) A Ψ ( X ) B U | | F + γ 1 | | A | | 1 + γ 2 | | B | | 1 .
In the next section, we present the proposed online EDMD applied to the voltage control problem of microgrids.

4. Online EDMD for Voltage Control of Microgrids

The algorithm presented in the previous section is applied to voltage regulation in a microgrid, following the model described in Section 2. First, we define the dictionary of functions used to approximate the Koopman operator via EDMD. From this set of functions, we start by including the direct voltage measurements, their squared values, and the products of voltages between nodes i and j.
D = V i V j V i 2 V j 2 V i V j
This dictionary of functions corresponds to a regulation problem in which the voltage measurements are required to reach the reference value. Alternative dictionaries allow the formulation of a tracking problem by including the error e i = V ref V i in each function as follows
D = e i e j e i 2 e j 2 e i e j .
The nonlinear system described in (9) is represented in the lifted space through the Koopman approximation matrices A , B , and C . For secondary control, the signal u i is designed to correct voltage deviations while minimizing the control effort. MPC is a general framework for control and optimization that approaches the optimal solution by making decisions at each control step. MPC predicts future system behavior over a finite horizon based on a process model. In this case, the Koopman approximation provides a linear predictor for forecasting the future states of the nonlinear system. Based on this framework, the following MPC problem is formulated
min u R n | | V i | | Q 2 + | | u | | R 2 s . t . y i = A x + B u , V i = C y i , V m i n V i V m a x , u m i n u i u m a x .
It is worth noting that the proposed control law (38) operates in a decentralized fashion, since each inverter relies exclusively on local information. Specifically, each inverter has access only to the voltage of the inverter with which it is physically interconnected. The convergence of the control algorithm (38) depends on the structure of the cost function and the constraints imposed by the linear representation of the voltage. Some approaches for solving the optimization problem in distributed systems have been presented in [3].
The optimization problem (38) is implemented online using the updated state matrix from (29) as
min u i R n | | V i | | Q 2 + | | u i | | R 2 s . t . x k + 1 i = A k i x k i + B i u k i , V i = C i x k i , A k + 1 i = A k i + γ k + 1 i ( y k + 1 A k i x k + 1 ) + x k + 1 P k i , γ k + 1 i = 1 1 + x k + 1 P k i x k + 1 .
The online EDMD voltage control of MGs is characterized as follows. MGs are initialized with A 0 , B 0 , and C 0 , which are obtained from preceding data. A 0 is set as a scaled matrix A 0 = c I n , with c R + . The update of the matrix is triggered by system perturbations or executed at every update period T u , throughout this process, B and C are kept constant. To ensure reliable computation of the EDMD matrices, the data signals are filtered and saturated to remove values that might otherwise distort the estimation. The main steps os the online EDMD for voltage control of MGs is summarized in Figure 2. The following assumptions are introduced to guarantee the conditions for the convergence of the algorithm (Figure 2).
Assumption 2.
The observables ψ ( x ) are assumed to be Lipschitz continuous.
Within the set of observables defined in (37), the functions e i and e j are globally Lipschitz with constant L = 1 . Their squares, e i 2 and e j 2 , as well as the product e i e j , are locally Lipschitz.
Assumption 3.
Matrices defining the initial system dynamics, A 0 , B 0 , and C 0 , are provided.
Assumption 4.
The pairs ( A 0 , B 0 ) and ( A 0 , C 0 ) are controllable and observable, respectively.
In Assumption 4, the controllability and observability conditions can be verified explicitly by assessing the controllability and observability properties of A 0 , B 0 , and C 0 .
Assumption 5.
Each agent has access to real-time local measurements, which are used to update the system matrices. The state and input data, X and U, are drawn from a normal probability distribution.
Assumption 6.
During each update, the matrices preserve their full-rank property. Moreover, the data used for updates are free of high-frequency components that might compromise the accuracy of the matrix computation.
We have introduced the main concepts and conditions for the online EDMD algorithm for voltage control of microgrids. In the following theorem, we present the main convergence result.
Theorem 1.
The linear predictive-based controller in the lifted space with matrices A 0 , B 0 , and C 0 from (39), with the predictor updated through P at instants T u and satisfying Assumptions (3)–(6), guarantees asymptotic stability of the origin of the closed-loop lifted system. In particular, if the weighting matrices satisfy Q > 0 and R 0 , then the state and control sequences generated by the controller satisfy
x k 0 and u k 0 as k .
Proof. 
At each time instant k, the control input u k is obtained by solving the MPC optimization problem (39), which minimizes the quadratic stage cost
( x k , u k ) : = C 0 x k Q 2 + u k i R 2 ,
subject to the lifted linear predictor
x k + 1 = A 0 x k + B 0 u k
Let V k be the optimal value function of the MPC problem given by
V k = min { u k , , u k + N 1 } j = 0 N 1 C 0 x k + j Q 2 + u k + j R 2 ,
in other words, V k : = J ( x k ) at time k. Since Q > 0 and R 0 , the stage cost ( x k , u k ) is positive definite with respect to the state and nonnegative with respect to the input. Therefore, there exist class- K functions α 1 and α 2 such that
α 1 ( x k ) V k α 2 ( x k ) ,
which implies that V k is positive definite and radially unbounded.
Using the standard shifting argument from MPC theory, the optimal value function satisfies the discrete-time Lyapunov inequality
V k + 1 V k ( x k , u k ) = C 0 x k Q 2 u k R 2 0 .
Hence, { V k } is a non-increasing sequence bounded from below by zero, and therefore it converges as k . Furthermore,
k = 0 C 0 x k Q 2 + u k R 2 < ,
which implies
C 0 x k Q 2 0 and u k R 2 0 as k .
Since Q > 0 , the condition C 0 x k Q 2 0 implies C 0 x k 0 . Finally, the update through P preserves the stabilizing and observable properties of the closed-loop system, ensuring that the Lyapunov decrease property holds for all times. Consequently, the origin of the closed-loop lifted system is asymptotically stable, and both the state and control input converge to zero as k . □
We have presented the main results for the online EDMD voltage control algorithm. This adaptive learning mechanism provides several distinct advantages such as real-time adaptability, reduced model dependency, improved numerical stability since a regularization term is introduced to prevent ill-posedness during online updates, ensuring smooth adaptation and bounded estimation errors, and enhanced control performance; by updating the predictive model online, the MPC layer can react promptly to new operating conditions, guaranteeing stable voltage regulation even under rapid transients. In the next section, we validate the proposed method by simulation in a 14-node IEEE model.

5. Simulation Results

In this section, we present the simulation results using an IEEE 14-node testbed MG shown in Figure 3. This particular example of a small microgrid with five distributed generators is well aligned with the scale and operational requirements commonly found in Latin American rural electrification initiatives, where dispersed agricultural communities, indigenous settlements, and remote villages often lack reliable grid access or experience frequent service interruptions. In these environments, energy supply is typically built around a mix of renewable resources, such as solar photovoltaics and small wind units, complemented by battery storage and occasionally diesel backup, resulting in a generation mix that naturally reflects a five-unit configuration. At this scale, coordinated control becomes essential to maintain voltage and frequency stability under fluctuating loads, seasonal resource variability, and limited technical supervision. Furthermore, such a configuration captures the realities of infrastructure constraints in the region, including limited transmission capacity, decentralized usage patterns, and progressive expansion as communities grow, reflecting the operational and socio-technical conditions characteristic of rural electrification projects across Latin America. The entire system is implemented in Simulink®, while the optimization is carried out through YALMIP using the solver Gurobi. The parameters of the MG are provided in Table 1. The transmission line parameters are the same used in the benchmark presented in [3], and the load at each MG node is defined as 1 kW.
First, to illustrate a comparison between the different presented Koopman-based learning methods approximating the noisy data, the system output evolution over a period of 100 s is shown in Figure 4. The original dataset is shown in green, while the same dataset with added noise appears in black. The corresponding approximations are presented as follows: the Koopman approximation in violet, the Koopman approximation with noisy data in red, and finally, the Koopman approximation with regularization is shown in blue. For the single-inverter model, the evolution of the eigenvalues is shown in Figure 5. During the initial iterations, the eigenvalues deviate significantly from those computed with the standard EDMD. However, after a few iterations, they converge to similar values. Starting from an identity state matrix, the eigenvalues shift from left to right along the real axis.

5.1. Load Changing Simulations

The MPC parameters are summarized in Table 2. The MG begins operation with no loads connected at the initial instant. At t = 2 s, five loads of 2 kVar are connected to nodes 3, 5, 6, 9, and 14. Each inverter is initialized with a stored set of measurements large enough to ensure that the matrix P k is invertible. In particular, each inverter retains 1000 samples of e i and e j values, while the initial state matrix is set to A 0 = I n . Matrices B 0 and C 0 are maintained unchanged, as obtained from a preceding iteration. Figure 6a illustrates the output voltage of each inverter. Following the load change at t = 2 s, voltage oscillations occur at all inverter outputs. Then, voltages stabilize within one second and remain close to the reference value, with deviations below 0.05 V. The current at each inverter is shown in Figure 6b, where inverter 1 supplies the larger quantity. It is observed that the current response has a stable steady state and a small overshoot with a rapid response. Similarly, the reactive power of each inverter is depicted in Figure 7, where inverters 4 and 5 exhibit similar values.
The load-changing simulations demonstrate the capability of the proposed online EDMD-based predictive controller to maintain voltage stability under dynamic operating conditions. When step variations in the load were introduced, the controller rapidly adjusted the inverter control inputs to compensate for the resulting voltage deviations. The voltage magnitude recovered to its nominal reference value within a short transient period, showing minimal overshoot and fast settling time. This behavior confirms the effectiveness of the Koopman-based linear predictor in capturing the nonlinear dynamics associated with load perturbations.
Compared with conventional model-based MPC or static linearized controllers, the proposed method exhibited superior adaptability. This improvement arises from the online update of the Koopman matrix, which continuously refines the lifted-state model based on recent input–output data. As the system experienced load changes, the online learning mechanism adjusted the internal model to reflect the updated operating point, resulting in more accurate predictions and smoother control actions. Furthermore, the inclusion of the regularization term in the EDMD update prevented numerical instability during abrupt load variations, ensuring consistent performance across all scenarios.

5.2. Transmission Line Failure Simulations

For transmission line simulation, the MG begins with 2kvar loads connected to the nodes 3, 5, 6, 9, and 14. Then, at t = 10 s, transmission line B18 is opened, and nodes 10 and 11 are disconnected. The transmission line failure simulations are conducted to evaluate the fault-tolerant capability and dynamic resilience of the proposed online EDMD-based Koopman–MPC controller. When a line outage occurred at t = 10 s, the microgrid experienced a sudden change in network topology and power flow distribution, resulting in transient voltage imbalances across the inverter buses, as shown in Figure 8. Despite the abrupt disturbance, the controller promptly adapted its predictive model and restored the voltage profiles to their nominal values with minimal overshoot and oscillation.
Similarly, reactive power transient response at each inverter is shown in Figure 9, where a small variation of the steady state is observed at t = 10 s. The simulation results show that the online learning feature of the EDMD algorithm played a crucial role in this performance. Immediately after the fault, the Koopman operator is updated using the latest measurement data, effectively capturing the new post-fault system dynamics. This real-time model adaptation allowed the MPC layer to recompute optimal control inputs that compensated for the altered coupling between distributed generators. As a result, the system maintained stable operation without requiring manual reconfiguration or prior fault information (see Figure 9). The proposed online Koopman–MPC approach exhibited faster recovery times and improved voltage regulation accuracy under fault conditions (see Figure 8). Moreover, the inclusion of the regularization term in the online EDMD update ensured numerical stability, preventing abrupt parameter shifts or ill-conditioned estimates during the transient. The smooth evolution of the Koopman model enabled consistent and stable control action even under severe network disturbances.

5.3. Comparison Between EDMD Algorithm and the Online EDMD Algorithm

In this subsection, a comparison is presented between a similar online EDMD-based algorithm that does not dynamically update the Koopman matrix and its offline counterpart. As in the previous load-changing scenario, the focus is placed on inverter one; the load is connected at t = 2 s. The output voltage of inverter one is shown in Figure 10. It is clear that the voltage stabilization response is better for the online algorithm both at the system start at t = 0 s and when the load is connected at t = 2 s. The online algorithm reaches its steady-state value in less than one second, whereas the offline algorithm takes more than two seconds.

6. Conclusions and Future Work

This work presents a data-driven online control strategy for a microgrid, where the nonlinear dynamics of the inverters are represented in a lifted space via online EDMD and the Koopman operator. The proposed online algorithm can update the Koopman matrix with the most recent data pair. The online EDMD-based Koopman learning with regularization establishes a connection between nonlinear system representation and convex optimization. It enables a computationally efficient, data-driven, and adaptive voltage control strategy that retains both the interpretability of linear control theory and the expressive power of nonlinear dynamics, overcoming the core limitations of nonconvex formulations in microgrid voltage regulation. The conditions for the algorithm’s convergence are also established. Finally, the effectiveness of the proposed method is validated in a microgrid model for voltage regulation under transmission line faults and load variations. On the other hand, the proposed work validation has been restricted to numerical simulations, and no laboratory experiments have yet been conducted. As a consequence, the method’s robustness against real-world issues, such as sensor noise and communication delays, is still in progress.
As future work, these limitations highlight the need for experimental studies to fully assess the practical feasibility and scalability of the proposed strategy in real inverter-based microgrid environments.

Author Contributions

Conceptualization, V.T., D.T.-C. and E.M.-N.; methodology, V.T. and D.T.-C.; software, V.T. and D.T.-C.; investigation, V.T., D.T.-C. and E.M.-N.; writing—original draft preparation, V.T.; writing—review and editing, D.T.-C. and E.M.-N.; visualization, V.T.; supervision, E.M.-N. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The original contributions presented in this study are included in the article. Further inquiries can be directed to the corresponding author.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Lasseter, R.H. Microgrids and distributed generation. J. Energy Eng. 2007, 133, 144–149. [Google Scholar] [CrossRef]
  2. Rodriguez-Gil, J.A.; Mojica-Nava, E.; Vargas-Medina, D.; Arevalo-Castiblanco, M.F.; Cortes, C.A.; Rivera, S.; Cortes-Romero, J. Energy management system in networked microgrids: An overview. In Energy Systems; Springer: Berlin/Heidelberg, Germany, 2024; pp. 1–32. [Google Scholar]
  3. Toro, V.; Tellez-Castro, D.; Mojica-Nava, E.; Rakoto-Ravalontsalama, N. Data-driven distributed voltage control for microgrids: A Koopman-based approach. Int. J. Electr. Power Energy Syst. 2023, 145, 108636. [Google Scholar] [CrossRef]
  4. Moustakas, K.; Loizidou, M.; Rehan, M.; Nizami, A. A review of recent developments in renewable and sustainable energy systems: Key challenges and future perspective. Renew. Sustain. Energy Rev. 2020, 119, 109418. [Google Scholar] [CrossRef]
  5. Schiffer, J.; Zonetti, D.; Ortega, R.; Stanković, A.M.; Sezi, T.; Raisch, J. A survey on modeling of microgrids—From fundamental physics to phasors and voltage sources. Automatica 2016, 74, 135–150. [Google Scholar] [CrossRef]
  6. Macana, C.A.; Mojica-Nava, E.; Pota, H.R.; Guerrero, J.; Vasquez, J.C. A distributed real-time energy management system for inverter-based microgrids. Electr. Power Syst. Res. 2022, 213, 108753. [Google Scholar] [CrossRef]
  7. Budišić, M.; Mohr, R.; Mezić, I. Applied koopmanism. Chaos Interdiscip. J. Nonlinear Sci. 2012, 22, 047510. [Google Scholar] [CrossRef] [PubMed]
  8. Rowley, C.W.; Mezi, I.; Bagheri, S.; Schlatter, P.; Henningson, D.S. Spectral analysis of nonlinear flows. J. Fluid Mech. 2009, 641, 115–127. [Google Scholar] [CrossRef]
  9. Colbrook, M.J.; Townsend, A. Rigorous data-driven computation of spectral properties of Koopman operators for dynamical systems. Commun. Pure Appl. Math. 2024, 77, 221–283. [Google Scholar] [CrossRef]
  10. Rahmani, M.; Redkar, S. Optimal DMD Koopman Data-Driven Control of a Worm Robot. Biomimetics 2024, 9, 666. [Google Scholar] [CrossRef] [PubMed]
  11. Korda, M.; Mezić, I. Linear predictors for nonlinear dynamical systems: Koopman operator meets model predictive control. Automatica 2018, 93, 149–160. [Google Scholar] [CrossRef]
  12. Mauroy, A.; Susuki, Y.; Mezic, I. Koopman Operator in Systems and Control; Springer: Berlin/Heidelberg, Germany, 2020; Volume 7. [Google Scholar]
  13. Han, P.; Xu, J.; Rong, L.; Wang, W.; Sun, Y.; Lin, G. Data-Driven Control Method Based on Koopman Operator for Suspension System of Maglev Train. Actuators 2024, 13, 397. [Google Scholar] [CrossRef]
  14. Korda, M.; Mezić, I. On Convergence of Extended Dynamic Mode Decomposition to the Koopman Operator. J. Nonlinear Sci. 2018, 28, 687–710. [Google Scholar] [CrossRef]
  15. Tu, J.H.; Rowley, C.W.; Luchtenburg, D.M.; Brunton, S.L.; Kutz, J.N. On dynamic mode decomposition: Theory and applications. J. Comput. Dyn. 2014, 1, 391–421. [Google Scholar] [CrossRef]
  16. Köhne, F.; Philipp, F.M.; Schaller, M.; Schiela, A.; Worthmann, K. L-error Bounds for Approximations of the Koopman Operator by Kernel Extended Dynamic Mode Decomposition. SIAM J. Appl. Dyn. Syst. 2025, 24, 501–529. [Google Scholar] [CrossRef]
  17. Mohr, R.; Fonoberova, M.; Mezić, I. Koopman Reduced-Order Modeling with Confidence Bounds. SIAM J. Appl. Dyn. Syst. 2025, 24, 2070–2101. [Google Scholar] [CrossRef]
  18. Anantharaman, R.; Mauroy, A. Koopman operator based identification of nonlinear networks. Nonlinear Dyn. 2025, 113, 27031–27051. [Google Scholar] [CrossRef]
  19. Zhang, H.; Rowley, C.W.; Deem, E.A.; Cattafesta, L.N. Online dynamic mode decomposition for time-varying systems. SIAM J. Appl. Dyn. Syst. 2019, 18, 1586–1609. [Google Scholar] [CrossRef]
  20. Redman, W.T.; Huang, D.; Fonoberova, M.; Mezić, I. Koopman learning with episodic memory. Chaos Interdiscip. J. Nonlinear Sci. 2025, 35, 011102. [Google Scholar] [CrossRef] [PubMed]
  21. Tellez-Castro, D.; Garcia-Tenorio, C.; Mojica-Nava, E.; Sofrony, J.; Vande Wouwer, A. Data-driven predictive control of interconnected systems using the koopman operator. Actuators 2022, 11, 151. [Google Scholar] [CrossRef]
  22. Ma, Z.; Wang, Z.; Cheng, R. Analytical Large-Signal Modeling of Inverter-based Microgrids with Koopman Operator Theory for Autonomous Control. IEEE Trans. Smart Grid 2023, 15, 1376–1387. [Google Scholar] [CrossRef]
  23. Gong, X.; Wang, X. A novel Koopman-inspired method for the secondary control of microgrids with grid-forming and grid-following sources. Appl. Energy 2023, 333, 120631. [Google Scholar] [CrossRef]
  24. Lan, Y.; Mezić, I. Linearization in the large of nonlinear systems and Koopman operator spectrum. Phys. D Nonlinear Phenom. 2013, 242, 42–53. [Google Scholar] [CrossRef]
  25. Sinha, S.; Nandanoori, S.P.; Yeung, E. Data driven online learning of power system dynamics. In Proceedings of the 2020 IEEE Power & Energy Society General Meeting (PESGM), Montreal, QC, Canada, 2–6 August 2020; IEEE: Washington, DC, USA, 2020; pp. 1–5. [Google Scholar]
  26. Gong, X.; Wang, X.; Joos, G. An online data-driven method for microgrid secondary voltage and frequency control with ensemble Koopman modeling. IEEE Trans. Smart Grid 2022, 14, 68–81. [Google Scholar] [CrossRef]
  27. Jiang, X.; Li, Y.; Huang, D. Modularized bilinear Koopman operator for modeling and predicting transients of microgrids. IEEE Trans. Smart Grid 2024, 15, 5219–5231. [Google Scholar] [CrossRef]
  28. Du, Z.; Lin, X.; Zhong, G.; Liu, H.; Zhao, W. Data-Driven Voltage Control Method of Active Distribution Networks Based on Koopman Operator Theory. Mathematics 2024, 12, 3944. [Google Scholar] [CrossRef]
  29. Guerrero, J.M.; Vasquez, J.C.; Matas, J.; de Vicuna, L.G.; Castilla, M. Hierarchical Control of Droop-Controlled AC and DC Microgrids—A General Approach Toward Standardization. IEEE Trans. Ind. Electron. 2011, 58, 158–172. [Google Scholar] [CrossRef]
  30. Schiffer, J.; Ortega, R.; Astolfi, A.; Raisch, J.; Sezi, T. Conditions for stability of droop-controlled inverter-based microgrids. Automatica 2014, 50, 2457–2469. [Google Scholar] [CrossRef]
  31. Schmid, P.J. Dynamic mode decomposition of numerical and experimental data. J. Fluid Mech. 2010, 656, 5–28. [Google Scholar] [CrossRef]
  32. Williams, M.O.; Kevrekidis, I.G.; Rowley, C.W. A Data–Driven Approximation of the Koopman Operator: Extending Dynamic Mode Decomposition. J. Nonlinear Sci. 2015, 25, 1307–1346. [Google Scholar] [CrossRef]
  33. James, G.; Witten, D.; Hastie, T.; Tibshirani, R. An Introduction to Statistical Learning; Springer: Berlin/Heidelberg, Germany, 2013; Volume 112. [Google Scholar]
  34. Hastie, T.; Tibshirani, R.; Friedman, J. The Elements of Statistical Learning: Data Mining, Inference, and Prediction, 2nd ed.; Springer Series in Statistics; Springer: New York, NY, USA, 2009. [Google Scholar] [CrossRef]
Figure 1. General scheme for droop-controlled microgrid.
Figure 1. General scheme for droop-controlled microgrid.
Sustainability 17 11114 g001
Figure 2. Online EDMD for Voltage Control of MGs.
Figure 2. Online EDMD for Voltage Control of MGs.
Sustainability 17 11114 g002
Figure 3. 14-node IEEE testbed with five inverters and eleven loads.
Figure 3. 14-node IEEE testbed with five inverters and eleven loads.
Sustainability 17 11114 g003
Figure 4. Comparison among different scenarios using noisy data and regularization.
Figure 4. Comparison among different scenarios using noisy data and regularization.
Sustainability 17 11114 g004
Figure 5. Evolution of the eigenvalues as matrix A is updated at each iteration.
Figure 5. Evolution of the eigenvalues as matrix A is updated at each iteration.
Sustainability 17 11114 g005
Figure 6. (a) Voltage and (b) current dynamic response for load variations at t = 2 s.
Figure 6. (a) Voltage and (b) current dynamic response for load variations at t = 2 s.
Sustainability 17 11114 g006
Figure 7. Medium reactive power measured at each inverter’s output for load changing at t = 2 s.
Figure 7. Medium reactive power measured at each inverter’s output for load changing at t = 2 s.
Sustainability 17 11114 g007
Figure 8. Voltage magnitude measured at each inverter’s output after transmission line changing at t = 10 s.
Figure 8. Voltage magnitude measured at each inverter’s output after transmission line changing at t = 10 s.
Sustainability 17 11114 g008
Figure 9. Medium reactive power measured at each inverter’s output after transmission line changing at t = 10 s.
Figure 9. Medium reactive power measured at each inverter’s output after transmission line changing at t = 10 s.
Sustainability 17 11114 g009
Figure 10. Voltage output of inverter one: comparison between the responses obtained with the offline and online EDMD-based algorithms.
Figure 10. Voltage output of inverter one: comparison between the responses obtained with the offline and online EDMD-based algorithms.
Sustainability 17 11114 g010
Table 1. Microgrid parameters for control with online EDMD.
Table 1. Microgrid parameters for control with online EDMD.
Inverter12345
Updating time t (s) 0.1
f (Hz) 60
P r e f (kW)1010101010
Q r e f (kVar)55588
m i ( 1 × 10 4 ) 1
n i ( 1 × 10 4 )0.2000.2000.2000.1250.125
V r e f ( R M S ) 120120120120120
τ i (s)0.100.150.200.250.28
Table 2. MPC parameters for the proposed algorithm.
Table 2. MPC parameters for the proposed algorithm.
Parameter12345
State gain Q1212151515
Input gain R1
Sampling Time T s 0.1 s
Voltage restriction V i 115 V V i 125 V
Control Horizon H p 10
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Toro, V.; Tellez-Castro, D.; Mojica-Nava, E. Online Data-Driven Intelligent Control of Microgrids Using Koopman Operator Learning. Sustainability 2025, 17, 11114. https://doi.org/10.3390/su172411114

AMA Style

Toro V, Tellez-Castro D, Mojica-Nava E. Online Data-Driven Intelligent Control of Microgrids Using Koopman Operator Learning. Sustainability. 2025; 17(24):11114. https://doi.org/10.3390/su172411114

Chicago/Turabian Style

Toro, Vladimir, Duvan Tellez-Castro, and Eduardo Mojica-Nava. 2025. "Online Data-Driven Intelligent Control of Microgrids Using Koopman Operator Learning" Sustainability 17, no. 24: 11114. https://doi.org/10.3390/su172411114

APA Style

Toro, V., Tellez-Castro, D., & Mojica-Nava, E. (2025). Online Data-Driven Intelligent Control of Microgrids Using Koopman Operator Learning. Sustainability, 17(24), 11114. https://doi.org/10.3390/su172411114

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop