diff --git a/FileSets/DcSystemRow.qml b/FileSets/DcSystemRow.qml index 49a7e761..7381b7cc 100644 --- a/FileSets/DcSystemRow.qml +++ b/FileSets/DcSystemRow.qml @@ -21,6 +21,9 @@ Row { property bool showRpm: false property bool showVoltage: false property bool showCurrent: false + property string speedParam: "/Speed" + property string temperatureParam: "/Dc/0/Temperature" + Component.onCompleted: { @@ -43,6 +46,12 @@ Row { useMonitorMode = true positivePowerIsConsuming = true } + else if (serviceType == DBusService.DBUS_SERVICE_MOTOR_DRIVE) + { + positivePowerIsConsuming = true + speedParam = "/Motor/RPM" + temperatureParam = "/Motor/Temperature" + } } // uses the same sizes as DetailsDcSystem page @@ -58,8 +67,8 @@ Row { VBusItem { id: dbusVoltageItem; bind: Utils.path (serviceName, "/Dc/0/Voltage") } VBusItem { id: dbusCurrentItem; bind: Utils.path (serviceName, "/Dc/0/Current") } VBusItem { id: dbusTemperatureItem; bind: Utils.path (serviceName, "/Dc/0/Temperature") } - VBusItem { id: stateItem; bind: Utils.path (serviceName, "/State") } - VBusItem { id: rpmItem; bind: Utils.path (serviceName, "/Speed") } + VBusItem { id: stateItem; bind: Utils.path (serviceName, temperatureParam) } + VBusItem { id: rpmItem; bind: Utils.path (serviceName, speedParam) } // use system temperature scale if it exists (v2.90 onward) - otherwise use the GuiMods version property VBusItem systemScaleItem: VBusItem { bind: "com.victronenergy.settings/Settings/System/Units/Temperature" } diff --git a/FileSets/DetailMotorDrive.qml b/FileSets/DetailMotorDrive.qml new file mode 100644 index 00000000..ebad95da --- /dev/null +++ b/FileSets/DetailMotorDrive.qml @@ -0,0 +1,147 @@ +////// detail page for displaying Motor Drive details +////// pushed from Flow overview + +import QtQuick 1.1 +import "utils.js" as Utils +import com.victron.velib 1.0 +import "enhancedFormat.js" as EnhFmt + +MbPage +{ + id: root + + title: "Motor Drive detail" + + property variant sys: theSystem + property string systemPrefix: "com.victronenergy.system" + property color backgroundColor: "#b3b3b3" + + property int rowTitleWidth: 130 + property int tableColumnWidth: 100 + property int totalDataWidth: tableColumnWidth * 3 + + VBusItem { id: motorDrivePowerItem; bind: Utils.path(systemPrefix, "/Dc/MotorDrive/Power") } + + Component.onCompleted: discoverServices() + + // background + Rectangle + { + anchors + { + fill: parent + } + color: root.backgroundColor + } + + Row + { + spacing: 5 + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top; anchors.topMargin: + 10 + Column + { + spacing: 2 + Row + { + anchors.horizontalCenter: parent.horizontalCenter + Text { id: totalLabel; font.pixelSize: 12; font.bold: true; color: "black" + horizontalAlignment: Text.AlignRight + text: qsTr("Total Power") } + Text { font.pixelSize: 12; font.bold: true; color: "black" + width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter + text: EnhFmt.formatVBusItem (motorDrivePowerItem, " W") + } + PowerGauge + { + id: gauge + width: (root.width * 0.8) - totalLabel.paintedWidth - tableColumnWidth + height: 15 + connection: motorDrivePowerItem + maxForwardPowerParameter: "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/MaxMotorDriveLoad" + maxReversePowerParameter: "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/MaxMotorDriveCharge" + } + } + // vertical spacer + Row { Text { font.pixelSize: 12; width: rowTitleWidth; text: "" } } + Row + { + id: tableHeaderRow + anchors.horizontalCenter: parent.horizontalCenter + Text { font.pixelSize: 12; font.bold: true; color: "black" + width: rowTitleWidth; horizontalAlignment: Text.AlignHCenter + text: qsTr("Name") } + Text { font.pixelSize: 12; font.bold: true; color: "black" + width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter + text: qsTr("Power") } + Text { font.pixelSize: 12; font.bold: true; color: "black" + width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter + text: qsTr("Temperature") } + Text { font.pixelSize: 12; font.bold: true; color: "black" + width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter + text: qsTr("RPM") } + } + } + } + + // table of available alternators + ListView + { + id: theTable + + anchors + { + top: root.top; topMargin: 60 + horizontalCenter: root.horizontalCenter + } + width: tableHeaderRow.width + height: root.height - 60 + interactive: true + + model: dcModel + delegate: DcSystemRow + { + tableColumnWidth: root.tableColumnWidth + rowTitleWidth: root.rowTitleWidth + width: theTable.width + showTemperature: true + showRpm: true + Connections + { + target: scrollTimer + onTriggered: doScroll() + } + } + } + + ListModel { id: dcModel } + + // Synchronise name text scroll start + Timer + { + id: scrollTimer + interval: 5000 + repeat: true + running: root.active + } + + function addService(service) + { + switch (service.type) + { + case DBusService.DBUS_SERVICE_ALTERNATOR: + dcModel.append ( {serviceName: service.name, serviceType: service.type } ) + break;; + } + } + + // Detect available services of interest + function discoverServices() + { + dcModel.clear() + for (var i = 0; i < DBusServices.count; i++) + { + addService(DBusServices.at(i)) + } + } +} diff --git a/FileSets/PageSettingsGuiModsGauges.qml b/FileSets/PageSettingsGuiModsGauges.qml index 9b49df52..448da521 100644 --- a/FileSets/PageSettingsGuiModsGauges.qml +++ b/FileSets/PageSettingsGuiModsGauges.qml @@ -240,5 +240,31 @@ MbPage { show: showGauges.checked writeAccessLevel: User.AccessInstaller } + MbEditBox + { + description: qsTr ("Max Motor Drive load power") + maximumLength: 6 + item.bind: Utils.path (bindPrefixGuiMods, "/GaugeLimits/MaxMotorDriveLoad") + matchString: "0123456789" + numericOnlyLayout: true + overwriteMode: false + unit: "W" + enableSpaceBar: true + show: showGauges.checked + writeAccessLevel: User.AccessInstaller + } + MbEditBox + { + description: qsTr ("Max Motor Drive charge power") + maximumLength: 6 + item.bind: Utils.path (bindPrefixGuiMods, "/GaugeLimits/MaxMotorDriveCharge") + matchString: "0123456789" + numericOnlyLayout: true + overwriteMode: false + unit: "W" + enableSpaceBar: true + show: showGauges.checked + writeAccessLevel: User.AccessInstaller + } } } diff --git a/FileSets/v2.66/OverviewFlowComplex.qml b/FileSets/v2.66/OverviewFlowComplex.qml index e28386f2..4b875d04 100644 --- a/FileSets/v2.66/OverviewFlowComplex.qml +++ b/FileSets/v2.66/OverviewFlowComplex.qml @@ -56,6 +56,9 @@ OverviewPage { property bool hasAcCharger: sys.acCharger != undefined && sys.acCharger.power.valid property bool showAcCharger: (dcCoupled || !hasPvOnInput) && hasAcCharger + VBusItem { id: motorDrivePowerItem; bind: Utils.path(systemPrefix, "/Dc/MotorDrive/Power") } + property bool showMotorDrive: (dcCoupled || !hasLoadsOnInput) && ! showAlternator && motorDrivePowerItem.valid + property int bottomOffset: showTanksTemps ? 45 : 5 property int topOffset: showTanksTemps ? 1 : 5 property string settingsBindPreffix: "com.victronenergy.settings" @@ -104,6 +107,7 @@ OverviewPage { property double pvChargerFlow: showPvCharger ? noNoise (sys.pvCharger.power) : 0 property double dcSystemFlow: showDcSystem ? -noNoise (sys.dcSystem.power) : 0 property double alternatorFlow: showAlternator ? noNoise (sys.alternator.power) : 0 + property double motorDriveFlow: showMotorDrive ? noNoise (motorDrivePowerItem) : 0 property double inverterDcFlow: showInverter ? noNoise (sys.vebusDc.power) : 0 property double batteryFlow: noNoise (sys.battery.power) property double windGenFlow: noNoise (sys.windGenerator.power) @@ -610,6 +614,50 @@ OverviewPage { DetailTarget { id: alternatorTarget; detailsPage: "DetailAlternator.qml" } } + OverviewBox + { + id: motorDriveBox + title: qsTr ("Motor Drive") + color: "#157894" + titleColor: "#419FB9" + height: inOutTileHeight + width: inOutTileWidth + opacity: showMotorDrive ? 1 : disabledTileOpacity + visible: showMotorDrive + anchors + { + left: root.left; leftMargin: 5 + bottom: dcSystemBox.top; bottomMargin: 5 + } + values: TileText { + text: EnhFmt.formatVBusItem (motorDrivePowerItem) + font.pixelSize: 17 + visible: showMotorDrive + anchors + { + bottom: parent.bottom; bottomMargin: 0 + horizontalCenter: parent.horizontalCenter + } + } + PowerGauge + { + id: motorDriveGauge + width: parent.width + height: 10 + anchors + { + top: parent.top; topMargin: 20 + horizontalCenter: parent.horizontalCenter + } + connection: motorDrivePowerItem + maxForwardPowerParameter: "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/MaxMotorDriveLoad" + maxReversePowerParameter: "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/MaxMotorDriveCharge" + show: showGauges && showMotorDrive + showLabels: true + } + DetailTarget { id: motorDriveTarget; detailsPage: "DetailMotorDrive.qml" } + } + VBusItem { id: dcSystemNameItem; bind: Utils.path(settingsPrefix, "/Settings/GuiMods/CustomDcSystemName") } OverviewBox { @@ -994,8 +1042,8 @@ OverviewPage { id: dcBus1 ballCount: 1 path: straight - active: root.active && ((showAlternator || showDcSystem) || (dcCoupled && showInactiveFlow)) - value: -Utils.sign (alternatorFlow + dcSystemFlow) + active: root.active && ((showAlternator || showMotorDrive || showDcSystem) || (dcCoupled && showInactiveFlow)) + value: -Utils.sign (alternatorFlow + motorDriveFlow + dcSystemFlow) startPointVisible: false endPointVisible: false @@ -1010,8 +1058,8 @@ OverviewPage { id: dcBus2 ballCount: 1 path: straight - active: root.active && ((showAlternator || showAcCharger || showDcSystem) || (dcCoupled && showInactiveFlow)) - value: Utils.sign (alternatorFlow + dcSystemFlow + acChargerFlow) + active: root.active && ((showAlternator || showMotorDrive || showAcCharger || showDcSystem) || (dcCoupled && showInactiveFlow)) + value: Utils.sign (alternatorFlow + motorDriveFlow + dcSystemFlow + acChargerFlow) startPointVisible: false endPointVisible: false @@ -1126,8 +1174,8 @@ OverviewPage { id: alternatorConnection ballCount: 1 path: straight - active: root.active && (showAlternator || (dcCoupled && showInactiveFlow)) - value: Utils.sign (alternatorFlow) + active: root.active && (showAlternator || showMotorDrive || (dcCoupled && showInactiveFlow)) + value: Utils.sign (alternatorFlow + motorDriveFlow) startPointVisible: true endPointVisible: false anchors @@ -1418,7 +1466,7 @@ OverviewPage { property variant targetList: [ acInputTarget, pvOnInputTarget, acLoadsOnInputTarget, - acChargerTarget, alternatorTarget, dcSystemTarget, + acChargerTarget, alternatorTarget, motorDriveTarget, dcSystemTarget, multiTarget, batteryTarget, acLoadsOnOutputTarget, pvOnOutputTarget, fuelCellTarget, windGenTarget, pvChargerTarget ] diff --git a/FileSets/v2.73/OverviewFlowComplex.qml b/FileSets/v2.73/OverviewFlowComplex.qml index 4f8a9c8e..df2fbeea 100644 --- a/FileSets/v2.73/OverviewFlowComplex.qml +++ b/FileSets/v2.73/OverviewFlowComplex.qml @@ -56,6 +56,9 @@ OverviewPage { property bool hasAcCharger: sys.acCharger != undefined && sys.acCharger.power.valid property bool showAcCharger: (dcCoupled || !hasPvOnInput) && hasAcCharger + VBusItem { id: motorDrivePowerItem; bind: Utils.path(systemPrefix, "/Dc/MotorDrive/Power") } + property bool showMotorDrive: (dcCoupled || !hasLoadsOnInput) && ! showAlternator && motorDrivePowerItem.valid + property int bottomOffset: showTanksTemps ? 45 : 5 property int topOffset: showTanksTemps ? 1 : 5 property string settingsBindPreffix: "com.victronenergy.settings" @@ -104,6 +107,7 @@ OverviewPage { property double pvChargerFlow: showPvCharger ? noNoise (sys.pvCharger.power) : 0 property double dcSystemFlow: showDcSystem ? -noNoise (sys.dcSystem.power) : 0 property double alternatorFlow: showAlternator ? noNoise (sys.alternator.power) : 0 + property double motorDriveFlow: showMotorDrive ? noNoise (motorDrivePowerItem) : 0 property double inverterDcFlow: showInverter ? noNoise (sys.vebusDc.power) : 0 property double batteryFlow: noNoise (sys.battery.power) property double windGenFlow: noNoise (sys.windGenerator.power) @@ -610,6 +614,50 @@ OverviewPage { DetailTarget { id: alternatorTarget; detailsPage: "DetailAlternator.qml" } } + OverviewBox + { + id: motorDriveBox + title: qsTr ("Motor Drive") + color: "#157894" + titleColor: "#419FB9" + height: inOutTileHeight + width: inOutTileWidth + opacity: showMotorDrive ? 1 : disabledTileOpacity + visible: showMotorDrive + anchors + { + left: root.left; leftMargin: 5 + bottom: dcSystemBox.top; bottomMargin: 5 + } + values: TileText { + text: EnhFmt.formatVBusItem (motorDrivePowerItem) + font.pixelSize: 17 + visible: showMotorDrive + anchors + { + bottom: parent.bottom; bottomMargin: 0 + horizontalCenter: parent.horizontalCenter + } + } + PowerGauge + { + id: motorDriveGauge + width: parent.width + height: 10 + anchors + { + top: parent.top; topMargin: 20 + horizontalCenter: parent.horizontalCenter + } + connection: motorDrivePowerItem + maxForwardPowerParameter: "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/MaxMotorDriveLoad" + maxReversePowerParameter: "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/MaxMotorDriveCharge" + show: showGauges && showMotorDrive + showLabels: true + } + DetailTarget { id: motorDriveTarget; detailsPage: "DetailMotorDrive.qml" } + } + VBusItem { id: dcSystemNameItem; bind: Utils.path(settingsPrefix, "/Settings/GuiMods/CustomDcSystemName") } OverviewBox { @@ -994,8 +1042,8 @@ OverviewPage { id: dcBus1 ballCount: 1 path: straight - active: root.active && ((showAlternator || showDcSystem) || (dcCoupled && showInactiveFlow)) - value: -Utils.sign (alternatorFlow + dcSystemFlow) + active: root.active && ((showAlternator || showMotorDrive || showDcSystem) || (dcCoupled && showInactiveFlow)) + value: -Utils.sign (alternatorFlow + motorDriveFlow + dcSystemFlow) startPointVisible: false endPointVisible: false @@ -1010,8 +1058,8 @@ OverviewPage { id: dcBus2 ballCount: 1 path: straight - active: root.active && ((showAlternator || showAcCharger || showDcSystem) || (dcCoupled && showInactiveFlow)) - value: Utils.sign (alternatorFlow + dcSystemFlow + acChargerFlow) + active: root.active && ((showAlternator || showMotorDrive || showAcCharger || showDcSystem) || (dcCoupled && showInactiveFlow)) + value: Utils.sign (alternatorFlow + motorDriveFlow + dcSystemFlow + acChargerFlow) startPointVisible: false endPointVisible: false @@ -1126,8 +1174,8 @@ OverviewPage { id: alternatorConnection ballCount: 1 path: straight - active: root.active && (showAlternator || (dcCoupled && showInactiveFlow)) - value: Utils.sign (alternatorFlow) + active: root.active && (showAlternator || showMotorDrive || (dcCoupled && showInactiveFlow)) + value: Utils.sign (alternatorFlow + motorDriveFlow) startPointVisible: true endPointVisible: false anchors @@ -1415,7 +1463,7 @@ OverviewPage { property variant targetList: [ acInputTarget, pvOnInputTarget, acLoadsOnInputTarget, - acChargerTarget, alternatorTarget, dcSystemTarget, + acChargerTarget, alternatorTarget, motorDriveTarget, dcSystemTarget, multiTarget, batteryTarget, acLoadsOnOutputTarget, pvOnOutputTarget, fuelCellTarget, windGenTarget, pvChargerTarget ] diff --git a/FileSets/v2.89/dbus_systemcalc.py b/FileSets/v2.89/dbus_systemcalc.py index e9673016..845efb8b 100755 --- a/FileSets/v2.89/dbus_systemcalc.py +++ b/FileSets/v2.89/dbus_systemcalc.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 -u # -*- coding: utf-8 -*- -#### modified for GuiMods -- added Alternator, Wind generator (DC Meter subtype Wind Generator (-8)) +#### modified for GuiMods from dbus.mainloop.glib import DBusGMainLoop import dbus @@ -169,6 +169,10 @@ def __init__(self): 'com.victronenergy.dcsource': { '/Dc/0/Power': dummy, '/Settings/MonitorMode': dummy + }, + 'com.victronenergy.motordrive': + { + '/Dc/0/Power': dummy } } @@ -291,6 +295,8 @@ def __init__(self): #### added for GuiMods '/Dc/Alternator/Power': {'gettext': '%.0F W'}, '/Dc/WindGenerator/Power': {'gettext': '%.0F W'}, + '/Dc/MotorDrive/Power': {'gettext': '%.0F W'}, + '/Dc/Vebus/Current': {'gettext': '%.1F A'}, '/Dc/Vebus/Power': {'gettext': '%.0F W'}, @@ -323,6 +329,9 @@ def __init__(self): self._handleservicechange() self._updatevalues() +#### added for GuiMods + self.dcSystemPower = [0, 0, 0] + GLib.timeout_add(1000, exit_on_error, self._handletimertick) def _create_dbus_monitor(self, *args, **kwargs): @@ -596,6 +605,19 @@ def _updatevalues(self): else: newvalues['/Dc/Alternator/Power'] += p +#### added for GuiMods + # ==== MOTOR DRIVE ==== + motordrives = self._dbusmonitor.get_service_list('com.victronenergy.motordrive') + for motordrive in motordrives: + p = self._dbusmonitor.get_value(motordrive, '/Dc/0/Power') + if p is None: + p = 0 + + if '/Dc/MotorDrive/Power' not in newvalues: + newvalues['/Dc/MotorDrive/Power'] = p + else: + newvalues['/Dc/MotorDrive/Power'] += p + # ==== DC SOURCES ==== dcSources = self._dbusmonitor.get_service_list('com.victronenergy.dcsource') for dcSource in dcSources: @@ -773,6 +795,7 @@ def _updatevalues(self): fuelcell_power = newvalues.get('/Dc/FuelCell/Power', 0) alternator_power = newvalues.get('/Dc/Alternator/Power', 0) windgen_power = newvalues.get('/Dc/WindGenerator/Power', 0) + motordrive_power = newvalues.get('/Dc/MotorDrive/Power', 0) # If there are VE.Direct inverters, remove their power from the # DC estimate. This is done using the AC value when the DC @@ -788,7 +811,12 @@ def _updatevalues(self): i, '/Ac/Out/L1/V', 0) * self._dbusmonitor.get_value( i, '/Ac/Out/L1/I', 0) newvalues['/Dc/System/MeasurementType'] = 0 # estimated - newvalues['/Dc/System/Power'] = dc_pv_power + charger_power + fuelcell_power + vebuspower - inverter_power - battery_power + alternator_power + windgen_power +#### changed for GuiMods + # average DC system power over 3 passes (seconds) to minimize wild swings in displayed value + self.dcSystemPower[0] = self.dcSystemPower[1] + self.dcSystemPower[1] = self.dcSystemPower[2] + self.dcSystemPower[2] = dc_pv_power + charger_power + fuelcell_power + vebuspower - inverter_power - battery_power + alternator_power + windgen_power - motordrive_power + newvalues['/Dc/System/Power'] = (self.dcSystemPower[0] + self.dcSystemPower[1] + self.dcSystemPower[2]) / 3 elif self._settings['hasdcsystem'] == 1 and solarchargers_loadoutput_power is not None: newvalues['/Dc/System/MeasurementType'] = 0 # estimated diff --git a/FileSets/v2.90/dbus_systemcalc.py b/FileSets/v2.90/dbus_systemcalc.py index ba2e9d35..b227072d 100755 --- a/FileSets/v2.90/dbus_systemcalc.py +++ b/FileSets/v2.90/dbus_systemcalc.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 -u # -*- coding: utf-8 -*- -#### modified for GuiMods -- added Wind generator (DC Meter subtype Wind Generator (-8)) +#### modified for GuiMods from dbus.mainloop.glib import DBusGMainLoop import dbus @@ -186,6 +186,10 @@ def __init__(self): 'com.victronenergy.dcsource': { '/Dc/0/Power': dummy, '/Settings/MonitorMode': dummy + }, + 'com.victronenergy.motordrive': + { + '/Dc/0/Power': dummy } } @@ -332,6 +336,8 @@ def __init__(self): '/Dc/Alternator/Power': {'gettext': '%.0F W'}, #### added for GuiMods '/Dc/WindGenerator/Power': {'gettext': '%.0F W'}, + '/Dc/MotorDrive/Power': {'gettext': '%.0F W'}, + '/Dc/Vebus/Current': {'gettext': '%.1F A'}, '/Dc/Vebus/Power': {'gettext': '%.0F W'}, '/Dc/System/Power': {'gettext': '%.0F W'}, @@ -366,6 +372,9 @@ def __init__(self): self._handleservicechange() self._updatevalues() +#### added for GuiMods + self.dcSystemPower = [0, 0, 0] + GLib.timeout_add(1000, exit_on_error, self._handletimertick) def _create_dbus_monitor(self, *args, **kwargs): @@ -643,6 +652,19 @@ def _updatevalues(self): else: newvalues['/Dc/Alternator/Power'] += p +#### added for GuiMods + # ==== MOTOR DRIVE ==== + motordrives = self._dbusmonitor.get_service_list('com.victronenergy.motordrive') + for motordrive in motordrives: + p = self._dbusmonitor.get_value(motordrive, '/Dc/0/Power') + if p is None: + p = 0 + + if '/Dc/MotorDrive/Power' not in newvalues: + newvalues['/Dc/MotorDrive/Power'] = p + else: + newvalues['/Dc/MotorDrive/Power'] += p + #### added for GuiMods # ==== DC SOURCES ==== dcSources = self._dbusmonitor.get_service_list('com.victronenergy.dcsource') @@ -821,6 +843,7 @@ def _updatevalues(self): fuelcell_power = newvalues.get('/Dc/FuelCell/Power', 0) alternator_power = newvalues.get('/Dc/Alternator/Power', 0) windgen_power = newvalues.get('/Dc/WindGenerator/Power', 0) + motordrive_power = newvalues.get('/Dc/MotorDrive/Power', 0) # If there are VE.Direct inverters, remove their power from the # DC estimate. This is done using the AC value when the DC @@ -842,7 +865,11 @@ def _updatevalues(self): # version of Venus it does not break user's expectations. #newvalues['/Dc/System/Power'] = dc_pv_power + charger_power + fuelcell_power + vebuspower - inverter_power - battery_power - alternator_power #### changed for GuiMods - newvalues['/Dc/System/Power'] = dc_pv_power + charger_power + fuelcell_power + vebuspower - inverter_power - battery_power + alternator_power + windgen_power + # average DC system power over 3 passes (seconds) to minimize wild swings in displayed value + self.dcSystemPower[0] = self.dcSystemPower[1] + self.dcSystemPower[1] = self.dcSystemPower[2] + self.dcSystemPower[2] = dc_pv_power + charger_power + fuelcell_power + vebuspower - inverter_power - battery_power + alternator_power + windgen_power - motordrive_power + newvalues['/Dc/System/Power'] = (self.dcSystemPower[0] + self.dcSystemPower[1] + self.dcSystemPower[2]) / 3 elif self._settings['hasdcsystem'] == 1 and solarchargers_loadoutput_power is not None: newvalues['/Dc/System/MeasurementType'] = 0 # estimated diff --git a/FileSets/v3.00~4/dbus_systemcalc.py b/FileSets/v3.00~4/dbus_systemcalc.py index 1b78bf1d..44fe01e2 100755 --- a/FileSets/v3.00~4/dbus_systemcalc.py +++ b/FileSets/v3.00~4/dbus_systemcalc.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 -u # -*- coding: utf-8 -*- -#### modified for GuiMods -- added Wind generator (DC Meter subtype Wind Generator (-8)) +#### modified for GuiMods from dbus.mainloop.glib import DBusGMainLoop import dbus @@ -175,6 +175,10 @@ def __init__(self): 'com.victronenergy.dcsource': { '/Dc/0/Power': dummy, '/Settings/MonitorMode': dummy + }, + 'com.victronenergy.motordrive': + { + '/Dc/0/Power': dummy } } @@ -300,6 +304,8 @@ def __init__(self): '/Dc/Alternator/Power': {'gettext': '%.0F W'}, #### added for GuiMods '/Dc/WindGenerator/Power': {'gettext': '%.0F W'}, + '/Dc/MotorDrive/Power': {'gettext': '%.0F W'}, + '/Dc/Vebus/Current': {'gettext': '%.1F A'}, '/Dc/Vebus/Power': {'gettext': '%.0F W'}, '/Dc/System/Power': {'gettext': '%.0F W'}, @@ -333,6 +339,9 @@ def __init__(self): self._handleservicechange() self._updatevalues() + +#### added for GuiMods + self.dcSystemPower = [0, 0, 0] GLib.timeout_add(1000, exit_on_error, self._handletimertick) @@ -594,6 +603,19 @@ def _updatevalues(self): else: newvalues['/Dc/Alternator/Power'] += p +#### added for GuiMods + # ==== MOTOR DRIVE ==== + motordrives = self._dbusmonitor.get_service_list('com.victronenergy.motordrive') + for motordrive in motordrives: + p = self._dbusmonitor.get_value(motordrive, '/Dc/0/Power') + if p is None: + p = 0 + + if '/Dc/MotorDrive/Power' not in newvalues: + newvalues['/Dc/MotorDrive/Power'] = p + else: + newvalues['/Dc/MotorDrive/Power'] += p + #### added for GuiMods # ==== DC SOURCES ==== dcSources = self._dbusmonitor.get_service_list('com.victronenergy.dcsource') @@ -771,6 +793,7 @@ def _updatevalues(self): fuelcell_power = newvalues.get('/Dc/FuelCell/Power', 0) alternator_power = newvalues.get('/Dc/Alternator/Power', 0) windgen_power = newvalues.get('/Dc/WindGenerator/Power', 0) + motordrive_power = newvalues.get('/Dc/MotorDrive/Power', 0) # If there are VE.Direct inverters, remove their power from the # DC estimate. This is done using the AC value when the DC @@ -792,8 +815,12 @@ def _updatevalues(self): # version of Venus it does not break user's expectations. #newvalues['/Dc/System/Power'] = dc_pv_power + charger_power + fuelcell_power + vebuspower - inverter_power - battery_power - alternator_power #### changed for GuiMods - newvalues['/Dc/System/Power'] = dc_pv_power + charger_power + fuelcell_power + vebuspower - inverter_power - battery_power + alternator_power + windgen_power - + # average DC system power over 3 passes (seconds) to minimize wild swings in displayed value + self.dcSystemPower[0] = self.dcSystemPower[1] + self.dcSystemPower[1] = self.dcSystemPower[2] + self.dcSystemPower[2] = dc_pv_power + charger_power + fuelcell_power + vebuspower - inverter_power - battery_power + alternator_power + windgen_power - motordrive_power + newvalues['/Dc/System/Power'] = (self.dcSystemPower[0] + self.dcSystemPower[1] + self.dcSystemPower[2]) / 3 + elif self._settings['hasdcsystem'] == 1 and solarchargers_loadoutput_power is not None: newvalues['/Dc/System/MeasurementType'] = 0 # estimated newvalues['/Dc/System/Power'] = solarchargers_loadoutput_power diff --git a/ReadMe b/ReadMe index 80c6221b..d4c83b29 100644 --- a/ReadMe +++ b/ReadMe @@ -3,6 +3,7 @@ GuiMods has been revived with combined functionality of the original GuiMods and GuiMods2 has been decommissioned Recent changes: + added motor drive tile to DC Coupled overview added threshold to swithch to K units (previously this was fixed at 1000) separate simple, DC coupled and AC coupled flow overviews can now be selected Alternator, Wind Generator, Fuel Cell and AC Charger DC sources have been added @@ -388,6 +389,10 @@ Configuration Max Fuel Cell power is the maximum power expected from all fuel cells in the system + Max Motor Drive load power is the maximum power expected from all motor drives when they are consuming power + + Max Motor Drive charge power is the maximum power expected from all motor drives when they are generating power + Installation: GuiMods requires that SetupHelper is installed first. diff --git a/changes b/changes index 5f8043b2..fe9af7b7 100644 --- a/changes +++ b/changes @@ -1,3 +1,7 @@ +v7.0~1: + added motor drive + average calculated DC System power to minimize wild swings in displayed value + v6.19: added support for Venus OS v3.00~4 fixed: Inverter detail not showing inverter power (always 0) diff --git a/setup b/setup index bae077b4..4c47edf1 100755 --- a/setup +++ b/setup @@ -75,7 +75,7 @@ if [ $scriptAction == 'INSTALL' ] ; then # if one setting exists, assume they are all there # NOTE: if new settings are added in the future, change test for that one # to avoid creating that new parameter !!!! - dbus-send --system --print-reply=literal --dest=com.victronenergy.settings /Settings/Generator0/ServiceInterval\ + dbus-send --system --print-reply=literal --dest=com.victronenergy.settings /Settings/GuiMods/GaugeLimits/MaxMotorDriveLoad\ com.victronenergy.BusItem.GetValue &> /dev/null if (( $? != 0 )); then logMessage "creating GuiMods Settings" @@ -136,7 +136,9 @@ if [ $scriptAction == 'INSTALL' ] ; then {"path":"/GuiMods/KilowattThreshold", "default":1000, "min":1000, "max":10000}, \ {"path":"/GuiMods/TankBarFormat", "default":0, "min":0, "max":2}, \ {"path":"/FischerPanda0/ServiceInterval", "default":0, "min":-1, "max":5000000}, \ - {"path":"/Generator0/ServiceInterval", "default":0, "min":-1, "max":5000000} ]' > /dev/null + {"path":"/Generator0/ServiceInterval", "default":0, "min":-1, "max":5000000}, \ + {"path":"/GuiMods/GaugeLimits/MaxMotorDriveCharge", "default":0.0}, \ + {"path":"/GuiMods/GaugeLimits/MaxMotorDriveLoad", "default":0.0} ]' > /dev/null fi temp=$(dbus-send --system --print-reply=literal --dest=com.victronenergy.settings /Settings/GuiMods/ShowInactiveFlowTiles\ @@ -280,6 +282,7 @@ if [ $scriptAction == 'INSTALL' ] ; then updateActiveFile "$qmlDir/DcSystemRow.qml" updateActiveFile "$qmlDir/DetailDcSystem.qml" updateActiveFile "$qmlDir/DetailAlternator.qml" + updateActiveFile "$qmlDir/DetailMotorDrive.qml" updateActiveFile "$qmlDir/DetailAcCharger.qml" updateActiveFile "$qmlDir/DetailWindGen.qml" updateActiveFile "$qmlDir/timeToGo.js" @@ -287,10 +290,10 @@ if [ $scriptAction == 'INSTALL' ] ; then updateActiveFile "$qmlDir/TileDigIn.qml" updateActiveFile "$qmlDir/SystemStateShort.qml" updateActiveFile "/opt/victronenergy/dbus-systemcalc-py/dbus_systemcalc.py" - updateActiveFile "$qmlDir/enhancedFormat.js" if $thisFileUpdated; then restartSystemCalc=true fi + updateActiveFile "$qmlDir/enhancedFormat.js" updateActiveFile "$qmlDir/DetailTarget.qml" updateActiveFile "$qmlDir/DetailButton.qml" updateActiveFile "/opt/victronenergy/gui/qml/TileManualStartEnhanced.qml" @@ -361,14 +364,15 @@ if [ $scriptAction == 'UNINSTALL' ] ; then restoreActiveFile "$qmlDir/OverviewTanksTempsDigInputs.qml" restoreActiveFile "$qmlDir/TileDigIn.qml" restoreActiveFile "$qmlDir/DetailAlternator.qml" + restoreActiveFile "$qmlDir/DetailMotorDrive.qml" restoreActiveFile "$qmlDir/AlternatorRow.qml" restoreActiveFile "$qmlDir/DetailWindGen.qml" restoreActiveFile "$qmlDir/SystemStateShort.qml" restoreActiveFile "/opt/victronenergy/dbus-systemcalc-py/dbus_systemcalc.py" - restoreActiveFile "$qmlDir/enhancedFormat.js" if $thisFileUpdated ; then restartSystemCalc=true fi + restoreActiveFile "$qmlDir/enhancedFormat.js" restoreActiveFile "$qmlDir/DetailTarget.qml" restoreActiveFile "$qmlDir/DetailButton.qml" restoreActiveFile "/opt/victronenergy/gui/qml/TileManualStartEnhanced.qml" diff --git a/version b/version index 69f29b23..b8c13656 100644 --- a/version +++ b/version @@ -1 +1 @@ -v6.19 +7.0~1