Переглянути джерело

Adjust RateOfChange to expose the same interface as a Channel object

Neal Wilson 11 роки тому
джерело
коміт
427f0858f4
2 змінених файлів з 11 додано та 9 видалено
  1. 3
    3
      config/Windows/productionroaster.xml
  2. 8
    6
      src/rate.w

+ 3
- 3
config/Windows/productionroaster.xml Переглянути файл

@@ -423,7 +423,7 @@
423 423
 							indicator.digitCount = 9;
424 424
 							var decorator = new WidgetDecorator(indicator, configModel.data(driverIndex, 0), 2);
425 425
 							indicatorPanel.addWidget(decorator);
426
-							rate.measurement.connect(indicator.setValue);
426
+							rate.newData.connect(indicator.setValue);
427 427
 							temperatureDisplays.push(indicator);
428 428
 							rateCalculators.push(rate);
429 429
 						}
@@ -494,13 +494,13 @@
494 494
 		for(var i = channels.length; i < channels.length + rateCalculators.length; i++) {
495 495
 			var offset = new MeasurementTimeOffset(epoch);
496 496
 			rateoffsets.push(offset);
497
-			rateCalculators[i - channels.length].measurement.connect(offset.newMeasurement);
497
+			rateCalculators[i - channels.length].newData.connect(offset.newMeasurement);
498 498
 			var adapter = new MeasurementAdapter(i + 1);
499 499
 			rateadapters.push(adapter);
500 500
 			offset.measurement.connect(adapter.newMeasurement);
501 501
 			var emitter = new ZeroEmitter(i + 1);
502 502
 			ratezeros.push(emitter);
503
-			rateCalculators[i - channels.length].measurement.connect(emitter.newMeasurement);
503
+			rateCalculators[i - channels.length].newData.connect(emitter.newMeasurement);
504 504
 			emitter.measurement.connect(graph.newMeasurement);
505 505
 		}
506 506
         start.clicked.connect(function() {

+ 8
- 6
src/rate.w Переглянути файл

@@ -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
 

Завантаження…
Відмінити
Зберегти