def set_value(self, device_name, val): #ch = 'XFEL.MAGNETS/MAGNET.ML/' + device_name + '/CURRENT.SP' ch = 'XFEL.MAGNETS/MAGNET.ML/' + device_name + '/KICK_MRAD.SP' print (ch, val) #self.mutex.acquire() pydoocs.write(ch, str(val)) #self.mutex.release() return 0
def set_value(self, device_name, val): #ch = 'XFEL.MAGNETS/MAGNET.ML/' + device_name + '/CURRENT.SP' ch = 'XFEL.MAGNETS/MAGNET.ML/' + device_name + '/KICK_MRAD.SP' print(ch, val) #self.mutex.acquire() pydoocs.write(ch, str(val)) #self.mutex.release() return 0
def set_value(self, channel, val): """ Method to set value to a channel :param channel: (str) String of the devices name used in doocs :param val: value :return: None """ pydoocs.write(channel, float(val)) return
def set_value(self, channel, val): """ Method to set value to a channel :param channel: (str) String of the devices name used in doocs :param val: value :return: None """ #print("SETTING") pydoocs.write(channel, val) return
def set_value(self, device_name, val): if device_name.find("ACC")>=0: ch = 'FLASH.RF/LLRF.CONTROLLER/CTRL.' + device_name elif device_name.find("SUMVOLTAGE")>=0: ch = 'FLASH.RF/LLRF.SUMVOLTAGE_CTRL/ACC139/' + device_name + '.SP.FLASH1' else: ch = 'TTF2.MAGNETS/STEERER/' + device_name + '/PS' print (ch, val) self.mutex.acquire() try: pydoocs.write(ch, str(val)) #pass except: print("Error in pydoocs.write(): ch = ", ch, " val = ", val) self.mutex.release() return 0
def set_value(self, device_name, val): if device_name.find("ACC") >= 0: ch = 'FLASH.RF/LLRF.CONTROLLER/CTRL.' + device_name elif device_name.find("SUMVOLTAGE") >= 0: ch = 'FLASH.RF/LLRF.SUMVOLTAGE_CTRL/ACC139/' + device_name + '.SP.FLASH1' else: ch = 'TTF2.MAGNETS/STEERER/' + device_name + '/PS' print(ch, val) self.mutex.acquire() try: pydoocs.write(ch, str(val)) #pass except: print("Error in pydoocs.write(): ch = ", ch, " val = ", val) self.mutex.release() return 0
def write_doocs_values(self, addresses, doocs_property, value): for address in addresses: address_single = address + doocs_property #print(address_single) try: pyd.write(address_single, value) except: message = "Following address does not allow to set a doocs value" message += address_single if self.textbox != None: self.textbox.setTextColor(QtGui.QColor(255, 0, 0)) self.textbox.append(message) self.textbox.setTextColor(QtGui.QColor(0, 0, 0)) else: print(message)
def write_doocs(self): self.doocs_permit = True try: pydoocs.write("XFEL.UTIL/DYNPROP/HIREX.SA2/PIXEL_CALIBRATION", self.pixel_calibration_mean) self.pixel_doocs = pydoocs.read( "XFEL.UTIL/DYNPROP/HIREX.SA2/PIXEL_CALIBRATION") pydoocs.write("XFEL.UTIL/DYNPROP/HIREX.SA2/CENTRAL_ENERGY", self.dE_mean) self.central_doocs = pydoocs.read( "XFEL.UTIL/DYNPROP/HIREX.SA2/CENTRAL_ENERGY") pydoocs.write("XFEL.UTIL/DYNPROP/HIREX.SA2/FILENAME", self.file_name) self.filename_doocs = pydoocs.read( "XFEL.UTIL/DYNPROP/HIREX.SA2/FILENAME") pydoocs.write("XFEL.UTIL/DYNPROP/HIREX.SA2/TIMESTAMP", self.date_time_obj) self.timestamp_doocs = pydoocs.read( "XFEL.UTIL/DYNPROP/HIREX.SA2/TIMESTAMP") self.ui.output.setText(self.ui.output.text() + "DOOCS PIXEL_CALIBRATION value: " + str(self.pixel_doocs['data']) + '\n') self.ui.output.setText(self.ui.output.text() + "DOOCS CENTRAL_ENERGY value: " + str(self.central_doocs['data']) + '\n') self.ui.output.setText(self.ui.output.text() + "DOOCS FILENAME value: " + str(self.filename_doocs['data']) + '\n') self.ui.output.setText(self.ui.output.text() + "DOOCS TIMESTAMP value: " + str(self.timestamp_doocs['data']) + '\n') except: self.doocs_permit = False if not self.doocs_permit: self.ui.output.setText(self.ui.output.text() + "Control: no permission to write to DOOCS" + '\n')
# init Machine machine = Machine(snapshot) # init DataBase db = SnapshotDB(filename="simple_scan" + time.strftime("%Y%m%d-%H_%M_%S") + ".pcl") # get machine snapshot before scan df_ref = machine.get_machine_snapshot() db.add(df_ref) # scanning loop for x_i in x_range: # set new value print("set: {} <-- {}".format(doocs_ch, x_i)) pydoocs.write(doocs_ch, x_i) # sleep 1 sec. Here maybe we need to wait a bit longer in some cases. Especially if the images are saved time.sleep(1) while True: # check if machine is online. Looking to snapshot alarm channels if machine.is_machine_online(): break else: # if is not online sleep for 3 sec time.sleep(3) print("sleep 3 sec ..") # get machine snapshot df = machine.get_machine_snapshot() # add data to DataBase db db.add(df)