Implemented functionality to control outputs for BMS

This commit is contained in:
Yury Shuvakin
2022-11-26 09:28:53 +03:00
parent eb89c386a3
commit 92c3e42039
9 changed files with 483 additions and 136 deletions

View File

@@ -0,0 +1,42 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import Utils 1.0
RadioButton {
id: control
implicitHeight: 30
spacing: 15
leftPadding: 0
indicator: Rectangle {
implicitWidth: control.implicitHeight
implicitHeight: control.implicitHeight
x: control.leftPadding
y: parent.height / 2 - height / 2
radius: implicitWidth / 2
border.color: Palette.borderColor
Rectangle {
property int spacing: 10
width: parent.implicitWidth - spacing
height: parent.implicitHeight - spacing
x: spacing / 2
y: spacing / 2
radius: width / 2
color: Palette.alternativeBackgroundColor
visible: control.checked
}
}
contentItem: Text {
text: control.text
font.pixelSize: 18
font.weight: Font.Bold
color: Palette.textColor
maximumLineCount: 2
wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter
leftPadding: control.indicator.width + control.spacing
}
}

View File

@@ -26,3 +26,4 @@ ScrollIndicator 1.0 ScrollIndicator.qml
OutlineImageButton 1.0 OutlineImageButton.qml
ImageButton 1.0 ImageButton.qml
ProgressBar 1.0 ProgressBar.qml
RadioButton 1.0 RadioButton.qml

View File

