Jump to content

Davidson.Cassagnol

Members
  • Posts

    6
  • Joined

  • Last visited

Davidson.Cassagnol's Achievements

Newbie

Newbie (1/4)

0

Reputation

  1. I am trying to use the Waveform SDK py files to collect Impedance and Impedance Phase data in steps using start and stop frequency, and then graphing those data. I've created a py script that allows me to measure and collect Impedance and Impedance Phase data once...i need hep understating if i should use a regular loop function or if there's a special sweep function that can help. rev1.py
  2. Hello, I am trying to graph Impedance and Impedance Phase that is outputted by the code below I have modified AnalogImpedance_Measure.py to only measure DwfAnalogImpedanceImpedance, DwfAnalogImpedanceImpedancePhase and now I need to try and understand where the measurements are being stored so that I can then graph them. I'm creating a subplot for Impedance and another subplot for Impedance Phase, when the code is compiled you can see the output that I get. from ctypes import * from dwfconstants import * import math import time import sys import numpy import matplotlib.pyplot as plt import numpy as np rgMeasure = [[DwfAnalogImpedanceImpedance,"Impedance","Ohm"], [DwfAnalogImpedanceImpedancePhase,"ImpedancePhase","Radian"]] # load dwf library if sys.platform.startswith("win"): dwf = cdll.LoadLibrary("dwf.dll") elif sys.platform.startswith("darwin"): dwf = cdll.LoadLibrary("/Library/Frameworks/dwf.framework/dwf") else: dwf = cdll.LoadLibrary("libdwf.so") # print version information version = create_string_buffer(16) dwf.FDwfGetVersion(version) print("DWF Version: "+str(version.value)) hdwf = c_int() szerr = create_string_buffer(512) # try to connect to the first available device print("Opening first device") dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf)) # print error message if connection fails if hdwf.value == hdwfNone.value: dwf.FDwfGetLastErrorMsg(szerr) print(str(szerr.value)) print("failed to open device") quit() # configure impedance measurement frequnecy = 1e3 reference = 1e3 print("Reference: "+str(reference)+" Ohm Frequency: "+str(frequnecy/1e3)+" kHz for nanofarad capacitors") dwf.FDwfAnalogImpedanceReset(hdwf) dwf.FDwfAnalogImpedanceModeSet(hdwf, c_int(8)) # 0 = W1-C1-DUT-C2-R-GND, 1 = W1-C1-R-C2-DUT-GND, 8 = AD IA adapter dwf.FDwfAnalogImpedanceReferenceSet(hdwf, c_double(reference)) # reference resistor value in Ohms dwf.FDwfAnalogImpedanceFrequencySet(hdwf, c_double(frequnecy)) # frequency in Hertz dwf.FDwfAnalogImpedanceAmplitudeSet(hdwf, c_double(1)) dwf.FDwfAnalogImpedanceConfigure(hdwf, c_int(1)) # start time.sleep(1) dwf.FDwfAnalogImpedanceStatus(hdwf, None) # ignore last capture, force a new one # measurement reading loop while True: sts = c_byte() if dwf.FDwfAnalogImpedanceStatus(hdwf, byref(sts)) == 0: # handle error dwf.FDwfGetLastErrorMsg(szerr) print(str(szerr.value)) quit() if sts.value == 2: break for i in rgMeasure: cval = c_double() dwf.FDwfAnalogImpedanceStatusMeasure(hdwf, i[0], byref(cval)) val = cval.value scale = "" if i[2] != "Radian": if abs(val)>=1e9: val /= 1e9 scale = "G" elif abs(val)>=1e6: val /= 1e6 scale = "M" elif abs(val)>=1e3: val /= 1e3 scale = "k" elif abs(val)<1e-9: val *= 1e12 scale = "p" elif abs(val)<1e-6: val *= 1e9 scale = "n" elif abs(val)<1e-3: val *= 1e6 scale = "u" elif abs(val)<1: val *= 1e3 scale = "m" print(i[1]+": "+str(val)+" "+scale+i[2]) dwf.FDwfAnalogImpedanceConfigure(hdwf, c_int(0)) # stop dwf.FDwfDeviceClose(hdwf)
  3. hey thanks ive figured out a solution im gonna use DwfAnalogImpedanceImpedance, DwfAnalogImpedanceImpedancePhase just gotta figure out how to plot those two values
  4. Hello I have been trying to trigger an impedance/frequency sweep for measuring capacitance AnalogOut_Sweep Generates an output frequency sweep, and i want to see the input if that makes sense overall all I'm trying to measure is capacitance.
  5. NameError: name 'DwfAnalogImpedanceSeriesCapactance' is not defined Help with DwfAnalogImpedanceSeriesCapactance and DwfAnalogImpedanceParallelCapacitance im trying to measure capacitance using python from WaveForms SDK
×
×
  • Create New...