Matt, Stefan
The switching of coil drivers to low noise takes quite a long time with the current guardian code (20+ seconds per coil, with 20 coils, so over 400 seconds or about 7 minutes). This guardian state has recently been updated to make it more responsive (moved code to run, and used timer rather than sleep, see 28353), but this didn't make it any faster. I just changed the code to switch all of the optics together, rather than do them serially (see below). This should reduce the total time to ~90 seconds. The old function is still in ISC_LOCK.py as COIL_DRIVERS_SLOW.
We have not locked yet, so this code is untested.
=============================
def run(self):
eul2osemTramp = 8
analogExtraSleep = 7
path = '/opt/rtcds/userapps/release/isc/h1/scripts/sus/'
optics = ['PRM', 'PR2', 'SRM', 'SR2', 'BS'] # what optic?
stage = ['M3', 'M3', 'M3', 'M3', 'M2'] # what stage are we switching?
newState = [ 3, 3, 3, 3, 3 ] # what is our final coil state?
opt_stage_state = zip(optics, stage, newState) # tuple of these
coils = ['UL', 'UR', 'LL', 'LR']
coil = coils[self.coil_num]
log(str(self.reset_counter))
if self.reset_counter == 0:
# first step, set matrix values
for opt, stg, state in opt_stage_state:
log('-- Switching ' + opt + ' ' + coil)
ezca.burtwb(path + opt.lower() + '_' + stg.lower() +'_out_' + coil.lower() + '.snap')
time.sleep(0.1)
ezca['SUS-' + opt + '_' + stg + '_EUL2OSEM_LOAD_MATRIX'] = 1
self.timer['mtrxRamp'] = eul2osemTramp
self.reset_counter = 1
elif self.reset_counter == 1 and self.timer['mtrxRamp']:
# second step, clear filters
for opt, stg, state in opt_stage_state:
ezca['SUS-' + opt + '_' + stg + '_COILOUTF_' + coil + '_RSET'] = 2
self.timer['extraSleep'] = analogExtraSleep
self.reset_counter = 2
elif self.reset_counter == 2 and self.timer['extraSleep']:
# third step, switch coil drivers
for opt, stg, state in opt_stage_state:
ezca['SUS-' + opt + '_BIO_' + stg + '_' + coil + '_STATEREQ'] = 1 # go to intermediate state
time.sleep(0.1)
ezca['SUS-' + opt + '_BIO_' + stg + '_' + coil + '_STATEREQ'] = state
time.sleep(0.1)
self.reset_counter = 3
< ... more run code ... >
=============================