diff --git a/src/spicelib/devices/isrc/isrcload.c b/src/spicelib/devices/isrc/isrcload.c index 13a19f68e..fc9a7a17b 100644 --- a/src/spicelib/devices/isrc/isrcload.c +++ b/src/spicelib/devices/isrc/isrcload.c @@ -322,6 +322,9 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt) time -= here->ISRCcoeffs[here->ISRCrBreakpt]; time -= period * floor(time / period); time += here->ISRCcoeffs[here->ISRCrBreakpt]; + /* prevent glitches */ + if (time > end_time) + time = end_time; } else { value = diff --git a/src/spicelib/devices/vsrc/vsrcload.c b/src/spicelib/devices/vsrc/vsrcload.c index 1dee79108..90eb7f64b 100644 --- a/src/spicelib/devices/vsrc/vsrcload.c +++ b/src/spicelib/devices/vsrc/vsrcload.c @@ -351,6 +351,9 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) time -= here->VSRCcoeffs[here->VSRCrBreakpt]; time -= period * floor(time / period); time += here->VSRCcoeffs[here->VSRCrBreakpt]; + /* prevent glitches */ + if (time > end_time) + time = end_time; } else { value = here->VSRCcoeffs[here->VSRCfunctionOrder - 1];