Browse Source

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
pre-master-46
rlar 11 years ago
parent
commit
61724121aa
  1. 14
      src/spicelib/devices/res/ressetup.c
  2. 15
      src/spicelib/devices/res/restemp.c

14
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->RESscaleGiven) here->RESscale = 1.0;
if(!here->RESmGiven) here->RESm = 1.0; if(!here->RESmGiven) here->RESm = 1.0;
if(!here->RESnoisyGiven) here->RESnoisy = 1; 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) if(!here->RESbv_maxGiven)
here->RESbv_max = model->RESbv_max; here->RESbv_max = model->RESbv_max;

15
src/spicelib/devices/res/restemp.c

@ -33,6 +33,21 @@ REStemp(GENmodel *inModel, CKTcircuit *ckt)
for (here = model->RESinstances; here != NULL ; for (here = model->RESinstances; here != NULL ;
here=here->RESnextInstance) { 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 */ /* Default Value Processing for Resistor Instance */
if(!here->REStempGiven) { if(!here->REStempGiven) {

Loading…
Cancel
Save