Exemple #1
0
class PowTest(TestCase):
    def __init__(self):
        TestCase.__init__(self, "Tune Power Test")
        self.load = LoadControl(Config.LOAD_DEVICE)
        self.tran = FrequencyControl(Config.FREQ_DEVICE)
        self.tune = TunerControl(Config.TUNE_DEVICE)

    def test(self):
        "Test the transceiver at various frequency-load combinations"
        results = csv.writer(file(Config.TuneTimeTestoutput, "wb"))
        results.writerow(["Frequency", "Time", "Status"])
        #load input data
        infile = file(Config.TABLE_J, "r")
        tableJ = [line for line in csv.reader(infile)][Config.J_HEADER_ROWS:]
        infile.close()
        for row in tableJ:
            frequency = float(row[Config.J_FREQ_COL])
            print("Setting to %g MHz" % frequency)
            self.tran.setFrequency(frequency * M2Hz)
            for offset in range(0, Config.J_LOADS_PER_VSR * Config.J_VSRS, 3):
                # Set load
                self.load.setLCR(float(row[Config.J_L_COL + offset]),
                                 float(row[Config.J_C_COL + offset]),
                                 float(row[Config.J_R_COL + offset]))
                print("Setting load: L: %g C: %g R: %g" %
                      (float(row[Config.J_L_COL + offset]),
                       float(row[Config.J_C_COL + offset]),
                       float(row[Config.J_R_COL + offset])))
            #test for correct tuning
            Started = time.time()
            self.tune.start()
            self.tune.waitForDone()
            Finished = time.time()
            #record results
            if self.tune.getFrequency() == self.freq.readFrequency():
                result = [frequency, Finished - Started, "Pass"]
            else:
                result = [frequency, Finished - Started, "Fail"]
            print result
            results.writerow(result)
class PowTest(TestCase):
        def __init__(self):
            TestCase.__init__(self, "Tune Power Test")
            self.load = LoadControl(Config.LOAD_DEVICE)
            self.tran = FrequencyControl(Config.FREQ_DEVICE)
            self.tune = TunerControl(Config.TUNE_DEVICE)
            
        def test(self):
                "Test the transceiver at various frequency-load combinations"
                results = csv.writer(file(Config.TuneTimeTestoutput,"wb"))
                results.writerow(["Frequency","Time","Status"])
                #load input data
                infile = file(Config.TABLE_J, "r")
                tableJ = [line for line in csv.reader(infile)][Config.J_HEADER_ROWS:]
                infile.close()
                for row in tableJ:
                  frequency = float(row[Config.J_FREQ_COL])
                  print("Setting to %g MHz" % frequency)
                  self.tran.setFrequency(frequency*M2Hz)
                  for offset in range(0,Config.J_LOADS_PER_VSR*Config.J_VSRS,3):
                      # Set load
                      self.load.setLCR(float(row[Config.J_L_COL+offset]),
                       float(row[Config.J_C_COL+offset]),
                       float(row[Config.J_R_COL+offset]))
                      print("Setting load: L: %g C: %g R: %g" %
                      (float(row[Config.J_L_COL+offset]),
                       float(row[Config.J_C_COL+offset]),
                       float(row[Config.J_R_COL+offset])))
                  #test for correct tuning
                  Started=time.time()
                  self.tune.start()
                  self.tune.waitForDone()
                  Finished=time.time()
                  #record results
                  if self.tune.getFrequency() == self.freq.readFrequency():
                      result= [frequency,Finished-Started,"Pass"]
                  else:
                      result= [frequency,Finished-Started,"Fail"]
                  print result
                  results.writerow(result)
 def __init__(self):
     TestCase.__init__(self, "VSWR Tune Test")
     #moved this into the test
     #self.loadSetter = LoadControl(Config.LOAD_DEVICE)
     self.freq = FrequencyControl(Config.FREQ_DEVICE)
class TuneTest(TestCase):
    
    def __init__(self):
        TestCase.__init__(self, "VSWR Tune Test")
        #moved this into the test
        #self.loadSetter = LoadControl(Config.LOAD_DEVICE)
        self.freq = FrequencyControl(Config.FREQ_DEVICE)
    
    def test(self):
        currentVSWR = 0
        tableD = None # This is a 2 dimensional table of all the frequencies that will be tested in the procedure
        testResult = True
        # Load frequencies to test
        try:
            inFile = file(Config.TABLE_J, "r")
            tableJ = [line for line in csv.reader(inFile)][Config.J_HEADER_ROWS:]
            inFile.close()
        except:
            print("Could not load frequencies to test (%s)" % Config.TABLE_J)
            return False
            
        #open output
        results = csv.writer(file(Config.TuneTestoutput,"wb"))
        results.writerow(["Frequency [MHz]","Inductor","Capacitor","Resistor","Final VSWR","Status","Raido SWR meter value:"])
        
        # Cycle through frequencies
        for line in tableJ:
            curTestResult = False
            calcVSWR = 0
            roe = 0
            roeValues = None
            vswrFile = None
            
            frequency = float(line[Config.J_FREQ_COL])
            #set freq
            self.freq.setFrequency(frequency*MHz)
            self.loadSetter = LoadControl(Config.LOAD_DEVICE)
            for offset in range(0,Config.J_LOADS_PER_VSR*Config.J_VSRS,3):        
                # Set load
                L = float(line[Config.J_L_COL+offset])
                C = float(line[Config.J_C_COL+offset])
                R = float(line[Config.J_R_COL+offset])
                print("Setting load: L: %g C: %g R: %g" % (L,C,R))
                self.loadSetter.setLCR(L,C,R)
                              
                # Prompt user to run the network analyzer and save to location
                while(vswrFile == None):                    
                    print("Please wait until tuned")
                    print("Input raido SWR meter value:"),
                    notes = raw_input()
                    print("Press enter to set raio to recieve")
                    self.wait()
                    self.freq.setRx()
                    print("Please set the network analyzer to  %s MHz"
                     % line[Config.J_FREQ_COL])
                    print("Please save the CSV data from the analyzer to %s"
                     % Config.NET_RES_FILE)
                    self.wait()
                    try:
                        vswrFile = file(Config.NET_RES_FILE, "r")
                    except:
                        print("Could not open input file") 
                print("Reconnect the coupler to the transmitter then press enter")
                self.wait()
                self.freq.setTx()

                # Load the contents of the file
                roeValues = [newLine for newLine in csv.reader(vswrFile)][Config.NET_RES_HEADER_ROWS:]
                vswrFile.close()
                vswrFile = None
                # Calculate average roe 
                roeValues.pop()
                for roeLine in roeValues:
                    try:
                        roe += Utils.tooComplex(roeLine[Config.NET_RES_ROE_COL])
                    except IndexError:
                        print "Wiered input:",roeLine
                roe /= len(roeValues)
            
                # Calculate VSWR and compare to predicted
                calcVSWR = Utils.Vswr(roe)
                curTestResult = True if calcVSWR < 1.6 else False
                
                # Print results and set overall test to false if failed
                if(curTestResult):
                    print("Pass for frequency %s" % (frequency))
                    results.writerow([float(line[Config.J_FREQ_COL]),L,C,R,
                    calcVSWR,"Pass",notes]) 
                    testResult = True
                else:
                    print("Fail for frequency %s" % (frequency))
                    results.writerow([float(line[Config.J_FREQ_COL]),L,C,R,
                    calcVSWR,"Fail",notes])
                    testResult = False
            del self.loadSetter
            if(not self.prompt("Continue?")):
                return testResult
Exemple #5
0
 def __init__(self):
     TestCase.__init__(self, "VSWR Tune Test")
     #moved this into the test
     #self.loadSetter = LoadControl(Config.LOAD_DEVICE)
     self.freq = FrequencyControl(Config.FREQ_DEVICE)
Exemple #6
0
class TuneTest(TestCase):
    def __init__(self):
        TestCase.__init__(self, "VSWR Tune Test")
        #moved this into the test
        #self.loadSetter = LoadControl(Config.LOAD_DEVICE)
        self.freq = FrequencyControl(Config.FREQ_DEVICE)

    def test(self):
        currentVSWR = 0
        tableD = None  # This is a 2 dimensional table of all the frequencies that will be tested in the procedure
        testResult = True
        # Load frequencies to test
        try:
            inFile = file(Config.TABLE_J, "r")
            tableJ = [line
                      for line in csv.reader(inFile)][Config.J_HEADER_ROWS:]
            inFile.close()
        except:
            print("Could not load frequencies to test (%s)" % Config.TABLE_J)
            return False

        #open output
        results = csv.writer(file(Config.TuneTestoutput, "wb"))
        results.writerow([
            "Frequency [MHz]", "Inductor", "Capacitor", "Resistor",
            "Final VSWR", "Status", "Raido SWR meter value:"
        ])

        # Cycle through frequencies
        for line in tableJ:
            curTestResult = False
            calcVSWR = 0
            roe = 0
            roeValues = None
            vswrFile = None

            frequency = float(line[Config.J_FREQ_COL])
            #set freq
            self.freq.setFrequency(frequency * MHz)
            self.loadSetter = LoadControl(Config.LOAD_DEVICE)
            for offset in range(0, Config.J_LOADS_PER_VSR * Config.J_VSRS, 3):
                # Set load
                L = float(line[Config.J_L_COL + offset])
                C = float(line[Config.J_C_COL + offset])
                R = float(line[Config.J_R_COL + offset])
                print("Setting load: L: %g C: %g R: %g" % (L, C, R))
                self.loadSetter.setLCR(L, C, R)

                # Prompt user to run the network analyzer and save to location
                while (vswrFile == None):
                    print("Please wait until tuned")
                    print("Input raido SWR meter value:"),
                    notes = raw_input()
                    print("Press enter to set raio to recieve")
                    self.wait()
                    self.freq.setRx()
                    print("Please set the network analyzer to  %s MHz" %
                          line[Config.J_FREQ_COL])
                    print("Please save the CSV data from the analyzer to %s" %
                          Config.NET_RES_FILE)
                    self.wait()
                    try:
                        vswrFile = file(Config.NET_RES_FILE, "r")
                    except:
                        print("Could not open input file")
                print(
                    "Reconnect the coupler to the transmitter then press enter"
                )
                self.wait()
                self.freq.setTx()

                # Load the contents of the file
                roeValues = [newLine for newLine in csv.reader(vswrFile)
                             ][Config.NET_RES_HEADER_ROWS:]
                vswrFile.close()
                vswrFile = None
                # Calculate average roe
                roeValues.pop()
                for roeLine in roeValues:
                    try:
                        roe += Utils.tooComplex(
                            roeLine[Config.NET_RES_ROE_COL])
                    except IndexError:
                        print "Wiered input:", roeLine
                roe /= len(roeValues)

                # Calculate VSWR and compare to predicted
                calcVSWR = Utils.Vswr(roe)
                curTestResult = True if calcVSWR < 1.6 else False

                # Print results and set overall test to false if failed
                if (curTestResult):
                    print("Pass for frequency %s" % (frequency))
                    results.writerow([
                        float(line[Config.J_FREQ_COL]), L, C, R, calcVSWR,
                        "Pass", notes
                    ])
                    testResult = True
                else:
                    print("Fail for frequency %s" % (frequency))
                    results.writerow([
                        float(line[Config.J_FREQ_COL]), L, C, R, calcVSWR,
                        "Fail", notes
                    ])
                    testResult = False
            del self.loadSetter
            if (not self.prompt("Continue?")):
                return testResult
