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

Loading…
Cancel
Save