Exemplo n.º 1
0
 def __init__(self, antenna):
   self.antenna = antenna.upper()
   self.mount_ctrl = None
   self.mount = None
   try:
     self.mount_ctrl = MountController(antenna)
     self.mount = self.mount_ctrl.getMount()
     self.AntennaStatus()
   except:
     print "Could not get Mount for %s" % (self.antenna)
Exemplo n.º 2
0
 def __init__(self , input_ = None, output_ = None , mount_c = None):
     self.input = input_
     self.output = output_
     self.mount_c = mount_c
     if(input_ is None):
         self.input = 'test.dat'
     if(output_ is None):
         file = self.input.split('.')
         self.output = str(file[0])+'_az_el.dat'
     if(mount_c is None):
         self.mount_c = MountController('ALMA03')
Exemplo n.º 3
0
    #Get the delay server from generalUtil
    sds = sfi_obs_mode.getDelayServer()

    logger.logInfo("Single Field Interferometry Observing Mode has been created")

    logger.logInfo("Running for %d sources, be patient" %len(sourceList))

    nrepeats=options.repeats
    for i in range(nrepeats):
        if (nrepeats>1):
            print "repeat number", (i+1)

        for src in sourceList:
#            if ((vlsr[src.getSourceName()] is not None ) and (ast.isObservable(src, 20.))):
            from CCL.MountController import MountController
            mc = MountController(antennaList[0])
            ra,dec = src.getRADec()
            if ((vlsr[src.getSourceName()] is not None ) and mc.isObservableEquatorial(ra,dec)):
                logger.logInfo(" Observing %s" % src.getSourceName())
                #vtopo = ast.getSourceTopoVelocity(src,vlsr[src.getSourceName()])
                #logger.logInfo(" Source velocity is %10.3f km/s LSR, or %10.3f km/s TOPO" % (vlsr[src.getSourceName()]/1e3,
                #                                                                             vtopo/1e3))
                #topoFreq = restFreq*(1.-vtopo/299792458.)
                topoFreq = ast.getTopoFrequency(src, vlsr[src.getSourceName()], restFreq)
                logger.logInfo("Topocentric Frequency is %12.6f GHz" % (topoFreq /1e9) )
                #
                # Optionally tune to center the line
                if options.tuneFrequency:
                    obsFreq = topoFreq + gU.bandOffset
                #
                # channel where the line center should be:
Exemplo n.º 4
0
def AntennaStatus(antname):
  #print "Antenna Name ?: " 
  AntennaName=string.upper(antname) #raw_input().upper()
  #print AntennaName
#  abm = AutoTesting.Utils.Utils()
#  ActualABM = abm.ping_abm()
  #print ActualABM
  R = chr(27)+"[1;91m"
  G = chr(27)+"[1;92m"
  B = chr(27)+"[1;94m"
  Y = chr(27)+"[1;93m"
  T = chr(27)+"[0m"

#  AntennaExist= ActualABM.count(AntennaName)
  AntennaExist= 2
  if AntennaExist >= 1 :

        if AntennaName.startswith("DV")==True:

          from CCL.MountController import MountController
          mc=MountController(AntennaName)
          mount=mc.getMount()

          
          '''Azimuth status bytes'''
          AZ_STATUS=(mount._HardwareDevice__hw.GET_AZ_STATUS())
          AZ_Motor_Temp_raw=(mount._HardwareDevice__hw.GET_AZ_MOTOR_TEMPS())

          AZ_Motor_Temps = AZ_Motor_Temp_raw[0]
          
          Motor1_Temp = AZ_Motor_Temps[0]- 50
          Motor2_Temp = AZ_Motor_Temps[1]- 50


          azstb1= AZ_STATUS[0]
          azByte1=dec2bin(azstb1[1],'76543210')
          azByte2=dec2bin(azstb1[2],'76543210')
          azByte3=dec2bin(azstb1[3],'76543210')
          azByte4=dec2bin(azstb1[4],'76543210')
          azByte6=dec2bin(azstb1[6],'76543210')
          azByte7=dec2bin(azstb1[7],'76543210')

          #Byte 1
          if azByte1[7]=='1':azbit1_0=R+"FAILURE"+T #Servo Failure
          else:
              azbit1_0=G+"OK"+T
              
          if azByte1[3]=='1':azbit1_4=G+"Stow"+T    # Stow position
          else:
              azbit1_4=G+"UnStow"+T
              
          if azByte1[2]=='1':azbit1_5=R+"FAILURE"+T #Encoder Failure
          else:
              azbit1_5=G+"OK"+T
              
          if azByte1[1]=='1':azbit1_6=R+"ERR"+T     #Insane velocity feedback
          else:
              azbit1_6=G+"OK"+T

          #Byte 2    
          if azByte2[7]=='1':azbit2_0=R+"FAILURE"+T #Brake 1 Failure
          else:
              azbit2_0=G+"OK"+T
              
          if azByte2[6]=='1':azbit2_1=R+"FAILURE"+T #Brake 2 Failure
          else:
              azbit2_1=G+"OK"+T

          #Byte 3    
          if azByte3[7]=='1':azbit3_0=R+"FAILURE"+T #Servo Amp. 1 Failure
          else:
              azbit3_0=G+"OK"+T
              
          if azByte3[6]=='1':azbit3_1=R+"FAILURE"+T #Servo Amp. 2 Failure
          else:
              azbit3_1=G+"OK"+T
              
          if azByte3[2]=='1':azbit3_5=R+"FAILURE"+T #Breaker Failure
          else:
              azbit3_5=G+"OK"+T

          #Byte 4    
          if azByte4[7]=='1':bit4_0=R+"OVERTEMP"+T      #Motor 1 Overtemp
          else:
              azbit4_0=G+"OK"+T
              
          if azByte4[6]=='1':azbit4_1=R+"HIGH"+T        #Motor 2 Overtemp        
          else:
              azbit4_1=G+"OK"+T
              
          if azByte4[2]=='1':azbit4_5=R+"YES"+T         #Servo Oscilation
          else:
              azbit4_5=G+"NO"+T
              
          if azByte4[1]=='1':azbit4_6=R+"FAILURE"+T     #Aux. Encoder Failure
          else:
              azbit4_6=G+"OK"+T
              
          #Byte 6    
          if azByte6[3]=='1':azbit6_4=R+"Warning"+T     #Gear Box 1 Oil level
          else:
              azbit6_4=G+"Normal"+T
              
          if azByte6[2]=='1':azbit6_5=R+"Warning"+T     #Gear Box 2 Oil Level 
          else:
              azbit6_5=G+"Normal"+T

          #Byte 7

          if azByte7[3]=='1':azbit7_4=R+"ERR"+T         #Flip-Flop Buffer
          else:
              azbit7_4=G+"OK"+T




              
              
          ''' ************************* '''    


          ''' Elevation Status Bytes ''' 

          EL_STATUS=(mount._HardwareDevice__hw.GET_EL_STATUS())
          EL_Motor_temps_raw = (mount._HardwareDevice__hw.GET_EL_MOTOR_TEMPS())

          elstb1= EL_STATUS[0]
          elByte0=dec2bin(elstb1[0],'76543210')
          elByte1=dec2bin(elstb1[1],'76543210')
          elByte2=dec2bin(elstb1[2],'76543210')
          elByte3=dec2bin(elstb1[3],'76543210')
          elByte4=dec2bin(elstb1[4],'76543210')
          elByte6=dec2bin(elstb1[6],'76543210')

          EL_Motors_temps = EL_Motor_temps_raw[0]
          EL_Motor_1 = EL_Motors_temps[0]-50
          EL_Motor_2 = EL_Motors_temps[1]-50
          EL_Motor_3 = EL_Motors_temps[2]-50
          EL_Motor_4 = EL_Motors_temps[3]-50

          #Byte 0

          if elByte0[7]=='1':elbit0_0=B+"SET"+T #Prelimit UP
          else:
              elbit0_0=B+"UNSET"+T

          if elByte0[6]=='1':elbit0_1=B+"SET"+T #Prelimit DOWN"
          else:
              elbit0_1=B+"UNSET"+T

          #Byte 1

          if elByte1[7]=='1':elbit1_0=R+"FAILURE"+T   #Servo Failure
          else:
              elbit1_0=G+"OK"+T
              
          if elByte1[3]=='1':elbit1_4=G+"Stow"+T      #Stow Position
          else:
              elbit1_4=G+"UnStow"+T
              
          if elByte1[2]=='1':elbit1_5=R+"FAILURE"+T   #Encoder Failure
          else:
              elbit1_5=G+"OK"+T
              
          if elByte1[1]=='1':elbit1_6=R+"ERR"+T       #Insane Velocity Feedack
          else:
              elbit1_6=G+"OK"+T

          #Byte 2    
          if elByte2[7]=='1':elbit2_0=R+"FAILURE"+T   #Brake 1 Failure 
          else:
              elbit2_0=G+"OK"+T
              
          if elByte2[6]=='1':elbit2_1=R+"FAILURE"+T   #Brake 2 Failure
          else:
              elbit2_1=G+"OK"+T
              
          if elByte2[5]=='1':elbit2_2=R+"FAILURE"+T   #Brake 3 Failure
          else:
              elbit2_2=G+"OK"+T
              
          if elByte2[4]=='1':elbit2_3=R+"FAILURE"+T   #Brake 4 Failure
          else:
              elbit2_3=G+"OK"+T

              

          #Byte 3    
          if elByte3[7]=='1':elbit3_0=R+"FAILURE"+T   #Servo Ampl. 1 Failure
          else:
              elbit3_0=G+"OK"+T
              
          if elByte3[6]=='1':elbit3_1=R+"FAILURE"+T   #Servo Ampl. 2 Failure
          else:
              elbit3_1=G+"OK"+T
              
          if elByte3[5]=='1':elbit3_2=R+"FAILURE"+T   #Servo Ampl. 3 Failure
          else:
              elbit3_2=G+"OK"+T
              
          if elByte3[4]=='1':elbit3_3=R+"FAILURE"+T   #Servo Ampl. 4 Failure
          else:
              elbit3_3=G+"OK"+T
              
          if elByte3[2]=='1':elbit3_5=R+"FAILURE"+T   #Breaker Failure
          else:
              elbit3_5=G+"OK"+T

             

          #Byte 4
          if elByte4[7]=='1':elbit4_0=R+"OVERTEMP"+T  #Motor 1 Overtemp.
          else:
              elbit4_0=G+"OK"+T
              
          if elByte4[6]=='1':elbit4_1=R+"OVERTEMP"+T  #Motor 2 Overtemp.
          else:
              elbit4_1=G+"OK"+T
              
          if elByte4[5]=='1':elbit4_2=R+"OVERTEMP"+T  #Motor 3 Overtemp.
          else:
              elbit4_2=G+"OK"+T
              
          if elByte4[4]=='1':elbit4_3=R+"OVERTEMP"+T  #Motor 4 Overtemp.
          else:
              elbit4_3=G+"OK"+T
              
          if elByte4[2]=='1':elbit4_5=R+"YES"+T       #Servo Oscilation
          else:
              elbit4_5=G+"NO"+T
              
          if elByte4[1]=='1':elbit4_6=R+"FAILURE"+T   #Aux. Encoder Failure      
          else:
              elbit4_6=G+"OK"+T

          #Byte 6
          if elByte6[3]=='1':elbit6_4=R+"Warning"+T   #Gear Box 1 oil Level
          else:
              elbit6_4=G+"Normal"+T
              
          if elByte6[2]=='1':elbit6_5=R+"Warning"+T   #Gear Box 2 oil Level
          else:
              elbit6_5=G+"Normal"+T
              
          if elByte6[1]=='1':elbit6_6=R+"Warning"+T   #Gear Box 3 oil Level
          else:
              elbit6_6=G+"Normal"+T
              
          if elByte6[0]=='1':elbit6_7=R+"Warning"+T   #Gear Box 4 oil Level
          else:
              elbit6_7=G+"Normal"+T




          ''' SYSTEM STATUS '''

          SYS_STATUS=(mount._HardwareDevice__hw.GET_SYSTEM_STATUS())

          sysstat=SYS_STATUS[0]
          sysbyte0=dec2bin(sysstat[0],'76543210')
          sysbyte1=dec2bin(sysstat[1],'76543210')
          sysbyte2=dec2bin(sysstat[2],'76543210')
          sysbyte3=dec2bin(sysstat[3],'76543210')
          sysbyte4=dec2bin(sysstat[4],'76543210')


          #Byte 0
          if sysbyte0[7]=='1':stbit0_0=R+"Applied"+T  # E-Stop
          else:
              stbit0_0=G+"Released"+T
              
          if sysbyte0[6]=='1':stbit0_1=Y+"Applied"  #Stairway Interlock
          else:
              stbit0_1=G+"Released"+T


          #Byte 1

          if sysbyte1[7]=='1':stbit1_0=Y+"Applied"+T  # Safe switch
          else:
              stbit1_0=G+"Released"+T


          if sysbyte1[0]=='1':stbit1_7=R+"Applied"+T  #ALMA E-Stop
          else:
              stbit1_7=G+"Released"+T
              



          #Byte 2

          if sysbyte2[3]=='0':stbit2_4=G+"Retracted"+T #Ladder 
          else:
              stbit2_4=Y+"Extended"+T    




          #Byte 3

          if sysbyte3=='00000001':EstopPos="Drive Cabinet"
          if sysbyte3=='00000010':EstopPos="AZ Motors"
          if sysbyte3=='00000100':EstopPos="Inside Antenna Base"
          if sysbyte3=='00001000':EstopPos="Platform 2"
          if sysbyte3=='00010000':EstopPos="Ladder Platf. 1"
          if sysbyte3=='00100000':EstopPos="Receiver Cabin"
          if sysbyte3=='01000000':EstopPos="Portable Control Un."
          if sysbyte3=='10000000':EstopPos="Outside Pedestal"
          if sysbyte3=='00000000':EstopPos=""
          else:
              EstopPos="ERROR"   

          #ACU Information

          ACU_MODE=(mount._HardwareDevice__hw.GET_ACU_MODE_RSP())
          acumode=ACU_MODE[0]
          acubyte0=dec2bin(acumode[0],'76543210')
          acubyte1=dec2bin(acumode[1],'76543210')

          az_mode=acubyte0[0]+acubyte0[1]+acubyte0[2]+acubyte0[3]

          if az_mode=='0000':azmode=B+"Shutdown"+T
          elif az_mode=='0001':azmode=B+"Standby"+T
          elif az_mode=='0010':azmode=B+"Encoder"+T
          elif az_mode=='0011':azmode=B+"Autonomus"+T
          elif az_mode=='0100':azmode=B+"Survival Stow"+T
          elif az_mode=='0101':azmode=B+"Maintenance Stow"+T
          elif az_mode=='0110':azmode=B+"Velocity"+T
          elif az_mode=='0111':azmode=B+"Sefltest"+T
          else: azmode="ERR"


          el_mode=acubyte0[4]+acubyte0[5]+acubyte0[6]+acubyte0[7]

          if el_mode=='0000':elmode=B+"Shutdown"+T
          elif el_mode=='0001':elmode=B+"Standby"+T
          elif el_mode=='0010':elmode=B+"Encoder"+T
          elif el_mode=='0011':elmode=B+"Autonomus"+T
          elif el_mode=='0100':elmode=B+"Survival Stow"+T
          elif el_mode=='0101':elmode=B+"Maintenance Stow"+T
          elif el_mode=='0110':elmode=B+"Velocity"+T
          elif el_mode=='0111':elmode=B+"Selftest"+T
          else: elmode="ERR"



          if acubyte1=='00000001':acu_mode=Y+"LOCAL"+T
          elif acubyte1=='00000010':acu_mode=B+"REMOTE"+T
          elif acubyte1=='00000011':acu_mode=Y+"DISABLED"+T
          elif acubyte1=='00000100':acu_mode=Y+"PCU"+T
              

          print "\n"	
          print chr(27)+"[1;95m"+" ##### Antenna Status: %3s" %AntennaName +"\n"+T
          print " ACU Status: %6s        E-Stop: %8s      Location:%20s      " %(acu_mode, stbit0_0, EstopPos)
          print " Safety Switch: %8s   Ladder: %9s     ALMA E-Stop: %6s   " %(stbit1_0, stbit2_4, stbit1_7)
          print "\n"  
          print chr(27)+"[1;95m"+" **********AZIMUTH STATUS**********"+T
          print " Mode: %16s                               " %(azmode)
          print " Servo Status: %3s         Stow Position    : %6s  " %(azbit1_0,azbit1_4)
          print " Encoder     : %3s         Velocity Feedback: %3s" %(azbit1_5,azbit1_6)
          print " Brake 1     : %3s         Brake 2          : %3s         " %(azbit2_0,azbit2_1)
          print " Servo 1     : %3s         Servo 2 : %3s      Breaker: %3s        " %(azbit3_0,azbit3_1,azbit3_5)
          print " Motor 1 Temp: %4s         Motor 2 Temp     : %4s                     " %(azbit4_0,azbit4_1)
          print " Servo Osc   : %3s         Aux. Encoder     : %3s                    " %(azbit4_5,azbit4_6)
          print " GearBox 1 Oil Lvl: %7s    GearBox 2 Oil Lvl: %7s            " %(azbit6_4,azbit6_5)
          print " Flip-Flop Buffer Pos.  : %3s                                     " %(azbit7_4)
          print " Motors Temperatures (C):                                 "
          print " Motor 1 : %3s  Motor 2 : %3s                              " %(Motor1_Temp,Motor2_Temp)
          print "\n"
          print chr(27)+"[1;95m"+" **********ELEVATION STATUS**********"+T
          print " Mode: %16s                                " %(elmode)
          print " Servo Status: %6s         Stow Position    : %6s   " %(elbit1_0,elbit1_4)
          print " Prelimit Up : %6s         Prelimit Down    : %6s   " %(elbit0_0,elbit0_1)
          print " Encoder     : %3s         Velocity Feedback: %3s" %(elbit1_5,elbit1_6)
          print " Brake 1     : %3s         Brake 2: %3s               " %(elbit2_0,elbit2_1)
          print " Brake 3     : %3s         Brake 4: %3s               " %(elbit2_2,elbit2_3)
          print " Servo 1     : %3s         Servo 2: %3s               " %(elbit3_0,elbit3_1)
          print " Servo 3     : %3s         Servo 4: %3s               " %(elbit3_2,elbit3_3)
          print " Breaker     : %3s                                    " %(elbit3_5)
          print " Motor 1 Temp:%4s    Motor 2 Temp:%4s     " %(elbit4_0,elbit4_1)
          print " Motor 3 Temp:%4s    Motor 4 Temp:%4s     " %(elbit4_2,elbit4_3)
          print " Servo Osc   : %3s   Aux. Encoder: %3s                    " %(elbit4_5,elbit4_6)
          print " GearBox 1 Oil Lvl: %7s       GearBox 2 Oil Lvl: %7s            " %(elbit6_4,elbit6_5)
          print " GearBox 3 Oil Lvl: %7s       GearBox 4 Oil Lvl: %7s            " %(elbit6_6,elbit6_7)
          print " Motors Temperatures (C):                                  "
          print " Motor 1: %3s  Motor 2: %3s  Motor 3: %3s  Motor 4: %3s   " %(EL_Motor_1,EL_Motor_2,EL_Motor_3,EL_Motor_4)
          print "\n"
          print chr(27)+"[1;95m"+" *************************************"+T

          getContainerServices().disconnect() 

######### FROM HERE IS THE STATUS BYTE FOR MELCo ACA 12 y 7 mt  ##########


        elif AntennaName.startswith("PM")==True:

          


          from CCL.MountController import MountController
          mc=MountController(AntennaName)
          mount=mc.getMount()

          
          '''Azimuth status bytes'''
          AZ_STATUS_1=(mount._HardwareDevice__hw.GET_AZ_STATUS())
          AZ_STATUS_2= (mount._HardwareDevice__hw.GET_AZ_STATUS_2())

          AZ_Motor_Temp_raw=(mount._HardwareDevice__hw.GET_AZ_MOTOR_TEMPS())

          AZ_Motor_Temps = AZ_Motor_Temp_raw[0]
          
          MotorL1_Temp = AZ_Motor_Temps[0]- 50
          MotorL2_Temp = AZ_Motor_Temps[1]- 50
          MotorR1_Temp = AZ_Motor_Temps[2]- 50
          MotorR2_Temp = AZ_Motor_Temps[3]- 50




          azstb1= AZ_STATUS_1[0]
          azByte1_2=dec2bin(azstb1[2],'76543210')
          azByte1_3=dec2bin(azstb1[3],'76543210')
          azByte1_4=dec2bin(azstb1[4],'76543210')
          azByte1_5=dec2bin(azstb1[5],'76543210')
          azByte1_6=dec2bin(azstb1[6],'76543210')
          azByte1_7=dec2bin(azstb1[7],'76543210')



          azstb2= AZ_STATUS_2[0]
          azByte2_1=dec2bin(azstb2[1],'76543210')
          azByte2_2=dec2bin(azstb2[2],'76543210')
          azByte2_3=dec2bin(azstb2[3],'76543210')
          azByte2_4=dec2bin(azstb2[4],'76543210')
          azByte2_5=dec2bin(azstb2[5],'76543210')
          azByte2_6=dec2bin(azstb2[6],'76543210')
          azByte2_7=dec2bin(azstb2[7],'76543210')



          #### AZ Status 1 #####

          #Byte 1
          
          
         
          #Byte 2    
          if azByte1_2[7]=='1':azbit2_0=R+"FAIL"+T #AZ-L1 DPA Fault
          else:
              azbit2_0=G+"OK"+T
              
          if azByte1_2[6]=='1':azbit2_1=R+"FAIL"+T #AZ-L2 DPA Fault
          else:
              azbit2_1=G+"OK"+T

          if azByte1_2[5]=='1':azbit2_2=R+"FAIL"+T #AZ-R1 DPA Fault
          else:
              azbit2_2=G+"OK"+T

          if azByte1_2[4]=='1':azbit2_3=R+"FAIL"+T #AZ-R2 DPA Fault
          else:
              azbit2_3=G+"OK"+T


          if azByte1_2[3]=='1':azbit2_4=R+"FAIL"+T #AZ-L1 motor overheat
          else:
              azbit2_4=G+"OK"+T

          if azByte1_2[2]=='1':azbit2_5=R+"FAIL"+T #AZ-L2 motor overheat
          else:
              azbit2_5=G+"OK"+T

          if azByte1_2[1]=='1':azbit2_6=R+"FAIL"+T #AZ-R1 motor overheat
          else:
              azbit2_6=G+"OK"+T

          if azByte1_2[0]=='1':azbit2_7=R+"FAIL"+T #AZ-R2 motor overheat
          else:
              azbit2_7=G+"OK"+T
    

              

          #Byte 3    
          if azByte1_3[7]=='1':azbit3_0=R+"FAILURE"+T # AZ-L1 capacitor bank fault
          else:
              azbit3_0=G+"OK"+T
              
          if azByte1_3[6]=='1':azbit3_1=R+"FAILURE"+T # AZ-L2 capacitor bank fault
          else:
              azbit3_1=G+"OK"+T
              
          if azByte1_3[5]=='1':azbit3_2=R+"FAILURE"+T # AZ-R1 capacitor bank fault
          else:
              azbit3_2=G+"OK"+T

          if azByte1_3[4]=='1':azbit3_3=R+"FAILURE"+T # AZ-R2 capacitor bank fault
          else:
              azbit3_3=G+"OK"+T



            

          #Byte 4    
          if azByte1_4[7]=='1':bit4_0=R+"OVERCURRENT"+T      # AZ-L1 excessive current
          else:
              azbit4_0=G+"OK"+T
              
          if azByte1_4[6]=='1':azbit4_1=R+"OVERCURRENT"+T        # AZ-L2 excessive current        
          else:
              azbit4_1=G+"OK"+T
              
          if azByte1_4[5]=='1':azbit4_2=R+"OVERCURRENT"+T         # AZ-R1 excessive current
          else:
              azbit4_2=G+"NO"+T
              
          if azByte1_4[4]=='1':azbit4_3=R+"OVERCURRENT"+T     # AZ-R2 excessive current
          else:
              azbit4_3=G+"OK"+T



          #Byte 5
          if azByte1_5[7]=='1':bit5_0=B+"ON"+T      # AZ-L DCPA rack circuit breaker off
          else:
              azbit5_0=B+"OFF"+T

          if azByte1_5[6]=='1':bit5_1=B+"ON"+T      # AZ-R DCPA rack circuit breaker off
          else:
              azbit5_1=B+"OFF"+T


          if azByte1_5[4]=='1':bit5_3=R+"FAILURE"+T      # AZ-ALL encoder alarm
          else:
              azbit5_3=G+"OK"+T
              
           
              
              
          #Byte 6    
          if azByte1_6[3]=='1':azbit6_4=R+"Failure"+T     #brake power failure
          else:
              azbit6_4=G+"OK"+T
              
          if azByte1_6[2]=='1':azbit6_5=R+"BLOWN"+T     #brake power supply fuse blow 
          else:
              azbit6_5=G+"OK"+T

          #Byte 7

          if azByte1_7[7]=='1':azbit7_0=B+"STOW"+T         #survival stow position
          else:
              azbit7_0=B+"UNSTOW"+T

          if azByte1_7[6]=='1':azbit7_1=B+"STOW"+T         #maintenance stow position
          else:
              azbit7_1=B+"UNSTOW"+T




          #### AZ STATUS 2 ####




          #Byte 3

          if azByte2_3[7]=='1':az2bit3_0=R+"FAILURE"+T         #position filter fault
          else:
              az2bit3_0=G+"OK"+T

          if azByte2_3[6]=='1':az2bit3_1=R+"FAILURE"+T         #major filter fault
          else:
              az2bit3_1=G+"OK"+T

          if azByte2_3[5]=='1':az2bit3_2=R+"FAILURE"+T         #minor filter fault
          else:
              az2bit3_2=G+"OK"+T

          if azByte2_3[4]=='1':az2bit3_3=R+"FAILURE"+T         #feedback filter fault
          else:
              az2bit3_3=G+"OK"+T
          
          
          #Byte 5

          if azByte2_5[7]=='1':az2bit5_0=R+"FAILURE"+T         #brake axis DPA fault
          else:
              az2bit5_0=G+"OK"+T

          if azByte2_5[6]=='1':az2bit5_1=B+"ON"+T             #brake axis DPA circuit breaker off
          else:
              az2bit5_1=B+"OFF"+T


          if azByte2_5[5]=='1':az2bit5_2=B+"ON"+T             #brake axis DPA contactor off
          else:
              az2bit5_2=B+"OFF"+T


          if azByte2_5[4]=='1':az2bit5_3=B+"ON"+T             #brake axis resolver disconnected
          else:
              az2bit5_3=B+"OFF"+T

          if azByte2_5[0]=='1':az2bit5_7=R+"TIME OUT"+T       #brake axis drive time out
          else:
              az2bit5_7=G+"OK"+T
              


              
              
          ''' ************************* '''    


          ''' Elevation Status Bytes ''' 

          EL_STATUS=(mount._HardwareDevice__hw.GET_EL_STATUS())

          EL_Motor_temps_raw = (mount._HardwareDevice__hw.GET_EL_MOTOR_TEMPS())  

          elstb1= EL_STATUS[0]
          elByte0=dec2bin(elstb1[0],'76543210')
          elByte1=dec2bin(elstb1[1],'76543210')
          elByte2=dec2bin(elstb1[2],'76543210')
          elByte3=dec2bin(elstb1[3],'76543210')
          elByte4=dec2bin(elstb1[4],'76543210')
          elByte5=dec2bin(elstb1[5],'76543210')
          elByte6=dec2bin(elstb1[6],'76543210')

          EL_Motors_temps = EL_Motor_temps_raw[0]
          EL_Motor_L = EL_Motors_temps[0]-50
          EL_Motor_R = EL_Motors_temps[1]-50
          

          #Byte 0

         

          #Byte 2    
          if elByte2[7]=='1':elbit2_0=R+"FAILURE"+T   #EL-L DPA fault  
          else:
              elbit2_0=G+"OK"+T
              
          if elByte2[6]=='1':elbit2_1=R+"FAILURE"+T   #EL-R DPA fault
          else:
              elbit2_1=G+"OK"+T
              
          if elByte2[3]=='1':elbit2_4=R+"OVERHEAT"+T   #EL-L motor overheat
          else:
              elbit2_2=G+"OK"+T
              
          if elByte2[2]=='1':elbit2_5=R+"OVERHEAT"+T   #EL-R motor overheat
          else:
              elbit2_3=G+"OK"+T

              

          #Byte 3    
          if elByte3[7]=='1':elbit3_0=R+"FAILURE"+T   #EL-L capacitor bank fault
          else:
              elbit3_0=G+"OK"+T
              
          if elByte3[6]=='1':elbit3_1=R+"FAILURE"+T   #EL-R capacitor bank fault
          else:
              elbit3_1=G+"OK"+T
              
          

             

          #Byte 4
          if elByte4[7]=='1':elbit4_0=R+"OVERCURRENT"+T  #EL-L excessive current
          else:
              elbit4_0=G+"OK"+T
              
          if elByte4[6]=='1':elbit4_1=R+"OVERCURRENT"+T  #EL-R excessive current
          else:
              elbit4_1=G+"OK"+T


          #Byte 5
          if elByte5[4]=='1':elbit5_3=R+"FAULT"+T  #EL-all econder fault
          else:
              elbit5_3=G+"OK"+T

          
              
         
          #Byte 6
          if elByte6[3]=='1':elbit6_4=R+"Failure"+T   #Brake power failure
          else:
              elbit6_4=G+"Normal"+T
              
          if elByte6[2]=='1':elbit6_5=R+"Failure"+T   #Brake power supply fuse blow
          else:
              elbit6_5=G+"Normal"+T
              
        



          ''' SYSTEM STATUS '''

          SYS_STATUS=(mount._HardwareDevice__hw.GET_SYSTEM_STATUS())

          sysstat=SYS_STATUS[0]
          sysbyte0=dec2bin(sysstat[0],'76543210')
          sysbyte1=dec2bin(sysstat[1],'76543210')
          sysbyte2=dec2bin(sysstat[2],'76543210')
          sysbyte3=dec2bin(sysstat[3],'76543210')
          sysbyte4=dec2bin(sysstat[4],'76543210')


          #Byte 0
          if sysbyte0[7]=='1':stbit0_0=R+"Applied"+T  # E-Stop
          else:
              stbit0_0=G+"Released"+T
              
          if sysbyte0[6]=='1':stbit0_1=Y+"Applied"+T  #Stairway Interlock
          else:
              stbit0_1=B+"Released"+T

          if sysbyte0[0]=='1':stbit0_7=R+"ERR"+T       #TE Missing


          #Byte 1

          if sysbyte1[6]=='1':stbit1_1=Y+"Applied"+T  # Safe switch
          else:
              stbit1_1=B+"Released"+T


          if sysbyte1[4]=='1':stbit1_3=Y+"Extended"+T # Ladder
          else:
              stbit1_3=B+"Retracted"+T


          if sysbyte1[0]=='1':stbit1_7=R+"Applied"+T  #ALMA E-Stop
          else:
              stbit1_7=G+"Released"+T
              



          #Byte 2

          if sysbyte2[3]=='0':stbit2_4="Retracted" #Ladder 
          else:
              stbit2_4="Extended"    




          #Byte 3

          if sysbyte3=='00000001':EstopPos="Drive Cabinet"
          if sysbyte3=='00000010':EstopPos="AZ Motors"
          if sysbyte3=='00000100':EstopPos="Inside Antenna Base"
          if sysbyte3=='00001000':EstopPos="Platform 2"
          if sysbyte3=='00010000':EstopPos="Ladder Platf. 1"
          if sysbyte3=='00100000':EstopPos="Receiver Cabin"
          if sysbyte3=='01000000':EstopPos="Portable Control Un."
          if sysbyte3=='10000000':EstopPos="Outside Pedestal"
          if sysbyte3=='00000000':EstopPos=""
          else:
              EstopPos="ERROR"   

          #ACU Information

          ACU_MODE=(mount._HardwareDevice__hw.GET_ACU_MODE_RSP())
          acumode=ACU_MODE[0]
          acubyte0=dec2bin(acumode[0],'76543210')
          acubyte1=dec2bin(acumode[1],'76543210')

          az_mode=acubyte0[0]+acubyte0[1]+acubyte0[2]+acubyte0[3]

          if az_mode=='0000':azmode="Shutdown"
          elif az_mode=='0001':azmode="Standby"
          elif az_mode=='0010':azmode="Encoder"
          elif az_mode=='0011':azmode="Autonomus"
          elif az_mode=='0100':azmode="Survival Stow"
          elif az_mode=='0101':azmode="Maintenance Stow"
          elif az_mode=='0110':azmode="Velocity"
          elif az_mode=='0111':azmode="Sefltest"
          else: azmode="ERR"


          el_mode=acubyte0[4]+acubyte0[5]+acubyte0[6]+acubyte0[7]

          if el_mode=='0000':elmode="Shutdown"
          elif el_mode=='0001':elmode="Standby"
          elif el_mode=='0010':elmode="Encoder"
          elif el_mode=='0011':elmode="Autonomus"
          elif el_mode=='0100':elmode="Survival Stow"
          elif el_mode=='0101':elmode="Maintenance Stow"
          elif el_mode=='0110':elmode="Velocity"
          elif el_mode=='0111':elmode="Selftest"
          else: elmode="ERR"



          if acubyte1=='00000001':acu_mode="LOCAL"
          elif acubyte1=='00000010':acu_mode="REMOTE"
              

          print "\n"	
          print chr(27)+"[1;95m"+" ##### Antenna Status: %3s" %AntennaName +"\n"+T
          print " ACU Status: %6s        E-Stop: %8s      Location:%20s      " %(acu_mode, stbit0_0, EstopPos)
          print " Safety Switch: %8s   Ladder: %9s        ALMA E-Stop:       " %(stbit1_1, stbit1_3)
          print "\n"  
          print chr(27)+"[1;95m"+" **********AZIMUTH STATUS**********"+T
          print " Mode: %16s                               " %(azmode)
          print " AZ-L1 DPA    : %3s   AZ-L2 DPA    : %3s          " %(azbit2_0,azbit2_1)
          print " AZ-R1 DPA    : %3s   AZ-R2 DPA    : %3s          " %(azbit2_2,azbit2_3)
          print " AZ-L1 Motor  : %3s   AZ-L2 Motor  : %3s          " %(azbit2_4,azbit2_5)
          print " AZ-R1 Motor  : %3s   AZ-R2 Motor  : %3s          " %(azbit2_6,azbit2_7)
          print " AZ-L1 Bank   : %3s   AZ-L2 Bank   : %3s          " %(azbit3_0,azbit3_1)
          print " AZ-R1 Bank   : %3s   AZ-R2 Bank   : %3s          " %(azbit3_2,azbit3_3)
          print " AZ-L1 Current: %3s   AZ-L2 Current: %3s          " %(azbit4_0,azbit4_1)
          print " AZ-R1 Current: %3s   AZ-R2 Current: %3s          " %(azbit4_2,azbit4_3)
          print " AZ-L DCPA    : %3s   AZ-R DCPA    : %3s          " %(azbit5_0,azbit5_1)
          print " Encoder: %3s                                     " %(azbit5_3)
          print " Motors Temperatures (C):                             "
          print " L1: %3s   L2: %3s   R1: %3s   R2: %3s                " %(MotorL1_Temp,MotorL2_Temp,MotorR1_Temp,MotorR2_Temp)
          print "\n"
          print chr(27)+"[1;95m"+" **********ELEVATION STATUS**********"+T
          print " Mode: %16s                                " %(elmode)
          print " EL-L DPA     : %3s   EL-R DPA     : %3s          " %(azbit2_0,azbit2_1)
          print " EL-L Motor   : %3s   EL-R Motor   : %3s          " %(azbit2_4,azbit2_5)
          print " EL-L Bank    : %3s   EL-R Bank    : %3s          " %(azbit3_0,azbit3_1)
          print " EL-L  Current: %3s   EL-R  Current: %3s          " %(azbit4_0,azbit4_1)
          print " EL   DCPA    : %3s                               " %(azbit5_0)
          print " Encoder: %3s                                     " %(azbit5_3)
          print " Motors Temperatures (C):                         "
          print " L: %3s   R: %3s                                  " %(EL_Motor_L,EL_Motor_R)
          print "\n"
          print chr(27)+"[1;95m"+" *************************************"+T

          getContainerServices().disconnect()
          

        elif AntennaName.startswith("CM")==True:

          print "The script is not ready for MELCo 7 mt"
          
          getContainerServices().disconnect()

        elif AntennaName.startswith("DA")==True:

          print "The script is not ready for AEM"
          
          getContainerServices().disconnect() 

        else:

          print " You should select the correct antenna, i.e.: "  + "DV01" + "," + " PM03" 

          getContainerServices().disconnect()


  else:

    print " ##### The antenna " + antname + " does not exist on this STE #####"

    getContainerServices().disconnect()
Exemplo n.º 5
0
class radec2azel:
    def __init__(self , input_ = None, output_ = None , mount_c = None):
        self.input = input_
        self.output = output_
        self.mount_c = mount_c
        if(input_ is None):
            self.input = 'test.dat'
        if(output_ is None):
            file = self.input.split('.')
            self.output = str(file[0])+'_az_el.dat'
        if(mount_c is None):
            self.mount_c = MountController('ALMA03')
    def parse(self):
        fd = open(self.input)
        nfd = open(self.output,'w')
        lines = fd.readlines()
        movie = ['| converting ...','/ converting ...','- converting ...','\\ converting ...']
        for line in lines:
            c = movie.pop(0)
            stderr.write(c)
            stderr.flush()
            stderr.write('\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b')
            stderr.flush()
            if(line.rfind('#') == 0):
                nfd.write(line)
            elif(line.rfind('Starname RaDeg DeDeg Vt PmRa PmDe Prlx') == 0 ):
                nfd.write(line)
            elif(line.rfind('---------') == 0):
                nfd.write(line)
            else:
                new_coord =''
                try:
                    line = line.rstrip('\n')
                    nfd.write(line)
                    parameters = line.split(' ')
                    count = 0
                    for char in parameters:
                        if(char is ''):
                            pass
                        else:
                            count+=1
                            if(count == 3):
                                ra = char
                            elif(count == 4):
                                dec = char
                                break
                    ra_  = str(ra)
                    dec_ = str(dec)
                    ra   = float(ra_.rstrip('\t'))
                    dec  = float(dec_.rstrip('\t'))
                    ra = radians(ra)
                    dec = radians(dec)
                    (az,el) = self.mount_c.toAzEl(ra,dec)
                    az = az * (180/pi)
                    el = el * (180/pi)
                    new_coord = '\n#'+str(az)+' '+str(el)+'\n'
                except IndexError:
                    pass
                nfd.write(new_coord)
            movie.append(c)
        fd.close()
        nfd.close()