Skip to content
Open
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
6 changes: 5 additions & 1 deletion pvlib/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,17 @@ def simple_efficiency(
pg. 101.
''' # noqa: E501

if load_loss == 0:
return input_power - no_load_loss * transformer_rating

Comment on lines +108 to +110
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if load_loss == 0:
return input_power - no_load_loss * transformer_rating

I don't think this is necessary with the alternate form of the quadratic equation.

input_power_normalized = input_power / transformer_rating

a = load_loss
b = 1
c = no_load_loss - input_power_normalized

output_power_normalized = (-b + (b**2 - 4*a*c)**0.5) / (2 * a)
disc = (b*b - 4*a*c)**0.5
output_power_normalized = 2*c / (-b - disc)

output_power = output_power_normalized * transformer_rating
return output_power