def __init__(self, datasocket=None):
     threading.Thread.__init__(self)
     if datasocket is not None:
         self.datasocket = datasocket
     else:
         self.datasocket = None    
     self.measured_voltage = 0
     self.filament = {}
     self.filament['device'] = CPX.CPX400DPDriver(1, usbchannel=0)
     self.filament['voltage'] = 0
     self.filament['current'] = 0
     self.filament['idle_voltage'] = 3
     self.filament['device'].set_current_limit(5)
     self.filament['device'].output_status(True)
     self.bias = {}
     self.bias['device'] = CPX.CPX400DPDriver(2, usbchannel=0)
     self.bias['grid_voltage'] = 0
     self.bias['grid_current'] = 0
     self.bias['device'].output_status(True)
     self.looptime = 0
     self.update_setpoint(0.2)
     self.adc = DeltaSigma(0x68, 0x69, 18)
     self.adc.setPGA(8)  # Adjust this if resistor value is changed
     self.running = True
     self.wanted_voltage = 0
     self.emission_current = 999
     self.pid = pid.PID(2, 0.07, 0, 9)
     self.pid.UpdateSetpoint(self.setpoint)
Beispiel #2
0
def main():
    """ Main function """
    ps1 = cpx.CPX400DPDriver(1, device='/dev/ttyACM0', interface='serial')
    ps2 = cpx.CPX400DPDriver(2, device='/dev/ttyACM0', interface='serial')
    isotech = ips.IPS(
        '/dev/serial/by-id/' +
        'usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0')

    pullsocket = DateDataPullSocket(
        'vhp_temp_control',
        ['setpoint', 'dutycycle', 'pid_p', 'pid_i', 'pid_e'],
        timeouts=[999999, 3.0, 3.0, 3.0, 3.0],
        port=9001)
    pullsocket.start()

    pushsocket = DataPushSocket('vhp_push_control', action='store_last')
    pushsocket.start()

    power_calc = PowerCalculatorClass(pullsocket, pushsocket)
    power_calc.daemon = True
    power_calc.start()

    heater = HeaterClass(power_calc, pullsocket, ps1, ps2, isotech)
    heater.start()

    tui = CursesTui(heater, ps1)
    tui.daemon = True
    tui.start()
Beispiel #3
0
def main():
    """ Main function """
    power_supplies = {}
    for i in range(1, 3):
        power_supplies[i] = cpx.CPX400DPDriver(
            i,
            interface='lan',
            hostname='cinf-palle-heating-ps',
            tcp_port=9221)
        power_supplies[i].set_voltage(0)
        power_supplies[i].output_status(True)

    codenames = [
        'setpoint', 'wanted_voltage', 'actual_voltage_1', 'actual_voltage_2',
        'actual_current_1', 'actual_current_2', 'power', 'temperature'
    ]
    pullsocket = DateDataPullSocket(
        'palle_temp_control',
        codenames,
        timeouts=[999999, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0])
    pullsocket.start()

    pushsocket = DataPushSocket('mgw_push_control', action='store_last')
    pushsocket.start()

    power_calculator = PowerCalculatorClass(pullsocket, pushsocket)
    power_calculator.daemon = True
    power_calculator.start()

    heater = HeaterClass(power_calculator, pullsocket, power_supplies)
    heater.start()

    tui = CursesTui(heater)
    tui.daemon = True
    tui.start()
Beispiel #4
0
 def init_heater_class(self, ):
     dev_port = '/dev/serial/by-id/usb-TTI_CPX400_Series_PSU_C2F9545A-if00'
     self.heater = CPX.CPX400DPDriver(1,
                                      interface='serial',
                                      device=dev_port)
     self.status['ID'] = self.heater.read_software_version()
     print 'ID: ' + self.status['ID']
Beispiel #5
0
def main():
    """ Main function """
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    sock.settimeout(1)
    try:
        network_adress = 'rasppi12'
        command = 'microreactorng_temp_sample#raw'.encode()
        sock.sendto(command, (network_adress, 9000))
        received = sock.recv(1024)
        received = received.decode('ascii')
        if received == 'OLD_DATA':
            raise RuntimeError(
                "Received OLD_DATA from rasppi12. Please check it.")
        start_temp = float(received[received.find(',') + 1:])
        agilent_hostname = '10.54.6.56'
        rtd_reader = RtdReader(agilent_hostname, start_temp)
    except socket.timeout:
        print('Could not find rasppi12')
        exit()
    rtd_reader.daemon = True
    rtd_reader.start()
    time.sleep(1)

    power_supply = {}
    for k in range(1, 3):
        power_supply[k] = cpx.CPX400DPDriver(
            k,
            interface='lan',
            hostname='surfcat-stm312-heating-ps',
            tcp_port=9221)
        power_supply[k].set_voltage(0)
        power_supply[k].output_status(True)

    codenames = [
        'setpoint', 'wanted_voltage', 'actual_voltage_1', 'actual_voltage_2',
        'actual_current_1', 'actual_current_2', 'power', 'temperature'
    ]
    pullsocket = DateDataPullSocket(
        MICRO + '-reactorng_temp_control',
        codenames,
        timeouts=[999999, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0])
    pullsocket.start()

    pushsocket = DataPushSocket(MICRO + '-reactorng_push_control',
                                action='store_last')
    pushsocket.start()

    power_calculator = PowerCalculatorClass(pullsocket, pushsocket, rtd_reader)
    power_calculator.daemon = True
    power_calculator.start()

    heater = HeaterClass(power_calculator, pullsocket, power_supply)
    heater.start()

    tui_class = CursesTui(heater)
    tui_class.start()
    LOGGER.info('script ended')
 def __init__(self):
     threading.Thread.__init__(self)
     port = '/dev/serial/by-id/usb-TTI_CPX400_Series_PSU_5512626F-if00'
     self.dca = cpx.CPX400DPDriver(1, interface='serial', device=port)
     self.mai = cpx.CPX400DPDriver(2, interface='serial', device=port)
     self.dca.set_current_limit(9)
     self.mai.set_current_limit(5)
     self.voltage = {}
     self.voltage['mai'] = 0
     self.voltage['dca'] = 0
     self.dca.output_status(True)
     self.mai.output_status(True)
     self.actual_voltage = {}
     self.actual_current = {}
     self.actual_voltage['mai'] = 0
     self.actual_current['mai'] = 0
     self.actual_voltage['dca'] = 0
     self.actual_current['dca'] = 0
     self.quit = False
def main():
    """ Main function """
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    sock.settimeout(1)
    try:
        temperature_string = 'mr_sample_tc_temperature#raw'
        sock.sendto(temperature_string.encode('ascii'), ('rasppi12', 9000))
        received = sock.recv(1024).decode('ascii')
        start_temp = float(received[received.find(',') + 1:])
    except socket.gaierror:
        print('Could not find rasppi12')
        exit()
    except ValueError:
        print('Bad reply from rasppi12')
        exit()
    rtd_reader = RtdReader(start_temp)

    rtd_reader.daemon = True
    rtd_reader.start()
    time.sleep(1)

    power_supply = {}
    for k in range(1, 3):
        power_supply[k] = cpx.CPX400DPDriver(k,
                                             interface='serial',
                                             device='/dev/ttyACM0')
        power_supply[k].set_voltage(0)
        power_supply[k].output_status(True)

    codenames = [
        'setpoint', 'wanted_voltage', 'actual_voltage_1', 'actual_voltage_2',
        'actual_current_1', 'actual_current_2', 'power', 'temperature'
    ]
    pullsocket = DateDataPullSocket(
        MICRO + '-reactor_temp_control',
        codenames,
        timeouts=[999999, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0])
    pullsocket.start()

    pushsocket = DataPushSocket(MICRO + '-reactor push control',
                                action='store_last')
    pushsocket.start()

    power_calculator = PowerCalculatorClass(pullsocket, pushsocket, rtd_reader)
    power_calculator.daemon = True
    power_calculator.start()

    heater = HeaterClass(power_calculator, pullsocket, power_supply)
    heater.start()

    tui = CursesTui(heater)
    tui.daemon = True
    tui.start()
