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

Transformers #1269

Closed
mikofski opened this issue Jul 31, 2021 · 26 comments · Fixed by #2053
Closed

Transformers #1269

mikofski opened this issue Jul 31, 2021 · 26 comments · Fixed by #2053

Comments

@mikofski
Copy link
Member

problem
As an energy analyst, I need to know energy at point of interconnect, and that includes detailed transformer efficiency and losses, as well as ac collection losses and curtailment

solution
A transformer load / no-load model

alternatives
Roll your own, but then this risks everyone using slightly different, possibly flawed models, precisely one of the issues pvlib tries to solve

Additional context

@adriesse
Copy link
Member

adriesse commented Aug 27, 2021

I think this would be a nice addition. The modelling is relatively easy and spec sheets often have the needed info.

@kurt-rhee
Copy link
Contributor

Hey @mikofski,

@kevinsa5 and @AdamRJensen brought this up during the PVPMC pvlib session. I'd like to take a stab at it if there are no objections. PlantPredict uses this very simple model from McCann, Lawrence , ABB Electrical Transmission and Distribution Reference, P.101.

https://terabase.atlassian.net/servicedesk/customer/portal/3/article/1292304413

@kurt-rhee
Copy link
Contributor

I would also like to write a blog post that documents how to create a pull request for a pvlib upgrade using the transformer model as a real world example.

@mikofski
Copy link
Member Author

If it helps I did some nuts & bolts talks at UC BIDS a few years back:

@kurt-rhee
Copy link
Contributor

Mark those are awesome references, I will definitely riff off of them.

@kandersolar
Copy link
Member

@kurt-rhee that would be great! FYI I skimmed around a bit in the reference but did not find the equation from the PlantPredict docs. For the pvlib function, we should cite a particular equation number or something to make it easier to find.

@mikofski
Copy link
Member Author

here is the SolarFarmer equation. I don’t know the reference. Is it similar to Plant Predict?

@kurt-rhee
Copy link
Contributor

@kandersolar That is unfortunate, I looked through it as well and there is no mention of the equations that are in PlantPredict's documentation. I've also asked around internally and none of our EE's are familiar with the equation. Looking at the commit history, the function was last edited back in 2017 so whichever performance engineer wrote the spec for that code is likely long gone.

As for the path forward, I could upload the PlantPredict documentation to zenodo, or if that isn't sufficient for this type of work, I have reached out to First Solar to see if any of their engineers are familiar with the function.

@kurt-rhee
Copy link
Contributor

@mikofski Looks like SolarFarmer and PlantPredict have different models for transformer losses.

image

@mikofski
Copy link
Member Author

@kurt-rhee I did a test and actually they’re identical!
Transformers.xlsx

They’re just algebraic manipulations of each other. Now who knows the reference? Is this just common power electronics? Maybe any textbook?

@kandersolar
Copy link
Member

kandersolar commented May 15, 2024

I think it's possible to derive them based on definitions inspired by the load and no-load losses described in that ABB reference. It would still be nice to have a more explicit reference though. Here is the outline (note: all quantities in the following are normalized to the rated power of the transformer):

Assume load loss is proportional to the square of output power:

$$\begin{aligned} L_\mathrm{load}(P_{\mathrm{out}}) &= L_\mathrm{load}(P_{\mathrm{rated}}) \cdot P_{\mathrm{out}}^2 \\\ &= L_\mathrm{full\,load} \cdot P_{\mathrm{out}}^2 \end{aligned}$$

Total loss is the variable load loss, plus a constant no-load loss:

$$ \begin{aligned} L_\mathrm{total}(P_{\mathrm{out}}) &= L_\mathrm{no,load} + L_\mathrm{load}(P_{\mathrm{out}}) \\ &= L_\mathrm{no,load} + L_\mathrm{full,load} \cdot P_{\mathrm{out}}^2 \end{aligned} $$

Conservation of energy:

$$ \begin{aligned} P_{\mathrm{in}} &= P_{\mathrm{out}} + L_\mathrm{total}(P_{\mathrm{out}}) \\ &= L_\mathrm{no,load} + P_{\mathrm{out}} + L_\mathrm{full,load} \cdot P_{\mathrm{out}}^2 \end{aligned} $$

Now use quadratic formula to solve for $P_{\mathrm{out}}$ as a function of $P_{\mathrm{in}}$:

$$ P_{\mathrm{out}} = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}, $$

where

$$ \begin{aligned} a &= L_\mathrm{full,load} \\ b &= 1 \\ c &= L_\mathrm{no,load} - P_{\mathrm{in}} \end{aligned} $$

So:

$$ P_{\mathrm{out}} = \frac{-1 \pm \sqrt{1 - 4L_\mathrm{full,load}(L_\mathrm{no,load} - P_{\mathrm{in}})}}{2L_\mathrm{full,load}} $$

(the positive root must be the correct one, if $P_{\mathrm{out}}$ is to be positive)

@mikofski
Copy link
Member Author

mikofski commented May 15, 2024

@kandersolar that’s perfect! @kurt-rhee may I suggest moving this proof into a documentation theory section, similar to single diode but called “transformer” and then no need to reference either Plant Predict or SolarFarmer? The formula above is identical to the one in SF docs which I confirmed is the same as Plant Predict

@mikofski
Copy link
Member Author

Robots in disguise

@adriesse
Copy link
Member

I think it would be best to reference an introductory electrical engineering text for the simplification of the losses as:

  • constant core losses, plus
  • quadratic winding losses

I've thrown out my textbooks decades ago, but I assume they still teach it so I hope some young engineer can suggest one.

The total loss is a vertically shifted parabola. Spec sheets give two points on that parabola, so you use these points to solve for the two coefficients of the parabola/transformer model, which we could call k_core and k_winding.

I think that all the calculations that go directly from specs to simulation needlessly and unfortunately obfuscate what is actually happening.

@kurt-rhee
Copy link
Contributor

@adriesse An introductory electrical engineering text would be really nice I agree.

Would you be okay if I wrote a first version and created a PR with a reference to the worse text cited above along with Kevin's derivation just so that pvlib has some transformer model? My personal feeling is that a model with a not very good reference is better than no model at all, and we can always update the reference in the future.

@kurt-rhee
Copy link
Contributor

@mikofski and @kandersolar

Seriously bravo thank you for all of the work you guys did.

@echedey-ls
Copy link
Contributor

I hope some young engineer can suggest one.

It's my time to shine! I'll drop my two cents here: the only English book I see recommended in the subject I had regarding them, is Electric machinery fundamentals. Stephen J. Chapman.. Luckily it's easy to find freely on the Internet. Relevant section is 2.7, subsection "Transformer Efficiency", first equation is 2-65, p. 122 of the PDF, 102 of the textbook. Maybe it's a bit old, but I think it does the trick.

@kurt-rhee
Copy link
Contributor

@mikofski
Copy link
Member Author

@echedey-ls & @kurt-rhee sorry I don’t understand the textbook reference. I can’t see how to manipulate it to the same form as @kandersolar derivation, Plant Predict, or SolarFarmer.

@echedey-ls
Copy link
Contributor

I see your point @mikofski . I understood from @adriesse comment were looking for a didactic reference, not an explicit reference with the same equations. Textually, the book states some losses are constant and other losses are quadratic with the current. The following changes explain @kandersolar first equation:

$$ P_{in} = P_{Cu} + P_{core} + V_S I_S cos \theta = P_{Cu} + P_{core} + P_{out} $$

$P_{Cu}$ relationship with output power is:

$$ P_{Cu} = I_{out}^2 R = \left( \frac{P_{out}}{V_{out}} \right) ^2 R \stackrel{V_{out}\approx constant}{=} P_{out}^2 \cdot k_{Cu}$$

Notation is different; how to determine $L_{full,load} \enspace\text{or}\enspace k_{Cu}$ is a matter of solving for it in the first equation.

Thanks for putting the image @kurt-rhee , sometimes I forget the most obvious features of github 💀

@kandersolar
Copy link
Member

I think that all the calculations that go directly from specs to simulation needlessly and unfortunately obfuscate what is actually happening.

I do not see a way to simplify or meaningfully separate the math shown above. If the copper loss was defined to be proportional to $P_{in}^2$ then the equations would surely be much cleaner. But the only way to arrive at the SolarFarmer and PlantPredict model was to assume that the copper loss was instead proportional to $P_{out}^2$, requiring the nasty quadratic formula to solve for $P_{out}$.

If you have a cleaner way, I would be quite happy to see it!

@adriesse
Copy link
Member

I'm afraid I've reached my pro bono limit on this one. Perhaps just give it another name like "plantpredict_solarfarmer" rather than "simple"! :)

@kurt-rhee
Copy link
Contributor

@adriesse @kandersolar how about something like "abb_efficiency" so that it related to the reference? I don't think that PlantPredict or SolarFarmer should get credit for the model since neither of us came up with it. I'm sure @mikofski would agree.

@cwhanse
Copy link
Member

cwhanse commented May 23, 2024

+1 for abb_efficiency if we change the reference to ABB's 1997 publication, which is a derivative work of the 1950s Westinghouse book.

@mikofski
Copy link
Member Author

Works for me

@mikofski
Copy link
Member Author

Thank you so much @kurt-rhee , @echedey-ls , @kandersolar , @adriesse , & everyone who helped on this. It feels so gods to see this issue/feature-request closed after 3 years! Amazing!

@kandersolar kandersolar added this to the 0.11.0 milestone Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants