# Need help post processing spectre simulation results

Status
Not open for further replies.

#### mtwieg

Hi all, I'm trying to simulate the large signal output impedance of a nonlinear amplifier in spectre. I had previously done this in LTspice, but spectre seems like a much better choice since it has PSS analysis, which should cut down my simulation time and data size substantially.

The simulation is set up with the amplifier biased and driven at some level, and on its output I inject an AC voltage (same frequency as the amplifier) of some phase and magnitude (so three degrees of freedom in total). I do a bit sweep of all three parameters, and that works fine.

The problem is now I'm not sure what the best way to do postprocessing is. The specific analysis I'm trying to do isn't built into spectre (no I'm not trying to do LSSP), so my choices are to either export the data from spectre into a file I can read easily into MATLAB, or I can try making the calculator do the analysis for me. I've already been doing analysis in MATLAB so I want to stick with that for now.

So what I need is a way to reliably export the swept simulation results in an orderly format to a single csv file or something similar. This includes a few time domain waveforms, as well as several (maybe six) spectral waveforms per sweep point. I presume the most professional way to do this is by SKILL code but I'm a novice there, so I was hoping that I could get by configuring ADE in a state where all the waveforms I want to export are set as outputs, and I can just manually tell it to save all of them at once. Does this sound feasible?

#### BigBoss

I used OCEAN scripts to collect the spectre results coming from diferrent computing servers ( distributed simulation, LSF).I think you can follow the same method.
I don't remember the scripts but I believe that you can find easily in Cadence help..

mtwieg

### mtwieg

Points: 2

#### mtwieg

Some quick searching turned up this short guide, this seems to be what I need, and it doesn't look terribly overwhelming. Right off the bat I can save some frequency domain voltages, but despite naming the file with .csv it's still apparently in a tab-separated format. MATLAB should be able to read it anyways, with a little work. I will work on this for a while and come back when I've run into another wall once I try it with sweeps and stuff.

Thanks!

#### BigBoss

Some quick searching turned up this short guide, this seems to be what I need, and it doesn't look terribly overwhelming. Right off the bat I can save some frequency domain voltages, but despite naming the file with .csv it's still apparently in a tab-separated format. MATLAB should be able to read it anyways, with a little work. I will work on this for a while and come back when I've run into another wall once I try it with sweeps and stuff.

Thanks!

In Waveform Graph, there is a utility to export the signal as CVS format ( or others ).You can do that by selecting "Signal Waveform" then Trace-->Export--><Select Format>-->Save..

#### mtwieg

Right I saw that at first but since I'm exporting many signals in both time and frequency domain it would be a big hassle to do it manually, especially since I need the signals to be sorted in a consistent order within the file.

#### mtwieg

Okay I've toyed around with the ocnPrint() command and when I try to get the results of multiple output currents from a multidimensional sweep into a single file, it starts printing in strange ways... Here is the bit of code I'm using. It does a two dimensional parametric analysis sweep of a PSS with its own swept variable (not sure if that's any better than doing a 3D param sweep of a simple one shot PSS....). I then save a couple frequency domain (eight harmonics) terminal currents (V3/PLUS and emf/PLUS) to my file:
Code:
analysis('pss ?fund "63.6M"  ?harms "8"  ?errpreset "moderate"
?tstab "1u"  ?saveinit "yes"  ?param "Pemf"  ?start "0"
?stop "360-360/Nphase"  ?sweepStep "(360/Nphase)"  )

; define all my variables.....

saveOption( 'useprobes "yes" )
saveOption( 'currents "all" )
saveOption( 'save "all" )
temp( 27 )
out=outfile("./myOutputFile.csv" "w")

paramAnalysis("VD" ?values '(5 10 )
paramAnalysis("Vemf" ?values '(0 5 )
))

paramRun()

;run()

results()
selectResults('pss_fd)
outputs()
ocnPrint( ?output "./myOutputFile.csv" i("/V3/PLUS") i("/emf/PLUS") ?precision 16 ?numberNotation 'scientific)

Here's what a section of my resulting file looks like.

Code:
freq (Hz)         i "/V3/PLUS" ?    i "/emf/PLUS"

VD = 5.000e+00
Vemf = 0.000e+00
Pemf              0.000e+00         1.800e+02
0.000000e+00      2.003035e+00      2.003035e+00
6.360000e+07      2.303541e-05      2.302624e-05
1.272000e+08      3.156149e-02      3.156149e-02
1.908000e+08      1.566088e-05      1.566102e-05
2.544000e+08      2.251377e-03      2.251377e-03
3.180000e+08      1.023122e-05      1.023153e-05
3.816000e+08      8.556886e-04      8.556886e-04
4.452000e+08      6.148428e-06      6.148535e-06
5.088000e+08      5.876728e-04      5.876728e-04

freq (Hz)         i "/V3/PLUS" ?    i "/emf/PLUS"
VD = 5.000e+00
Vemf = 5.000e+00
Pemf              0.000e+00         1.800e+02
0.000000e+00      1.457860e+00      2.557659e+00
6.360000e+07      3.225801e-05      1.950321e-05
1.272000e+08      3.979855e-02      2.358029e-02
1.908000e+08      2.107013e-05      1.399825e-05
2.544000e+08      2.560928e-03      2.704357e-03
3.180000e+08      1.366810e-05      8.280167e-06
3.816000e+08      4.835256e-04      1.457072e-03
4.452000e+08      8.255963e-06      4.655203e-06
5.088000e+08      2.577641e-04      9.575695e-04

freq (Hz)         i "/V3/PLUS" ?    i "/emf/PLUS"
VD = 1.000e+01
Vemf = 0.000e+00
Pemf              0.000e+00         1.800e+02
0.000000e+00      4.181946e+00      4.181946e+00
6.360000e+07      4.489758e-05      4.499004e-05
1.272000e+08      9.029502e-02      9.029502e-02
1.908000e+08      3.653996e-05      3.653356e-05
2.544000e+08      6.681358e-03      6.681359e-03
3.180000e+08      2.147855e-05      2.147617e-05
3.816000e+08      1.074253e-03      1.074252e-03
4.452000e+08      1.316462e-05      1.316373e-05
5.088000e+08      7.937277e-04      7.937280e-04

freq (Hz)         i "/V3/PLUS" ?    i "/emf/PLUS"
VD = 1.000e+01
Vemf = 5.000e+00
Pemf              0.000e+00         1.800e+02
0.000000e+00      3.646274e+00      4.710046e+00
6.360000e+07      6.461666e-05      6.434143e-05
1.272000e+08      1.006379e-01      8.027135e-02
1.908000e+08      5.027847e-05      3.655591e-05
2.544000e+08      6.293988e-03      7.052111e-03
3.180000e+08      2.799251e-05      2.036455e-05
3.816000e+08      2.303542e-04      1.937481e-03
4.452000e+08      1.152624e-05      1.042267e-05
5.088000e+08      3.741796e-04      1.228669e-03

freq (Hz)         i "/V3/PLUS" ?    i "/emf/PLUS"
VD = 5.000e+00
Vemf = 0.000e+00
Pemf              0.000e+00         1.800e+02
0.000000e+00      1.931826e-04      1.931826e-04
6.360000e+07      1.302202e+00      1.302202e+00
1.272000e+08      2.554010e-04      2.554004e-04
1.908000e+08      2.234784e-03      2.234784e-03
2.544000e+08      9.135043e-05      9.135038e-05
3.180000e+08      6.459813e-04      6.459812e-04
3.816000e+08      5.696015e-05      5.696012e-05
4.452000e+08      2.936241e-04      2.936241e-04
5.088000e+08      4.117021e-05      4.117017e-05

freq (Hz)         i "/V3/PLUS" ?    i "/emf/PLUS"
VD = 5.000e+00
Vemf = 5.000e+00
Pemf              0.000e+00         1.800e+02
0.000000e+00      1.187199e-04      2.693180e-04
6.360000e+07      9.697355e-01      1.671418e+00
1.272000e+08      2.102841e-04      3.044971e-04
1.908000e+08      1.557618e-03      2.983903e-03
2.544000e+08      7.906408e-05      1.041942e-04
3.180000e+08      4.825799e-04      8.376897e-04
3.816000e+08      5.046117e-05      6.468615e-05
4.452000e+08      2.311789e-04      3.635262e-04
5.088000e+08      3.656876e-05      4.644422e-05

freq (Hz)         i "/V3/PLUS" ?    i "/emf/PLUS"
VD = 1.000e+01
Vemf = 0.000e+00
Pemf              0.000e+00         1.800e+02
0.000000e+00      4.386338e-04      4.386338e-04
6.360000e+07      2.694160e+00      2.694160e+00
1.272000e+08      4.877893e-04      4.877892e-04
1.908000e+08      5.823824e-03      5.823823e-03
2.544000e+08      1.652732e-04      1.652713e-04
3.180000e+08      8.230741e-04      8.230730e-04
3.816000e+08      1.027487e-04      1.027476e-04
4.452000e+08      4.699788e-04      4.699783e-04
5.088000e+08      7.327464e-05      7.327406e-05

freq (Hz)         i "/V3/PLUS" ?    i "/emf/PLUS"
VD = 1.000e+01
Vemf = 5.000e+00
Pemf              0.000e+00         1.800e+02
0.000000e+00      3.674653e-04      5.109941e-04
6.360000e+07      2.333870e+00      3.058098e+00
1.272000e+08      4.397657e-04      5.387826e-04
1.908000e+08      5.189853e-03      6.538269e-03
2.544000e+08      1.517307e-04      1.784527e-04
3.180000e+08      6.293325e-04      1.039369e-03
3.816000e+08      9.333905e-05      1.091077e-04
4.452000e+08      3.941644e-04      5.461989e-04
5.088000e+08      6.737233e-05      7.792299e-05

So there are two columns and eight blocks of results. The two columns of each block are labeled as if they are my different waveforms, but they are the same variable but with a different Pemf sweep value. The top four blocks and bottom four blocks are the different waveforms... pretty confusing.

My dataset is going to be five dimensional, so there's obviously no way I'm going to get it into a text file in a nice form. But at least I want it to be readable to matlab as a single matrix which I can then reshape. But the spacing and headers between the different blocks are making that impossible.

So my basic question right now is: How do I save a high-dimensioned dataset in one file in a way where it can be read in as a single matrix?

Status
Not open for further replies.