From c947a33915909882726d91f3ca17d0f356d2d3f0 Mon Sep 17 00:00:00 2001 From: Daniel McInnes Date: Tue, 25 Jul 2023 15:35:56 +1000 Subject: [PATCH] scheduled charging can also be used for discharge Improve the ESS Scheduled menu to more clearly indicate when a scheduled operation is active, what SOC is being targeted, and to provide an option to self-consume battery energy above the limit. The use case for this is when a schedule with a lower SOC limit follows one with a higher limit. The user may want to self-consume down to the lower level. https://github.com/victronenergy/venus/issues/970 --- .../CGwacsBatteryScheduleNavigationItem.qml | 32 ++++++++----------- data/mock/SystemSettingsImpl.qml | 3 +- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/components/settings/CGwacsBatteryScheduleNavigationItem.qml b/components/settings/CGwacsBatteryScheduleNavigationItem.qml index 0d0dbe963..dcc1a5b5c 100644 --- a/components/settings/CGwacsBatteryScheduleNavigationItem.qml +++ b/components/settings/CGwacsBatteryScheduleNavigationItem.qml @@ -146,35 +146,31 @@ ListNavigationItem { maximumHour: 9999 } - ListSwitch { - id: socLimitEnabled - - //% "Stop on SOC" - text: qsTrId("cgwacs_battery_schedule_stop_on_soc") - checked: socLimitSpinBox.value < 100 - visible: defaultVisible && itemEnabled.checked - - onCheckedChanged: { - if (checked && socLimitSpinBox.value >= 100) { - socLimitSpinBox.dataPoint.setValue(95) - } else if (!checked && socLimitSpinBox.value < 100) { - socLimitSpinBox.dataPoint.setValue(100) - } - } - } - ListSpinBox { id: socLimitSpinBox //% "SOC limit" text: qsTrId("cgwacs_battery_schedule_soc_limit") - visible: defaultVisible && socLimitEnabled.checked + visible: defaultVisible dataSource: root._scheduleSource + "/Soc" suffix: "%" from: 5 to: 95 stepSize: 5 } + + ListRadioButtonGroup { + //% "Self-consumption above limit" + text: qsTrId("cgwacs_battery_schedule_self_consumption_above_limit") + dataSource: root._scheduleSource + "/AllowDischarge" + visible: defaultVisible && itemEnabled.checked && socLimit.value < 100 + optionModel: [ + //% "PV" + { display: qsTrId("cgwacs_battery_schedule_pv"), value: 0 }, + //% "PV & Battery" + { display: qsTrId("cgwacs_battery_schedule_pv_and_battery"), value: 1 } + ] + } } } } diff --git a/data/mock/SystemSettingsImpl.qml b/data/mock/SystemSettingsImpl.qml index b69c0d0cf..ba880e11e 100644 --- a/data/mock/SystemSettingsImpl.qml +++ b/data/mock/SystemSettingsImpl.qml @@ -105,9 +105,10 @@ QtObject { setMockSettingValue("CGwacs/BatteryLife/DischargedTime", 0) setMockSettingValue("CGwacs/BatteryLife/Flags", 0) setMockSettingValue("CGwacs/BatteryLife/MinimumSocLimit", 10) + setMockSettingValue("CGwacs/BatteryLife/Schedule/Charge/0/AllowDischarge", 1) setMockSettingValue("CGwacs/BatteryLife/Schedule/Charge/0/Day", -1) setMockSettingValue("CGwacs/BatteryLife/Schedule/Charge/0/Duration", -1) - setMockSettingValue("CGwacs/BatteryLife/Schedule/Charge/0/Soc", 100) + setMockSettingValue("CGwacs/BatteryLife/Schedule/Charge/0/Soc", 90) setMockSettingValue("CGwacs/BatteryLife/Schedule/Charge/0/Start", 0) setMockSettingValue("CGwacs/BatteryLife/SocLimit", 10) setMockSettingValue("CGwacs/BatteryLife/State", 4)