Consecutive tran and ac simulation may lead to gross errors
when TC or scale is used on the instance line of C and L. Reason is the missing reset when CKTtemp is called once during each simulation command. TC or scale is then applied again and again, a reset is missing. This patch adds a reset, i.e. the capacitance or inductance is reset to its instance value in a call to *temp. It fixes bug#594. Command 'alter' has been tested. Resistance has not been tackled by this bug, because the line here->RESconduct = here->RESm / (here->RESresist * factor * here->RESscale); differs from here->CAPcapac = here->CAPcapac * factor * here->CAPscale; in that there is no accumulation of correction factors with here->RESconduct
This commit is contained in:
parent
c26e4c990a
commit
f073fb5c05
|
|
@ -33,6 +33,7 @@ typedef struct sCAPinstance {
|
|||
double CAPtemp; /* temperature at which this capacitor operates */
|
||||
double CAPdtemp; /* delta-temperature of this instance */
|
||||
double CAPcapac; /* capacitance */
|
||||
double CAPcapacinst;/* capacitance on instance line */
|
||||
double CAPinitCond; /* initial capacitor voltage if specified */
|
||||
double CAPwidth; /* width of the capacitor */
|
||||
double CAPlength; /* length of the capacitor */
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ CAPparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
|||
|
||||
switch(param) {
|
||||
case CAP_CAP:
|
||||
here->CAPcapac = value->rValue;
|
||||
here->CAPcapacinst = here->CAPcapac = value->rValue;
|
||||
if (!here->CAPmGiven)
|
||||
here->CAPm = 1.0;
|
||||
here->CAPcapGiven = TRUE;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ CAPtemp(GENmodel *inModel, CKTcircuit *ckt)
|
|||
if (!here->CAPscaleGiven) here->CAPscale = 1.0;
|
||||
if (!here->CAPmGiven) here->CAPm = 1.0;
|
||||
|
||||
if (!here->CAPcapGiven) { /* No instance capacitance given */
|
||||
if (!here->CAPcapGiven) { /* No instance capacitance given */
|
||||
if (!model->CAPmCapGiven) { /* No model capacitange given */
|
||||
here->CAPcapac =
|
||||
model->CAPcj *
|
||||
|
|
@ -60,11 +60,14 @@ CAPtemp(GENmodel *inModel, CKTcircuit *ckt)
|
|||
(here->CAPlength - model->CAPshort) +
|
||||
model->CAPcjsw * 2 * (
|
||||
(here->CAPlength - model->CAPshort) +
|
||||
(here->CAPwidth - model->CAPnarrow) );
|
||||
} else {
|
||||
(here->CAPwidth - model->CAPnarrow));
|
||||
}
|
||||
else {
|
||||
here->CAPcapac = model->CAPmCap;
|
||||
}
|
||||
}
|
||||
else
|
||||
here->CAPcapac = here->CAPcapacinst; /* reset capacitance to instance value */
|
||||
|
||||
difference = (here->CAPtemp + here->CAPdtemp) - model->CAPtnom;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ struct sINDinstance {
|
|||
|
||||
int INDbrEq; /* number of the branch equation added for current */
|
||||
double INDinduct; /* inductance */
|
||||
double INDinductinst;/* inductance on instance line */
|
||||
double INDm; /* Parallel multiplier */
|
||||
double INDtc1; /* first temperature coefficient of resistors */
|
||||
double INDtc2; /* second temperature coefficient of resistors */
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ INDparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
|||
|
||||
switch(param) {
|
||||
case IND_IND:
|
||||
here->INDinduct = value->rValue;
|
||||
here->INDinductinst = here->INDinduct = value->rValue;
|
||||
if (!here->INDmGiven)
|
||||
here->INDm =1.0;
|
||||
here->INDindGiven = TRUE;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ INDtemp(GENmodel *inModel, CKTcircuit *ckt)
|
|||
else
|
||||
here->INDinduct = model->INDmInd;
|
||||
}
|
||||
else
|
||||
here->INDinduct = here->INDinductinst; /* reset inductance to instance value */
|
||||
|
||||
difference = (here->INDtemp + here->INDdtemp) - model->INDtnom;
|
||||
|
||||
/* instance parameters tc1 and tc2 will override
|
||||
|
|
|
|||
Loading…
Reference in New Issue