#!/usr/local/bin/python2.6 ''' McGill Cosmology Laboratory Cryogenic Fridge Controller System Project Python Class for Running Fridge Cycles using the CryoBoard Author: James Kennedy , May 14, 2010 Modified: Feb 1 2011. Updated for Rev2 Cryoboard crython ''' import crython import fridge import time # Cryoboard and user setting boardIP = '192.168.1.137' userIP = '192.168.1.121' userPort = 12121 # Fridge Cycle Temperature Settings #Hot pump temperatures HOT_PUMP_TEMPS = 35 # K #Intermediate pump Temperatures #(The cycle will heat to this temperature, wait for the main plate to cool # then continue to the DEFAULT_PUMP_TEMPS) INTERMEDIATE_PUMP_TEMPS = 25 # K MAINPLATE_BASETEMP = 4.7 # K cb = crython.CryoBoard(boardIP) st = crython.CryoStreamer(cb,userIP,userPort) if st.status() == False: st.launch() cryo_fridge = fridge.CryoFridge(cb,st) ###### RESET FRIDGE SETTINGS ######## cryo_fridge.FridgeReset() cryo_fridge.He4_switch.flip_switch('OPEN') cryo_fridge.He3_ISW.flip_switch('OPEN') cryo_fridge.He3_USW.flip_switch('OPEN') ###### STARTING FRIDGE CYCLE ######## cryo_fridge.HeatPumps(heat_temp=INTERMEDIATE_PUMP_TEMPS) cryo_fridge.HeatPumps(heat_temp=HOT_PUMP_TEMPS) cryo_fridge.He3_U_pump.set_pump_voltage(4.0) cryo_fridge.MainPlateCool(min_temp=MAINPLATE_BASETEMP) #To get the last bit of cooling, turn 4He pump off # wait 1h mins to condense He4 # cryo_fridge.He4_pump.set_pump_voltage(0) cryo_fridge.He3_U_pump.set_pump_voltage(3.5) print('Turning 4He pump heater off') print('Waiting 1 hour. To condense He4') mtemp = 'Main plate temp is ' + str(cryo_fridge.Main_plate.get_temp()) + ' K' print(mtemp) tnow = time.ctime() print(tnow) time.sleep(3600) print('Starting He4 Cycle') mtemp = 'Main plate temp is ' + str(cryo_fridge.Main_plate.get_temp()) + ' K' print(mtemp) tnow = time.ctime() print(tnow) cryo_fridge.He4_pump.set_pump_voltage(0) cryo_fridge.He4_switch.flip_switch('CLOSED') ##### The Hex thermometer is off the scale so we're just going ##### to ensure that the 4He pump is cold < 7 K # # Now watch the heat exchanger when the temperature turns around # AND the 4He PUMP is below 7 Kelvin flip the next two switches # # Following the APEX-SZ algorithm, will keep a running average # of the heat exchanger temperature. When a value is > 5 sigma from # the running average, the heat exchanger has turned around #hextemp = [] #He4_cycle = True # #for i in xrange(5): # hextemp.append(cryo_fridge.Hex.get_temp()) # time.sleep(10) # #while He4_cycle == True: # hextemp = hextemp[1:end] # hextemp.append(cryo_fridge.Hex.get_temp()) # # htemp = numpy.asarray(hextemp) # avg_temp = numpy.mean(htemp) # std_temp = numpy.std(htemp) # # if (cryo_fridge.Hex.get_temp()) > (avg_temp + 5*std_temp): # if cryo_fridge.He4_pump.get_temp() < 7 # He4_cycle = False He4_cycle = True while He4_cycle == True: time.sleep(10) if cryo_fridge.He4_pump.get_temp() < 6.75: He4_cycle = False print('He4 Cycle finished') tnow = time.ctime() print(tnow) ut = 'UltraHead Temp is ' + str(cryo_fridge.UCHead.get_temp()) + ' K' print(ut) it = 'InterHead Temp is ' + str(cryo_fridge.ICHead.get_temp()) + ' K' print(it) cryo_fridge.He3_I_pump.set_pump_voltage(0) cryo_fridge.He3_ISW.flip_switch('CLOSED') time.sleep(180) cryo_fridge.He3_U_pump.set_pump_voltage(0) cryo_fridge.He3_USW.flip_switch('CLOSED') print('Auto Cycle Complete') tnow = time.ctime() print(tnow)