EEBus: error on missing productionNominalMax (BC) (#31483)
This commit is contained in:
parent
c3692046b9
commit
238ab79e59
4 changed files with 17 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ package eebus
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
|
@ -246,6 +247,10 @@ func (c *EEBus) run() error {
|
|||
// LPP
|
||||
if c.productionLimitActivated.IsZero() {
|
||||
if c.productionLimit.IsActive {
|
||||
if c.productionNominalMax <= 0 {
|
||||
return errors.New("production limit received but productionNominalMax is not configured")
|
||||
}
|
||||
|
||||
c.log.WARN.Println("activating production limit")
|
||||
c.setProductionLimit(c.productionLimit.Value, true)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,6 +150,18 @@ func TestRun_ProductionLimitReleasedEarly(t *testing.T) {
|
|||
assertProductionLimit(t, c, false)
|
||||
}
|
||||
|
||||
// TestRun_ProductionLimitWithoutNominalMax verifies an incoming LPP limit
|
||||
// errors instead of being silently ignored when productionNominalMax is unset (#31469).
|
||||
func TestRun_ProductionLimitWithoutNominalMax(t *testing.T) {
|
||||
c := newTestEEBus(t)
|
||||
c.heartbeat.Set(struct{}{})
|
||||
c.productionNominalMax = 0
|
||||
|
||||
c.productionLimit = ucapi.LoadLimit{Value: -2200, IsActive: true, Duration: time.Hour}
|
||||
require.Error(t, c.run())
|
||||
assert.Nil(t, c.CurtailedPercent())
|
||||
}
|
||||
|
||||
// TestRun_ConsumptionLimitReleasedEarly is the LPC mirror of the LPP early-release
|
||||
// case: an active consumption limit must drop as soon as the EG deactivates it.
|
||||
func TestRun_ConsumptionLimitReleasedEarly(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue