MCPcopy Create free account
hub / github.com/evcc-io/evcc / GetChargePowerFlexibility

Method GetChargePowerFlexibility

core/loadpoint_api.go:683–700  ·  view source on GitHub ↗

GetChargePowerFlexibility returns the flexible amount of current charging power

(rates api.Rates)

Source from the content-addressed store, hash-verified

681
682// GetChargePowerFlexibility returns the flexible amount of current charging power
683func (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

Callers 1

Calls 8

GetModeMethod · 0.95
chargingMethod · 0.95
minSocNotReachedMethod · 0.95
smartLimitActiveMethod · 0.95
GetSmartCostLimitMethod · 0.95
GetChargePowerMethod · 0.95
chargerHasFeatureMethod · 0.95
EffectiveMinPowerMethod · 0.95

Tested by 1