diff --git a/src/spicelib/devices/vsrc/vsrcacct.c b/src/spicelib/devices/vsrc/vsrcacct.c index 6835cd0df..df890ed76 100644 --- a/src/spicelib/devices/vsrc/vsrcacct.c +++ b/src/spicelib/devices/vsrc/vsrcacct.c @@ -56,24 +56,20 @@ VSRCaccept(CKTcircuit *ckt, GENmodel *inModel) double phase; double deltat; - /* TR negative or 0 --> TR = ckt->CKTstep - TF negative or 0 --> TF = ckt->CKTstep - PW < 0 --> PW = 0 - PER <= 0 --> PER = TR + TF + PW */ TD = here->VSRCfunctionOrder > 2 ? here->VSRCcoeffs[2] : 0.0; TR = here->VSRCfunctionOrder > 3 - && here->VSRCcoeffs[3] > 0.0 + && here->VSRCcoeffs[3] != 0.0 ? here->VSRCcoeffs[3] : ckt->CKTstep; TF = here->VSRCfunctionOrder > 4 - && here->VSRCcoeffs[4] > 0.0 + && here->VSRCcoeffs[4] != 0.0 ? here->VSRCcoeffs[4] : ckt->CKTstep; PW = here->VSRCfunctionOrder > 5 - && here->VSRCcoeffs[5] >= 0.0 - ? here->VSRCcoeffs[5] : 0.0; + && here->VSRCcoeffs[5] != 0.0 + ? here->VSRCcoeffs[5] : ckt->CKTfinalTime; PER = here->VSRCfunctionOrder > 6 - && here->VSRCcoeffs[6] > 0.0 - ? here->VSRCcoeffs[6] : TR + TF + PW; + && here->VSRCcoeffs[6] != 0.0 + ? here->VSRCcoeffs[6] : ckt->CKTfinalTime; PHASE = here->VSRCfunctionOrder > 7 ? here->VSRCcoeffs[7] : 0.0; diff --git a/src/spicelib/devices/vsrc/vsrcload.c b/src/spicelib/devices/vsrc/vsrcload.c index 8c778d2e0..6da9b1a39 100644 --- a/src/spicelib/devices/vsrc/vsrcload.c +++ b/src/spicelib/devices/vsrc/vsrcload.c @@ -86,12 +86,7 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) } else { time = ckt->CKTtime; } - /* use the transient functions. Parameter limits: - TR negative or 0 --> TR = ckt->CKTstep - TF negative or 0 --> TF = ckt->CKTstep - PW < 0 --> PW = 0 - PER <= 0 --> PER = TR + TF + PW - */ + /* use the transient functions */ switch(here->VSRCfunctionType) { default: @@ -111,17 +106,17 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) TD = here->VSRCfunctionOrder > 2 ? here->VSRCcoeffs[2] : 0.0; TR = here->VSRCfunctionOrder > 3 - && here->VSRCcoeffs[3] > 0.0 + && here->VSRCcoeffs[3] != 0.0 ? here->VSRCcoeffs[3] : ckt->CKTstep; TF = here->VSRCfunctionOrder > 4 - && here->VSRCcoeffs[4] > 0.0 + && here->VSRCcoeffs[4] != 0.0 ? here->VSRCcoeffs[4] : ckt->CKTstep; PW = here->VSRCfunctionOrder > 5 - && here->VSRCcoeffs[5] >= 0.0 - ? here->VSRCcoeffs[5] : 0.0; + && here->VSRCcoeffs[5] != 0.0 + ? here->VSRCcoeffs[5] : ckt->CKTfinalTime; PER = here->VSRCfunctionOrder > 6 - && here->VSRCcoeffs[6] > 0.0 - ? here->VSRCcoeffs[6] : TR + TF + PW; + && here->VSRCcoeffs[6] != 0.0 + ? here->VSRCcoeffs[6] : ckt->CKTfinalTime; /* shift time by delay time TD */ time -= TD;