@@ -122,63 +122,108 @@ def __init__(self, distributor_exponent: float = 1) -> None:
122122 * 3 - means proportion would be like x^3 from SoC.
123123
124124 Example:
125- Lets say we have two batteries Bat1 and Bat2. All parameters
126- except SoC are equal.
127- SoC bounds for each battery is lower = 20, upper = 80.
128-
129- Example1:
130- Let Bat1.soc = 70 and Bat2.soc = 50.
131- Bat1.available_soc = 10, Bat2.available_soc = 30
132- Bat1.available_soc / Bat2.available_soc = 3
133- We need to distribute 8000W.
134- If distribution_exponent is
135- * 0: distribution for each battery will be the equal.
136- Bat1.distribution = 4000; Bat2.distribution = 4000
137- * 1: then Bat2 will have 3x more power assigned then Bat1.
138- 10x+30x = 8000
139- x = 200
140- Bat1.distribution = 2000; Bat2.distribution = 6000
141- * 2: then Bat2 will have 9x more power assigned then Bat1.
142- (10)^2 * x + (30)^2 * x = 8000
143- x = 80
144- Bat1.distribution = 800; Bat2.distribution = 7200
145- * 3: then Bat2 will have 27x more power assigned then Bat1.
146- (10)^3 * x + (30)^3 * x = 8000
147- x = 0,285714286
148- Bat1.distribution = 285; Bat2.distribution = 7715
149-
150- Example2:
151- Let Bat1.soc = 50 and Bat2.soc = 20.
152- Bat1.available_soc = 30, Bat2.available_soc = 60
153- Bat1.available_soc / Bat2.available_soc = 2
154- We need to distribute 900W.
155- If distribution_exponent is
156- * 0: distribution for each battery will be the same.
157- Bat1.distribution = 4500; Bat2.distribution = 450
158- * 1: then Bat2 will have 2x more power assigned then Bat1.
159- 30x + 60x = 900
160- x = 100
161- Bat1.distribution = 300; Bat2.distribution = 600
162- * 2: then Bat2 will have 4x more power assigned then Bat1.
163- 30^2 * x + 60^2 * x = 900
164- x = 0.2
165- Bat1.distribution = 180; Bat2.distribution = 720
166- * 3: then Bat2 will have 8x more power assigned then Bat1.
167- 30^3 * x + 60^3 * x = 900
168- x = 0,003703704
169- Bat1.distribution = 100; Bat2.distribution = 800
170-
171- Example3:
172- Let Bat1.soc = 44 and Bat2.soc = 64.
173- Bat1.available_soc = 36 (80 - 44), Bat2.available_soc = 16 (80 - 64)
174- We need to distribute 900W.
175- If distribution_exponent is
176- * 0: distribution for each battery will be the equal.
177- Bat1.distribution = 450; Bat2.distribution = 450
178- * 0.5: then Bat2 will have 6/4x more power assigned then Bat1.
179- sqrt(36)x + sqrt(16)x = 900
180- x = 100
181- Bat1.distribution = 600; Bat2.distribution = 400
125+ Lets say we have two batteries `Bat1` and `Bat2`. All parameters
126+ except SoC are equal. SoC bounds for each battery is `lower = 20`,
127+ `upper = 80`.
128+
129+ # Example 1
130+
131+ Let:
132+
133+ * `Bat1.soc = 70` and `Bat2.soc = 50`.
134+ * `Bat1.available_soc = 10`, `Bat2.available_soc = 30`
135+ * `Bat1.available_soc / Bat2.available_soc = 3`
136+
137+ We need to distribute 8000W.
138+
139+ If `distribution_exponent` is:
140+
141+ * `0`: distribution for each battery will be the equal.
142+ ``` python
143+ Bat1.distribution = 4000; Bat2.distribution = 4000
144+ ```
145+
146+ * `1`: then `Bat2` will have 3x more power assigned then `Bat1`.
147+ ``` python
148+ 10 * x + 30 * x = 8000
149+ x = 200
150+ Bat1.distribution = 2000; Bat2.distribution = 6000
151+ ```
152+
153+ * `2`: then `Bat2` will have 9x more power assigned then `Bat1`.
154+ ``` python
155+ 10^2 * x + 30^2 * x = 8000
156+ x = 80
157+ Bat1.distribution = 800; Bat2.distribution = 7200
158+ ```
159+
160+ * `3`: then `Bat2` will have 27x more power assigned then `Bat1`.
161+ ``` python
162+ 10^3 * x + 30^3 * x = 8000
163+ x = 0,285714286
164+ Bat1.distribution = 285; Bat2.distribution = 7715
165+ ```
166+
167+ # Example 2
168+
169+ Let:
170+
171+ * `Bat1.soc = 50` and `Bat2.soc = 20`.
172+ * `Bat1.available_soc = 30`, `Bat2.available_soc = 60`
173+ * `Bat1.available_soc / Bat2.available_soc = 2`
174+
175+ We need to distribute 900W.
176+
177+ If `distribution_exponent` is:
178+
179+ * `0`: distribution for each battery will be the same.
180+ ``` python
181+ Bat1.distribution = 4500; Bat2.distribution = 450
182+ ```
183+
184+ * `1`: then `Bat2` will have 2x more power assigned then `Bat1`.
185+ ``` python
186+ 30 * x + 60 * x = 900
187+ x = 100
188+ Bat1.distribution = 300; Bat2.distribution = 600
189+ ```
190+
191+ * `2`: then `Bat2` will have 4x more power assigned then `Bat1`.
192+ ``` python
193+ 30^2 * x + 60^2 * x = 900
194+ x = 0.2
195+ Bat1.distribution = 180; Bat2.distribution = 720
196+ ```
197+
198+ * `3`: then `Bat2` will have 8x more power assigned then `Bat1`.
199+ ``` python
200+ 30^3 * x + 60^3 * x = 900
201+ x = 0,003703704
202+ Bat1.distribution = 100; Bat2.distribution = 800
203+ ```
204+
205+ # Example 3
206+
207+ Let:
208+
209+ * `Bat1.soc = 44` and `Bat2.soc = 64`.
210+ * `Bat1.available_soc = 36 (80 - 44)`, `Bat2.available_soc = 16 (80 - 64)`
211+
212+ We need to distribute 900W.
213+
214+ If `distribution_exponent` is:
215+
216+ * `0`: distribution for each battery will be the equal.
217+ ``` python
218+ Bat1.distribution = 450; Bat2.distribution = 450
219+ ```
220+
221+ * `0.5`: then `Bat2` will have 6/4x more power assigned then `Bat1`.
222+ ``` python
223+ sqrt(36) * x + sqrt(16) * x = 900
224+ x = 100
225+ Bat1.distribution = 600; Bat2.distribution = 400
226+ ```
182227
183228 Raises:
184229 ValueError: If distributor_exponent < 0
0 commit comments