-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathPvChargerRow.qml
More file actions
78 lines (68 loc) · 2.9 KB
/
PvChargerRow.qml
File metadata and controls
78 lines (68 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Display individual PV charger / inverter devices in Details page
// tracker is passed from DetailPvCharger.qml
// -1 indicates a single tracker MPPT
// 0 indicates the overview for a multiple tracker MPPT
// this will display the MPPT name, total PV yield and charging mode
// 1 - n indicates specific tracker informaiton
// this will display tracker power, voltage and current only
import QtQuick 1.1
import "utils.js" as Utils
import "enhancedFormat.js" as EnhFmt
Row {
id: root
// uses the same sizes as DetailsPvCharger page
property int tableColumnWidth: 0
property int rowTitleWidth: 0
property int index: tracker - 1
property bool singleTracker: tracker == -1
property bool multiTrackerHeader: tracker == 0
property bool useTrackerInfo: tracker > 0
property bool showNameAndTotal: singleTracker || multiTrackerHeader
VBusItem { id: customNameItem; bind: Utils.path(serviceName, "/CustomName") }
property string pvName: showNameAndTotal ? customNameItem.valid ? customNameItem.value : "--" : " tracker " + tracker.toString()
VBusItem { id: pvVoltage; bind: Utils.path(serviceName, singleTracker ? "/Pv/V" : useTrackerInfo ? "/Pv/" + index.toString() + "/V" : "") }
VBusItem { id: pvPower; bind: Utils.path(serviceName, showNameAndTotal ? "/Yield/Power" : "/Pv/" + index.toString() + "/P") }
SystemState {
id: state
bind: Utils.path (serviceName, "/State")
}
function doScroll()
{
pvText.doScroll()
}
MarqueeEnhanced
{
id: pvText
width: rowTitleWidth
height: parent.height
text: pvName
fontSize: 12
textColor: "black"
bold: true
textHorizontalAlignment: Text.AlignHCenter
scroll: false
anchors
{
verticalCenter: parent.verticalCenter
}
}
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: EnhFmt.formatVBusItem (pvPower, "W") }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: multiTrackerHeader ? " " : EnhFmt.formatVBusItem (pvVoltage, "V") }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: multiTrackerHeader ? " " : calculateCurrent (pvPower, pvVoltage, "A") }
Text { font.pixelSize: 12; font.bold: true; color: "black"
width: tableColumnWidth; horizontalAlignment: Text.AlignHCenter
text: showNameAndTotal ? state.text : " " }
function calculateCurrent (powerItem, voltageItem, unit)
{
if (powerItem.valid && voltageItem.valid && voltageItem.value != 0)
return EnhFmt.formatValue (powerItem.value / voltageItem.value, unit)
else
return ""
}
}