From dff212c630410fcbd5fa93e9889c8f18cf76b80b Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 29 Jan 2023 11:51:15 +0100 Subject: [PATCH] Preliminary bug-617 fix: Don't set temperature to a step beyond the sweep boundaries. --- src/spicelib/analysis/dctrcurv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/spicelib/analysis/dctrcurv.c b/src/spicelib/analysis/dctrcurv.c index 996e907c7..2f53734c9 100644 --- a/src/spicelib/analysis/dctrcurv.c +++ b/src/spicelib/analysis/dctrcurv.c @@ -465,6 +465,17 @@ DCtrCurv(CKTcircuit *ckt, int restart) DEVices[rcode]->DEVload(job->TRCVvElt[i]->GENmodPtr, ckt); } else if (job->TRCVvType[i] == TEMP_CODE) { /* temperature */ ckt->CKTtemp += job->TRCVvStep[i]; + + /* FIXME: Do the Temp check already here for the first time. + If the stop criterion is fulfilled, discard Temp evaluation, because + CKTtemp may report errors if a large extra Temp step is exercized. */ + if (SGN(job->TRCVvStep[i]) * + ((ckt->CKTtemp - CONSTCtoK) - job->TRCVvStop[i]) > DBL_EPSILON * 1e+03) { +// ckt->CKTtemp -= job->TRCVvStep[i]; // Undo the large step +// ckt->CKTtemp += SGN(job->TRCVvStep[i]) * DBL_EPSILON * 2e+03; // Add just a small step + continue; // Skip model evaluation + } + inp_evaluate_temper(ft_curckt); CKTtemp(ckt); }