Repository navigation
Notes on PowerFlowData constructors
#223
luke-kiernan
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
We have large chunks of code copy-pasted between the different constructors of
PowerFlowData, which makes keeping track of what's what tricky. What follows are notes on the differences and similarities between the constructors for the different types of power flows: written with an eye towards refactoring things, but also generally useful for high level understanding.Things in common across the 4 constructors (copy-pasted 4x):
timestep_namesconvergedThings in common between
make_dc_powerflowdataand the AC power flow constructor (copy-pasted 2x):timestep_mapthis is removed in PR #225, temporarily. The field only exists for PF-PSI compatibility reasons; for now, I'm focusing on PNM-PF compatibility, for which that field is problematic.branch_types(named asbranch_type)Things different across the 4 power flows, but in a regular fashion:
ACPowerFlowDataABAPowerFlowData[v]PTDFPowerFlowDatapower_network_matrix(pnm)aux_network_matrix(anm)nothingbus_lookuppnm.lookup[2]anm.lookup[1]pnm.lookup[2]arc_lookuppnm.branch_admittance_from_to.lookup[1]anm.lookup[2]pnm.lookup[1]pnmanmpnmpnm.branch_admittance_{from/to}_{to/from}anm.data, transposedpnm.data, transposedUpdated for PR #225
The swap on lookups for PTDF is due to the fact that we're storing the transpose, yet the axes and lookups are in the order of the non-transposed matrix. [A slicker approach would be to make it a subtype of an
Adjointtype.] One pattern that emerges: for DC power flows, we use the non-ABA matrix for things.The ref bus positions, in 3 cases, are retrieved via
get_ref_bus_position: looking in PNM, the function call turns into[get_bus_lookup(M)[x] for x in keys(M.subnetwork_axes)]Then, we have several things that only make sense for AC power flows:
[calculate_]loss_factors,generator_slack_participation_factors, and[calculate_]voltage_stability_factorsneighbors(empty for DC)All reactions