浏览代码

Synthesize measurements in ZoomLog for slow hardware. Fixes #4

Neal Wilson 11 年前
父节点
当前提交
bca126c971
共有 2 个文件被更改,包括 1257 次插入1206 次删除
  1. 1225
    1206
      src/typica.cpp
  2. 32
    0
      src/typica.w

+ 1225
- 1206
src/typica.cpp
文件差异内容过多而无法显示
查看文件


+ 32
- 0
src/typica.w 查看文件

@@ -8170,6 +8170,7 @@ The first measurement is always added to each model.
8170 8170
 @<ZoomLog Implementation@>=
8171 8171
 void ZoomLog::newMeasurement(Measurement measure, int tempcolumn)
8172 8172
 {
8173
+	@<Synthesize measurements for slow hardware@>@;
8173 8174
 	model_ms->newMeasurement(measure, tempcolumn);
8174 8175
 	if(lastMeasurement.contains(tempcolumn))
8175 8176
 	{
@@ -8220,6 +8221,37 @@ foreach(m, modelSet)
8220 8221
 	m->newMeasurement(measure, tempcolumn);
8221 8222
 }
8222 8223
 
8224
+@ Some measurement hardware in use cannot guarantee delivery of at least one
8225
+measurement per second. This causes problems for the current |ZoomLog|
8226
+implementation as, for example, if there is no measurement at a time where
8227
+the seconds are divisible by 5, there will be no entry in that view. This can
8228
+result in situations where the |ZoomLog| at its default view of one measurement
8229
+every 30 seconds might not display any data at all aside from the first
8230
+measurement, the last measurement, and any measurement that happens to have an
8231
+annotation associated with it. The solution in this case is to synthesize
8232
+measurements so that the |ZoomLog| thinks it gets at least one measurement
8233
+every second.
8234
+
8235
+The current approach simply replicates the last measurement every second until
8236
+the time for the most recent measurement is reached, however it would likely be
8237
+better to interpolate values between the two most recent real measurements as
8238
+this would match the graphic representation rather than altering it when later
8239
+reviewing the batch.
8240
+
8241
+@<Synthesize measurements for slow hardware@>=
8242
+if(lastMeasurement[tempcolumn].time() < measure.time()
8243
+{
8244
+	QList<QTime> timelist;
8245
+	for(QTime i = lastMeasurement[tempcolumn].addSecs(1); i < measure.time(); i = i.addSecs(1))
8246
+	{
8247
+		timelist.append(i);
8248
+	}
8249
+	for(int i = 0; i < timelist.size(); i++)
8250
+	{
8251
+		newMeasurement(Measurement(measure.temperature(), timelist[i], measure.scale()), tempcolumn);
8252
+	}
8253
+}
8254
+
8223 8255
 @ New to \pn{} 1.4 is the concept of a current column set. This was added to
8224 8256
 improve support for devices where measurements on different data series may not
8225 8257
 arrive at exactly the same time and for multi-device configurations where

正在加载...
取消
保存