|
| 1 | +""" |
| 2 | +This module contains functions for transformer modeling. |
| 3 | +
|
| 4 | +Transformer models calculate AC power output and losses at a given input power. |
| 5 | +""" |
| 6 | + |
| 7 | + |
| 8 | +def simple_efficiency( |
| 9 | + input_power, no_load_loss, load_loss, transformer_rating |
| 10 | +): |
| 11 | + r''' |
| 12 | + Calculate the power at the output terminal of the transformer |
| 13 | + after taking into account efficiency using a simple calculation. |
| 14 | +
|
| 15 | + The equation used in this function can be derived from [1]_. |
| 16 | +
|
| 17 | + For a zero input power, the output power will be negative. |
| 18 | + This means the transformer will consume energy from the grid at night if |
| 19 | + it stays connected (due to the parallel impedance in the equivalent |
| 20 | + circuit). |
| 21 | + If the input power is negative, the output power will be even more |
| 22 | + negative; so the model can be used bidirectionally when drawing |
| 23 | + energy from the grid. |
| 24 | +
|
| 25 | + Parameters |
| 26 | + ---------- |
| 27 | + input_power : numeric |
| 28 | + The real AC power input to the transformer. [W] |
| 29 | +
|
| 30 | + no_load_loss : numeric |
| 31 | + The constant losses experienced by a transformer, even |
| 32 | + when the transformer is not under load. Fraction of transformer rating, |
| 33 | + value from 0 to 1. [unitless] |
| 34 | +
|
| 35 | + load_loss: numeric |
| 36 | + The load dependent losses experienced by the transformer. |
| 37 | + Fraction of transformer rating, value from 0 to 1. [unitless] |
| 38 | +
|
| 39 | + transformer_rating: numeric |
| 40 | + The nominal output power of the transformer. [VA] |
| 41 | +
|
| 42 | + Returns |
| 43 | + ------- |
| 44 | + output_power : numeric |
| 45 | + Real AC power output. [W] |
| 46 | +
|
| 47 | + Notes |
| 48 | + ------- |
| 49 | + First, assume that the load loss :math:`L_{load}` (as a fraction of rated power |
| 50 | + :math:`P_{nom}`) is proportional to the square of output power: |
| 51 | +
|
| 52 | + .. math:: |
| 53 | +
|
| 54 | + L_{load}(P_{out}) &= L_{load}(P_{rated}) \times (P_{out} / P_{nom})^2 |
| 55 | +
|
| 56 | + &= L_{full, load} \times (P_{out} / P_{nom})^2 |
| 57 | +
|
| 58 | + Total loss is the constant no-load loss plus the variable load loss: |
| 59 | +
|
| 60 | + .. math:: |
| 61 | +
|
| 62 | + L_{total}(P_{out}) &= L_{no, load} + L_{load}(P_{out}) |
| 63 | +
|
| 64 | + &= L_{no, load} + L_{full, load} \times (P_{out} / P_{nom})^2 |
| 65 | +
|
| 66 | +
|
| 67 | + By conservation of energy, total loss is the difference between input and |
| 68 | + output power: |
| 69 | +
|
| 70 | + .. math:: |
| 71 | +
|
| 72 | + \frac{P_{in}}{P_{nom}} &= \frac{P_{out}}{P_{nom}} + L_{total}(P_{out}) |
| 73 | +
|
| 74 | + &= \frac{P_{out}}{P_{nom}} + L_{no, load} + L_{full, load} \times (P_{out} / P_{nom})^2 |
| 75 | +
|
| 76 | + Now use the quadratic formula to solve for :math:`P_{out}` as a function of |
| 77 | + :math:`P_{in}`. |
| 78 | +
|
| 79 | + .. math:: |
| 80 | +
|
| 81 | + \frac{P_{out}}{P_{nom}} &= \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} |
| 82 | +
|
| 83 | + a &= L_{full, load} |
| 84 | +
|
| 85 | + b &= 1 |
| 86 | +
|
| 87 | + c &= L_{no, load} - P_{in} / P_{nom} |
| 88 | +
|
| 89 | + Therefore: |
| 90 | +
|
| 91 | + .. math:: |
| 92 | +
|
| 93 | + P_{out} = P_{nom} \frac{-1 \pm \sqrt{1 - 4 L_{full, load} |
| 94 | +
|
| 95 | + \times (L_{no, load} - P_{in}/P_{nom})}}{2 L_{full, load}} |
| 96 | +
|
| 97 | + The positive root should be chosen, so that the output power is |
| 98 | + positive. |
| 99 | +
|
| 100 | +
|
| 101 | + References |
| 102 | + ---------- |
| 103 | + .. [1] Central Station Engineers of the Westinghouse Electric Corporation, |
| 104 | + "Electrical Transmission and Distribution Reference Book" 4th Edition. |
| 105 | + pg. 101. |
| 106 | + ''' # noqa: E501 |
| 107 | + |
| 108 | + input_power_normalized = input_power / transformer_rating |
| 109 | + |
| 110 | + a = load_loss |
| 111 | + b = 1 |
| 112 | + c = no_load_loss - input_power_normalized |
| 113 | + |
| 114 | + output_power_normalized = (-b + (b**2 - 4*a*c)**0.5) / (2 * a) |
| 115 | + |
| 116 | + output_power = output_power_normalized * transformer_rating |
| 117 | + return output_power |
0 commit comments