mirror of
https://git.code.sf.net/p/ngspice/ngspice
synced 2026-08-22 05:47:42 +02:00
Add coil diameter dia to the inductor parameters.
dia (diameter) takes preference over csect (cross section)
This commit is contained in:
@@ -44,6 +44,7 @@ IFparm INDmPTable[] = { /* model parameters */
|
|||||||
IOPA( "tc2", IND_MOD_TC2, IF_REAL,"Second order temp. coefficient"),
|
IOPA( "tc2", IND_MOD_TC2, IF_REAL,"Second order temp. coefficient"),
|
||||||
IOPXU( "tnom", IND_MOD_TNOM, IF_REAL,"Parameter measurement temperature"),
|
IOPXU( "tnom", IND_MOD_TNOM, IF_REAL,"Parameter measurement temperature"),
|
||||||
IOPA( "csect", IND_MOD_CSECT, IF_REAL,"Inductor cross section"),
|
IOPA( "csect", IND_MOD_CSECT, IF_REAL,"Inductor cross section"),
|
||||||
|
IOPA( "dia", IND_MOD_DIA, IF_REAL,"Inductor diameter"),
|
||||||
IOPA( "length", IND_MOD_LENGTH, IF_REAL,"Inductor length"),
|
IOPA( "length", IND_MOD_LENGTH, IF_REAL,"Inductor length"),
|
||||||
IOPA( "nt", IND_MOD_NT, IF_REAL,"Model number of turns"),
|
IOPA( "nt", IND_MOD_NT, IF_REAL,"Model number of turns"),
|
||||||
IOPA( "mu", IND_MOD_MU, IF_REAL,"Relative magnetic permeability"),
|
IOPA( "mu", IND_MOD_MU, IF_REAL,"Relative magnetic permeability"),
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ struct sINDmodel { /* model structure for an inductor */
|
|||||||
double INDtempCoeff1; /* first temperature coefficient */
|
double INDtempCoeff1; /* first temperature coefficient */
|
||||||
double INDtempCoeff2; /* second temperature coefficient */
|
double INDtempCoeff2; /* second temperature coefficient */
|
||||||
double INDcsect; /* Cross section of inductor */
|
double INDcsect; /* Cross section of inductor */
|
||||||
|
double INDdia; /* Diameter of (cylindrical) inductor */
|
||||||
double INDlength; /* Mean length of magnetic path */
|
double INDlength; /* Mean length of magnetic path */
|
||||||
double INDmodNt; /* Model number of turns */
|
double INDmodNt; /* Model number of turns */
|
||||||
double INDmu; /* Relative magnetic permeability */
|
double INDmu; /* Relative magnetic permeability */
|
||||||
@@ -109,6 +110,7 @@ struct sINDmodel { /* model structure for an inductor */
|
|||||||
unsigned INDtc1Given : 1; /* flag to indicate tc1 was specified */
|
unsigned INDtc1Given : 1; /* flag to indicate tc1 was specified */
|
||||||
unsigned INDtc2Given : 1; /* flag to indicate tc2 was specified */
|
unsigned INDtc2Given : 1; /* flag to indicate tc2 was specified */
|
||||||
unsigned INDcsectGiven : 1; /* flag to indicate cross section given */
|
unsigned INDcsectGiven : 1; /* flag to indicate cross section given */
|
||||||
|
unsigned INDdiaGiven : 1; /* flag to indicate diameter given */
|
||||||
unsigned INDlengthGiven: 1; /* flag to indicate length given */
|
unsigned INDlengthGiven: 1; /* flag to indicate length given */
|
||||||
unsigned INDmodNtGiven : 1; /* flag to indicate mod. n. of turns given */
|
unsigned INDmodNtGiven : 1; /* flag to indicate mod. n. of turns given */
|
||||||
unsigned INDmuGiven : 1; /* flag to indicate mu_r given */
|
unsigned INDmuGiven : 1; /* flag to indicate mu_r given */
|
||||||
@@ -196,6 +198,7 @@ enum {
|
|||||||
IND_MOD_TC2,
|
IND_MOD_TC2,
|
||||||
IND_MOD_TNOM,
|
IND_MOD_TNOM,
|
||||||
IND_MOD_CSECT,
|
IND_MOD_CSECT,
|
||||||
|
IND_MOD_DIA,
|
||||||
IND_MOD_LENGTH,
|
IND_MOD_LENGTH,
|
||||||
IND_MOD_NT,
|
IND_MOD_NT,
|
||||||
IND_MOD_MU,
|
IND_MOD_MU,
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ INDmParam(int param, IFvalue *value, GENmodel *inModel)
|
|||||||
mod->INDcsect = value->rValue;
|
mod->INDcsect = value->rValue;
|
||||||
mod->INDcsectGiven = TRUE;
|
mod->INDcsectGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
|
case IND_MOD_DIA:
|
||||||
|
mod->INDdia = value->rValue;
|
||||||
|
mod->INDdiaGiven = TRUE;
|
||||||
|
break;
|
||||||
case IND_MOD_LENGTH :
|
case IND_MOD_LENGTH :
|
||||||
mod->INDlength = value->rValue;
|
mod->INDlength = value->rValue;
|
||||||
mod->INDlengthGiven = TRUE;
|
mod->INDlengthGiven = TRUE;
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ INDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
|||||||
if (!model->INDmIndGiven) {
|
if (!model->INDmIndGiven) {
|
||||||
model->INDmInd = 0.0;
|
model->INDmInd = 0.0;
|
||||||
}
|
}
|
||||||
if (!model->INDtnomGiven) {
|
if (!model->INDtnomGiven) {
|
||||||
model->INDtnom = ckt->CKTnomTemp;
|
model->INDtnom = ckt->CKTnomTemp;
|
||||||
}
|
}
|
||||||
if (!model->INDtc1Given) {
|
if (!model->INDtc1Given) {
|
||||||
model->INDtempCoeff1 = 0.0;
|
model->INDtempCoeff1 = 0.0;
|
||||||
}
|
}
|
||||||
if (!model->INDtc2Given) {
|
if (!model->INDtc2Given) {
|
||||||
@@ -44,6 +44,9 @@ INDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
|||||||
if (!model->INDcsectGiven){
|
if (!model->INDcsectGiven){
|
||||||
model->INDcsect = 0.0;
|
model->INDcsect = 0.0;
|
||||||
}
|
}
|
||||||
|
if (!model->INDdiaGiven){
|
||||||
|
model->INDdia = 0.0;
|
||||||
|
}
|
||||||
if (!model->INDlengthGiven) {
|
if (!model->INDlengthGiven) {
|
||||||
model->INDlength = 0.0;
|
model->INDlength = 0.0;
|
||||||
}
|
}
|
||||||
@@ -54,30 +57,32 @@ INDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
|||||||
model->INDmu = 1.0;
|
model->INDmu = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* precompute specific inductance (one turn) */
|
/* diameter takes preference over cross section */
|
||||||
if((model->INDlengthGiven) && (model->INDlength > 0.0)) {
|
if (model->INDdiaGiven) {
|
||||||
model->INDspecInd = (model->INDmu * CONSTmuZero
|
model->INDcsect = PI * model->INDdia * model->INDdia / 4.;
|
||||||
* model->INDcsect) / model->INDlength;
|
}
|
||||||
} else {
|
|
||||||
model->INDspecInd = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Lundin's geometry correction factor */
|
/* precompute specific inductance (one turn) */
|
||||||
model->INDspecInd *= Lundin(model->INDlength, model->INDcsect);
|
if((model->INDlengthGiven) && (model->INDlength > 0.0)) {
|
||||||
|
model->INDspecInd = (model->INDmu * CONSTmuZero
|
||||||
|
* model->INDcsect) / model->INDlength;
|
||||||
|
} else {
|
||||||
|
model->INDspecInd = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lundin's geometry correction factor */
|
||||||
|
model->INDspecInd *= Lundin(model->INDlength, model->INDcsect);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
double kl = Lundin(model->INDlength, model->INDcsect);
|
double kl = Lundin(model->INDlength, model->INDcsect);
|
||||||
double Dl = model->INDlength / sqrt(model->INDcsect / PI) / 2.;
|
double Dl = model->INDlength / sqrt(model->INDcsect / PI) / 2.;
|
||||||
fprintf(stdout, "Lundin's correction factor %f at l/D %f\n", kl, Dl);
|
fprintf(stdout, "Lundin's correction factor %f at l/D %f\n", kl, Dl);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* How many turns ? */
|
/* How many turns ? */
|
||||||
if (!model->INDmIndGiven)
|
if (!model->INDmIndGiven)
|
||||||
model->INDmInd = model->INDmodNt * model->INDmodNt * model->INDspecInd;
|
model->INDmInd = model->INDmodNt * model->INDmodNt * model->INDspecInd;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* loop through all the instances of the model */
|
/* loop through all the instances of the model */
|
||||||
for (here = INDinstances(model); here != NULL ;
|
for (here = INDinstances(model); here != NULL ;
|
||||||
here=INDnextInstance(here)) {
|
here=INDnextInstance(here)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user