This project demonstrates the implementation of power system load flow analysis using Python for steady-state power system studies.
The repository includes:
- Y-Bus matrix construction
- Gauss-Seidel load flow analysis
- Newton-Raphson load flow analysis
- Power flow calculations
- Transmission loss estimation
- Automated testing with PyTest
- Engineering report generation
- Data visualization
- Jupyter Notebook analysis workflow
The project is designed as a practical electrical engineering portfolio showcasing numerical methods, power system modeling, and Python-based engineering computation.
Load flow analysis determines the operating condition of an electrical power system under steady-state conditions.
Key outputs:
- Bus Voltage Magnitudes
- Voltage Angles
- Active Power Flow
- Reactive Power Flow
- Transmission Losses
Reference bus with specified:
- Voltage Magnitude
- Voltage Angle
Specified:
- Active Power (P)
- Reactive Power (Q)
Calculated:
- Voltage Magnitude
- Voltage Angle
Specified:
- Active Power (P)
- Voltage Magnitude (V)
Calculated:
- Reactive Power (Q)
- Voltage Angle
The Bus Admittance Matrix (Y-Bus) represents the electrical network connectivity and admittance characteristics.
General form:
[Ybus][V] = [I]
The Y-Bus matrix serves as the foundation for load flow calculations.
Advantages:
- Simple implementation
- Low memory requirement
- Suitable for educational studies
Limitations:
- Slow convergence
- Sensitive to initial conditions
Advantages:
- Fast convergence
- High numerical accuracy
- Industry-standard solution technique
Limitations:
- More computational complexity
- Jacobian matrix construction required
power-system-load-flow-analysis/
├── data/
│ ├── sample_bus_data.csv
│ ├── sample_line_data.csv
│ └── ieee_5bus_system.csv
│
├── src/
│ ├── ybus_builder.py
│ ├── gauss_seidel.py
│ ├── newton_raphson.py
│ ├── power_flow.py
│ ├── transmission_losses.py
│ └── load_flow_solver.py
│
├── notebooks/
│ ├── 01_data_exploration.ipynb
│ ├── 02_ybus_construction.ipynb
│ ├── 03_gauss_seidel_analysis.ipynb
│ ├── 04_newton_raphson_analysis.ipynb
│ └── 05_result_comparison.ipynb
│
├── visualizations/
│ ├── voltage_profile.png
│ ├── transmission_losses.png
│ ├── convergence_curve.png
│ ├── bus_angle_profile.png
│ └── power_flow_results.png
│
├── reports/
│ ├── load_flow_report.pdf
│ └── generate_report.py
│
├── tests/
│ ├── test_ybus_builder.py
│ ├── test_gauss_seidel.py
│ ├── test_newton_raphson.py
│ ├── test_power_flow.py
│ └── test_transmission_losses.py
│
├── assets/
│ ├── project_workflow_and_system_methodology_diagrams.png
│
│
│
├── examples/
│ ├── run_gauss_seidel.py
│ └── run_newton_raphson.py
│
├── requirements.txt
├── .gitignore
├── LICENSE
└── README.md
Contains bus information:
- Bus Number
- Bus Type
- Voltage Magnitude
- Active Power
- Reactive Power
Contains transmission line parameters:
- From Bus
- To Bus
- Resistance (p.u.)
- Reactance (p.u.)
- Line Charging Susceptance (p.u.)
Sample IEEE-inspired 5-Bus system used for load flow studies.
Shows bus voltage magnitudes throughout the system.
Displays estimated transmission losses.
Illustrates convergence behavior of numerical methods.
Displays voltage angle distribution.
Summarizes calculated power flow values.
Bus 1 : 1.050 p.u.
Bus 2 : 1.020 p.u.
Bus 3 : 1.010 p.u.
Bus 4 : 0.990 p.u.
Bus 5 : 0.975 p.u.
2.13 MW
Converged in 4 iterations
Converged in 18 iterations
Clone repository:
git clone https://github.com/koswadi/power-system-load-flow-analysis.gitMove to project directory:
cd power-system-load-flow-analysisCreate virtual environment:
python -m venv venvActivate virtual environment:
venv\Scripts\activatesource venv/bin/activateInstall dependencies:
pip install -r requirements.txtpython examples/run_gauss_seidel.pypython examples/run_newton_raphson.pyRun all tests:
pytest tests/Expected output:
5 passed
Covered Components:
- Y-Bus Builder
- Gauss-Seidel Solver
- Newton-Raphson Solver
- Power Flow Calculation
- Transmission Loss Estimation
Generate report:
python reports/generate_report.pyOutput:
reports/load_flow_report.pdf
Report Contents:
- Load Flow Results
- Bus Voltages
- Power Flow Summary
- Transmission Losses
- Method Comparison
- Engineering Conclusions
This project demonstrates:
- Power System Analysis
- Numerical Methods
- Scientific Computing with Python
- Engineering Data Visualization
- Automated Testing
- Technical Report Generation
- Reproducible Engineering Workflows
Planned enhancements include:
- IEEE 14-Bus System
- IEEE 30-Bus System
- Fast Decoupled Load Flow
- Optimal Power Flow (OPF)
- Contingency Analysis
- Interactive Dashboard
- Power System State Estimation
- Renewable Energy Integration Studies
Agoes Koswadi
Electrical Engineering Portfolio Project
Focused on:
- Power Systems
- Electrical Engineering
- Python Programming
- Engineering Computation
- AI Evaluation and Data Annotation
This project is distributed under the MIT License.







