Browse Source

Fixing DATAQ SDK integration with example configuration

Neal Wilson 11 years ago
parent
commit
c1345814f5
1 changed files with 28 additions and 7 deletions
  1. 28
    7
      config/Windows/productionroaster.xml

+ 28
- 7
config/Windows/productionroaster.xml View File

@@ -74,6 +74,7 @@
74 74
 		var rateadapters = new Array();
75 75
 		var rateoffsets = new Array();
76 76
 		var ratezeros = new Array();
77
+		var channelType = new Array();
77 78
 		var indicatorPanel = findChildObject(this, 'indicators');
78 79
 		var annotationPanel = findChildObject(this, 'controlpanel');
79 80
 		var log = findChildObject(this, 'log');
@@ -149,6 +150,7 @@
149 150
 												channel = device.newChannel(DAQ.Fahrenheit, DAQ.TypeS);
150 151
 											}
151 152
 											channels.push(channel);
153
+											channelType.push("T");
152 154
 											columnNames.push(channelReference.columnname);
153 155
 											DAQChannels++;
154 156
 											var indicator = new TemperatureDisplay;
@@ -212,6 +214,7 @@
212 214
 									channel = device.newChannel(DAQ.Fahrenheit, DAQ.TypeS);
213 215
 								}
214 216
 								channels.push(channel);
217
+								channelType.push("T");
215 218
 								columnNames.push(deviceReference.columnname);
216 219
 								var indicator = new TemperatureDisplay;
217 220
 								temperatureDisplays.push(indicator);
@@ -237,12 +240,17 @@
237 240
 						for(var j = 0; j < configModel.rowCount(driverIndex); j++) {
238 241
 							var channelIndex = configModel.index(j, 0, driverIndex);
239 242
 							var channelReference = configModel.referenceElement(configModel.data(channelIndex, 32));
243
+							var indicator = new TemperatureDisplay;
240 244
 							var unit;
241 245
 							if(channelReference.type == "Temperature") {
242 246
 								unit = Units.Fahrenheit;
247
+								channelType.push("T");
248
+								temperatureDisplays.push(indicator);
243 249
 							}
244 250
 							else {
245 251
 								unit = Units.Unitless;
252
+								indicator.setDisplayUnits(Units.Unitless);
253
+								channelType.push("C");
246 254
 							}
247 255
 							var channel = device.newChannel(unit);
248 256
 							var calibrator = new LinearCalibrator;
@@ -251,13 +259,13 @@
251 259
 							calibrator.mappedLower = channelReference.calibrationMappedLower;
252 260
 							calibrator.mappedUpper = channelReference.calibrationMappedUpper;
253 261
 							calibrator.sensitivity = channelReference.calibrationSensitivity;
254
-							calibrator.closedRange = channelReference.calibrationClosedInterval;
262
+							if(channelReference.calibrationClosedInterval == 'true') {
263
+								calibrator.closedRange = true;
264
+							}
255 265
 							// device.setSmoothingEnabled(j) = channelReference.smoothing;
256 266
 							channel.newData.connect(calibrator.newMeasurement)
257 267
 							channels.push(calibrator);
258 268
 							columnNames.push(channelReference.column);
259
-							var indicator = new TemperatureDisplay;
260
-							temperatureDisplays.push(indicator);
261 269
 							var decorator = new WidgetDecorator(indicator, configModel.data(channelIndex, 0), 2);
262 270
 							calibrator.newData.connect(indicator.setValue);
263 271
 							indicatorPanel.addWidget(decorator);
@@ -274,6 +282,7 @@
274 282
 					modbusdevices.push(device);
275 283
 					var pvchannel = device.pVChannel();
276 284
 					channels.push(pvchannel);
285
+					channelType.push("T");
277 286
 					columnNames.push(driverReference.pvcolname);
278 287
 					var indicator = new TemperatureDisplay;
279 288
 					temperatureDisplays.push(indicator);
@@ -284,6 +293,7 @@
284 293
 					{
285 294
 						var svchannel = device.sVChannel();
286 295
 						channels.push(svchannel);
296
+						channelType.push("C");
287 297
 						columnNames.push(driverReference.svcolname);
288 298
 						var indicator = new TemperatureDisplay;
289 299
 						temperatureDisplays.push(indicator);
@@ -394,6 +404,7 @@
394 404
 								channels[j].newData.connect(calibrator.newMeasurement);
395 405
 								calibrator.newData.connect(indicator.setValue);
396 406
 								channels.push(calibrator);
407
+								channelType.push(channelType[j]);
397 408
 								columnNames.push(driverReference.destination);
398 409
 								indicatorPanel.addWidget(decorator);
399 410
 							}
@@ -471,6 +482,7 @@
471 482
 							rate.newData.connect(indicator.setValue);
472 483
 							temperatureDisplays.push(indicator);
473 484
 							channels.push(rate);
485
+							channelType.push("T");
474 486
 							columnNames.push(configModel.data(driverIndex, 0));
475 487
 						}
476 488
 					}
@@ -617,9 +629,13 @@
617 629
                 var durfield = findChildObject(currentBatchInfo, 'duration');
618 630
                 durfield.text = duration;
619 631
                 log.clearOutputColumns();
620
-				for(var i = 0; i < channels.length; i++)
621
-				{
622
-					log.addOutputTemperatureColumn(lc + i);
632
+				for(var i = 0; i < channels.length; i++) {
633
+					if(channelType[i] == "T") {
634
+						log.addOutputTemperatureColumn(lc + i);
635
+					}
636
+					else {
637
+						log.addOutputControlColumn(lc + i);
638
+					}
623 639
 				}
624 640
 				log.addOutputAnnotationColumn(lc + channels.length);
625 641
                 var filename = log.saveTemporary();
@@ -776,7 +792,12 @@
776 792
                 log.clearOutputColumns();
777 793
 				for(var i = 0; i < columnNames.length; i++)
778 794
 				{
779
-					log.addOutputTemperatureColumn(lc + i);
795
+					if(channelType[i] == "T") {
796
+						log.addOutputTemperatureColumn(lc + i);
797
+					}
798
+					else {
799
+						log.addOutputControlColumn(lc + i);
800
+					}
780 801
 				}
781 802
 				log.addOutputAnnotationColumn(lc + columnNames.length);
782 803
                 log.saveXML(file);

Loading…
Cancel
Save