Subversion Repositories Projects

Rev

Rev 628 | Rev 632 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 628 Rev 629
Line 181... Line 181...
181
                self.voltageCtrl.SetTicks(ticks)
181
                self.voltageCtrl.SetTicks(ticks)
182
                self.firstVoltage = False
182
                self.firstVoltage = False
183
            i = (v-vmin)/(vmax-vmin)  # 0..1
183
            i = (v-vmin)/(vmax-vmin)  # 0..1
184
            i *= 2
184
            i *= 2
185
            i = i+1
185
            i = i+1
186
            i = min(max(i,0),5)
186
            i = min(max(i,0.1),4.9)
187
            self.voltageCtrl.SetSpeedValue(i)
187
            self.voltageCtrl.SetSpeedValue(i)
Line 188... Line 188...
188
 
188
 
Line 492... Line 492...
492
                 x += 1
492
                 x += 1
493
                 idx = self.TestListCtrl.GetNextSelected(idx)
493
                 idx = self.TestListCtrl.GetNextSelected(idx)
494
             line = wx.lib.plot.PolyLine(data, legend= 'Vibrations', colour='red', width=2)
494
             line = wx.lib.plot.PolyLine(data, legend= 'Vibrations', colour='red', width=2)
495
             markers = wx.lib.plot.PolyMarker(data, legend= '', colour='red', marker='circle',size=2)
495
             markers = wx.lib.plot.PolyMarker(data, legend= '', colour='red', marker='circle',size=2)
496
             title = "Comparing tests"
496
             title = "Comparing tests"
-
 
497
             self.graphCtrl.setLogScale((False,False))
497
             self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line, markers], title, "Test", "Vibration Value"), xAxis=(1,max(x,10)), yAxis=(0,y))
498
             self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line, markers], title, "Test", "Vibration Value"), xAxis=(1,max(x,10)), yAxis=(0,y))
498
             self.graphCtrl.SetEnableGrid('Horizontal')
499
             self.graphCtrl.SetEnableGrid('Horizontal')
Line 499... Line 500...
499
 
500
 
500
         else:
501
         else:
Line 508... Line 509...
508
                 xydata.shape = (nb, 2)
509
                 xydata.shape = (nb, 2)
509
                 xydata[:,1] = vibTest.getRawData()
510
                 xydata[:,1] = vibTest.getRawData()
510
                 line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red', width=2)
511
                 line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red', width=2)
Line 511... Line 512...
511
       
512
       
-
 
513
                 title = "Raw Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
512
                 title = "Raw Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
514
                 self.graphCtrl.setLogScale((False,False))
513
                 self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
515
                 self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
Line 514... Line 516...
514
                 self.graphCtrl.SetEnableGrid('Horizontal')
516
                 self.graphCtrl.SetEnableGrid('Horizontal')
515
   
517
   
516
             if self.graphTypeChoice.GetSelection() == 1:
518
             if self.graphTypeChoice.GetSelection() == 1:
517
                 xydata = _Numeric.linspace(0,0.09*nb,2*nb)
519
                 xydata = _Numeric.linspace(0,0.09*nb,2*nb)
518
                 xydata.shape = (nb, 2)
520
                 xydata.shape = (nb, 2)
Line 519... Line 521...
519
                 xydata[:,1] = vibTest.getFilteredData(self.app.settings["hpf"].value, self.app.settings["lpf"].value)
521
                 xydata[:,1] = vibTest.getFilteredData(self.app.settings["hpf"].value, self.app.settings["lpf"].value)
-
 
522
                 line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red', width=2)
520
                 line = wx.lib.plot.PolyLine(xydata, legend= 'Raw Data', colour='red', width=2)
523
       
521
       
524
                 title = "Filtered Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
Line 522... Line 525...
522
                 title = "Filtered Signal: %s %s %d" %(vibTest.descr, vibTest.channel, vibTest.speed)
525
                 self.graphCtrl.setLogScale((False,False))
523
                 self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
526
                 self.graphCtrl.Draw(wx.lib.plot.PlotGraphics([line], title, "Time (ms)", "Acc"), yAxis= (-y,y))
524
                 self.graphCtrl.SetEnableGrid('Horizontal')
527
                 self.graphCtrl.SetEnableGrid('Horizontal')
Line 525... Line 528...
525
   
528
   
-
 
529
             elif self.graphTypeChoice.GetSelection() == 2:
-
 
530
                 xydata = _Numeric.linspace(0,FS/2,nb)
Line 526... Line 531...
526
             elif self.graphTypeChoice.GetSelection() == 2:
531
                 xydata.shape = (nb/2, 2)
527
                 xydata = _Numeric.linspace(0,FS/2,nb)
532
                 
Line 528... Line 533...
528
                 xydata.shape = (nb/2, 2)
533
                 xydata[:,1] = vibTest.getSpectrum()
529
                 
534
                 
530
                 xydata[:,1] = vibTest.getSpectrum()
535
                 #print xydata
531
   
536
   
Line 532... Line 537...
532
                 line = wx.lib.plot.PolyLine(xydata, legend= 'Spectrum', colour='red')
537
                 line = wx.lib.plot.PolyLine(xydata, legend= 'Spectrum', colour='red')
533
                 markers = wx.lib.plot.PolyMarker(xydata, legend= '', colour='red', marker='circle',size=2)
-
 
534
                 
538
                 markers = wx.lib.plot.PolyMarker(xydata, legend= '', colour='red', marker='circle',size=2)
-
 
539
                 
-
 
540
                 fc = self.app.settings["hpf"].value
-
 
541
                 filterLine1 = wx.lib.plot.PolyLine(((fc,0),(fc,y)), legend='HP Filter', colour='Black', width=4)
Line 535... Line 542...
535
                 fc = self.app.settings["hpf"].value
542
                 fc = self.app.settings["lpf"].value
536
                 filterLine1 = wx.lib.plot.PolyLine(((fc,0),(fc,y)), legend='HP Filter', colour='Black', width=4)
543
                 filterLine2 = wx.lib.plot.PolyLine(((fc,0),(fc,y)), legend='HP Filter', colour='Black', width=4)
537
                 fc = self.app.settings["lpf"].value
544
       
Line 775... Line 782...
775
                   
782
                   
776
                    if voltage<minVoltage:
783
                    if voltage<minVoltage:
Line 777... Line 784...
777
                        raise Exception("Voltage too low")
784
                        raise Exception("Voltage too low")
-
 
785
                   
Line 778... Line 786...
778
                   
786
            self._sendEvent("Done !")            
779
            self._sendEvent("Done !")            
787
            self._setMotorSpeed(speed, .1)
Line 780... Line 788...
780
       
788
       
781
        except Exception, e:
789
        except Exception, e:
Line 782... Line 790...
782
            self._sendEvent("Exception \"%s\"" % e, error=True)  
790
            self._sendEvent("Exception \"%s\"" % e, error=True)  
783
               
791
               
784
        self.running = False
792
        self.running = False
Line 865... Line 873...
865
        self.settings["serialport"] = Setting("Serial Port", "COM1")
873
        self.settings["serialport"] = Setting("Serial Port", "COM1")
866
        self.settings["startupspeed"] = Setting("Motor Startup Speed", 25)
874
        self.settings["startupspeed"] = Setting("Motor Startup Speed", 25)
867
        self.settings["startupsettling"] = Setting("Motor Startup Setting time (s)", 3)
875
        self.settings["startupsettling"] = Setting("Motor Startup Setting time (s)", 3)
868
        self.settings["serialport"] = Setting("Serial Port", "COM1")
876
        self.settings["serialport"] = Setting("Serial Port", "COM1")
869
        self.settings["hpf"] = Setting("HP Filter cutoff (Hz)", 50)
877
        self.settings["hpf"] = Setting("HP Filter cutoff (Hz)", 50)
870
        self.settings["lpf"] = Setting("LP Filter cutoff (Hz)", 180)
878
        self.settings["lpf"] = Setting("LP Filter cutoff (Hz)", 290)
871
        self.settings["minvoltage"] = Setting("Minimum Bettery Voltage (0=Automatic) (V) ", 0)
879
        self.settings["minvoltage"] = Setting("Minimum Bettery Voltage (0=Automatic) (V) ", 0)
872
        self.settings["maxvoltage"] = Setting("Maximum Bettery Voltage (0=Automatic) (V) ", 0)
880
        self.settings["maxvoltage"] = Setting("Maximum Bettery Voltage (0=Automatic) (V) ", 0)
Line 873... Line 881...
873
 
881