diff --git a/README.optran b/README.optran index 8d0a0a8b9..8c06ec5ab 100644 --- a/README.optran +++ b/README.optran @@ -43,4 +43,9 @@ simulation when all nodes have become stable, might be desirable, but has not yet been implemented. One also may use the optran for a first transient simulation, maybe with different step sizes, before the next (tran, ac, pz, noise) -simulation is commencing. +simulation is commencing. So you may reach a certain bias point +quickly and with coarse time steps, and then continue with fine +steps to see details. For example a power amp in electro-thermal +simulation may run for some seconds (minutes?) until the final +temperature is reached, and then the detailed transient or +an ac simulation starts. diff --git a/examples/optran/script-optran.txt b/examples/optran/script-optran.txt index 274b43c13..d58092225 100644 --- a/examples/optran/script-optran.txt +++ b/examples/optran/script-optran.txt @@ -9,10 +9,10 @@ version rusage else *** script for standard ngspice -* Start optran without first iteration, +* Start optran without first iteration, * without gmin stepping and without src stepping -* optran duration 4s, step size 10 ms -optran 1 0 0 4 1e-2 0 +* optran step size 10 ms, duration 40s, +optran 1 0 0 1e-2 4 0 tran 1u 10m echo * output power @@ -31,8 +31,8 @@ plot in out *plot V1#branch V2#branch ylimit -50 50 plot V1#branch V2#branch ylimit -15 15 * output current -plot @rl1[i] -*plot @rl1[i] xlimit 0 5m ylimit -0.3 0.3 +plot @rl1[i] +*plot @rl1[i] xlimit 0 5m ylimit -0.3 0.3 * resistance of thermistor2 TH1, TH2 let rth1 = (v("net-_d3a1-pad1_") - v("net-_r11-pad1_")) / (@b.xth1.brtherm[i] + 1n) let rth2 = (v("net-_d1a1-pad2_") - v("net-_r12-pad1_")) / (@b.xth2.brtherm[i] + 1n) @@ -47,7 +47,8 @@ tran 1u 100m fft out set xbrushwidth=4 set color0=white +plot mag(out) xlimit 0 10k +* to see the harmonics plot mag(out) xlimit 0 10k ylimit 0 30m - end .endc \ No newline at end of file diff --git a/src/spicelib/analysis/optran.c b/src/spicelib/analysis/optran.c index fd63f6e38..85106aa40 100644 --- a/src/spicelib/analysis/optran.c +++ b/src/spicelib/analysis/optran.c @@ -50,11 +50,15 @@ static double opramptime = 0.; CKTnoOpIter (default 0, set by 'option noopiter') CKTnumGminSteps CKTnumSrcSteps - opfinaltime opstepsize + opfinaltime opramptime -*/ + A typical command may be + optran 1 0 0 50u 10m 0 + (no initial iteration, no gmin stepping, no source stepping, + stepsize for optran 50 us, optran run until 10 ms, no supply ramping + */ void com_optran(wordlist* wl) { wordlist* wltmp = wl; char* stpstr; @@ -76,11 +80,11 @@ void com_optran(wordlist* wl) { if ((errno == ERANGE) || (*stpstr != '\0')) goto bugquit; wltmp = wltmp->wl_next; - opfinaltime = strtod(wltmp->wl_word, &stpstr); + opstepsize = strtod(wltmp->wl_word, &stpstr); if ((errno == ERANGE) || (*stpstr != '\0')) goto bugquit; wltmp = wltmp->wl_next; - opstepsize = strtod(wltmp->wl_word, &stpstr); + opfinaltime = strtod(wltmp->wl_word, &stpstr); if ((errno == ERANGE) || (*stpstr != '\0')) goto bugquit; wltmp = wltmp->wl_next;