|
@@ -24,7 +24,7 @@ class RateOfChange : public QObject
|
24
|
24
|
void setCacheTime(int seconds);
|
25
|
25
|
void setScaleTime(int seconds);
|
26
|
26
|
signals:
|
27
|
|
- void measurement(Measurement measure);
|
|
27
|
+ void newData(Measurement measure);
|
28
|
28
|
private:
|
29
|
29
|
int ct;
|
30
|
30
|
int st;
|
|
@@ -81,10 +81,12 @@ if(cache.size() > 2)
|
81
|
81
|
}
|
82
|
82
|
}
|
83
|
83
|
|
84
|
|
-@ When calculating the rate of change we are doing something that will
|
85
|
|
-fundamentally increase the noise expressed through the derived series.
|
86
|
|
-Delivering a derived series that both lacks excessive volatility and remains
|
87
|
|
-acceptably accurate requires careful tuning.
|
|
84
|
+@ The calculation method here is subject to change as this is still noisier
|
|
85
|
+than I would like. What we are doing here is calculating the rate of change
|
|
86
|
+between each pair of adjacent measurements in the cache and averaging them to
|
|
87
|
+produce something that is a little less noisy than just using the first and
|
|
88
|
+last measurements in the cache. Other techniques may be useful for reducing the
|
|
89
|
+noise further.
|
88
|
90
|
|
89
|
91
|
The measurement will carry the fact that it is a relative measurement.
|
90
|
92
|
|
|
@@ -105,7 +107,7 @@ double pavg = acc /= rates.size();
|
105
|
107
|
double v2 = pavg * st;
|
106
|
108
|
Measurement value(v2, cache.back().time(), cache.back().scale());
|
107
|
109
|
value.insert("relative", true);
|
108
|
|
-emit measurement(value);
|
|
110
|
+emit newData(value);
|
109
|
111
|
|
110
|
112
|
@ The rest of the class implementation is trivial.
|
111
|
113
|
|