Major Stage 1
Major Stage 1
Submitted in partial fulfillment of the requirements for the award of the Degree of
in
by
                                                ACE
                                       Engineering College
                              An AUTONOMOUS Institution
                 NBA Accredited B. Tech Courses, Accorded NAAC ‘A’ Grade
                       Website: www.aceec.ac.in E-mail: info@aceec.ac.in
                                           CERTIFICATE
          This is to certify that the Major project Stage-I work entitled “A MACHINE
   LEARNING BASED CYBER ATTACK DETECTION MODEL FOR WIRELESS
   SENSOR NETWORKS IN MICROGRIDS” is being submitted by Mende Puja
   (22AG5A0501), B Anjali (21AG1A0509), Lavudya Harshitha (21AG5A0532), Karre
   Bharadwaj (22AG1A0526) in partial fulfillment for the award of Degree of BACHELOR OF
   TECHNOLOGY in COMPUTER SCIENCE AND ENGINEERING to the Jawaharlal Nehru
   Technological University, Hyderabad during the academic year 2024-25 is a record of bonafide work
   carried out by them under our guidance and supervision.
          The results embodied in this report have not been submitted by the student to any other
   University or Institution for the award of any degree or diploma.
                               ACKNOWLEDGEMENT
        We would like to express our gratitude to all the people behind the screen who have
helped us transform an idea into a real-time application.
       We would like to express our heartfelt gratitude to our parents without whom we would
not have been privileged to achieve and fulfill our dreams.
       A special thanks to our General Secretary, Prof. Y. V. Gopala Krishna Murthy, for
having founded such an esteemed institution. Sincere thanks to our COO Mr. Y.V.Raghu
Vamshi, for support in doing project work. We are also grateful to our beloved principal, Dr.
B. L. RAJU for permitting us to carry out this project
       We profoundly thank Dr. M. V. Vijaya Saradhi, Professor and Dean of the Department
of Computer Science and Engineering, who has been an excellent guide and also a great source
of inspiration for our work.
       We extremely thank Dr Ch Vijaya Kumar, HoS & Associate Professor, who helped
us in all the way in fulfilling of all aspects in completion of our Major-Project Satge-I.
       We extremely thank Dr. V. Ravi Kumar, Associate Professor and Project Coordinator,
who helped us all the way in fulfilling all aspects of the completion of our Major-Project Stage-I.
       We are very thankful to our internal guide Dr.M.V.Vijaya Saradhi, Professor and
Dean of the Department of Computer Science and Engineering, who has been an excellent
and also given continuous support for the Completion of our project work.
       The satisfaction and euphoria that accompany the successful completion of the task
would be great, but incomplete without the mention of the people who made it possible, whose
constant guidance and encouragement crown all the efforts with success. In this context, we
would like to thank all the other staff members, both teaching and non-teaching, who have
extended their timely help and eased our task.
                                                                                             BY
                                                                MENDE PUJA (22AG5A0501)
                                                                     B ANJALI (21AG1A0509)
                                                   LAVUDYA HARSHITHA (21AG1A0532)
                                                      KARRE BHARADWAJ (21AG1A0526)
                                           ACE ENGINEERING COLLEGE
                             INDEX
S. NO   CONTENTS                                         PAGE. NO
        ABSTRACT                                            1
  1.    INTRODUCTION                                        4
  2.    LITERATURE SURVEY                                   7
  3.    SOFTWARE REQUIREMENT AND ANALYSIS                   10
          3. 1 PROBLEM STATEMENT                            10
          3. 2 MODULES AND THEIR FUNCTIONALITIES            10
  4.    SOFTWARE DESIGN                                     12
          4. 1 ARCHITECTURE DIAGRAM                         12
          4. 2 DATAFLOW DIAGRAMS                            14
            4. 2. 1 DFD LEVEL - 0                           14
            4. 2. 2 DFD LEVEL - 1                           15
            4. 2. 3 DFD LEVEL - 2                           16
          4. 3 UML DIAGRAMS                                 18
            4. 3. 1 USECASE DIAGRAM                         18
            4. 3. 2 CLASS DIAGRAM                           19
            4. 3. 3 SEQUENCE DIAGRAM                        21
            4. 3. 4 COMPONENT DIAGRAM                       22
            4. 3. 5 ACTIVITY DIAGRAM                        23
            4. 3. 6 DEPLOYMENT DIAGRAM                      24
          4.4 METHODOLOGY                                   25
            4.4.1 CONVOLUTIONAL NEURAL NETWORKS             25
            4.4.2 PASSIVE AGGRESSIVE CLASSIFIERS            25
            4.4.3 RANDOM FOREST CLASSIFIERS                 26
            4.4.4 XBOOST CLASSIFIERS                        27
  5.    SOFTWARE AND HARDWARE REQUIREMENTS                  28
          5. 1 SOFTWARE REQUIREMENTS                        28
          5. 2 HARDWARE REQUIREMENTS                        28
 6.     CONCLUSIONS                                         29
 7.     REFERENCES                                          30
                                                                    ACE ENGINEERING COLLEGE
ABSTRACT
In this project, we demonstrate the context of cyber threats, explores the security challenges in wireless
sensor networks (WSNs) within microgrids, emphasizing the need for robust cyber-attack detection
mechanisms. The study introduces a machine learning-driven approach tailored for identifying network
anomalies and mitigating potential threats. By leveraging a diverse set of advanced algorithms—
including Convolutional Neural Networks (CNN), Passive Aggressive Classifiers, Random Forest
Classifiers, and XGBoost Classifiers—the model efficiently classifies network states as normal or
under specific attack scenarios, such as grayhole, blackhole, or flooding attacks.
Utilizing a comprehensive dataset from Kaggle, the system is trained to recognize intricate patterns
associated with cyber intrusions, enhancing its accuracy and responsiveness. This investigation aims
to strengthen the security framework of microgrids by integrating cutting-edge computational
methodologies, ensuring resilience against sophisticated cyber threats and fostering reliable network
operations.
This study not only focuses on detecting cyber threats but also emphasizes the adaptability and
scalability of the proposed model in real-world microgrid environments. By continuously analyzing
network traffic patterns, the system can evolve to recognize emerging attack strategies, making it a
proactive defense mechanism rather than a reactive one. Furthermore, the integration of multiple
machine learning techniques enhances the robustness of the detection framework, reducing false
positives and improving overall efficiency. As microgrids become increasingly reliant on WSNs,
implementing such intelligent security solutions is crucial to maintaining operational stability and
safeguarding critical infrastructure from evolving cyber threats.
The goal of this investigation is to advance the security framework of wireless sensor networks in
microgrids by integrating cutting-edge machine learning techniques. With a focus on maximizing
detection accuracy, the project aims to enhance cyber-attack identification, providing grid operators
with a powerful, automated tool that can assist in threat mitigation and ensure the resilience of
critical infrastructure. By leveraging a diverse set of classification algorithms, the model effectively
distinguishes between normal and malicious network behavior, minimizing false positives. This
approach not only strengthens the overall security posture of microgrids but also enables real-time
anomaly detection for swift incident response. Ultimately, the study contributes to the development
of intelligent cybersecurity solutions, ensuring the reliability and stability of next-generation smart
energy systems.
                                                                                                           1
                                            ACE ENGINEERING COLLEGE
                       LIST OF FIGURES
FIG. NO.   FIGURE NAME                                   PAGE NO.
  4. 1     ARCHITECTURE DIAGRAM                             12
 4. 2. 1   DFD LEVEL - 0                                    14
 4. 2. 2   DFD LEVEL - 1                                    15
 4. 2. 3   DFD LEVEL - 2                                    16
 4. 3. 1   USECASE DIAGRAM                                  18
 4. 3. 2   CLASS DIAGRAM                                    19
 4. 3. 3   SEQUENCE DIAGRAM                                 21
 4. 3. 4   COMPONENT DIAGRAM                                22
 4. 3. 5   ACTIVITY DIAGRAM                                 23
 4. 3. 6   DEPLOYMENT DIAGRAM                               24
 4. 4. 1   CONVOLUTIONAL NEURAL NETWORKS                    25
 4. 4. 2   PASSIVE AGGRESSIVE CLASSIFIERS                   25
 4. 4. 3   RANDOM FOREST CLASSIFIERS                        26
 4. 4. 4   XBOOST CLASSIFIERS                               27
                                                                      2
                                                 ACE ENGINEERING COLLEGE
                  LIST OF ABBREVIATIONS
S. No.   Abbrevation                             Full Form
  1      WSNs          Wireless Sensor Networks
  2      AI            Artificial Intelligence
  3      CNN           Convolutional Neural Networks
  4      NLP           Natural Language Processing
                                                                           3
                                                            ACE ENGINEERING COLLEGE
                                      CHAPTER 1
                                  INTRODUCTION
   In today’s increasingly interconnected energy landscape, wireless sensor networks (WSNs)
play a pivotal role in the efficient management and distribution of renewable energy within
microgrids. These networks enable real-time monitoring, data collection, and automated control
of energy systems, ensuring reliability and sustainability. However, as microgrids continue to
expand, their growing reliance on WSNs makes them highly vulnerable to sophisticated cyber
threats. Attacks such as grayhole, blackhole, and flooding can disrupt energy distribution,
compromise system stability, and lead to significant operational and financial consequences.
   In today’s digital era, the integration of Wireless Sensor Networks (WSNs) in microgrids
has revolutionized the way energy is managed, distributed, and monitored. These networks
enable real-time data collection, intelligent decision-making, and automation, ensuring that
renewable energy sources such as solar and wind power are efficiently utilized. As microgrids
become the backbone of modern energy infrastructure, their growing reliance on IoT-based
communication and control systems has made them susceptible to sophisticated cyber threats.
Cyber-attacks targeting WSNs can disrupt power distribution, compromise system stability, and
lead to financial and operational losses. The increasing frequency and severity of cyber threats
highlight the urgent need for robust and intelligent security mechanisms to safeguard these
critical infrastructures.
   The rapid evolution of energy distribution systems has led to the widespread adoption of
Wireless Sensor Networks (WSNs) in microgrids, playing a pivotal role in monitoring, control,
and optimization. These WSNs enable real-time data collection and transmission, allowing
microgrids to efficiently manage distributed energy resources, balance supply and demand, and
enhance sustainability. However, as these networks expand in functionality and connectivity,
they become increasingly vulnerable to cyber threats that can disrupt operations, manipulate
critical data, and compromise the reliability of energy distribution. Cyber-attacks such as
grayhole, blackhole, and flooding attacks pose significant risks by targeting network
communication, injecting malicious packets, or overwhelming system resources. If left
undetected, these threats can lead to substantial financial losses, operational downtime, and
even large-scale power outages.
                                                                                                   4
                                                               ACE ENGINEERING COLLEGE
      To address these security challenges, this study introduces a robust machine learning-based
   cyber-attack detection model specifically designed for WSNs in microgrids. By leveraging a
   diverse set of machine learning algorithms, including Convolutional Neural Networks (CNN),
   Passive Aggressive Classifiers, Random Forest Classifiers, and XGBoost Classifiers, the model
   is capable of accurately distinguishing between normal network behavior and potential cyber
   intrusions. The integration of these advanced classification techniques enhances the model's
   ability to detect anomalies in network traffic, identify attack signatures, and mitigate threats
   before they cause severe damage. Unlike traditional security measures, which often rely on
   predefined rule sets and static detection mechanisms, the proposed model employs a dynamic
   and adaptive approach, continuously learning from new attack patterns and improving detection
   accuracy over time.
      The implementation of this model involves the utilization of a comprehensive dataset from
   Kaggle, which encompasses a diverse range of network traffic patterns, attack scenarios, and
   normal operational states. By training the model on this dataset, it achieves high precision and
   recall in detecting different types of cyber-attacks, ensuring minimal false positives and false
   negatives. Moreover, the model’s real-time monitoring capabilities allow for proactive threat
   identification, reducing response time and enabling microgrids to swiftly implement
   countermeasures. The fusion of multiple machine learning techniques provides a well-rounded
   defense mechanism, combining the interpretability of decision trees, the adaptability of online
   learning algorithms, and the feature extraction capabilities of deep learning models.
      Beyond its technical efficacy, the adoption of machine learning-driven cyber security
   solutions in microgrids has profound implications for the future of energy management. Secure
   and resilient microgrids play a crucial role in promoting renewable energy integration, reducing
   carbon footprints, and ensuring energy independence. With the increasing deployment of smart
   grids and decentralized power systems, safeguarding WSNs against cyber threats becomes not
   only a technical necessity but also a strategic imperative. By implementing intelligent attack
   detection mechanisms, energy providers can enhance grid security, prevent service disruptions,
   and maintain the trust of consumers and stakeholders.Here are some key aspects of the future
   scope:
1. Adaptive Threat Intelligence: The integration of artificial intelligence and machine learning
   enables WSN-based microgrid security systems to continuously evolve by learning from
   emerging cyber threats. Future implementations can incorporate self-learning AI models that
   dynamically adapt to new attack patterns, ensuring long-term security and resilience.
                                                                                                      5
                                                                  ACE ENGINEERING COLLEGE
2. Real-Time Anomaly Detection: Advanced cybersecurity models can be integrated with real-
   time monitoring systems, enabling faster threat identification and immediate response. By
   deploying edge computing solutions, security mechanisms can process network data at the edge,
   minimizing latency and enhancing detection efficiency.
4. Integration with IoT and Smart Infrastructure: As smart cities and industrial automation
   continue to expand, the need for secure energy management solutions grows. The proposed
   machine learning-based security model can be adapted for broader IoT applications, enhancing
   the overall cybersecurity of interconnected infrastructures.
                                                                                                      6
                                                               ACE ENGINEERING COLLEGE
                                       CHAPTER 2
                             LITERATURE SURVEY
A literature survey for "A Machine Learning Based Cyber Attack Detection Model For Wireless
Sensor Networks In Microgrids” involves exploring existing research, publications, and
advancements in the fields of cybersecurity, machine learning, wireless sensor networks
(WSNs), and microgrid security. The following summarizes key findings from relevant research
papers and publications:
[1] Kwon, Cheolhyeon, Weiyi Liu, and Inseok Hwang. (IEEE, 2013)
Security   analysis   for   cyber-physical   systems    against   stealthy   deception   attacks.
This study investigates security vulnerabilities in the state estimation problem within networked
control systems (NCS). The research highlights that communication channels between sensors
and remote estimators in NCS are highly susceptible to malicious adversaries, making them
prime targets for stealthy deception attacks. The findings emphasize the need for robust security
mechanisms to detect and mitigate these threats effectively.
[2] Pajic, Miroslav, James Weimer, Nicola Bezzo, Oleg Sokolsky, George J. Pappas, and
Insup Lee. (IEEE, 2017)
Design and implementation of attack-resilient cyber-physical systems: With a focus on attack-
resilient state estimators.This paper discusses the rising security threats in control systems
and provides an in-depth analysis of attack-resilient cyber-physical systems (CPS). It
references real-world cyberattacks, such as the Maroochy Water breach, illustrating the
consequences of compromised security in critical infrastructure. The authors propose attack-
resilient state estimators to safeguard control systems against malicious disruptions.
                                                                                                    7
                                                                   ACE ENGINEERING COLLEGE
[4] Resilient control of networked control systems with stochastic denial-of-service (DoS)
attacks.
This paper addresses the challenge of securing networked control systems (NCS) against denial-
of-service (DoS) attacks. It models packet dropouts as a Markov process, allowing the system to
predict and adapt to attack patterns. The study presents a game-theoretic approach, balancing
attack strategies and defense mechanisms to enhance system resilience and maintain operational
stability.
                                                                                                       8
                                                            ACE ENGINEERING COLLEGE
Using algorithms like SVM (Support Vector Machine) and k-NN (k-Nearest Neighbors), the
study proposes a hybrid detection model capable of identifying and classifying a variety of
cyber-attacks, including DoS and grayhole attacks. The model significantly enhances the
security of microgrids and improves the resilience of energy systems in these areas.
                                                                                                 9
                                                              ACE ENGINEERING COLLEGE
                                            CHAPTER 3
                 SOFTWARE REQUIREMENT ANALYSIS
The critical problem addressed in this study revolves around the vulnerability of wireless sensor
networks (WSNs) within microgrids to various sophisticated cyber-attacks, such as grayhole,
blackhole, and flooding attacks. These attacks can severely disrupt the operation of microgrids,
leading to significant operational and financial losses. Traditional security mechanisms often
fall short in effectively detecting and mitigating such attacks due to their complexity and the
dynamic nature of cyber threats. Therefore, there is a pressing need for an advanced, efficient,
and accurate cyber attack detection model specifically designed for WSNs in microgrids,
leveraging the capabilities of machine learning algorithms to enhance the resilience and security
of these critical infrastructure systems.
                                                                                              10
                                                          ACE ENGINEERING COLLEGE
•   Results-Display
    The view results module enables users to view the classification results generated by
    the model. It provides insights into the predicted attack types, such as grayhole,
    blackhole, or flooding attacks, offering clear information on the detected threats.
•   Accuracy-Score
    The view score feature displays the accuracy percentage of the model’s prediction. This
    allows users to evaluate how well the model is performing in terms of detecting cyber
    attacks, providing valuable feedback on its effectiveness.
Each module is designed to work seamlessly together, providing an efficient and user-
friendly experience for identifying cyber threats in wireless sensor networks within
microgrids.
                                                                                          11
                                                                 ACE ENGINEERING COLLEGE
                                           CHAPTER 4
                                    SOFTWARE DESIGN
       4. 1 Architecture Diagram
The above figure describes the architecture design of the system as follows:
Input: Network traffic data from wireless sensor networks in microgrids is collected for analysis.
User Interaction: The user initiates the model-building process by providing relevant data.
Dataset: The system accesses a dataset containing normal and attack-related network traffic data.
Training: The system is trained using machine learning techniques to detect cyber attacks in
microgrids.
Data Splitting: Divides data into training and testing sets for model development.
Training (CNN & MobileNet): Uses CNN and MobileNet models to learn patterns in medical
images.
Model Building: The trained system builds a model to classify network traffic as normal or
malicious.
Testing: The built model is tested using unseen network data to evaluate its accuracy and reliability.
Evaluation: The model's performance is measured using accuracy, precision, recall, and F1-score.
                                                                                                     12
                                                                 ACE ENGINEERING COLLEGE
Output: The system provides a classification result indicating whether the network traffic is normal
or under attack, helping in proactive security measures.
• Data Flows: Movement of data between processes, external entities, and data stores.
            •   Understanding How a System Works: By following the data flow, you can see how
                data is processed and transformed.
            •   Communicating System Requirements: DFDs are a clear and concise way to show
                what data is needed and how it will be used.
            •   Designing New Systems: DFDs can be used to plan out the data flow of a new system
                before it is built.
4. 2. 1. DFD LEVEL – 0
    Level 0 (Context Diagram): A high-level overview of the entire system, showing its main
    processes and external entities. The below Fig No. 4.2.1 shows a high-level overview of the
    System. The system consists of four main components:
                                                                                                   13
                                                             ACE ENGINEERING COLLEGE
•   Process: The core system component that data and create models.
•   Data Store: A storage unit where processed data, trained models, and medical records are kept
    for future reference.
4. 2. 2. DFD LEVEL – 1
The below Fig No. 4.2.2 shows a high-level overview of the Cardiac Disease Prediction Using
Image Classification system.
•   System: The main processing unit responsible for handling data, processing, and generating
    predictions.
•   User: The entity that interacts with the system by providing data and viewing results.
•   Register: Users register for an account to access the system.
                                                                                                 14
                                                                 ACE ENGINEERING COLLEGE
Data Flows:
•   User to System: Users provide medical images and other relevant data as input.
•   System to Pre-processing: The system processes the raw data to improve model accuracy.
•   Pre-processed Data to Model Building: The processed data is used to train and optimize the
    classification model.
•   User to Model Selection: Users select a trained model for classification.
•   Model to Prediction Module: The selected model classifies the uploaded medical images.
•   Prediction Results to System: The system processes the classification results for reporting.
•   Results to Data Store: The final results are stored in the database for future access.
•   Data Store to View Results: Users retrieve and review prediction results from storage.
                                                                                                   15
                                                              ACE ENGINEERING COLLEGE
          •   Model Selection & Training: The system enables users to select a model and train it
              using data.
          •   Prediction & Classification: Trained models classify data inputs and generate
              predictions.
          •   Result Generation & Viewing: Users can generate, store, and view results from
              predictions..
                                                                                                16
                                                             ACE ENGINEERING COLLEGE
Key Components:
•   User: The end-user who interacts with the system for data upload, processing, and result
    viewing.
•   System: The core processing unit responsible for data handling, model training, and
    prediction.
•   Data Store: A centralized database that stores user data, trained models, and classification
    results.
