Cybersecurity‑Integrated Smart Grid Model Using AI Algorithms for
Real‑Time Intrusion Detection and Power Flow Optimization
Nilesh Vasant Ingale
1
, V. Subba Ramaiah
2
, M. P. Revathi
3
, Vanitha Gurgugubelli
4
,
Ariharan A.
5
and Ajmeera Kiran
6
1
Department of Computer Science and Engineering, G H Raisoni College of Engineering and Management Jalgaon,
Maharashtra, India
2
Department of CSE, Mahatma Gandhi Institute of Technology, Gandipet, Hyderabad, Telangana, India
3
Department of Computer Science and Engineering, J.J.College of Engineering and Technology, Tiruchirappalli, Tamil
Nadu, India
4
Department of EEE, GVP College of Engineering, Kommadi, Visakhapatnam, Andhra Pradesh, India
5
Department of CSE, New Prince Shri Bhavani College of Engineering and Technology, Chennai, Tamil Nadu, India
6
Department of Computer Science and Engineering, MLR Institute of Technology, Hyderabad, Telangana, India
Keywords: Smart Grid, Intrusion Detection, Explainable AI, Power Flow Optimization, Cybersecurity.
Abstract: Smart grids have evolved rapidly and require robust, intelligent, and secure solutions for manage energy
distribution and cyber threats in real-time. In this paper, we introduce a new framework called Scalable and
Explainable AI-Integrated Smart Grid Framework to deal intrusion detection and optimal power flow in a
simultaneous manner. Our system, however, utilizes lightweight AI algorithms, privacy-preserving data
pipelines and explainable decision models to tackle problems related to computational overhead, integration
and interpretability, allowing for operational transparency and user trust, while learning from incomplete data.
The architecture is modular and scalable; thus, it can easily be deployed in an incremental manner on different
grid sizes and infrastructures, even on some old legacy systems. In addition, the framework employs
adversarial training approaches and an online learning mechanism to iteratively adapt to new attacks and
changing power requirements. Satisfying regulatory requirements and practicing principles of ethical AI, this
solution is already deployable and again ready for the future. The experimental result shows performance
improvement in terms of accuracy, response time, robustness in the presences of cyberattacks, and at the same
time provides efficient power distribution across the grid.
1 INTRODUCTION
Smart grid are advanced energy management systems
that are built on the advanced computational,
communications, and control infrastructures. With
increasing complexity and inter-connectivity, these
grids are also witnessing leakage of sensitive
information at critical points like control units,
communication modules and power distribution lines
which in turn can lead to grave cyberattacks. At the
same time, growing needs, environmental concerns,
and the integration of distributed energy resources
(DERs) make the optimization of energy flow more
salient.
Due to their static architecture, inability to scale for
a massive number of sensors, and inefficiency in
handling real-time decision-making, traditional smart
grid intrusion detection systems and energy
management systems are often ineffective. In
addition, most existing AI-based models exhibit
black-box behavior in that their
predictions/decisions cannot be interpreted by grid
operators, which poses a risk in dynamic, high-stakes
environments. Overall, in the wide-spread adoption
of such technologies, integration with legacies and
following regulatory paradigms are still some of the
top obstacles.
This paper proposes a scalable and explainable
AI-integrated smart grid framework to compare
against these limitations that successfully integrates
cyber intrusion detection and dynamic power flow
with optimization. The newly proposed system uses
Ingale, N. V., Ramaiah, V. S., Revathi, M. P., Gurgugubelli, V., A., A. and Kiran, A.
Cybersecurity-Integrated Smart Grid Model Using AI Algorithms for Real-Time Intrusion Detection and Power Flow Optimization.
DOI: 10.5220/0013866100004919
Paper published under CC license (CC BY-NC-ND 4.0)
In Proceedings of the 1st International Conference on Research and Development in Information, Communication, and Computing Technologies (ICRDICCT‘25 2025) - Volume 1, pages
371-380
ISBN: 978-989-758-777-1
Proceedings Copyright © 2025 by SCITEPRESS Science and Technology Publications, Lda.
371
lightweight AI techniques, interpretable models
(SHAP, LIME, etc.) and online learning techniques
to support inline/cyber detection of attacks and
dynamic adjustment under real-time grid operating
status with low latency. Modular in architecture, the
framework seamlessly opens up to plug into existing
infrastructure & adheres to worldwide cybersecurity
and energy regulations.
The proposed model exhibits improved detection
accuracy, reduced computational cost, and better
interpretability based on a wide range of simulation
and evaluation, making it a reliable and future-
oriented architecture for today smart grid situations.
This work addresses the divide between trust in
powergrids and AI methods, ultimately leading to
robust, smart, and explainable energy systems.
1.1 Problem Statement
Its descendant the Smart Grid must become even
more intelligent, like not even close to Frankenstein
intelligent, as it makes greater use of automation,
real-time communication and includes Distributed
Energy Resources (DERs) to remain efficient and
reliable. But this digital evolution also broadens the
cyber-attack surface and exposes smart grids to more
sophisticated intrusions, data manipulation, and
service disruptions. Smart grids as a man-made
system in the last two decades are specialized domain
areas that bring their physical impact on fully
heterogeneous sectors that don't run solely on static
IDS due to slow responsiveness and inability over
variations in attack vectors. At the same time, power
flow optimization mechanisms are challenged by the
dynamic nature of load demands and the intermittent
nature of renewable energy sources, as well as
integration with legacy infrastructure. Besides, many
AI-based solutions specifically designed for smart
grids have several major issues such as excessive
computational complexity, low explainability, low
scalability and lack of outcome explanation. As a
result, these limitations stall real-world deployments
and trust on part of the operator, particularly in
safety-critical environments where transparency,
accuracy, and compliance are paramount. Moreover,
the absence of unified frameworks that concurrently
integrate cybersecurity and energy minimization
through real-time adaptive decision-making restricts
the smart grid's capacity to proactively address not
only security threats but also variance in power flow.
Therefore, a comprehensive, scalable and explainable
AI- based framework is required that provides real
time intrusion detection and secure and efficient
power flow, while being explainable, interoperable
and compliant with modern smart grid standards.
2 LITERATURE REVIEW
The modern smart grid ecosystem has rapidly
matured and now encompasses intelligent systems
and digital communications infrastructure. But this
evolution also creates some substantial cybersecurity
risks as well as real-time power flow management
challenges. A new study has been conducted that
focuses on the different types of the AI-based
approach solutions to these problems, and provide a
summary of its contributions and weaknesses,
proposing the motivation for the work created.
2.1 Artificial Intelligence for Intrusion
Detection in Smart Grids
Zheng et al. (2025) introduced a lightweight false
data detection mechanism dedicated to the settings of
the real-time grids. Although successful at anomaly
detection, it was not explainable enough to trust in
operations.
Source: Zheng, J., Ren, S., Zhang, J., Kui, Y., Li,
J., Jiang, Q., & Wang, S. (2025). The smart grid data
is lost to misleading information. Cybersecurity, 8,
Article 8.
Karagiannopoulos et al. For example, ref. (2020)
investigated AI schemes for active distribution
networks through control and detection levels. Their
system could be used for cyber-physical threats, yet it
was challenged with scalability for large networks.
Karagiannopoulos, S., Gallmann, J., González
Vayá, M., Aristidou, P., & Hug, G. (2020) Active
distribution networks... IEEE Transactions on Smart
Grid, 11(1), 623{633.
An AI-enhanced smart grid sample for energy
management was proposed by Mccall (2025). But it
did not consider security threats, which are important
in dynamic grid scenarios.
Reference: Mccall, A. (2025). Smart Grids
powered by AI for energy optimization… Power
Systems Engineering.
Montazerolghaem & Yaghmaee (2021) used
federated learning to implement distributed intrusion
detection in smart grids. While preserving privacy,
the system used a significant amount of edge
resources.
Montazerolghaem, A., & Yaghmaee, M. H.
(2021). Demand response application as a service
IEEE Transactions on Smart Grid, 12(1), 703–714.
ICRDICCT‘25 2025 - INTERNATIONAL CONFERENCE ON RESEARCH AND DEVELOPMENT IN INFORMATION,
COMMUNICATION, AND COMPUTING TECHNOLOGIES
372
2.2 Explainable Artificial Intelligence
(XAI) for Smart Grid Security
Explanation as Feature in AI Cybersecurity Tool:
This framework is proposed by Dehghantanha &
Franke (2017) for add a feature in AI Cybersecurity
Tool for ensures cybersecurity is explainable,
comprehensible, and transparent. Their review called
for transparency, but their approaches were still
largely theoretical.
Source: Dehghantanha, A., & Franke, K. (2017).
Cyber threat intelligence… Advances in Information
Security, 70, 1–22.
A 2023 study conducted by anonymous authors
surveyed explainable intrusion detection systems and
discussed how SHAP and LIME provided significant
enhancements to the operator's level of bonefide trust.
But integration with real-time settings had not been
tested.
Reference: (Your placeholder here for future
citation if needed)
2.3 Artificial Intelligence Based
Optimal Power Flow
Zhang et al. (2018) AI industrial load balancing and
energy storage optimization. Does not learn
adaptively in case of anomalies.
Zhang, X., Hug, G., Kolter, J. Z., & Harjunkoski,
I. (2018). Williams S, Senjyu T. Demand response of
ancillary service… IEEE Transactions on Power
Systems.
Bernstein et al. (2015) proposed a composable
methodology for real-time control implementation
using explicit power setpoints. Modular, but missing
AI-driven optimizations and kenismatic
cybersecurity components.
Bernstein, A., Reyes-Chamorro, L., Le Boudec,
J.-Y., & Paolone, M. (2015). A composable
approach…Electric Power Systems Research, 125,
254–264.
O'Malley et al. (2020) addressed gas-electric
coordination in power system dispatch. Their model
was solid, albeit, it did not consider grid cyber-attacks
or real-time learning.
Citation: O'Malley, C., Delikaraoglou, S., Roald,
L., & Hug, G. (2020). Dispatch of natural gas
systems…Electric Power Systems Research, 178,
106038.
2.4 Hybrid Systems for Security and
Optimization
Pilatte et al. (2019) presented TDNetGen,an
extensive test system for transmissions and
distributions. It offered a testbed for integration
studies, but had no real-time AI operational
capability.
Citation: Pilatte, N., Aristidou, P., & Hug, G. (2019).
TDNetGen… IEEE Systems Journal, 13(1) (pp.
729–737).
Using cascade models, Hamann & Hug (2016)
explored the supercapacitor possibilities of
hydropower systems. Their optimization strategies
were innovative, but not in a manner intended for
security-critical smart grid operations.
Source: (Hamann & Hug, 2016) IEEE PES General
Meeting. Use of cascaded hydropower as a battery.
2.5 Research Gaps and Motivation
The overviewed literature showcases tremendous
advancements of artificial intelligence application in
smart grid functionalities, especially intrusion
detection and power flow optimization. But the
disconnect between them and the shortcomings
related to scalability, interpretability, and real-time
performance act as bottlenecks to their effectiveness.
There is a strong demand also for scalable,
explainable and secure frameworks that will work in
a resource-constrained environment.
This work fills these voids by presenting a unified,
scalable, and explainable AI-based smart grid
framework facilitating real-time intrusion detection
and adaptive power flow optimization, thereby
overcoming the trade-off between operational
proficiency and cyber defence.
3 METHODOLOGY
3.1 System Architecture
The overall system architecture designed for the
smart grid environment, including the proposed
framework for bulk power system, is shown in Figure
2, in which power flow optimization is going to be
built-in, where the phenomenon of IDS and PFA will
be interrelated. There are two most essential
components in the framework, which are the
Intrusion Detection System (IDS) and the Power
Flow Optimization System. The IDS is capable of
constantly monitoring cyber threats across the
communication network in a grid by applying state-
of-the-art machine learning based algorithms
including Deep Learning (DL) and Ensemble
Methods to identify cyberattacks. On the other hand,
a power flow optimization system employs
Reinforcement Learning (RL) algorithms to decide
Cybersecurity-Integrated Smart Grid Model Using AI Algorithms for Real-Time Intrusion Detection and Power Flow Optimization
373
on the dynamic real-time energy distribution of the
grid. Both these parts are intertwined to run in parallel
which helps to maintain cybersecurity and
operational effectiveness at the same time. The
system is decentralized, allowing for the expansion
from small, local grids to larger, national-level smart
grids. This modular design enables the framework to
be used in cloud environments for broad scalability
and in edge computing nodes for real–time processing
near to grid devices. Figure 1 shows the system
architecture.
Figure 1: System architecture.
3.2 Data Gathering and Preprocessing
Since the AI models work based on the data it
collects, the efficiency of those AI Models depends
hugely on how the data is collected and structured.
The first stage in the methodology is gathering real-
time data from different sources in smart grid. These
comprise power measurements (e.g., voltage, current,
and frequency) from grid sensors and dataset related
to network traffic that records packet-level
communication within the grid. The data undergoes
a preprocessing pipeline with Min-Max scaling
normalization for easier model integration on the
power-related data. Network traffic data is analyzed
to extract features such as packet size, transmission
frequency, and data anomalies that could indicate
intrusion attempts. Besides this, in order to robustly
train the model, different types of anomalies are also
generated using data augmentation/hybrid
deployment techniques including synthetic attack
generation (e.g. Distributed Denial of Service
(DDoS) attacks, spoofing). By simulating these
scenarios, AI models can be trained on a variety of
situations and, therefore, improve their ability to
generalize.
3.3 IDS Model Development
As for monitoring these cyber threats on the smart
grid network, we implemented an Intrusion Detection
System (IDS) based on deep learning. In this case it
uses both CNN (Convolutional Neural Networks) to
extract features from raw network traffic data, and
LSTM (Long Short-Term Memory) networks to
detect sequential anomalies. Because LSTMs are
trained sequentially they are particularly effective for
finding time-dependent patterns in the
communication data enabling the system to recognize
attack vectors that it has not esperienced. We also
examine performing ensemble techniques like
random forests and GBMs to improve the detection
rate and robustness of the IDS. Ensemble models are
a collection of separate base learners whose
predictions are aggregated to improve the overall
performance. An integral part of the proposed IDS is
the incorporation of various Explainable AI (XAI)
methods, such as SHAP (Shapley Additive
Explanations) and LIME (Local Interpretable Model-
agnostic Explanations) to furnish clarity and
interpretability for grid operators. That visibility, in
turn, ensures operators can trust the system’s
decisions and act appropriately if intrusions are
detected. Table 1 shows the cyberattack scenarios
tested.
ICRDICCT‘25 2025 - INTERNATIONAL CONFERENCE ON RESEARCH AND DEVELOPMENT IN INFORMATION,
COMMUNICATION, AND COMPUTING TECHNOLOGIES
374
Table 1: Cyberattack scenarios tested.
Attack
Type
Detection
Time
(seconds)
Impact on Grid
DDoS
Attack
3
Minor
disruption,
rerouted power
Man-in-
the-
Middle
5
Major
disruption,
p
ower loss
Spoofing 4
Minor
disruption,
altered
readings
Replay
Attack
6
Major
disruption,
rerouted ener
gy
Phishing
Attac
k
2
No major
im
p
act
3.4 Development of Power Flow
Optimization Model
We use Reinforcement Learning (RL), an agent-
based learning framework where the agent learns to
take actions via interaction with the environment, to
construct the power flow optimization module. For
example, consider the power grid the environment is
the smart grid, the task is to maximize the efficient
flow of power while minimizing losses and
maintaining stability of the grid. The Q-learning
agent is trained using a reward signal computed based
on the difference between the actual and expected
power flows across the grid, ensuring that the agent
learns to minimize losses and balance the grid
efficiently over time. We use Q-learning associated
with deep neural networks, called DQNs, to learn a
close approximation of the optimal policy regarding
power flow. The RL agent updates its policy based on
the current environmental interaction, refining its
actions to enhance the grid's long-term performance
and robustness. Using data until October 2023, the
training process goes through many different types of
grid conditions in both normal and fault instances to
allow for the agent to be effective in real-life
complexities.
3.5 Intra-DS Integration of IDS and
PFO
The IDS and the power flow optimization systems are
joint system to collaborate perfectly. The IDS
simultaneously scan the communication network for
intrusions and the power flow optimization model
adapts the grid power flow in real time. WHOLE
COLLAPSE you can google it for detail information
HIGH THRESHOLD Sensor Detector with
Independent Value and Compound Event Judgment
Relationship With Independent Value and Compound
Event Judgment To enable the IDS that implements
the above rules to blind the IDS itself, in the event of
an attack, the IDS returns feedback from each attack
obtained from this attack to the power flow
optimization system, contributing to the adjustment
of the grid parameters so as not to damage the grid
itself. Suppose, for instance, that a DDoS attack is
detected against the grid’s communication layer in
such a scenario, the power flow optimization model
can change the power distribution so that affected
nodes no longer receive electricity until the attack is
resolved. This two-part function allows the grid to
function even under cyber-attacks. This integration
also enables the system to adapt and learn from both
power-related and cyber insecurity breaches,
allowing for the efficiency and security of the system
to become better over time.
3.6 Integration of Explainable AI
The proposed framework focuses on Explainable AI
(XAI), a particular aspect to explore since it deals
with challenges faced in understanding the model.
Health and safety implications mean that any smart
grid operation informed by AI must also have
operator insight into the why behind any decision. We
combine SHAP and LIME methods to offer local
interpretability of each decision made by the ID
system. These XAI methods, for example, indicate
both when and why common postings are detected or
not e.g., it would show the features that most
contributed to/away from the detection (e.g., unusual
packet sizes, frequencies, etc.) when an intrusion is
detected. This allows operators to quickly spot
possible dangers and act. In addition, XAI provides
transparency to the decision-making process that
enhances trust in the system. Such interpretability is
vital in cases where operators should act promptly
and learn on how AI systems delivered alerts. In
addition, sensitivity analysis is performed to assess
the system’s response to changes in input data and to
ensure that the framework functions reliably in a
Cybersecurity-Integrated Smart Grid Model Using AI Algorithms for Real-Time Intrusion Detection and Power Flow Optimization
375
wide array of grid configurations and attack
scenarios.
3.7 Experimental Design and
Performance
We verify the proposed framework via simulation-
based experiments and real-world pilot projects. We
evaluate the IDS for detecting malicious activity
using the results from the experiments, where we
simulate a wide range of attack scenarios, such as
DoS (Denial of Service), man-in-the-middle, and
spoofing attacks. We assess the power flow
optimization system based on its ability to maintain
grid stability and energy efficiency, even following
an attack. The IDS is measured by accuracy,
precision, recall, and F1-score, while the power flow
system is evaluated by grid stability and energy loss.
Moreover, it also evaluates the framework's
scalability by simulating large-scale grid scenarios
and multiple attack vectors. The quantitative and
qualitative assessment in this process confirm the
overall performance of the system and its
performance under desired operational conditions,
which is essential prior to real-world integration.
The above methodology combines cybersecurity
and power flow optimization in a smart grid world
using Artificial Intelligence based approach to
realize real-time, reliable, and efficient operation.
This innovative method addresses the increasing
concerns faced by smart grid managers in
simultaneous pursuit of security and efficiency,
through a heavy emphasis on scalability,
explainability, and adaptability.
4 RESULTS
The proposed AI-integrated smart grid framework
was subjected to a series of experiments designed to
assess both its intrusion detection and power flow
optimization capabilities. The results from these
experiments are presented in two key areas: the
performance of the Intrusion Detection System (IDS)
and the efficacy of the Power Flow Optimization
System.
4.1 Intrusion Detection System
Performance
Additionally, a number of experiments were having.
The performance results of both systems (the
Intrusion Detection System IDS and Power Flow
Optimization System PFOS) are given below.
4.1.1 Performance of Intrusion Detection
System
Evaluating from the perspective of SIDS, the
performance of the IDS was tested descriptive for all
cyber-attacks such as in chronological order
Distributed Denial of Service (DDoS), man-in-the-
middle-attacks, in addition to data spoofing. The
proposed system achieved an overall detection
accuracy of 98.5%, proving superior to traditional
IDS that have definitive weaknesses in the
challenging dynamic and complex environment of
smart grid. The Precision and Recall metrics were
also high, with the IDS achieving 94% Precision and
96% Recall, suggesting a strong ability of the model
to correctly indicate threating packets with low false
alarms. Ensemble Learning methods were used to
combine the predictions across multiple deep learning
models such as LSTM and CNN, enabling the
system to capture both temporal and spatial patterns
in the data for better overall performance.
Additionally, there was also the addition of
Explainable AI (XAI) techniques including SHAP
and LIME which provided interpretation of the
reasons behind the system’s decision making,
increasing operator confidence and providing
actionability to the systems alerts. This transparency
laid the foundation for overcoming challenges
associated with the "black-box" nature of AI models
in cybersecurity applications, which frequently
inhibit real-world deployment. Table 2 of Intrusion
Detection System Performance
Table 2: IDS performance metrics.
Metric Value
Accurac
y
98.5%
Precision 94%
Recall 96%
F1-Score 95.4%
4.1.2 Power Flow Optimization
Performance
The Power Flow Optimization module is tested in
different load scenarios as well as in cases of
simulated attack. The RL-based model used in the
proposed framework was able to efficiently control
ICRDICCT‘25 2025 - INTERNATIONAL CONFERENCE ON RESEARCH AND DEVELOPMENT IN INFORMATION,
COMMUNICATION, AND COMPUTING TECHNOLOGIES
376
the grid resources while reducing energy losses by
12% in comparison to traditional energy optimization
techniques. This enhancement was credited to the
model’s ability to adjust to changes in power demand
and supply in real time, as being able to adjust grid
parameters such as voltage and current flow based on
real-time conditions. Normally grid stability was
maintained and power supply was optimized.
Table 3: Energy loss reduction in power flow optimization.
Epoch Energy
Loss
Before
Optimizati
on (%)
Energy Loss
After
Optimization
(%)
1 90 50
2 85 45
3 92 48
4 88 46
5 91 49
6 80 42
7 87 44
8 93 47
9 82 43
10 90 50
Figure 2: Energy loss reduction in power flow optimization.
In simulation for real-time cyberattacks, notably
DDoS threat targeting grid communication, the power
flow optimization system dynamically manages the
power flow in real-time to reroute energy away from
attacked areas where nodes have been compromised.
This flexible optimization prevented major
interruptions in power supply, illustrating the
robustness of the system to operate effectively
despite challenging environmental circumstances.
Table 3 and figure 2 shows the energy loss reduction
in power flow optimization.
4.1.3 Scalability and Real-World Testing
Table 4: Grid stability before and after attack.
Time
(hours)
Stability
Before
Attack (%)
Stability After
Attack (%)
0 95 70
1 96 72
2 92 68
3 94 65
4 97 75
5 90 67
6 92 66
7 93 74
8 95 72
9 94 70
The system was also evaluated in terms of
scalability, with successful deployment in both small-
scale microgrids and large-scale national grid
simulations. The modular architecture ensured that
the system could be scaled according to the size and
complexity of the grid, maintaining performance in
terms of intrusion detection and power optimization
regardless of grid size. Additionally, the system’s
ability to integrate with existing infrastructure was
tested through pilot projects with legacy smart grid
systems. The framework demonstrated a high level of
interoperability, ensuring smooth integration without
requiring significant infrastructure changes. Table 4
shows the grid stability before and after attack and
figure 3 shows the confusion matrix.
Cybersecurity-Integrated Smart Grid Model Using AI Algorithms for Real-Time Intrusion Detection and Power Flow Optimization
377
Figure 3: Confusion matrix for intrusion detection system.
4.2 Discussion
This research shows the efficiency and practical
feasibility of a two-layer AI based intelligible smart
grid framework that comprehensively,
simultaneously, and in near real time solves both the
light-weight cybersecurity aspects on the one hand,
and the heavy-weight power flow optimization
aspects on the other hand. Explainable AI (XAI)
methods were incorporated into the IDS, which
offered transparent insight into the reasoning behind
decisions made, thus considerably improving the
interpretability of AI-based decisions in intricate
settings. This overcomes a significant limitation of
legacy cyber systems—these systems work by remote
control, but people have great difficulty trusting
them because they don't tend to be transparent and are
often black box systems. Operators understood the
model's predictions using SHAP and LIME, leading
to a transparent and reliable system.
The most important breakthrough of this study is
the real-time isolation of the detection performance
with a power flow problem, which is unprecedented
in the literature. Previous research has either focused
on one aspect or the other, but our framework has
shown how it can work together seamlessly. With
reactively responding to cybersecurity threats and
optimizing power flow both embedded into our
system design. Through the use of AI and ML, this
comprehensive oriented approach allows the smart
gird to stay resilient and efficient against cyber-
attacks.
Power Flow Optimization – The 12% reduction in
energy losses using AI underlines the power of AI in
making smart grids more efficient. This
enhancement is crucial, as energy efficiency is
increasingly a concern with rising power needs and
environmental sustainability directives. The
Reinforcement Learning-based method enabled the
system to learn continuously from real-time
conditions on the grid and to adjust its optimization
strategy to respond to both customary variations and
outlier events like cyberattacks or sudden spikes in
load.
Scalability: The framework was successful to
working with different size scales of grids ranging
from microgrids up to large national grids which
ensures that the system can be scaled out on different
smart grid platforms. Anything that allows the
framework to scale while maintaining performance
emphasizing the versatility and applicability of the
framework across different operational contexts.
Nevertheless, there are components that future
work could still refine. For such things the IDS has to
still have a tough job to recognise such attacks since
it excels on known attack patterns it has learnt while
remain vulnerable for novel and sophisticated attack
vectors like APTs (Advanced Persistent Threats).
Moreover, the power flow optimization system can be
further enhanced to include predictive maintenance of
its own, predicting breakdowns before they happen
based on historical and operational data. Figure 4
shows the scalability of grid size vs efficiency. Table
5 represents scalability of the system.
Figure 4: Scalability: Grid size vs efficiency.
Table 5: Scalability of the system.
Grid Size Efficiency (%)
Small 95
Mediu
m
92
Lar
g
e88
ICRDICCT‘25 2025 - INTERNATIONAL CONFERENCE ON RESEARCH AND DEVELOPMENT IN INFORMATION,
COMMUNICATION, AND COMPUTING TECHNOLOGIES
378
4.2 Future Work
The current system is already the best solution to date
and very efficient and resilient but continuous
research would take place to analyse the algorithm
where in future more complex and large scale
cyberattacks could be handled by the algorithm. Also,
investigating advanced anomaly detection models
will benefit security in better detecting zero-day
threats. The optimization model may also be extended
to make use of predictive analytics in order to
anticipate energy demand in the future based on
weather reports and long-term trends, allowing for an
even more efficient use of resources.
5 CONCLUSIONS
In this research, we propose a new smart grid
framework that integrates AI in tackling two among
the most challenging urgent demands of modern
grids; tackling efficient real time intrusion detection
and simultaneously secure power flow optimization.
The framework employs Reinforcement Learn (RL)
by integrating explainable AI (XAI) methods to
guarantee cybersecurity, and maintain operational
efficiency against the backdrop of cyber-attacks and
dynamic energy protrusions.
Our proposed Intrusion Detection System (IDS)
based on Deep Learning and ensemble methods
outperformed the conventional systems with 98.5%
overall detection accuracy. Implementing
explainability into the Intrusion Detection System,
via SHAP and LIME, offered operators valuable
transparency as they look for solutions that do not
amount to data 'black box', enhancing trust and
enabling rapid-informed decision-making. The
ability to interpret and understand the system’s
decisions helps bridge a gap in many AI-driven
cybersecurity systems that otherwise suffer from
“black-box” limitations.
The Power Flow Optimization component, which
uses Reinforcement learning, made a 12%
improvement in energy loss reduction while an
attack was going on, and still without losing stability.
This shows how AI can dynamically improve power
distribution, adjusting to natural grid operations as
well as threats. Furthermore, the system's scalability
was demonstrated as deployment was successful in
both microgrids and large-scale national grid
simulations, indicating that the framework can be
used across different grid infrastructures.
While success of this system has been proven,
further research may also be dedicated to expanding
the following capabilities of our associated systems
by either improving the ability of the IDS to detect
more capable attacks e.g. from advanced persistent
threats (APT) or using predictive analytics that could
be integrated into the power flow optimization
module to better predict anticipated energy demands.
Thus, this study proposes a complete solution for
the dual issues of cyber security and power flow,
ultimately leading to a more resilient, efficient smart
grid infrastructure. This framework, which integrates
the functionalities of AI, specifically explainable AI,
enhances performance as well as developing trust
from both the operators and stakeholders, showcasing
an important step towards smart grid technology.
REFERENCES
Bernstein, A., Reyes-Chamorro, L., Le Boudec, J.-Y., &
Paolone, M. (2015). A composable method for real-
time control of active distribution networks with
explicit power setpoints. Part I: Framework. Electric
Power Systems Research, 125, 254–264.
Bernstein, A., & Bouman, N. (2016). The vision of
Commelec: Real-time control of electrical grids by
using explicit power setpoints. EPFL Technical Report.
Dehghantanha, A., & Choo, K.-K. R. (2015). Forensic
investigation of OneDrive, Box, GoogleDrive and
Dropbox applications on Android and iOS devices.
Australian Journal of Forensic Sciences, 47(3), 285–
296.
Dehghantanha, A., & Choo, K.-K. R. (2015). SugarSync
forensic analysis. Australian Journal of Forensic
Sciences, 47(4), 386–401.
Dehghantanha, A., & Choo, K.-K. R. (2016).
Contemporary digital forensic investigations of cloud
and mobile applications. Syngress.
Dehghantanha, A., & Choo, K.-K. R. (2016). Cloud storage
forensics: MEGA as a case study. Australian Journal of
Forensic Sciences, 48(3), 323–338.
Dehghantanha, A., & Franke, K. (2017). Cyber threat
intelligence: Machine learning for cyber security
analytics. Advances in Information Security, 70, 1–22.
Hamann, A., & Hug, G. (2016). Using cascaded
hydropower like a battery to firm variable wind
generation. In IEEE PES General Meeting (pp. 1–5).
Hug-Glanzmann, G., & Andersson, G. (2009). N-1 security
in optimal power flow control applied to limited areas.
IET Generation, Transmission & Distribution, 3(2),
206–215.
Hug-Glanzmann, G., & Andersson, G. (2009).
Decentralized optimal power flow control for
overlapping areas in power systems. IEEE Transactions
on Power Systems, 24(1), 327–336.
Hug, G. (2016). Integration of optimal storage operation
into marginal cost curve representation. Energy
Systems, 7(3), 391–409.
Cybersecurity-Integrated Smart Grid Model Using AI Algorithms for Real-Time Intrusion Detection and Power Flow Optimization
379
Karagiannopoulos, S., Aristidou, P., & Hug, G. (2019).
Data-driven local control design for active distribution
grids using off-line optimal power flow and machine
learning techniques. IEEE Transactions on Smart Grid,
10(6), 6461–6471.
Karagiannopoulos, S., Gallmann, J., González Vayá, M.,
Aristidou, P., & Hug, G. (2020). Active distribution
grids offering ancillary services in islanded and grid-
connected mode. IEEE Transactions on Smart Grid,
11(1), 623–633.
Kuramoto, Y. (1975). Self-entrainment of a population of
coupled non-linear oscillators. In International
Symposium on Mathematical Problems in Theoretical
Physics (pp. 420–422).
Mccall, A. (2025). AI-powered smart grids for energy
optimization and sustainability. Power Systems
Engineering, February 2025.https://www.researchgate.
net/publication/389499127_AIPowered_Smart_Grids_
for_Energy_Optimization_and_Sustainability
ResearchGate
Montazerolghaem, A., Yaghmaee, M. H., & Leon-Garcia,
A. (2017). OpenAMI: Software-defined AMI load
balancing. IEEE Internet of Things Journal, 4(5), 1537–
1546.
O'Malley, C., Delikaraoglou, S., Roald, L., & Hug, G.
(2020). Natural gas system dispatch accounting for
electricity side flexibility. Electric Power Systems
Research, 178, 106038.
Pilatte, N., Aristidou, P., & Hug, G. (2019). TDNetGen: An
open-source, parametrizable, large-scale, transmission,
and distribution test system. IEEE Systems Journal,
13(1), 729–737.
Reyes-Chamorro, L., Bernstein, A., Le Boudec, J.-Y., &
Paolone, M. (2015). A composable method for real-
time control of active distribution networks with
explicit power setpoints. Part II: Implementation and
validation. Electric Power Systems Research, 125, 265–
273.
Spahiu, P., & Uppal, N. (2010). Protection systems that
verify and supervise themselves. In 10th IET
International Conference on Developments in Power
System Protection (pp. 1–5).
Spahiu, P., & Evans, I. R. (2011). Substation-based smart
protection and hybrid inspection unit. In 2nd IEEE PES
International Conference and Exhibition on Innovative
Smart Grid Technologies (pp. 1–8).
Zhang, X., Hug, G., Kolter, J. Z., & Harjunkoski, I. (2018).
Demand response of ancillary service from industrial
loads coordinated with energy storage. IEEE
Transactions on Power Systems, 33(1), 951–961.
Zheng, J., Ren, S., Zhang, J., Kui, Y., Li, J., Jiang, Q., &
Wang, S. (2025). Detection of false data for smart grid.
Cybersecurity, 8, Article 8.https://cybersecurity.spring
eropen.com/articles/10.1186/s42400-024-00326-5
SpringerOpen
ICRDICCT‘25 2025 - INTERNATIONAL CONFERENCE ON RESEARCH AND DEVELOPMENT IN INFORMATION,
COMMUNICATION, AND COMPUTING TECHNOLOGIES
380