Пример #1
0
def log(igh_ctrl, ilm_ctrl):
    response = qweb.getLoggableInfoForNow('igh')
    sensors = str.split(response, '\n')
    for sensor in sensors:
        if sensor != '':
            found = True
            loggable_name = ''
            props = str.split(sensor, ';')
            for prop in props:
                keyvals = str.split(prop, '=')
                if keyvals[0] == 'loggable_name':
                    loggable_name = keyvals[1]

            # IGH North
            if loggable_name == 'ighn_temp_sorb':
                val = igh_ctrl.SorbTemp
            elif loggable_name == 'ighn_temp_1k':
                val = igh_ctrl.OneKPotTemp
            elif loggable_name == 'ighn_temp_mix':
                val = igh_ctrl.MixChTemp
            elif loggable_name == 'ighn_power_mix':
                val = igh_ctrl.MixChPower
            elif loggable_name == 'ighn_power_still':
                val = igh_ctrl.StillPower
            elif loggable_name == 'ighn_power_sorb':
                val = igh_ctrl.SorbPower
            elif loggable_name == 'ighn_pres_g1':
                val = igh_ctrl.G1
            elif loggable_name == 'ighn_pres_g2':
                val = igh_ctrl.G2
            elif loggable_name == 'ighn_pres_g3':
                val = igh_ctrl.G3
            elif loggable_name == 'ighn_pres_p1':
                val = igh_ctrl.P1
            elif loggable_name == 'ighn_pres_p2':
                val = igh_ctrl.P2
            elif loggable_name == 'ighn_nv':
                val = igh_ctrl.NV
            elif loggable_name == 'ighn_res_mix':
                val = igh_ctrl.MixChResistance

            #ILM
            elif loggable_name == 'bluedewar_he_level':
                val = ilm_ctrl.HeliumLevel
            elif loggable_name == 'bluedewar_ni_level':
                val = ilm_ctrl.NitrogenLevel
            else:
                found = False

            if found:
                qweb.makeLogEntry(loggable_name, val)
Пример #2
0
def requestAllSensors(xb, delay=1.0):
    response = qweb.getLoggableInfoForNow('xbee')
    sensors = str.split(response, "\n")
    # print('server wants: ', sensors)
    for sensor_str in sensors:
        if sensor_str != '':
            sensor_dict = {
                s.split('=')[0]: s.split('=')[1]
                for s in sensor_str.split(';')
            }
            if sensor_dict['machine_type'] == 'xbee':
                try:
                    transmitRequest(xb, sensor_dict['loggable_name'])
                except Exception as e:
                    print('{0} -- {1}'.format(datetime.datetime.now(), e))
                    pass
                time.sleep(delay)
Пример #3
0
def find_loggable_data(data):
    """ ask the server what needs to be updated. return just that list """
    # get string from server describing which parameters need to be updated
    global inv_name_reference
    
    # string describing what needs to be updated
    loggable_str = qweb.getLoggableInfoForNow('bfs')
    # list of loggable_names to be updated 
    loggable_list = re.findall(r'loggable_name=(\w+);',loggable_str)
    
    loggable_data = []
    if loggable_list:
        # get list of bluefors names from loggable_list using dictionary
        lookup_list = [inv_name_reference[k] for k in loggable_list if k in inv_name_reference]
        for d in data:
            if d[1] in lookup_list:         
                loggable_data.append(d)
    return loggable_data