Пример #1
0
def transferCurveII(v1,v2,vi=0.1,r1=1.0,r2=1.0,wt=0.1,returnData=False):

    # Check if SciPy is loaded
    slab.checkSciPy()

    # Perform a DC Sweep
    x,y1,y2,y3,y4 = slab.dcSweep(1,v1,v2,vi,wt)
    # Set DAC to zero
    slab.writeChannel(1,0.0)  
    # Calculate current
    cin  = (x-y1) / r1
    cout = (slab.vdd - y2) / r2
    # Show curve
    slab.message(1,"Drawing curve")
    plt.figure(facecolor="white")   # White border
    pl.plot(cin,cout)
    pl.xlabel("Input (mA)")
    pl.ylabel("Output (mA)")
    pl.title("DC I(I) Transfer Curve")
    pl.grid()
    pl.show()   
    pl.close()
    
    if slab.plotReturnData or returnData:
        return cin,cout 
Пример #2
0
def ioCurve():
    slab.message(1, "Input between DAC1+ADC1 and GND")
    slab.message(1, "Output between ADC2 and GND")

    # Perform a DC sweep
    x, y1, y2, y3, y4 = slab.dcSweep(1, 0.0, 3.0, 0.1)

    # Plot result
    slab.message(1, "Drawing curve")
    slab.plot11(y1, y2, "V(V) Plot", "Input (V)", "Output(V)")
Пример #3
0
def curveVVbridge(vp,vn,vi=0.1,vmin=0.0,wt=0.1,returnData=False):

    # Check if SciPy is loaded
    slab.checkSciPy() 

    # Perform the positive DC sweep
    slab.message(1,"Positive curve")
    slab.setVoltage(2,vmin)
    xp,y1p,y2p,y3p,y4p = slab.dcSweep(1,vmin,vp,vi,wt)
    # Perform the negative DC sweep
    slab.message(1,"Negative curve")
    slab.setVoltage(1,vmin)
    xn,y1n,y2n,y3n,y4n = slab.dcSweep(2,vmin,vn,vi,wt)
    
    # Join all measurements
    x=[]
    y=[]
    
    ln = len(xn)
    for i in range(0,ln):
        pos = ln-i-1
        xvalue = y1n[pos]-y2n[pos]
        yvalue = y3n[pos]-y4n[pos]
        x.append(xvalue)
        y.append(yvalue)
        
    lp = len(xp)    
    for i in range(0,lp):
        xvalue = y1p[i]-y2p[i]
        yvalue = y3p[i]-y4p[i]
        x.append(xvalue)
        y.append(yvalue) 
        
    x = np.array(x)
    y = np.array(y)    
    
    # Plot result
    slab.message(1,"Drawing curve")
    slab.plot11(x,y,"V(V) Bridge Plot","Input (V)","Output (V)")
    
    if slab.plotReturnData or returnData:
        return x,y 
Пример #4
0
def curveVIbridge(v1max,v2max,vi=0.1,vmin=0.0,r=1.0,wt=0.1,returnData=False):

    # Check if SciPy is loaded
    slab.checkSciPy() 

    # Perform first DC sweep
    slab.message(1,"Positive curve")
    slab.setVoltage(2,vmin)                                 # Set DAC 2 to vmin
    xf,y1f,y2f,y3f,y4f = slab.dcSweep(1,vmin,v1max,vi,wt)   # Sweep DAC 1

    # Perform second DC sweep
    slab.message(1,"Negative curve")
    slab.setVoltage(1,vmin)                                 # Set DAC 1 to vmin
    xr,y1r,y2r,y3r,y4r = slab.dcSweep(2,vmin,v2max,vi,wt)   # Sweep DAC 2
    
    # Set DACs to vmin
    slab.setVoltage(1,vmin)
    slab.setVoltage(2,vmin)
    
    # Join the curves
    vd=[]
    id=[]
    lenr=len(xr)
    for i in range(0,lenr):
        pos = lenr - i - 1
        vd.append(y2r[pos]-y3r[pos])
        id.append((y1r[pos]-y2r[pos])/r)
    for i in range(0,len(xf)):
        vd.append(y2f[i]-y3f[i])
        id.append((y1f[i]-y2f[i])/r)
    
    plt.figure(facecolor="white")   # White border
    pl.plot(vd,id)      
    pl.xlabel("Voltage (V)")
    pl.ylabel("Current (mA)")
    pl.title("V-I plot in bridge mode")
    pl.grid()
    pl.show() 
    pl.close()
    
    if slab.plotReturnData or returnData:
        return vd,id        
Пример #5
0
def curveVIbridgeOld(v1max,v2max,vi=0.1,r=1.0,wt=0.1,returnData=False):

    # Check if SciPy is loaded
    slab.checkSciPy() 

    # Perform first DC sweep
    slab.message(1,"Forward curve")
    slab.setVoltage(2,0.0)                            # Set DAC 2 to 0.0
    x,y1,y2,y3,y4 = slab.dcSweep(1,0.0,v1max,vi,wt)   # Sweep DAC 1

    # First plot
    vd = y2 - y3
    id = (y1 - y2)/r
    plt.figure(facecolor="white")   # White border
    pl.plot(vd,id)

    # Perform second DC sweep
    slab.message(1,"Backward curve")
    slab.setVoltage(1,0.0)                            # Set DAC 1 to 0.0
    x,y1,y2,y3,y4 = slab.dcSweep(2,0.0,v2max,vi,wt)   # Sweep DAC 2
    
    # Set DACs to zero
    slab.writeChannel(1,0.0)
    slab.writeChannel(2,0.0)
    
    # Second plot
    slab.message(1,"Drawing curve")
    vd = y2 - y3
    id = (y1 - y2)/r
    pl.plot(vd,id)
    
    pl.xlabel("Voltage (V)")
    pl.ylabel("Current (mA)")
    pl.title("V-I plot in bridge mode")
    pl.grid()
    pl.show() 
    pl.close()
    
    if slab.plotReturnData or returnData:
        return vd,id
Пример #6
0
def hystVVcurve(v1,v2,vi=0.1,wt=0.1,returnData=False):

    # Check if SciPy is loaded
    slab.checkSciPy()

    # Perform DC sweeps
    xf,y1f,y2f,y3f,y4f = slab.dcSweep(1,v1,v2,vi,wt)
    xr,y1r,y2r,y3r,y4r = slab.dcSweep(1,v2,v1,-vi,wt)
    # Plot result
    slab.message(1,"Drawing curves")
    plt.figure(facecolor="white")     # White border
    pl.plot(xf,y1f,label="Forward");
    pl.plot(xr,y1r,label="Back");
    pl.legend(loc='lower right')         
    pl.title("V(V) Hysteresis Curve")
    pl.xlabel("Input Voltage(V)")
    pl.ylabel("Output Voltage(V)")   
    pl.grid()    
    pl.show()   
    pl.close()

    if slab.plotReturnData or returnData:
        return xf,y1f,xr,y1r   
Пример #7
0
def curveVI(v1,v2,vi=0.1,r=1.0,wt=0.1,returnData=False):

    # Check if SciPy is loaded
    slab.checkSciPy() 

    # Perform a DC sweep
    x,y1,y2,y3,y4 = slab.dcSweep(1,v1,v2,vi,wt)
    # Set DAC 1 to zero
    slab.writeChannel(1,0.0)
    # Plot result
    slab.message(1,"Drawing curve")
    vd = y2
    id = (y1 - y2) / r
    slab.plot11(vd,id,"V-I plot","Voltage (V)","Current (mA)")     
    
    if slab.plotReturnData or returnData:
        return vd,id
Пример #8
0
def curveVV(v1,v2,vi=0.1,wt=0.1,adc2=False,returnData=False):

    # Check if SciPy is loaded
    slab.checkSciPy() 

    # Perform a DC sweep
    x,y1,y2,y3,y4 = slab.dcSweep(1,v1,v2,vi,wt)
    
    # Check ADC2 option
    if adc2:
        x = y2
    
    # Plot result
    slab.message(1,"Drawing curve")
    slab.plot11(x,y1,"V(V) Plot","Input (V)","Output(V)")
    
    if slab.plotReturnData or returnData:
        return x,y1
Пример #9
0
def curveVVref(v1,v2,vi=0.1,wt=0.1,adc3=False,returnData=False):

    # Check if SciPy is loaded
    slab.checkSciPy()

    # Perform a DC sweep
    x,y1,y2,y3,y4 = slab.dcSweep(1,v1,v2,vi,wt)
    
    # Check ADC3 option
    if adc3:
        x = y3
    
    # Plot result
    slab.message(1,"Drawing curve")
    vi = x - y2
    vo = y1 - y2
    slab.plot11(vi,vo,"V(V) Plot with reference","Input (V)","Output(V)") 
    
    if slab.plotReturnData or returnData:
        return vi,vo
Пример #10
0
def curveVIref(v1,v2,vi=0.1,r=1.0,vr=-1,wt=0.1,returnData=False):

    # Check if SciPy is loaded
    slab.checkSciPy() 

    # Perform a DC sweep
    x,y1,y2,y3,y4 = slab.dcSweep(1,v1,v2,vi,wt)
    # Set DAC 1 to Vdd/2
    slab.setVoltage(1,slab.vdd/2)
    # Plot result
    req =  r / 2
    if vr < 0:
        vr = slab.vdd / 2
    vd = y1 - y2
    id = (y2 - vr)/req
    slab.message(1,"Drawing curve")
    slab.plot11(vd,id,"V-I plot with reference","Voltage (V)","Current (mA)") 
    
    if slab.plotReturnData or returnData:
        return vd,id
Пример #11
0
slab.dcPrint()
# Check dcPrint command if enabled
if check_dcPrint:
    slab.dcPrint()
    print('You should see volatages of all four ADCs')
    print('All should be about 1.0')
    slab.pause('(Press return)')   
    print()

#DC sweep command
#print('After measurement ends you shouls see four lines')
#print('ADCs 1,3,4 with equal X and Y values and ADC2 always 1.0')
#print('Close the window to continue')
#slab.dcSweepPlot(1,0.5,2.5,0.1)
print('DC Sweep test')
v=slab.dcSweep(1,0.5,2.5,0.1)
testPass = True
w=v[1]/v[0]
if not isVectorConstant(w,1.0):
    raise slab.SlabEx("dcSweep fails at DAC1 or ADC1")
w=v[3]/v[0]
if not isVectorConstant(w,1.0):
    raise slab.SlabEx("dcSweep fails at DAC1 or ADC3")
w=v[4]/v[0]
if not isVectorConstant(w,1.0):
    raise slab.SlabEx("dcSweep fails at DAC1 or ADC4")
if not isVectorConstant(v[2],1.0):
    raise slab.SlabEx("dcSweep fails at DAC2 or ADC2")
print('pass')    
print()
Пример #12
0
import slab

# Set prefix to locate calibrations
slab.setFilePrefix("../")

# Open serial communication
slab.connect()

# Increase accuracy
slab.setDCreadings(50)

# V Device curve
print "Performing measurements..."
#x,y1,y2,y3,y4 = slab.dcSweep(1,0.6,1.6,0.05)
x, y1, y2, y3, y4 = slab.dcSweep(1, 1.0, 3.0, 0.1)

# Set DACs to zero
slab.zero()

# Post processing low current
#Ib = (x - y1)/100.0   # In mA
#Ic = (3.3 - y2)/1.0   # In mA
Ib = (x - y1) / 6.8  # In mA
Ic = (3.3 - y2) / 0.047  # In mA
beta = Ic / Ib

# Plot
print "Plotting"
slab.plot11(Ic, beta, "Beta vs Ic", "Ic (mA)", "Beta")