COMPONENTS:
5. Model Building: The deep learning model is trained using the uploaded data.
8. Prediction: The selected model processes input data and makes predictions.
10. View Data & Results: Users can view stored data and prediction outcomes.
Data Flows:
                                                                                                   17
                                                              ACE ENGINEERING COLLEGE
                                     4. 3. UML DIAGRAMS
  4. 3. 1. USE CASE DIAGRAM
  A use case diagram at its simplest is a representation of a user's interaction with the system,
  depicting the specifications of a use case. The below Fig No. 4.3.1 portrays the different types of
  users of the Cardiac Disease Prediction System and the various ways they interact with the system.
    1. User: The primary actor interacts with the system by uploading network traffic data for
        cyber attack detection.
    2. System: Represents the Cyber Attack Detection System, responsible for data processing,
        attack detection, and result generation.
USE CASES:
    1. Register: The user creates an account to access the system.
3. Upload Data: The user uploads network traffic data for analysis.
                                                                                                  18
                                                                  ACE ENGINEERING COLLEGE
4. Take Data: The system retrieves the uploaded data for processing.
5. View Data: The user can view and analyze the uploaded network data.
         6. Pre-processing: The system processes the raw data by cleaning, normalizing, and preparing
             it for model training.
         7. Model Building: The system trains a machine learning model to detect cyber attacks in the
             network traffic.
         8. Select Model: The user selects a preferred model for attack detection.
9. Prediction: The system predicts whether the network traffic is normal or under cyber attack.
 4. 3. 2. CLASS DIAGRAM
    The class diagram is the main building block of object-oriented modeling. It is used both for
    general conceptual modeling of the systematics of the application and for detailed modeling,
    translating the models into programming code. In the diagram, classes are represented with boxes
    that contain three parts:
   •     The upper part holds the name of the class.
   •     The middle part contains the attributes of the class.
   •     The bottom part gives the methods or operations the class can take or undertake.
The above Fig No. 4.3.2 shows the main components of the system and how they interact with each
other.
                                                                                                     19
                                                                ACE ENGINEERING COLLEGE
                                                                                                    20
                                                                   ACE ENGINEERING COLLEGE
4. 3. 3. SEQUENCE DIAGRAM
    A sequence diagram is a kind of interaction diagram that shows how processes operate with one
    another and in what order. It is a construct of a Message Sequence Chart. A sequence diagram
    shows object interactions arranged in a time sequence. Sequence diagrams are sometimes called
    event diagrams, event scenarios, and timing diagrams.
The above Fig No. 4.3.3 shows the interaction between the user and the System
1. User:
• After successful registration, the user logs in to access the system functionalities.
• The user can view existing data related to cyber attack detection..
                                                                                               21
                                                                    ACE ENGINEERING COLLEGE
   •   Pre-processing steps are applied to clean and structure the data for training and
       prediction.
• The system builds a machine learning model using the pre-processed data.
• The user selects the appropriate model for cyber attack detection.
    4. Finally, the user can view the detection results, gaining insights into the security status of
       the wireless sensor network in the microgrid.
5. 3. 4. COMPONENT DIAGRAM
    The below Fig No. 4.3.4 depicts how components are wired together to form larger components
    and/or software systems for our project. This diagram illustrates the structure of arbitrarily
    complex systems, showing the interaction between the Trainer/System and the User.
User: This component represents the person who is using the system.
System: Comprises the following sub-components:
   •   Data Processing: Takes user-provided network data, cleans, and prepares it for analysis.
   •   Feature Extraction: Identifies critical patterns and anomalies indicative of potential cyber
       attacks.
                                                                                                        22
                                                                  ACE ENGINEERING COLLEGE
•        Provides a detailed analysis of detected anomalies in the wireless sensor network of the
microgrid.
    The activity diagram is another important diagram in UML to describe the dynamic aspects of the
    system. It is a flowchart that represents the flow from one activity to another.An activity can be
    described as an operation of the system, as shown in Fig No. 4.3.5.
                                                                                                   23
                                                                     ACE ENGINEERING COLLEGE
   •   View Results: Once processing is complete, the user views the results generated by the
       system.
System :
   •   Working on Data: The system begins processing the received data.
   •   Preprocessing: The system cleans, normalizes, and prepares the data for analysis.
   •   Training the Data: The system trains the selected machine learning model using relevant
       datasets.
   •   Model Building: The system builds and fine-tunes the model for accurate predictions.
   •    Generate Results: The system processes the final output and generates results based on the
       trained model.
