vsrc, isrc TRNOISE: allow repeated calls to 'tran'

This commit is contained in:
h_vogt 2012-12-22 17:57:31 +01:00
parent 237fd538d1
commit 8a1cec25a5
4 changed files with 16 additions and 0 deletions

View File

@ -228,6 +228,9 @@ ISRCaccept(CKTcircuit *ckt, GENmodel *inModel)
double RTSEMT = state->RTSEMT;
if (ckt->CKTtime == 0) {
/* initialzing here again needed for repeated calls to tran command */
state->RTScapTime = RTScapTime = exprand(RTSCAPT);
state->RTSemTime = RTSemTime = RTScapTime + exprand(RTSEMT);
if (ckt->CKTbreak) {
error = CKTsetBreak(ckt, RTScapTime);
if(error)

View File

@ -327,6 +327,10 @@ INoi1 1 0 DC 0 TRNOISE(0n 0.5n 1 10n) : generate 1/f noise
double TS = state -> TS;
double RTSAM = state->RTSAM;
/* reset top (hack for repeated tran commands) */
if (time == 0)
state->top = 0;
/* no noise */
if(TS == 0.0) {
value = 0.0;

View File

@ -228,6 +228,10 @@ VSRCaccept(CKTcircuit *ckt, GENmodel *inModel)
double RTSEMT = state->RTSEMT;
if (ckt->CKTtime == 0) {
/* initialzing here again needed for repeated calls to tran command */
state->RTScapTime = RTScapTime = exprand(RTSCAPT);
state->RTSemTime = RTSemTime = RTScapTime + exprand(RTSEMT);
if (ckt->CKTbreak) {
error = CKTsetBreak(ckt, RTScapTime);
if(error)

View File

@ -345,10 +345,15 @@ VNoi3 3 0 DC 0 TRNOISE(0 0 0 0 15m 22u 50u) : generate RTS noise
double TS = state -> TS;
double RTSAM = state->RTSAM;
/* reset top (hack for repeated tran commands) */
if (time == 0)
state->top = 0;
/* no noise */
if(TS == 0.0) {
value = 0.0;
} else {
/* 1/f and white noise */
size_t n1 = (size_t) floor(time / TS);