コード例 #1
0
    def __init__(self, name, config_tree):

        self.name = name
        self.wago_ip = config_tree["controller_ip"]
        self.controller = None
        self.mapping = ""
        mapping = []
        for module in config_tree["mapping"]:
            module_type = module["type"]
            logical_names = module["logical_names"]
            mapping.append("%s,%s" % (module_type, logical_names))
        self.mapping = "\n".join(mapping)

        self.cnt_dict = {}
        self.cnt_names = []
        self.cnt_gain_names = []

        try:
            self.counter_gain_names = config_tree[
                "counter_gain_names"].replace(" ", "").split(',')
        except:
            pass

        try:
            self.cnt_names = config_tree["counter_names"].replace(
                " ", "").split(',')
        except:
            pass
        else:
            for i, name in enumerate(self.cnt_names):
                self.cnt_dict[name] = i
                add_property(self, name, WagoCounter(name, self, i))
コード例 #2
0
ファイル: wago.py プロジェクト: mguijarr/bliss
  def __init__(self, name, config_tree):

    self.name = name
    self.wago_ip = config_tree["controller_ip"]
    self.controller = None
    self.mapping = ""
    mapping = []
    for module in config_tree["mapping"]:
      module_type = module["type"]
      logical_names = module["logical_names"]
      mapping.append("%s,%s" % (module_type, logical_names))
    self.mapping = "\n".join(mapping)

    self.cnt_dict = {}
    self.cnt_names = []
    try:
      idx = 0
      self.cnt_names = config_tree["counter_names"].replace(" ","").split(',')
      for i in self.cnt_names:
        self.cnt_dict[i] = idx
        self.__counter = WagoCounter(self, i, idx)
        def wc_counter(*args):
          return self.__counter
        add_property(self, i, wc_counter)
        idx += 1
    except:
      pass
コード例 #3
0
   def __init__(self, name, config):
       self.name = name
       self.__counters_grouped_read_handler = BpmGroupedReadHandler(self)

       tango_uri = config.get("uri")
       tango_lima_uri = config.get("lima_uri")
       foil_actuator_name = config.get("foil_name")

       self.__control = DeviceProxy(tango_uri)
       if tango_lima_uri:
           self.__lima_control = DeviceProxy(tango_lima_uri)
       else:
           self.__lima_control = None
       self._acquisition_event = event.Event()
       self._acquisition_event.set()
       self.__diode_actuator = None
       self.__led_actuator = None
       self.__foil_actuator  = None

       bpm_properties = self.__control.get_property_list('*')

       if 'wago_ip' in bpm_properties:
           self.__diode_actuator = Actuator(self.__control.In, 
                                            self.__control.Out,
                                            lambda: self.__control.YagStatus == "in",
                                            lambda: self.__control.YagStatus == "out")
           self.__led_actuator  = Actuator(self.__control.LedOn,
                                           self.__control.LedOff,
                                           lambda: self.__control.LedStatus > 0)
           def diode_current(*args):
               return BpmDiodeCounter("diode_current", self, self.__control)
           add_property(self, "diode_current", diode_current)
           def diode_actuator(*args):
               return self.__diode_actuator
           add_property(self, "diode", diode_actuator)
           def led_actuator(*args):
               return self.__led_actuator
           add_property(self, "led", led_actuator)
       if 'has_foils' in bpm_properties:
           self.__foil_actuator  = Actuator(self.__control.FoilIn,
                                            self.__control.FoilOut,
                                            lambda: self.__control.FoilStatus == "in",
                                            lambda: self.__control.FoilStatus == "out")
           def foil_actuator(*args):
               return self.__foil_actuator
           if not foil_actuator_name:
               foil_actuator_name = 'foil'
           add_property(self, foil_actuator_name, foil_actuator)
コード例 #4
0
ファイル: tango_bpm.py プロジェクト: mguijarr/bliss
   def __init__(self, name, config):
       self.name = name

       tango_uri = config.get("uri")
       foil_actuator_name = config.get("foil_name")

       self.__control = PyTango.gevent.DeviceProxy(tango_uri)
       self.__acquisition_event = gevent.event.Event()
       self.__acquisition_event.set()
       self.__last_acq = None
       self.__diode_actuator = None
       self.__led_actuator = None
       self.__foil_actuator  = None

       bpm_properties = self.__control.get_property_list('*')

       if 'wago_ip' in bpm_properties:
           self.__diode_actuator = Actuator(self.__control.In, 
                                            self.__control.Out,
                                            lambda: self.__control.YagStatus == "in",
                                            lambda: self.__control.YagStatus == "out")
           self.__led_actuator  = Actuator(self.__control.LedOn,
                                           self.__control.LedOff,
                                           lambda: self.__control.LedStatus > 0)
           def diode_current(*args):
               return BpmCounter(self, "diode_current", "_read_diode_current")
           add_property(self, "diode_current", diode_current)
           def diode_actuator(*args):
               return self.__diode_actuator
           add_property(self, "diode", diode_actuator)
           def led_actuator(*args):
               return self.__led_actuator
           add_property(self, "led", led_actuator)
       if 'has_foils' in bpm_properties:
           self.__foil_actuator  = Actuator(self.__control.FoilIn,
                                            self.__control.FoilOut,
                                            lambda: self.__control.FoilStatus == "in",
                                            lambda: self.__control.FoilStatus == "out")
           def foil_actuator(*args):
               return self.__foil_actuator
           if not foil_actuator_name:
               foil_actuator_name = 'foil'
           add_property(self, foil_actuator_name, foil_actuator)