Fix a bug in the SFFM current source, reported by Dmitriy.

Enable TD.
This commit is contained in:
Holger Vogt 2026-04-24 19:53:45 +02:00
parent 24240d0e9a
commit e6e3d62118
2 changed files with 14 additions and 8 deletions

View File

@ -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;

View File

@ -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