示例#1
0
def config_acs(pfc_path):
  sleep(5)
  tom = shell.Shell(pfc_path)
  sleep(1)
  sb = shell.Scoreboard(tom,'acs')
  sleep(1)
  tom.sendline('power on acs')
  sleep(3)
  print sb.query('power_acs_enabled')
  sleep(1)
  tom.sendline('acs esc on')
  sleep(5)
  esc_state = str(sb.query('acs_fan_esc_power_state'))
  current_esc_state = esc_state.split("'")[3]
  sleep(3)

  while current_esc_state != 'On':
    tom.sendline('acs esc on')
    sleep(6)
    esc_state = str(sb.query('acs_fan_esc_power_state'))
    current_esc_state = esc_state.split("'")[3]
    print current_esc_state
    sleep(2)

  print sb.query('acs_fan_esc_switch_on')
  esc_temp = str(sb.query('acs_temperature_fan_esc'))
  current_esc_temp = esc_temp.split("'")[3]
  print current_esc_temp
  tom.close()
  sleep(3)
  return float(current_esc_temp)
示例#2
0
def query_specific(pfc_path):
    tom = shell.Shell(pfc_path)
    sleep(3)
    sb = shell.Scoreboard(tom, 'apex')
    sleep(3)
    sbmap = sb.query()
    tom.close()
    return sbmap
示例#3
0
def query_sb(pfc_path):
    tom = shell.Shell(pfc_path)
    sleep(3)
    sb = shell.Scoreboard(tom, 'apex')
    sleep(3)
    msg = str(sb.query('apex'))
    tom.close()
    return msg
示例#4
0
def config_acs_setpoint(pfc_path, esc_setpoint):
  tom = shell.Shell(pfc_path)
  sleep(1)
  sb = shell.Scoreboard(tom,'acs')
  tom.sendline('heater set acs.main %s' % esc_setpoint)
  sleep(3)
  acs_sp = str(sb.query('acs_heater_setpoint_main'))
  current_acs_sp = acs_sp.split("'")[3]
  print 'ACS setpoint was set to %s' % current_acs_sp
  tom.close()
示例#5
0
def clean_acs(pfc_path):
    sleep(5)
    tom = shell.Shell(pfc_path)
    sleep(1)
    sb = shell.Scoreboard(tom, 'acs')
    sleep(1)
    tom.sendline('power off acs')
    sleep(3)
    print sb.query('power_acs_enabled')
    sleep(1)
    tom.close()
示例#6
0
def check_esc_temp(pfc_path):
    tom = shell.Shell(pfc_path)
    sleep(1)
    sb = shell.Scoreboard(tom, 'acs')
    sleep(3)
    esc_temp = str(sb.query('acs_temperature_fan_esc'))
    current_esc_temp = esc_temp.split("'")[3]
    print current_esc_temp
    tom.close()
    sleep(3)
    return float(current_esc_temp)
示例#7
0
def config_esc_setpoint(pfc_path, esc_setpoint):
  tom = shell.Shell(pfc_path)
  sleep(1)
  sb = shell.Scoreboard(tom,'acs')
  tom.sendline('heater set acs.esc.on %s' % esc_setpoint)
  sleep(3)
  tom.sendline('acs esc_activation_temperature %s' % esc_setpoint)
  sleep(3)
  esc_sp = str(sb.query('acs_heater_setpoint_fan_esc'))
  current_esc_sp = esc_sp.split("'")[3]
  print 'ESC setpoint was set to %s' % current_esc_sp
  tom.close()
示例#8
0
def squib_status(pfc_path):
    tom = shell.Shell(pfc_path)
    sleep(3)
    sb = shell.Scoreboard(tom, 'apex')
    sleep(3)
    hard = str(sb.query('apex_hard_squib_state'))
    soft = str(sb.query('apex_soft_squib_state'))
    aux = str(sb.query('apex_aux_squib_state'))
    print hard
    print soft
    print aux
    hard = (hard.split("'")[3])
    soft = (soft.split("'")[3])
    aux = (aux.split("'")[3])
    tom.close()
    sleep(3)
    return (hard, soft, aux)
示例#9
0
def sb_measure(pfc_path):

    print "Recording MB SB data..."
    tom = shell.Shell(pfc_path)
    sleep(2)
    sb = shell.Scoreboard(tom, '')
    sleep(2)
    ts = utils.get_timestamp()
    logfile.write(ts)
    for sbvar in sbvars:
        logfile.write(',%s' % str(sb.query(sbvar)).split("'")[3])
    vardata = str(sb.query_i2c())
    for i in range(24):
        vdata = vardata.split(",")[i - 1]
        data = vdata.split(":")[1]
        logfile.write(',%s' % data)
    logfile.write(',\n')
    tom.close()
    print "Finished recording data"
示例#10
0
    ps2.set_voltage(1, charge_v)
    ps2.set_currentlimit(1, charge_i)
elif batt_num == '4':
    ps1.set_voltage(2, charge_v)
    ps1.set_currentlimit(2, charge_i)
    ps2.set_voltage(1, charge_v)
    ps2.set_currentlimit(1, charge_i)
    ps2.set_voltage(2, charge_v)
    ps2.set_currentlimit(2, charge_i)
else:
    if batt_num != '1':
        raise Exception, 'Unknown command.'

print "Accessing the PFCs"
tom1 = shell.Shell(pfc1_path)
sb1 = shell.Scoreboard(tom1, 'battery')
if batt_num == '2':
    tom2 = shell.Shell(pfc2_path)
    sb2 = shell.Scoreboard(tom2, 'battery')
elif batt_num == '3':
    tom2 = shell.Shell(pfc2_path)
    sb2 = shell.Scoreboard(tom2, 'battery')
    tom3 = shell.Shell(pfc3_path)
    sb3 = shell.Scoreboard(tom3, 'battery')
elif batt_num == '4':
    tom2 = shell.Shell(pfc2_path)
    sb2 = shell.Scoreboard(tom2, 'battery')
    tom3 = shell.Shell(pfc3_path)
    sb3 = shell.Scoreboard(tom3, 'battery')
    tom4 = shell.Shell(pfc4_path)
    sb4 = shell.Scoreboard(tom4, 'battery')
示例#11
0
文件: masscal.py 项目: xuniuer/python
 def _init(self):
   self._tom = shell.Shell(self._dev, log=self.shell_log)
   self._sb = shell.Scoreboard(self._tom, 'gxpr_bridge')
示例#12
0
import argparse
import math
import twk_utils

from datetime import datetime
from time import sleep
from tools import shell

pfc_path = '/dev/serial/by-id/usb-loon_onboard_half_stack_hv_pfc-if01-port0'

utils = twk_utils.Twk_utils()

print "Accessing Major Tom"

tom = shell.Shell(pfc_path)
sb = shell.Scoreboard(tom, None)
sbvars = []
sbvars.append('gopro_target_video_on')
sbvars.append('gopro0_video_on')
sbvars.append('gopro0_voltage_camera_5v')
sbvars.append('gopro0_current_camera_5v')
sbvars.append('version_hash_gopro0')
sbvars.append('gopro1_video_on')
sbvars.append('gopro1_voltage_camera_5v')
sbvars.append('gopro1_current_camera_5v')
sbvars.append('version_hash_gopro1')
sbvars.append('gopro2_video_on')
sbvars.append('gopro2_voltage_camera_5v')
sbvars.append('gopro2_current_camera_5v')
sbvars.append('version_hash_gopro2')
sbvars.append('gopro3_video_on')
示例#13
0
print "Accessing the XPF6020 Power Supply"
charge_v = 50
charge_i = 10
ps = xpf6020.Xpf6020(ps_path)
ps.reset_ps()
ps.set_voltage(1, charge_v)
ps.set_currentlimit(1, charge_i)
if batt_num == '2':
    ps.set_voltage(2, charge_v)
    ps.set_currentlimit(2, charge_i)
else:
    raise Exception, 'Unknown command.'

print "Accessing the PFCs"
tom1 = shell.Shell(pfc1_path)
sb1 = shell.Scoreboard(tom1, 'battery')
if batt_num == '2':
    tom2 = shell.Shell(pfc2_path)
    sb2 = shell.Scoreboard(tom2, 'battery')
else:
    raise Exception, 'Unknown command.'


def batt_charging(target_soc, monitor_freq, batt_num):

    ts = get_timestamp()
    print 'Charging the battery(s)...[' + ts + ']'

    ps.all_output('on')
    sleep(1)
示例#14
0
    sleep(1)
    unit_id = config_common.prompt_unit(NAME)
    sn = unit_id.split("FL")[1]

    # Flash
    config_common.run_flash_firmware(args.firmware_dir, IMAGE_NAME)
    sleep(1)
    sore.all_output('off')
    sleep(5)
    sore.all_output('on')
    sleep(10)

    # Flash S/N
    tom = shell.Shell(bridge_path)
    sleep(1)
    sb = shell.Scoreboard(tom, 'gxpr_bridge')
    sleep(1)
    print sb.query('version_hash_gxpr')
    tom.sendline('test set_system_info %s' % sn)
    sleep(3)
    print sb.query('gxpr_serial_number')
    print sb.query('gxpr_fpga_sw_version')
    sleep(1)

    aeromap = aero.measure()

    print "   GXPR Status: " + aeromap['overall']
    print "   GXPR ERP: " + aeromap['power_boterp_value']
    print "   GXPR MTL: " + aeromap['power_botmtl_value']
    print "   GXPR Decoder: " + aeromap['decoder']
    print "   GXPR Power: " + aeromap['power']
示例#15
0
batt_vin = 49.8
batt_iin = 2

ps = xpf6020.Xpf6020(ps_path)
ps.reset_ps()
ps.set_voltage(1,batt_vin) 
ps.set_currentlimit(1,batt_iin)

print "Accessing the BK8500 Electronic Load"
bkload = bk8500.Bk8500()
bkload.remote_switch('on')

print "Accessing the Payload"
tom = shell.Shell(pfc_path)
sb = shell.Scoreboard(tom,'battery')

def batt_discharging(current, wait_time, monitor_freq, cycle):
  
  ts = utils.get_timestamp()
  print 'Discharging the battery @ %s A...[%s]' % (current, ts)
  
  max_current = current * 1.5
  bkload.config_cc_mode(current, max_current)
  sleep(1)
  bkload.load_switch('on')
  sleep(2)
  tom.sendline('power on acs')
  sleep(2)

  check_batt_discharge(current, wait_time, monitor_freq, cycle)
示例#16
0
def batt_charging(target_volt, target_current, max_temp, min_temp, max_diff, min_diff, monitor_freq, batt_num):

  is_it_done_yet = False

  ps1.ind_output('1','on')
  sleep(1)

  if batt_num == '2':
    ps1.ind_output('2','on')
    sleep(1)
  elif batt_num == '3':
    ps1.ind_output('2','on')
    sleep(1)
    ps2.ind_output('1','on')
    sleep(1)
  elif batt_num == '4':
    ps1.ind_output('2','on')
    sleep(1)
    ps2.ind_output('1','on')
    sleep(1)
    ps2.ind_output('2','on')
    sleep(1)
  else:
    if batt_num != '1':
      raise Exception, 'Unknown command.'

  while True:

    for i in range(int(batt_num)):

      print i
      if i == 1:
        path = pfc1_path
      elif i == 2:
        path = pfc2_path
      elif i == 3:
        path = pfc3_path
      elif i == 4:
        path = pfc4_path
      else:
        raise Exception, 'Unknown range.'

      tom = shell.Shell(path)
      sb = shell.Scoreboard(tom,'battery')

      state = check_batt_charge(target_volt, target_current, max_temp, min_temp, max_diff, min_diff, monitor_freq, batt_num)

      if i == 1:
        ch1_state = state
      elif i == 2:
        ch2_state = state
      elif i == 3:
        ch3_state = state
      elif i == 4:
        ch4_state = state
      else:
        raise Exception, 'Unknown range.'

      tom.close()

    if batt_num == '1':

      if ch1_state == 1:
        break

    elif batt_num == '2':

      if ch1_state == 1 and ch2_state == 1:
        break

    elif batt_num == '3':

      if ch1_state == 1 and ch2_state == 1 and ch3_state == 1:
        break

    elif batt_num == '4':

      if ch1_state == 1 and ch2_state == 1 and ch3_state == 1 and ch4_state == 1:
        break

    print "Checking measurement again in another %s seconds" % monitor_freq
    sleep(monitor_freq)