resload.c, restemp.c: tc1, tc2 instance parameters override model parameters
This commit is contained in:
parent
08beef9152
commit
4b8f031971
|
|
@ -17,9 +17,6 @@ RESload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
RESmodel *model = (RESmodel *)inModel;
|
RESmodel *model = (RESmodel *)inModel;
|
||||||
double m;
|
double m;
|
||||||
double difference;
|
|
||||||
double factor;
|
|
||||||
|
|
||||||
|
|
||||||
/* loop through all the resistor models */
|
/* loop through all the resistor models */
|
||||||
for( ; model != NULL; model = model->RESnextModel ) {
|
for( ; model != NULL; model = model->RESnextModel ) {
|
||||||
|
|
@ -29,18 +26,12 @@ RESload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
for (here = model->RESinstances; here != NULL ;
|
for (here = model->RESinstances; here != NULL ;
|
||||||
here = here->RESnextInstance) {
|
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) -
|
here->REScurrent = (*(ckt->CKTrhsOld+here->RESposNode) -
|
||||||
*(ckt->CKTrhsOld+here->RESnegNode)) * here->RESconduct;
|
*(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->RESposPosptr) += m * here->RESconduct;
|
||||||
*(here->RESnegNegptr) += m * here->RESconduct;
|
*(here->RESnegNegptr) += m * here->RESconduct;
|
||||||
|
|
@ -59,8 +50,6 @@ RESacload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
RESmodel *model = (RESmodel *)inModel;
|
RESmodel *model = (RESmodel *)inModel;
|
||||||
double m;
|
double m;
|
||||||
double difference;
|
|
||||||
double factor;
|
|
||||||
|
|
||||||
NG_IGNORE(ckt);
|
NG_IGNORE(ckt);
|
||||||
|
|
||||||
|
|
@ -72,15 +61,9 @@ RESacload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
for (here = model->RESinstances; here != NULL ;
|
for (here = model->RESinstances; here != NULL ;
|
||||||
here = here->RESnextInstance) {
|
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;
|
m = (here->RESm);
|
||||||
factor = 1.0 + (here->REStc1)*difference +
|
|
||||||
(here->REStc2)*difference*difference;
|
|
||||||
|
|
||||||
m = (here->RESm)/factor;
|
|
||||||
|
|
||||||
if(here->RESacresGiven) {
|
if(here->RESacresGiven) {
|
||||||
*(here->RESposPosptr) += m * here->RESacConduct;
|
*(here->RESposPosptr) += m * here->RESacConduct;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ REStemp(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
RESinstance *here;
|
RESinstance *here;
|
||||||
double factor;
|
double factor;
|
||||||
double difference;
|
double difference;
|
||||||
|
double tc1, tc2;
|
||||||
|
|
||||||
|
|
||||||
/* loop through all the resistor models */
|
/* loop through all the resistor models */
|
||||||
|
|
@ -74,8 +75,20 @@ REStemp(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
|
|
||||||
difference = (here->REStemp + here->RESdtemp) - model->REStnom;
|
difference = (here->REStemp + here->RESdtemp) - model->REStnom;
|
||||||
|
|
||||||
factor = 1.0 + (model->REStempCoeff1)*difference +
|
/* instance parameters tc1 and tc2 will override
|
||||||
(model->REStempCoeff2)*difference*difference;
|
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));
|
here -> RESconduct = (1.0/(here->RESresist * factor * here->RESscale));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue