Example #1
0
# -*- coding: utf-8 -*-
""" This module contains drivers for equipment from Omega. Specifically it
contains a driver for the ??? thermo couple read out unit.
"""
from __future__ import print_function
import time
import logging
import serial
from PyExpLabSys.common.supported_versions import python2_and_3
# Configure logger as library logger and set supported python versions
LOGGER = logging.getLogger(__name__)
LOGGER.addHandler(logging.NullHandler())
python2_and_3(__file__)


class ISeries(object):
    """Driver for the iSeries omega temperature controllers"""

    pre_string = chr(42)
    end_string = chr(13)

    def __init__(self, port, baudrate=19200, comm_stnd='rs232'):
        """Initialize internal parameters

        :param port: A serial port designation as understood by `pySerial
            <http://pyserial.sourceforge.net/pyserial_api.html#native-ports>`_
        """
        LOGGER.debug('Initialize driver')
        self.serial = serial.Serial(port,
                                    baudrate,
                                    bytesize=serial.SEVENBITS,
Example #2
0
""" Logger module for the UPS """
from __future__ import print_function
import threading
import time
import socket
from PyExpLabSys.common.value_logger import ValueLogger
from PyExpLabSys.common.database_saver import ContinuousDataSaver
from PyExpLabSys.common.sockets import DateDataPullSocket
from PyExpLabSys.common.sockets import LiveSocket
import PyExpLabSys.drivers.galaxy_3500 as galaxy_3500
from PyExpLabSys.common.supported_versions import python2_and_3
import credentials
python2_and_3(__file__)

class UpsReader(threading.Thread):
    """ Run the ups-instance and keep status updated """
    def __init__(self, ups):
        threading.Thread.__init__(self)
        self.ups = ups
        self.status = ups.status
        self.ttl = 100
        self.quit = False

    def value(self, channel):
        """ Return the value of the reader """
        self.ttl = self.ttl - 1
        if self.ttl < 0:
            self.quit = True
        value_params = ['Internal Temperature', 'Output kVA L1',
                        'Output kVA L2', 'Output kVA L3',
                        'Output Current L1', 'Output Current L2',