瀏覽代碼

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

+ 8
- 6
src/rate.w 查看文件

24
 		void setCacheTime(int seconds);
24
 		void setCacheTime(int seconds);
25
 		void setScaleTime(int seconds);
25
 		void setScaleTime(int seconds);
26
 	signals:
26
 	signals:
27
-		void measurement(Measurement measure);
27
+		void newData(Measurement measure);
28
 	private:
28
 	private:
29
 		int ct;
29
 		int ct;
30
 		int st;
30
 		int st;
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
 The measurement will carry the fact that it is a relative measurement.
91
 The measurement will carry the fact that it is a relative measurement.
90
 
92
 
105
 double v2 = pavg * st;
107
 double v2 = pavg * st;
106
 Measurement value(v2, cache.back().time(), cache.back().scale());
108
 Measurement value(v2, cache.back().time(), cache.back().scale());
107
 value.insert("relative", true);
109
 value.insert("relative", true);
108
-emit measurement(value);
110
+emit newData(value);
109
 
111
 
110
 @ The rest of the class implementation is trivial.
112
 @ The rest of the class implementation is trivial.
111
 
113
 

Loading…
取消
儲存