Jump to content
  • 0

How to set CC/CV mode with code?


Resul

Question

Hello,

I can successfully communicate with my Analog Discovery 2 device. I can send and receive data. 

I want to build a custom LCR Meter using Analog Discovery 2 and Impedance Analyzer Adapter with C#.

I need CC/CV measurements too. Waveforms have built-in support for these measurements. But, I inspect the Waveforms SDK Reference Manual and all scripts in the Examples folder. I can not find a clue to how to achieve my goal.

I want to learn how can we set "mode" with code. There is only the FDwfAnalogImpedanceAmplitudeSet function. There is also a "Custom" mode. There are five scripts that are

1. Constant Voltage Adapter
2. Constant Current Adapter
3. Constant Voltage
4. Constant Current
5. Offset Sweep

I am using IA Adapter. So, I investigate Constant Voltage Adapter and Constant Current Adapter scripts. I think I need to use these scripts as a reference. But, these scripts use some variables such as VRMS, IRMS.

I see the function to retrieve Voltage and Current. But, I need VRMS and IRMS values. How can I read these values from the device? They are built-in in scripts.

Thanks In Advance, Regards
Resul 

Edited by Resul
Change Title
Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 1

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

 

Link to comment
Share on other sites

  • 1

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.

Edited by attila
Link to comment
Share on other sites

  • 0

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. 
 

Link to comment
Share on other sites

  • 0

Hi Mr. JColvin,

Thanks for your response. I visited the shared link.  I installed and tried the 3.16.34 version.

After my detailed investigation of dwf.cs class. I come up with these results: 
1. There is a FDwfAnalogImpedanceModeSet function. But, this function does not set Mode (Amplitude, CV, CC, and Custom). This function sets Order which is the measurement circuit. There is a comment in the dwf.cs file.  

2. I think, Mr. Attila did not release the expected API yet. 

Regards,

Resul 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...