Exemple #1
0
  def __init__(self, dev, logdir='.', serial=None, aero_path='.'):
    """Create a new instance of UnitUnderTest"""
    # Create control structures

    aero = aeroflex.Aeroflex(aero_path)
    aerovars = aeroflex.fields()
    
    self._dev = dev
    self._init()
    # Request serial number from unit
    if serial is None:
      serial_pattern = 'S/N: (\d+)\r'
      self._tom.sendline('test serial_number get')
      while self._tom.expect([shell.SHELL_PROMPT, serial_pattern]):
        serial = int(self._tom.match.group(1))
      if not serial:
        raise Exception, "Unknown serial number"
    self._serial = serial
    # Open logfile and check if file exists before write
    logfile = '%s-temptest-%s.csv' % (logdir, self._serial)
    if os.path.exists(logfile):
      message = raw_input('File path: %s already exists. Wish to overwrite? [y/N] ' % (logfile))
      if message != 'y':
        logfile = raw_input('What is the new file path? ' )
        while True:
          if os.path.exists(logfile):
            logfile = raw_input('New file path also exists. Got another one? ' )       
          else:
            break;
    print("Write measurements into " + logfile)
    self._log = open(logfile, 'wt')
    self._writeheader(aerovars)
Exemple #2
0
    def __init__(self, dev, logdir='.', serial=None, aero_path='.'):
        """Create a new instance of UnitUnderTest"""
        # Create control structures

        aero = aeroflex.Aeroflex(aero_path)
        aerovars = aeroflex.fields()

        self._dev = dev
        self._init()
        # Request serial number from unit
        if serial is None:
            serial_pattern = 'S/N: (\d+)\r'
            self._tom.sendline('test serial_number get')
            while self._tom.expect([shell.SHELL_PROMPT, serial_pattern]):
                serial = int(self._tom.match.group(1))
            if not serial:
                raise Exception, "Unknown serial number"
        self._serial = serial
        # Open logfile and check if file exists before write
        logfile = '%s-temptest-%s.csv' % (logdir, self._serial)
        if os.path.exists(logfile):
            message = raw_input(
                'File path: %s already exists. Wish to overwrite? [y/N] ' %
                (logfile))
            if message != 'y':
                logfile = raw_input('What is the new file path? ')
                while True:
                    if os.path.exists(logfile):
                        logfile = raw_input(
                            'New file path also exists. Got another one? ')
                    else:
                        break
        print("Write measurements into " + logfile)
        self._log = open(logfile, 'wt')
        self._writeheader(aerovars)
Exemple #3
0
  def measure(self, channel, aero_path):

    # Create control structures
    print "Accessing the Aeroflex"
    aero = aeroflex.Aeroflex(aero_path)
    aerovars = aeroflex.fields()
    
    for i in range(3):
      try:
        # Take the measurements
        ts1 = datetime.now().isoformat()
        sbmap = self._sb.query()
        break
      except:
        self._reinit()
    else:
      raise Exception, 'Unable to resynchronize with Major Tom'

    # Take the measurements
    ts2 = datetime.now().isoformat()
    aeromap = aero.measure()
    ts3 = datetime.now().isoformat()
    if aeromap['overall'] == 'NREP':
    	print "  GXPR Status: No Reply"
    elif aeromap['overall'] == 'FAIL':
        print "  GXPR Status: Replied"
  
    # Commit to logfile
    self._log.write(ts1)
    for sbvar in UnitUnderTest.sbvars:
      try:
        self._log.write(',%e' % sbmap[sbvar][1])
      except TypeError:
        self._log.write(',%s' % sbmap[sbvar][1])

    self._log.write(',%s' % ts2)
    self._log.write(',%s' % channel)
    for var in aerovars:
        try:
            self._log.write(',%e' % aeromap[var])
        except TypeError:
            self._log.write(',%s' % aeromap[var])
    self._log.write(',%s\n' % ts3)
    self._log.flush()
