devices/ind: implement `tc1', `tc2' instance parameters
This commit is contained in:
parent
b50f9b97bb
commit
4a1cdf0ada
|
|
@ -18,6 +18,8 @@ IFparm INDpTable[] = { /* parameters */
|
||||||
IOPZ( "dtemp", IND_DTEMP, IF_REAL,
|
IOPZ( "dtemp", IND_DTEMP, IF_REAL,
|
||||||
"Instance temperature difference with the rest of the circuit"),
|
"Instance temperature difference with the rest of the circuit"),
|
||||||
IOPU( "m", IND_M, IF_REAL, "Multiplication Factor"),
|
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"),
|
IOPU( "scale", IND_SCALE, IF_REAL, "Scale factor"),
|
||||||
IOP( "nt", IND_NT, IF_REAL, "Number of turns"),
|
IOP( "nt", IND_NT, IF_REAL, "Number of turns"),
|
||||||
OP( "flux", IND_FLUX, IF_REAL, "Flux through inductor"),
|
OP( "flux", IND_FLUX, IF_REAL, "Flux through inductor"),
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ typedef struct sINDinstance {
|
||||||
int INDbrEq; /* number of the branch equation added for current */
|
int INDbrEq; /* number of the branch equation added for current */
|
||||||
double INDinduct; /* inductance */
|
double INDinduct; /* inductance */
|
||||||
double INDm; /* Parallel multiplier */
|
double INDm; /* Parallel multiplier */
|
||||||
|
double INDtc1; /* first temperature coefficient of resistors */
|
||||||
|
double INDtc2; /* second temperature coefficient of resistors */
|
||||||
double INDtemp; /* Instance operating temperature */
|
double INDtemp; /* Instance operating temperature */
|
||||||
double INDdtemp; /* Delta temp. of instance */
|
double INDdtemp; /* Delta temp. of instance */
|
||||||
double INDscale; /* Scale factor */
|
double INDscale; /* Scale factor */
|
||||||
|
|
@ -52,6 +54,8 @@ typedef struct sINDinstance {
|
||||||
unsigned INDindGiven : 1; /* flag to indicate inductance was specified */
|
unsigned INDindGiven : 1; /* flag to indicate inductance was specified */
|
||||||
unsigned INDicGiven : 1; /* flag to indicate init. cond. was specified */
|
unsigned INDicGiven : 1; /* flag to indicate init. cond. was specified */
|
||||||
unsigned INDmGiven : 1; /* flag to indicate multiplier given */
|
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 INDtempGiven : 1; /* flag to indicate operating temp. given */
|
||||||
unsigned INDdtempGiven : 1; /* flag to indicate delta temp. given */
|
unsigned INDdtempGiven : 1; /* flag to indicate delta temp. given */
|
||||||
unsigned INDscaleGiven : 1; /* flag to indicate scale factor 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_DTEMP 10
|
||||||
#define IND_SCALE 11
|
#define IND_SCALE 11
|
||||||
#define IND_NT 12
|
#define IND_NT 12
|
||||||
|
#define IND_TC1 13
|
||||||
|
#define IND_TC2 14
|
||||||
|
|
||||||
/* model parameters */
|
/* model parameters */
|
||||||
#define IND_MOD_IND 100
|
#define IND_MOD_IND 100
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,14 @@ INDparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
||||||
here->INDm = value->rValue;
|
here->INDm = value->rValue;
|
||||||
here->INDmGiven = TRUE;
|
here->INDmGiven = TRUE;
|
||||||
break;
|
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:
|
case IND_SCALE:
|
||||||
here->INDscale = value->rValue;
|
here->INDscale = value->rValue;
|
||||||
here->INDscaleGiven = TRUE;
|
here->INDscaleGiven = TRUE;
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ INDtemp(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
INDinstance *here;
|
INDinstance *here;
|
||||||
double difference;
|
double difference;
|
||||||
double factor;
|
double factor;
|
||||||
|
double tc1, tc2;
|
||||||
|
|
||||||
/* loop through all the inductor models */
|
/* loop through all the inductor models */
|
||||||
for( ; model != NULL; model = model->INDnextModel ) {
|
for( ; model != NULL; model = model->INDnextModel ) {
|
||||||
|
|
@ -52,9 +53,20 @@ INDtemp(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
here->INDinduct = model->INDmInd;
|
here->INDinduct = model->INDmInd;
|
||||||
}
|
}
|
||||||
difference = (here->INDtemp + here->INDdtemp) - model->INDtnom;
|
difference = (here->INDtemp + here->INDdtemp) - model->INDtnom;
|
||||||
|
|
||||||
factor = 1.0 + (model->INDtempCoeff1)*difference +
|
/* instance parameters tc1 and tc2 will override
|
||||||
(model->INDtempCoeff2)*difference*difference;
|
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 * factor * here->INDscale;
|
||||||
here->INDinduct = here->INDinduct / here->INDm;
|
here->INDinduct = here->INDinduct / here->INDm;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue