def readData(self, url):
		ws_lw_acquisition_controller = self.linac_wizard_document.getWS_LW_Controller()
		da = XmlDataAdaptor.adaptorForUrl(url,false)
		root_da = da.childAdaptor("LINAC_Wizard")		
		title = root_da.stringValue("Title")
		seqNames = root_da.stringValue("AccSequence").split()
		if(len(seqNames) != 0): 
			#------set up selected names in the SetUp tables
			linac_setup_controller	= self.linac_wizard_document.getSetUp_Controller()
			linac_setup_controller.setSelectedSequences(seqNames[0],seqNames[len(seqNames)-1])
			#-----------------------------------------------
			lst = ArrayList()
			for seqName in seqNames:
				lst.add(self.accl.getSequence(seqName))
			accSeq = AcceleratorSeqCombo("SEQUENCE", lst)
			self.linac_wizard_document.ws_lw_controller.cleanOldWSdata()
			self.linac_wizard_document.setAccSeq(accSeq)
			nodes = accSeq.getAllNodes(true)
			name_to_node_dict = {}
			for node in nodes:
				name_to_node_dict[node.getId()] = node	
			#-----add cavities to the nodes dictinary ------------
			for cav in ws_lw_acquisition_controller.cavs:
				name_to_node_dict[cav.getId()] = cav	
			#----read WS or LW wave_form data
			self.readData_WS_LW_Records(root_da,name_to_node_dict)
			#----read Initial Twiss and beam parameters
			self.readTransverseTwiss(root_da)
		#---- read SCL Phase Scan data
		self.linac_wizard_document.scl_long_tuneup_controller.clean()
		self.linac_wizard_document.scl_long_tuneup_controller.readDataFromXML(root_da)		
		self.linac_wizard_document.scl_long_tuneup_controller.updateAllTables()
