Esempio n. 1
0
    def __init__(self):

        # Chama o construtor da superclasse
        Driver.__init__(self)

        # Define condicoes iniciais das variáveis EPICS de escrita
        for module in BLMs:
                self.setParam("UVX:CountingPRU:" + sys.argv[1] + ":" + module, 0)
                self.setParamStatus("UVX:CountingPRU:" + sys.argv[1] + ":" + module, Alarm.NO_ALARM, Severity.NO_ALARM)
		if module == "Bergoz1" or module == "Bergoz2":
			self.setParam("UVX:CountingPRU:" + sys.argv[1] + ":" + module + "-InhA", 0)
			self.setParam("UVX:CountingPRU:" + sys.argv[1] + ":" + module + "-InhB", 0)
			self.setParamStatus("UVX:CountingPRU:" + sys.argv[1] + ":" + module + "-InhA", Alarm.NO_ALARM, Severity.NO_ALARM)
			self.setParamStatus("UVX:CountingPRU:" + sys.argv[1] + ":" + module + "-InhB", Alarm.NO_ALARM, Severity.NO_ALARM)


        self.setParam("UVX:CountingPRU:" + sys.argv[1] + ":TimeBase", 1)
        self.setParamStatus("UVX:CountingPRU:" + sys.argv[1] + ":TimeBase", Alarm.NO_ALARM, Severity.NO_ALARM)

        # Fila de prioridade
        self.queue = PriorityQueue()

        # Objeto do tipo Event para temporizacao das leituras
        self.event = threading.Event()

        # Cria, configura e inicializa as threads
        self.process = threading.Thread(target = self.processThread)
        self.scan = threading.Thread(target = self.scanThread)

        self.process.setDaemon(True)
        self.scan.setDaemon(True)

        self.process.start()
        self.scan.start()
    def  __init__(self):
        Driver.__init__(self)

        #Read configuration file content
        self.configReader = PoemonitorConfigReader()
        self.configData = self.configReader.readFile(CONFIG_FILE_NAME)

        #Create one request queue for each switch and set their connetion status as disconnected
        for i in range(0, self.configReader.getNumberOfSwitchesFrom(self.configData)):
            self.listOfQueues.append(Queue())
            self.connectionStatusList.append(False)

        #Event object used for periodically read the PVs values
        self.event = Event()

        #Define and start the scan thread
        self.scan = Thread(target = self.scanThread)
        self.scan.setDaemon(True)
        self.scan.start()

        #Define and start all the process threads
        for i in range(0,len(self.listOfQueues)):
            th = Thread(target = self.processThread, args=[i])
            th.setDaemon(True)
            th.start()
 def __init__(self):
     Driver.__init__(self)
     self.tid = None
     self.images = None
     self.device = pixet.devices()[DETECTOR_ID]
     self.setParam('Model_RBV', self.device.fullName())
     self.setParam('MaxSizeX_RBV', self.device.width())
     self.setParam('MaxSizeY_RBV', self.device.height())
Esempio n. 4
0
 def __init__(self, cams):
     """Get array of pair [cam, Prefixs] where prefix is xxxx:PREFIX:yyyy"""
     Driver.__init__(self)
     self.n_iocs = 0
     self.ioc = []
     self.prefix = []
     for i in cams:
         self.n_iocs += 1
         self.ioc.append(ueye_ioc.ThorCamIOC(i[0], self, i[1]))
         self.prefix.append(i[1])
Esempio n. 5
0
    def __init__(self):

        Driver.__init__(self)

        self.serial = serial.Serial ("/dev/ttyUSB0", baudrate = 9600, \
                                     parity = serial.PARITY_EVEN, \
                                     bytesize = 8, stopbits = 1)

        self.scanThread = threading.Thread(target=self.scan)

        self.scanThread.start()
    def __init__(self):
        Driver.__init__(self)
        self.saveData = False
        self.filename = ''

        if TESTING:
            self.proxy = DummyProxy()
        else:
            # The server will be running without a Tango database, so the connection is made using
            self.proxy = PyTango.DeviceProxy('tango://localhost:12345/mira/cascade/tofchannel#dbase=no')
            # The "mira/cascade/tofchannel" part depends on what is configured in the Entangle resource file.
        
        self.tid = threading.Thread(target = self.doWork)
        self.tid.setDaemon(True)
        self.tid.start()
Esempio n. 7
0
    def __init__(self, ctx):
        Driver.__init__(self)
        self.context = ctx
        self.logger = logging.getLogger('')
        self.initSocket()
        self.fzcok = True
        self.iocstatus = ""
        self.report = NodeReport.NodeSet()

        self.sockmutex = Lock()
        self.repmutex = Lock()
        self.eid = Event()
        self.tid = Thread(target=self.runIOC)
        self.tid.setDaemon(True)
        self.tid.start()
        self.logger.info("main thread started")
    def __init__(self):

        Driver.__init__(self)

        self.queue = Queue()

        self.event = threading.Event()

        self.process = threading.Thread(target=self.processThread)
        self.scan = threading.Thread(target=self.scanThread)

        self.process.setDaemon(True)
        self.scan.setDaemon(True)

        self.process.start()
        self.scan.start()
    def __init__(self, input_pv_name, output_pv_name):

        Driver.__init__(self)

        self.input_pv_name = input_pv_name
        self.output_pv_name = output_pv_name

        self.data_buffer = []

        self.queue = Queue()

        self.process_thread = threading.Thread(target=self.processThread)
        self.process_thread.setDaemon(True)
        self.process_thread.start()

        camonitor(self.input_pv_name, callback=self.enqueueData)
Esempio n. 10
0
    def __init__(self, ctx):

        Driver.__init__(self)
        self.context = ctx
        self.logger = logging.getLogger('')
        self.initSocket()
        self.fznmok = True
        self.iocstatus = ""
        self.report = NodeReport.Node()

        self.sockmutex = Lock()
        self.repmutex = Lock()
        self.eid = Event()
        self.tid = Thread(target = self.runIOC) 
        self.tid.setDaemon(True)
        self.tid.start()
        self.logger.info("main thread started")
Esempio n. 11
0
    def __init__(self, communication_driver, pump_polling_interval, hostname):
        connectionError = True  # Also set when pump is not connected
        Driver.__init__(self)
        _logger.info(
            "Starting epics driver with polling interval '%s' seconds.",
            pump_polling_interval)

        super().setParam(hostname_PV, hostname)

        self.communication_driver = communication_driver
        self.pump_polling_interval = pump_polling_interval
        # Start login thread.
        self.login_thread = Thread(target=self.try_connect)
        self.login_thread.setDaemon(True)
        self.login_thread.start()
        # Start the polling and connection check thread.
        self.polling_thread = Thread(target=self.poll_pump)
        self.polling_thread.setDaemon(True)
        self.polling_thread.start()
Esempio n. 12
0
    def __init__(self, PV_input, PV_output):

        Driver.__init__(self)

        self.PV_input = PV_input
        self.PV_output = PV_output

        # created variables
        self.dataBuffer = []

        # start queue
        self.queue = Queue()

        # start others threads
        self.process_thread = threading.Thread(target=self.processThread)
        self.process_thread.setDaemon(True)
        self.process_thread.start()

        # monitor of PV element
        camonitor(self.PV_input, callback=self.enqueueData)
Esempio n. 13
0
    def __init__(self):

        Driver.__init__(self)

        self.serial = serial.Serial('/dev/ttyUSB0', baudrate = 9600, bytesize = 8, parity = 'N', dsrdtr = True)
        
        # Limpa qualquer dado que esteja no buffer, evitando um 'bip' de erro. 
        self.serial.timeout = 1
        self.serial.readline()
        self.serial.flushInput()
        self.serial.flushOutput()
        self.serial.timeout = None
        
        self.event = threading.Event()
        
        # Resposta do multimetro eh constituida de 17 bytes, no formato abaixo
        self.HP232_readbytes = "+9.99999999E-99\r\n"

        # scan_delay regula o intervalo de tempo em que a thread scan realiza requisicoes 
        self.scan_delay = 1
        self.scan = threading.Thread(target = self.scanThread)
        self.process = threading.Thread(target = self.processThread)
        self.prosac_server = threading.Thread (target = self.prosacServer)
        
        self.scan.setDaemon(True)
        self.process.setDaemon(True)
        self.prosac_server.setDaemon(True)

        # Operacoes de AJUSTE sempre terao mais prioridade que operacoes
        # de leitura
        self.queue = PriorityQueue()
        self.queue.put((0, [PROSACommand.ADJUST, 10]))

        logging.info("class pyHP232 PROSAC2Serial inicializada.")

        self.process.start()
        self.scan.start()
        self.prosac_server.start()
Esempio n. 14
0
    def __init__(self, driver, prefixs):
        Driver.__init__(self)
        self.driver = driver
        self.ready = False
        if not (len(prefixs) == 12):
            logger.exception("Not enough channels.")
            return

        self._prefixs = prefixs
        for i in range(6):
            self.setParam("%s.PRESSURE" % self._prefixs[i],
                          self.driver.pressures[i])
            self.setParam("%s.STATUS" % self._prefixs[i],
                          self.driver.status[i])
            self.setParam("%s.NAME" % self._prefixs[i], self.driver.names[i])
            print(self.driver.names[i])
            self.setParam("%s.TYPE" % self._prefixs[i], self.driver.types[i])
        for i in range(6, 12):
            self.setParam("%s.SENSOR" % self._prefixs[i],
                          int(self.driver.relay[i - 6][0]))
            self.setParam("%s.LOWER" % self._prefixs[i],
                          float(self.driver.relay[i - 6][1]))
            self.setParam("%s.UPPER" % self._prefixs[i],
                          float(self.driver.relay[i - 6][2]))
Esempio n. 15
0
    def __init__(self):

        Driver.__init__(self)
        
        self._ntp_scan_thread = threading.Thread(target = self._poll_ntp)
        self._ntp_scan_thread.setDaemon(True)
        
        self._gpsd_scan_thread = threading.Thread(target = self._poll_gpsd)
        self._gpsd_scan_thread.setDaemon(True)
        
        self._gpsd_poll_thread = threading.Thread(target = self._update_gpsd)
        self._gpsd_poll_thread.setDaemon(True)
        
        # Instantiate object which communicates with ntp server 
        self._ntpclient = ntplib.NTPClient()
        
        self._gpsdclient = gps.gps(mode = gps.WATCH_ENABLE)  #starting the stream of info)
        
        # Change here to modify ip address of the server to be requested
        self.setParam("NTP:Address", _address)
        self.setParamStatus("NTP:Address", Alarm.NO_ALARM, Severity.NO_ALARM)
        
        #self.setParam("NTP:Address", socket.gethostbyname(socket.gethostname()))
        
        self.setParam("GPS:Fix", 0)
        
        # Log file initialization
        self.log_file = open(os.path.dirname(os.path.realpath(sys.argv[0])) + "/GPS-PV-Server.log", "a")
        self.log_file.write(time_string() + "GPS PVs Server initialized.\n")
        self.log_file.flush()
        
        print 'PV server initialized.'

        self._ntp_scan_thread.start()
        self._gpsd_poll_thread.start()
        self._gpsd_scan_thread.start()
Esempio n. 16
0
 def __init__(self):
     Driver.__init__(self)
     self.tid = None
Esempio n. 17
0
 def __init__(self):
     Driver.__init__(self)
     self.eid = threading.Event()
     self.tid = threading.Thread(target=self.wait_task)
     self.tid.setDaemon(True)
     self.tid.start()
Esempio n. 18
0
 def __init__(self):
     Driver.__init__(self)
     self.eid = threading.Event()
     self.tid = threading.Thread(target=self.runSimScope)
     self.tid.setDaemon(True)
     self.tid.start()
Esempio n. 19
0
 def start(self):
   Driver.__init__(self)   # must be called after SimpleServer creation 
   self.updateFilePVs()
Esempio n. 20
0
 def __init__(self):
     Driver.__init__(self)
     self.eid = threading.Event()
     self.tid = threading.Thread(target = self.runSimScope) 
     self.tid.setDaemon(True)
     self.tid.start()
Esempio n. 21
0
 def __init__(self):
     Driver.__init__(self)
     self.tid = None
     self.images = None
     self.mcd = HamamatsuMCD()
Esempio n. 22
0
 def __init__(self):
     Driver.__init__(self)
     self.tid = None 
Esempio n. 23
0
 def __init__(self):
     """Get array of pair [cam, Prefixs] where prefix is xxxx:PREFIX:yyyy"""
     Driver.__init__(self)
     self.ioc = []
     self.prefix = []
Esempio n. 24
0
 def __init__(self):
     Driver.__init__(self)
Esempio n. 25
0
 def __init__(self):
     # call the superclass constructor
     Driver.__init__(self)
Esempio n. 26
0
 def __init__(self):
     Driver.__init__(self)