Analog/Mixed Signal (AMS) Directly extracting and plotting measurement for each period

2024-06-23T23:37:29.000-0400
Eldo

Summary

Is it possible to make a measurement for each periods ? And plot it directly with Eldo ?


Details

TCL procedure is the solution to make a measurement during each period of a signal:  
proc avg_period { wave0 wave1 } {
    wfc "
       myxup = xup($wave0,0)
       myavg=\[\]
       for i in range(0,length(myxup)-1) : xtmp=myxup\[i\]\; ytmp=(avg($wave1, myxup\[i\], myxup\[i+1\])) \; myavg.append(\[xtmp,ytmp\])
       wf1 = datatowf(myavg)
    "
    return wf1
}


The TCL code defines a procedure called "avg_period" that needs 2 waves as argument. The first one (wave0) is the reference to define the window for average computation. This wave could be the output of the oscillator for instance. XUP function returns a vector "myxup" that contains the X values each time this wave cross 0.
Then a "for" loop is used to compute the average value of wave1 (that could be the current of a source if wanted to extract the consumption of the oscillator) by specifying the computation window based on "myxup" previously extracted. For all X values, average on Wave1 is computed between x(i) and x(i+1).
[xtmp,ytmp] is added in "myavg".
And finally this vector is converted in wave "wf1" with datatowf function.

Note: language used in Waveform Calculator is Python so the for loop syntax is also in Python because it is embedded inside the wfc.


This TCL procedure is called in Eldo with .TCL_WAVE command:
.TCL_WAVE TRAN AVG_CONSO=avg_period(v(1,3),i(v2))

K_000065963_2.PNG


Netlist: tran_oscillator.cir
Tcl procedure: avg_period.tcl
 

KB Article ID# KB000065963_EN_US

Contents

SummaryDetails

Associated Components

Eldo Classic Eldo Premier