Ejemplo n.º 2
0
	def __init__(self,top_document,accl):
		#--- top_document is a parent document for all controllers
		self.top_document = top_document		
		self.main_panel = JPanel(BorderLayout())
		#----etched border
		etched_border = BorderFactory.createEtchedBorder()
		#----main loop timer
		self.main_loop_timer = Main_Loop_Timer(self)		
		#---- set up accSeq
		self.accSeq = null
		seq_names = ["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6","CCL1","CCL2","CCL3","CCL4"]
		lst = ArrayList()
		for seqName in seq_names:
			lst.add(accl.getSequence(seqName))
		self.accSeq = AcceleratorSeqCombo("SEQUENCE", lst)
		rf_gaps = self.accSeq.getAllNodesWithQualifier(AndTypeQualifier().and((OrTypeQualifier()).or(RfGap.s_strType)))	
		self.cav_wrappers = []
		cavs = []
		count = 0
		for rf_gap in rf_gaps:
			cav = rf_gap.getParent()
			pos = self.accSeq.getPosition(cav)
			if(cav not in cavs):
				#print "debug cav=",cav.getId()," count=",count
				cavs.append(cav)				
				alias = "null"
				if(count > 3):
					alias = seq_names[count+1-4]
				else:
					alias = seq_names[0]+str(count+1)
				cav_llrf_name = "null"
				cav_pwr_pv_name = "nullPwr"
				if(count <= 3):
					cav_llrf_name = "MEBT_LLRF:FCM"+str(count+1)
					cav_pwr_pv_name = "MEBT_LLRF:Cav"+str(count+1)+":NetPwr"
				if(count > 3 and count < 10):
					cav_llrf_name = "DTL_LLRF:FCM"+str(count-3)
					cav_pwr_pv_name = "DTL_LLRF:Cav"+str(count-3)+":NetPwr"
				if(count > 9):
					cav_llrf_name = "CCL_LLRF:FCM"+str(count-9)
					cav_pwr_pv_name = "CCL_LLRF:Cav"+str(count-9)+":NetPwr"					
				amp_pv_name = cav_llrf_name+":CtlAmpSet"
				phase_pv_name = cav_llrf_name+":CtlPhaseSet"
				self.cav_wrappers.append(Cavity_Wrapper(cav,pos,alias,amp_pv_name,phase_pv_name,cav_pwr_pv_name))	
				#print "debug =================================="
				#print "debug cav=",cav.getId(),"  alias=",alias,"  amp_pv_name=",amp_pv_name," phase_pv_name=",phase_pv_name
				#print "debug         cav_pwr_pv_name=",cav_pwr_pv_name
				#print "debug cav=",cav.getId()," pos =",pos," L=",cav.getLength()
				count += 1
		#---- BPMs
		self.bpm_wrappers = []
		bpms = self.accSeq.getAllNodesWithQualifier(AndTypeQualifier().and((OrTypeQualifier()).or(BPM.s_strType)))	
		for bpm in bpms:
			pos = self.accSeq.getPosition(bpm)
			pos += 0.5*bpm.getBPMBucket().getLength()*bpm.getBPMBucket().getOrientation() 
			bpm_wrapper = BPM_Wrapper(bpm,pos)
			#print "debug bpm=",bpm_wrapper.alias," pos =",pos		
			self.bpm_wrappers.append(bpm_wrapper)
		#---- SCL first BPMs and Cavs
		lst = ArrayList()
		for seqName in ["SCLMed",]:	
			lst.add(accl.getSequence(seqName))
		self.scl_accSeq = AcceleratorSeqCombo("SCL_SEQUENCE", lst)
		bpms = self.scl_accSeq.getAllNodesWithQualifier((AndTypeQualifier().and((OrTypeQualifier()).or(BPM.s_strType))).andStatus(true))
		bpms = bpms[:5]
		self.scl_bpm_wrappers = []
		for bpm in bpms:
			pos = self.scl_accSeq.getPosition(bpm) + self.accSeq.getLength()
			pos += 0.5*bpm.getBPMBucket().getLength()*bpm.getBPMBucket().getOrientation()		
			bpm_wrapper = BPM_Wrapper(bpm,pos)
			#print "debug bpm=",bpm_wrapper.alias," pos =",pos				
			self.scl_bpm_wrappers.append(bpm_wrapper)
		rf_gaps = self.scl_accSeq.getAllNodesWithQualifier(AndTypeQualifier().and((OrTypeQualifier()).or(RfGap.s_strType)))	
		cavs = []
		for rf_gap in rf_gaps:
			cav = rf_gap.getParent()
			if((cav not in cavs) and cav.getStatus()):
				cavs.append(cav)
		cavs = cavs[:9]
		self.scl_cav_wrappers = []
		for cav in cavs:
			pos = self.scl_accSeq.getPosition(cav) + self.accSeq.getLength()
			alias = cav.getId().split(":")[1]	
			amp_pv_name = "SCL_LLRF:"+alias.replace("Cav","FCM")+":CtlAmpSet"
			phase_pv_name = "SCL_LLRF:"+alias.replace("Cav","FCM")+":CtlPhaseSet"
			cav_pwr_pv_name = "SCL_LLRF:"+alias+":NetPwr"	
			self.scl_cav_wrappers.append(Cavity_Wrapper(cav,pos,alias,amp_pv_name,phase_pv_name,cav_pwr_pv_name))
			#print "debug =================================="
			#print "debug cav=",cav.getId(),"  alias=",alias,"  amp_pv_name=",amp_pv_name," phase_pv_name=",phase_pv_name
			#print "debug         cav_pwr_pv_name=",cav_pwr_pv_name			
		#---- Panels setup
		#---- Auxiliaries setup
		self.loop_run_state = Loop_Run_State()
		self.loop_run_state.isRunning = false
		self.loop_run_state.shouldStop = false
		#---------------------------------------------
		#----etched border
		etched_border = BorderFactory.createEtchedBorder()
		#---- Cavities' Controllers 
		self.cav_controllers = []
		self.cav_controllers.append(MEBT_Cavity_Controller(self,self.cav_wrappers[0]))
		self.cav_controllers.append(MEBT_Cavity_Controller(self,self.cav_wrappers[1]))
		self.cav_controllers.append(MEBT_Cavity_Controller(self,self.cav_wrappers[2]))
		self.cav_controllers.append(MEBT_Cavity_Controller(self,self.cav_wrappers[3]))
		#---------------------------------
		self.cav_controllers.append(DTL1_Cavity_Controller(self,self.cav_wrappers[4]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[5]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[6]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[7]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[8]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[9]))
		#----------------------------------
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[10]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[11]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[12]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[13]))	
		#------ cavity controllers customization --------------------
		#------ MEBT Reb. 4 -------
		self.cav_controllers[3].cav_amp_backward_steps_mult_text.setValue(8.0)
		#----- amplitudes limits
		self.cav_controllers[0].safe_relative_amp_down_text.setValue(50.)
		self.cav_controllers[1].safe_relative_amp_down_text.setValue(50.)
		self.cav_controllers[2].safe_relative_amp_down_text.setValue(50.)
		self.cav_controllers[3].safe_relative_amp_down_text.setValue(50.)
		#----- No PASTA Use for DTL2-6 and CCL4
		self.cav_controllers[5].scan_main_panel.use_PASTA_RadioButton.setSelected(false)
		self.cav_controllers[6].scan_main_panel.use_PASTA_RadioButton.setSelected(false)
		self.cav_controllers[7].scan_main_panel.use_PASTA_RadioButton.setSelected(false)
		self.cav_controllers[8].scan_main_panel.use_PASTA_RadioButton.setSelected(false)
		self.cav_controllers[9].scan_main_panel.use_PASTA_RadioButton.setSelected(false)
		self.cav_controllers[13].scan_main_panel.use_PASTA_RadioButton.setSelected(false)
		#------ Phase corrections after Full scan for MEBT
		self.cav_controllers[0].guess_phase_shift_text.setValue(-10.0)
		self.cav_controllers[1].guess_phase_shift_text.setValue(-6.0)
		#------ Phase and amplitude corrections after Full scan for inner BPM
		self.cav_controllers[5].guess_phase_shift_text.setValue(-4.0)
		self.cav_controllers[5].guess_cav_amp_shift_text.setValue(-2.0)
		self.cav_controllers[6].guess_phase_shift_text.setValue(1.)
		self.cav_controllers[6].guess_cav_amp_shift_text.setValue(0.7)
		self.cav_controllers[8].guess_phase_shift_text.setValue(0.)
		self.cav_controllers[8].guess_cav_amp_shift_text.setValue(-0.7)
		self.cav_controllers[10].guess_phase_shift_text.setValue(0.)
		self.cav_controllers[10].guess_cav_amp_shift_text.setValue(-3.6)
		self.cav_controllers[11].guess_phase_shift_text.setValue(0.)
		self.cav_controllers[11].guess_cav_amp_shift_text.setValue(-3.7)		
		#------ The BPMs for Full Scan and PASTA
		self.cav_controllers[0].cav_bpms_controller.work_bpm_index = 1 
		self.cav_controllers[1].cav_bpms_controller.work_bpm_index = 1 		
		self.cav_controllers[5].cav_bpms_controller.pasta_bpm_0_index = 2
		self.cav_controllers[5].cav_bpms_controller.pasta_bpm_1_index = 5
		self.cav_controllers[6].cav_bpms_controller.pasta_bpm_0_index = 2
		self.cav_controllers[6].cav_bpms_controller.pasta_bpm_1_index = 4
		self.cav_controllers[7].cav_bpms_controller.pasta_bpm_0_index = 2
		self.cav_controllers[7].cav_bpms_controller.pasta_bpm_1_index = 5
		self.cav_controllers[8].cav_bpms_controller.pasta_bpm_0_index = 5
		self.cav_controllers[8].cav_bpms_controller.pasta_bpm_1_index = 6
		self.cav_controllers[9].cav_bpms_controller.pasta_bpm_0_index = 3
		self.cav_controllers[9].cav_bpms_controller.pasta_bpm_1_index = 5
		self.cav_controllers[10].cav_bpms_controller.pasta_bpm_0_index = 5
		self.cav_controllers[10].cav_bpms_controller.pasta_bpm_1_index = 6
		self.cav_controllers[11].cav_bpms_controller.pasta_bpm_0_index = 2
		self.cav_controllers[11].cav_bpms_controller.pasta_bpm_1_index = 3
		self.cav_controllers[12].cav_bpms_controller.pasta_bpm_0_index = 2
		self.cav_controllers[12].cav_bpms_controller.pasta_bpm_1_index = 4
		self.cav_controllers[13].cav_bpms_controller.pasta_bpm_0_index = 3
		self.cav_controllers[13].cav_bpms_controller.pasta_bpm_1_index = 4
		self.cav_controllers[11].cav_bpms_controller.sin_wave_bpm_index = 0
		self.cav_controllers[12].cav_bpms_controller.sin_wave_bpm_index = 0
		self.cav_controllers[13].cav_bpms_controller.sin_wave_bpm_index = 1
		#-----Target power levels
		self.cav_controllers[4].cav_wrapper.net_pwr_goal =  378.0
		self.cav_controllers[5].cav_wrapper.net_pwr_goal = 1208.0
		self.cav_controllers[6].cav_wrapper.net_pwr_goal = 1294.0
		self.cav_controllers[7].cav_wrapper.net_pwr_goal = 1416.0
		self.cav_controllers[8].cav_wrapper.net_pwr_goal = 1454.0
		self.cav_controllers[9].cav_wrapper.net_pwr_goal = 1414.0
		self.cav_controllers[10].cav_wrapper.net_pwr_goal = 2531.0
		self.cav_controllers[11].cav_wrapper.net_pwr_goal = 2984.0
		self.cav_controllers[12].cav_wrapper.net_pwr_goal = 3018.0
		self.cav_controllers[13].cav_wrapper.net_pwr_goal = 2856.0
		#----------------------------------------------   
		left_panel = JPanel(BorderLayout())
		self.tabbedPane = JTabbedPane()		
		self.tabbedPane.add("Cavity",JPanel(BorderLayout()))	
		self.tabbedPane.add("Parameters",JPanel(BorderLayout()))
		#--------------------------------------------------------
		self.cav_table = JTable(Cavities_Table_Model(self))
		self.cav_table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
		self.cav_table.setFillsViewportHeight(true)
		self.cav_table.setPreferredScrollableViewportSize(Dimension(500,240))
		self.cav_table.getSelectionModel().addListSelectionListener(Cavs_Table_Selection_Listener(self))
		scrl_cav_panel = JScrollPane(self.cav_table)
		scrl_cav_panel.setBorder(BorderFactory.createTitledBorder(etched_border,"Cavities' Parameters"))
		init_buttons_panel = Init_Cav_Controllers_Panel(self)
		start_stop_panel = Start_Stop_Panel(self)
		#---- fake scan button
		self.keepAllCavParams_RadioButton = start_stop_panel.keepAllCavParams_RadioButton
		self.keepAmps_RadioButton = start_stop_panel.keepAmps_RadioButton
		#---- status text field
		self.status_text = start_stop_panel.status_text
		tmp0_panel = JPanel(BorderLayout())
		tmp0_panel.add(init_buttons_panel,BorderLayout.NORTH)
		tmp0_panel.add(scrl_cav_panel,BorderLayout.CENTER)
		tmp0_panel.add(start_stop_panel,BorderLayout.SOUTH)
		tmp1_panel = JPanel(BorderLayout())
		tmp1_panel.add(tmp0_panel,BorderLayout.NORTH)
		left_panel.add(tmp1_panel,BorderLayout.WEST)
		#--------------------------------------------------------
		self.main_panel.add(left_panel,BorderLayout.WEST)
		self.main_panel.add(self.tabbedPane,BorderLayout.CENTER)
		#---- non GUI controllers
		self.particle_tracker_model = Particle_Tracker_Model(self)
		self.env_tracker_model = Envelop_Tracker_Model(self)
