Browse Source

Cleaned and fixed inductor code.

pre-master-46
pnenzi 23 years ago
parent
commit
858a227a57
  1. 1
      src/spicelib/devices/ind/ind.c
  2. 2
      src/spicelib/devices/ind/indask.c
  3. 9
      src/spicelib/devices/ind/inddefs.h
  4. 12
      src/spicelib/devices/ind/indsetup.c
  5. 4
      src/spicelib/devices/ind/indtemp.c

1
src/spicelib/devices/ind/ind.c

@ -45,7 +45,6 @@ IFparm INDmPTable[] = { /* model parameters */
IOPA( "length", IND_MOD_LENGTH, IF_REAL,"Inductor length"),
IOPA( "nt", IND_MOD_NT, IF_REAL,"Model number of turns"),
IOPA( "mu", IND_MOD_MU, IF_REAL,"Relative magnetic permeability"),
OPU( "sind", IND_MOD_SIND, IF_REAL,"Specific model inductance"),
IP( "l", IND_MOD_L, IF_FLAG,"Inductor model")
};

2
src/spicelib/devices/ind/indask.c

@ -58,7 +58,6 @@ INDask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value,
return(E_ASKCURRENT);
} else {
value->rValue = *(ckt->CKTrhsOld + here->INDbrEq);
value->rValue *= here->INDm;
}
return(OK);
case IND_POWER :
@ -70,7 +69,6 @@ INDask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value,
} else {
value->rValue = *(ckt->CKTrhsOld + here->INDbrEq) *
*(ckt->CKTstate0+here->INDvolt);
value->rValue *= here->INDm;
}
return(OK);
case IND_QUEST_SENS_DC:

9
src/spicelib/devices/ind/inddefs.h

@ -87,7 +87,7 @@ typedef struct sINDmodel { /* model structure for an inductor */
double INDlength; /* Mean length of magnetic path */
double INDmodNt; /* Model number of turns */
double INDmu; /* Relative magnetic permeability */
double INDspecInd; /* Specific (one turn) inductance */
unsigned INDtnomGiven : 1; /* flag to indicate nominal temp was given */
unsigned INDtc1Given : 1; /* flag to indicate tc1 was specified */
unsigned INDtc2Given : 1; /* flag to indicate tc2 was specified */
@ -95,7 +95,9 @@ typedef struct sINDmodel { /* model structure for an inductor */
unsigned INDlengthGiven: 1; /* flag to indicate length given */
unsigned INDmodNtGiven : 1; /* flag to indicate mod. n. of turns given */
unsigned INDmuGiven : 1; /* flag to indicate mu_r given */
unsigned INDmIndGiven : 1; /* flag to indicate model inductance given */
unsigned INDmIndGiven : 1; /* flag to indicate model inductance given */
double INDspecInd; /* Specific (one turn) inductance */
} INDmodel;
@ -165,8 +167,7 @@ typedef struct sMUTmodel { /* model structure for a mutual inductor */
#define IND_MOD_LENGTH 105
#define IND_MOD_NT 106
#define IND_MOD_MU 107
#define IND_MOD_SIND 108
#define IND_MOD_L 109
#define IND_MOD_L 108
/* device questions */
#define IND_QUEST_SENS_REAL 201

12
src/spicelib/devices/ind/indsetup.c

@ -12,9 +12,9 @@ Author: 1985 Thomas L. Quarles
int
INDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
/* load the inductor structure with those pointers needed later
* for fast matrix loading
*/
/* load the inductor structure with those pointers needed later
* for fast matrix loading
*/
{
INDmodel *model = (INDmodel*)inModel;
INDinstance *here;
@ -56,10 +56,10 @@ INDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
if (model->INDmuGiven)
model->INDspecInd = (model->INDmu * CONSTmuZero
* model->INDcsect) / model->INDlength;
* model->INDcsect * model->INDcsect) / model->INDlength;
else
model->INDspecInd = (CONSTmuZero * model->INDcsect)
/ model->INDlength;
model->INDspecInd = (CONSTmuZero * model->INDcsect
* model->INDcsect ) / model->INDlength;
} else {
model->INDspecInd = 0.0;

4
src/spicelib/devices/ind/indtemp.c

@ -51,7 +51,7 @@ INDtemp(GENmodel *inModel, CKTcircuit *ckt)
here->INDinduct = model->INDspecInd * here->INDnt * here->INDnt;
else
here->INDinduct = model->INDmInd;
}
}
difference = (here->INDtemp + here->INDdtemp) - model->INDtnom;
factor = 1.0 + (model->INDtempCoeff1)*difference +
@ -59,7 +59,7 @@ INDtemp(GENmodel *inModel, CKTcircuit *ckt)
here->INDinduct = here->INDinduct * factor * here->INDscale;
here->INDinduct = here->INDinduct / here->INDm;
}
}
return(OK);

Loading…
Cancel
Save