Пример #1
0
def test_procedure(TESTNAME, testDict):
    d = Dialog(dialog="dialog")

    d.set_background_title("Testing: " + TESTNAME)

    if not operator_query_instructions(TESTNAME):
        return False

    try:
        ht.init()
        # Acquire the Hall Effect Apparatus
        scan = ht.acquire(0x16d0, 0x0c9b)
    except Exception:
        d.msgbox("Data-chan initialization failed")
        return False

    # Start Measuring
    ht.enable(scan)
    ht.set_channel_gain(scan, 3, 5)

    # Set CC gen
    ht.set_current_fixed(scan, 0.3)

    win = pg.GraphicsWindow()
    win.setWindowTitle(TESTNAME)
    meas = {"ch3": {}}
    meas["ch3"]["name"] = "V on CC Shunt"
    for key in meas:
        meas[key]["plotobj"] = win.addPlot(title=meas[key]["name"])
        meas[key]["data"] = [0] * 100
        meas[key]["curveobj"] = meas[key]["plotobj"].plot(meas[key]["data"])

    def update():
        popped_meas = ht.pop_measure(scan)
        if popped_meas is not None:
            for key in meas:
                meas[key]["data"][:-1] = meas[key]["data"][1:]
                meas[key]["data"][-1] = popped_meas[key]
                meas[key]["curveobj"].setData(meas[key]["data"])

    timer = pg.QtCore.QTimer()
    timer.timeout.connect(update)
    timer.start(50)

    ## Start Qt event loop unless running in interactive mode or using pyside.
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
    ht.disconnect_device(scan)
    ht.deinit()

    return True
Пример #2
0
def test_procedure(TESTNAME,testDict):
    d = Dialog(dialog="dialog")
    d.set_background_title("Testing: " + TESTNAME)

    if not operator_query_instructions(TESTNAME):
        return False


    try:
        ht.init()
        # Acquire the Hall Effect Apparatus
        scan = ht.acquire(0x16d0,0x0c9b)
    except Exception:
        d.msgbox("Data-chan initialization failed")
        return False

    # Start Measuring
    ht.enable(scan)
    ht.set_channel_gain(scan, 3, 5)
    d.gauge_start("Acquiring DAC Voltage VS Hall Vr measures")


    measures = {}
    raw_current_codes = range (int(2000), int(2100))

    # count from 0 to the total number of steps
    for i in range(len(raw_current_codes)):

        ht.set_current_raw(scan,raw_current_codes[i])
        #pop all old measures
        while(ht.pop_measure(scan) != None ):
            pass
        time.sleep(0.150)
        measures[i] = ht.pop_measure(scan)

        d.gauge_update(int(float(i) / float(len(raw_current_codes)) * 100.0))

        if measures[i] is not None:
            measures[i]["raw_current_code"] = raw_current_codes[i]

    d.gauge_stop()

    ht.disconnect_device(scan)
    ht.deinit()
    testResult = compute.compute(testDict["asset_path"],measures,'raw_current_code','ch6')
    if(not testResult):
        return False
    if(not (-0.0014-(-0.0014*0.2)<=testResult['coeff']['slope']<=-0.0014+(-0.0014*0.2))):
        return False
    return testResult
Пример #3
0
def test_procedure(TESTNAME, testDict):
    ####### CONFIG
    measures_to_take = 100
    d = Dialog(dialog="dialog")
    d.set_background_title("Testing: " + TESTNAME)
    d.msgbox("Disconnetti la schedina che fa click-click-click")

    try:
        ht.init()
        # Acquire the Hall Effect Apparatus
        scan = ht.acquire(0x16d0, 0x0c9b)
    except Exception:
        d.msgbox("Data-chan initialization failed")
        return False

    # Start Measuring
    ht.enable(scan)
    ht.set_channel_gain(scan, 3, 5)

    d.gauge_start("Acquiring DAC Voltage VS Current measures")

    measures = {}
    raw_current_codes = range(int(4095 / 2 - measures_to_take),
                              int(4095 / 2 + measures_to_take))
    # count from 0 to the total number of steps
    for i in range(len(raw_current_codes)):

        ht.set_current_raw(scan, raw_current_codes[i])
        #pop all old measures
        while (ht.pop_measure(scan) != None):
            pass
        time.sleep(0.150)
        measures[i] = ht.pop_measure(scan)
        d.gauge_update(int(float(i) / float(len(raw_current_codes)) * 100.0))
        if measures[i] is not None:
            measures[i]["raw_current_code"] = raw_current_codes[i]

    d.gauge_stop()

    ht.disconnect_device(scan)
    ht.deinit()
    testResult = compute.compute(testDict["asset_path"], measures,
                                 'raw_current_code', 'ch3')
    if (not testResult):
        return False
    if (not (0.0009 -
             (0.0009 * 0.2) <= testResult['coeff']['slope'] <= 0.0009 +
             (0.0009 * 0.2))):
        return False
    return testResult
Пример #4
0
def test_procedure(TESTNAME,testDict):

    d = Dialog(dialog="dialog")
    d.set_background_title("Testing: " + TESTNAME)

    d.msgbox("Connect the heater and press OK")

    try:
        ht.init()
        # Acquire the Hall Effect Apparatus
        scan = ht.acquire(0x16d0, 0x0c9b)
    except DataChanDeviceNotFoundOrInaccessibleError:
        d.msgbox("Data-chan initialization failed")
        return False

    # Start Measuring
    ht.enable(scan)
    #ht.set_channel_gain(scan, 2, 1)
    #ht.set_current_fixed(scan, 0.05)

    ht.set_heater_state(scan, 255)
    #ht.set_channel_gain(scan, 2, 1)

    d.gauge_start("Acquiring temperature over Time (with heater on)")

    measures = {}
    # count from 0 to the total number of steps
    for i in range(samples_count):
        time.sleep(sleep)

        # pop all old measures
        while(ht.pop_measure(scan) != None):
            pass
        time.sleep(0.150)
        measures[i] = ht.pop_measure(scan)
        if measures[i] is not None:
            measures[i]["i"] = i * sleep

        d.gauge_update(int(float(i) / samples_count * 100.0))

    d.gauge_stop()
    print(measures)
    ht.disconnect_device(scan)
    ht.deinit()
    testResult = compute.compute(testDict["asset_path"],measures,'i','ch2')
    if(not testResult):
        return False
    if(not (testResult['coeff']['slope']>=0.0005)):
        return False
    return testResult
Пример #5
0
def test_procedure(TESTNAME,testDict):
    d = Dialog(dialog="dialog")
    d.set_background_title("Testing: " + TESTNAME)


    try:
        # Initialize
        ht.init()

        # Acquire the Hall Effect Apparatus
        scan = ht.acquire(0x16d0,0x0c9b)
        # Start Measuring
        ht.enable(scan)

        # Set CC gen
        ht.set_current_fixed(scan, 0.01)

        # Check that the reported measures are ok
        count_correct_meas = 0
        for i in range (1,25):
            meas = ht.pop_measure(scan)
            if meas is not None:
                count_correct_meas += 1
                d.infobox(str(meas).replace(", ", ",\n"), width=60, height=20)
            time.sleep(0.3)

        ht.disconnect_device(scan)
        ht.deinit()
        if count_correct_meas < 20:
            d.msgbox("Too many measures were empty! fail", width=60)
            return False


    # Except problems in conneting to the device or retrieving measures
    except Exception as e:

        d.msgbox(str(e), width=60)
        import traceback

        tb = traceback.format_exc()
        d.scrollbox(str(tb))
        return False
        pass
    return True
Пример #6
0
def test_procedure(TESTNAME,testDict):

    d = Dialog(dialog="dialog")
    d.set_background_title("Testing: " + TESTNAME)

    try:
        ht.init()
        print(1)
        # Acquire the Hall Effect Apparatus
        scan = ht.acquire(0x16d0,0x0c9b)
        print(2)
    except Exception:
        d.msgbox("Data-chan initialization failed")
        return False



    # Start Measuring
    ht.enable(scan)
    ht.set_channel_gain(scan, 2, 5)


    d.msgbox("Connect the thermocouple and press ok")
    #pop all old measures
    while(ht.pop_measure(scan) != None ):
        pass

    # take an average of the thermocouple voltage
    average = 0
    for i in range(10):
        time.sleep(0.2)
        popped_meas = ht.pop_measure(scan)
        if popped_meas is not None:
            average += popped_meas["ch2"]
    average = average / 10
    if average <= 2.0:
        pass
    else:
        d.msgbox("termocouple not connected, measured an avg of " + str(average) + " V")
        return False


    d.msgbox("Disconnect the thermocouple and press ok")
    #pop all old measures
    while(ht.pop_measure(scan) != None ):
        pass

    # take an average of the thermocouple voltage
    average = 0
    for i in range(10):
        time.sleep(0.2)
        popped_meas = ht.pop_measure(scan)
        if popped_meas is not None:
            average += popped_meas["ch2"]
    average = average / 10


    ht.disconnect_device(scan)
    ht.deinit()


    if average >= 2.0:
        pass
    else:
        d.msgbox("termocouple pullup not triggered, measured an avg of " + str(average) + " V")
        return False
    return True