Ejemplo n.º 3
0
	def __init__(self,top_document,accl):
		#--- top_document is a parent document for all controllers
		self.top_document = top_document		
		self.main_panel = JPanel(BorderLayout())
		#----etched border
		etched_border = BorderFactory.createEtchedBorder()
		#---- set up accSeq
		self.accSeq = null
		seq_names = ["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6"]
		lst = ArrayList()
		for seqName in seq_names:
			lst.add(accl.getSequence(seqName))
		self.accSeq = AcceleratorSeqCombo("SEQUENCE", lst)
		#---- setup magnets
		nodes = self.accSeq.getAllNodes()
		self.quad_wrappers = []
		self.perm_quads_wrappers = []
		self.dc_wrappers = []
		for node in nodes:
			pos = self.accSeq.getPosition(node)
			if(node.isMagnet()):
				if(node.isPermanent()):
					self.perm_quads_wrappers.append(Magnet_Wrapper(node,pos))
				else:
					if(node.isCorrector()):
						self.dc_wrappers.append(Magnet_Wrapper(node,pos))
					else:
						self.quad_wrappers.append(Magnet_Wrapper(node,pos))
		#---- cavs 
		rf_gaps = self.accSeq.getAllNodesWithQualifier(AndTypeQualifier().and((OrTypeQualifier()).or(RfGap.s_strType)))	
		self.cav_wrappers = []
		self.mebt_cav_wrappers = []
		cavs = []
		for rf_gap in rf_gaps:
			cav = rf_gap.getParent()
			pos = self.accSeq.getPosition(cav)
			if((cav not in cavs) and cav.getId().find("DTL") >= 0):
				cavs.append(cav)
				self.cav_wrappers.append(Cavity_Wrapper(cav,pos))
			if((cav not in cavs) and cav.getId().find("MEBT") >= 0):
				cavs.append(cav)
				self.mebt_cav_wrappers.append(Cavity_Wrapper(cav,pos))			
		#---- BPMs
		self.bpm_wrappers = []
		bpms = self.accSeq.getAllNodesWithQualifier(AndTypeQualifier().and((OrTypeQualifier()).or(BPM.s_strType)))	
		for bpm in bpms:
			pos = self.accSeq.getPosition(bpm)
			bpm_wrapper = BPM_Wrapper(bpm,pos)
			if(bpm_wrapper.bpm.getId().find("DTL") >= 0):
				bpm_wrapper.use = false
			self.bpm_wrappers.append(bpm_wrapper)
		#---- debug print 
		"""
		for quad_wrapper in self.quad_wrappers:
			print "debug quad=",quad_wrapper.magnet.getId()
		for perm_quad_wrapper in self.perm_quads_wrappers:
			print "debug perm quad=",perm_quad_wrapper.magnet.getId()
		for dc_wrapper in self.dc_wrappers:
			print "debug dc=",dc_wrapper.magnet.getId()	
		for cav_wrapper in self.cav_wrappers:
			print "debug cav=",cav_wrapper.cav.getId()	
		for bpm_wrapper in self.bpm_wrappers:
			print "debug bpm=",bpm_wrapper.bpm.getId()	
		"""
		#---- Panels setup
		self.magnet_and_bpm_panel = Magnet_and_BPM_Panel(self)
		self.correction_coeffs_panel = Correction_Coeffs_Panel(self)
		self.orbit_diff_graphs_panel = Orbit_Diff_Graphs_Panel(self)
		self.orbit_measurer_cotroller_panel = Orbit_Measurer_Controller_Panel(self)
		#---- Auxiliaries setup
		self.orbit_measurer = Orbit_Measurer(self)
		self.measure_running = false
		#---------------------------------------------
		tmp0_panel = JPanel(BorderLayout())
		tmp0_panel.add(self.orbit_diff_graphs_panel,BorderLayout.CENTER)
		tmp0_panel.add(self.orbit_measurer_cotroller_panel,BorderLayout.SOUTH)
		tmp0_panel.add(self.correction_coeffs_panel,BorderLayout.NORTH)
		self.main_panel.add(self.magnet_and_bpm_panel,BorderLayout.WEST)
		self.main_panel.add(tmp0_panel,BorderLayout.CENTER)
