Next Article in Journal
Statistical Insights into Spatial Patterns: A Panorama About Lacunarity
Previous Article in Journal
Fractal-Based Non-Linear Assessment of Crack Propagation in Recycled Aggregate Concrete Using 3D Response Surface Methodology
Previous Article in Special Issue
Novel Fractional Order Differential and Integral Models for Wind Turbine Power–Velocity Characteristics
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Federated Learning Detection of Cyberattacks on Virtual Synchronous Machines Under Grid-Forming Control Using Physics-Informed LSTM

1
Department of Electrical & Software Engineering, Schulich School of Engineering, University of Calgary, Calgary, AB T2N 1N4, Canada
2
Department of Electrical and Computer Engineering, Aarhus University, 8000 Aarhus, Denmark
3
Department of Basic Sciences, Technical and Vocational University (TVU), Tehran 1435661137, Iran
*
Author to whom correspondence should be addressed.
Fractal Fract. 2025, 9(9), 569; https://doi.org/10.3390/fractalfract9090569
Submission received: 16 July 2025 / Revised: 24 August 2025 / Accepted: 27 August 2025 / Published: 29 August 2025

Abstract

The global shift toward clean production, like using renewable energy, has significantly decreased the use of synchronous machines (SMs), which help maintain stability and control, causing serious frequency stability issues in power systems with low inertia. Fractional order controller-based virtual synchronous machines (FOC-VSMs) have become a promising option, but they rely on communication networks to work together in real time, causing them to be at risk of cyberattacks, especially from false data injection attacks (FDIAs). This paper suggests a new way to detect FDI attacks using a federated physics-informed long short-term memory (PI-LSTM) network. Each FOC-VSM uses its data to train a PI-LSTM, which keeps the information private but still helps it learn from a common model that understands various operating conditions. The PI-LSTM incorporates physical constraints derived from the FOC-VSM swing equation, facilitating residual-based anomaly detection that is sensitive to minor deviations in control dynamics, such as altered inertia or falsified frequency signals. Unlike traditional LSTMs, the physics-informed architecture minimizes false positives arising from benign disturbances. We assessed the proposed method on an IEEE 9-bus test system featuring two FOC-VSMs. The results show that our method can successfully detect FDI attacks while handling regular changes, proving it could be a strong solution.

1. Introduction

As power systems move to using renewable energy sources that rely on converters, the decrease in SMs takes away important sources of inertia and damping, which can put frequency stability at risk [1,2,3,4]. Virtual synchronous machines (VSMs) mimic the behavior of SMs and have become important for keeping stability [5,6]. However, they depend on real-time communication networks to share power settings, configuration details, and synchronization information, which creates serious cybersecurity risks [7,8,9,10]. FDIAs is one type of cyberattack that targets these control signals [11], which depend on communication and can disturb local operations and threaten the overall stability of the system. This study aims to develop a scalable, physics-aware, and privacy-preserving mechanism for detecting FDIAs against FOC-VSMs. Existing solutions often ignore the physical behavior of FOC-VSMs or require centralized data access, limiting scalability, adaptability, and robustness in distributed grid environments. We suggest using a federated physics-informed LSTM that takes advantage of local inverter data and includes swing-equation dynamics, providing strong and adaptable detection in various operating conditions.
Many control methods mimic the behavior of SMs in power systems that heavily utilize inverter-based resources (IBRs). Among these, droop control is popular because it is simple and behaves like SMs in terms of frequency and power [12]. To provide even better support during changes, VSM control not only mimics frequency droop but also simulates inertia and damping, leading to better performance in systems with low inertia [13,14,15]. Matching control techniques help inverters work more like synchronous machines by taking advantage of their similar structures, which leads to better synchronization and stronger performance [16,17,18]. Other alternatives, such as virtual oscillator control (VOC), aim for global synchronization by mimicking nonlinear oscillatory systems. In addition, dispatchable VOC (dVOC) helps achieve synchronization while meeting steady-state power flow equations, improving on some of the shortcomings of VOC [19]. With the increasing deployment of grid-forming inverters, their reliance on communication networks for real-time data exchange has created new cyber-physical vulnerabilities. These inverters typically exchange control parameters, synchronization signals, and power setpoints, making them susceptible to cyberattacks. Researchers have looked into FDIAs and denial-of-service (DoS) attacks as serious risks to the stability and reliability of VSM-based systems [20,21]. FDIAs can change control signals or sensor data to trick the inverter into responding incorrectly, which can mess up voltage and frequency control [20,21]. VSMs are especially at risk because their simulated swing behavior relies on accurate frequency and power feedback, which attackers can fake or change by inserting false ω or p* values [22,23,24]. More invasive attacks also target setpoints or control parameters to degrade the power quality or destabilize the system [25,26].
Researchers have proposed various defense mechanisms to address these risks. One method involves using control systems based on trust and confidence, where each inverter gives a score to its neighbors and changes its settings based on that score [27]. Another method uses the weighted mean subsequent reduction (WMSR) algorithm to filter out unusual data shared over the network by looking at connection limits in the communication graph [28]. Intermittent communication protocols also contribute to cyber-resilience by verifying the timing of data exchanges. If communication links deviate from expected behavior, the affected controllers are isolated to prevent the propagation of corrupted information [29]. Although previous studies address cybersecurity in microgrids, only a few explore robust detection methods tailored for inverter-based microgrids, particularly those using VSM control. Reference [30] applies a long short-term memory (LSTM) network to monitor microgrid cybersecurity. Researchers propose observer-based techniques, such as Luenberger observers and augmented Kalman filters, to estimate signals under false data injection (FDI) attacks [31,32]. Artificial neural networks (ANNs) are used for detecting and mitigating DoS and FDI attacks in Volt-VAR control systems [33] and DC microgrid inverters [34]. LSTM is further used to detect and estimate anomalies in power measurements [35], and stacked autoencoders combined with LSTM architectures identify electricity theft [36]. An LSTM-based framework is also developed to detect cyberattacks on photovoltaic farms [37]. In addition to these, researchers have proposed model-based, data-driven, and metric-based techniques to identify attacks on inverter-based energy resources (IBERs). Model-based methods rely on control-theoretic tools such as state-space estimation [38], while data-driven methods use learning architectures like LSTM and convolutional neural networks (CNNs) [39]. Metric-based techniques utilize signal processing features and thresholds for anomaly detection [40]. However, model-based methods depend on accurate modeling of nonlinear systems, data-driven methods often suffer from false positives, and metric-based approaches are vulnerable to threshold manipulation. Despite recent progress in cyberattack detection for inverter-based resources, existing approaches exhibit several critical limitations that restrict their effectiveness in VSM-controlled, grid-forming environments:
  • Lack of physical system integration: Most data-driven detection approaches, such as those utilizing LSTM and convolutional neural networks, view inverter behavior as a mystery and fail to integrate the physical dynamics of virtual synchronous machines (VSMs). As a result, these models lack interpretability and struggle to differentiate between legitimate system disturbances and cyber-induced anomalies [39].
  • Centralized learning dependency: Many existing detection frameworks rely on centralized data collection for model training and inference, which poses significant privacy concerns and limits deployment scalability in distributed, site-specific inverter environments [39,40].
  • Poor generalization and high false alarms: Detection techniques that rely on model approximations [40] or metric-based thresholds [40] often fail to generalize across different operating conditions. They are particularly prone to false positives when normal variations in load, voltage, or frequency occur (creating reliability concerns in practical applications).
This study addresses the limitations of existing cyberattack detection methods in VSM-controlled power systems by making the following key objectives and contributions:
1
Physics-informed detection framework: We develop a PI-LSTM model that incorporates the swing equation of the VSM as a physical constraint in the training process. By embedding domain-specific dynamics, the model enables residual-based anomaly detection that is highly sensitive to subtle deviations in frequency, power, or control behavior (typical signatures of false data injection attacks) while maintaining robustness to normal operational disturbances.
2
Federated learning for distributed VSM security: We implement a federated learning (FL) architecture that allows each VSM-enabled inverter to train its local PI-LSTM model using site-specific measurements (e.g., frequency, active power, and dc-link voltage) without sharing raw data. This distributed learning framework addresses privacy concerns, accommodates diverse operating conditions and control parameters across inverters, and scales to large power systems while enabling collaborative detection of cyberattacks.
The structure of this paper is organized as below: Section 2 introduces the mathematical and control structure of VSMs, emphasizing their swing dynamics, voltage regulation, and vulnerability to cyber-physical disturbances due to increased reliance on communication links. Section 3 provides a comprehensive classification of cyberattack surfaces in VSM-based systems, detailing various FDIA vectors and their impacts on system stability and coordination. In Section 4, we present the proposed detection framework, which integrates a physics-informed long short-term memory (PI-LSTM) model with federated learning (FL) to enable decentralized, physically consistent, and data-private anomaly detection across VSM units. Section 5 offers an in-depth analysis of simulation results under multiple attack scenarios, comparing the detection accuracy, robustness, and computational efficiency of the proposed model against baseline approaches. Finally, Section 6 concludes the paper by summarizing key findings and highlighting directions for future research in cyber-resilient grid-forming converter networks.

