From 92c3e42039833b22faa5a4e2e113c4147884b92e Mon Sep 17 00:00:00 2001 From: Yury Shuvakin Date: Sat, 26 Nov 2022 09:28:53 +0300 Subject: [PATCH] Implemented functionality to control outputs for BMS --- qml/Controls/RadioButton.qml | 42 +++++++++ qml/Controls/qmldir | 1 + qml/Screens/BmsSettingsScreen.qml | 89 ++++++++++++++++-- qml/qml_items.qrc | 1 + res/config.xml | 147 ++++++++++++++++++++++++++++++ translations/cubo_en.ts | 115 ++++++++++++++--------- translations/cubo_it.ts | 115 ++++++++++++++--------- translations/cubo_ru.qm | Bin 23145 -> 23591 bytes translations/cubo_ru.ts | 109 ++++++++++++++-------- 9 files changed, 483 insertions(+), 136 deletions(-) create mode 100644 qml/Controls/RadioButton.qml diff --git a/qml/Controls/RadioButton.qml b/qml/Controls/RadioButton.qml new file mode 100644 index 0000000..fcc20e1 --- /dev/null +++ b/qml/Controls/RadioButton.qml @@ -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 + } +} diff --git a/qml/Controls/qmldir b/qml/Controls/qmldir index aa01916..7d617f7 100644 --- a/qml/Controls/qmldir +++ b/qml/Controls/qmldir @@ -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 diff --git a/qml/Screens/BmsSettingsScreen.qml b/qml/Screens/BmsSettingsScreen.qml index 96454d9..98fb45a 100644 --- a/qml/Screens/BmsSettingsScreen.qml +++ b/qml/Screens/BmsSettingsScreen.qml @@ -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") } } } diff --git a/qml/qml_items.qrc b/qml/qml_items.qrc index 18f98ef..69e18f8 100644 --- a/qml/qml_items.qrc +++ b/qml/qml_items.qrc @@ -46,5 +46,6 @@ Controls/ProgressBar.qml Screens/NetworkSettingsScreen.qml Screens/TimeSettingsScreen.qml + Controls/RadioButton.qml diff --git a/res/config.xml b/res/config.xml index 03d8c5d..64ec9e8 100644 --- a/res/config.xml +++ b/res/config.xml @@ -2486,6 +2486,142 @@ p, li { white-space: pre-wrap; } ms 5 + + Charge Battery Output Checked + 5 + 1 + Charge Battery Output Checked Description + CHARGE_BATTERY_OUTPUT_CHECKED + 0 + + + Brush Or Shunt Output Checked + 5 + 1 + Brush Or Shunt Output Checked Description + BRUSH_OR_SHUNT_OUTPUT_CHECKED + 0 + + + Brush Or Shunt Mode + 5 + 1 + Brush Or Shunt Mode Description + BRUSH_OR_SHUNT_MODE + 1 + + + Brush Usage Soc Threshold + 2 + 1 + Brush Usage Soc Threshold Description + BRUSH_USAGE_SOC_THRESHOLD + 1 + 0 + 100 + 0 + 0 + 1 + 10 + °C + 3 + + + Shunt Charging Contactor Delay + 2 + 1 + Shunt Charging Contactor Delay Description + SHUNT_CHARGING_CONTRACTOR_DELAY + 1 + 0 + 65535 + 0 + 0 + 1 + 10 + Sec + 3 + + + Cooling Output Checked + 5 + 1 + Cooling Output Checked Description + COOLING_OUTPUT_CHECKED + 0 + + + Cooling Start Threshold + 2 + 1 + Cooling Start Threshold Description + COOLING_START_THRESHOLD + 1 + 0 + 32767 + -32768 + 0 + 1 + 50 + °C + 4 + + + Cooling Stop Threshold + 2 + 1 + Cooling Stop Threshold Description + COOLING_STOP_THRESHOLD + 1 + 0 + 32767 + -32768 + 0 + 1 + 40 + °C + 4 + + + Heating Output Checked + 5 + 1 + Heating Output Checked Description + HEATING_OUTPUT_CHECKED + 0 + + + Heating Start Threshold + 2 + 1 + Heating Start Threshold Description + HEATING_START_THRESHOLD + 1 + 0 + 32767 + -32768 + 0 + 1 + 0 + °C + 4 + + + Heating Stop Threshold + 2 + 1 + Heating Stop Threshold Description + HEATING_STOP_THRESHOLD + 1 + 0 + 32767 + -32768 + 0 + 1 + 20 + °C + 4 + noOfCellsSeries @@ -2582,5 +2718,16 @@ p, li { white-space: pre-wrap; } chargeEnableState powerDownDelay humidityICType + chargeBatteryOutputChecked + brushOrShuntOutputChecked + brushOrShuntMode + brushUsageSocThreshold + shuntChargingContactorDelay + coolingOutputChecked + coolingStartThreshold + coolingStopThreshold + heatingOutputChecked + heatingStartThreshold + heatingStopThreshold diff --git a/translations/cubo_en.ts b/translations/cubo_en.ts index 40de71b..34a5ac1 100644 --- a/translations/cubo_en.ts +++ b/translations/cubo_en.ts @@ -233,13 +233,13 @@ BmsSettingsScreen - + Serial number - + Configuration @@ -255,7 +255,7 @@ - + SOC @@ -271,7 +271,7 @@ - + Limits @@ -292,7 +292,7 @@ - + Cell configuration @@ -318,7 +318,7 @@ - + Balancing configuration @@ -339,7 +339,7 @@ - + Output settings @@ -349,114 +349,139 @@ - - Use for storage management - - - - + # 2 + + + Active + + + + + Brush control + + + + + Shunt charging contactor + + + + + SOC threshold, % + + + Delay, s + + + + # 3 - + + Cooling activation + + + + # 4 - + + Heating activation + + + + BMS configuration saved to file - + Read default settings - + The settings are written to non-volatile memory. Wait, please. - - Normally closed - - - - - Change in value during SOC - - - - - + + Closes at t<, °C - - + + Use to control charger + + + + + Opens at t>, °C - - + + Current sensor value "0" - + Calibrate "0" - + Load settings from file - - + + Select configuration file - - + + Configuration files (*.xml) - - + + All files (*) - + Save settings to file - + Read current settings from BMS - + Write to non-volatile memory of BMS - + Write current values to BMS diff --git a/translations/cubo_it.ts b/translations/cubo_it.ts index 384f204..3848412 100644 --- a/translations/cubo_it.ts +++ b/translations/cubo_it.ts @@ -233,13 +233,13 @@ BmsSettingsScreen - + Serial number - + Configuration @@ -255,7 +255,7 @@ - + SOC @@ -271,7 +271,7 @@ - + Limits @@ -292,7 +292,7 @@ - + Cell configuration @@ -318,7 +318,7 @@ - + Balancing configuration @@ -339,7 +339,7 @@ - + Output settings @@ -349,114 +349,139 @@ - - Use for storage management - - - - + # 2 + + + Active + + + + + Brush control + + + + + Shunt charging contactor + + + + + SOC threshold, % + + + Delay, s + + + + # 3 - + + Cooling activation + + + + # 4 - + + Heating activation + + + + BMS configuration saved to file - + Read default settings - + The settings are written to non-volatile memory. Wait, please. - - Normally closed - - - - - Change in value during SOC - - - - - + + Closes at t<, °C - - + + Use to control charger + + + + + Opens at t>, °C - - + + Current sensor value "0" - + Calibrate "0" - + Load settings from file - - + + Select configuration file - - + + Configuration files (*.xml) - - + + All files (*) - + Save settings to file - + Read current settings from BMS - + Write to non-volatile memory of BMS - + Write current values to BMS diff --git a/translations/cubo_ru.qm b/translations/cubo_ru.qm index 6ad37d3959a4d21a8553eab2891eca997e4cf27c..e604c23553ebc1254ca4671c8db29e3dcf5ccb9a 100644 GIT binary patch delta 2132 zcmZ`(c~F$+9e%$3-f!9cc9->v7$mqLSLMiZ%DFCQK!^wn368`J!Hv*zv|I)aU8AK+ zjTscu#z-8KC>nF9g{Vo4842JqA+||v>kKA}(6s8L9;q=UQ~NC2(#~}H2lMR9`#YZB z^LyU!Fa6T~<5K6GqAdUx0uR4VOa}@^h>ro**&Zw*pb;p25D>e8yh-9Xu+$GwQhHxA10}f(N1yB|X{9q3-lF4dW5C``0z767r70BEJad!a7 zE{EcmL_AH*CjK2tPZsY#hw{enfRt7!hvR|VLr~5#KD`IZKcV+>uBwzXJ20A7q zRK7aKU8eL3&5MJ;;@x8Y+&ZAxF8p*NL z#nu~)%gPcxQ42}%hoWbF91ycgoK(F@@E77_1oIq{Vzu|t%*zye`969eXSq!0S*!f{T}l}KnO16MdZ2F zBu@KDnmZ2K(d7@YL8o>i>NTKnSbL-5A6%io2h&uqh?>=0Rl8Tl*S++Bw99M%NHL&2 z=LZe1S~Ea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y92F%(`oIyN|YHwaWz>L}#6d=ol zhC?Sw^bR(DB~pqE4^H{ngR$+{*q2ua%xpkUmq0=^CBQdLIAQCcmN$h<^|?T7fzUtGMPH5ygH|fwSSXI!|0M8$ zA_mDL0OPY_$fvBYZxds0u%5AB%sAR)5e;=d;!9_a)5r*M?~$!cxGkP4wg6s-#M5=W zxp$NJ!&WCS?T$EbF%XzoC0?m61m=vARNu3_K#vqLkybgvq_`m(oBp))sEJmlWJ(J{ zZc=I=>8WQWTDm~0-5bFkdR%JEx`wol(>LOo~F0W#D#IKhwUrGj|N66x)E?S|L zC){5GWbc)Iv}CUSBKr?9A-YJOzaf)eo{$%(^CnrP_y~enN19EfdBp~Bk zxw$5sik^^=vc1osv$eRQAo=K+jv13l$9{vO@Xk14v+*ty_0>fC>9`o7+h!vs>4KZ+U?KfF7(WwwsQY#xj} zt(R6((VVIJEXRwy*f#xZT~~mxo%%P{v;(%s^;#TE|+ zhU#zBa&2ibjO_jr80$2Q5xMr=Zg_Of00(iKp2@#{&P|Lw-lhWUqEOyaond`DAExkn{FINzHdOYdZ}Mw!+Y_cH%Kbi8SD zUpYsKjfUoPB-5l)8ZWx*11<>WaCw{@ zDLZ7l96S6qW!uNwX36pLOjzJV7813?U8>>dowy{wWU@F zW+gU_44B|92=Wt}`X`sVZ%@gQ9RBhHavbY8WUCw_XRvx4EIi4|ooKES<%It$n=_Y} z7UvfgRa***mY2B-@0Cjp36b2#tv113HKS3S;GI|IvMgF&YAGvUUYbuD#rY+KVpmD| Lz3?#mt-yZ)on71L diff --git a/translations/cubo_ru.ts b/translations/cubo_ru.ts index 9014c28..0dde5cd 100644 --- a/translations/cubo_ru.ts +++ b/translations/cubo_ru.ts @@ -245,13 +245,13 @@ BmsSettingsScreen - + Serial number Серийный номер - + Configuration Конфигурация @@ -267,7 +267,7 @@ - + SOC SOC @@ -283,7 +283,7 @@ - + Limits Ограничения @@ -304,7 +304,7 @@ - + Cell configuration Конфигурация ячеек @@ -330,7 +330,7 @@ - + Balancing configuration Конфигурация балансировки @@ -351,7 +351,7 @@ - + Output settings Настройка выходов @@ -361,100 +361,137 @@ № 1 - - Use for storage management + + Use to control charger Использовать для управления ЗУ - + Use for storage management + Использовать для управления ЗУ + + + # 2 № 2 + + + Active + Активный + + + + Brush control + Управление щетками + + + + Shunt charging contactor + Шунтирование зарядного контактора + + + + SOC threshold, % + Уровень SOC, % + + Delay, s + Задержка, с + + + # 3 № 3 - + + Cooling activation + Активация охлаждения + + + # 4 № 4 - + + Heating activation + Активация обогрева + + + BMS configuration saved to file БМС конфигурация сохранена в файл - + Read default settings Загрузить настройки по-умолчанию - + The settings are written to non-volatile memory. Wait, please. Выполняется запись настроек в энергонезависимую память. Пожалуйста подождите. - Normally closed - Нормально замкнут + Нормально замкнут - Change in value during SOC - Изменение значения при SOC + Изменение значения при SOC - - + + Closes at t<, °C Замыкается при t<, °C - - + + Opens at t>, °C Размыкается при t>, °C - - + + Current sensor value "0" Значение датчика тока «0» - + Calibrate "0" Калибровать «0» - + Load settings from file Загрузить настройки из файла - - + + Select configuration file Выберите файл конфигурации - - + + Configuration files (*.xml) Файлы конфигурации (*.xml) - - + + All files (*) Все файлы (*) - + Save settings to file Сохранить настройки в файл @@ -463,17 +500,17 @@ Wait, please. Загрузить настройки из файла - + Read current settings from BMS Загрузить текущие настройки из BMS - + Write to non-volatile memory of BMS Записать в энергонезависимую память BMS - + Write current values to BMS Записать текущие значения в BMS