diff --git a/src/spicelib/devices/ind/ind.c b/src/spicelib/devices/ind/ind.c index 9b83bf868..e729d5438 100644 --- a/src/spicelib/devices/ind/ind.c +++ b/src/spicelib/devices/ind/ind.c @@ -18,6 +18,8 @@ IFparm INDpTable[] = { /* parameters */ IOPZ( "dtemp", IND_DTEMP, IF_REAL, "Instance temperature difference with the rest of the circuit"), IOPU( "m", IND_M, IF_REAL, "Multiplication Factor"), + IOPU( "tc1", IND_TC1, IF_REAL, "First order temp. coefficient"), + IOPU( "tc2", IND_TC2, IF_REAL, "Second order temp. coefficient"), IOPU( "scale", IND_SCALE, IF_REAL, "Scale factor"), IOP( "nt", IND_NT, IF_REAL, "Number of turns"), OP( "flux", IND_FLUX, IF_REAL, "Flux through inductor"), diff --git a/src/spicelib/devices/ind/inddefs.h b/src/spicelib/devices/ind/inddefs.h index 86c65a497..20d52fc90 100644 --- a/src/spicelib/devices/ind/inddefs.h +++ b/src/spicelib/devices/ind/inddefs.h @@ -32,6 +32,8 @@ typedef struct sINDinstance { int INDbrEq; /* number of the branch equation added for current */ double INDinduct; /* inductance */ double INDm; /* Parallel multiplier */ + double INDtc1; /* first temperature coefficient of resistors */ + double INDtc2; /* second temperature coefficient of resistors */ double INDtemp; /* Instance operating temperature */ double INDdtemp; /* Delta temp. of instance */ double INDscale; /* Scale factor */ @@ -52,6 +54,8 @@ typedef struct sINDinstance { unsigned INDindGiven : 1; /* flag to indicate inductance was specified */ unsigned INDicGiven : 1; /* flag to indicate init. cond. was specified */ unsigned INDmGiven : 1; /* flag to indicate multiplier given */ + unsigned INDtc1Given : 1; /* indicates tc1 parameter specified */ + unsigned INDtc2Given : 1; /* indicates tc2 parameter specified */ unsigned INDtempGiven : 1; /* flag to indicate operating temp. given */ unsigned INDdtempGiven : 1; /* flag to indicate delta temp. given */ unsigned INDscaleGiven : 1; /* flag to indicate scale factor given */ @@ -155,6 +159,8 @@ typedef struct sMUTmodel { /* model structure for a mutual inductor */ #define IND_DTEMP 10 #define IND_SCALE 11 #define IND_NT 12 +#define IND_TC1 13 +#define IND_TC2 14 /* model parameters */ #define IND_MOD_IND 100 diff --git a/src/spicelib/devices/ind/indparam.c b/src/spicelib/devices/ind/indparam.c index 6b7a0fbac..91f35bad3 100644 --- a/src/spicelib/devices/ind/indparam.c +++ b/src/spicelib/devices/ind/indparam.c @@ -39,6 +39,14 @@ INDparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select) here->INDm = value->rValue; here->INDmGiven = TRUE; break; + case IND_TC1: + here->INDtc1 = value->rValue; + here->INDtc1Given = TRUE; + break; + case IND_TC2: + here->INDtc2 = value->rValue; + here->INDtc2Given = TRUE; + break; case IND_SCALE: here->INDscale = value->rValue; here->INDscaleGiven = TRUE; diff --git a/src/spicelib/devices/ind/indtemp.c b/src/spicelib/devices/ind/indtemp.c index 5201d5df5..0dcc4e1e2 100644 --- a/src/spicelib/devices/ind/indtemp.c +++ b/src/spicelib/devices/ind/indtemp.c @@ -21,6 +21,7 @@ INDtemp(GENmodel *inModel, CKTcircuit *ckt) INDinstance *here; double difference; double factor; + double tc1, tc2; /* loop through all the inductor models */ for( ; model != NULL; model = model->INDnextModel ) { @@ -52,9 +53,20 @@ INDtemp(GENmodel *inModel, CKTcircuit *ckt) here->INDinduct = model->INDmInd; } difference = (here->INDtemp + here->INDdtemp) - model->INDtnom; - - factor = 1.0 + (model->INDtempCoeff1)*difference + - (model->INDtempCoeff2)*difference*difference; + + /* instance parameters tc1 and tc2 will override + model parameters tc1 and tc2 */ + if (here->INDtc1Given) + tc1 = here->INDtc1; /* instance */ + else + tc1 = model->INDtempCoeff1; /* model */ + + if (here->INDtc2Given) + tc2 = here->INDtc2; + else + tc2 = model->INDtempCoeff2; + + factor = 1.0 + tc1*difference + tc2*difference*difference; here->INDinduct = here->INDinduct * factor * here->INDscale; here->INDinduct = here->INDinduct / here->INDm;