Exemple #7
0
 def __init__(self):
     TestCase.__init__(self, "Tune Power Test")
     self.load = LoadControl(Config.LOAD_DEVICE)
     self.tran = FrequencyControl(Config.FREQ_DEVICE)
     self.tune = TunerControl(Config.TUNE_DEVICE)
 def __init__(self):
     TestCase.__init__(self, "Tune Power Test")
     self.load = LoadControl(Config.LOAD_DEVICE)
     self.tran = FrequencyControl(Config.FREQ_DEVICE)
     self.tune = TunerControl(Config.TUNE_DEVICE)
Exemple #9
0
 def __init__(self):
     TestCase.__init__(self, "Power Test")
     self.freqSetter = FrequencyControl(Config.FREQ_DEVICE)
Exemple #10
0
class PowerTest(TestCase):
    
    def __init__(self):
        TestCase.__init__(self, "Power Test")
        self.freqSetter = FrequencyControl(Config.FREQ_DEVICE)
    
    def test(self):
        tableF = None # This is a 2 dimensional table of all the combinations of loads and frequenices to be tested
        testResult = True
        powers = None;
        frequencies = None;

        #open output        
        results = csv.writer(file(Config.PowerTestoutput,"wb"))
        results.writerow(["Powerlevel","Frequency","Heat","Correctness"])

        # Load frequencies to test
        try:
            inFile = file(Config.TABLE_F, "r")
            tableF = [line for line in csv.reader(inFile)][Config.F_HEADER_ROWS:]
            inFile.close()
        except:
            print("Could not load frequencies to test (%s)" % Config.TABLE_F)
            return False
        
        # Load all powers and frequencies from the table
        powers = [line[Config.F_ALL_POWERS_COL] for line in tableF if line[Config.F_ALL_POWERS_COL] != ""]
        frequencies = [line[Config.F_ALL_FREQS_COL] for line in tableF if line[Config.F_ALL_FREQS_COL] != ""]
        
        # Cycle through powers
        for power in powers:
            curPower = float(power)
            
            # Set power - MAY NEED CONVERSION
            self.freqSetter.setPower(curPower)
            
            for freq in frequencies:
                curFreq = float(freq) * 1000000
                curTestResult = True
                print("Running test for power %f W and %f MHz" %(curPower, curFreq / 1000000))
                
                # Set frequency
                self.freqSetter.setFrequency(curFreq)
                
                # Ask user if everything is OK
                if(not self.prompt("Is the equipment cool enough?")):
                     self.freqSetter.setPower(0)
                     results.writerow([curPower,curFreq,"Overheated!","Failed"])
                     return False
                    
                # Prompt for if the test is good
                curTestResult = self.prompt("Is the output correct?")
                
               #save what just happend
               results.writerow([curPower,curFreq,"Pass",curTestResult])
                # Print results and set overall test to false if failed
                if(curTestResult):
                    print("PASS for power %f W frequency %s MHz\n" % (curPower, curFreq / 1000000))
                else:
                    print("FAIL for power %f W frequency %s MHz\n" % (curPower, curFreq / 1000000))
                    testResult = False
            
        return testResult