ind...c: inductor with tc1, tc2 instance parameter

This commit is contained in:
h_vogt 2013-05-09 00:20:54 +02:00
parent ba7f6c4a7a
commit 31a3df3f47
4 changed files with 31 additions and 3 deletions

View File

@ -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"),

View File

@ -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

View File

@ -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;

View File

@ -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;