diff --git a/src/spicelib/devices/isrc/isrcload.c b/src/spicelib/devices/isrc/isrcload.c index 5e02b0372..ccf282e17 100644 --- a/src/spicelib/devices/isrc/isrcload.c +++ b/src/spicelib/devices/isrc/isrcload.c @@ -225,11 +225,11 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt) && here->ISRCcoeffs[4] ? here->ISRCcoeffs[4] : (500./ckt->CKTfinalTime); TD = here->ISRCfunctionOrder > 5 - ? here->ISRCcoeffs[5] : 0; - PHASEM = here->ISRCfunctionOrder > 5 ? here->ISRCcoeffs[5] : 0.0; - PHASEC = here->ISRCfunctionOrder > 6 + PHASEM = here->ISRCfunctionOrder > 6 ? here->ISRCcoeffs[6] : 0.0; + PHASEC = here->ISRCfunctionOrder > 7 + ? here->ISRCcoeffs[7] : 0.0; /* limit the modulation index */ if (MDI > FC / FM) { @@ -251,10 +251,16 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt) phasec = PHASEC * M_PI / 180.0; phasem = PHASEM * M_PI / 180.0; - /* compute waveform value */ - value = VO + VA * - sin((2.0 * M_PI * FC * time + phasec) + - MDI * sin(2.0 * M_PI * FM * time + phasem)); + time -= TD; + if (time <= 0) { + value = 0; + } + else { + /* compute waveform value */ + value = VO + VA * + sin((2.0 * M_PI * FC * time + phasec) + + MDI * sin(2.0 * M_PI * FM * time + phasem)); + } } break; diff --git a/src/spicelib/devices/vsrc/vsrcload.c b/src/spicelib/devices/vsrc/vsrcload.c index 5bb468994..e2191bf9d 100644 --- a/src/spicelib/devices/vsrc/vsrcload.c +++ b/src/spicelib/devices/vsrc/vsrcload.c @@ -254,7 +254,7 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) && here->VSRCcoeffs[4] /* test if not 0 */ ? here->VSRCcoeffs[4] : (500./ckt->CKTfinalTime); TD = here->VSRCfunctionOrder > 5 - ? here->VSRCcoeffs[5] : 0; + ? here->VSRCcoeffs[5] : 0.0; PHASEM = here->VSRCfunctionOrder > 6 ? here->VSRCcoeffs[6] : 0.0; PHASEC = here->VSRCfunctionOrder > 7