Ejemplo n.º 4
0
	def __init__(self,top_document,accl):
		#--- top_document is a parent document for all controllers
		self.top_document = top_document		
		self.main_panel = JPanel(BorderLayout())
		#----etched border
		etched_border = BorderFactory.createEtchedBorder()
		#----main loop timer
		self.main_loop_timer = Main_Loop_Timer(self)		
		#---- set up accSeq
		self.accSeq = null
		seq_names = ["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6","CCL1","CCL2","CCL3","CCL4"]
		lst = ArrayList()
		for seqName in seq_names:
			lst.add(accl.getSequence(seqName))
		self.accSeq = AcceleratorSeqCombo("SEQUENCE", lst)
		rf_gaps = self.accSeq.getAllNodesWithQualifier(AndTypeQualifier().and((OrTypeQualifier()).or(RfGap.s_strType)))	
		self.cav_wrappers = []
		cavs = []
		count = 0
		for rf_gap in rf_gaps:
			cav = rf_gap.getParent()
			pos = self.accSeq.getPosition(cav)
			if(cav not in cavs):
				#print "debug cav=",cav.getId()," count=",count
				cavs.append(cav)				
				alias = "null"
				if(count > 3):
					alias = seq_names[count+1-4]
				else:
					alias = seq_names[0]+str(count+1)
				cav_llrf_name = "null"
				cav_pwr_pv_name = "nullPwr"
				if(count <= 3):
					cav_llrf_name = "MEBT_LLRF:FCM"+str(count+1)
					cav_pwr_pv_name = "MEBT_LLRF:Cav"+str(count+1)+":NetPwr"
				if(count > 3 and count < 10):
					cav_llrf_name = "DTL_LLRF:FCM"+str(count-3)
					cav_pwr_pv_name = "DTL_LLRF:Cav"+str(count-3)+":NetPwr"
				if(count > 9):
					cav_llrf_name = "CCL_LLRF:FCM"+str(count-9)
					cav_pwr_pv_name = "CCL_LLRF:Cav"+str(count-9)+":NetPwr"					
				amp_pv_name = cav_llrf_name+":CtlAmpSet"
				phase_pv_name = cav_llrf_name+":CtlPhaseSet"
				self.cav_wrappers.append(Cavity_Wrapper(cav,pos,alias,amp_pv_name,phase_pv_name,cav_pwr_pv_name))	
				#print "debug =================================="
				#print "debug cav=",cav.getId(),"  alias=",alias,"  amp_pv_name=",amp_pv_name," phase_pv_name=",phase_pv_name
				#print "debug         cav_pwr_pv_name=",cav_pwr_pv_name
				#print "debug cav=",cav.getId()," pos =",pos," L=",cav.getLength()
				count += 1
		#---- BPMs
		self.bpm_wrappers = []
		bpms = self.accSeq.getAllNodesWithQualifier(AndTypeQualifier().and((OrTypeQualifier()).or(BPM.s_strType)))	
		for bpm in bpms:
			pos = self.accSeq.getPosition(bpm)
			pos += 0.5*bpm.getBPMBucket().getLength()*bpm.getBPMBucket().getOrientation() 
			bpm_wrapper = BPM_Wrapper(bpm,pos)
			#print "debug bpm=",bpm_wrapper.alias," pos =",pos		
			self.bpm_wrappers.append(bpm_wrapper)
		#---- SCL first BPMs and Cavs
		lst = ArrayList()
		for seqName in ["SCLMed",]:	
			lst.add(accl.getSequence(seqName))
		self.scl_accSeq = AcceleratorSeqCombo("SCL_SEQUENCE", lst)
		bpms = self.scl_accSeq.getAllNodesWithQualifier((AndTypeQualifier().and((OrTypeQualifier()).or(BPM.s_strType))).andStatus(true))
		bpms = bpms[:5]
		self.scl_bpm_wrappers = []
		for bpm in bpms:
			pos = self.scl_accSeq.getPosition(bpm) + self.accSeq.getLength()
			pos += 0.5*bpm.getBPMBucket().getLength()*bpm.getBPMBucket().getOrientation()		
			bpm_wrapper = BPM_Wrapper(bpm,pos)
			#print "debug bpm=",bpm_wrapper.alias," pos =",pos				
			self.scl_bpm_wrappers.append(bpm_wrapper)
		rf_gaps = self.scl_accSeq.getAllNodesWithQualifier(AndTypeQualifier().and((OrTypeQualifier()).or(RfGap.s_strType)))	
		cavs = []
		for rf_gap in rf_gaps:
			cav = rf_gap.getParent()
			if((cav not in cavs) and cav.getStatus()):
				cavs.append(cav)
		cavs = cavs[:9]
		self.scl_cav_wrappers = []
		for cav in cavs:
			pos = self.scl_accSeq.getPosition(cav) + self.accSeq.getLength()
			alias = cav.getId().split(":")[1]	
			amp_pv_name = "SCL_LLRF:"+alias.replace("Cav","FCM")+":CtlAmpSet"
			phase_pv_name = "SCL_LLRF:"+alias.replace("Cav","FCM")+":CtlPhaseSet"
			cav_pwr_pv_name = "SCL_LLRF:"+alias+":NetPwr"	
			self.scl_cav_wrappers.append(Cavity_Wrapper(cav,pos,alias,amp_pv_name,phase_pv_name,cav_pwr_pv_name))
			#print "debug =================================="
			#print "debug cav=",cav.getId(),"  alias=",alias,"  amp_pv_name=",amp_pv_name," phase_pv_name=",phase_pv_name
			#print "debug         cav_pwr_pv_name=",cav_pwr_pv_name			
		#---- Panels setup
		#---- Auxiliaries setup
		self.loop_run_state = Loop_Run_State()
		self.loop_run_state.isRunning = false
		self.loop_run_state.shouldStop = false
		#---------------------------------------------
		#----etched border
		etched_border = BorderFactory.createEtchedBorder()
		#---- Cavities' Controllers 
		self.cav_controllers = []
		self.cav_controllers.append(MEBT_Cavity_Controller(self,self.cav_wrappers[0]))
		self.cav_controllers.append(MEBT_Cavity_Controller(self,self.cav_wrappers[1]))
		self.cav_controllers.append(MEBT_Cavity_Controller(self,self.cav_wrappers[2]))
		self.cav_controllers.append(MEBT_Cavity_Controller(self,self.cav_wrappers[3]))
		#---------------------------------
		self.cav_controllers.append(DTL1_Cavity_Controller(self,self.cav_wrappers[4]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[5]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[6]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[7]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[8]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[9]))
		#----------------------------------
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[10]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[11]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[12]))
		self.cav_controllers.append(DTL_CCL_Cavity_Controller(self,self.cav_wrappers[13]))	
		#------ cavity controllers customization --------------------
		#------ MEBT Reb. 4 -------
		self.cav_controllers[3].cav_amp_backward_steps_mult_text.setValue(8.0)
		#----- amplitudes limits
		self.cav_controllers[0].safe_relative_amp_down_text.setValue(50.)
		self.cav_controllers[1].safe_relative_amp_down_text.setValue(50.)
		self.cav_controllers[2].safe_relative_amp_down_text.setValue(50.)
		self.cav_controllers[3].safe_relative_amp_down_text.setValue(50.)
		#----- No PASTA Use for DTL2-6 and CCL4
		self.cav_controllers[5].scan_main_panel.use_PASTA_RadioButton.setSelected(false)
		self.cav_controllers[6].scan_main_panel.use_PASTA_RadioButton.setSelected(false)
		self.cav_controllers[7].scan_main_panel.use_PASTA_RadioButton.setSelected(false)
		self.cav_controllers[8].scan_main_panel.use_PASTA_RadioButton.setSelected(false)
		self.cav_controllers[9].scan_main_panel.use_PASTA_RadioButton.setSelected(false)
		self.cav_controllers[13].scan_main_panel.use_PASTA_RadioButton.setSelected(false)
		#------ Phase corrections after Full scan for MEBT
		self.cav_controllers[0].guess_phase_shift_text.setValue(-10.0)
		self.cav_controllers[1].guess_phase_shift_text.setValue(-6.0)
		#------ Phase and amplitude corrections after Full scan for inner BPM
		self.cav_controllers[5].guess_phase_shift_text.setValue(-4.0)
		self.cav_controllers[5].guess_cav_amp_shift_text.setValue(-2.0)
		self.cav_controllers[6].guess_phase_shift_text.setValue(1.)
		self.cav_controllers[6].guess_cav_amp_shift_text.setValue(0.7)
		self.cav_controllers[8].guess_phase_shift_text.setValue(0.)
		self.cav_controllers[8].guess_cav_amp_shift_text.setValue(-0.7)
		self.cav_controllers[10].guess_phase_shift_text.setValue(0.)
		self.cav_controllers[10].guess_cav_amp_shift_text.setValue(-3.6)
		self.cav_controllers[11].guess_phase_shift_text.setValue(0.)
		self.cav_controllers[11].guess_cav_amp_shift_text.setValue(-3.7)		
		#------ The BPMs for Full Scan and PASTA
		self.cav_controllers[0].cav_bpms_controller.work_bpm_index = 1 
		self.cav_controllers[1].cav_bpms_controller.work_bpm_index = 1 		
		self.cav_controllers[5].cav_bpms_controller.pasta_bpm_0_index = 2
		self.cav_controllers[5].cav_bpms_controller.pasta_bpm_1_index = 5
		self.cav_controllers[6].cav_bpms_controller.pasta_bpm_0_index = 2
		self.cav_controllers[6].cav_bpms_controller.pasta_bpm_1_index = 4
		self.cav_controllers[7].cav_bpms_controller.pasta_bpm_0_index = 2
		self.cav_controllers[7].cav_bpms_controller.pasta_bpm_1_index = 5
		self.cav_controllers[8].cav_bpms_controller.pasta_bpm_0_index = 5
		self.cav_controllers[8].cav_bpms_controller.pasta_bpm_1_index = 6
		self.cav_controllers[9].cav_bpms_controller.pasta_bpm_0_index = 3
		self.cav_controllers[9].cav_bpms_controller.pasta_bpm_1_index = 5
		self.cav_controllers[10].cav_bpms_controller.pasta_bpm_0_index = 5
		self.cav_controllers[10].cav_bpms_controller.pasta_bpm_1_index = 6
		self.cav_controllers[11].cav_bpms_controller.pasta_bpm_0_index = 2
		self.cav_controllers[11].cav_bpms_controller.pasta_bpm_1_index = 3
		self.cav_controllers[12].cav_bpms_controller.pasta_bpm_0_index = 2
		self.cav_controllers[12].cav_bpms_controller.pasta_bpm_1_index = 4
		self.cav_controllers[13].cav_bpms_controller.pasta_bpm_0_index = 3
		self.cav_controllers[13].cav_bpms_controller.pasta_bpm_1_index = 4
		self.cav_controllers[11].cav_bpms_controller.sin_wave_bpm_index = 0
		self.cav_controllers[12].cav_bpms_controller.sin_wave_bpm_index = 0
		self.cav_controllers[13].cav_bpms_controller.sin_wave_bpm_index = 1
		#-----Target power levels
		self.cav_controllers[4].cav_wrapper.net_pwr_goal =  378.0
		self.cav_controllers[5].cav_wrapper.net_pwr_goal = 1208.0
		self.cav_controllers[6].cav_wrapper.net_pwr_goal = 1294.0
		self.cav_controllers[7].cav_wrapper.net_pwr_goal = 1416.0
		self.cav_controllers[8].cav_wrapper.net_pwr_goal = 1454.0
		self.cav_controllers[9].cav_wrapper.net_pwr_goal = 1414.0
		self.cav_controllers[10].cav_wrapper.net_pwr_goal = 2531.0
		self.cav_controllers[11].cav_wrapper.net_pwr_goal = 2984.0
		self.cav_controllers[12].cav_wrapper.net_pwr_goal = 3018.0
		self.cav_controllers[13].cav_wrapper.net_pwr_goal = 2856.0
		#----------------------------------------------   
		left_panel = JPanel(BorderLayout())
		self.tabbedPane = JTabbedPane()		
		self.tabbedPane.add("Cavity",JPanel(BorderLayout()))	
		self.tabbedPane.add("Parameters",JPanel(BorderLayout()))
		#--------------------------------------------------------
		self.cav_table = JTable(Cavities_Table_Model(self))
		self.cav_table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION)
		self.cav_table.setFillsViewportHeight(true)
		self.cav_table.setPreferredScrollableViewportSize(Dimension(500,240))
		self.cav_table.getSelectionModel().addListSelectionListener(Cavs_Table_Selection_Listener(self))
		scrl_cav_panel = JScrollPane(self.cav_table)
		scrl_cav_panel.setBorder(BorderFactory.createTitledBorder(etched_border,"Cavities' Parameters"))
		init_buttons_panel = Init_Cav_Controllers_Panel(self)
		start_stop_panel = Start_Stop_Panel(self)
		#---- fake scan button
		self.keepAllCavParams_RadioButton = start_stop_panel.keepAllCavParams_RadioButton
		self.keepAmps_RadioButton = start_stop_panel.keepAmps_RadioButton
		#---- status text field
		self.status_text = start_stop_panel.status_text
		tmp0_panel = JPanel(BorderLayout())
		tmp0_panel.add(init_buttons_panel,BorderLayout.NORTH)
		tmp0_panel.add(scrl_cav_panel,BorderLayout.CENTER)
		tmp0_panel.add(start_stop_panel,BorderLayout.SOUTH)
		tmp1_panel = JPanel(BorderLayout())
		tmp1_panel.add(tmp0_panel,BorderLayout.NORTH)
		left_panel.add(tmp1_panel,BorderLayout.WEST)
		#--------------------------------------------------------
		self.main_panel.add(left_panel,BorderLayout.WEST)
		self.main_panel.add(self.tabbedPane,BorderLayout.CENTER)
		#---- non GUI controllers
		self.particle_tracker_model = Particle_Tracker_Model(self)
		self.env_tracker_model = Envelop_Tracker_Model(self)