GetChargePowerFlexibility returns the flexible amount of current charging power
(rates api.Rates)
| 681 | |
| 682 | // GetChargePowerFlexibility returns the flexible amount of current charging power |
| 683 | func (lp *Loadpoint) GetChargePowerFlexibility(rates api.Rates) float64 { |
| 684 | mode := lp.GetMode() |
| 685 | if mode == api.ModeNow || !lp.charging() || lp.minSocNotReached() || |
| 686 | lp.planActive || lp.smartLimitActive(lp.GetSmartCostLimit(), rates, true) { |
| 687 | return 0 |
| 688 | } |
| 689 | |
| 690 | if mode == api.ModePV { |
| 691 | return lp.GetChargePower() |
| 692 | } |
| 693 | |
| 694 | // MinPV mode: a charger without current control (switch socket or heatpump) cannot release power. |
| 695 | if lp.chargerHasFeature(api.SwitchDevice) || lp.chargerHasFeature(api.Continuous) { |
| 696 | return 0 |
| 697 | } |
| 698 | |
| 699 | return max(0, lp.GetChargePower()-lp.EffectiveMinPower()) |
| 700 | } |
| 701 | |
| 702 | // GetMaxPhaseCurrent returns the maximum charge current per phase or- if not available- |
| 703 | // the offered current from either charger or charge meter |