Reverse stepsize and finaltime in optran command,

stepsize first as in tran command.
This commit is contained in:
Holger Vogt 2020-06-16 15:05:39 +02:00
parent 33d7cbad98
commit a077bac97d
3 changed files with 24 additions and 15 deletions

View File

@ -37,13 +37,12 @@ Step 3 may be skipped by
option srcsteps=0
command optran n3 overrides srcsteps
n4 sets the time for transient simulation.
n4 sets the step size for transient simulation towards the operating point.
n5 sets the step size for transient simulation.
n5 sets the time for transient simulation towards the operating point.
n6 set a ramp time to ramp all indpendent voltage or
n6 set a ramp time to ramp all independent voltage or
current sources until 100% is reached at opramptime.
(not yet implemented)
The transient op calculation uses the 'UIC' flag for its startup.
Basically two applications come to mind: You may use this with
@ -53,4 +52,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.

View File

@ -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

View File

@ -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;