Reverting back the previous commit, but also avoided to push a NaN in the predicted frequency

This commit is contained in:
Francesco Lannutti 2016-02-14 01:09:10 +01:00
parent 02b7fc950e
commit 4f2e0f1581
3 changed files with 10 additions and 9 deletions

View File

@ -18,4 +18,4 @@ l2 0 4 500m
r2 4 2 100
*.tran 300n 50m
.pss 50 200e-3 2 1024 11 10 5e-3 uic
.pss 50 2 2 1024 11 10 5e-3 uic

View File

@ -26,4 +26,4 @@ mn4 bout inv3 gnd_ana gnd_ana nch w=10u l=0.18u
*.tran 0.005n 100n
*.plot tran v(4)
.pss 624e6 500n 1 1024 10 5 5e-3 uic
.pss 624e6 500n 1 1024 10 20 5e-3 uic

View File

@ -647,7 +647,7 @@ DCpss(CKTcircuit *ckt,
RHS_copy_der [i] = ckt->CKTrhsOld [i + 1] ;
#ifdef STEPDEBUG
fprintf (stderr, "Pred is so high or so low! Diff is: %g\n", err_conv [i]) ;
fprintf (stderr, "Pred is so high or so low! Diff is: %-.9g\tat node: %d\n", err_conv [i], i) ;
#endif
}
@ -744,17 +744,18 @@ DCpss(CKTcircuit *ckt,
{
/* Pitagora ha sempre ragione!!! :))) */
/* pred is treated as FREQUENCY to avoid numerical overflow when derivative is close to ZERO */
if ((RHS_derivative [i] != 0) && (err_conv [i] == 0)) {
pred [i] = DBL_MAX ;
} else {
if (fabs (err_conv [i]) != 0)
{
pred [i] = RHS_derivative [i] / err_conv [i] ;
} else {
pred [i] = 1.0e6 * ckt->CKTguessedFreq ;
}
#ifdef STEPDEBUG
fprintf (stderr, "Pred is so high or so low! Diff is: %g\n", err_conv [i]) ;
fprintf (stderr, "Pred is so high or so low! Diff is: %-.9g\tat node: %d\n", err_conv [i], i) ;
#endif
if ((fabs (pred [i]) > 1.0e6 * ckt->CKTguessedFreq) || (err_conv [i] == 0))
if (fabs (pred [i]) > 1.0e6 * ckt->CKTguessedFreq)
{
if (pred [i] > 0)
pred [i] = 1.0e6 * ckt->CKTguessedFreq ;
@ -864,7 +865,7 @@ DCpss(CKTcircuit *ckt,
// err_conv_ref / dynamic_test, predsum) ;
//#endif
/* Take the mean value of time prediction trough the dynamic test variable - predsum becomes TIME */
/* Take the mean value of time prediction through the dynamic test variable - predsum becomes TIME */
predsum = 1 / (predsum * dynamic_test) ;
/* Store the predsum history as absolute value */