fastCharging scales to 3p if available and sets maximum current
()
| 1339 | |
| 1340 | // fastCharging scales to 3p if available and sets maximum current |
| 1341 | func (lp *Loadpoint) fastCharging() error { |
| 1342 | if lp.hasPhaseSwitching() { |
| 1343 | phases := 3 |
| 1344 | |
| 1345 | // load management limit active |
| 1346 | if lp.circuit != nil { |
| 1347 | minPower3p := currentToPower(lp.effectiveMinCurrent(), 3) |
| 1348 | if powerLimit := lp.circuit.ValidatePower(lp.chargePower, minPower3p); powerLimit < minPower3p { |
| 1349 | phases = 1 |
| 1350 | lp.log.DEBUG.Printf("fast charging: scaled to 1p to match %.0fW available circuit power", powerLimit) |
| 1351 | } |
| 1352 | } |
| 1353 | |
| 1354 | // ignore api.ErrNotAvailable: the phase switch could not be performed |
| 1355 | // right now, continue with the current phase configuration |
| 1356 | if err := lp.scalePhasesIfAvailable(phases); err != nil && !errors.Is(err, api.ErrNotAvailable) { |
| 1357 | return err |
| 1358 | } |
| 1359 | } |
| 1360 | |
| 1361 | return lp.setLimit(lp.effectiveMaxCurrent()) |
| 1362 | } |
| 1363 | |
| 1364 | // minCharging scales to 1p if available and sets minimum current |
| 1365 | func (lp *Loadpoint) minCharging() error { |