The default start-up time is 20us. This value may be changed by adding

set startup_time = <value>
to .spiceinit, where <value> may be any positive real number representing
the time (including ngspice-specific multipliers like 12u etc).
This commit is contained in:
Holger Vogt 2019-10-13 10:10:33 +02:00
parent 22702cdd3d
commit 448763a351
2 changed files with 20 additions and 4 deletions

View File

@ -11,6 +11,7 @@ Modified: 2000 Alansfixes
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
#include "ngspice/1-f-code.h" #include "ngspice/1-f-code.h"
#include "ngspice/cpextern.h"
#ifdef XSPICE_EXP #ifdef XSPICE_EXP
/* gtri - begin - wbk - modify for supply ramping option */ /* gtri - begin - wbk - modify for supply ramping option */
@ -33,6 +34,12 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt)
double value; double value;
double time; double time;
double m; double m;
static double StartupTime = 0.0;
if (StartupTime == 0.0) {
if (!cp_getvar("startup_time", CP_REAL, &StartupTime, 0))
StartupTime = 20.0e-6;
}
/* loop through all the source models */ /* loop through all the source models */
for( ; model != NULL; model = ISRCnextModel(model)) { for( ; model != NULL; model = ISRCnextModel(model)) {
@ -391,8 +398,9 @@ INoi1 1 0 DC 0 TRNOISE(0n 0.5n 1 10n) : generate 1/f noise
#endif #endif
} // switch } // switch
if ((ckt->CKTmode&MODESTARTUP) && ckt->CKTtime < 20e-6) { if ((ckt->CKTmode & MODESTARTUP) &&
value *= ckt->CKTtime/20e-6; ckt->CKTtime < StartupTime) {
value *= ckt->CKTtime / StartupTime;
} }
} // else (line 48) } // else (line 48)
loadDone: loadDone:

View File

@ -11,6 +11,7 @@ Modified: 2000 AlansFixes
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
#include "ngspice/1-f-code.h" #include "ngspice/1-f-code.h"
#include "ngspice/cpextern.h"
#ifdef XSPICE_EXP #ifdef XSPICE_EXP
/* gtri - begin - wbk - modify for supply ramping option */ /* gtri - begin - wbk - modify for supply ramping option */
@ -32,6 +33,12 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt)
VSRCinstance *here; VSRCinstance *here;
double time; double time;
double value = 0.0; double value = 0.0;
static double StartupTime = 0.0;
if (StartupTime == 0.0) {
if (!cp_getvar("startup_time", CP_REAL, &StartupTime, 0))
StartupTime = 20.0e-6;
}
/* loop through all the source models */ /* loop through all the source models */
for( ; model != NULL; model = VSRCnextModel(model)) { for( ; model != NULL; model = VSRCnextModel(model)) {
@ -405,8 +412,9 @@ VNoi3 3 0 DC 0 TRNOISE(0 0 0 0 15m 22u 50u) : generate RTS noise
#endif #endif
} // switch } // switch
if ((ckt->CKTmode&MODESTARTUP) && ckt->CKTtime < 20e-6) { if ((ckt->CKTmode & MODESTARTUP) &&
value *= ckt->CKTtime/20e-6; ckt->CKTtime < StartupTime) {
value *= ckt->CKTtime / StartupTime;
} }
} // else (line 48) } // else (line 48)
loadDone: loadDone: