Esempio n. 1
0
class LevelController(threading.Thread):
    def __init__(self):
        logger.log_msg('Conectando')
        self.interface = Interface(REQ_ADDR, PUSH_ADDR)
        logger.log_msg('Conectado')
        threading.Thread.__init__(self)
        self.setpoint = 0.0

        self.LRC = PIController(60, 1.2, 0, -1300, 1300, CONTROLLER_STEP)
        self.out = 0

    def step(self):
        L = float(self.interface.request('L'))
        q_s = float(self.interface.request('qs'))

        self.LRC.step(L)

        self.out = q_s + self.LRC.out

        self.interface.send_cmd('qf = ' + str(self.out))

    def run(self):
        logger.log_msg('Iniciando controlador')
        while True:
            self.step()
            time.sleep(CONTROLLER_STEP)
Esempio n. 2
0
class PressureController(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        logger.log_msg('Conectando')
        self.interface = Interface(REQ_ADDR, PUSH_ADDR)
        logger.log_msg('Conectado')

        # configura controlador
        self.controller = PIController(6e7, 3e6, 8.5, -1e12, 1e12, PRESSURE_STEP)

        # Offset usado
        self.Q0 = float(self.interface.request('Q'))

    def step(self):
        # Atualiza valor de acordo com controlador e envia par acaldeira
        P = float(self.interface.request('P'))
        self.controller.step(P)
        self.interface.send_cmd('Q = ' + str(self.Q0 + self.controller.out))

    def run(self):
        logger.log_msg('Iniciando controlador')
        while True:
            self.step()

            time.sleep(PRESSURE_STEP)
Esempio n. 3
0
class LevelController(threading.Thread):
    def __init__(self):
        logger.log_msg('Conectando')
        self.interface = Interface(REQ_ADDR, PUSH_ADDR)
        logger.log_msg('Conectado')
        threading.Thread.__init__(self)
        self.setpoint = 0.0

        self.LRC = PIController(60, 1.2, 0, -1300, 1300, CONTROLLER_STEP)
        self.out = 0

    def step(self):
        L = float(self.interface.request('L'))
        q_s = float(self.interface.request('qs'))

        self.LRC.step(L)

        self.out = q_s + self.LRC.out

        self.interface.send_cmd('qf = ' + str(self.out))

    def run(self):
        logger.log_msg('Iniciando controlador')
        while True:
            self.step()
            time.sleep(CONTROLLER_STEP)
Esempio n. 4
0
class PressureController(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        logger.log_msg('Conectando')
        self.interface = Interface(REQ_ADDR, PUSH_ADDR)
        logger.log_msg('Conectado')

        # configura controlador
        self.controller = PIController(6e7, 3e6, 8.5, -1e12, 1e12,
                                       PRESSURE_STEP)

        # Offset usado
        self.Q0 = float(self.interface.request('Q'))

    def step(self):
        # Atualiza valor de acordo com controlador e envia par acaldeira
        P = float(self.interface.request('P'))
        self.controller.step(P)
        self.interface.send_cmd('Q = ' + str(self.Q0 + self.controller.out))

    def run(self):
        logger.log_msg('Iniciando controlador')
        while True:
            self.step()

            time.sleep(PRESSURE_STEP)
class PressureController(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        logger.log_msg('Conectando')
        self.interface = Interface(REQ_ADDR, PUSH_ADDR)
        logger.log_msg('Conectado')
        self.controller = PIController(6e7, 3e6, 8.5, -1e12, 1e12, PRESSURE_STEP)
        self.Q0 = float(self.interface.request('Q'))

    def step(self):
        P = float(self.interface.request('P'))
        self.controller.step(P)
        logger.log_msg(P, self.controller.p_port, self.controller.i_port, self.controller.d_port)
        self.interface.send_cmd('Q = ' + str(self.Q0 + self.controller.out))

    def run(self):
        logger.log_msg('Iniciando controlador')
        while True:
            self.step()

            time.sleep(PRESSURE_STEP)