Innovenergy_trunk/firmware/opt/victronenergy/gui/qml/PageChargingStrategy.qml

293 lines
8.3 KiB
QML
Raw Normal View History

2023-02-16 12:57:06 +00:00
import QtQuick 1.1
import com.victron.velib 1.0
import "utils.js" as Utils
MbPage {
property string cgwacsPath: "com.victronenergy.settings/Settings/CGwacs"
property string settingsPrefix: "com.victronenergy.settings"
property string batteryLifePath: cgwacsPath + "/BatteryLife"
// Hub4Mode
property int hub4PhaseCompensation: 1
property int hub4PhaseSplit: 2
property int hub4Disabled: 3
property bool initialized: false
property VBusItem lastEoc: VBusItem { bind: "com.victronenergy.settings/Settings/Controller/LastEOC" }
title: qsTr("Charging Strategy")
Component.onCompleted: {
initialized = true
}
VBusItem {
id: controllerState
bind: "com.victronenergy.controller/State"
}
VBusItem {
id: systemType
bind: "com.victronenergy.system/SystemType"
}
VBusItem {
id: gridSetpoint
bind: "com.victronenergy.settings/Settings/CGwacs/AcPowerSetPoint"
}
VBusItem {
id: maxChargePowerItem
bind: Utils.path(cgwacsPath, "/MaxChargePower")
}
VBusItem {
id: maxDischargePowerItem
bind: Utils.path(cgwacsPath, "/MaxDischargePower")
}
VBusItem {
id: socLimitItem
bind: Utils.path(batteryLifePath, "/SocLimit")
}
VBusItem {
id: minSocLimitItem
bind: Utils.path(batteryLifePath, "/MinimumSocLimit")
}
VBusItem {
id: stateItem
bind: Utils.path(batteryLifePath, "/State")
}
model: hub4Settings
VisualItemModel {
id: hub4Settings
MbItemOptions {
id: chargingState
description: qsTr("Charging state")
readonly: true
bind: "com.victronenergy.controller/State"
possibleValues:[
MbOption { description: qsTr("Unknown"); value: 0 },
MbOption { description: qsTr("Heating"); value: 1 },
MbOption { description: qsTr("Optimize self-consumption"); value: 2 },
MbOption { description: qsTr("Calibration charge"); value: 3 },
MbOption { description: qsTr("Hold min SOC"); value: 4 },
MbOption { description: qsTr("Charge to min SOC"); value: 5 },
MbOption { description: qsTr("Bridge grid blackout"); value: 6 },
MbOption { description: qsTr("Limit discharge power"); value: 7 },
MbOption { description: qsTr("Scheduled charge"); value: 8 },
MbOption { description: qsTr("Limit charge power"); value: 9 },
MbOption { description: qsTr("No grid meter available"); value: 10 },
MbOption { description: qsTr("No battery available"); value: 11 },s
MbOption { description: qsTr("No inverter available"); value: 12 }
]
}
MbItemOptionsKnown {
id: timeToEoc
description: qsTr("Time to calibration charge")
readonly: true
bind: "com.victronenergy.controller/TimeToCalibrationCharge"
possibleValues:[
MbOption { description: qsTr("Now"); value: "now" }
]
}
MbEditBoxTime {
id: startTime
description: qsTr("Calibration charge start time (hh:mm)")
item.bind: "com.victronenergy.settings/Settings/Controller/CalibrationChargeStartTime"
writeAccessLevel: User.AccessUser
}
MbOK {
id: eoctime
description: qsTr("Start calibration charge now?")
writeAccessLevel: User.AccessUser
value: controllerState.value==3? qsTr("Calibration charge started") : qsTr("Press here")
show:true
//show:lastEoc.value!==0
onClicked: {
if (controllerState.value!==3){lastEoc.setValue(0)}
}
}
MbSpinBox {
id: acPowerSetPoint
description: qsTr("Grid setpoint")
//show: hub4Mode.value !== hub4Disabled && stateItem.value !== batteryKeepCharged #we don't depend on hub4Mode anymore
show: true
userHasWriteAccess: true
//bind: "com.victronenergy.settings/Settings/CGwacs/AcPowerSetPoint"
//numOfDecimals: 0
////unit: "W"
////stepsize: 100
}
MbSpinBox {
id: minSocLimit
description: qsTr("Minimum SOC (unless grid fails)")
userHasWriteAccess: true
//show: hub4Mode.value !== hub4Disabled && stateItem.value !== batteryKeepCharged #we don't depend on hub4Mode anymore
show: true
//bind: Utils.path(batteryLifePath, "/MinimumSocLimit")
//numOfDecimals: 0
//unit: "%"
//min: 0
//max: 100
//stepsize: 5
}
MbSwitch {
id: withoutGridMeter
name: qsTr("Grid meter installed")
userHasWriteAccess: true
enabled: true
bind: Utils.path(cgwacsPath, '/RunWithoutGridMeter')
//show: hub4Mode.value !== hub4Disabled #we don't depend on hub4Mode anymore
show: true
invertSense: true
}
MbSwitch {
bind: Utils.path(settingsPrefix, "/Settings/SystemSetup/HasAcOutSystem")
name: qsTr("Inverter AC output in use")
show: withoutGridMeter.checked
userHasWriteAccess: true
enabled: true
}
/* MbSwitch { //auskommentiert for possible future use
VBusItem {
id: vebusPath
bind: "com.victronenergy.system/VebusService"
}
VBusItem {
id: doNotFeedInvOvervoltage
bind: Utils.path(vebusPath.value, "/Hub4/DoNotFeedInOvervoltage")
}
name: qsTr("Feed-in excess solarcharger power")
bind: Utils.path(settingsPrefix, "/Settings/CGwacs/OvervoltageFeedIn")
show: hub4Mode.value !== hub4Disabled && doNotFeedInvOvervoltage.valid
userHasWriteAccess: true
enabled: true
}*/
MbSwitch {
id: maxChargePowerSwitch
name: qsTr("Limit the charge power")
checked: maxChargePowerItem.value >= 0
userHasWriteAccess: true
enabled: true
//show: hub4Mode.value !== hub4Disabled && !(maxChargeCurrentControl.valid && maxChargeCurrentControl.value) #we don't depend on hub4Mode anymore
show: true
onCheckedChanged: {
if (checked && maxChargePowerItem.value < 0)
maxChargePowerItem.setValue(1000)
else if (!checked && maxChargePowerItem.value >= 0)
maxChargePowerItem.setValue(-1)
}
}
MbSpinBox {
id: maxChargePower
description: qsTr("Maximum charge power")
userHasWriteAccess: true
show: maxChargePowerSwitch.show && maxChargePowerSwitch.checked
//bind: Utils.path(cgwacsPath, "/MaxChargePower")
//numOfDecimals: 0
//unit: "W"
//min: 0
//max: 200000
//stepsize: 50
}
MbSwitch {
id: maxInverterPowerSwitch
name: qsTr("Limit the discharge power")
checked: maxDischargePowerItem.value >= 0
userHasWriteAccess: true
enabled: true
//show: hub4Mode.value !== hub4Disabled && stateItem.value !== batteryKeepCharged #we don't depend on hub4Mode anymore
show: true
onCheckedChanged: {
if (checked && maxDischargePowerItem.value < 0)
maxDischargePowerItem.setValue(1000)
else if (!checked && maxDischargePowerItem.value >= 0)
maxDischargePowerItem.setValue(-1)
}
}
MbSpinBox {
id: maxDischargePower
description: qsTr("Maximum discharge power")
userHasWriteAccess: true
show: maxInverterPowerSwitch.show && maxInverterPowerSwitch.checked
//bind: Utils.path(cgwacsPath, "/MaxDischargePower")
//numOfDecimals: 0
//unit: "W"
//min: 0
//max: 300000
//stepsize: 50
}
MbSwitch {
name: qsTr("Fronius Zero feed-in")
bind: Utils.path(cgwacsPath, "/PreventFeedback")
//show: hub4Mode.value !== hub4Disabled #we don't depend on hub4Mode anymore
show: true
userHasWriteAccess: true
}
MbItemValue {
VBusItem {
id: pvPowerLimiterActive
bind: "com.victronenergy.hub4/PvPowerLimiterActive"
}
description: qsTr("Fronius Zero feed-in active")
//show: hub4Mode.value !== hub4Disabled && pvPowerLimiterActive.valid #we don't depend on hub4Mode anymore
show: pvPowerLimiterActive.valid
item.value: pvPowerLimiterActive.value === 0 ? qsTr("No") : qsTr("Yes")
}
// TODO, support scheduled charging
MbSubMenu {
id: scheduleSettings
property string bindPrefix: "com.victronenergy.settings/Settings/CGwacs/BatteryLife/Schedule/Charge/"
description: qsTr("Scheduled charging")
//show: hub4Mode.value !== hub4Disabled #we don't depend on hub4Mode anymore
show: true
subpage: Component {
MbPage {
title: scheduleSettings.description
model: VisualItemModel {
ChargeScheduleItem { bindPrefix: scheduleSettings.bindPrefix; scheduleNumber: 0 }
ChargeScheduleItem { bindPrefix: scheduleSettings.bindPrefix; scheduleNumber: 1 }
ChargeScheduleItem { bindPrefix: scheduleSettings.bindPrefix; scheduleNumber: 2 }
ChargeScheduleItem { bindPrefix: scheduleSettings.bindPrefix; scheduleNumber: 3 }
ChargeScheduleItem { bindPrefix: scheduleSettings.bindPrefix; scheduleNumber: 4 }
}
}
}
}
MbSubMenu {
id: deviceItem
description: qsTr("Debug")
show: user.accessLevel >= User.AccessService
subpage: Component {
PageHub4Debug { }
}
}
}
}