|
@@ -67,6 +67,7 @@
|
67
|
67
|
var roasterIndex = roasterlist.currentIndex;
|
68
|
68
|
var channels = new Array();
|
69
|
69
|
var annotationButtons = new Array();
|
|
70
|
+ var rangetimers = new Array();
|
70
|
71
|
var nidevices = new Array();
|
71
|
72
|
var dataqsdkdevices = new Array();
|
72
|
73
|
var jsdevices = new Array();
|
|
@@ -614,7 +615,7 @@
|
614
|
615
|
}
|
615
|
616
|
else if(driverReference.driver == "coolingtimer")
|
616
|
617
|
{
|
617
|
|
- var coolingTimer = new TimerDisplay;
|
|
618
|
+ var coolingTimer = new TimerDisplay();
|
618
|
619
|
coolingTimer.setDisplayFormat("mm:ss");
|
619
|
620
|
var decorator = new WidgetDecorator(coolingTimer, configModel.data(driverIndex, 0), 2);
|
620
|
621
|
indicatorPanel.addWidget(decorator);
|
|
@@ -625,6 +626,138 @@
|
625
|
626
|
coolingTimer.setResetValue(timeValue);
|
626
|
627
|
stop.clicked.connect(coolingTimer.startTimer);
|
627
|
628
|
}
|
|
629
|
+ else if(driverReference.driver == "rangetimer")
|
|
630
|
+ {
|
|
631
|
+ rangetimers.push(new TimerDisplay());
|
|
632
|
+ var rangeTimer = rangetimers[rangetimers.length - 1];
|
|
633
|
+ rangeTimer.setDisplayFormat("mm:ss");
|
|
634
|
+ var decorator = new WidgetDecorator(rangeTimer, configModel.data(driverIndex, 0), 2);
|
|
635
|
+ indicatorPanel.addWidget(decorator);
|
|
636
|
+ stop.clicked.connect(rangeTimer.stopTimer);
|
|
637
|
+ start.clicked.connect(rangeTimer.reset);
|
|
638
|
+ if(driverReference.starttrigger == "batch")
|
|
639
|
+ {
|
|
640
|
+ start.clicked.connect(rangeTimer.startTimer);
|
|
641
|
+ }
|
|
642
|
+ else if(driverReference.starttrigger == "manual")
|
|
643
|
+ {
|
|
644
|
+ var startButton = new AnnotationButton(driverReference.startbuttontext);
|
|
645
|
+ startButton.clicked.connect(rangeTimer.startTimer);
|
|
646
|
+ annotationPanel.addWidget(startButton);
|
|
647
|
+ tabControls.push(button);
|
|
648
|
+ }
|
|
649
|
+ else if(driverReference.starttrigger == "value")
|
|
650
|
+ {
|
|
651
|
+ var startTrigger = new ThresholdDetector();
|
|
652
|
+ startTrigger.setThreshold(Number(driverReference.startvalue));
|
|
653
|
+ var scope = new Object;
|
|
654
|
+ scope.invoke = function() {
|
|
655
|
+ if(timer.running && !(arguments.callee.rangeTimer.running))
|
|
656
|
+ {
|
|
657
|
+ arguments.callee.rangeTimer.startTimer();
|
|
658
|
+ }
|
|
659
|
+ };
|
|
660
|
+ scope.invoke.rangeTimer = rangeTimer;
|
|
661
|
+ startTrigger.timeForValue.connect(scope.invoke);
|
|
662
|
+ for(var j = 0; j < columnNames.length; j++)
|
|
663
|
+ {
|
|
664
|
+ if(columnNames[j] == driverReference.startcolumnname)
|
|
665
|
+ {
|
|
666
|
+ channels[j].newData.connect(startTrigger.newMeasurement);
|
|
667
|
+ }
|
|
668
|
+ }
|
|
669
|
+ }
|
|
670
|
+ stop.clicked.connect(rangeTimer.stopTimer)
|
|
671
|
+ if(driverReference.stoptrigger == "manual")
|
|
672
|
+ {
|
|
673
|
+ var stopButton = new AnnotationButton(driverReference.stopbuttontext);
|
|
674
|
+ stopButton.clicked.connect(rangeTimer.stopTimer);
|
|
675
|
+ annotationPanel.addWidget(stopButton);
|
|
676
|
+ tabControls.push(button);
|
|
677
|
+ }
|
|
678
|
+ else if(driverReference.stoptrigger == "value")
|
|
679
|
+ {
|
|
680
|
+ var stopTrigger = new ThresholdDetector();
|
|
681
|
+ stopTrigger.setThreshold(Number(driverReference.stopvalue));
|
|
682
|
+ stopTrigger.timeForValue.connect(rangeTimer.stopTimer);
|
|
683
|
+ for(var j = 0; j < columnNames.length; j++)
|
|
684
|
+ {
|
|
685
|
+ if(columnNames[j] == driverReference.stopcolumnname)
|
|
686
|
+ {
|
|
687
|
+ channels[j].newData.connect(stopTrigger.newMeasurement);
|
|
688
|
+ }
|
|
689
|
+ }
|
|
690
|
+ }
|
|
691
|
+ rangeTimer.reportingName = configModel.data(driverIndex, 0);
|
|
692
|
+ rangeTimer.report = function() {
|
|
693
|
+ return "" + this.reportingName + ": " + this.value;
|
|
694
|
+ };
|
|
695
|
+ }
|
|
696
|
+ else if(driverReference.driver = "multirangetimer")
|
|
697
|
+ {
|
|
698
|
+ var rangeTimer = new TimerDisplay();
|
|
699
|
+ rangeTimer.setDisplayFormat("mm:ss");
|
|
700
|
+ var decorator = new WidgetDecorator(rangeTimer, configModel.data(driverIndex, 0), 2);
|
|
701
|
+ indicatorPanel.addWidget(decorator);
|
|
702
|
+ var rangenames = driverReference.rangenames;
|
|
703
|
+ var endtemps = driverReference.endtemps;
|
|
704
|
+ var names = rangenames.slice(2, rangenames.length - 2).split(", ");
|
|
705
|
+ rangeTimer.rangeNames = new Array();
|
|
706
|
+ for(var j = 0; j < names.length; j++)
|
|
707
|
+ {
|
|
708
|
+ var name = names[j].slice(1, names[j].length - 1);
|
|
709
|
+ rangeTimer.rangeNames.push(name);
|
|
710
|
+ }
|
|
711
|
+ rangeTimer.rangeEnds = new Array();
|
|
712
|
+ var ends = endtemps.slice(2, endtemps.length - 2).split(", ");
|
|
713
|
+ for(var j = 0; j < ends.length; j++)
|
|
714
|
+ {
|
|
715
|
+ rangeTimer.rangeEnds.push(Number(ends[j]));
|
|
716
|
+ }
|
|
717
|
+ rangeTimer.currentRange = 0;
|
|
718
|
+ rangeTimer.results = new Array();
|
|
719
|
+ rangeTimer.trigger = new ThresholdDetector();
|
|
720
|
+ for(var j = 0; j < columnNames.length; j++)
|
|
721
|
+ {
|
|
722
|
+ if(columnNames[j] == driverReference.trigger)
|
|
723
|
+ {
|
|
724
|
+ channels[j].newData.connect(rangeTimer.trigger.newMeasurement);
|
|
725
|
+ }
|
|
726
|
+ }
|
|
727
|
+ rangeTimer.startRanges = function() {
|
|
728
|
+ arguments.callee.timer.currentRange = 0;
|
|
729
|
+ arguments.callee.timer.results.splice(0, arguments.callee.timer.results.length);
|
|
730
|
+ arguments.callee.timer.trigger.setThreshold(arguments.callee.timer.rangeEnds[0]);
|
|
731
|
+ };
|
|
732
|
+ rangeTimer.startRanges.timer = rangeTimer;
|
|
733
|
+ start.clicked.connect(rangeTimer.startTimer);
|
|
734
|
+ start.clicked.connect(rangeTimer.startRanges);
|
|
735
|
+ rangeTimer.transition = function() {
|
|
736
|
+ arguments.callee.timer.stopTimer();
|
|
737
|
+ arguments.callee.timer.results.push(arguments.callee.timer.value);
|
|
738
|
+ arguments.callee.timer.reset();
|
|
739
|
+ arguments.callee.timer.startTimer();
|
|
740
|
+ arguments.callee.timer.currentRange++;
|
|
741
|
+ if(arguments.callee.timer.currentRange <= arguments.callee.timer.rangeEnds.length)
|
|
742
|
+ {
|
|
743
|
+ arguments.callee.timer.trigger.setThreshold(arguments.callee.timer.rangeEnds[arguments.callee.timer.currentRange]);
|
|
744
|
+ }
|
|
745
|
+ };
|
|
746
|
+ rangeTimer.transition.timer = rangeTimer;
|
|
747
|
+ rangeTimer.trigger.timeForValue.connect(rangeTimer.transition);
|
|
748
|
+ stop.clicked.connect(rangeTimer.transition);
|
|
749
|
+ stop.clicked.connect(rangeTimer.stopTimer);
|
|
750
|
+ rangeTimer.report = function() {
|
|
751
|
+ var retval = "";
|
|
752
|
+ for(var j = 0; j < arguments.callee.timer.results.length; j++)
|
|
753
|
+ {
|
|
754
|
+ retval += arguments.callee.timer.rangeNames[j] + ": " + arguments.callee.timer.results[j] + "\n";
|
|
755
|
+ }
|
|
756
|
+ return retval;
|
|
757
|
+ };
|
|
758
|
+ rangeTimer.report.timer = rangeTimer;
|
|
759
|
+ rangetimers.push(rangeTimer);
|
|
760
|
+ }
|
628
|
761
|
}
|
629
|
762
|
}
|
630
|
763
|
for(var i = 1; i < tabControls.length; i++)
|
|
@@ -818,6 +951,11 @@
|
818
|
951
|
log.addOutputAnnotationColumn(lc + channels.length - channelSkip);
|
819
|
952
|
var filename = log.saveTemporary();
|
820
|
953
|
currentBatchInfo.tempData = filename;
|
|
954
|
+ var notes = findChildObject(currentBatchInfo, 'annotation');
|
|
955
|
+ for(var i = 0; i < rangetimers.length; i++)
|
|
956
|
+ {
|
|
957
|
+ notes.append(rangetimers[i].report());
|
|
958
|
+ }
|
821
|
959
|
currentBatchInfo.raise();
|
822
|
960
|
currentBatchInfo.activateWindow();
|
823
|
961
|
}
|