Beispiel #8
0
    def __init__(self):
        threading.Thread.__init__(self)
        channels = ['setpoint', 'emission', 'ionenergy']
        self.datasocket = DateDataPullSocket(
            'emission_tof', channels, timeouts=[99999999, 1.0, 99999999])
        self.datasocket.start()
        self.pushsocket = DataPushSocket('tof-emission-push_control',
                                         action='enqueue')
        self.pushsocket.start()
        self.livesocket = LiveSocket('tof-emission', channels)
        self.livesocket.start()
        self.filament = {}
        port = '/dev/serial/by-id/usb-TTI_CPX400_Series_PSU_C2F952E5-if00'
        self.filament['device'] = CPX.CPX400DPDriver(1,
                                                     interface='serial',
                                                     device=port)
        self.filament['voltage'] = 0
        self.filament['current'] = 0
        self.filament['idle_voltage'] = 1.7
        self.filament['device'].set_current_limit(4.0)
        self.filament['device'].output_status(True)
        self.bias = {}
        self.bias['device'] = CPX.CPX400DPDriver(2,
                                                 interface='serial',
                                                 device=port)
        self.bias['grid_voltage'] = 0
        self.bias['grid_current'] = 0
        self.bias['device'].output_status(True)
        cns = 'USB0::0x0957::0x0607::MY45000583::INSTR'
        self.bias['current_reader'] = a34410A.Agilent34410ADriver(
            interface='usbtmc', connection_string=cns)

        self.bias['current_reader'].select_measurement_function('CURRENT')
        self.pid = pid.PID(0.01, 0.1, 0, 4)
        self.looptime = 0
        self.setpoint = 0.05
        self.pid.update_setpoint(self.setpoint)
        self.running = True
        self.wanted_voltage = 0
        self.emission_current = 999
def main():
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    sock.settimeout(1)
    try:
        temperature_string = 'mr_sample_tc_temperature#raw'
        sock.sendto(temperature_string.encode('ascii'), ('rasppi12', 9000))
        received = sock.recv(1024).decode('ascii')
        start_temp = float(received[received.find(',') + 1:])
        agilent_hostname = '10.54.6.79'
        rtd_reader = RtdReader(agilent_hostname, start_temp)
    except:
        print('Could not find rasppi12')
        exit()

    rtd_reader.daemon = True
    rtd_reader.start()
    time.sleep(1)

    PS = {}
    for k in range(1, 3):
        PS[k] = cpx.CPX400DPDriver(k,
                                   interface='serial',
                                   device='/dev/ttyACM0')
        PS[k].set_voltage(0)
        PS[k].output_status(True)

    try:
        micro = chr(0x03BC)  # Python 3
    except ValueError:
        micro = unichr(0x03BC)  # Python 2
    Pullsocket = DateDataPullSocket(micro + 'reactor temp_control',
                                    ['setpoint', 'voltage', 'temperature'],
                                    timeouts=[999999, 3.0, 3.0],
                                    port=9000)
    Pullsocket.start()

    Pushsocket = DataPushSocket(micro + '-reactor push control',
                                action='store_last')
    Pushsocket.start()

    pcc = PowerCalculatorClass(Pullsocket, Pushsocket, rtd_reader)
    pcc.daemon = True
    pcc.start()

    heater = HeaterClass(P, Pullsocket, PS)
    heater.start()

    tui = CursesTui(H)
    tui.daemon = True
    tui.start()
 def __init__(self):
     threading.Thread.__init__(self)
     channels = ['setpoint', 'emission', 'ionenergy']
     self.datasocket = DateDataPullSocket(
         'emission_tof', channels, timeouts=[99999999, 1.0, 99999999])
     self.datasocket.start()
     self.pushsocket = DataPushSocket('tof-emission-push_control',
                                      action='enqueue')
     self.pushsocket.start()
     self.livesocket = LiveSocket('tof-emission', channels, 1)
     self.livesocket.start()
     self.filament = {}
     port = '/dev/serial/by-id/usb-TTI_CPX400_Series_PSU_C2F952E5-if00'
     self.filament['device'] = CPX.CPX400DPDriver(1,
                                                  interface='serial',
                                                  device=port)
     self.filament['voltage'] = 0
     self.filament['current'] = 0
     self.filament['idle_voltage'] = 1.7
     self.filament['device'].set_current_limit(7)
     self.filament['device'].output_status(True)
     self.bias = {}
     port = '/dev/serial/by-id/'
     port += 'usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port0'
     self.keithley_port = port
     self.bias['device'] = smu.KeithleySMU(interface='serial',
                                           device=self.keithley_port)
     self.bias['grid_voltage'] = 0
     self.bias['grid_current'] = 0
     self.bias['device'].output_state(True)
     self.pid = pid.PID(0.01, 0.1, 0, 4)
     self.looptime = 0
     self.setpoint = 0.05
     self.pid.update_setpoint(self.setpoint)
     self.running = True
     self.wanted_voltage = 0
     self.emission_current = 999
Beispiel #11
0
        while not self.quit:
            self.voltage = self.pc.read_power()
            self.pullsocket.set_point_now('voltage', self.voltage)
            for i in range(1, 3):
                self.ps[i].set_voltage(self.voltage)
            time.sleep(0.25)
        for i in range(1, 3):
            self.ps[i].set_voltage(0)
            self.ps[i].output_status(False)


port = '/dev/serial/by-id/usb-TTI_CPX400_Series_PSU_55126216-if00'
PS = {}
for i in range(1, 3):
    PS[i] = cpx.CPX400DPDriver(i,
                               interface='lan',
                               hostname='cinf-palle-heating-ps',
                               tcp_port=9221)
    PS[i].set_voltage(0)
    PS[i].output_status(True)

Pullsocket = DateDataPullSocket('mgw_temp_control', ['setpoint', 'voltage'],
                                timeouts=[999999, 3.0],
                                port=9000)
Pullsocket.start()

Pushsocket = DataPushSocket('mgw_push_control', action='store_last')
Pushsocket.start()

P = PowerCalculatorClass(Pullsocket, Pushsocket)
P.daemon = True
P.start()
    sock.sendto('microreactorng_temp_sample#raw', ('rasppi12', 9000))
    received = sock.recv(1024)
    start_temp = float(received[received.find(',') + 1:])
    agilent_hostname = 'microreactor-agilent-34410A'
    rtd_reader = RtdReader(agilent_hostname, start_temp)
except:
    print('Could not find rasppi12')
    exit()
rtd_reader.daemon = True
rtd_reader.start()
time.sleep(1)

PS = {}
for k in range(1, 3):
    PS[k] = cpx.CPX400DPDriver(k,
                               interface='lan',
                               hostname='cinf-microreactorng-heating-ps',
                               tcp_port=9221)
    PS[k].set_voltage(0)
    PS[k].output_status(True)

Pullsocket = DateDataPullSocket('microreactorng_temp_control',
                                ['setpoint', 'voltage', 'temperature'],
                                timeouts=[999999, 3.0, 3.0],
                                port=9000)
Pullsocket.start()

Pushsocket = DataPushSocket('microreactorng_push_control', action='store_last')
Pushsocket.start()

P = PowerCalculatorClass(Pullsocket, Pushsocket, rtd_reader)
P.daemon = True