|
@@ -66,6 +66,7 @@
|
66
|
66
|
var channels = new Array();
|
67
|
67
|
var annotationButtons = new Array();
|
68
|
68
|
var nidevices = new Array();
|
|
69
|
+ var dataqsdkdevices = new Array();
|
69
|
70
|
var temperatureDisplays = new Array();
|
70
|
71
|
var columnNames = new Array();
|
71
|
72
|
var modbusdevices = new Array();
|
|
@@ -223,6 +224,47 @@
|
223
|
224
|
}
|
224
|
225
|
}
|
225
|
226
|
}
|
|
227
|
+ else if(driverReference.driver == "dataqsdk")
|
|
228
|
+ {
|
|
229
|
+ var device = new DataqSdkDevice(driverReference.autoSelect ? driverReference.deviceNumber : driverReference.port);
|
|
230
|
+ var sampleRate = 6;
|
|
231
|
+ if(configModel.hasChildren(driverIndex)
|
|
232
|
+ {
|
|
233
|
+ for(var j = 0; j < configModel.rowCount(driverIndex); j++)
|
|
234
|
+ {
|
|
235
|
+ var channelIndex = configModel.index(j, 0, driverIndex);
|
|
236
|
+ var channelReference = configModel.referenceElement(configModel.data(channelIndex, 32));
|
|
237
|
+ var unit;
|
|
238
|
+ if(channelReference.type == "Temperature") {
|
|
239
|
+ unit = Units.Fahrenheit;
|
|
240
|
+ }
|
|
241
|
+ else {
|
|
242
|
+ unit = Units.Unitless;
|
|
243
|
+ }
|
|
244
|
+ var channel = device.newChannel(unit);
|
|
245
|
+ var calibrator = new LinearCalibrator;
|
|
246
|
+ calibrator.measuredLower = channelReference.calibrationMeasuredLower;
|
|
247
|
+ calibrator.measuredUpper = channelReference.calibrationMeasuredUpper;
|
|
248
|
+ calibrator.mappedLower = channelReference.calibrationMappedLower;
|
|
249
|
+ calibrator.mappedUpper = channelReference.calibrationMappedUpper;
|
|
250
|
+ calibrator.sensitivity = channelReference.calibrationSensitivity;
|
|
251
|
+ calibrator.closedRange = channelReference.calibrationClosedInterval;
|
|
252
|
+ // device.setSmoothingEnabled(j) = channelReference.smoothing;
|
|
253
|
+ channel.newData.connect(calibrator.newMeasurement)
|
|
254
|
+ channels.push(calibrator);
|
|
255
|
+ columnNames.push(channelReference.column);
|
|
256
|
+ var indicator = new TemperatureDisplay;
|
|
257
|
+ temperatureDisplays.push(indicator);
|
|
258
|
+ var decorator = new WidgetDecorator(indicator, configModel.data(channelIndex, 0), 2);
|
|
259
|
+ calibrator.newData.connect(indicator.setValue);
|
|
260
|
+ indicatorPanel.addWidget(decorator);
|
|
261
|
+ }
|
|
262
|
+ sampleRate /= configModel.rowCount(driverIndex);
|
|
263
|
+ }
|
|
264
|
+ device.setSampleRate(sampleRate);
|
|
265
|
+ device.start();
|
|
266
|
+ dataqsdkdevices.push(device);
|
|
267
|
+ }
|
226
|
268
|
else if(driverReference.driver == "modbusrtu")
|
227
|
269
|
{
|
228
|
270
|
var device = new ModbusRTUDevice(configModel, driverIndex);
|
|
@@ -462,8 +504,13 @@
|
462
|
504
|
{
|
463
|
505
|
modbusdevices[i].deleteLater();
|
464
|
506
|
}
|
|
507
|
+ for(var i = 0; i < dataqsdkdevices.length; i++)
|
|
508
|
+ {
|
|
509
|
+ dataqsdkdevices[i].deleteLater();
|
|
510
|
+ }
|
465
|
511
|
delete nidevices;
|
466
|
512
|
delete modbusdevices;
|
|
513
|
+ delete dataqsdkdevices;
|
467
|
514
|
window.saveSizeAndPosition("window");
|
468
|
515
|
vsplit.saveState("script/mainSplitter");
|
469
|
516
|
isplit.saveState("script/instrumentSplitter");
|