Jump to content
  • 3

scripting waveforms network analyzer function


cephy

Question

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? 

thanks

rob

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

Hi @cephy

var time = new Date()

while(wait()){
    print(time.toISOString())
    
    for(var i = 0; i < 1; i++){
        Network1.single()
        Network1.wait()
        var szfile = "~/Desktop/na/"+time.getFullYear()+"_"+(time.getMonth()+1)+"_"+time.getDate()+"-"+time.getHours()+"_"+time.getMinutes()+"_"+time.getSeconds()+"-"+i+".csv"
        print(szfile)
        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 comment
Share on other sites

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 comment
Share on other sites

Hi @Torau

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

 

AnalogNetwork_Analyzer.py

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. 

image.png.539bb4e1f597fcef0729ec57322bdb85.png

image.png.181fae062e9bc549cc86d86056c10eb4.png

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...