2. Virtual Synchronous Machine

The global transition toward renewable energy has led to the widespread deployment of inverter-based resources (IBRs), such as photovoltaic (PV) systems and wind turbines. Unlike conventional SMs, which inherently contribute mechanical inertia and provide frequency and voltage regulation, these resources connect to the grid through power electronic interfaces that do not naturally support such dynamics. As the penetration of IBRs increases, system inertia declines, leading to degraded frequency stability, higher rates of change of frequency (RoCoFs), and reduced frequency nadirs following disturbances [41]. To address these stability challenges, grid-forming converters (GFCs) are being developed to emulate SM capabilities such as inertial response, voltage support, black start, and droop-based frequency regulation. Among various control strategies for GFCs, the virtual synchronous machine (VSM) has emerged as a physically intuitive and widely adopted method. VSMs replicate the electromechanical behavior of synchronous machines using virtual models embedded in power converter controllers [41]. At the heart of VSM control is the swing equation, which models the frequency dynamics of a synchronous machine. The j t h VSM emulates this using
θ ˙ j = ω j
J j ω ˙ j = 1 ω * p j * p j + D j ω * ω j
Here, θ is the internal angle of the converter, ω is the instantaneous angular frequency, J is the virtual moment of inertia, D is the virtual damping factor, ω * is the nominal frequency (e.g., 50 or 60 Hz), p * is the active power reference, and p is the measured active power output [41]. Equation (1) ensures the phase angle evolves according to the frequency, replicating the rotor dynamics of SMs. To integrate virtual friction or coordinated damping, we modified the swing equation as follows [42]:
J j ω ˙ j   =   1 ω * p j * p j + D j ω * ω j   +   F j ω C , j     ω j
where
  • F j is the virtual friction coefficient
  • ω C is the center-of-inertia frequency, typically calculated as
    ω C = j = 1 N     ( J j ω * ) ω j j = 1 N     ( J j ω * )
This extension adds a damping torque that depends on the mismatch between a unit’s local frequency and the global average frequency. Equation (3) governs frequency changes in response to active power imbalance and provides a mechanism for emulated inertial and droop response. To enhance synchronization in multi-VSM networks, a virtual friction term F j ω C ω j must also be included. This term dampens the deviation between the local frequency ω j and the center-of-inertia frequency ω C , calculated across all VSMs as in (3), and improves coherence across the microgrid. The output voltage of the VSM is synthesized based on the internal angle θ and a virtual excitation current i f , which is analogous to the field current in a synchronous generator. The three-phase voltage reference is constructed as follows:
v ^ a b c   =   2 ω M f i f s i n ( θ ) s i n ( θ     2 π / 3 ) s i n ( θ     4 π / 3 )
Here, M f is the mutual inductance coefficient between the virtual field and stator windings. To regulate the voltage magnitude, a virtual automatic voltage regulator (AVR) is implemented. This typically consists of a fractional order proportional-integral (FO-PI) controller that adjusts the excitation current i f to maintain the DC-link or output voltage at a desired setpoint:
i f   =   k p M f v r e f     v d q   +   k i a M f 0 t   v r e f     v d q ( τ ) d τ
which replicates the function of the AVR by adjusting i f to maintain the reference voltage v ref . Here, v d q denotes the measured voltage magnitude in the dq-frame; a is the fractal factor; and k p   a n d   k i are the proportional and integral gains, respectively [41,43]. Transforming the reference voltages v ^ a b c to the dq-coordinate frame using the same angle θ and frequency ω as in (2), the FOC-VSM employs standard voltage and current control loops. These loops, along with PWM signal generation, remain consistent with the conventional control design [41], ensuring accurate real-time tracking of voltage and current references.
Figure 1 presents a comprehensive view of the control architecture used to implement a FOC-VSM. This architecture is organized in a hierarchical manner, reflecting the layered control strategy required to replicate the behavior of synchronous machines using power electronics. At the highest level, the control system incorporates a swing equation and frequency droop-based loop, which governs the virtual rotor dynamics. Specifically, the angle dynamics are given by θ ˙ = ω , and the frequency dynamics are given by the swing Equation (2). This combination allows the converter to exhibit synthetic inertia and emulate a primary frequency response, adapting its internal frequency based on active power imbalances and deviations from nominal frequency.
Beneath this frequency control layer, the voltage magnitude control loop emulates the function of an automatic voltage regulator (AVR) as found in traditional synchronous generators. This loop regulates the virtual excitation current i f using a fractional order proportional-integral (FO-PI) controller that minimizes the error between the reference voltage v ref and the measured terminal or DC-link voltage v d c , as represented by (6). The result is dynamic voltage support capability and improved voltage stability at the point of common coupling (PCC). Once the internal angle θ and excitation current i f are determined, a waveform generator constructs the three-phase voltage reference signals. These are synthesized according to (5), thereby generating a rotating voltage vector with magnitude and frequency determined by the outer control loops. This sinusoidal reference ensures that the output voltage behaves like that of a synchronous machine’s stator windings.

3. Cyberattacks on Virtual Synchronous Machines

While the local control laws of VSMs are typically hardcoded into power electronics and locally executed, they increasingly rely on external communication to support coordinated operation. This includes feedback and synchronization signals exchanged between distributed inverters and central or supervisory controllers. Such communication channels (although essential for functions like virtual friction (VF) damping, droop control coordination, and grid restoration) open the system to cybervulnerabilities, particularly FDIAs.

3.1. Attack Surfaces in VSM Microgrids

Each VSM maintains its internal dynamics using the swing equation and voltage regulation via an AVR (see Equations (1)–(5)). These control laws rely on several signals that may be internally generated (e.g., power output p j and frequency ω j ) or externally received, such as the center-of-inertia (COI) frequency ω C . For example, VF damping requires that each VSM compares its local frequency to ω C , a weighted average of all inverter frequencies, typically computed by a central controller and broadcast back to all units. These communication-based dependencies introduce four principal vectors of attack:
  • Frequency measurement reports ( ω j C C );
  • Global reference feedback ( ω C V S M j );
  • Setpoint commands (e.g., p j * , v ref   );
  • Excitation current feedback (e.g., used in some distributed AVR schemes).

3.2. False Data Injection on Local Frequency Measurements

Assume that each VSM j N = { 1 , 2 , , N } computes its own instantaneous frequency ω j using the standard swing dynamics. This locally computed frequency is then reported to a central controller (CC) or used in coordination mechanisms like frequency consensus or virtual friction. An FDIA can target this communication channel by adding a time-varying corrupting signal a j A ( t ) to the outgoing data, resulting in a manipulated signal received by the CC:
ω j A = ω j + a j A ( t )
Here, a j A ( t ) represents an arbitrary and potentially unbounded additive disturbance introduced by the attacker. This injected error may not be observable at the CC and can mislead any subsequent frequency aggregation or control logic that depends on the ensemble of ω j values [44]. In this study, the additive disturbance a j A ( t ) in (7) was modeled using several representative attack profiles, including constant offsets, sinusoidal variations, square-wave manipulations, and ramped signals. These profiles represent practical FDIA strategies ranging from persistent biasing to stealthy gradual corruption. Their amplitudes, start times, and durations were randomized within specified bounds, to ensure comprehensive coverage of both short-term and long-duration attack cases.
In systems where the controller calculates the center-of-inertia (COI) frequency as a weighted average of reported frequencies,
ω C n = j = 1 N     ( J j ω * ) ω j j = 1 N     ( J j ω * )
The attack alters this value to
ω C = ω C n + j = 1 N     ( J j ω * ) a j A ( t ) j = 1 N     ( J j ω * )
This attack can induce system-wide instabilities, such as frequency divergence, by perturbing only a subset of nodes. The systemic vulnerability arises from the aggregation mechanism of ω C : the attack on a few nodes contaminates the reference used by all. Oscillatory or ramped attack profiles a j A ( t ) may be particularly destabilizing as they introduce persistent frequency fluctuations or false trends, potentially triggering overcurrent protection or load-shedding schemes.

