When I started learning power flow analysis in my undergrad, I stumbled upon the limitation of my potato brain to understand the basics of the power flow.
Back then, there were no references to the optimization program of the economic dispatch or OPF specifically.
So, to help you guys who want to learn the basics of optimization, I present you my not-finest creation that I made in my spare time, sometimes when I am asleep too.
This program uses Python 3.8 with the modules as follows:
pandas, matplotlib, math, networkx, pypower, gurobipy
The network parameters are obtained from the pypower datasets, which are adjusted based on their format. For now, some cases throw an error (e.g., case24_rts, case57, case118, case300) due to double transmission lines between two buses that mess up the naming of the variable indices.
To use gurobipy, Gurobi should be installed in the machine with a valid license (hey, a student's license is very cool!). Please read its documentation to understand how the code works fully.
This program is made to be as simple as possible.
Open the script DCOPF.ipynb. Enjoy!
Similar to the economic dispatch problem, DC OPF aims to minimize the total generation cost according to the polynomial characteristics of each generator:
where
For further explanation, please refer to the Documentation here
I tested on case9 and case39 and verified that the results were identical to the power flow modules like pandapower and pypower.
Maybe, just maybe, the other cases work too. Or not.
"When will you publish an AC OPF optimization including renewables, energy storages, electric vehicle charging stations, and a flame dragon?"
-"Bit too much, isn't it?."
My brain was initially a potato. By learning more about things related to my research, it is now upgraded into a baked potato.