Skip to content

pp.create.create_transformers value initialization not working#2894

Open
belobradi wants to merge 6 commits intoe2nIEE:developfrom
belobradi:transformer-nan-values
Open

pp.create.create_transformers value initialization not working#2894
belobradi wants to merge 6 commits intoe2nIEE:developfrom
belobradi:transformer-nan-values

Conversation

@belobradi
Copy link
Copy Markdown

  • create_transformers now forwards tap and optional std-type params.
  • updated tests verifying these fields.

…E#2886)

* create_transformers now forwards tap and optional std-type params.
* updated tests verifying these fields.
@belobradi belobradi changed the title pp.create.create_transformers value initialization not working (#2886) pp.create.create_transformers value initialization not working Feb 28, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 28, 2026

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.26%. Comparing base (1784739) to head (8a0669a).

Files with missing lines Patch % Lines
pandapower/create/trafo_create.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2894   +/-   ##
========================================
  Coverage    72.26%   72.26%           
========================================
  Files          351      351           
  Lines        37967    37968    +1     
========================================
+ Hits         27438    27439    +1     
  Misses       10529    10529           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

belobradi and others added 3 commits March 1, 2026 14:27
…E#2886)

* Remove unnecessary shift_degree extraction.
* Remove redundant tap_changer_type value check.
* Pass std_params directly to params dict instead of extracting individually.
* test_create should use tolist() instead of "value".
* npt.NDArray should use "integer" as a numpy.
…E#2886)

* Remove redundant tap_changer_type value check reverted.
* UT added for std_type override when create_transformers is used.
params = {**std_params, **kwargs}

if tap_changer_type is not None:
params["tap_changer_type"] = tap_changer_type
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I think this change is a good Idea there seems to be one issue.

If the standard type includes one of the explicitly passed parameters this will fail.
Standard types in pandapower have a set of minimal required values that need to be set, but can take any additional values.
So I could create a standard_type that includes e.g a derating factor df, with you're code change this would lead to df being passed twice as a keyword and lead to a TypeError: pandapower.create.trafo_create.create_transformers_from_parameters() got multiple values for keyword argument 'df'

Reproducible example:

from pandapower.std_types import create_std_type, load_std_type
from pandapower.networks.mv_oberrhein import mv_oberrhein
from pandapower.create.trafo_create import create_transformers

net = mv_oberrhein()
std_params = load_std_type(net, "63 MVA 110/10 kV", "trafo")
create_std_type(net, {**std_params, "df": .8}, "MyTrafoType", "trafo")
create_transformers(net, [58], [0], "MyTrafoType")
print(net)

assert net.trafo["in_service"].tolist() == [True]
assert net.trafo["oltc"].tolist() == [False]
assert net.trafo["test_kwargs"].tolist() == ["TestKW"]
assert net.trafo["vector_group"].tolist() == ["Dyn5"]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems to be unrelated to the PR.

I would also not approve of it as this seems overly complex, if the original assert fails you can get slightly better output if you have CLI logging enabled while testing.

Same for the test above.

@KS-HTK KS-HTK added the enhancement New feature or request label Mar 19, 2026
@KS-HTK KS-HTK linked an issue Mar 19, 2026 that may be closed by this pull request
6 tasks
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] pp.create.create_transformers value initialization not working

3 participants