devices/ind/*, whitespace
This commit is contained in:
parent
24aee8bf2a
commit
681903492b
|
|
@ -20,15 +20,16 @@ typedef struct sINDmodel INDmodel;
|
||||||
typedef struct sMUTinstance MUTinstance;
|
typedef struct sMUTinstance MUTinstance;
|
||||||
typedef struct sMUTmodel MUTmodel;
|
typedef struct sMUTmodel MUTmodel;
|
||||||
|
|
||||||
|
|
||||||
/* structures used to descrive inductors */
|
/* structures used to descrive inductors */
|
||||||
|
|
||||||
|
|
||||||
/* information needed for each instance */
|
/* information needed for each instance */
|
||||||
|
|
||||||
struct sINDinstance {
|
struct sINDinstance {
|
||||||
INDmodel *INDmodPtr; /* backpointer to model */
|
INDmodel *INDmodPtr; /* backpointer to model */
|
||||||
INDinstance *INDnextInstance; /* pointer to next instance of
|
INDinstance *INDnextInstance; /* pointer to next instance of
|
||||||
* current model*/
|
* current model */
|
||||||
IFuid INDname; /* pointer to character string naming this instance */
|
IFuid INDname; /* pointer to character string naming this instance */
|
||||||
int INDstate; /* pointer to beginning of state vector for inductor */
|
int INDstate; /* pointer to beginning of state vector for inductor */
|
||||||
int INDposNode; /* number of positive node of inductor */
|
int INDposNode; /* number of positive node of inductor */
|
||||||
|
|
@ -43,7 +44,7 @@ struct sINDinstance {
|
||||||
double INDdtemp; /* Delta temp. of instance */
|
double INDdtemp; /* Delta temp. of instance */
|
||||||
double INDscale; /* Scale factor */
|
double INDscale; /* Scale factor */
|
||||||
double INDnt; /* Number of turns */
|
double INDnt; /* Number of turns */
|
||||||
double INDinitCond; /* initial inductor voltage if specified */
|
double INDinitCond; /* initial inductor voltage if specified */
|
||||||
|
|
||||||
double *INDposIbrptr; /* pointer to sparse matrix diagonal at
|
double *INDposIbrptr; /* pointer to sparse matrix diagonal at
|
||||||
* (positive,branch eq) */
|
* (positive,branch eq) */
|
||||||
|
|
@ -65,27 +66,26 @@ struct sINDinstance {
|
||||||
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 */
|
||||||
unsigned INDntGiven : 1; /* flag to indicate number of turns given */
|
unsigned INDntGiven : 1; /* flag to indicate number of turns given */
|
||||||
int INDsenParmNo; /* parameter # for sensitivity use;
|
int INDsenParmNo; /* parameter # for sensitivity use;
|
||||||
set equal to 0 if not a design parameter*/
|
* set equal to 0 if not a design parameter */
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define INDflux INDstate /* flux in the inductor */
|
#define INDflux INDstate /* flux in the inductor */
|
||||||
#define INDvolt INDstate+1 /* voltage - save an entry in table */
|
#define INDvolt INDstate+1 /* voltage - save an entry in table */
|
||||||
#define INDsensxp INDstate+2 /* charge sensitivities and their derivatives.
|
#define INDsensxp INDstate+2 /* charge sensitivities and their derivatives.
|
||||||
+3 for the derivatives - pointer to the
|
* +3 for the derivatives - pointer to the
|
||||||
beginning of the array */
|
* beginning of the array */
|
||||||
|
|
||||||
|
|
||||||
/* per model data */
|
/* per model data */
|
||||||
|
|
||||||
struct sINDmodel { /* model structure for an inductor */
|
struct sINDmodel { /* model structure for an inductor */
|
||||||
int INDmodType; /* type index of this device type */
|
int INDmodType; /* type index of this device type */
|
||||||
INDmodel *INDnextModel; /* pointer to next possible model in
|
INDmodel *INDnextModel; /* pointer to next possible model in
|
||||||
* linked list */
|
* linked list */
|
||||||
INDinstance * INDinstances; /* pointer to list of instances that have this
|
INDinstance *INDinstances; /* pointer to list of instances that have this
|
||||||
* model */
|
* model */
|
||||||
IFuid INDmodName; /* pointer to character string naming this model */
|
IFuid INDmodName; /* pointer to character string naming this model */
|
||||||
|
|
||||||
/* --- end of generic struct GENmodel --- */
|
/* --- end of generic struct GENmodel --- */
|
||||||
|
|
||||||
|
|
@ -119,58 +119,55 @@ struct sINDmodel { /* model structure for an inductor */
|
||||||
/* information needed for each instance */
|
/* information needed for each instance */
|
||||||
|
|
||||||
struct sMUTinstance {
|
struct sMUTinstance {
|
||||||
MUTmodel *MUTmodPtr; /* backpointer to model */
|
MUTmodel *MUTmodPtr; /* backpointer to model */
|
||||||
MUTinstance *MUTnextInstance; /* pointer to next instance of
|
MUTinstance *MUTnextInstance; /* pointer to next instance of
|
||||||
* current model*/
|
* current model */
|
||||||
IFuid MUTname; /* pointer to character string naming this instance */
|
IFuid MUTname; /* pointer to character string naming this instance */
|
||||||
double MUTcoupling; /* mutual inductance input by user */
|
double MUTcoupling; /* mutual inductance input by user */
|
||||||
double MUTfactor; /* mutual inductance scaled for internal use */
|
double MUTfactor; /* mutual inductance scaled for internal use */
|
||||||
IFuid MUTindName1; /* name of coupled inductor 1 */
|
IFuid MUTindName1; /* name of coupled inductor 1 */
|
||||||
IFuid MUTindName2; /* name of coupled inductor 2 */
|
IFuid MUTindName2; /* name of coupled inductor 2 */
|
||||||
INDinstance *MUTind1; /* pointer to coupled inductor 1 */
|
INDinstance *MUTind1; /* pointer to coupled inductor 1 */
|
||||||
INDinstance *MUTind2; /* pointer to coupled inductor 2 */
|
INDinstance *MUTind2; /* pointer to coupled inductor 2 */
|
||||||
double *MUTbr1br2; /* pointers to off-diagonal intersections of */
|
double *MUTbr1br2; /* pointers to off-diagonal intersections of */
|
||||||
double *MUTbr2br1; /* current branch equations in matrix */
|
double *MUTbr2br1; /* current branch equations in matrix */
|
||||||
|
|
||||||
unsigned MUTindGiven : 1; /* flag to indicate inductance was specified */
|
|
||||||
int MUTsenParmNo; /* parameter # for sensitivity use;
|
|
||||||
set equal to 0 if not a design parameter*/
|
|
||||||
|
|
||||||
|
|
||||||
|
unsigned MUTindGiven : 1; /* flag to indicate inductance was specified */
|
||||||
|
int MUTsenParmNo; /* parameter # for sensitivity use;
|
||||||
|
* set equal to 0 if not a design parameter */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* per model data */
|
/* per model data */
|
||||||
|
|
||||||
struct sMUTmodel { /* model structure for a mutual inductor */
|
struct sMUTmodel { /* model structure for a mutual inductor */
|
||||||
int MUTmodType; /* type index of this device type */
|
int MUTmodType; /* type index of this device type */
|
||||||
MUTmodel *MUTnextModel; /* pointer to next possible model in
|
MUTmodel *MUTnextModel; /* pointer to next possible model in
|
||||||
* linked list */
|
* linked list */
|
||||||
MUTinstance * MUTinstances; /* pointer to list of instances that have this
|
MUTinstance *MUTinstances; /* pointer to list of instances that have this
|
||||||
* model */
|
* model */
|
||||||
IFuid MUTmodName; /* pointer to character string naming this model */
|
IFuid MUTmodName; /* pointer to character string naming this model */
|
||||||
|
|
||||||
/* --- end of generic struct GENmodel --- */
|
/* --- end of generic struct GENmodel --- */
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*MUTUAL*/
|
#endif /*MUTUAL*/
|
||||||
|
|
||||||
/* device parameters */
|
/* device parameters */
|
||||||
#define IND_IND 1
|
#define IND_IND 1
|
||||||
#define IND_IC 2
|
#define IND_IC 2
|
||||||
#define IND_FLUX 3
|
#define IND_FLUX 3
|
||||||
#define IND_VOLT 4
|
#define IND_VOLT 4
|
||||||
#define IND_IND_SENS 5
|
#define IND_IND_SENS 5
|
||||||
#define IND_CURRENT 6
|
#define IND_CURRENT 6
|
||||||
#define IND_POWER 7
|
#define IND_POWER 7
|
||||||
#define IND_M 8
|
#define IND_M 8
|
||||||
#define IND_TEMP 9
|
#define IND_TEMP 9
|
||||||
#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_TC1 13
|
||||||
#define IND_TC2 14
|
#define IND_TC2 14
|
||||||
|
|
||||||
/* model parameters */
|
/* model parameters */
|
||||||
#define IND_MOD_IND 100
|
#define IND_MOD_IND 100
|
||||||
|
|
@ -193,10 +190,10 @@ IFuid MUTmodName; /* pointer to character string naming this model */
|
||||||
|
|
||||||
#ifdef MUTUAL
|
#ifdef MUTUAL
|
||||||
/* device parameters */
|
/* device parameters */
|
||||||
#define MUT_COEFF 401
|
#define MUT_COEFF 401
|
||||||
#define MUT_IND1 402
|
#define MUT_IND1 402
|
||||||
#define MUT_IND2 403
|
#define MUT_IND2 403
|
||||||
#define MUT_COEFF_SENS 404
|
#define MUT_COEFF_SENS 404
|
||||||
|
|
||||||
/* model parameters */
|
/* model parameters */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ Copyright 1990 Regents of the University of California. All rights reserved.
|
||||||
Author: 1985 Thomas L. Quarles
|
Author: 1985 Thomas L. Quarles
|
||||||
**********/
|
**********/
|
||||||
|
|
||||||
/* load the inductor structure with those pointers needed later
|
/* load the inductor structure with those pointers needed later
|
||||||
* for fast matrix loading
|
* for fast matrix loading
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ngspice/ngspice.h"
|
#include "ngspice/ngspice.h"
|
||||||
#include "ngspice/ifsim.h"
|
#include "ngspice/ifsim.h"
|
||||||
|
|
@ -25,21 +25,23 @@ Author: 1985 Thomas L. Quarles
|
||||||
|
|
||||||
|
|
||||||
#ifdef MUTUAL
|
#ifdef MUTUAL
|
||||||
|
|
||||||
int
|
int
|
||||||
MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||||
{
|
{
|
||||||
MUTmodel *model = (MUTmodel*)inModel;
|
MUTmodel *model = (MUTmodel*) inModel;
|
||||||
MUTinstance *here;
|
MUTinstance *here;
|
||||||
|
|
||||||
NG_IGNORE(states);
|
NG_IGNORE(states);
|
||||||
|
|
||||||
for (; model; model = model->MUTnextModel)
|
for (; model; model = model->MUTnextModel)
|
||||||
for (here = model->MUTinstances; here; here = here->MUTnextInstance) {
|
for (here = model->MUTinstances; here; here = here->MUTnextInstance) {
|
||||||
|
|
||||||
int ktype = CKTtypelook("Inductor");
|
int ktype = CKTtypelook("Inductor");
|
||||||
if(ktype <= 0) {
|
|
||||||
|
if (ktype <= 0) {
|
||||||
SPfrontEnd->IFerrorf (ERR_PANIC,
|
SPfrontEnd->IFerrorf (ERR_PANIC,
|
||||||
"mutual inductor, but inductors not available!");
|
"mutual inductor, but inductors not available!");
|
||||||
return(E_INTERN);
|
return(E_INTERN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,20 +49,22 @@ MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||||
here->MUTind1 = (INDinstance *) CKTfndDev(ckt, here->MUTindName1);
|
here->MUTind1 = (INDinstance *) CKTfndDev(ckt, here->MUTindName1);
|
||||||
if (!here->MUTind1) {
|
if (!here->MUTind1) {
|
||||||
SPfrontEnd->IFerrorf (ERR_WARNING,
|
SPfrontEnd->IFerrorf (ERR_WARNING,
|
||||||
"%s: coupling to non-existant inductor %s.",
|
"%s: coupling to non-existant inductor %s.",
|
||||||
here->MUTname, here->MUTindName1);
|
here->MUTname, here->MUTindName1);
|
||||||
}
|
}
|
||||||
if (!here->MUTind2)
|
if (!here->MUTind2)
|
||||||
here->MUTind2 = (INDinstance *) CKTfndDev(ckt, here->MUTindName2);
|
here->MUTind2 = (INDinstance *) CKTfndDev(ckt, here->MUTindName2);
|
||||||
if (!here->MUTind2) {
|
if (!here->MUTind2) {
|
||||||
SPfrontEnd->IFerrorf (ERR_WARNING,
|
SPfrontEnd->IFerrorf (ERR_WARNING,
|
||||||
"%s: coupling to non-existant inductor %s.",
|
"%s: coupling to non-existant inductor %s.",
|
||||||
here->MUTname, here->MUTindName2);
|
here->MUTname, here->MUTindName2);
|
||||||
}
|
}
|
||||||
|
|
||||||
TSTALLOC(MUTbr1br2,MUTind1->INDbrEq,MUTind2->INDbrEq);
|
TSTALLOC(MUTbr1br2, MUTind1->INDbrEq, MUTind2->INDbrEq);
|
||||||
TSTALLOC(MUTbr2br1,MUTind2->INDbrEq,MUTind1->INDbrEq);
|
TSTALLOC(MUTbr2br1, MUTind2->INDbrEq, MUTind1->INDbrEq);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
#endif /* MUTUAL */
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,6 @@
|
||||||
Copyright 2003 Paolo Nenzi
|
Copyright 2003 Paolo Nenzi
|
||||||
Author: 2003 Paolo Nenzi
|
Author: 2003 Paolo Nenzi
|
||||||
**********/
|
**********/
|
||||||
/*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "ngspice/ngspice.h"
|
#include "ngspice/ngspice.h"
|
||||||
#include "ngspice/cktdefs.h"
|
#include "ngspice/cktdefs.h"
|
||||||
|
|
@ -13,11 +10,10 @@ Author: 2003 Paolo Nenzi
|
||||||
#include "ngspice/suffix.h"
|
#include "ngspice/suffix.h"
|
||||||
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
int
|
int
|
||||||
MUTtemp(GENmodel *inModel, CKTcircuit *ckt)
|
MUTtemp(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
MUTmodel *model = (MUTmodel*)inModel;
|
MUTmodel *model = (MUTmodel*) inModel;
|
||||||
MUTinstance *here;
|
MUTinstance *here;
|
||||||
|
|
||||||
NG_IGNORE(ckt);
|
NG_IGNORE(ckt);
|
||||||
|
|
@ -26,15 +22,15 @@ MUTtemp(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
for (here = model->MUTinstances; here; here = here->MUTnextInstance) {
|
for (here = model->MUTinstances; here; here = here->MUTnextInstance) {
|
||||||
|
|
||||||
/* Value Processing for mutual inductors */
|
/* Value Processing for mutual inductors */
|
||||||
|
|
||||||
double ind1 = here->MUTind1->INDinduct;
|
double ind1 = here->MUTind1->INDinduct;
|
||||||
double ind2 = here->MUTind2->INDinduct;
|
double ind2 = here->MUTind2->INDinduct;
|
||||||
|
|
||||||
/* _______
|
/* _______
|
||||||
* M = k * \/l1 * l2
|
* M = k * \/L1 * L2
|
||||||
*/
|
*/
|
||||||
here->MUTfactor = here->MUTcoupling * sqrt(ind1 * ind2);
|
here->MUTfactor = here->MUTcoupling * sqrt(ind1 * ind2);
|
||||||
|
}
|
||||||
}
|
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue