OCPP: assume 1p3p support for power (#19735)

This commit is contained in:
premultiply 2025-03-13 11:05:45 +01:00 • committed by GitHub
parent dbd9c1a5fd
commit 3d89080858
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View file

@ -313,6 +313,7 @@ func (c *OCPP) setCurrent(current float64) error {
func (c *OCPP) createTxDefaultChargingProfile(current float64) *types.ChargingProfile {
phases := c.phases
period := types.NewChargingSchedulePeriod(0, current)
if c.cp.ChargingRateUnit == types.ChargingRateUnitWatts {
// get (expectedly) active phases from loadpoint
if c.lp != nil {
@ -322,11 +323,12 @@ func (c *OCPP) createTxDefaultChargingProfile(current float64) *types.ChargingPr
phases = 3
}
period = types.NewChargingSchedulePeriod(0, math.Trunc(230.0*current*float64(phases)))
}
// OCPP assumes phases == 3 if not set
if phases != 0 {
period.NumberPhases = &phases
} else {
// OCPP assumes phases == 3 if not set
if phases != 0 {
// set explicit phase configuration
period.NumberPhases = &phases
}
}
res := &types.ChargingProfile{

View file

@ -52,6 +52,7 @@ func (cp *CP) Setup(ctx context.Context, meterValues string, meterInterval time.
case match(KeyChargingScheduleAllowedChargingRateUnit):
if *opt.Value == "Power" || *opt.Value == "W" { // "W" is not allowed by spec but used by some CPs
cp.ChargingRateUnit = types.ChargingRateUnitWatts
cp.PhaseSwitching = true // assume phase switching is available for power-based charging
}
case match(KeyConnectorSwitch3to1PhaseSupported) || match(KeyChargeAmpsPhaseSwitchingSupported):