|
@@ -10,8 +10,7 @@ Rectangle {
|
10
|
10
|
property real sumxy : 0
|
11
|
11
|
property int n : 0
|
12
|
12
|
|
13
|
|
- width: 720
|
14
|
|
- height: 680
|
|
13
|
+ width: 720; height: 680
|
15
|
14
|
|
16
|
15
|
BrewingControlChart {
|
17
|
16
|
id: graph
|
|
@@ -25,178 +24,9 @@ Rectangle {
|
25
|
24
|
Column {
|
26
|
25
|
spacing: 8
|
27
|
26
|
|
28
|
|
- Row {
|
29
|
|
- spacing: 5
|
30
|
|
-
|
31
|
|
- Text {
|
32
|
|
- text: "Mass of ground coffee: "
|
33
|
|
- }
|
34
|
|
- TextInput {
|
35
|
|
- id: groundMass
|
36
|
|
-
|
37
|
|
- width: 30
|
38
|
|
- validator: DoubleValidator {
|
39
|
|
- bottom: 0
|
40
|
|
- decimals: 2
|
41
|
|
- notation: DoubleValidator.StandardNotation
|
42
|
|
- }
|
43
|
|
- KeyNavigation.tab: brewedMass
|
44
|
|
-
|
45
|
|
- Line {
|
46
|
|
- x1: -3; y1: groundMass.height
|
47
|
|
- x2: 33; y2: y1
|
48
|
|
- penWidth: 1
|
49
|
|
- color: "black"
|
50
|
|
- }
|
51
|
|
- }
|
52
|
|
- }
|
53
|
|
- Row {
|
54
|
|
- spacing: 5
|
55
|
|
-
|
56
|
|
- Text {
|
57
|
|
- text: "Mass of brewed coffee:"
|
58
|
|
- }
|
59
|
|
- TextInput {
|
60
|
|
- id: brewedMass
|
61
|
|
-
|
62
|
|
- width: 30
|
63
|
|
- validator: DoubleValidator {
|
64
|
|
- bottom: 0
|
65
|
|
- decimals: 2
|
66
|
|
- notation: DoubleValidator.StandardNotation
|
67
|
|
- }
|
68
|
|
- KeyNavigation.backtab: groundMass
|
69
|
|
- KeyNavigation.tab: ptds
|
70
|
|
-
|
71
|
|
- Line {
|
72
|
|
- x1: -3; y1: brewedMass.height
|
73
|
|
- x2: 33; y2: y1
|
74
|
|
- penWidth: 1
|
75
|
|
- color: "black"
|
76
|
|
- }
|
77
|
|
- }
|
78
|
|
- }
|
79
|
|
- Row {
|
80
|
|
- spacing: 56
|
81
|
|
-
|
82
|
|
- Text {
|
83
|
|
- text: "Percent TDS:"
|
84
|
|
- }
|
85
|
|
- TextInput {
|
86
|
|
- id: ptds
|
87
|
|
-
|
88
|
|
- width: 30
|
89
|
|
- validator: DoubleValidator {
|
90
|
|
- bottom: 0
|
91
|
|
- top: 100
|
92
|
|
- decimals: 2
|
93
|
|
- notation: DoubleValidator.StandardNotation
|
94
|
|
- }
|
95
|
|
- KeyNavigation.backtab: brewedMass
|
96
|
|
-
|
97
|
|
- Line {
|
98
|
|
- x1: -3; y1: ptds.height
|
99
|
|
- x2: 33; y2: y1
|
100
|
|
- penWidth: 1
|
101
|
|
- color: "black"
|
102
|
|
- }
|
103
|
|
- }
|
104
|
|
- }
|
105
|
|
- Row {
|
106
|
|
- spacing: 87
|
107
|
|
-
|
108
|
|
- Text {
|
109
|
|
- id: colorlabel
|
110
|
|
-
|
111
|
|
- text: "Color:"
|
112
|
|
- }
|
113
|
|
- ColorPicker {
|
114
|
|
- id: colorpicker
|
115
|
|
-
|
116
|
|
- width: 37; height: colorlabel.height
|
117
|
|
- }
|
118
|
|
- }
|
119
|
|
- Row {
|
120
|
|
- id: lsfrow
|
121
|
|
-
|
122
|
|
- visible: false
|
123
|
|
- spacing: 1
|
124
|
|
-
|
125
|
|
- Text {
|
126
|
|
- id: fitcolorlabel
|
127
|
|
-
|
128
|
|
- text: "Least Squares Fit Color:"
|
129
|
|
- }
|
130
|
|
- ColorPicker {
|
131
|
|
- id: fitcolorpicker
|
132
|
|
-
|
133
|
|
- width: 37; height: colorlabel.height
|
134
|
|
-
|
135
|
|
- onColorChanged: {
|
136
|
|
- graph.setFitColor(color)
|
137
|
|
- }
|
138
|
|
- }
|
139
|
|
- }
|
140
|
|
- Rectangle {
|
141
|
|
- id: plotButton
|
142
|
|
-
|
143
|
|
- z: 0
|
144
|
|
- anchors.horizontalCenter: parent.horizontalCenter
|
145
|
|
- height: buttonText.height + 20; width: buttonText.width + 40
|
146
|
|
- border.color: "black"
|
147
|
|
- radius: 10
|
148
|
|
-
|
149
|
|
- Text {
|
150
|
|
- id: buttonText
|
151
|
|
-
|
152
|
|
- text: "Plot This Brew"
|
153
|
|
- anchors {horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter}
|
154
|
|
- }
|
155
|
|
- MouseArea {
|
156
|
|
- anchors.fill: parent
|
157
|
|
-
|
158
|
|
- onClicked: {
|
159
|
|
- var extraction = (brewedMass.text * (ptds.text / 100)) / groundMass.text
|
160
|
|
- graph.plotPoint(extraction, (ptds.text / 100), colorpicker.color)
|
161
|
|
- dataViewModel.append({"color": colorpicker.color, "ptds": ptds.text, "extraction": extraction})
|
162
|
|
- root.n += 1
|
163
|
|
- root.sumy += (ptds.text / 100)
|
164
|
|
- root.sumx += extraction
|
165
|
|
- root.sumxy += ((ptds.text / 100) * extraction)
|
166
|
|
- root.sumxsq += Math.pow(extraction, 2)
|
167
|
|
- if(root.n > 1) {
|
168
|
|
- var a = ((root.sumy * root.sumxsq)-(root.sumx * root.sumxy))/((root.n * root.sumxsq)-Math.pow(root.sumx, 2))
|
169
|
|
- var b = ((root.n * root.sumxy)-(root.sumx * root.sumy))/((root.n * root.sumxsq) - Math.pow(root.sumx, 2))
|
170
|
|
- var x1 = 0.14
|
171
|
|
- var x2 = 0.26
|
172
|
|
- var y1 = a + (b * x1)
|
173
|
|
- var y2 = a + (b * x2)
|
174
|
|
- if(y1 < 0.008) {
|
175
|
|
- x1 = (0.008 - a) / b
|
176
|
|
- y1 = 0.008
|
177
|
|
- }
|
178
|
|
- if(y2 < 0.008) {
|
179
|
|
- x2 = (0.008 - a) / b
|
180
|
|
- y2 = 0.008
|
181
|
|
- }
|
182
|
|
- if(y1 > 0.016) {
|
183
|
|
- x1 = (0.016 - a) / b
|
184
|
|
- y1 = 0.016
|
185
|
|
- }
|
186
|
|
- if(y2 > 0.016) {
|
187
|
|
- x2 = (0.016 - a) / b
|
188
|
|
- y2 = 0.016
|
189
|
|
- }
|
190
|
|
- graph.setFit(x1, y1, x2, y2);
|
191
|
|
- }
|
192
|
|
- }
|
193
|
|
- }
|
194
|
|
- }
|
195
|
27
|
ListView {
|
196
|
28
|
spacing: 3
|
197
|
|
- height: 400
|
198
|
|
- width: 100
|
199
|
|
- z: -1
|
|
29
|
+ height: 600; width: 100
|
200
|
30
|
contentHeight: dataViewModel.count * 35
|
201
|
31
|
|
202
|
32
|
model: ListModel {
|
|
@@ -221,6 +51,7 @@ Rectangle {
|
221
|
51
|
}
|
222
|
52
|
}
|
223
|
53
|
}
|
|
54
|
+
|
224
|
55
|
Component.onCompleted: {
|
225
|
56
|
var quitItem = window.addMenuItem("File", "Quit");
|
226
|
57
|
quitItem.shortcut = "Ctrl+Q";
|
|
@@ -242,7 +73,42 @@ Rectangle {
|
242
|
73
|
showLeastSquares.checkable = true;
|
243
|
74
|
showLeastSquares.triggered.connect(function() {
|
244
|
75
|
graph.setFitVisible(showLeastSquares.checked);
|
245
|
|
- lsfrow.visible = showLeastSquares.checked;
|
|
76
|
+ });
|
|
77
|
+ window.newPoint.connect(function(pointDescription) {
|
|
78
|
+ graph.plotPoint(pointDescription.extraction,
|
|
79
|
+ pointDescription.ptds / 100,
|
|
80
|
+ pointDescription.color)
|
|
81
|
+ dataViewModel.append(pointDescription)
|
|
82
|
+ root.n += 1
|
|
83
|
+ root.sumy += pointDescription.ptds / 100
|
|
84
|
+ root.sumx += pointDescription.extraction
|
|
85
|
+ root.sumxy += ((pointDescription.ptds / 100) * pointDescription.extraction)
|
|
86
|
+ root.sumxsq += Math.pow(pointDescription.extraction, 2)
|
|
87
|
+ if(root.n > 1) {
|
|
88
|
+ var a = ((root.sumy * root.sumxsq)-(root.sumx * root.sumxy))/((root.n * root.sumxsq)-Math.pow(root.sumx, 2))
|
|
89
|
+ var b = ((root.n * root.sumxy)-(root.sumx * root.sumy))/((root.n * root.sumxsq) - Math.pow(root.sumx, 2))
|
|
90
|
+ var x1 = 0.14
|
|
91
|
+ var x2 = 0.26
|
|
92
|
+ var y1 = a + (b * x1)
|
|
93
|
+ var y2 = a + (b * x2)
|
|
94
|
+ if(y1 < 0.008) {
|
|
95
|
+ x1 = (0.008 - a) / b
|
|
96
|
+ y1 = 0.008
|
|
97
|
+ }
|
|
98
|
+ if(y2 < 0.008) {
|
|
99
|
+ x2 = (0.008 - a) / b
|
|
100
|
+ y2 = 0.008
|
|
101
|
+ }
|
|
102
|
+ if(y1 > 0.016) {
|
|
103
|
+ x1 = (0.016 - a) / b
|
|
104
|
+ y2 = 0.016
|
|
105
|
+ }
|
|
106
|
+ if(y2 > 0.016) {
|
|
107
|
+ x2 = (0.016 - a) / b
|
|
108
|
+ y2 = 0.016
|
|
109
|
+ }
|
|
110
|
+ graph.setFit(x1, y1, x2, y2)
|
|
111
|
+ }
|
246
|
112
|
});
|
247
|
113
|
}
|
248
|
114
|
}
|