PyPSA / PyPSA

PyPSA: Python for Power System Analysis
https://pypsa.readthedocs.io
MIT License
1.21k stars 451 forks source link

Are transformer inputs supposed to be per unit values? #735

Open grgmiller opened 1 year ago

grgmiller commented 1 year ago

According to the documentation and https://github.com/PyPSA/PyPSA/blob/master/pypsa/component_attrs/transformers.csv, the input values of x, r, g, and b for transformers are supposed to entered as per unit values, even though these same parameters for lines are entered as nominal values.

What's more confusing, the transformer component also includes output values of x_pu, r_pu, g_pu, and b_pu, which are calculated from the input values of x, r, g, and b, which are already supposedly supposed to be pu values.

Maybe I am misunderstanding something here, but this seems to suggest that: 1) the documentation includes the incorrect expected units for the input values, and/or 2) The input values are misnamed (should include the _pu suffix), and/or 3) The output _pu values are being incorrectly calculated.

grgmiller commented 12 months ago

After looking into the math a bit more, it looks like perhaps the input value of x is in per unit on system base quantities, and the calculated output of x_pu is in per unit on 1 MVA base (per the calculations happening here: https://github.com/PyPSA/PyPSA/blob/b066cb5d7af7b30861a2b76e486ec3910778e9c9/pypsa/pf.py#L1023).

However, this calculation is dividing x by s_nom, which in the documentation is defined as the transformer rating, not the system base MVA.