This repository contains the code, data, and results for the project on state classification of the IEEE 39-bus system using a Kernel Affine Hull Machine (KAHM) with differential privacy, federated learning, and false data injection attack (FDIA) detection.
The code is a single-file PowerFactory script
(Code/KAHM_Based_Power_System_State_Classification_.py) designed to run
inside DIgSILENT PowerFactory (with Python API) on a university
virtual machine. It imports the powerfactory module at the top of the
file.
Absolute file paths (e.g., R:\Computational_Intelligence\...) refer to
that environment.
Because PowerFactory is a licensed software, and because powerfactory
is imported at module level, the file cannot be imported or executed
at all on a standard personal computer without a PowerFactory
installation present — even though most of the analytical code (the
KAHM classifier, differential privacy mechanism, federated aggregation,
and FDIA attack/detection modules) is pure Python and does not itself
call the PowerFactory API.
All outputs and logs from a successful run are provided in the
Results/ and Simulation_log/ folders, enabling full inspection of
the methodology and results without needing a PowerFactory license.
If you have access to a PowerFactory installation, you can adapt the
paths in Code/KAHM_Based_Power_System_State_Classification_.py (see
the __main__ block at the bottom of the file) and run the pipeline
via PowerFactory's embedded Python environment.
Code/— Single-file PowerFactory pipeline implementation (KAHM_Based_Power_System_State_Classification_.py)Power_Network_Data/— IEEE 39-bus network input data (buses, lines, generators, loads, transformers, shunts, SVC, system-level CSVs)Report/— Written report and code-explanation PDFResults/— Generated outputs:Classification_Outputs/— KAHM/DP accuracy, confusion matrices, distances, gamma CV results (CSV)Network_Outputs/— Per-scenario/per-contingency bus, line, generator, and transformer results (CSV)HTML_REPORT.html— Dashboard summaryconvert_all.py— Output conversion script
Simulation_log/— Full run log (psa_kahm_20260705_194236.log) corresponding to the results reported in the paper
A complete description of the methodological approach, parameter choices, and experimental design can be found in the accompanying written report.
Chirag Narula Msc Student @ Uni Rostock chiragnarula1525@gmail.com /chirag.narula@uni-rostock.de Matriculation Number: 226100055