From 61724121aada5b7c54268879d8188e2fccaaee13 Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 9 Aug 2015 17:20:50 +0200 Subject: [PATCH] res/restemp.c, bug fix, need to update `RESresist' in `REStemp()' instead of `RESsetup()' to be effective when altering a resistor model parameter or when sweeping a resistor model parameter in a dc analysis. see tests/regression/temper/temper-3.cir --- src/spicelib/devices/res/ressetup.c | 14 -------------- src/spicelib/devices/res/restemp.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/spicelib/devices/res/ressetup.c b/src/spicelib/devices/res/ressetup.c index 44c75ea5f..25150a831 100644 --- a/src/spicelib/devices/res/ressetup.c +++ b/src/spicelib/devices/res/ressetup.c @@ -52,20 +52,6 @@ RESsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit*ckt, int *state) if(!here->RESscaleGiven) here->RESscale = 1.0; if(!here->RESmGiven) here->RESm = 1.0; if(!here->RESnoisyGiven) here->RESnoisy = 1; - if(!here->RESresGiven) { - if(here->RESlength * here->RESwidth * model->RESsheetRes > 0.0) { - here->RESresist = model->RESsheetRes * (here->RESlength - - model->RESshort) / (here->RESwidth - model->RESnarrow); - } else { - if(model->RESresGiven) { - here->RESresist = model->RESres; - } else { - SPfrontEnd->IFerrorf (ERR_WARNING, - "%s: resistance to low, set to 1 mOhm", here->RESname); - here->RESresist = 1e-03; - } - } - } if(!here->RESbv_maxGiven) here->RESbv_max = model->RESbv_max; diff --git a/src/spicelib/devices/res/restemp.c b/src/spicelib/devices/res/restemp.c index a0f8c925c..64afc6201 100644 --- a/src/spicelib/devices/res/restemp.c +++ b/src/spicelib/devices/res/restemp.c @@ -33,6 +33,21 @@ REStemp(GENmodel *inModel, CKTcircuit *ckt) for (here = model->RESinstances; here != NULL ; here=here->RESnextInstance) { + if (!here->RESresGiven) { + if (here->RESlength * here->RESwidth * model->RESsheetRes > 0.0) { + here->RESresist = + (here->RESlength - model->RESshort) / + (here->RESwidth - model->RESnarrow) * + model->RESsheetRes; + } else if (model->RESresGiven) { + here->RESresist = model->RESres; + } else { + SPfrontEnd->IFerrorf (ERR_WARNING, + "%s: resistance to low, set to 1 mOhm", here->RESname); + here->RESresist = 1e-03; + } + } + /* Default Value Processing for Resistor Instance */ if(!here->REStempGiven) {