Browse Source

Reverse stepsize and finaltime in optran command,

stepsize first as in tran command.
pre-master-46
Holger Vogt 6 years ago
parent
commit
3be5926f2c
  1. 7
      README.optran
  2. 7
      examples/optran/script-optran.txt
  3. 12
      src/spicelib/analysis/optran.c

7
README.optran

@ -43,4 +43,9 @@ simulation when all nodes have become stable, might be desirable,
but has not yet been implemented. but has not yet been implemented.
One also may use the optran for a first transient simulation, maybe One also may use the optran for a first transient simulation, maybe
with different step sizes, before the next (tran, ac, pz, noise) 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.

7
examples/optran/script-optran.txt

@ -11,8 +11,8 @@ else
*** script for standard ngspice *** script for standard ngspice
* Start optran without first iteration, * Start optran without first iteration,
* without gmin stepping and without src stepping * 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 tran 1u 10m
echo echo
* output power * output power
@ -47,7 +47,8 @@ tran 1u 100m
fft out fft out
set xbrushwidth=4 set xbrushwidth=4
set color0=white set color0=white
plot mag(out) xlimit 0 10k
* to see the harmonics
plot mag(out) xlimit 0 10k ylimit 0 30m plot mag(out) xlimit 0 10k ylimit 0 30m
end end
.endc .endc

12
src/spicelib/analysis/optran.c

@ -50,11 +50,15 @@ static double opramptime = 0.;
CKTnoOpIter (default 0, set by 'option noopiter') CKTnoOpIter (default 0, set by 'option noopiter')
CKTnumGminSteps CKTnumGminSteps
CKTnumSrcSteps CKTnumSrcSteps
opfinaltime
opstepsize opstepsize
opfinaltime
opramptime 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) { void com_optran(wordlist* wl) {
wordlist* wltmp = wl; wordlist* wltmp = wl;
char* stpstr; char* stpstr;
@ -76,11 +80,11 @@ void com_optran(wordlist* wl) {
if ((errno == ERANGE) || (*stpstr != '\0')) if ((errno == ERANGE) || (*stpstr != '\0'))
goto bugquit; goto bugquit;
wltmp = wltmp->wl_next; wltmp = wltmp->wl_next;
opfinaltime = strtod(wltmp->wl_word, &stpstr);
opstepsize = strtod(wltmp->wl_word, &stpstr);
if ((errno == ERANGE) || (*stpstr != '\0')) if ((errno == ERANGE) || (*stpstr != '\0'))
goto bugquit; goto bugquit;
wltmp = wltmp->wl_next; wltmp = wltmp->wl_next;
opstepsize = strtod(wltmp->wl_word, &stpstr);
opfinaltime = strtod(wltmp->wl_word, &stpstr);
if ((errno == ERANGE) || (*stpstr != '\0')) if ((errno == ERANGE) || (*stpstr != '\0'))
goto bugquit; goto bugquit;
wltmp = wltmp->wl_next; wltmp = wltmp->wl_next;

Loading…
Cancel
Save