Try to equalise the last two time steps before a breakpoint,

if the second step would be smaller than CKTdelta otherwise.
This commit is contained in:
Holger Vogt 2025-11-15 19:50:04 +01:00
parent 95b8cee898
commit b3eb6b12fe
1 changed files with 19 additions and 0 deletions

View File

@ -525,6 +525,7 @@ resume:
}
#ifndef XSPICE
/* Force the breakpoint if appropriate */
else if(ckt->CKTtime + ckt->CKTdelta >= ckt->CKTbreaks[0]) {
ckt->CKTsaveDelta = ckt->CKTdelta;
ckt->CKTdelta = ckt->CKTbreaks[0] - ckt->CKTtime;
@ -534,6 +535,15 @@ resume:
#endif
ckt->CKTbreak = 1; /* why? the current pt. is not a bkpt. */
}
/* Try to equalise the last two time steps before the breakpoint,
if the second step would be smaller than CKTdelta otherwise.*/
else if (ckt->CKTtime + 1.9 * ckt->CKTdelta > ckt->CKTbreaks[0]) {
ckt->CKTsaveDelta = ckt->CKTdelta;
ckt->CKTdelta = (ckt->CKTbreaks[0] - ckt->CKTtime) / 2.;
#ifdef STEPDEBUG
fprintf(stdout, "Delta equalising step at time %e with delta %e\n", ckt->CKTtime, ckt->CKTdelta);
#endif
}
#endif /* !XSPICE */
@ -574,6 +584,15 @@ resume:
ckt->CKTsaveDelta = ckt->CKTdelta;
ckt->CKTdelta = ckt->CKTbreaks[0] - ckt->CKTtime;
}
/* Try to equalise the last two time steps before the breakpoint,
if the second step would be smaller than CKTdelta otherwise.*/
else if (ckt->CKTtime + 1.9 * ckt->CKTdelta > ckt->CKTbreaks[0]) {
ckt->CKTsaveDelta = ckt->CKTdelta;
ckt->CKTdelta = (ckt->CKTbreaks[0] - ckt->CKTtime) / 2.;
#ifdef STEPDEBUG
fprintf(stdout, "Delta equalising step at time %e with delta %e\n", ckt->CKTtime, ckt->CKTdelta);
#endif
}
#ifdef SHARED_MODULE
/* Either directly go to next time step, or modify ckt->CKTdelta depending on