예제 #1
0
def publish():
    now = time.time()

    current_sensors = {
        sensor: umtrx.query_sensor_value(SENSORS_PATH + "/" + sensor)
        for sensor in sensors_list
    }

    for channel in ["1", "2"]:
        vpf_name = "voltagePF" + channel
        vpr_name = "voltagePR" + channel

        if vpf_name in current_sensors and vpr_name in current_sensors:
            vswr = umtrx_vswr(float(current_sensors[vpf_name]),
                              float(current_sensors[vpr_name]),
                              VSWR_CALIBRATION)
            current_sensors["VSWR" + channel] = vswr.vswr()
            current_sensors["ReturnLoss" + channel] = vswr.return_loss()

    for name, value in current_sensors.items():
        print "PUTVAL {host}/umtrx-{id}/sensor-{name} interval={interval} {now}:{value}".format(
            host=HOSTNAME,
            id=BOARD_ID,
            name=name.lower(),
            interval=INTERVAL,
            now=now,
            value=value)
예제 #2
0
def publish():
    sets = {'Voltages1': ['VoltagePR1', 'VoltagePR2', 'VoltagePF1', 'VoltagePF2'],
            'Voltages2': ['Voltagezero', 'VoltageVin', 'VoltageVinPA', 'VoltageDCOUT'],
            'Temperature': ['TempA', 'TempB'], 'VSWR': ['Channel_1_VSWR', 'Channel_2_VSWR'],
            'ReturnLoss': ['Channel_1_ReturnLoss', 'Channel_2_ReturnLoss']}

    current_sensors = {}

    for sensor in sensors_list:
        sensor_data = umtrx.query_sensor_raw(sensors_path + "/" + sensor)['result']
        current_sensors[sensor_data['name']] = sensor_data['value']

    # vswr_calibration = TM10_VSWR_cal
    vswr_calibration = 0

    for num in [1, 2]:
        vpr_name = 'voltagePR' + str(num)
        vpf_name = 'voltagePF' + str(num)
        if vpr_name in sensors_list and vpf_name in sensors_list:
            vpr = float(umtrx.query_sensor_value(sensors_path + '/' + vpr_name))
            vpf = float(umtrx.query_sensor_value(sensors_path + '/' + vpf_name))

            vswr = umtrx_vswr(vpf, vpr, vswr_calibration)

            current_sensors['Channel_%d_VSWR' % num] = vswr.vswr()
            current_sensors['Channel_%d_ReturnLoss' % num] = vswr.return_loss()

    for key, values in sets.iteritems():
        publish_set(key, [current_sensors[name] for name in values])
예제 #3
0
def publish():
    now = time.time()

    current_sensors = {sensor: umtrx.query_sensor_value(SENSORS_PATH + "/" + sensor) for sensor in sensors_list}

    for channel in ["1", "2"]:
        vpf_name = "voltagePF" + channel
        vpr_name = "voltagePR" + channel

        if vpf_name in current_sensors and vpr_name in current_sensors:
            vswr = umtrx_vswr(float(current_sensors[vpf_name]), float(current_sensors[vpr_name]), VSWR_CALIBRATION)
            current_sensors["VSWR" + channel] = vswr.vswr()
            current_sensors["ReturnLoss" + channel] = vswr.return_loss()

    for name, value in current_sensors.items():
        print "PUTVAL {host}/umtrx-{id}/sensor-{name} interval={interval} {now}:{value}".format(
            host=HOSTNAME, id=BOARD_ID, name=name.lower(), interval=INTERVAL, now=now, value=value)
  reply = s.query_sensor_raw(sensors_path+"/"+sensor)
  if reply.has_key('result'):
    res = reply['result']
    print "  %15s = %9s %s" % (res['name'], res['value'], res['unit'])
  else:
    print "Can't read sensor %s" % sensor

#vswr_calibration = TM10_VSWR_cal
#vswr_calibration = TM3_VSWR_cal
vswr_calibration = 0
for num in [1, 2]:
  vpr_name = 'voltagePR'+str(num)
  vpf_name = 'voltagePF'+str(num)
  if vpr_name in sensors_list and vpf_name in sensors_list:
    vpr = float(s.query_sensor_value(sensors_path+'/'+vpr_name))
    vpf = float(s.query_sensor_value(sensors_path+'/'+vpf_name))
    vswr = umtrx_vswr(vpf, vpr, vswr_calibration)
    print "TRX %d power detector:" % num
    print "              VPF =  %5.2f  V"   % vpf
    print "               PF = %5.1f   dBm" % vswr.pf()
    print "              VPR =  %5.2f  V"   % vpr
    print "               PR = %5.1f   dBm" % vswr.pr()
    print "             VSWR = %6.2f"       % vswr.vswr()
    print "            Gamma =   %5.3f"     % vswr.gamma()
    print "      Return Loss = %5.1f   dB"  % vswr.return_loss()
    print "    Mismatch Loss =   %5.3f dB"  % vswr.mismatch_loss()
    print "    Through power =  %5.2f  %%"  % (100.0*vswr.pf_rate())
    print "  Reflected power =  %5.2f  %%"  % (100.0*vswr.pr_rate())

s.close()
예제 #5
0
    reply = s.query_sensor_raw(sensors_path + "/" + sensor)
    if reply.has_key('result'):
        res = reply['result']
        print "  %15s = %9s %s" % (res['name'], res['value'], res['unit'])
    else:
        print "Can't read sensor %s" % sensor

#vswr_calibration = TM10_VSWR_cal
#vswr_calibration = TM3_VSWR_cal
vswr_calibration = 0
for num in [1, 2]:
    vpr_name = 'voltagePR' + str(num)
    vpf_name = 'voltagePF' + str(num)
    if vpr_name in sensors_list and vpf_name in sensors_list:
        vpr = float(s.query_sensor_value(sensors_path + '/' + vpr_name))
        vpf = float(s.query_sensor_value(sensors_path + '/' + vpf_name))
        vswr = umtrx_vswr(vpf, vpr, vswr_calibration)
        print "TRX %d power detector:" % num
        print "              VPF =  %5.2f  V" % vpf
        print "               PF = %5.1f   dBm" % vswr.pf()
        print "              VPR =  %5.2f  V" % vpr
        print "               PR = %5.1f   dBm" % vswr.pr()
        print "             VSWR = %6.2f" % vswr.vswr()
        print "            Gamma =   %5.3f" % vswr.gamma()
        print "      Return Loss = %5.1f   dB" % vswr.return_loss()
        print "    Mismatch Loss =   %5.3f dB" % vswr.mismatch_loss()
        print "    Through power =  %5.2f  %%" % (100.0 * vswr.pf_rate())
        print "  Reflected power =  %5.2f  %%" % (100.0 * vswr.pr_rate())

s.close()