Exemple #4
0
    def measure(self, channel, aero_path):

        # Create control structures
        print "Accessing the Aeroflex"
        aero = aeroflex.Aeroflex(aero_path)
        aerovars = aeroflex.fields()

        for i in range(3):
            try:
                # Take the measurements
                ts1 = datetime.now().isoformat()
                sbmap = self._sb.query()
                break
            except:
                self._reinit()
        else:
            raise Exception, 'Unable to resynchronize with Major Tom'

        # Take the measurements
        ts2 = datetime.now().isoformat()
        aeromap = aero.measure()
        ts3 = datetime.now().isoformat()
        if aeromap['overall'] == 'NREP':
            print "  GXPR Status: No Reply"
        elif aeromap['overall'] == 'FAIL':
            print "  GXPR Status: Replied"

        # Commit to logfile
        self._log.write(ts1)
        for sbvar in UnitUnderTest.sbvars:
            try:
                self._log.write(',%e' % sbmap[sbvar][1])
            except TypeError:
                self._log.write(',%s' % sbmap[sbvar][1])

        self._log.write(',%s' % ts2)
        self._log.write(',%s' % channel)
        for var in aerovars:
            try:
                self._log.write(',%e' % aeromap[var])
            except TypeError:
                self._log.write(',%s' % aeromap[var])
        self._log.write(',%s\n' % ts3)
        self._log.flush()
Exemple #5
0
from tools import shell

parser = argparse.ArgumentParser(description='Transponder Vacuum Soak Script')
parser.add_argument('majortom', help='Serial port connected to Major Tom')
parser.add_argument('aeroflex',
                    help='Serial port connected to the Aeroflex IRF 6000')
parser.add_argument('logfile', help='CSV file to append new measurements')
parser.add_argument('-v',
                    '--verbose',
                    action='store_true',
                    help='Tee serial communications to the console')
args = parser.parse_args()

print "Accessing the Aeroflex"
aero = aeroflex.Aeroflex(args.aeroflex)
aerovars = aeroflex.fields()

print "Accessing Major Tom"
tom = shell.Shell(args.majortom)
sb = shell.Scoreboard(tom, None)
sbvars = []
sbvars.append('avionics_barometric_pressure')
sbvars.append('avionics_barometric_pressure_filtered')
sbvars.append('avionics_barometric_pressure_variance')
sbvars.append('avionics_barometer_temperature')
sbvars.append('avionics_secondary_barometric_pressure')
sbvars.append('avionics_secondary_barometer_temperature')
sbvars.append('apex_temperature_barometer')
sbvars.append('apex_barometric_pressure')
sbvars.append('apex_barometric_pressure_filtered')
sbvars.append('apex_barometric_pressure_variance')
Exemple #6
0
        help='Required precision for the PPC4')
parser.add_argument('-v', '--verbose',
        action='store_true',
        help='Tee serial communications to the console')
args = parser.parse_args()

print "Sweeping from FL%03.0f to FL%03.0f in steps of %.2f FL." \
    % (args.min_altitude, args.max_altitude, args.step_size)

print "Accessing PPC4"
ppc = ppc4.PPC4(args.ppc4)
ppc.verbose = args.verbose

print "Accessing the Aeroflex"
aero = aeroflex.Aeroflex(args.aeroflex)
aerovars = aeroflex.fields()

print "Accessing Major Tom"
tom = shell.Shell(args.majortom)
sb = shell.Scoreboard(tom, None)
sbvars = []
sbvars.append('avionics_barometric_pressure')
sbvars.append('avionics_barometric_pressure_filtered')
sbvars.append('avionics_barometric_pressure_variance')
sbvars.append('avionics_barometer_temperature')
sbvars.append('avionics_secondary_barometric_pressure')
sbvars.append('avionics_secondary_barometer_temperature')
sbvars.append('apex_temperature_barometer')
sbvars.append('apex_barometric_pressure')
sbvars.append('apex_barometric_pressure_filtered')
sbvars.append('apex_barometric_pressure_variance')