@@ -393,7 +393,8 @@ RowLayout {
}
Controls.CheckBox {
text: qsTr("Use for storage management")
id: chargeBatteryOutputCheckBox
text: qsTr("Use to control charger")
Layout.fillWidth: true
Layout.preferredHeight: outputSettingsFrame.outputNumberSize
}
@@ -417,7 +418,8 @@ RowLayout {
}
Controls.CheckBox {
text: qsTr("Normally closed")
id: brushOrShuntOutputCheckBox
text: qsTr("Active")
Layout.fillWidth: true
Layout.preferredHeight: outputSettingsFrame.outputNumberSize
}
@@ -426,20 +428,48 @@ RowLayout {
Layout.columnSpan: 2
}
Controls.RadioButton {
id: brushControlRadioButton
text: qsTr("Brush control")
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
Controls.RadioButton {
id: shuntChargingContactorRadioButton
text: qsTr("Shunt charging contactor")
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
Controls.SubtitleLabel {
text: qsTr("Change in value during SOC")
text: qsTr("SOC threshold, %")
maximumLineCount: 2
wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
Controls.SubtitleLabel {
text: qsTr("Delay, s")
maximumLineCount: 2
wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
Layout.columnSpan: 2
}
Controls.TextField {
id: changeValueSocField
id: brushUsageSocThresholdField
validator: IntValidator { bottom: 0; top: 100 }
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
Controls.TextField {
id: shuntChargingContactorDelayField
validator: IntValidator { bottom: 0; top: 65535 }
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
Layout.columnSpan: 2
}
Controls.LineSeparator {
@@ -457,6 +487,8 @@ RowLayout {
}
Controls.CheckBox {
id: coolingOutputCheckBox
text: qsTr("Cooling activation")
Layout.fillWidth: true
Layout.preferredHeight: outputSettingsFrame.outputNumberSize
}
@@ -478,13 +510,15 @@ RowLayout {
}
Controls.TextField {
id: closesBelowTemperatureThirdField
id: coolingStartThresholdField
validator: IntValidator { bottom: -32768; top: 32768 }
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
Controls.TextField {
id: opensGreaterTemperatureThirdField
id: coolingStopThresholdField
validator: IntValidator { bottom: -32768; top: 32768 }
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
@@ -504,6 +538,8 @@ RowLayout {
}
Controls.CheckBox {
id: heatingOutputCheckBox
text: qsTr("Heating activation")
Layout.fillWidth: true
Layout.preferredHeight: outputSettingsFrame.outputNumberSize
}
@@ -525,13 +561,15 @@ RowLayout {
}
Controls.TextField {
id: closesBelowTemperatureFourthField
id: heatingStartThresholdField
validator: IntValidator { bottom: -32768; top: 32768 }
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
Controls.TextField {
id: opensGreaterTemperatureFourthField
id: heatingStopThresholdField
validator: IntValidator { bottom: -32768; top: 32768 }
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
@@ -756,6 +794,21 @@ RowLayout {
BmsInterface.bmsConfig().setParamValue("cellBalanceUpdateInterval", parseInt(balancingCellIntervalField.text))
BmsInterface.bmsConfig().setParamValue("shuntLCFactor", parseFloat(zeroSensorValueField.text))
BmsInterface.bmsConfig().setParamValue("chargeBatteryOutputChecked", chargeBatteryOutputCheckBox.checked)
BmsInterface.bmsConfig().setParamValue("brushOrShuntOutputChecked", brushOrShuntOutputCheckBox.checked)
BmsInterface.bmsConfig().setParamValue("brushOrShuntMode", shuntChargingContactorRadioButton.checked)
BmsInterface.bmsConfig().setParamValue("brushUsageSocThreshold", parseInt(brushUsageSocThresholdField.text))
BmsInterface.bmsConfig().setParamValue("shuntChargingContactorDelay", parseInt(shuntChargingContactorDelayField.text))
BmsInterface.bmsConfig().setParamValue("coolingOutputChecked", coolingOutputCheckBox.checked)
BmsInterface.bmsConfig().setParamValue("coolingStartThreshold", parseInt(coolingStartThresholdField.text))
BmsInterface.bmsConfig().setParamValue("coolingStopThreshold", parseInt(coolingStopThresholdField.text))
BmsInterface.bmsConfig().setParamValue("heatingOutputChecked", heatingOutputCheckBox.checked)
BmsInterface.bmsConfig().setParamValue("heatingStartThreshold", parseInt(heatingStartThresholdField.text))
BmsInterface.bmsConfig().setParamValue("heatingStopThreshold", parseInt(heatingStopThresholdField.text))
}
Connections {
@@ -783,6 +836,22 @@ RowLayout {
balancingCellIntervalField.text = BmsInterface.bmsConfig().getParamInt("cellBalanceUpdateInterval")
zeroSensorValueField.text = MathHelper.roundDouble(BmsInterface.bmsConfig().getParamDouble("shuntLCFactor"))
chargeBatteryOutputCheckBox.checked = BmsInterface.bmsConfig().getParamBool("chargeBatteryOutputChecked")
brushOrShuntOutputCheckBox.checked = BmsInterface.bmsConfig().getParamBool("brushOrShuntOutputChecked")
brushControlRadioButton.checked = !BmsInterface.bmsConfig().getParamBool("brushOrShuntMode")
shuntChargingContactorRadioButton.checked = BmsInterface.bmsConfig().getParamBool("brushOrShuntMode")
brushUsageSocThresholdField.text = BmsInterface.bmsConfig().getParamInt("brushUsageSocThreshold")
shuntChargingContactorDelayField.text = BmsInterface.bmsConfig().getParamInt("shuntChargingContactorDelay")
coolingOutputCheckBox.checked = BmsInterface.bmsConfig().getParamBool("coolingOutputChecked")
coolingStartThresholdField.text = BmsInterface.bmsConfig().getParamInt("coolingStartThreshold")
coolingStopThresholdField.text = BmsInterface.bmsConfig().getParamInt("coolingStopThreshold")
heatingOutputCheckBox.checked = BmsInterface.bmsConfig().getParamBool("heatingOutputChecked")
heatingStartThresholdField.text = BmsInterface.bmsConfig().getParamInt("heatingStartThreshold")
heatingStopThresholdField.text = BmsInterface.bmsConfig().getParamInt("heatingStopThreshold")
}
}
}

View File

@@ -46,5 +46,6 @@
<file>Controls/ProgressBar.qml</file>
<file>Screens/NetworkSettingsScreen.qml</file>
<file>Screens/TimeSettingsScreen.qml</file>
<file>Controls/RadioButton.qml</file>
</qresource>
</RCC>