4.3. 6. DEPLOYMENT DIAGRAM
       A deployment diagram in the Unified Modeling Language models the physical deployment of
       artifacts on nodes, which is shown in Fig No. 4.3.6 for our project.
User: This represents the person or entity interacting with the Machine Learning-Based Cyber Attack
Detection Model for Wireless Sensor Networks in Microgrids. The user provides input data related to
network traffic, sensor behavior, or other security-related parameters to detect cyber threats.
System: This is the core component responsible for analyzing sensor data and predicting cyber attacks
based on the user’s input. It consists of multiple sub-components:
   •   Data Preprocessing: Cleans and organizes the input data, ensuring it is ready for analysis.
   •   Feature Extraction: Identifies crucial features related to cyber attack patterns within sensor
       networks.
   •   Model Classification: Uses machine learning algorithms (e.g., CNN, Passive Aggressive
       Classifier) to detect anomalies or potential cyber threats.
   •   Result Generation: Provides the final classification output, highlighting whether a cyber attack
       has been detected and offering insights for further security measures.
                                                                                                     24
                                                                 ACE ENGINEERING COLLEGE
                                     4.4 METHODOLOGY
 4.4.1 CONVOLUTIONAL NEURAL NETWORKS
  Convolutional Neural Network (CNN) Convolutional Neural Networks (CNNs) are a fundamental
deep learning architecture specifically designed for processing structured grid data, such as images.
They excel in tasks like image classification, object detection, and feature extraction by leveraging
hierarchical feature learning.
A key strength of CNNs is their ability to automatically extract relevant features from raw data through
convolutional and pooling operations. These layers enable the model to detect local features and spatial
relationships, making CNNs highly effective in recognizing intricate patterns within images. Unlike
traditional machine learning approaches that require manual feature engineering, CNNs learn and
refine features directly from data, improving performance and reducing human intervention.
The adaptability of CNNs to varying input sizes further enhances their utility, allowing them to process
images with different resolutions while maintaining performance. This feature is particularly valuable
in fields such as medical imaging and cybersecurity, where datasets may contain diverse image sizes
and formats. By capturing spatial hierarchies and dependencies, CNNs have become a pivotal tool in
computer vision applications, enabling state-of-the-art performance in tasks requiring deep feature
understanding.
Passive Aggressive classifiers are a type of online learning algorithm specifically designed for binary
classification tasks. Unlike traditional batch learning methods that require the entire dataset to be
available before training, Passive Aggressive classifiers update their model parameters sequentially
with each new instance of data.
                                                                                                     25
                                                                       ACE ENGINEERING COLLEGE
This makes them particularly effective in scenarios involving streaming data, where information
arrives continuously, and quick adaptation is crucial. These classifiers strike a balance between
maintaining previously learned patterns and incorporating new insights, ensuring their decision
boundaries remain relevant as data evolves.
The working principle of Passive Aggressive classifiers is based on adjusting their decision boundary
only when a misclassification occurs. However, when an incorrect classification is made, the model
aggressively updates its parameters to correct the mistake while ensuring minimal changes to prevent
overfitting. The degree of aggressiveness in updates is controlled by a hyperparameter, which regulates
how much the model should adjust in response to misclassifications. This adaptability makes Passive
Aggressive classifiers highly effective in dynamic environments where data patterns shift frequently.
In summary, Unlike traditional batch learning models, they update their parameters incrementally, adapting
quickly to new data while requiring minimal memory. These classifiers remain passive when predictions are
correct but aggressively adjust their decision boundaries upon misclassification, with the degree of adjustment
controlled by a hyperparameter. This balance between adaptability and stability makes them suitable for dynamic
datasets where patterns continuously evolve. Due to their efficiency and real-time learning capabilities, Passive
Aggressive classifiers are widely used in applications such as text classification, spam detection, sentiment
analysis, and cybersecurity tasks like anomaly detection in network traffic. Their ability to handle continuous
data streams effectively makes them an essential tool for real-time decision-making.
They operate by constructing a multitude of decision trees during training and outputting the mode of
the classes (classification) or mean prediction (regression) of individual trees.
                                                                                                              26
                                                                 ACE ENGINEERING COLLEGE
Each tree is trained on a random subset of the training data and features, promoting diversity among
the trees and reducing overfitting.
Random Forests are known for their robustness, scalability, and ability to handle high-dimensional data
with complex interactions. They are widely used for tasks like classification, regression, feature
importance ranking, and anomaly detection in various domains.
XGBoost employs a regularization term in the objective function to control model complexity and
prevent overfitting. It utilizes a distributed and parallel computing framework, making it suitable for
large-scale datasets and computationally intensive tasks. XGBoost has gained popularity due to its
exceptional performance in various machine learning competitions and real-world applications,
including classification, regression, ranking, and anomaly detection.
                                                                                                    27
                                                      ACE ENGINEERING COLLEGE
                              CHAPTER 5
              SOFTWARE AND HARDWARE REQUIREMENTS
5.1. SOFTWARE REQUIREMENTS
  •   Operating System             : Windows 7/8/10
  •   Server side Script           : HTML, CSS, Bootstrap & JS
  •   IDE/Workbench                : PyCharm/VSCode
  •   Framework                    : Flask, pandas, numpy and Scikit-Learn
                                                                                   28
                                                             ACE ENGINEERING COLLEGE
                                       CHAPTER 6
                                     CONCLUSION
In conclusion, the development of a machine learning-based cyber attack detection model for
wireless sensor networks in microgrids represents a significant step forward in securing critical
infrastructure. By leveraging advanced machine learning techniques, this system effectively
identifies and mitigates cyber threats, ensuring the stability and security of microgrid
operations.
However, while AI-based detection models offer substantial benefits, human intervention
remains necessary for continuous monitoring, model refinement, and addressing evolving cyber
threats. The effectiveness of this approach depends on the quality and diversity of training
datasets, as well as the system’s adaptability to emerging attack patterns.
                                                                                                    29
                                                            ACE ENGINEERING COLLEGE
                                       CHAPTER 7
                                       REFERENCES
1. A. Kavousi-Fard, W. Su, and T. Jin (2020): A Machine-Learning-Based Cyber Attack
   Detection Model for Wireless Sensor Networks in Microgrids, IEEE Transactions on
   Industrial   Informatics,    vol.      17,   no.   1,   pp.   650–658.      Available   at:
   https://ieeexplore.ieee.org/document/8951100
2. C. Zhang, L. Wu, Y. Wang, and X. Li (2023): Machine Learning-Based Cyber Attack
   Detection in Wireless Sensor Networks for Microgrids, IEEE Transactions on Smart Grid.
3. A. Sharma, B. Patel, and D. Kim (2022): AI-Driven Intrusion Detection for Microgrid
   Security: A Deep Learning Approach, International Journal of Smart Energy Systems.
4. J. Smith and R. Kumar (2021): Cybersecurity in Microgrids: Machine Learning for Anomaly
   Detection in Wireless Sensor Networks, Proceedings of the International Conference on
   Cybersecurity.
5. T. Brown, M. Lee, and H. Wilson (2023): Hybrid AI Approaches for Cyber Threat Detection
   in Microgrid Wireless Sensor Networks, Journal of Energy Informatics.
6. M. Mohammadi, A. Kavousi-Fard, M. Dabbaghjamanesh, M. Shaaban, H. H. Zeineldin, and
   E. F. El-Saadany (2023): A Cyber-Physical Architecture for Microgrids Based on Deep
   Learning and LORA Technology, arXiv preprint arXiv:2312.08818. Available at:
   https://arxiv.org/abs/2312.08818
7. H. Tabbaa, S. Ifzarne, and I. Hafidi (2022): An Online Ensemble Learning Model for
   Detecting Attacks in Wireless Sensor Networks, arXiv preprint arXiv:2204.13814. Available
   at: https://arxiv.org/abs/2204.13814
8. N. Souri and A. Mehrizi-Sani (2024): Hybrid Machine Learning Approach for Cyberattack
   Mitigation of Parallel Converters in a DC Microgrid, arXiv preprint arXiv:2406.07503.
   Available at: https://arxiv.org/abs/2406.07503
9. Y. A. Farrukh, I. Khan, Z. Ahmad, and R. M. Elavarasan (2021): A Sequential Supervised
   Machine Learning Approach for Cyber Attack Detection in a Smart Grid System, arXiv
   preprint arXiv:2108.00476. Available at: https://arxiv.org/abs/2108.00476
30