Skip to content

Commit

Permalink
fixed PV inverter details and gauge
Browse files Browse the repository at this point in the history
  • Loading branch information
kwindrem committed May 9, 2024
1 parent 5ad7314 commit 82cb1da
Show file tree
Hide file tree
Showing 12 changed files with 174 additions and 115 deletions.
41 changes: 22 additions & 19 deletions FileSets/VersionIndependent/DetailPvInverter.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ MbPage
property string systemPrefix: "com.victronenergy.system"
property color backgroundColor: "#b3b3b3"

property int dataColumns: 4
property int gridPhaseCount: sys.pvOnGrid.phaseCount.valid ? sys.pvOnGrid.phaseCount.value : 0
property int outputPhaseCount: sys.pvOnAcOut.phaseCount.valid ? sys.pvOnAcOut.phaseCount.value : 0
property int phaseCount: Math.max (gridPhaseCount, outputPhaseCount, 1)
property int dataColumns: 2 + phaseCount
property int rowTitleWidth: 130
// gauge and "conneciton column use title width too"
property int totalDataWidth: root.width - (rowTitleWidth * 2) - 10
property int totalDataWidth: root.width - rowTitleWidth - 10
property int tableColumnWidth: totalDataWidth / dataColumns

Component.onCompleted: discoverServices()
Expand All @@ -38,7 +40,7 @@ MbPage
{
spacing: 5
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top; anchors.topMargin: + 10
anchors.top: parent.top; anchors.topMargin: 5
Column
{
spacing: 2
Expand All @@ -52,13 +54,13 @@ MbPage
text: qsTr("Total") }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: "L1" }
text: "L1"; visible: phaseCount > 1 }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: "L2" }
text: "L2"; visible: phaseCount >= 2 }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: "L3" }
text: "L3"; visible: phaseCount >= 3 }
}
Row
{
Expand All @@ -70,17 +72,17 @@ MbPage
text: EnhFmt.formatVBusItem (sys.pvOnGrid.power) }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: EnhFmt.formatVBusItem (sys.pvOnGrid.powerL1) }
text: EnhFmt.formatVBusItem (sys.pvOnGrid.powerL1); visible: phaseCount > 1 }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: EnhFmt.formatVBusItem (sys.pvOnGrid.powerL2) }
text: EnhFmt.formatVBusItem (sys.pvOnGrid.powerL2); visible: phaseCount >= 2}
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: EnhFmt.formatVBusItem (sys.pvOnGrid.powerL3) }
text: EnhFmt.formatVBusItem (sys.pvOnGrid.powerL3); visible: phaseCount >= 3}
PowerGauge
{
id: pvGridGauge
width: rowTitleWidth
width: tableColumnWidth
height: 15
connection: sys.pvOnGrid
maxForwardPowerParameter: "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/PvOnGridMaxPower"
Expand All @@ -97,13 +99,13 @@ MbPage
text: EnhFmt.formatVBusItem (sys.pvOnAcOut.power) }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: EnhFmt.formatVBusItem (sys.pvOnAcOut.powerL1) }
text: EnhFmt.formatVBusItem (sys.pvOnAcOut.powerL1); visible: phaseCount > 1 }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: EnhFmt.formatVBusItem (sys.pvOnAcOut.powerL2) }
text: EnhFmt.formatVBusItem (sys.pvOnAcOut.powerL2); visible: phaseCount >= 2 }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: EnhFmt.formatVBusItem (sys.pvOnAcOut.powerL3) }
text: EnhFmt.formatVBusItem (sys.pvOnAcOut.powerL3); visible: phaseCount >= 3 }
PowerGauge
{
id: pvAcOutGauge
Expand All @@ -120,7 +122,7 @@ MbPage
width: rowTitleWidth; horizontalAlignment: Text.AlignHCenter
text: qsTr(" ") }
}
Row
Row
{
id: tableHeaderRow
Text { font.pixelSize: 12; font.bold: true; color: "black"
Expand All @@ -131,15 +133,15 @@ MbPage
text: qsTr("Total") }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: "L1" }
text: "L1"; visible: phaseCount > 1 }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: "L2" }
text: "L2"; visible: phaseCount >= 2 }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: "L3" }
text: "L3"; visible: phaseCount >= 3 }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: rowTitleWidth; horizontalAlignment: Text.AlignHCenter
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: qsTr("Connection") }
}
}
Expand All @@ -164,6 +166,7 @@ MbPage
{
tableColumnWidth: root.tableColumnWidth
rowTitleWidth: root.rowTitleWidth
phaseCount: root.phaseCount
width: pvInverterTable.width
Connections
{
Expand Down
9 changes: 5 additions & 4 deletions FileSets/VersionIndependent/PvInverterRow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Row {
// uses the same sizes as DetailsPvCharger page
property int tableColumnWidth: 0
property int rowTitleWidth: 0
property int phaseCount: 0

VBusItem { id: customNameItem; bind: Utils.path(serviceName, "/CustomName") }
VBusItem { id: pvTotalPower; bind: Utils.path(serviceName, "/Ac/Power") }
Expand Down Expand Up @@ -43,15 +44,15 @@ Row {
text: EnhFmt.formatVBusItem (pvTotalPower, "W") }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: EnhFmt.formatVBusItem (pvPowerL1, "W") }
text: EnhFmt.formatVBusItem (pvPowerL1, "W"); visible: phaseCount > 1 }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: EnhFmt.formatVBusItem (pvPowerL2, "W") }
text: EnhFmt.formatVBusItem (pvPowerL2, "W"); visible: phaseCount >= 2 }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: EnhFmt.formatVBusItem (pvPowerL3, "W") }
text: EnhFmt.formatVBusItem (pvPowerL3, "W"); visible: phaseCount >= 3 }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: rowTitleWidth; horizontalAlignment: Text.AlignHCenter
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text:
{
if (position.valid)
Expand Down
14 changes: 5 additions & 9 deletions FileSets/v2.73/OverviewHubEnhanced.qml
Original file line number Diff line number Diff line change
Expand Up @@ -905,15 +905,11 @@ OverviewPage {
top: parent.top; topMargin: 19
horizontalCenter: parent.horizontalCenter
}
maxForwardPowerParameter:
{
if (hasAcSolarOnOut)
return "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/PvOnOutputMaxPower"
else
return "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/PvOnGridMaxPower"
}
connection: hasAcSolarOnOut ? sys.pvOnAcOut : hasAcSolarOnAcIn1 ? sys.pvOnAcIn1 : sys.pvOnAcIn2
visible: showGauges && showAcSolar && !showDcAndAcSolar
maxForwardPowerParameter: "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/PvOnOutputMaxPower"
maxForwardPowerParameter2: "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/PvOnGridMaxPower"
connection: sys.pvOnAcOut
connection2: sys.pvOnGrid
visible: showGauges && showAcSolar
}
DetailTarget { id: pvInverterTarget; detailsPage: "DetailPvInverter.qml" }
}
Expand Down
47 changes: 32 additions & 15 deletions FileSets/v2.73/PowerGauge.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,34 @@ Item {
property bool darkMode: darkModeItem.valid && darkModeItem.value == 1

property variant connection
// connection2 accommodates combined PV inverter AC input and AC output
property variant connection2: undefined
property bool includeConnection2: connection2 != undefined


property bool reversePower: false
property bool useInputCurrentLimit: false
property variant endLabelFontSize: 16
property color endLabelBackgroundColor: "transparent"

property int phaseCount: root.connection == undefined ? 0 : root.connection.l1AndL2OutShorted ? 1 : connection.phaseCount != undefined && connection.phaseCount.valid ? connection.phaseCount.value : 1
property int phaseCount1: root.connection == undefined ? 0 : root.connection.l1AndL2OutShorted ? 1 : connection.phaseCount != undefined && connection.phaseCount.valid ? connection.phaseCount.value : 1
property int phaseCount2: root.connection2 == undefined ? 0 : root.connection2.l1AndL2OutShorted ? 1 : connection2.phaseCount != undefined && connection2.phaseCount.valid ? connection2.phaseCount.value : 1

property int phaseCount: includeConnection2 ? Math.max (phaseCount1, phaseCount2) : phaseCount1


property string maxForwardPowerParameter: ""
VBusItem { id: maxForwardLimitItem; bind: root.maxForwardPowerParameter }
property string maxForwardPowerParameter: ""
VBusItem { id: maxForwardLimitItem; bind: root.maxForwardPowerParameter }
property string maxForwardPowerParameter2: ""
VBusItem { id: maxForwardLimitItem2; bind: root.maxForwardPowerParameter2 }

property string maxReversePowerParameter: ""
VBusItem { id: maxReverseLimitItem; bind: root.maxReversePowerParameter }
property string maxReversePowerParameter: ""
VBusItem { id: maxReverseLimitItem; bind: root.maxReversePowerParameter }

property real inPowerLimit: sys.acInput.inCurrentLimit.valid ? sys.acInput.inCurrentLimit.value * sys.acInput.voltageL1.value : 0
property real inPowerLimit: sys.acInput.inCurrentLimit.valid ? sys.acInput.inCurrentLimit.value * sys.acInput.voltageL1.value : 0

property real maxForwardLimit: useInputCurrentLimit ? inPowerLimit : maxForwardLimitItem.valid ? maxForwardLimitItem.value : 0
property real maxReverseLimit: maxReverseLimitItem.valid ? maxReverseLimitItem.value : 0
property real maxForwardLimit: useInputCurrentLimit ? inPowerLimit : maxForwardLimitItem.valid ? maxForwardLimitItem.value : 0 + maxForwardLimitItem2.valid ? maxForwardLimitItem2.value : 0
property real maxReverseLimit: maxReverseLimitItem.valid ? maxReverseLimitItem.value : 0
// overload range is 10% of forward to reverse limits
property real overload: (maxForwardLimit + maxReverseLimit) * 0.1
property real maxForwardDisplayed: maxForwardLimit > 0 ? maxForwardLimit + overload : 0
Expand Down Expand Up @@ -216,13 +225,15 @@ Item {

function calculateBar1width ()
{
var currentValue, barWidth
var currentValue = 0.0, barWidth
if (root.connection.powerL1 != undefined)
currentValue = root.connection.powerL1.valid ? root.connection.powerL1.value : 0
currentValue += root.connection.powerL1.valid ? root.connection.powerL1.value : 0
else if (root.connection.power != undefined)
currentValue = root.connection.power.valid ? root.connection.power.value : 0
else
currentValue = 0
currentValue += root.connection.power.valid ? root.connection.power.value : 0
if (includeConnection2 && root.connection2.powerL1 != undefined)
currentValue += root.connection2.powerL1.valid ? root.connection2.powerL1.value : 0
else if (includeConnection2 && root.connection2.power != undefined)
currentValue += root.connection2.power.valid ? root.connection2.power.value : 0

if (reversePower)
currentValue = -currentValue
Expand All @@ -246,7 +257,10 @@ Item {
{
var currentValue, barWidth
currentValue = root.connection.powerL2.valid ? root.connection.powerL2.value : 0
if (reversePower)
if (includeConnection2)
currentValue += root.connection2.powerL2.valid ? root.connection2.powerL2.value : 0

if (reversePower)
currentValue = -currentValue
root.bar2color = getBarColor (currentValue)
barWidth = Math.min ( Math.max (currentValue, -maxReverseDisplayed), maxForwardDisplayed) * scaleFactor
Expand All @@ -267,7 +281,10 @@ Item {
{
var currentValue, barWidth
currentValue = root.connection.powerL3.valid ? root.connection.powerL3.value : 0
if (reversePower)
if (includeConnection2)
currentValue += root.connection2.powerL3.valid ? root.connection2.powerL3.value : 0

if (reversePower)
currentValue = -currentValue
root.bar3color = getBarColor (currentValue)
barWidth = Math.min ( Math.max (currentValue, -maxReverseDisplayed), maxForwardDisplayed) * scaleFactor
Expand Down
14 changes: 5 additions & 9 deletions FileSets/v3.01/OverviewHubEnhanced.qml
Original file line number Diff line number Diff line change
Expand Up @@ -966,15 +966,11 @@ OverviewPage {
top: parent.top; topMargin: 19
horizontalCenter: parent.horizontalCenter
}
maxForwardPowerParameter:
{
if (hasAcSolarOnOut)
return "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/PvOnOutputMaxPower"
else
return "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/PvOnGridMaxPower"
}
connection: hasAcSolarOnOut ? sys.pvOnAcOut : hasAcSolarOnAcIn1 ? sys.pvOnAcIn1 : sys.pvOnAcIn2
visible: showGauges && showAcSolar && !showDcAndAcSolar
maxForwardPowerParameter: "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/PvOnOutputMaxPower"
maxForwardPowerParameter2: "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/PvOnGridMaxPower"
connection: sys.pvOnAcOut
connection2: sys.pvOnGrid
visible: showGauges && showAcSolar
}
DetailTarget { id: pvInverterTarget; detailsPage: "DetailPvInverter.qml" }
}
Expand Down
35 changes: 25 additions & 10 deletions FileSets/v3.01/PowerGauge.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,31 @@ Item {
property bool darkMode: darkModeItem.valid && darkModeItem.value == 1

property variant connection
// connection2 accommodates combined PV inverter AC input and AC output
property variant connection2: undefined
property bool includeConnection2: connection2 != undefined

property bool reversePower: false
property bool useInputCurrentLimit: false
property variant endLabelFontSize: 16
property color endLabelBackgroundColor: "transparent"

property int phaseCount: root.connection == undefined ? 0 : root.connection.l1AndL2OutShorted ? 1 : connection.phaseCount != undefined && connection.phaseCount.valid ? connection.phaseCount.value : 1
property int phaseCount1: root.connection == undefined ? 0 : root.connection.l1AndL2OutShorted ? 1 : connection.phaseCount != undefined && connection.phaseCount.valid ? connection.phaseCount.value : 1
property int phaseCount2: root.connection2 == undefined ? 0 : root.connection2.l1AndL2OutShorted ? 1 : connection2.phaseCount != undefined && connection2.phaseCount.valid ? connection2.phaseCount.value : 1
property int phaseCount: includeConnection2 ? Math.max (phaseCount1, phaseCount2) : phaseCount1


property string maxForwardPowerParameter: ""
VBusItem { id: maxForwardLimitItem; bind: root.maxForwardPowerParameter }
property string maxForwardPowerParameter: ""
VBusItem { id: maxForwardLimitItem; bind: root.maxForwardPowerParameter }
property string maxForwardPowerParameter2: ""
VBusItem { id: maxForwardLimitItem2; bind: root.maxForwardPowerParameter2 }

property string maxReversePowerParameter: ""
VBusItem { id: maxReverseLimitItem; bind: root.maxReversePowerParameter }

property real inPowerLimit: sys.acInput.inCurrentLimit.valid ? sys.acInput.inCurrentLimit.value * sys.acInput.voltageL1.value : 0

property real maxForwardLimit: useInputCurrentLimit ? inPowerLimit : maxForwardLimitItem.valid ? maxForwardLimitItem.value : 0
property real maxForwardLimit: useInputCurrentLimit ? inPowerLimit : maxForwardLimitItem.valid ? maxForwardLimitItem.value : 0 + maxForwardLimitItem2.valid ? maxForwardLimitItem2.value : 0
property real maxReverseLimit: maxReverseLimitItem.valid ? maxReverseLimitItem.value : 0
// overload range is 10% of forward to reverse limits
property real overload: (maxForwardLimit + maxReverseLimit) * 0.1
Expand Down Expand Up @@ -218,11 +225,13 @@ Item {
{
var currentValue, barWidth
if (root.connection.powerL1 != undefined)
currentValue = root.connection.powerL1.valid ? root.connection.powerL1.value : 0
currentValue += root.connection.powerL1.valid ? root.connection.powerL1.value : 0
else if (root.connection.power != undefined)
currentValue = root.connection.power.valid ? root.connection.power.value : 0
else
currentValue = 0
currentValue += root.connection.power.valid ? root.connection.power.value : 0
if (includeConnection2 && root.connection2.powerL1 != undefined)
currentValue += root.connection2.powerL1.valid ? root.connection2.powerL1.value : 0
else if (includeConnection2 && root.connection2.power != undefined)
currentValue += root.connection2.power.valid ? root.connection2.power.value : 0

if (reversePower)
currentValue = -currentValue
Expand All @@ -246,7 +255,10 @@ Item {
{
var currentValue, barWidth
currentValue = root.connection.powerL2.valid ? root.connection.powerL2.value : 0
if (reversePower)
if (includeConnection2)
currentValue += root.connection2.powerL2.valid ? root.connection2.powerL2.value : 0

if (reversePower)
currentValue = -currentValue
root.bar2color = getBarColor (currentValue)
barWidth = Math.min ( Math.max (currentValue, -maxReverseDisplayed), maxForwardDisplayed) * scaleFactor
Expand All @@ -267,7 +279,10 @@ Item {
{
var currentValue, barWidth
currentValue = root.connection.powerL3.valid ? root.connection.powerL3.value : 0
if (reversePower)
if (includeConnection2)
currentValue += root.connection2.powerL3.valid ? root.connection2.powerL3.value : 0

if (reversePower)
currentValue = -currentValue
root.bar3color = getBarColor (currentValue)
barWidth = Math.min ( Math.max (currentValue, -maxReverseDisplayed), maxForwardDisplayed) * scaleFactor
Expand Down
15 changes: 5 additions & 10 deletions FileSets/v3.40~13/OverviewHubEnhanced.qml
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,6 @@ OverviewPage {
}
]
////// add power bar graph
////// only shows one of possibly 3 PV inverter locations !!!!!!!!!!!!!!!!!!!!!
PowerGauge
{
id: pvInverterBar
Expand All @@ -964,15 +963,11 @@ OverviewPage {
top: parent.top; topMargin: 19
horizontalCenter: parent.horizontalCenter
}
maxForwardPowerParameter:
{
if (hasAcSolarOnOut)
return "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/PvOnOutputMaxPower"
else
return "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/PvOnGridMaxPower"
}
connection: hasAcSolarOnOut ? sys.pvOnAcOut : hasAcSolarOnAcIn1 ? sys.pvOnAcIn1 : sys.pvOnAcIn2
visible: showGauges && showAcSolar && !showDcAndAcSolar
maxForwardPowerParameter: "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/PvOnOutputMaxPower"
maxForwardPowerParameter2: "com.victronenergy.settings/Settings/GuiMods/GaugeLimits/PvOnGridMaxPower"
connection: sys.pvOnAcOut
connection2: sys.pvOnGrid
visible: showGauges && showAcSolar
}
DetailTarget { id: pvInverterTarget; detailsPage: "DetailPvInverter.qml" }
}
Expand Down
Loading

0 comments on commit 82cb1da

Please sign in to comment.