diff --git a/src/spicelib/devices/isrc/isrcload.c b/src/spicelib/devices/isrc/isrcload.c index 37b138564..3f3816da4 100644 --- a/src/spicelib/devices/isrc/isrcload.c +++ b/src/spicelib/devices/isrc/isrcload.c @@ -11,6 +11,7 @@ Modified: 2000 Alansfixes #include "ngspice/sperror.h" #include "ngspice/suffix.h" #include "ngspice/1-f-code.h" +#include "ngspice/cpextern.h" #ifdef XSPICE_EXP /* gtri - begin - wbk - modify for supply ramping option */ @@ -33,6 +34,12 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt) double value; double time; 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 */ 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 } // switch - if ((ckt->CKTmode&MODESTARTUP) && ckt->CKTtime < 20e-6) { - value *= ckt->CKTtime/20e-6; + if ((ckt->CKTmode & MODESTARTUP) && + ckt->CKTtime < StartupTime) { + value *= ckt->CKTtime / StartupTime; } } // else (line 48) loadDone: diff --git a/src/spicelib/devices/vsrc/vsrcload.c b/src/spicelib/devices/vsrc/vsrcload.c index 1c77978c2..315e58a18 100644 --- a/src/spicelib/devices/vsrc/vsrcload.c +++ b/src/spicelib/devices/vsrc/vsrcload.c @@ -11,6 +11,7 @@ Modified: 2000 AlansFixes #include "ngspice/sperror.h" #include "ngspice/suffix.h" #include "ngspice/1-f-code.h" +#include "ngspice/cpextern.h" #ifdef XSPICE_EXP /* gtri - begin - wbk - modify for supply ramping option */ @@ -32,6 +33,12 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) VSRCinstance *here; double time; 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 */ 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 } // switch - if ((ckt->CKTmode&MODESTARTUP) && ckt->CKTtime < 20e-6) { - value *= ckt->CKTtime/20e-6; + if ((ckt->CKTmode & MODESTARTUP) && + ckt->CKTtime < StartupTime) { + value *= ckt->CKTtime / StartupTime; } } // else (line 48) loadDone: