示例#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)

    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