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

add some safegueards for numerical issues in TDPF #2195

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Change Log
- [CHANGED] cim2pp: extracted getting default classes, added generic setting datatypes from CGMES XMI schema
- [ADDED] function :code:`getOTDF` to obtain Outage Transfer Distribution Factors, that can be used to analyse outages using the DC approximation of the power system
- [ADDED] function :code:`outage_results_OTDF` to obtain the matrix of results for all outage scenarios, with rows as outage scenarios and columns as branch power flows in that scenario
- [FIXED] add some safeguards for TDPF to avoid numerical issues in some cases


[2.13.1] - 2023-05-12
Expand Down
2 changes: 1 addition & 1 deletion pandapower/pf/create_jacobian_tdpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
2019, pp. 1-6, doi: 10.1109/EEEIC.2019.8783234.
"""
t_rise_pu = a0 + a1 * i_square_pu + a2 * np.square(i_square_pu) - t_air_pu
r_theta_pu = t_rise_pu / p_loss_pu
r_theta_pu = t_rise_pu / np.where(p_loss_pu == 0, 1e-6, p_loss_pu)

Check warning on line 118 in pandapower/pf/create_jacobian_tdpf.py

View check run for this annotation

Codecov / codecov/patch

pandapower/pf/create_jacobian_tdpf.py#L118

Added line #L118 was not covered by tests
return r_theta_pu


Expand Down
3 changes: 2 additions & 1 deletion pandapower/pypower/newtonpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@

if tdpf:
# update the R, g, b for the tdpf_lines, and the Y-matrices
branch[tdpf_lines, BR_R] = r = r_ref_pu * (1 + alpha_pu * (T - t_ref_pu))
# here: limit the change of the R to reflect a realistic range of values for T to avoid numerical issues
branch[tdpf_lines, BR_R] = r = r_ref_pu * (1 + alpha_pu * np.clip(np.nan_to_num(T - t_ref_pu), -50, 250 / T_base))

Check warning on line 302 in pandapower/pypower/newtonpf.py

View check run for this annotation

Codecov / codecov/patch

pandapower/pypower/newtonpf.py#L302

Added line #L302 was not covered by tests
# todo expansion with SSC and VSC (that are not controllable)
Ybus, Yf, Yt = makeYbus(baseMVA, bus, branch)
g, b = calc_g_b(r, x)
Expand Down
Loading