3.3. False Data Injection on COI Frequency Feedback

The second major scenario involves corrupting the COI frequency signal ω C that the CC sends back to the inverters. Even if the CC computes a valid ω C , an adversary can compromise the downstream communication channel to VSM k , altering the signal as
ω C , k r e c e i v e d = ω C + a k B ( t )
Here, a k B ( t ) is a second additive signal, designed to mislead the VSM about the global frequency state. Since VF damping applies a torque F j ω C , k ω j , such an attack can invert, amplify, or disable the damping response. In a coordinated VSM network, misalignment of damping terms can degrade system synchrony, increase frequency drift, and compromise load-sharing. In [38], it is shown that such attacks (if sustained) can prevent the system from reaching steady-state consensus, even if the swing dynamics remain otherwise unchanged.

3.4. Power Setpoint and Voltage Reference Manipulation

A third scenario involves manipulating control setpoints sent to the VSM, such as the active power reference p j * or the voltage reference v ref . These parameters typically originate from a central energy management system (EMS) or higher-level supervisory controller. If an attacker gains access to the control path between this supervisory layer and the inverter controller, they can corrupt the intended commands as
p j * ,   compromised   = p j * + a j p ( t )
v ref compromised = v ref + a j v ( t )
Such FDIAs can be particularly damaging because they directly modify target states, causing the VSM to regulate toward physically infeasible conditions. For instance, over-injection of power via p j * may lead to inverter overloading, line overheating, or protection trips. Undervoltage commands via v ref may degrade power quality and destabilize reactive power sharing. Intermittent switching of setpoints (e.g., toggling between extremes) can stress the converter’s inner control loops and introduce high-frequency oscillations. These attacks are difficult to detect because they do not necessarily trigger abnormal deviations in system states unless carefully monitored with residual-based mechanisms.

4. Proposed Framework

4.1. Physics-Informed LSTM Model

To detect cyberattacks that compromise the integrity of VSMs, we propose a physics-informed long short-term memory (PI-LSTM) model that embeds the physical swing dynamics of the VSM into a deep learning framework. This hybrid approach combines the predictive power of LSTM-based sequence modeling with prior knowledge of the VSM’s dynamic equations.

4.1.1. Integration of VSM Swing Dynamics

Each VSM’s frequency and phase angle are governed by nonlinear differential equations that mimic the behavior of synchronous machines. These swing dynamics describe how the system evolves over time in response to changes in power setpoints, damping forces, and global frequency references (as seen in Section 2). To integrate these equations into a machine learning model, we discretize them using the forward Euler method, which yields update rules of the form
δ j t = δ j t 1 + Δ t ω j ( t 1 )
ω j t = ω j t 1 + Δ t ω ˙ j ( t 1 )
The term ω ˙ j ( t   1 ) is computed from the system’s physical model, incorporating local active power imbalance, virtual damping, and coordinated virtual friction (as detailed in Section 2). These equations define how a well-behaved VSM is expected to evolve. However, as shown in Section 3, cyberattacks such as FDIAs can target key VSM signals exchanged over communication channels. To enable the model to recognize both normal and malicious behavior, we construct the PI-LSTM input vector at each time step t as
x t = ω j ( t ) , p j ( t ) , v d c ( t ) , ω C , j r e c e i v e d   ( t ) , p j * , c o m p ( t ) , v r e f c o m p ( t )
This input, x t , is passed to the PI-LSTM along with the internal hidden state h t , which retains historical context across time steps:
s ^ t + 1   =   P I L S T M x t , h t
The output s ^ t + 1 represents the model’s predicted physical state for the next time step, typically including
s ^ t + 1 = ω ^ j ( t + 1 ) , δ ^ j ( t + 1 )
By learning to map these attack-aware inputs to physically consistent state transitions, the PI-LSTM develops an understanding of how a VSM should behave under normal conditions. When cyberattacks distort the inputs in a way that violates the expected physics, the model will produce predictions that deviate from actual measurements, forming the basis for detection, which is further detailed in the next subsection.
The Euler forward scheme adopted in this work provides a simple and computationally efficient discretization of the swing dynamics, with a global truncation error of O ( Δ t ) . In theory, the classical fourth-order Runge–Kutta (RK4) method [45] offers significantly higher accuracy, with a global truncation error of O Δ t 4 , and thus has the potential to yield more precise state propagation for the nonlinear variables ( δ j , ω j ). Nevertheless, RK4 requires four evaluations of the swing-equation right-hand side per time step, whereas Euler requires only one. This difference substantially increases computational demand and update latency. Since the primary objective of this work is to develop and evaluate a federated, physics-informed detection framework rather than to optimize numerical solvers, Euler forward is selected as the most suitable trade-off. The additional computational burden of RK4 is not aligned with our real-time detection focus, even though it could theoretically enhance numerical fidelity in offline studies or future extensions.

4.1.2. Physics-Based Residual Computation

To detect deviations from expected VSM behavior (such as those introduced by false data injection attacks), the PI-LSTM model is equipped with a residual-based detection mechanism. This mechanism exploits the discrepancy between the model’s predicted future state (based on physically grounded dynamics) and the actual observed state at each time step. Let the PI-LSTM output at time step t + 1 be (17) and the corresponding ground-truth measurements be
s t + 1 = ω j ( t + 1 ) , δ j ( t + 1 )
The prediction residual r t + 1 is then computed as
r t + 1 = s ^ t + 1 s t + 1 2 = ω ^ j t + 1   ω j ( t + 1 ) 2 + δ ^ j t + 1 δ j ( t + 1 ) 2
This residual captures how far the observed physical state deviates from what the PI-LSTM, informed by swing dynamics, expects to happen under the given control and measurement inputs. Because the model has been trained on normal (attack-free) data and guided by physical laws, residuals during nominal operation remain small. When a cyberattack alters any of the key signals-especially those involved in swing control (e.g., p j * , ω C , v ref ), the relationship between inputs and resulting physical states will diverge from learned patterns, and the residual r t + 1 will increase. To further enforce physical consistency and increase sensitivity to unmodeled disturbances, we can also compute an auxiliary physics-informed residual based on the discretized swing equation. From the known dynamics, we calculate an alternative estimate of ω j ( t + 1 ) using the forward Euler update (reproduced from Section 4.1):
ω j p h y s t   +   1 = ω j t + Δ t 1 J j 1 ω * p j * ,   comp   ( t )     p j ( t )   +   D j ω *     ω j ( t )   +   F j ω C , j r e c e i v e d ( t )     ω j ( t )
This provides a purely physics-based prediction of the next frequency, which can be compared with either the observed frequency ω j ( t + 1 ) or the PI-LSTM prediction ω ^ j ( t + 1 ) . Thus, a physics consistency residual is also defined:
r t + 1 p h y s   =   ω ^ j ( t   +   1 )     ω j p h y s ( t   +   1 )
This residual provides an additional anomaly indicator: if the LSTM prediction aligns with the data but not with the physical model, it may signal data drift or model overfitting; if it aligns with the physics but not with the data, it likely indicates an attack or fault. Finally, both residuals can be combined in a hybrid detection metric:
R t + 1   =   α r t + 1   +   ( 1     α ) r t + 1 p h y s   ,   α [ 0 ,   1 ]
A detection threshold τ is defined based on training or validation data: i f   R t + 1 > τ anomaly detected. This physics-aware residual computation strategy ensures the detection system is robust to both fast-changing cyberanomalies and gradual data manipulation, while minimizing false positives due to benign system disturbances.

4.1.3. Combined Loss Function and Training Objective

The PI-LSTM model is trained not only to minimize prediction errors on observed data but also to conform to the underlying physical laws of VSM dynamics. To achieve this, we formulate a hybrid loss function that combines data-driven prediction loss and physics-based consistency loss. Together, these objectives encourage the model to produce accurate forecasts while maintaining fidelity to the swing equation and resisting overfitting to spurious temporal correlations.
Data-Driven Loss (Supervised Prediction Error)
This component penalizes discrepancies between the PI-LSTM’s predicted state and the ground truth:
L data   =   1 N t = 1 N   ω ^ j ( t )     ω j ( t ) 2   +   δ ^ j ( t )     δ j ( t ) 2
This is a standard mean squared error (MSE) loss computed across a sequence of length N . It ensures the LSTM learns to forecast the short-term dynamics of frequency and rotor angle.
Physics-Informed Loss (Swing Equation Residual)
To penalize deviations from the known physics (specifically the swing equation), we define a residual loss based on the Euler-discretized update of ω j ( t ) as derived in Equation (20). The physics-consistency loss is defined as
L p h y s = 1 N t = 1 N   ω ^ j ( t ) ω j p h y s ( t ) 2
This encourages the model’s predictions to align with those generated by first-principal dynamics, even in the presence of non-observable state dependencies.
Total Loss Function
The final objective used for model training is a weighted combination of the two terms:
L total   =   λ L data     +   ( 1     λ ) L phys
Here, λ [ 0 ,   1 ] is a tunable hyperparameter that balances emphasis between data fit and physical conformity. A lower λ biases the model toward strict physical consistency, while a higher λ prioritizes minimizing forecast error. In practice, λ is selected through cross-validation to optimize both predictive accuracy and generalizability under disturbances and cyberthreats. By enforcing both objectives during training, the PI-LSTM learns to reject physically implausible trajectories. This dual constraint enables the model to serve as a reliable foundation for residual-based anomaly detection, especially under conditions where cyberattacks alter only a subset of input signals.

4.2. Federated Learning Strategy

While the PI-LSTM model enables localized detection of cyberanomalies in VSMs, training such models centrally would require aggregating raw operational data from geographically distributed units. This raises privacy, scalability, and communication overhead concerns, especially in cyber-physical systems like smart grids where real-time control must be preserved. To overcome these limitations, we integrate the PI-LSTM into a federated learning (FL) framework. In this architecture, each VSM trains its model locally using site-specific data while contributing to a shared global model without exposing raw measurements. This decentralized approach ensures data privacy, supports heterogeneity in VSM operating conditions, and allows the detection framework to scale to large systems.

4.2.1. Local Model Training and Update Cycle

To support distributed, privacy-preserving cyberattack detection across a fleet of VSMs, we adopt a federated learning (FL) architecture in which each VSM functions as an autonomous learning client. Inspired by practical frameworks in the recent literature [46,47], our approach allows each unit to train a local physics-informed deep model on site while collaboratively contributing to a global cyberattack detection model without sharing raw data. Each VSM node executes a local training cycle within a synchronous global learning round, following the steps below.
Model Synchronization and Initialization
At the start of each federated round r , a central aggregation server broadcasts the current global model parameters θ ( r ) to all participating VSM nodes. These parameters define a shared physics-informed LSTM (PI-LSTM) model, pre-structured to integrate both learned temporal patterns and swing equation-based physical constraints.
Local Data Acquisition and Attack-Aware Input Construction
Each VSM maintains its own operational dataset consisting of historical time-series records of measurable internal states and externally received control signals. For time step t , the input vector is constructed as (15). This formulation incorporates both true system dynamics and communication-based quantities susceptible to FDIAs. The next-step VSM state s t + 1 = ω j ( t + 1 ) , δ j ( t + 1 ) is used as the supervised prediction target.
The local PI-LSTM model receives x t and internal memory state h t and predicts the future system state (17). Training is guided by a hybrid objective function that combines supervised prediction error with physical consistency loss derived from discretized swing dynamics (Equations (23)–(25)). This training process ensures that each local model learns site-specific operational behavior while conforming to the physical laws that govern VSM dynamics.
Model Update and Sharing
Upon completing local optimization (using Adam), each VSM sends its updated model parameters θ j ( r + 1 ) to the central server. No raw measurements or labels are transmitted, thus preserving data privacy and regulatory compliance.
Preparedness for Aggregation
All received local models are stored by the server for global aggregation (detailed in Section 4.2.2). Clients with insufficient data, low-quality updates, or outlier behavior may be excluded or down-weighted, similar to performance-based schemes used in hierarchical FL strategies such as FedAvg-P [48]. This federated training loop allows each VSM to independently learn dynamic patterns and potential cyberattack impacts, while benefiting from a system-wide collaborative model. The resulting global PI-LSTM becomes more robust to attack variability, regional disturbances, and operating condition diversity.

4.2.2. Secure Aggregation and Global Model Sharing

The final stage of each federated learning (FL) round involves secure aggregation of the locally trained PI-LSTM models and redistribution of the updated global model. This step enables the collaborative improvement of the cyberattack detection capability across the VSM network, while ensuring that privacy is preserved and system heterogeneity is respected.
Model Aggregation via Federated Averaging
Once all participating VSM nodes complete their local training cycles and transmit updated parameters θ j ( r + 1 ) , the central aggregator performs model fusion using the Federated Averaging (FedAvg) algorithm. Specifically, the global model update at round r + 1 is computed as
θ ( r + 1 ) = j = 1 K   n j n total θ j ( r + 1 )
where θ j ( r + 1 ) denotes the updated parameters from client j , n j is the number of samples at client j , n total = j = 1 K   n j is the total number of samples across all participating clients, and K is the number of clients in the current round. This weighted averaging scheme ensures that clients with more representative or diverse data have proportionally greater influence on the global model, improving convergence and generalization.
In practical FL deployments, communication links between VSMs and the server may suffer from latency and packet loss. These factors do not directly alter the local PI-LSTM inference, but they can influence synchronization in federated rounds. Moderate latency and low packet loss mainly affect the round duration, whereas severe impairments may delay anomaly reporting and reduce responsiveness. This highlights the importance of considering communication-efficient or asynchronous FL variants in future implementations, especially for large-scale or bandwidth-constrained power systems.

4.3. Anomaly Detection and Decision Logic

The federated PI-LSTM framework described in previous sections enables the prediction of future system states based on both historical behavior and physics-informed constraints. However, the ultimate goal is not only accurate forecasting but also the reliable detection of cyber-induced anomalies—specifically, those that violate the expected physical evolution of VSMs. To this end, we implement a residual-based decision mechanism that compares predicted state trajectories against both measured outcomes and physics-consistent estimates, which can be seen in Algorithm 1. A detection threshold τ is defined during validation. If L t + 1 t o t a l > τ , the system flags the event as anomalous. This hybrid strategy ensures robust detection of stealthy attacks that would otherwise bypass traditional thresholding based on signal deviation alone.
Algorithm 1: Federated PI-LSTM-Based Cyberattack Detection in Virtual Synchronous Generators
Input:
   •
Initial global model parameters θ ( 0 )
   •
Local datasets D j = x t , s t + 1 for each VSM node j
   •
Hyperparameters: learning rate η , loss weight λ , number of rounds R , local epochs E , detection threshold τ
Output:
   •
Trained global PI-LSTM model θ ( R )
   •
Real-time anomaly flags
Training Phase (Federated Learning):
   1.
For each global round r = 1 to R :
   2.
Server broadcasts global model θ ( r ) to all VSM clients
   3.
For each client j in parallel:
   4.
Initialize local model θ j ( r ) = θ ( r )
   5.
For each local epoch e = 1 to E :
   6.
For each timestep t D j :
  • Predict next state using PI-LSTM:
    s ^ t + 1 = P I L S T M x t , h t
  • Estimate frequency from physics model (Euler method):
    ω t + 1 phys = S w i n g E q x t
  • Compute data loss:
    L data = s ^ t + 1 s t + 1 2
  • Compute physics loss:
    L phys = ω ^ t + 1 ω t + 1 phys 2
  • Compute total loss:
    L total = λ L data + ( 1 λ ) L phys
  • Update model parameters using gradient descent:
    θ j ( r ) θ j ( r ) η L total
   7.
Client j sends θ j ( r ) to server
   8.
Server aggregates all updates using FedAvg:
θ ( r + 1 ) = j = 1 K n j n total θ j ( r )
Inference Phase (Anomaly Detection):
   9.
For each new timestep t at client j :
  • Input: x t , current measurements
  • Predict next state:
    s ^ t + 1 = P I L S T M x t , h t
  • Estimate physical frequency:
    ω t + 1 phys = S w i n g E q x t
  • Compute prediction residual:
    L t + 1 d a t a = s ^ t + 1 s t + 1 2
  • Compute physics residual:
    L t + 1 p h y s = ω ^ t + 1 ω t + 1 p h y s
  • Combine residuals:
    L t + 1 t o t a l = α L t + 1 d a t a + ( 1 α ) L t + 1 p h y s
  • If  L t + 1 t o t a l > τ :
    → Raise anomaly alert

5. Simulation and Results

5.1. System Setup and Modeling Environment

To evaluate the proposed federated PI-LSTM-based cyberattack detection framework under realistic low-inertia power system conditions, we simulate the IEEE 9-bus transmission test system using Simscape Electrical/SimPowerSystems. The system configuration is illustrated in Figure 2 and consists of a conventional synchronous machine (SM), two large-scale grid-forming converter (GFC) systems based on VSMs, and constant impedance loads.
All transmission lines are modeled as nominal π-sections incorporating full RLC dynamics, allowing accurate capture of fast transients and potential adverse interactions with grid-forming inverters. Line dynamics are essential in this context due to the rapid response characteristics of GFCs, which may interact nonlinearly with passive network elements under both normal and adversarial conditions. Transformers are implemented as three-phase linear transformer models, and all loads are constant impedance type.
The cyberattack detection framework is applied to these converter-interfaced VSMs. The relevant plant and control parameters for the VSM modules are as follows. Notably, each VSM uses a virtual moment of inertia = 2 × 10 3 and droop coefficients k p = 0.001 , k i = 0.5 . The VSMs operate at a nominal frequency of ω = 2 π × 50   r a d / s , with voltage reference regulation via FO-PI controllers embedded in each local control stack. These settings form the operational and physical context in which the PI-LSTM-based anomaly detection is tested under both nominal and compromised scenarios.
In the simulation environment, each VSM is subject to distinct operational conditions, including varying load profiles, renewable generation fluctuations, and cyberattack patterns. These differences result in non-IID data distributions across clients in the federated learning process, thereby reflecting realistic heterogeneity in distributed grid environments.

5.2. VSM Behavior Under Nominal and Attacked Conditions

To evaluate the vulnerability and detection performance of VSMs under cyberattacks, we simulate various FDIAs targeting key control and communication channels. We classify these attacks into four categories:
(i)
Corruption of local frequency measurements ω j sent to the central controller (CC);
(ii)
Tampering with the COI frequency ω C received by the VSMs;
(iii)
Manipulation of the voltage reference v ref .
Each attack is introduced in a controlled simulation scenario and evaluated for its impact on frequency and power output. The baseline (nominal) behavior is compared against the system response under attack.

5.2.1. Attack on Signals Sent to the Central Controller

The first attack class targets the upward communication from VSMs to the CC. Figure 3a illustrates the scenario in which individual VSM frequency measurements are corrupted by time-varying signals before reaching the CC. At t = 4   s , a sine wave of amplitude 0.2 is added to ω c . At t = 5   s , a square wave ( 0.2   r a d / s ) is applied to ω c , and a constant offset ( 0.2 π r a d / s ) is injected into ω c at t = 6   s . These manipulated values distort the computed center-of-inertia frequency ω c , as shown in Figure 3a. Despite the corrupted inputs, Figure 3b demonstrates that the output power of each VSM remains close to the nominal case (dashed lines), indicating the system’s inherent masking of subtle attacks without proper anomaly detection.

5.2.2. Attack on COI Frequency Feedback to VSMs

The second attack manipulates the COI frequency signal ω C broadcast from the CC to each VSM. Figure 4a presents the behavior of ω C , the received COI frequency at a VSM1, under a square-wave FDIA. An attack is introduced at t = 2   s , generating sharp frequency fluctuations that differ from the true CC value, original ω C . Figure 4b shows the power output of VSM1 under these conditions. Without anomaly mitigation, the output exhibits large oscillations (red line).

5.2.3. Attack on Voltage Reference V r e f

The final attack class modifies the reference voltage input used by the AVR controller. This alters the terminal voltage output of the converter, affecting the power balance and potentially causing local voltage collapse or instability (as shown in Figure 5). Overall, these case studies demonstrate that VSMs are susceptible to diverse FDIA vectors that exploit communication dependencies. Without a physics-informed detection mechanism, these attacks may remain hidden while degrading system synchrony or power quality. The proposed PI-LSTM model successfully identifies such anomalies through temporal inconsistency and physical residuals, especially when embedded in a federated architecture.
In addition to short-duration, abrupt false data injection attacks, long-running stealth attacks with low-magnitude perturbations were simulated on the communication links of VSMs. These stealthy manipulations persisted across multiple control cycles while maintaining a degree of stealthiness by remaining within normal operating margins.

5.3. Dataset Construction and Network Parameters

To train and evaluate the proposed FL-PI-LSTM framework for detecting cyberattacks on VSMs, we develop a labeled dataset through simulation of the IEEE 9-bus transmission system. The VSMs are installed at buses 2 and 3, selected due to their inverter-based generation and critical participation in grid-forming control. Each VSM is simulated independently to support decentralized training across clients in the federated learning (FL) setup.
The proposed FL-PI-LSTM framework is not limited to a fixed power or frequency operating point. In this study, simulations were conducted with a nominal frequency of 50 Hz (2π × 50 rad/s) and load variations in the range of 0.8–1.2 p.u. These values were selected to represent typical operating conditions in distribution networks. While the method is demonstrated within this range, it can be extended to different grid frequencies (e.g., 60 Hz) or power levels through retraining with representative datasets, ensuring adaptability across diverse system configurations.

5.3.1. Data Generation and Labeling

Simulations were carried out in MATLAB/Simulink using Simscape Electrical with a sampling interval of 5 ms over 10 s windows. Both nominal operation and FDIA scenarios were considered. For each scenario, time-series data of rotor angle, frequency, power reference, voltage reference, excitation current, and DC-link voltage were collected. Sliding windows were applied to extract training sequences, and labels were assigned as normal or anomalous depending on overlap with injected attacks. To ensure diversity, multiple parameters were systematically varied: attack type (frequency report, COI feedback, power setpoint, and voltage reference), trigger time (uniformly randomized within [1 s, 7 s]), duration (0.5–2 s), amplitude (1–5 rad/s or p.u. equivalent), waveform (constant, sine, square, and ramp), load level (0.8–1.2 of nominal), and the VSM under attack (VSM1, VSM2, or both). A total of 2000 distinct attack events were generated and labeled with metadata. Both training and test datasets included these diverse conditions, ensuring that the proposed framework was evaluated on realistic variations (as shown in Table 1).
Each simulation outputs vectors of measured states (e.g., rotor angle and frequency), control inputs (e.g., power reference and voltage reference), and internal signals (e.g., excitation current and VDC), which are aligned to build training sequences. A total of 2000 sequences are labeled with attack metadata.

5.3.2. FL-PI-LSTM Network Configuration

The architecture used for each local model is a physics-informed long short-term memory (PI-LSTM) network. Each VSM is assigned a local model instance, which is trained independently in the federated setting and periodically synchronized via model aggregation (as shown in Table 2).
This structured simulation and training environment ensures that the detection model is exposed to a wide variety of attack dynamics and system operating conditions, improving its generalization and robustness under realistic grid threats.

5.4. Performance Analysis

This section presents a comprehensive evaluation of the proposed FL-PI-LSTM detection framework in comparison with three alternative models: CL-LSTM, FL-LSTM, and CL-PI-LSTM. Each model is trained and tested under the same simulation setup and evaluated using standard detection metrics and runtime efficiency indicators. The training behavior of all models is shown in Figure 6, which presents the evolution of training loss over 250 epochs. The CL-LSTM model demonstrates moderate convergence, with loss reduction tapering off after epoch 150. The FL-LSTM model converges slightly faster and reaches a lower final loss due to the benefit of local training across varied data sources. The CL-PI-LSTM model maintains consistently lower loss values throughout training due to the added regularization effect of physics-based residuals. Among all models, FL-PI-LSTM exhibits the fastest and smoothest convergence, indicating both local model stability and enhanced generalization from physics-informed constraints.
It should be noted that the datasets across VSMs are non-IID by construction since each client experiences unique disturbances and attack scenarios. The convergence behavior illustrated in Figure 6 thus inherently validates the robustness of the proposed method under non-IID conditions.
Figure 7 displays the precision, recall, and F1 score achieved by each model on the test set. The CL-LSTM model yields the lowest overall performance across all metrics, while the FL-LSTM improves notably in recall, benefiting from heterogeneous training data. CL-PI-LSTM surpasses both prior models by incorporating physical constraints, thus reducing false positives. The FL-PI-LSTM achieves the highest overall performance, with a precision of 95%, a recall of 96%, and an F1 score of 95.5%. This demonstrates the combined benefits of federated learning and physics-informed modeling in producing an accurate, resilient, and generalizable cyberattack detection system.
This study concentrates on detecting cyberattacks against VSM signals. Model poisoning and backdoor threats targeting federated aggregation remain outside our present scope but represent important directions for future work, where robust aggregation and client update validation could complement the proposed framework.
The training and inference runtimes of each model are presented in Table 3. Pure LSTM models (CL-LSTM and FL-LSTM) demonstrate faster training per epoch due to their simpler objectives. However, the physics-informed models maintain comparable inference time, indicating no major penalty during real-time deployment. The FL-PI-LSTM, while incorporating additional physical constraints, completes each local epoch in only 4.0 s and maintains an inference latency of 0.39 milliseconds per sample, making it suitable for real-time detection in distributed power systems.
To evaluate the effect of λ , we conducted a sensitivity analysis with three representative values: λ   = 0.2 , 0.5 ,   a n d   0.8 . Table 4 reports the precision, recall, and false positive rate (FPR) for each setting. The results indicate that λ = 0.5 achieves the most balanced trade-off, providing both high precision/recall and low FPR. Lower values emphasize physics consistency at the cost of recall, while higher values increase sensitivity but with more false positives.
The proposed PI-LSTM framework was applied to multiple FDIA categories, including frequency measurement corruption, COI feedback tampering, power setpoint manipulation, and voltage reference tampering. In addition, stealthy long-duration perturbations with small amplitudes were introduced to emulate subtle adversarial strategies. Across these scenarios, the PI-LSTM successfully distinguished between normal dynamics and attack-induced anomalies, demonstrating its general applicability for FDIA detection in VSM-based networks.

Ablation Study: Dynamic Thresholding

In addition to fixed-threshold detection, we evaluated a dynamic threshold mechanism to explore its effect on anomaly detection performance. The dynamic threshold τ ( t ) was defined as
τ t = μ t + β σ t
where μ t and σ t denote the moving average and standard deviation of the residual loss L t t o t a l within a sliding window of size W , and β is a scaling hyperparameter. This allows the threshold to adapt in real time to the variability and noise level of operating conditions. Table 5 summarizes the performance comparison between fixed and dynamic thresholds. Results indicate that dynamic thresholding reduces false positives (FPR) by 2.3 % on average, while recall and precision remain nearly unchanged. This demonstrates that dynamic adjustment primarily helps in suppressing unnecessary alarms without affecting true anomaly detection.

6. Conclusions

This paper presented a novel cyberattack detection framework for VSMs, integrating physics-informed deep learning with federated intelligence. We proposed a hybrid architecture combining a physics-informed long short-term memory (PI-LSTM) network with federated learning (FL), enabling each VSM to perform local anomaly detection while contributing to a globally trained model without sharing raw data. The framework is tailored to detect a wide range of false data injection attacks targeting frequency measurements, COI feedback, power setpoints, and voltage references—key vectors in distributed grid-forming converter networks. By embedding swing dynamics and control constraints into the LSTM architecture, the PI-LSTM model demonstrated a strong ability to distinguish physically inconsistent behaviors from benign transients. This resulted in significantly reduced false alarms and faster detection times. Federated learning further enhanced model generalization and privacy by aggregating knowledge across clients while preserving data locality. Simulations on a modified IEEE 9-bus system, with VSMs deployed at critical nodes, confirmed the superiority of the proposed FL-PI-LSTM model over centralized and non-physics-informed baselines. It achieved the highest classification metrics (F1 score of 95.5%), the lowest false alarm rate (2.1%), and real-time inference performance, making it well suited for practical deployment in cyber-resilient low-inertia power systems. Although this work is based on extensive simulation scenarios, future efforts will focus on hardware-in-the-loop (HIL) and real microgrid experiments to validate the proposed framework under practical operating conditions.

Author Contributions

Conceptualization, A.K.; methodology, A.K. and S.O.; software, A.K.; validation, A.K., S.O. and S.M.; writing—original draft preparation, A.K.; writing—review and editing, S.O. and S.M. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The datasets generated and analyzed during this study are available from the corresponding author on reasonable request.

Acknowledgments

During the preparation of this work, the authors used Open AI’s Chat GPT in order to assist with grammar refinement, content structuring, and drafting technical explanations. After using this tool, the authors reviewed and edited the content as needed and take full responsibility for the content of the published article.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
FDIAFalse data injection attack
FOCFractional order controller
PI-LSTMPhysics-informed long short-term memory
VSMsVirtual synchronous machines
SMSynchronous machines
IBERsInverter-based energy resources
IBRsInverter-based resources
VOCVirtual oscillator control
DVOCDispatchable VOC
DoSDenial of service
WMSRWeighted mean subsequent reduction
ANNArtificial neural networks
CNNConvolutional neural networks
RoCoFRates of change of frequency
GFCGrid-forming converters
PVPhotovoltaic
AVRAutomatic voltage regulator
FO-PIFractional order proportional-integral
PCCPoint of common coupling
VFVirtual friction
CCCentral controller
COIThe center of inertia
EMSEnergy management system
MSEMean squared error
FLFederated learning

References

  1. Peykarporsan, R.; Oshnoei, S.; Fathollahi, A.; Lie, T.T. A Novel Intelligent Fractional Order Cascade Control to Enhance Wind Energy Conversion in Wind Farms: A Practical Case Study. IEEE Trans. Energy Convers. 2025, 40, 1736–1749. [Google Scholar] [CrossRef]
  2. Oshnoei, A.; Khezri, R.; Ghaderzadeh, M.; Parang, H.; Oshnoei, S.; Kheradmandi, M. Application of IPSO algorithm in DFIG-based wind turbines for efficient frequency control of multi-area power systems. In Proceedings of the 2017 Smart Grid Conference (SGC), Tehran, Iran, 20–21 December 2017; pp. 1–6. [Google Scholar]
  3. Wu, J.; Liu, M.; Lu, W.; Xie, K. Real-time optimization of active distribution networks with distributed energy resources participating in frequency regulation. J. Clean. Prod. 2021, 328, 129597. [Google Scholar] [CrossRef]
  4. Huang, Y.; Sun, Q.; Chen, Z.; Gao, D.W.; Pedersen, T.B.; Larsen, K.G.; Li, Y. Dynamic Modeling and Analysis for Electricity-Gas Systems with Electric-Driven Compressors. IEEE Trans. Smart Grid 2025, 16, 2144–2155. [Google Scholar] [CrossRef]
  5. Citro, C.; Al-Numay, M.; Siano, P.; Alhelou, H.H. Experimental evaluation of virtual synchronous generators with high regulation performance to enhance AC–DC grid interconnections. Int. J. Electr. Power Energy Syst. 2024, 158, 109964. [Google Scholar] [CrossRef]
  6. Sati, S.E.; Al-Durra, A.; Zeineldin, H.H.; EL-Fouly, T.H.M.; El-Saadany, E.F. Decentralized frequency restoration and stability enhancement for virtual synchronous machines at economic dispatch in islanded microgrid. Appl. Energy 2025, 377, 124544. [Google Scholar] [CrossRef]
  7. Khaleghi, A.; Karimipour, H. A Probabilistic-Based Approach for Detecting Simultaneous Load Redistribution Attacks Through Entropy Analysis and Deep Learning. IEEE Trans. Smart Grid 2025, 16, 1851–1861. [Google Scholar] [CrossRef]
  8. Khaleghi, A.; Ghazizadeh, M.S.; Aghamohammadi, M.R.; Guerrero, J.M.; Vasquez, J.C.; Guan, Y. A Probabilistic Data Recovery Framework Against Load Redistribution Attacks Based on Bayesian Network and Bias Correction Method. IEEE Trans. Power Syst. 2024, 39, 5806–5817. [Google Scholar] [CrossRef]
  9. Oshnoei, S.; Aghamohammadi, M.R.; Khooban, M.H. Smart frequency control of cyber-physical power system under false data injection attacks. IEEE Trans. Circuits Syst. I Regul. Pap. 2024, 71, 5582–5595. [Google Scholar] [CrossRef]
  10. Oshnoei, S.; Aghamohammadi, M.R.; Heidari, J.; Khooban, M.H. Watermarking-based defense mechanism in LFC of electricity grids compromised by covert attacks. IEEE Trans. Circuits Syst. II Express Briefs 2024, 71, 4576–4580. [Google Scholar] [CrossRef]
  11. Bakeer, M.; Bakeer, A.; Magdy, G.; Aly, M.M. A new cyber-security approach for load frequency control of hybrid interconnected renewable power systems. J. Clean. Prod. 2023, 425, 138866. [Google Scholar] [CrossRef]
  12. Sinha, M.; Dörfler, F.; Johnson, B.B.; Dhople, S.V. Uncovering droop control laws embedded within the nonlinear dynamics of van der pol oscillators. IEEE Trans. Control Netw. Syst. 2015, 4, 347–358. [Google Scholar] [CrossRef]
  13. D’Arco, S.; Suul, J.A.; Fosso, O.B. A Virtual Synchronous Machine implementation for distributed control of power converters in SmartGrids. Electr. Power Syst. Res. 2015, 122, 180–197. [Google Scholar] [CrossRef]
  14. Zhong, Q.-C.; Weiss, G. Synchronverters: Inverters that mimic synchronous generators. IEEE Trans. Ind. Electron. 2010, 58, 1259–1267. [Google Scholar] [CrossRef]
  15. Zhong, Q.-C.; Nguyen, P.-L.; Ma, Z.; Sheng, W. Self-synchronized synchronverters: Inverters without a dedicated synchronization unit. IEEE Trans. Power Electron. 2013, 29, 617–630. [Google Scholar] [CrossRef]
  16. Arghir, C.; Jouini, T.; Dörfler, F. Grid-forming control for power converters based on matching of synchronous machines. Automatica 2018, 95, 273–282. [Google Scholar] [CrossRef]
  17. Curi, S.; Groß, D.; Dörfler, F. Control of low-inertia power grids: A model reduction approach. In Proceedings of the 2017 IEEE 56th Annual Conference on Decision and Control (CDC), Melbourne, Australia, 12–15 December 2017; pp. 5708–5713. [Google Scholar]
  18. Arghir, C.; Dörfler, F. The electronic realization of synchronous machines: Model matching, angle tracking, and energy shaping techniques. IEEE Trans. Power Electron. 2019, 35, 4398–4410. [Google Scholar] [CrossRef]
  19. Seo, G.-S.; Colombino, M.; Subotic, I.; Johnson, B.; Groß, D.; Dörfler, F. Dispatchable virtual oscillator control for decentralized inverter-dominated power systems: Analysis and experiments. In Proceedings of the 2019 IEEE Applied Power Electronics Conference and Exposition (APEC), Anaheim, CA, USA, 17–21 March 2019; pp. 561–566. [Google Scholar]
  20. Chlela, M.; Mascarella, D.; Joos, G.; Kassouf, M. Fallback control for isochronous energy storage systems in autonomous microgrids under denial-of-service cyber-attacks. IEEE Trans. Smart Grid 2017, 9, 4702–4711. [Google Scholar] [CrossRef]
  21. Dibaji, S.M.; Pirani, M.; Flamholz, D.B.; Annaswamy, A.M.; Johansson, K.H.; Chakrabortty, A. A systems and control perspective of CPS security. Annu. Rev. Control 2019, 47, 394–411. [Google Scholar] [CrossRef]
  22. Barua, A.; Al Faruque, M.A. Hall Spoofing: A {Non-Invasive}{DoS} Attack on {Grid-Tied} Solar Inverter. In Proceedings of the 29th USENIX Security Symposium (USENIX Security 20), Boston, MA, USA, 12–14 August 2020; pp. 1273–1290. [Google Scholar]
  23. Salehghaffari, H.; Khodaparastan, M. Dynamic attacks against inverter-based microgrids. In Proceedings of the 2019 IEEE Power & Energy Society General Meeting (PESGM), Portland, OR, USA, 4–8 August 2019; pp. 1–5. [Google Scholar]
  24. Sheng, L.; Lou, G.; Gu, W.; Lu, S.; Ding, S.; Ye, Z. Optimal communication network design of microgrids considering cyber-attacks and time-delays. IEEE Trans. Smart Grid 2022, 13, 3774–3785. [Google Scholar] [CrossRef]
  25. Joseph, A.; Smedley, K.; Mehraeen, S. Secure power distribution against reactive power control malfunction in DER units. IEEE Trans. Power Deliv. 2020, 36, 1552–1561. [Google Scholar] [CrossRef]
  26. Li, Y.; Zhang, P.; Zhang, L.; Wang, B. Active synchronous detection of deception attacks in microgrid control systems. IEEE Trans. Smart Grid 2016, 8, 373–375. [Google Scholar] [CrossRef]
  27. Abhinav, S.; Modares, H.; Lewis, F.L.; Ferrese, F.; Davoudi, A. Synchrony in networked microgrids under attacks. IEEE Trans. Smart Grid 2017, 9, 6731–6741. [Google Scholar] [CrossRef]
  28. Bidram, A.; Poudel, B.; Damodaran, L.; Fierro, R.; Guerrero, J.M. Resilient and cybersecure distributed control of inverter-based islanded microgrids. IEEE Trans. Ind. Inform. 2019, 16, 3881–3894. [Google Scholar] [CrossRef]
  29. Zhou, Q.; Shahidehpour, M.; Alabdulwahab, A.; Abusorrah, A. A cyber-attack resilient distributed control strategy in islanded microgrids. IEEE Trans. Smart Grid 2020, 11, 3690–3701. [Google Scholar] [CrossRef]
  30. Khaleghi, A.; Karimipour, H. Investigation of Detection Mechanisms Against False Data Injection Attacks Based on Machine Learning Approaches. In Artificial Intelligence in the Operation and Control of Digitalized Power Systems; Springer: Berlin/Heidelberg, Germany, 2024; pp. 209–231. [Google Scholar]
  31. Xiahou, K.; Liu, Y.; Wu, Q.H. Decentralized detection and mitigation of multiple false data injection attacks in multiarea power systems. IEEE J. Emerg. Sel. Top. Ind. Electron. 2021, 3, 101–112. [Google Scholar] [CrossRef]
  32. Oshnoei, S.; Aghamohammadi, M. Detection and mitigation of coordinate false datainjection attacks in frequency control of power grids. In Proceedings of the 2021 11th Smart Grid Conference (SGC), Tabriz, Iran, 7–9 December 2021; pp. 1–5. [Google Scholar]
  33. Beikbabaei, M.; Mehrizi-Sani, A. Detection and mitigation of cyberattacks on Volt-Var control. arXiv 2024, arXiv:2404.02374. [Google Scholar] [CrossRef]
  34. Habibi, M.R.; Baghaee, H.R.; Blaabjerg, F.; Dragičević, T. Secure control of DC microgrids for instant detection and mitigation of cyber-attacks based on artificial intelligence. IEEE Syst. J. 2021, 16, 2580–2591. [Google Scholar] [CrossRef]
  35. Wilson, M.; Mahmood, H.; Giordano, J. Detection and mitigation of cyberattacks against power measurement channels using LSTM neural networks. In Proceedings of the 2021 IEEE Energy Conversion Congress and Exposition (ECCE), Vancouver, BC, Canada, 10–14 October 2021; pp. 1419–1426. [Google Scholar]
  36. Takiddin, A.; Ismail, M.; Zafar, U.; Serpedin, E. Deep autoencoder-based anomaly detection of electricity theft cyberattacks in smart grids. IEEE Syst. J. 2022, 16, 4106–4117. [Google Scholar] [CrossRef]
  37. Li, F.; Li, Q.; Zhang, J.; Kou, J.; Ye, J.; Song, W.; Mantooth, H.A. Detection and diagnosis of data integrity attacks in solar farms based on multilayer long short-term memory network. IEEE Trans. Power Electron. 2020, 36, 2495–2498. [Google Scholar] [CrossRef]
  38. Zografopoulos, I.; Konstantinou, C. Detection of malicious attacks in autonomous cyber-physical inverter-based microgrids. IEEE Trans. Ind. Inform. 2021, 18, 5815–5826. [Google Scholar] [CrossRef]
  39. Guo, L.; Zhang, J.; Ye, J.; Coshatt, S.J.; Song, W. Data-driven cyber-attack detection for pv farms via time-frequency domain features. IEEE Trans. Smart Grid 2021, 13, 1582–1597. [Google Scholar] [CrossRef]
  40. Yang, B.; Guo, L.; Li, F.; Ye, J.; Song, W. Impact analysis of data integrity attacks on power electronics and electric drives. In Proceedings of the 2019 IEEE Transportation Electrification Conference and Expo (ITEC), Detroit, MI, USA, 19–21 June 2019; pp. 1–6. [Google Scholar]
  41. Tayyebi, A.; Groß, D.; Anta, A.; Kupzog, F.; Dörfler, F. Frequency stability of synchronous machines and grid-forming power converters. IEEE J. Emerg. Sel. Top. Power Electron. 2020, 8, 1004–1018. [Google Scholar] [CrossRef]
  42. Reissner, F.; Yin, H.; Weiss, G. A Stability Result for Network Reduced Power Systems Using Virtual Friction and Inertia. IEEE Trans. Smart Grid 2022, 13, 1668–1678. [Google Scholar] [CrossRef]
  43. Oshnoei, S.; Aghamohammadi, M.; Oshnoei, S. A Novel Fractional order controller based on Fuzzy Logic for Regulating the Frequency of an Islanded Microgrid. In Proceedings of the 2019 International Power System Conference (PSC), Tehran, Iran, 9–11 December 2019; pp. 320–326. [Google Scholar]
  44. Reißner, F.; Chong, M.S. Secure control for a microgrid of VSMs with Virtual Friction. In Proceedings of the 2024 European Control Conference (ECC), Stockholm, Sweden, 25–28 June 2024; pp. 3083–3090. [Google Scholar]
  45. Ekeriance, D.; Wokoma, B.; Ojuka, O.; Okoroma, P.; Aferonkhaire, J. Comparative study of modified Euler and 4th order Runge Kutta numerical techniques for transient stability prediction. J. Recent Trends Electr. Power Syst. 2024, 7, 10–21. [Google Scholar]
  46. Li, Y.; Wei, X.; Li, Y.; Dong, Z.; Shahidehpour, M. Detection of false data injection attacks in smart grid: A secure federated deep learning approach. IEEE Trans. Smart Grid 2022, 13, 4862–4872. [Google Scholar] [CrossRef]
  47. Kausar, F.; Deo, S.; Hussain, S.; Ul Haque, Z. Federated Deep Learning Model for False Data Injection Attack Detection in Cyber Physical Power Systems. Energies 2024, 17, 5337. [Google Scholar] [CrossRef]
  48. Alshede, H.; Jambi, K.; Nassef, L.; Alowidi, N.; Fadel, E. FedAvg-P: Performance-Based hierarchical federated learning-based anomaly detection system aggregation strategy for advanced metering infrastructure. Sensors 2024, 24, 5492. [Google Scholar] [CrossRef] [PubMed]
