resload.c, restemp.c tc1, tc2 instance parameters override model parameters
This commit is contained in:
parent
bd0dd7e465
commit
7108aae784
|
|
@ -17,31 +17,22 @@ RESload(GENmodel *inModel, CKTcircuit *ckt)
|
|||
{
|
||||
RESmodel *model = (RESmodel *)inModel;
|
||||
double m;
|
||||
double difference;
|
||||
double factor;
|
||||
|
||||
|
||||
/* loop through all the resistor models */
|
||||
for( ; model != NULL; model = model->RESnextModel ) {
|
||||
RESinstance *here;
|
||||
RESinstance *here;
|
||||
|
||||
/* loop through all the instances of the model */
|
||||
for (here = model->RESinstances; here != NULL ;
|
||||
here = here->RESnextInstance) {
|
||||
|
||||
if(!here->REStc1Given) here->REStc1 = 0.0;
|
||||
if(!here->REStc2Given) here->REStc2 = 0.0;
|
||||
if(!here->RESmGiven) here->RESm = 1.0;
|
||||
if(!here->RESmGiven)
|
||||
here->RESm = 1.0;
|
||||
|
||||
here->REScurrent = (*(ckt->CKTrhsOld+here->RESposNode) -
|
||||
*(ckt->CKTrhsOld+here->RESnegNode)) * here->RESconduct;
|
||||
|
||||
difference = (here->REStemp + here->RESdtemp) - 300.15;
|
||||
factor = 1.0 + (here->REStc1)*difference +
|
||||
(here->REStc2)*difference*difference;
|
||||
|
||||
m = (here->RESm)/factor;
|
||||
|
||||
m = (here->RESm);
|
||||
*(here->RESposPosptr) += m * here->RESconduct;
|
||||
*(here->RESnegNegptr) += m * here->RESconduct;
|
||||
*(here->RESposNegptr) -= m * here->RESconduct;
|
||||
|
|
@ -59,29 +50,21 @@ RESacload(GENmodel *inModel, CKTcircuit *ckt)
|
|||
{
|
||||
RESmodel *model = (RESmodel *)inModel;
|
||||
double m;
|
||||
double difference;
|
||||
double factor;
|
||||
|
||||
NG_IGNORE(ckt);
|
||||
|
||||
/* loop through all the resistor models */
|
||||
for( ; model != NULL; model = model->RESnextModel ) {
|
||||
RESinstance *here;
|
||||
RESinstance *here;
|
||||
|
||||
/* loop through all the instances of the model */
|
||||
for (here = model->RESinstances; here != NULL ;
|
||||
here = here->RESnextInstance) {
|
||||
|
||||
if(!here->REStc1Given) here->REStc1 = 0.0;
|
||||
if(!here->REStc2Given) here->REStc2 = 0.0;
|
||||
if(!here->RESmGiven) here->RESm = 1.0;
|
||||
if(!here->RESmGiven)
|
||||
here->RESm = 1.0;
|
||||
|
||||
difference = (here->REStemp + here->RESdtemp) - 300.15;
|
||||
factor = 1.0 + (here->REStc1)*difference +
|
||||
(here->REStc2)*difference*difference;
|
||||
|
||||
m = (here->RESm)/factor;
|
||||
|
||||
m = (here->RESm);
|
||||
if(here->RESacresGiven) {
|
||||
*(here->RESposPosptr) += m * here->RESacConduct;
|
||||
*(here->RESnegNegptr) += m * here->RESacConduct;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ REStemp(GENmodel *inModel, CKTcircuit *ckt)
|
|||
RESinstance *here;
|
||||
double factor;
|
||||
double difference;
|
||||
double tc1, tc2;
|
||||
|
||||
|
||||
/* loop through all the resistor models */
|
||||
|
|
@ -74,11 +75,22 @@ REStemp(GENmodel *inModel, CKTcircuit *ckt)
|
|||
|
||||
difference = (here->REStemp + here->RESdtemp) - model->REStnom;
|
||||
|
||||
factor = 1.0 + (model->REStempCoeff1)*difference +
|
||||
(model->REStempCoeff2)*difference*difference;
|
||||
/* instance parameters tc1 and tc2 will override
|
||||
model parameters tc1 and tc2 */
|
||||
if (here->REStc1Given)
|
||||
tc1 = here->REStc1; /* instance */
|
||||
else
|
||||
tc1 = model->REStempCoeff1; /* model */
|
||||
|
||||
if (here->REStc2Given)
|
||||
tc2 = here->REStc2;
|
||||
else
|
||||
tc2 = model->REStempCoeff2;
|
||||
|
||||
factor = 1.0 + tc1*difference +
|
||||
tc2*difference*difference;
|
||||
|
||||
here -> RESconduct = (1.0/(here->RESresist * factor * here->RESscale));
|
||||
|
||||
|
||||
/* Paolo Nenzi: AC value */
|
||||
if(here->RESacresGiven)
|
||||
|
|
|
|||
Loading…
Reference in New Issue