Add HoldCharge battery mode (#27906)
This commit is contained in:
parent
51845c40a5
commit
03d6c0249a
9 changed files with 78 additions and 5 deletions
|
|
@ -9,4 +9,5 @@ const (
|
|||
BatteryNormal
|
||||
BatteryHold
|
||||
BatteryCharge
|
||||
BatteryHoldCharge
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
const _BatteryModeName = "unknownnormalholdcharge"
|
||||
const _BatteryModeName = "unknownnormalholdchargeholdcharge"
|
||||
|
||||
var _BatteryModeIndex = [...]uint8{0, 7, 13, 17, 23}
|
||||
var _BatteryModeIndex = [...]uint8{0, 7, 13, 17, 23, 33}
|
||||
|
||||
const _BatteryModeLowerName = "unknownnormalholdcharge"
|
||||
const _BatteryModeLowerName = "unknownnormalholdchargeholdcharge"
|
||||
|
||||
func (i BatteryMode) String() string {
|
||||
if i < 0 || i >= BatteryMode(len(_BatteryModeIndex)-1) {
|
||||
|
|
@ -28,9 +28,10 @@ func _BatteryModeNoOp() {
|
|||
_ = x[BatteryNormal-(1)]
|
||||
_ = x[BatteryHold-(2)]
|
||||
_ = x[BatteryCharge-(3)]
|
||||
_ = x[BatteryHoldCharge-(4)]
|
||||
}
|
||||
|
||||
var _BatteryModeValues = []BatteryMode{BatteryUnknown, BatteryNormal, BatteryHold, BatteryCharge}
|
||||
var _BatteryModeValues = []BatteryMode{BatteryUnknown, BatteryNormal, BatteryHold, BatteryCharge, BatteryHoldCharge}
|
||||
|
||||
var _BatteryModeNameToValueMap = map[string]BatteryMode{
|
||||
_BatteryModeName[0:7]: BatteryUnknown,
|
||||
|
|
@ -41,6 +42,8 @@ var _BatteryModeNameToValueMap = map[string]BatteryMode{
|
|||
_BatteryModeLowerName[13:17]: BatteryHold,
|
||||
_BatteryModeName[17:23]: BatteryCharge,
|
||||
_BatteryModeLowerName[17:23]: BatteryCharge,
|
||||
_BatteryModeName[23:33]: BatteryHoldCharge,
|
||||
_BatteryModeLowerName[23:33]: BatteryHoldCharge,
|
||||
}
|
||||
|
||||
var _BatteryModeNames = []string{
|
||||
|
|
@ -48,6 +51,7 @@ var _BatteryModeNames = []string{
|
|||
_BatteryModeName[7:13],
|
||||
_BatteryModeName[13:17],
|
||||
_BatteryModeName[17:23],
|
||||
_BatteryModeName[23:33],
|
||||
}
|
||||
|
||||
// BatteryModeString retrieves an enum value from the enum constants string name.
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const (
|
|||
flagCustomCssDescription = "Additional user-defined CSS file for custom styling. No compatibility guarantees."
|
||||
|
||||
flagBatteryMode = "battery-mode"
|
||||
flagBatteryModeDescription = "Set battery mode (normal, hold, charge)"
|
||||
flagBatteryModeDescription = "Set battery mode (normal, hold, charge, holdcharge)"
|
||||
flagBatteryModeWait = "battery-mode-wait"
|
||||
flagBatteryModeWaitDescription = "Wait given duration during which potential watchdogs are active"
|
||||
|
||||
|
|
|
|||
|
|
@ -225,6 +225,11 @@ func (m *E3dc) setBatteryMode(mode api.BatteryMode) error {
|
|||
e3dcDischargeBatteryLimit(false, 0),
|
||||
e3dcBatteryCharge(50000), // max. 50kWh
|
||||
}
|
||||
case api.BatteryHoldCharge:
|
||||
messages = []rscp.Message{
|
||||
e3dcDischargeBatteryLimit(false, 0),
|
||||
e3dcBatteryCharge(0),
|
||||
}
|
||||
default:
|
||||
return api.ErrNotAvailable
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ func (m *batterySocLimits) LimitController(socG func() (float64, error), limitSo
|
|||
case api.BatteryCharge:
|
||||
return limitSocS(m.MaxSoc)
|
||||
|
||||
// BatteryHoldCharge implementable via limit soc
|
||||
default:
|
||||
return api.ErrNotAvailable
|
||||
}
|
||||
|
|
|
|||
|
|
@ -264,5 +264,23 @@ render: |
|
|||
uri: {{ joinHostPort .host .port }}
|
||||
id: 1
|
||||
value: 124:0:OutWRte
|
||||
- case: 4 # holdcharge
|
||||
set:
|
||||
source: sequence
|
||||
set:
|
||||
- source: const
|
||||
value: 1
|
||||
set:
|
||||
source: sunspec
|
||||
uri: {{ .host }}:{{ .port }}
|
||||
id: 1
|
||||
value: 124:0:StorCtl_Mod
|
||||
- source: const
|
||||
value: 0 # %
|
||||
set:
|
||||
source: sunspec
|
||||
uri: {{ .host }}:{{ .port }}
|
||||
id: 1
|
||||
value: 124:0:InWRte
|
||||
{{- include "battery-params" . }}
|
||||
{{- end }}
|
||||
|
|
|
|||
|
|
@ -110,6 +110,10 @@ render: |
|
|||
body: '{"timeofuse":[]}'
|
||||
- source: error
|
||||
error: ErrNotAvailable
|
||||
- case: 4 # holdcharge (not implemented)
|
||||
set:
|
||||
source: error
|
||||
error: ErrNotAvailable
|
||||
{{- end }}
|
||||
{{- include "battery-params" . }}
|
||||
{{- end }}
|
||||
|
|
|
|||
|
|
@ -260,5 +260,23 @@ render: |
|
|||
uri: {{ joinHostPort .host .port }}
|
||||
id: 1
|
||||
value: 124:0:OutWRte
|
||||
- case: 4 # holdcharge
|
||||
set:
|
||||
source: sequence
|
||||
set:
|
||||
- source: const
|
||||
value: 1
|
||||
set:
|
||||
source: sunspec
|
||||
uri: {{ .host }}:{{ .port }}
|
||||
id: 1
|
||||
value: 124:0:StorCtl_Mod
|
||||
- source: const
|
||||
value: 0 # %
|
||||
set:
|
||||
source: sunspec
|
||||
uri: {{ .host }}:{{ .port }}
|
||||
id: 1
|
||||
value: 124:0:InWRte
|
||||
{{- include "battery-params" . }}
|
||||
{{- end }}
|
||||
|
|
|
|||
|
|
@ -104,5 +104,27 @@ render: |
|
|||
source: sunspec
|
||||
{{- include "modbus" . | indent 10 }}
|
||||
value: 124:0:InOutWRte_RvrtTms
|
||||
- case: 4 # holdcharge
|
||||
set:
|
||||
source: sequence
|
||||
set:
|
||||
- source: const
|
||||
value: 1
|
||||
set:
|
||||
source: sunspec
|
||||
{{- include "modbus" . | indent 10 }}
|
||||
value: 124:0:StorCtl_Mod
|
||||
- source: const
|
||||
value: 0 # %
|
||||
set:
|
||||
source: sunspec
|
||||
{{- include "modbus" . | indent 10 }}
|
||||
value: 124:0:InWRte
|
||||
- source: const
|
||||
value: 0 # s
|
||||
set:
|
||||
source: sunspec
|
||||
{{- include "modbus" . | indent 10 }}
|
||||
value: 124:0:InOutWRte_RvrtTms
|
||||
{{- include "battery-params" . }}
|
||||
{{- end }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue