Jump to content

Resul

Members
  • Posts

    14
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Resul reacted to attila in Difference Between Python Plot and WaveForms Plot on C-V Measurements   
    Hi @Resul
    The Wavegen can output -5V to +5V. There is some reserve like +/-0.4V but this is not guaranteed to work on each device or with proper linearity.
    You may do +/-10V using +/-5V rails as reference instead of ground.
    - with -5V doing sweep from -5V to +5V which will be relative 0 to +10V
    - with +5V sweep from +5V to -5V will be like 0 to -10V
    Note that you could do this with minimal amplitude like 0.1V (or 0.2V) to limit the Wavegen amplitude to +/-5.1V
    or use +/-4V reference with 1V amplitude signal for +/-8V range.
    see point 3 :
     
  2. Like
    Resul reacted to attila in Difference Between Python Plot and WaveForms Plot on C-V Measurements   
    Hi @Resul
    The bugs mentioned yesterday are fixed here:
    https://forum.digilentinc.com/topic/8908-waveforms-beta-download/
    Your code will work if you use c_int in FDwfAnalogImpedancePeriodSet
    See the examples AnalogImpedance_OffsetSweep.py AnalogImpedance_OffsetSweepCp.py which also look for out of range conditions on Scope inputs.
     
     
  3. Like
    Resul reacted to attila in Impedance Analyzer Adapter Options Menu for Offset Sweep   
    Hi @Resul
    I got a glitch due to setting the scope offset wrongly with opposite sign and the input entered in limitation. I will have to add some function or measurement to notify such.
    I also notice there is bug in calculating the scope sample rate to obtain the certain amount of periods.


     
    """ DWF Python Example Author: Digilent, Inc. Revision: 2021-08-24 Requires: Python 2.7, 3 """ from ctypes import * from dwfconstants import * import math import time import sys import numpy import matplotlib.pyplot as plt 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") version = create_string_buffer(16) dwf.FDwfGetVersion(version) print("DWF Version: "+str(version.value)) hdwf = c_int() szerr = create_string_buffer(512) print("Opening first device") dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf)) if hdwf.value == hdwfNone.value: dwf.FDwfGetLastErrorMsg(szerr) print(str(szerr.value)) print("failed to open device") quit() dwf.FDwfDeviceAutoConfigureSet(hdwf, c_int(0)) sts = c_byte() reference = 1e3 freq = 1e3 start = -4.0 stop = 4.0 steps = 101 print("Reference: "+str(reference)+" Ohm Frequency: "+str(freq)+" Hz Offset: "+str(start)+" V ... "+str(stop)+" V") 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(freq)) # frequency in Hertz dwf.FDwfAnalogImpedanceAmplitudeSet(hdwf, c_double(0.5)) # 0.5V amplitude = 1V peak2peak signal dwf.FDwfAnalogImpedanceOffsetSet(hdwf, c_double(start)) dwf.FDwfAnalogImpedanceConfigure(hdwf, c_int(1)) # start dwf.FDwfAnalogInChannelOffsetSet(hdwf, c_int(0), c_double(start)) # set Scope C1 offset to start dwf.FDwfAnalogInChannelOffsetSet(hdwf, c_int(1), c_double(0)) # set Scope C2 offset to 0V dwf.FDwfAnalogInFrequencySet(hdwf, c_double(freq*8192/16)) # override, periods are wrongly calculated in < v3.16.35 dwf.FDwfAnalogInConfigure(hdwf, c_int(0)) # re-configure Scope time.sleep(1) # wait for the device, specially for the offsets to stabilize rgOff = [0.0]*steps rgRs = [0.0]*steps rgXs = [0.0]*steps for i in range(steps): vOff = start + i*(stop-start)/steps rgOff[i] = vOff dwf.FDwfAnalogOutOffsetSet(hdwf, c_int(0), c_double(vOff)) # adjust Wavegen 1 offset dwf.FDwfAnalogOutConfigure(hdwf, c_int(0), c_int(1)) # configure and start Wavegen 1 dwf.FDwfAnalogInChannelOffsetSet(hdwf, c_int(0), c_double(vOff)) # adjust Scope C1 offset dwf.FDwfAnalogInConfigure(hdwf, c_int(1)) # configure Scope time.sleep(0.01) # settle time depends on the circuit/DUT dwf.FDwfAnalogInConfigure(hdwf, c_int(1)) # start Scope while True: if dwf.FDwfAnalogImpedanceStatus(hdwf, byref(sts)) == 0: dwf.FDwfGetLastErrorMsg(szerr) print(str(szerr.value)) quit() if sts.value == 2: break resistance = c_double() reactance = c_double() dwf.FDwfAnalogImpedanceStatusMeasure(hdwf, DwfAnalogImpedanceResistance, byref(resistance)) dwf.FDwfAnalogImpedanceStatusMeasure(hdwf, DwfAnalogImpedanceReactance, byref(reactance)) rgRs[i] = abs(resistance.value) # absolute value for logarithmic plot rgXs[i] = abs(reactance.value) dwf.FDwfAnalogImpedanceConfigure(hdwf, c_int(0)) # stop dwf.FDwfDeviceClose(hdwf) plt.plot(rgOff, rgRs, rgOff, rgXs) ax = plt.gca() ax.set_yscale('log') plt.show()  
  4. Like
    Resul reacted to attila in Impedance Analyzer Adapter Options Menu for Offset Sweep   
    Hi @Resul
    I managed to reproduce the issue... working on it...
  5. Like
    Resul got a reaction from attila in How to set CC/CV mode with code?   
    Thank you so much Mr. @attila, Now, I can read Vrms and Irms values without make any math calculation. So, this is more clear for me. I implemented the script logic. I hope they will work. I will test it. 
    Thanks In Advance,
    Resul 
     
     
  6. Like
    Resul reacted to attila in Impedance Analyzer Adapter Options Menu for Offset Sweep   
    Hi @Resul
    1. To improve the resolution you could use the 2nd device configuration to have 16k sample buffer compared to the 8k in the 1st, default.
    2. You may see noise around 1.5V because the reading enters in limitation. There is no additional filtering in the application.
    In the SDK the offset for both channels is set to the offset level, in the application by default only channel 1 set to offset.
    2.a Try changing the amplitude.
    2.b Try setting the channel 2 offset to 0V or configure the Wavegen and Scope C1 offset manually:
    ... FDwfAnalogImpedanceConfigure(hdwf, 1) // general configuration FDwfAnalogInChannelOffsetSet(hdwf, 1, 0.0) // Scope C2 offset for:    FDwfAnalogOutNodeOffsetSet(hdwf, 0, 0, vOff) // change Wavegen offset    FDwfAnalogOutConfigure(hdwf, 0, 1) // start wavegen    FDwfAnalogInChannelOffsetSet(hdwf, 0, vOff) // Scope C1 offset    FDwfAnalogInConfigure(hdwf, 0, 1) // start Scope    while:       FDwfAnalogImpedanceStatus(... FDwfAnalogImpedanceStatusMeasure(... 3. The AD2 Wavegen can output -5V to +5V
    You could eventually use the negative supply to have a -5V reference and do 1 to +9V sweep range, then use the positive supply to have +5V reference and do -1 to -9V, or -4V for 0 to +8V and +4V for 0 to -8V.  Such 8V range of offset because you need about 1V for the signal.
    Edit: correcting wavegen offset function and scope offset sign
  7. Like
    Resul reacted to attila in How to set CC/CV mode with code?   
    Hi @Resul
    There is no API for the CC/CV mode. These can be implemented in custom app similar to the example scripts in the WF app/ Imedance/ Mode: Custom, Custom Amplitude
    See the dwf.h for Vrms...
    The cs and vb will be updated in next version.
    public const int DwfAnalogImpedanceVrms = 14; // Vrms public const int DwfAnalogImpedanceVreal = 15; // V real public const int DwfAnalogImpedanceVimag = 16; // V imag public const int DwfAnalogImpedanceIrms = 17; // Irms public const int DwfAnalogImpedanceIreal = 18; // I real public const int DwfAnalogImpedanceIimag = 19; // I imag  
  8. Like
    Resul reacted to JColvin in How to set CC/CV mode with code?   
    Hi @Resul,
    I believe this change is implemented starting with beta version 3.16.33: https://forum.digilentinc.com/topic/8908-waveforms-beta-download/.
    Let us know how this goes for you.
    Thanks,
    JColvin
     
  9. Like
    Resul reacted to attila in How to set CC/CV mode with code?   
    Hi @Resul
    I think you could use the FDwfAnalogImpedanceStatusInput example: AnalogNetwork_Analyzer.py
    dwf.FDwfAnalogImpedanceStatusInput(hdwf, c_int(0), byref(gain1), 0) # relative to FDwfAnalogImpedanceAmplitudeSet Amplitude/C1
    dwf.FDwfAnalogImpedanceStatusInput(hdwf, c_int(1), byref(gain2), byref(phase2)) # relative to Channel 1, C1/C#
    For mode 0 (W1-C1-DUT-C2-R-GND) or 8 (AD IA adapter) :
    gain1 = Amp/VrmsC1
    gain2 = VrmsC1/VrmsC2
    VrmsC1 = A/gain1
    VrmsC2 = A/gain1/gain2
    Vrms = VrmsC1-VrmsC2
    Irms = VrmsC2/Res
    Edit:
    Next software version will add such measurement options for the API.
  10. Like
    Resul got a reaction from attila in How to set CC/CV mode with code?   
    Hello Mr. Attila,
    Thanks a lot for your clear explanation and guidance. I wrote the C# function as in the script in Waveforms. I will inform you after the test with the reference component. 
    I am calling the function after each measurement on target frequency. The function calculates the new amplitude and resistor values. After that, I am setting the new values using 
    FDwfAnalogImpedanceReferenceSet and FDwfAnalogImpedanceAmplitudeSet functions. 
    I hope this is the right approach. 
     
×
×
  • Create New...