Пример #1
0
	def setBPMs(self,bpm_wrappers):
		self.batchGetRequest = BatchGetValueRequest()
		self.bpm_wrappers = bpm_wrappers
		#--------------------------------------------
		self.bpm_ch_amp_phase_dict = {}
		self.bpm_old_phases_dict = {}	
		ch_arr = []
		for bpm_wrapper in self.bpm_wrappers:
			if(not bpm_wrapper.isGood): continue
			bpm = bpm_wrapper.getBPM()
			ch_ampl = ChannelFactory.defaultFactory().getChannel(bpm.getId()+":amplitudeAvg")
			ch_phase = ChannelFactory.defaultFactory().getChannel(bpm.getId()+":phaseAvg")
			if(ch_ampl.connectAndWait(0.5) and ch_phase.connectAndWait(0.5)):		
				self.bpm_ch_amp_phase_dict[bpm_wrapper] = (ch_ampl,ch_phase)
				#print "debug bpm=",bpm_wrapper.alias," added!"
				ch_arr.append(ch_ampl)
				ch_arr.append(ch_phase)
			else:
				bpm_wrapper.isGood = false
				#print "debug bad BPM =",bpm_wrapper.alias
		for ch in ch_arr:
			self.batchGetRequest.addChannel(ch)