Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Handling of X and R Values for Transformers During LOPF #743

Open
khelfen opened this issue May 21, 2024 · 4 comments
Open

Incorrect Handling of X and R Values for Transformers During LOPF #743

khelfen opened this issue May 21, 2024 · 4 comments
Assignees
Labels

Comments

@khelfen
Copy link

khelfen commented May 21, 2024

Issue Description:
Currently, the handling of X and R values in the network during lopf is incorrect. The values are given in per unit (p.u.) with reference to s_nom for transformers while for lines it's in Ohm. Therefore for transformers it should remain constant even when network expansion and s_nom increases occur. However, these values are currently being adjusted, leading to significantly incorrect values.

See:

def update_electrical_parameters(network, l_snom_pre, t_snom_pre):
"""
Update electrical parameters of active branch components
considering s_nom of previous iteration.
Parameters
----------
network : pypsa.Network object
Container for all network components.
l_snom_pre: pandas.Series
s_nom of ac-lines in previous iteration.
t_snom_pre: pandas.Series
s_nom of transformers in previous iteration.
Returns
-------
None.
"""
network.lines.x[network.lines.s_nom_extendable] = (
network.lines.x * l_snom_pre / network.lines.s_nom_opt
)
network.transformers.x[network.transformers.s_nom_extendable] = (
network.transformers.x * t_snom_pre / network.transformers.s_nom_opt
)
network.lines.r[network.lines.s_nom_extendable] = (
network.lines.r * l_snom_pre / network.lines.s_nom_opt
)
network.transformers.r[network.transformers.s_nom_extendable] = (
network.transformers.r * t_snom_pre / network.transformers.s_nom_opt
)
network.lines.g[network.lines.s_nom_extendable] = (
network.lines.g * network.lines.s_nom_opt / l_snom_pre
)
network.transformers.g[network.transformers.s_nom_extendable] = (
network.transformers.g * network.transformers.s_nom_opt / t_snom_pre
)
network.lines.b[network.lines.s_nom_extendable] = (
network.lines.b * network.lines.s_nom_opt / l_snom_pre
)
network.transformers.b[network.transformers.s_nom_extendable] = (
network.transformers.b * network.transformers.s_nom_opt / t_snom_pre
)
# Set snom_pre to s_nom_opt for next iteration
l_snom_pre = network.lines.s_nom_opt.copy()
t_snom_pre = network.transformers.s_nom_opt.copy()
return l_snom_pre, t_snom_pre

Expected Behavior:
X and R values should remain constant in per unit (p.u.) with reference to s_nom for transformers, regardless of network expansion and s_nom increases.

@khelfen khelfen added the bug label May 21, 2024
@ulfmueller
Copy link
Member

I think you are right - we will change that accordingly. It also brings up another potential error concerning the x and r values - as pypsa uses a transformer specific s_nom per unit calculation and we used originally a global base s_nom. Thanks for bringing that up - we will follow up on it.

Just as an additional information: We really never stumbled into these problems since we have never done any important and bigger calculation on the original topology (due to computational burden). The transformers and their behavior is completely neglected then once using the spatial clustering approaches.

@ulfmueller ulfmueller self-assigned this Jun 6, 2024
@ClaraBuettner
Copy link
Contributor

I had a look at the pypsa-scripts that set the constraints in the end (pf.py, function calculate_dependent_values).
The used "x_pu" values for transformers are normalized using the (static) s_nom, which is not changed when the transformer is expanded.
But the electrical parameters do change when the capacity is increased. This is done by the function "update_electrical_paramters" within etrago. Thus, I think that we do not need to change anything.

@ulfmueller
Copy link
Member

I agree. So if you agree with us @khelfen as well, I would delete #745 and leave it as it was.

@khelfen
Copy link
Author

khelfen commented Jun 17, 2024

I agree. So if you agree with us @khelfen as well, I would delete #745 and leave it as it was.

Hey :) thank you for the follow up! I'm not sure if I completely understand it.

I'll make an example to better do so and let's take this standard transformer from osmTGmod with s_nom = 630 MVA, u = 380/220 kV and u_kr = 13.5%. u_kr is the relative short-circuit voltage which corresponds to the reactance in p.u. So in this example the transformer would have a reactance value x within our model of 0.135. The calculated x_pu within calculate_dependent_values would be 0.135 / 630 MVA = 0.000214 1/MVA.

I don't see why x should be changed as it is in p.u. and when s_nom changes due to grid reinforcement x_pu will change accordingly without changing x. Like I said I'm not totally sure I do understand it but I don't think x, r, b and g of transformators should be changed by update_electrical_parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants