Browse Source

Synthesize measurements in ZoomLog for slow hardware. Fixes #4

Neal Wilson 11 years ago
parent
commit
bca126c971
2 changed files with 1257 additions and 1206 deletions
  1. 1225
    1206
      src/typica.cpp
  2. 32
    0
      src/typica.w

+ 1225
- 1206
src/typica.cpp
File diff suppressed because it is too large
View File


+ 32
- 0
src/typica.w View File

8170
 @<ZoomLog Implementation@>=
8170
 @<ZoomLog Implementation@>=
8171
 void ZoomLog::newMeasurement(Measurement measure, int tempcolumn)
8171
 void ZoomLog::newMeasurement(Measurement measure, int tempcolumn)
8172
 {
8172
 {
8173
+	@<Synthesize measurements for slow hardware@>@;
8173
 	model_ms->newMeasurement(measure, tempcolumn);
8174
 	model_ms->newMeasurement(measure, tempcolumn);
8174
 	if(lastMeasurement.contains(tempcolumn))
8175
 	if(lastMeasurement.contains(tempcolumn))
8175
 	{
8176
 	{
8220
 	m->newMeasurement(measure, tempcolumn);
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
 @ New to \pn{} 1.4 is the concept of a current column set. This was added to
8255
 @ New to \pn{} 1.4 is the concept of a current column set. This was added to
8224
 improve support for devices where measurements on different data series may not
8256
 improve support for devices where measurements on different data series may not
8225
 arrive at exactly the same time and for multi-device configurations where
8257
 arrive at exactly the same time and for multi-device configurations where

Loading…
Cancel
Save