Curtailment: distribute limits to all devices by percent (#31390)

This commit is contained in:
andig 2026-07-02 20:43:12 +02:00 • committed by GitHub
parent 949daf4670
commit eea55d282d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 147 additions and 131 deletions

View file

@ -210,8 +210,8 @@ type Dimmer interface {
// Curtailer provides EEG §9 curtailment
type Curtailer interface {
Curtailed() (bool, error)
Curtail(bool) error
Curtailed() (bool, error) // curtailed if feed-in is limited to less than nominal (<100%)
SetCurtailPercent(int) error // limit feed-in to the given percent of nominal (0..100, 100 = uncurtailed)
}
// ChargeController allows to start/stop the charging session on the vehicle side
@ -293,8 +293,8 @@ type Circuit interface {
type HEMS interface {
SetUpdated(func())
Dimmed() *bool // nil = no statement
Curtailed() *bool // nil = no statement
MaxConsumptionPower() float64 // 0 = no limit
CurtailedPercent() *int // allowed feed-in percent of nominal production power (0..100), nil = no statement
MaxProductionPower() *float64 // nil = no limit
}

View file

@ -173,7 +173,7 @@ func (i *iCurrentGetter) GetMaxCurrent() (float64, error) {
return i.currentGetter0()
}
func Curtailer(curtailer0 func(bool) error, curtailer1 func() (bool, error)) api.Curtailer {
func Curtailer(curtailer0 func() (bool, error), curtailer1 func(int) error) api.Curtailer {
if curtailer0 == nil || curtailer1 == nil {
return nil
}
@ -181,16 +181,16 @@ func Curtailer(curtailer0 func(bool) error, curtailer1 func() (bool, error)) api
}
type iCurtailer struct {
curtailer0 func(bool) error
curtailer1 func() (bool, error)
}
func (i *iCurtailer) Curtail(p0 bool) error {
return i.curtailer0(p0)
curtailer0 func() (bool, error)
curtailer1 func(int) error
}
func (i *iCurtailer) Curtailed() (bool, error) {
return i.curtailer1()
return i.curtailer0()
}
func (i *iCurtailer) SetCurtailPercent(p0 int) error {
return i.curtailer1(p0)
}
func Dimmer(dimmer0 func(bool) error, dimmer1 func() (bool, error)) api.Dimmer {

View file

@ -1212,18 +1212,18 @@ func (m *MockHEMS) EXPECT() *MockHEMSMockRecorder {
return m.recorder
}
// Curtailed mocks base method.
func (m *MockHEMS) Curtailed() *bool {
// CurtailedPercent mocks base method.
func (m *MockHEMS) CurtailedPercent() *int {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Curtailed")
ret0, _ := ret[0].(*bool)
ret := m.ctrl.Call(m, "CurtailedPercent")
ret0, _ := ret[0].(*int)
return ret0
}
// Curtailed indicates an expected call of Curtailed.
func (mr *MockHEMSMockRecorder) Curtailed() *gomock.Call {
// CurtailedPercent indicates an expected call of CurtailedPercent.
func (mr *MockHEMSMockRecorder) CurtailedPercent() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Curtailed", reflect.TypeOf((*MockHEMS)(nil).Curtailed))
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurtailedPercent", reflect.TypeOf((*MockHEMS)(nil).CurtailedPercent))
}
// Dimmed mocks base method.