• 3

scripting waveforms network analyzer function


I want to automate the network analyzer function in waveforms using script.  I want to run the network analyzer every 5 minutes for 10 times (with the same settings) on the same RLC circuit and save the results (frequency, gain and phase) to a file.  Is there a way to write a script to automate this? 



Edited by cephy
Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 2

Hi @Torau

Here you have a Bode plot in Python using the FDwfAnalogImpedance WF SDK functions:



Edit: If you need the peak voltage values use:
    rgGaC1 = amplitude/gain1.value 
    rgGaC2 = amplitude/gain1.value/gain2.value 
Edit: Normalizing phase
    if phase2.value > math.pi :
        phase2.value -= 2.0*math.pi
    if phase2.value < -math.pi :
        phase2.value += 2.0*math.pi. 



Edited by attila
Link to post
Share on other sites
  • 0

Hi @cephy

var time = new Date()

    for(var i = 0; i < 1; i++){
        var szfile = "~/Desktop/na/"+time.getFullYear()+"_"+(time.getMonth()+1)+"_"+time.getDate()+"-"+time.getHours()+"_"+time.getMinutes()+"_"+time.getSeconds()+"-"+i+".csv"
        Network1.Export(szfile) // make sure the directory exists

    time = new Date(time.valueOf()+5*60*1000) // add 5 minutes
    while(wait() && Date.now()<time.valueOf()); // wait


Link to post
Share on other sites
  • 0

Hi Attila,


I am dealing with Analog Discovery 2 now. Would you like to show some scripts in python for getting the gain and phase values, and also how to save the results (frequency, gain and phase) to a file?

Thank you very much.

Best regards, Torau


Link to post
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