chore: move MaxACPower from battery to pv (#22943)
This commit is contained in:
parent
5797f6afb3
commit
f1b479cb82
4 changed files with 36 additions and 33 deletions
|
|
@ -32,15 +32,15 @@ func init() {
|
|||
|
||||
func NewE3dcFromConfig(other map[string]interface{}) (api.Meter, error) {
|
||||
cc := struct {
|
||||
batteryCapacity `mapstructure:",squash"`
|
||||
batteryMaxACPower `mapstructure:",squash"`
|
||||
Usage templates.Usage
|
||||
Uri string
|
||||
User string
|
||||
Password string
|
||||
Key string
|
||||
DischargeLimit uint32
|
||||
Timeout time.Duration
|
||||
batteryCapacity `mapstructure:",squash"`
|
||||
pvMaxACPower `mapstructure:",squash"`
|
||||
Usage templates.Usage
|
||||
Uri string
|
||||
User string
|
||||
Password string
|
||||
Key string
|
||||
DischargeLimit uint32
|
||||
Timeout time.Duration
|
||||
}{
|
||||
Timeout: request.Timeout,
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ func NewE3dcFromConfig(other map[string]interface{}) (api.Meter, error) {
|
|||
ReceiveTimeout: cc.Timeout,
|
||||
}
|
||||
|
||||
return NewE3dc(cfg, cc.Usage, cc.DischargeLimit, cc.batteryCapacity.Decorator(), cc.batteryMaxACPower.Decorator())
|
||||
return NewE3dc(cfg, cc.Usage, cc.DischargeLimit, cc.batteryCapacity.Decorator(), cc.pvMaxACPower.Decorator())
|
||||
}
|
||||
|
||||
var e3dcOnce sync.Once
|
||||
|
|
|
|||
|
|
@ -22,13 +22,15 @@ func NewConfigurableFromConfig(ctx context.Context, other map[string]interface{}
|
|||
measurement.Energy `mapstructure:",squash"` // energy optional
|
||||
measurement.Phases `mapstructure:",squash"` // optional
|
||||
|
||||
// pv
|
||||
pvMaxACPower `mapstructure:",squash"`
|
||||
|
||||
// battery
|
||||
batteryCapacity `mapstructure:",squash"`
|
||||
batteryMaxACPower `mapstructure:",squash"`
|
||||
batterySocLimits `mapstructure:",squash"`
|
||||
Soc *plugin.Config // optional
|
||||
LimitSoc *plugin.Config // optional
|
||||
BatteryMode *plugin.Config // optional
|
||||
batteryCapacity `mapstructure:",squash"`
|
||||
batterySocLimits `mapstructure:",squash"`
|
||||
Soc *plugin.Config // optional
|
||||
LimitSoc *plugin.Config // optional
|
||||
BatteryMode *plugin.Config // optional
|
||||
}{
|
||||
batterySocLimits: batterySocLimits{
|
||||
MinSoc: 20,
|
||||
|
|
@ -80,7 +82,7 @@ func NewConfigurableFromConfig(ctx context.Context, other map[string]interface{}
|
|||
}
|
||||
}
|
||||
|
||||
res := m.Decorate(energyG, currentsG, voltagesG, powersG, socG, cc.batteryCapacity.Decorator(), cc.batteryMaxACPower.Decorator(), batModeS)
|
||||
res := m.Decorate(energyG, currentsG, voltagesG, powersG, socG, cc.batteryCapacity.Decorator(), cc.pvMaxACPower.Decorator(), batModeS)
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,22 +18,6 @@ func (m *batteryCapacity) Decorator() func() float64 {
|
|||
}
|
||||
}
|
||||
|
||||
type batteryMaxACPower struct {
|
||||
MaxACPower float64
|
||||
}
|
||||
|
||||
// var _ api.MaxACPowerGetter = (*batteryMaxACPower)(nil)
|
||||
|
||||
// Decorator returns the max AC power decorator
|
||||
func (m *batteryMaxACPower) Decorator() func() float64 {
|
||||
if m.MaxACPower == 0 {
|
||||
return nil
|
||||
}
|
||||
return func() float64 {
|
||||
return m.MaxACPower
|
||||
}
|
||||
}
|
||||
|
||||
type batterySocLimits struct {
|
||||
MinSoc, MaxSoc float64
|
||||
}
|
||||
17
meter/usage_pv.go
Normal file
17
meter/usage_pv.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package meter
|
||||
|
||||
type pvMaxACPower struct {
|
||||
MaxACPower float64
|
||||
}
|
||||
|
||||
// var _ api.MaxACPowerGetter = (*pvMaxACPower)(nil)
|
||||
|
||||
// Decorator returns the max AC power decorator
|
||||
func (m *pvMaxACPower) Decorator() func() float64 {
|
||||
if m.MaxACPower == 0 {
|
||||
return nil
|
||||
}
|
||||
return func() float64 {
|
||||
return m.MaxACPower
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue