def run(self): if not self.timer['waiting']: return if self.counter == 0: if is_oplev_outofrange(): if self.timer['speaking']: kagralib.speak_aloud('%s optical lever is out of range. Please check it before engaging oplev damping'%OPTIC) self.timer['speaking'] = 300 return self.counter += 1 elif self.counter == 1: OLSERVO = [ezca.get_LIGOFilter('MOD-%s_TMOL_SERVO_MN_PIT'%OPTIC), ezca.get_LIGOFilter('MOD-%s_MNOL_SERVO_MN_YAW'%OPTIC)] try: for mode in sysmod.DAMPMODE_LIST: OLSERVO.append(ezca.get_LIGOFilter('MOD-%s_MODE%d_SERVO'%(OPTIC,mode))) except NameError: pass for servo in OLSERVO: servo.ramp_gain(1,1,False) self.timer['waiting'] = 1 self.counter += 1 elif self.counter == 2: return True
def run(self): if self.counter == 0: kagralib.speak_aloud('%s has been misaligned'%OPTIC) self.counter += 1 else: return True
def main(self): if sustype in ['TypeA', 'TypeB', 'TypeBp']: # by Miyo for suffix in ['P', 'T']: fec = cdslib.ezca_get_dcuid('K1VIS' + OPTIC + suffix) sdflib.restore(fec, 'misaligned') else: fec = cdslib.ezca_get_dcuid('K1VIS' + OPTIC) sdflib.restore(fec, 'misaligned') kagralib.speak_aloud('%s is misaligned' % (OPTIC))
def run(self): if not self.is_output_off(): notify('CHECK OUTPUT!!!') if self.timer['speak']: kagralib.speak_aloud('%s is not safe, although safe state was requested. It has output from some coils. Please check it'%OPTIC) self.timer['speak'] = 300 else: ezca['VIS-%s_MASTERSWITCH'%OPTIC] = 0 return True
def run(self): lib.all_off_quick(self, optic) ezca['VIS-' + optic + '_PAY_MASTERSWITCH'] = 'OFF' ezca['VIS-' + optic + '_MASTERSWITCH'] = 'OFF' kagralib.speak_aloud(optic + ' watchdog has tripped') kagralib.speak_aloud('Please check the status of ' + optic) return not (lib.is_pay_tripped(optic, par.BIO_PAY) or lib.is_twr_tripped(optic, par.BIO_TWR))
def run(self): if not self.timer['waiting']: return if bool(ezca['PSL-BEAM_SHUTTER_STATE']) and self.counter < 1: if self.timer['warning']: kagralib.speak_aloud( 'PSL shutter is open. Please close it to misalign PRM') notify('PSL shutter is open. Please close it to misalign PRM') self.timer['warning'] = 30 return if self.counter == 0: for key in self.OPAL: self.OPAL[key].turn_off('OFFSET') self.IM_TEST[key].TRAMP.put(3) self.IM_TEST[key].turn_on('OFFSET') self.IM_TEST[key].ramp_gain(1, 0, False) self.counter += 1 self.timer['waiting'] = 1 elif self.counter == 1: self.BF_TEST.TRAMP.put(3) self.BF_TEST.turn_on('OFFSET') self.BF_TEST.ramp_gain(1, 0, False) self.timer['warning'] = 120 self.counter += 1 elif self.counter == 2 and not self.BF_TEST.is_offset_ramping(): # engage PSD loop in IM_PIT and BF_YAW filt = ezca.get_LIGOFilter('VIS-PRM_BF_PSD_Y') filt.switch('FM3', 'FM7', 'FM8', 'FM9', 'ON') filt.ramp_gain(1, ramp_time=5, wait=True) filt = ezca.get_LIGOFilter('VIS-PRM_IM_PSD_P') filt.switch('FM3', 'FM7', 'FM8', 'FM9', 'ON') filt.ramp_gain(1, ramp_time=5, wait=True) if self.is_PSD_centered() and self.timer['checking']: self.timer['checking'] = 10 self.counter += 1 elif self.counter == 3: if self.timer['checking']: if self.is_PSD_centered(): return True if self.timer['warning']: kagralib.speak_aloud( 'PRM is not misaligned propery yet. Please check PRM status.' ) self.timer['warning'] = 120
def run(self): if not self.timer['waiting']: return if bool(ezca['PSL-BEAM_SHUTTER_STATE']) and self.counter < 1: if self.timer['warning']: kagralib.speak_aloud( 'PSL shutter is open. Please close it to realign PRM') notify('PSL shutter is open. Please close it to realign PRM') self.timer['warning'] = 30 return if self.counter == 0: for key in self.OPAL: self.OPAL[key].turn_on('OFFSET') self.IM_TEST[key].turn_off('OFFSET') self.IM_TEST['PIT'].ramp_offset( self.IM_TEST['PIT'].OFFSET.get() + ezca['VIS-PRM_IM_PSD_P_OUTPUT'], 1, False) self.counter += 1 self.timer['waiting'] = 1 elif self.counter == 1: self.BF_TEST.turn_off('OFFSET') self.BF_TEST.ramp_offset( self.BF_TEST.OFFSET.get() + ezca['VIS-PRM_BF_PSD_Y_OUTPUT'], 1, False) self.timer['warning'] = 120 self.counter += 1 elif self.counter == 2 and not self.BF_TEST.is_offset_ramping(): # diable PSD loop in IM_PIT and BF_YAW filt = ezca.get_LIGOFilter('VIS-PRM_BF_PSD_Y') filt.switch('FM3', 'FM4', 'FM7', 'FM8', 'FM9', 'OFF') filt.ramp_gain(0, ramp_time=5, wait=True) filt = ezca.get_LIGOFilter('VIS-PRM_IM_PSD_P') filt.switch('FM3', 'FM4', 'FM7', 'FM8', 'FM9', 'OFF') filt.ramp_gain(0, ramp_time=5, wait=True) if self.timer['warning']: kagralib.speak_aloud( 'PRM is not realigned propery yet. Please check PRM status.' ) self.timer['warning'] = 120 return self.is_oplev_inrange()
def vis_pay_watchdog_tripped(optic): ''' Send alerts to people. ''' #sendmail(sub=optic+' watchdog tripped!', text=optic+' watchdog has tripped. Please check the status.', to='*****@*****.**') kgl.speak_aloud(optic + ' payload watchdog has tripped') kgl.speak_aloud(optic + ' payload watchdog has tripped') kgl.speak_aloud('Please check the status of ' + optic)
def pre_exec(self): for DoF in ['LEN','PIT','YAW']: for stage in ['BF','MN','IM','TM']: if ezca['MOD-%s_ISC_WD_%s_%s_STATE'%(OPTIC,stage,DoF)]: kagralib.speak_aloud('%s ISC watch dog has been tripped.'%OPTIC) return 'CLEAR_ISCWD'
def pre_exec(self): if sustype == 'TypeA': if ezca['VIS-%s_ISCWD_WDMON_BLOCK' % OPTIC]: kagralib.speak_aloud('%s ISC watchdog has tripped.' % OPTIC) return 'REMOVE_ISCSIG'
def coil_engage_main(self): self.counter = 0 self.timer['waiting'] = 0 fotonfile = '/opt/rtcds/kamioka/k1/chans/K1VIS%sP.txt' % OPTIC ##### Define logger dt_now = datetime.now() year = dt_now.year month = dt_now.month day = dt_now.day hour = dt_now.hour minute = dt_now.minute log_dir = '/users/Measurements/VIS/%s/coil_balance/log/' % OPTIC date_str = '%d%s%s_%s%s' % (year, str(month).zfill(2), str(day).zfill(2), str(hour).zfill(2), str(minute).zfill(2)) log_file = log_dir + '/archives/balanceCOILOUTF_%s_' % OPTIC + date_str + '.log' #logging.basicConfig(filename=log_file,level=logging.DEBUG) logger = logging.getLogger('flogger') logger.setLevel(logging.DEBUG) handler = logging.StreamHandler() logger.addHandler(handler) handler = logging.FileHandler(filename=log_file) logger.addHandler(handler) # define sign of coilout if self.stage == 'TM': coil_gain = balanceCOILOUTF_TypeA.SIGN_TM_COILOUT(self.optic, logger) else: coil_gain = balanceCOILOUTF_TypeA.SIGN_MNIM_COILOUT( self.optic, self.stage, logger) for coil in self.coils: gg, avgI, avgQ, stdI, stdQ = balanceCOILOUTF_TypeA.Balancing( self.optic, self.stage, coil, self.freq[coil], self.oscAMP[coil], coil_gain, self.sweeprange, logger) ### fitting pI = np.polyfit(gg, avgI, 1) pQ = np.polyfit(gg, avgQ, 1) pGAIN = float(pI[1]) / float(pI[0]) * ( -1) # final gain of the balanced coil logger.debug('fitresult with a*gain + b:') logger.debug('-I (a,b) = (%f,%f)' % (pI[0], pI[1])) logger.debug('-Q (a,b) = (%f,%f)' % (pQ[0], pQ[1])) logger.debug('%s BALANCED GAIN = %f' % (coil, pGAIN)) logger.debug('put %f in VIS-%s_%s_COILOUTF_%s_GAIN' % (pGAIN, self.optic, self.stage, coil)) ezca['VIS-%s_%s_COILOUTF_%s_GAIN' % (self.optic, self.stage, coil)] = pGAIN ### plot results plt.close() plt.scatter(gg, avgI, label="I") plt.scatter(gg, avgQ, color='red', label="Q") plt.plot(gg, np.polyval(pI, gg)) plt.plot(gg, np.polyval(pQ, gg)) plt.grid() plt.title(date_str) plt.xlabel('%s_%s_COILOUTF_%s_GAIN' % (self.optic, self.stage, coil)) plt.ylabel('Amplitude of demodulated signal') plt.legend() plt.savefig(log_dir + 'archives/balanceCOILOUTF_%s_' % (self.optic) + date_str + '_%s_%s' % (self.stage, coil) + '.png') plt.savefig(log_dir + 'balanceCOILOUTF_%s_%s_%s_latest' % (self.optic, self.stage, coil) + '.png') self.timer['waiting'] = 3 ## Turn off excitation when finish the measuremetn ezca['VIS-%s_PAY_OLSERVO_LKIN_OSC_CLKGAIN' % self.optic] = 0 time.sleep(ezca['VIS-%s_PAY_OLSERVO_LKIN_OSC_TRAMP' % self.optic]) self.timer['waiting'] = 3 os.system('cp %s %s' % (log_file, (log_dir + 'balanceCOILOUTF_%s_latest.log' % (self.optic)))) balanceCOILOUTF_TypeA.ShutdownLOCKIN(self.optic) ### show the balanced date on Type-A medm screen ezca['VIS-%s_%s_COILBAL_DATE_YEAR' % (self.optic, self.stage)] = year ezca['VIS-%s_%s_COILBAL_DATE_MON' % (self.optic, self.stage)] = month ezca['VIS-%s_%s_COILBAL_DATE_DAY' % (self.optic, self.stage)] = day ezca['VIS-%s_%s_COILBAL_DATE_HOUR' % (self.optic, self.stage)] = hour ezca['VIS-%s_%s_COILBAL_DATE_MIN' % (self.optic, self.stage)] = minute kagralib.speak_aloud('%s %s coils are balanced' % (self.optic, self.stage)) self.timer['waiting'] = 3