e2nIEE / pandapower

Convenient Power System Modelling and Analysis based on PYPOWER and pandas
https://www.pandapower.org
Other
870 stars 481 forks source link

Base impedance/admittance of per unit system of admittance matrix #2446

Open Sciemon opened 3 days ago

Sciemon commented 3 days ago

Feature Checklist

Issue

I am trying to understand the entries of the admittance matrix (net._ppc["internal"]["Ybus"]) as illustrated for example in the internal data structure tutorial, but I cannot figure out the correct base impedance/admittance for the per unit conversion.

I would assume that an entry in the matrix that represents a line between two buses could be calculated as follows:

Z_base = vn_kv**2 / net._ppc["baseMVA"]
Z = (r_ohm_per_km + x_ohm_per_km*j)*length_km 
z = Z/Z_base
y = 1/z

where vn_kv is the nominal voltage of the from bus and r_ohm_per_km and x_ohm_per_km are parameters of the line.

But the results don't match the non diagonal entries of line branches in Ybus (other branch elements I have not checked). Could you point me to what I am missing? What would be the correct Z_base?

Thanks!

Label

pawellytaev commented 22 hours ago

Hi @Sciemon, in general I agree, the entry on the non-diagonal entries on the Ybus matrix should be the negative line admittance connecting the two buses. Do you have a minimal example where we can see the inconsitency? Do the lines in your model have parallel>1?

FYI, here is where we calculate the base impedance and branch impedance in p.u.: https://github.com/e2nIEE/pandapower/blob/d9ada108b1ac144f58ce7a8b7d8c093c9a9d0ec7/pandapower/build_branch.py#L203

pawellytaev commented 22 hours ago

... and here's where we calculate the Ybus matrix entries: https://github.com/e2nIEE/pandapower/blob/d9ada108b1ac144f58ce7a8b7d8c093c9a9d0ec7/pandapower/pypower/makeYbus.py#L46

https://github.com/e2nIEE/pandapower/blob/d9ada108b1ac144f58ce7a8b7d8c093c9a9d0ec7/pandapower/pypower/makeYbus.py#L87