-
Notifications
You must be signed in to change notification settings - Fork 0
/
ControlPID.qml
298 lines (244 loc) · 7.98 KB
/
ControlPID.qml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
Item {
property string title
property var pid
Layout.fillWidth: true
height: titleText.implicitHeight + pctGrid.implicitHeight + pidGrid.implicitHeight + gainGrid.implicitHeight + adjPage.implicitHeight + 155
Label {
id: titleText
text: title
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.bold: true
}
GridLayout {
id: pctGrid
anchors.top: titleText.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 12
columns: 3
TextFieldExt {
id: fieldPercentMin
minWidth: 155
label: qsTr("Minimum Fan % (%)")
tooltip: qsTr("The minimum % the PID is allowed to output.")
text: pid ? pid.percentMin : 0
target: pid
property: "percentMin"
}
TextFieldExt {
id: fieldPercentMax1
visible: pid.adaptiveSP
minWidth: 155
label: qsTr("Maximum Fan % 1 (%)")
tooltip: qsTr("The maximum % the PID is allowed to output, when setpoint < setpoint_max and the setpoint may step up.")
text: pid ? pid.percentMax1 : 0
target: pid
property: "percentMax1"
}
Item {
visible: !pid.adaptiveSP
Layout.minimumWidth: 155
Layout.fillWidth: true
}
TextFieldExt {
id: fieldPercentMax2
minWidth: 155
label: qsTr("Maximum Fan % 2 (%)")
tooltip: qsTr("The maximum % the PID is allowed to output, when setpoint = setpoint_max or the setpoint is not allowed to step up (due to case temp delta).")
text: pid ? pid.percentMax2 : 0
target: pid
property: "percentMax2"
}
}
GridLayout {
id: pidGrid
anchors.top: pctGrid.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 12
columns: 3
TextFieldExt {
id: fieldSetpoint
Layout.maximumWidth: 115
label: qsTr("Setpoint")
text: pid ? pid.setpoint : 0
target: pid
property: "setpoint"
}
CheckBox {
id: fieldAdaptiveSP
Layout.fillWidth: true
text: qsTr("Automatically Adjust")
checked: pid ? pid.adaptiveSP : 0
onToggled: {
pid.adaptiveSP = fieldAdaptiveSP.checked
}
}
Item {
Layout.fillWidth: true
}
}
GridLayout {
id: gainGrid
anchors.top: pidGrid.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 12
columns: 3
TextFieldExt {
id: fieldGainP
label: qsTr("Gain (P)")
text: pid ? pid.gainP : 0
target: pid
property: "gainP"
}
TextFieldExt {
id: fieldGainI
label: qsTr("Gain (I)")
text: pid ? pid.gainI : 0
target: pid
property: "gainI"
}
TextFieldExt {
id: fieldGainD
label: qsTr("Gain (D)")
text: pid ? pid.gainD : 0
target: pid
property: "gainD"
}
}
Item {
id: adjPage
implicitHeight: subtitleText.height + adjGrid.height + 12
anchors.top: gainGrid.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 24
visible: fieldAdaptiveSP.checked
Label {
id: subtitleText
text: qsTr("Setpoint Adjustment")
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.capitalization: Font.AllUppercase
}
GridLayout {
id: adjGrid
anchors.top: subtitleText.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 12
columns: 3
TextFieldExt {
id: fieldSetpointMin
minWidth: 125
label: qsTr("Setpoint Min (°C)")
text: pid ? pid.setpointMin : 0
target: pid
property: "setpointMin"
}
TextFieldExt {
id: fieldSetpointMax
minWidth: 125
label: qsTr("Setpoint Max (°C)")
text: pid ? pid.setpointMax : 0
target: pid
property: "setpointMax"
}
TextFieldExt {
id: fieldStepSize
minWidth: 125
label: qsTr("Step Size (°C)")
text: pid ? pid.adaptiveSPStepSize : 0
target: pid
property: "adaptiveSPStepSize"
}
Item {
Layout.minimumWidth: 125
Layout.fillWidth: true
}
Item {
Layout.minimumWidth: 125
Layout.fillWidth: true
}
CheckBox {
id: fieldUseCaseTemp
text: qsTr("Use Case Temp")
checked: pid ? pid.adaptiveSPUseCaseTemp : 0
onToggled: {
pid.adaptiveSPUseCaseTemp = fieldUseCaseTemp.checked
}
}
TextFieldExt {
id: fieldStepUpPct
minWidth: 195
label: qsTr("Step-Up If Fan % Above (%)")
text: pid ? pid.adaptiveSPStepUp.pct : 0
target: pid.adaptiveSPStepUp
property: "pct"
}
TextFieldExt {
id: fieldStepUpDelay
minWidth: 85
label: qsTr("For (seconds)")
text: pid ? pid.adaptiveSPStepUp.delay : 0
target: pid.adaptiveSPStepUp
property: "delay"
}
TextFieldExt {
id: fieldStepUpCaseTempDelta
visible: fieldUseCaseTemp.checked
minWidth: 195
label: qsTr("And Case Temp Delta Below (°C)")
text: pid ? pid.adaptiveSPStepUp.caseTempDelta : 0
target: pid.adaptiveSPStepUp
property: "caseTempDelta"
}
Item {
visible: !fieldUseCaseTemp.checked
Layout.minimumWidth: 195
Layout.fillWidth: true
}
TextFieldExt {
id: fieldStepDownPct
minWidth: 205
label: qsTr("Step-Down If Fan % Below (%)")
text: pid ? pid.adaptiveSPStepDown.pct : 0
target: pid.adaptiveSPStepDown
property: "pct"
}
TextFieldExt {
id: fieldStepDownDelay
minWidth: 85
label: qsTr("For (seconds)")
text: pid ? pid.adaptiveSPStepDown.delay : 0
target: pid.adaptiveSPStepDown
property: "delay"
}
TextFieldExt {
id: fieldStepDownCaseTempDelta
visible: fieldUseCaseTemp.checked
minWidth: 215
label: qsTr("And Case Temp Delta Above (°C)")
text: pid ? pid.adaptiveSPStepDown.caseTempDelta : 0
target: pid.adaptiveSPStepDown
property: "caseTempDelta"
}
Item {
visible: !fieldUseCaseTemp.checked
Layout.minimumWidth: 215
Layout.fillWidth: true
}
}
}
}