Figure 1. Control layer structure of a grid forming FOC-VSM.
Figure 1. Control layer structure of a grid forming FOC-VSM.
Fractalfract 09 00569 g001
Figure 2. The single diagram of the IEEE 9-bus system.
Figure 2. The single diagram of the IEEE 9-bus system.
Fractalfract 09 00569 g002
Figure 3. FDIA on local frequency measurements sent to the CC.
Figure 3. FDIA on local frequency measurements sent to the CC.
Fractalfract 09 00569 g003
Figure 4. (a,b) FDIA on COI frequency feedback to VSM1.
Figure 4. (a,b) FDIA on COI frequency feedback to VSM1.
Fractalfract 09 00569 g004
Figure 5. (a,b) FDIA on voltage reference at VSM1.
Figure 5. (a,b) FDIA on voltage reference at VSM1.
Fractalfract 09 00569 g005
Figure 6. Training loss convergence for models over 20 epochs.
Figure 6. Training loss convergence for models over 20 epochs.
Fractalfract 09 00569 g006
Figure 7. Comparison of detection performance (precision, recall, and F1 score).
Figure 7. Comparison of detection performance (precision, recall, and F1 score).
Fractalfract 09 00569 g007
Table 1. Attack and simulation parameter variations.
Table 1. Attack and simulation parameter variations.
ParameterDescriptionRange/Values
Attack typeType of FDIA appliedFrequency report, COI feedback, power setpoint, voltage reference
Trigger timeRandomized start time of attack (per trial)Uniform in [1 s, 7 s]
Attack durationLength of injected signalRandom in [0.5 s, 2 s]
Amplitude (A)Perturbation strengthA ∈ [1, 5] rad/s or p.u. equivalent
Attack waveformShape of injected signalConstant, sine, square, ramp
Load levelActive and reactive load at busesVaried from 0.8 to 1.2 of nominal
VSM under attackTargeted inverter(s)VSM 1, VSM 2, or both
Table 2. PI-LSTM model and training parameters.
Table 2. PI-LSTM model and training parameters.
ComponentDescriptionValue
Input sequence lengthTime steps per training sample20 steps (100 ms)
Hidden units (per cell)Number of LSTM units per recurrent layer64
Recurrent layersNumber of stacked LSTM layers2
Physics-informed layerEmbedded residual-based constraintEuler-form dynamic loss
Learning rateInitial learning rate0.001
OptimizerOptimization algorithmAdam
Batch sizeMini-batch size per round32
Number of FL roundsGlobal communication rounds50
Local epochsTraining epochs per round (per client)2
ClientsNumber of FL participants (VSMs)2 (VSM1 and VSM2)
Loss functionCombined physics + MSE lossL = L d a t a + λ L P h y s i c s
λ (physics loss weight)Scaling for physics-based residuals0.6
Table 3. Training and inference time comparison for all four model configurations.
Table 3. Training and inference time comparison for all four model configurations.
ModelTraining Time Per Epoch (s)Inference Time Per Sample (ms)
CL-LSTM6.20.38
FL-LSTM3.4 (per client)0.35
CL-PI-LSTM7.80.41
FL-PI-LSTM4.0 (per client)0.39
Table 4. Sensitivity of detection performance to λ.
Table 4. Sensitivity of detection performance to λ.
λPrecision (%)Recall (%)False Positive Rate (%)
0.291.885.63.1
0.595.292.42.5
0.893.196.75.4
Table 5. Fixed vs. dynamic threshold performance.
Table 5. Fixed vs. dynamic threshold performance.
Threshold TypePrecision (%)Recall (%)FPR (%)
Fixed threshold95.896.24.7
Dynamic threshold95.596.02.4
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

Khaleghi, A.; Oshnoei, S.; Mirzajani, S. Federated Learning Detection of Cyberattacks on Virtual Synchronous Machines Under Grid-Forming Control Using Physics-Informed LSTM. Fractal Fract. 2025, 9, 569. https://doi.org/10.3390/fractalfract9090569

AMA Style

Khaleghi A, Oshnoei S, Mirzajani S. Federated Learning Detection of Cyberattacks on Virtual Synchronous Machines Under Grid-Forming Control Using Physics-Informed LSTM. Fractal and Fractional. 2025; 9(9):569. https://doi.org/10.3390/fractalfract9090569

Chicago/Turabian Style

Khaleghi, Ali, Soroush Oshnoei, and Saeed Mirzajani. 2025. "Federated Learning Detection of Cyberattacks on Virtual Synchronous Machines Under Grid-Forming Control Using Physics-Informed LSTM" Fractal and Fractional 9, no. 9: 569. https://doi.org/10.3390/fractalfract9090569

APA Style

Khaleghi, A., Oshnoei, S., & Mirzajani, S. (2025). Federated Learning Detection of Cyberattacks on Virtual Synchronous Machines Under Grid-Forming Control Using Physics-Informed LSTM. Fractal and Fractional, 9(9), 569. https://doi.org/10.3390/fractalfract9090569

Article Metrics

Back to TopTop