Jspice3
inddefs.h
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3f2 - Copyright (c) Stephen R. Whiteley 1992
3 Copyright 1990 Regents of the University of California. All rights reserved.
4 Authors: 1985 Thomas L. Quarles
5  1992 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #ifndef IND
9 #define IND
10 
11 
12 /* turn on mutual inductor code */
13 #define MUTUAL
14 
15 #include "devdefs.h"
16 
17 
18 /* information needed for each instance */
19 
20 /* structures used to describe inductors */
21 typedef struct sINDinstance {
22 
23  /* backpointer to model */
25 
26  /* pointer to next instance of current model*/
28 
29  /* pointer to character string naming this instance */
31 
32  /* pointer to beginning of state vector for inductor */
33  int INDstate;
34 
35  /* number of positive node of inductor */
37 
38  /* number of negative node of inductor */
40 
41  /* number of the branch equation added for current */
42  int INDbrEq;
43 
44  /* flux in the inductor */
45 #define INDflux INDstate
46 
47  /* voltage - save an entry in table */
48 #define INDvolt INDstate+1
49 
50  /* inductance */
51  double INDinduct;
52 
53  /* initial inductor voltage if specified */
54  double INDinitCond;
55 
56  /* storage for veq */
57  double INDveq;
58 
59  /* storage for req */
60  double INDreq;
61 
62  /* previous total flux */
63  double INDprevFlux;
64 
65  /* pointer to sparse matrix diagonal at (positive,branch eq) */
66  double *INDposIbrptr;
67 
68  /* pointer to sparse matrix diagonal at (negative,branch eq) */
69  double *INDnegIbrptr;
70 
71  /* pointer to sparse matrix offdiagonal at (branch eq,negative) */
72  double *INDibrNegptr;
73 
74  /* pointer to sparse matrix offdiagonal at (branch eq,positive) */
75  double *INDibrPosptr;
76 
77  /* pointer to sparse matrix offdiagonal at (branch eq,branch eq) */
78  double *INDibrIbrptr;
79 
80  /* flags to indicate: */
81  unsigned INDindGiven : 1; /* inductance was specified */
82  unsigned INDicGiven : 1; /* init. cond. was specified */
83 
84 } INDinstance ;
85 
86 
87 /* per model data */
88 
89 /* model structure for an inductor */
90 typedef struct sINDmodel {
91 
92  /* type index of this device type */
94 
95  /* pointer to next possible model in linked list */
97 
98  /* pointer to list of instances that have this model */
100 
101  /* pointer to character string naming this model */
103 
104 #ifdef MUTUAL
105  /* pointer to mutual inductor models */
107 #endif
108 
109 } INDmodel;
110 
111 /* device parameters */
112 #define IND_IND 1
113 #define IND_IC 2
114 #define IND_FLUX 3
115 #define IND_VOLT 4
116 #define IND_CURRENT 5
117 #define IND_POWER 6
118 
119 #ifdef __STDC__
120 
121 extern int INDacLoad(GENmodel*,CKTcircuit*);
122 extern int INDask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*);
123 extern int INDfindBr(CKTcircuit*,GENmodel*,IFuid);
124 extern int INDgetic(GENmodel*,CKTcircuit*);
125 extern int INDload(GENmodel*,CKTcircuit*);
126 extern int INDparam(CKTcircuit*,int,IFvalue*,GENinstance*,IFvalue*);
127 extern void INDparse(int,GENERIC*,GENERIC*,GENERIC*);
128 extern int INDpzLoad(GENmodel*,CKTcircuit*,SPcomplex*);
129 extern int INDsetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*);
130 extern int INDtrunc(GENmodel*,CKTcircuit*,double*);
131 
132 #else /* stdc */
133 
134 extern int INDacLoad();
135 extern int INDask();
136 extern int INDfindBr();
137 extern int INDgetic();
138 extern int INDload();
139 extern int INDparam();
140 extern void INDparse();
141 extern int INDpzLoad();
142 extern int INDsetup();
143 extern int INDtrunc();
144 
145 #endif /* stdc */
146 
147 
148 #ifdef MUTUAL
149 
150 /* information needed for each instance */
151 
152 /* structures used to describe mutual inductors */
153 typedef struct sMUTinstance {
154 
155  /* backpointer to model */
157 
158  /* pointer to next instance of current model*/
160 
161  /* pointer to character string naming this instance */
163 
164  /* mutual inductance input by user */
165  double MUTcoupling;
166 
167  /* mutual inductance scaled for internal use */
168  double MUTfactor;
169 
170  /* name of coupled inductor 1 */
172 
173  /* name of coupled inductor 2 */
175 
176  /* pointer to coupled inductor 1 */
178 
179  /* pointer to coupled inductor 2 */
181 
182  double *MUTbr1br2; /* pointers to off-diagonal intersections of */
183  double *MUTbr2br1; /* current branch equations in matrix */
184 
185  /* flag to indicate inductance was specified */
186  unsigned MUTindGiven : 1;
187 
188 } MUTinstance ;
189 
190 
191 /* per model data */
192 
193 /* model structure for a mutual inductor */
194 typedef struct sMUTmodel {
195 
196  /* type index of this device type */
198 
199  /* pointer to next possible model in linked list */
201 
202  /* pointer to list of instances that have this model */
204 
205  /* pointer to character string naming this model */
207 
208 } MUTmodel;
209 
210 /* device parameters */
211 #define MUT_COEFF 401
212 #define MUT_IND1 402
213 #define MUT_IND2 403
214 
215 #ifdef __STDC__
216 
217 extern int MUTask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*);
218 extern int MUTparam(CKTcircuit*,int,IFvalue*,GENinstance*,IFvalue*);
219 extern void MUTparse(int,GENERIC*,GENERIC*,GENERIC*);
220 
221 #else /* stdc */
222 
223 extern int MUTask();
224 extern int MUTparam();
225 extern void MUTparse();
226 
227 #endif /* stdc */
228 
229 #endif /*MUTUAL*/
230 #endif /*IND*/
struct sINDmodel * INDnextModel
Definition: inddefs.h:96
struct sMUTmodel * MUTmodPtr
Definition: inddefs.h:156
struct sINDinstance * INDnextInstance
Definition: inddefs.h:27
int INDposNode
Definition: inddefs.h:36
double * INDibrNegptr
Definition: inddefs.h:72
struct sMUTmodel MUTmodel
struct sMUTinstance MUTinstance
int INDask()
int INDfindBr()
double * INDibrPosptr
Definition: inddefs.h:75
int INDacLoad()
IFuid MUTindName1
Definition: inddefs.h:171
void MUTparse()
GENmodel * INDmutModels
Definition: inddefs.h:106
double * INDnegIbrptr
Definition: inddefs.h:69
void INDparse()
int INDstate
Definition: inddefs.h:33
unsigned INDindGiven
Definition: inddefs.h:81
struct sINDmodel * INDmodPtr
Definition: inddefs.h:24
struct sMUTmodel * MUTnextModel
Definition: inddefs.h:200
struct sMUTinstance * MUTnextInstance
Definition: inddefs.h:159
double * INDposIbrptr
Definition: inddefs.h:66
double * MUTbr1br2
Definition: inddefs.h:182
MUTinstance * MUTinstances
Definition: inddefs.h:203
int MUTparam()
GENERIC * IFuid
Definition: ifsim.h:72
int INDload()
double INDveq
Definition: inddefs.h:57
INDinstance * MUTind1
Definition: inddefs.h:177
int INDparam()
IFuid INDmodName
Definition: inddefs.h:102
int INDpzLoad()
struct sINDinstance INDinstance
IFuid MUTindName2
Definition: inddefs.h:174
IFuid MUTmodName
Definition: inddefs.h:206
INDinstance * INDinstances
Definition: inddefs.h:99
unsigned INDicGiven
Definition: inddefs.h:82
double * INDibrIbrptr
Definition: inddefs.h:78
int INDmodType
Definition: inddefs.h:93
double MUTfactor
Definition: inddefs.h:168
double INDreq
Definition: inddefs.h:60
double MUTcoupling
Definition: inddefs.h:165
int INDnegNode
Definition: inddefs.h:39
IFuid INDname
Definition: inddefs.h:30
INDinstance * MUTind2
Definition: inddefs.h:180
double INDprevFlux
Definition: inddefs.h:63
int INDsetup()
double * MUTbr2br1
Definition: inddefs.h:183
IFuid MUTname
Definition: inddefs.h:162
double INDinitCond
Definition: inddefs.h:54
int INDtrunc()
unsigned MUTindGiven
Definition: inddefs.h:186
#define SMPmatrix
Definition: smpdefs.h:11
int INDbrEq
Definition: inddefs.h:42
int INDgetic()
double INDinduct
Definition: inddefs.h:51
int MUTmodType
Definition: inddefs.h:197
char GENERIC
Definition: ifsim.h:27
int MUTask()
struct sINDmodel INDmodel