Jspice3
ltradefs.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: 1990 Jaijeet S. Roychowdhury
5  1993 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #ifndef LTRA
9 #define LTRA
10 #undef LTRALTEINFO
11 #undef LTRADEBUG
12 
13 #include "devdefs.h"
14 
15 /* structures used to describe lossy transmission liness */
16 
17 /* information used to describe a single instance */
18 
19 typedef struct sLTRAinstance {
20  struct sLTRAmodel *LTRAmodPtr; /* backpointer to model */
22  /* pointer to next instance of current model */
23  IFuid LTRAname; /* pointer to char string naming this instance */
24  int LTRAstate; /* pointer to start of state vector for line */
25  int LTRAposNode1; /* number of positive node of end 1 of t. line */
26  int LTRAnegNode1; /* number of negative node of end 1 of t. line */
27  int LTRAposNode2; /* number of positive node of end 2 of t. line */
28  int LTRAnegNode2; /* number of negative node of end 2 of t. line */
29  int LTRAbrEq1; /* number of branch equation for end 1 of t. line */
30  int LTRAbrEq2; /* number of branch equation for end 2 of t. line */
31  double LTRAinput1; /* accumulated excitation for port 1 */
32  double LTRAinput2; /* accumulated excitation for port 2 */
33  double LTRAinput1Old; /* previous accumulated excitation for port 1 */
34  double LTRAinput2Old; /* previous accumulated excitation for port 2 */
35  double LTRAinitVolt1; /* initial condition: voltage on port 1 */
36  double LTRAinitCur1; /* initial condition: current at port 1 */
37  double LTRAinitVolt2; /* initial condition: voltage on port 2 */
38  double LTRAinitCur2; /* initial condition: current at port 2 */
39  double *LTRAv1; /* past values of v1 */
40  double *LTRAi1; /* past values of i1 */
41  double *LTRAv2; /* past values of v2 */
42  double *LTRAi2; /* past values of i2 */
43  int LTRAinstListSize; /* size of above lists */
44 
45  double *LTRAibr1Ibr1Ptr; /* pointer to sparse matrix */
46  double *LTRAibr1Ibr2Ptr; /* pointer to sparse matrix */
47  double *LTRAibr1Pos1Ptr; /* pointer to sparse matrix */
48  double *LTRAibr1Neg1Ptr; /* pointer to sparse matrix */
49  double *LTRAibr1Pos2Ptr; /* pointer to sparse matrix */
50  double *LTRAibr1Neg2Ptr; /* pointer to sparse matrix */
51  double *LTRAibr2Ibr1Ptr; /* pointer to sparse matrix */
52  double *LTRAibr2Ibr2Ptr; /* pointer to sparse matrix */
53  double *LTRAibr2Pos1Ptr; /* pointer to sparse matrix */
54  double *LTRAibr2Neg1Ptr; /* pointer to sparse matrix */
55  double *LTRAibr2Pos2Ptr; /* pointer to sparse matrix */
56  double *LTRAibr2Neg2Ptr; /* pointer to sparse matrix */
57  double *LTRAneg1Ibr1Ptr; /* pointer to sparse matrix */
58  double *LTRAneg2Ibr2Ptr; /* pointer to sparse matrix */
59  double *LTRApos1Ibr1Ptr; /* pointer to sparse matrix */
60  double *LTRApos2Ibr2Ptr; /* pointer to sparse matrix */
61  double *LTRApos1Pos1Ptr; /* pointer to sparse matrix */
62  double *LTRAneg1Neg1Ptr; /* pointer to sparse matrix */
63  double *LTRApos2Pos2Ptr; /* pointer to sparse matrix */
64  double *LTRAneg2Neg2Ptr; /* pointer to sparse matrix */
65 
66  unsigned LTRAicV1Given:1; /* flag, init. voltage at port 1 given */
67  unsigned LTRAicC1Given:1; /* flag, init. current at port 1 given */
68  unsigned LTRAicV2Given:1; /* flag, init. voltage at port 2 given */
69  unsigned LTRAicC2Given:1; /* flag, init. current at port 2 given */
70 } LTRAinstance ;
71 
72 #define LTRAv1Tot LTRAstate
73 #define LTRAv2Tot LTRAstate+1
74 
75 
76 /* per model data */
77 /* model structure for transmission lines */
78 
79 typedef struct sLTRAmodel {
80 
81  int LTRAmodType; /* type index of this device type */
83  /* pointer to next possible model in linked list */
85  /* pointer to list of instances that have this model */
86  IFuid LTRAmodName; /* pointer to character string naming this model */
87 
89  /* first needed value of h1dash at current timepoint */
91  /* first needed value of h2 at current timepoint */
93  /* first needed value of h3dash at current timepoint */
95  /* first needed coeff of h1dash for the current timepoint */
97  /* first needed coeff of h2 for the current timepoint */
99  /* first needed coeff of h3dash for the current timepoint */
100 
101  double *LTRAh1dashCoeffs; /* list of other coefficients for h1dash */
102  double *LTRAh2Coeffs; /* list of other coefficients for h2 */
103  double *LTRAh3dashCoeffs; /* list of other coefficients for h3dash */
104  int LTRAmodelListSize; /* size of above lists */
105 
106  double LTRAconduct; /* conductance G - input */
107  double LTRAresist; /* resistance R - input */
108  double LTRAinduct; /* inductance L - input */
109  double LTRAcapac; /* capacitance C - input */
110  double LTRAlength; /* length l - input */
111  double LTRAtd; /* propagation delay T - calculated */
112  double LTRAimped; /* impedance Z - calculated */
113  double LTRAadmit; /* admittance Y - calculated */
114  double LTRAalpha; /* alpha - calculated */
115  double LTRAbeta; /* beta - calculated */
116  double LTRAattenuation; /* e^(-beta T) - calculated */
117  double LTRAcByR; /* C/R - for the RC line - calculated */
118  double LTRArclsqr; /* RCl^2 - for the RC line - calculated */
119  double LTRAintH1dash; /* int 0-inf h'1(tau) d tau - calculated */
120  double LTRAintH2; /* int 0-inf h 2(tau) d tau - calculated */
121  double LTRAintH3dash; /* int 0-inf h'3(tau) d tau - calculated */
122 
123  double LTRAcoshlrootGR; /* cosh(l*sqrt(G*R)), used for DC anal */
124  double LTRArRsLrGRorG; /* sqrt(R)*sinh(l*sqrt(G*R))/sqrt(G) */
125  double LTRArGsLrGRorR; /* sqrt(G)*sinh(l*sqrt(G*R))/sqrt(R) */
126 
127  int LTRAauxIndex; /* auxiliary index for h2 and h3dash */
128  double LTRAstLineReltol; /* reltol for checking st. lines */
129  double LTRAchopReltol; /* reltol for truncation of impulse responses */
130  double LTRAstLineAbstol; /* abstol for checking st. lines */
131  double LTRAchopAbstol; /* abstol for truncation of impulse responses */
132 
133  unsigned LTRAreltolGiven:1; /* relative deriv. tol. given */
134  unsigned LTRAabstolGiven:1; /* absolute deriv. tol. given */
135  unsigned LTRAtruncNR;
136  /* use N-R iterations for calculating step in LTRAtrunc */
138  /* don't bother about errors in impulse response calculations
139  due to large steps */
141  /* maximum safe step for impulse response calculations */
142  unsigned LTRAresistGiven:1; /* R was specified */
143  unsigned LTRAconductGiven:1;/* G was specified */
144  unsigned LTRAinductGiven:1; /* L was specified */
145  unsigned LTRAcapacGiven:1; /* C was specified */
146  unsigned LTRAlengthGiven:1; /* length was specified */
148  /* indicates whether full control, half control or no control */
150  /* indicates how to interpolate for delayed timepoint */
152  /* flag to indicate that the timestep should always be
153  limited to 0.8*LTRAtd */
154  unsigned LTRAfGiven:1; /* flag to indicate freq was specified */
155  double LTRAabstol; /* absolute deriv. tol. for breakpoint setting */
156  double LTRAreltol; /* relative deriv. tol. for breakpoint setting */
157 
158  int LTRAspecialCase; /* what kind of model (RC, RLC, RL, ...) */
159 
160 /* special cases */
161 #define LTRA_MOD_RLC 1
162 #define LTRA_MOD_RC 2
163 #define LTRA_MOD_RG 3
164 #define LTRA_MOD_LC 4
165 #define LTRA_MOD_RL 5
166 
167 } LTRAmodel;
168 
169 
170 /* device parameters */
171 #define LTRA_V1 1
172 #define LTRA_I1 2
173 #define LTRA_V2 3
174 #define LTRA_I2 4
175 #define LTRA_IC 5
176 #define LTRA_POS_NODE1 6
177 #define LTRA_NEG_NODE1 7
178 #define LTRA_POS_NODE2 8
179 #define LTRA_NEG_NODE2 9
180 #define LTRA_BR_EQ1 10
181 #define LTRA_BR_EQ2 11
182 
183 /* model parameters */
184 #define LTRA_MOD_LTRA 100
185 #define LTRA_MOD_R 101
186 #define LTRA_MOD_L 102
187 #define LTRA_MOD_G 103
188 #define LTRA_MOD_C 104
189 #define LTRA_MOD_LEN 105
190 #define LTRA_MOD_RELTOL 106
191 #define LTRA_MOD_ABSTOL 107
192 #define LTRA_MOD_NOCONTROL 108
193 #define LTRA_MOD_HALFCONTROL 109
194 #define LTRA_MOD_FULLCONTROL 110
195 #define LTRA_MOD_STEPLIMIT 111
196 #define LTRA_MOD_NOSTEPLIMIT 112
197 #define LTRA_MOD_LININTERP 113
198 #define LTRA_MOD_QUADINTERP 114
199 #define LTRA_MOD_MIXEDINTERP 115
200 #define LTRA_MOD_TRUNCNR 116
201 #define LTRA_MOD_TRUNCDONTCUT 117
202 #define LTRA_MOD_STLINEREL 118
203 #define LTRA_MOD_STLINEABS 119
204 
205 /* model questions */
206 #define LTRA_MOD_Z0 200
207 #define LTRA_MOD_TD 201
208 
209 
210 #ifdef __STDC__
211 
212 extern int LTRAaccept(CKTcircuit*,GENmodel*);
213 extern int LTRAask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*);
214 extern int LTRAacLoad(GENmodel*,CKTcircuit*);
215 extern int LTRAdelete(GENmodel*,IFuid,GENinstance**);
216 extern void LTRAdestroy(GENmodel**);
217 extern int LTRAload(GENmodel*,CKTcircuit*);
218 extern int LTRAmAsk(CKTcircuit*,GENmodel*,int,IFvalue*);
219 extern int LTRAmDelete(GENmodel**,IFuid,GENmodel*);
220 extern int LTRAmParam(int,IFvalue*,GENmodel*);
221 extern int LTRAparam(CKTcircuit*,int,IFvalue*,GENinstance*,IFvalue*);
222 extern void LTRAparse(int,GENERIC*,GENERIC*,GENERIC*);
223 extern int LTRAsetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*);
224 extern int LTRAtrunc(GENmodel*,CKTcircuit*,double*);
225 
226 extern void LTRArcCoeffsSetup(CKTcircuit*,GENmodel*);
227 extern void LTRArlcCoeffsSetup(CKTcircuit*,GENmodel*);
228 extern double LTRArlcH2Func(double,GENmodel*);
229 extern double LTRArlcH3dashFunc(double,double,double,double);
230 extern int LTRAstraightLineCheck(double,double,double,double,double,double,double,double);
231 extern double LTRAlteCalculate(CKTcircuit*,GENmodel*,GENinstance*,double);
232 
233 #else /* stdc */
234 
235 extern int LTRAaccept();
236 extern int LTRAask();
237 extern int LTRAacLoad();
238 extern int LTRAdelete();
239 extern void LTRAdestroy();
240 extern int LTRAload();
241 extern int LTRAmAsk();
242 extern int LTRAmDelete();
243 extern int LTRAmParam();
244 extern int LTRAparam();
245 extern void LTRAparse();
246 extern int LTRAsetup();
247 extern int LTRAtrunc();
248 
249 extern void LTRArcCoeffsSetup();
250 extern void LTRArlcCoeffsSetup();
251 extern double LTRArlcH2Func();
252 extern double LTRArlcH3dashFunc();
253 extern int LTRAstraightLineCheck();
254 extern double LTRAlteCalculate();
255 
256 #endif /* stdc */
257 
258 
259 #endif /*LTRA*/
260 
double LTRArGsLrGRorR
Definition: ltradefs.h:125
double * LTRAibr2Ibr2Ptr
Definition: ltradefs.h:52
double LTRAinput2
Definition: ltradefs.h:32
double LTRAh1dashFirstVal
Definition: ltradefs.h:88
double LTRAimped
Definition: ltradefs.h:112
void LTRAdestroy()
double * LTRApos1Pos1Ptr
Definition: ltradefs.h:61
unsigned LTRAfGiven
Definition: ltradefs.h:154
unsigned LTRAresistGiven
Definition: ltradefs.h:142
double LTRAcapac
Definition: ltradefs.h:109
int LTRAmParam()
double LTRAinput1Old
Definition: ltradefs.h:33
double LTRAintH2
Definition: ltradefs.h:120
double * LTRApos2Pos2Ptr
Definition: ltradefs.h:63
int LTRAstate
Definition: ltradefs.h:24
double LTRAinitVolt2
Definition: ltradefs.h:37
double * LTRAneg1Neg1Ptr
Definition: ltradefs.h:62
double LTRAalpha
Definition: ltradefs.h:114
double LTRAinduct
Definition: ltradefs.h:108
double * LTRAibr2Neg2Ptr
Definition: ltradefs.h:56
double LTRAinput2Old
Definition: ltradefs.h:34
double LTRAchopReltol
Definition: ltradefs.h:129
double * LTRAibr1Neg2Ptr
Definition: ltradefs.h:50
int LTRAaccept()
double LTRAintH1dash
Definition: ltradefs.h:119
int LTRAstepLimit
Definition: ltradefs.h:151
double LTRAlength
Definition: ltradefs.h:110
int LTRAnegNode1
Definition: ltradefs.h:26
unsigned LTRAtruncDontCut
Definition: ltradefs.h:137
unsigned LTRAlengthGiven
Definition: ltradefs.h:146
double LTRAh3dashFirstCoeff
Definition: ltradefs.h:98
struct sLTRAinstance * LTRAnextInstance
Definition: ltradefs.h:21
void LTRArlcCoeffsSetup()
int LTRAsetup()
double LTRAinput1
Definition: ltradefs.h:31
double * LTRAibr2Ibr1Ptr
Definition: ltradefs.h:51
double * LTRAibr2Pos2Ptr
Definition: ltradefs.h:55
int LTRAhowToInterp
Definition: ltradefs.h:149
double LTRAh2FirstCoeff
Definition: ltradefs.h:96
double LTRAstLineReltol
Definition: ltradefs.h:128
double LTRArRsLrGRorG
Definition: ltradefs.h:124
double LTRAintH3dash
Definition: ltradefs.h:121
double LTRAabstol
Definition: ltradefs.h:155
int LTRAmodelListSize
Definition: ltradefs.h:104
double * LTRAibr1Pos1Ptr
Definition: ltradefs.h:47
double LTRAh3dashFirstVal
Definition: ltradefs.h:92
double * LTRAi2
Definition: ltradefs.h:42
double LTRAstLineAbstol
Definition: ltradefs.h:130
GENERIC * IFuid
Definition: ifsim.h:72
struct sLTRAmodel * LTRAmodPtr
Definition: ltradefs.h:20
double LTRAreltol
Definition: ltradefs.h:156
int LTRAload()
struct sLTRAinstance LTRAinstance
LTRAinstance * LTRAinstances
Definition: ltradefs.h:84
int LTRAask()
IFuid LTRAname
Definition: ltradefs.h:23
double * LTRAibr1Ibr2Ptr
Definition: ltradefs.h:46
double * LTRAv2
Definition: ltradefs.h:41
int LTRAacLoad()
int LTRAbrEq1
Definition: ltradefs.h:29
double LTRArlcH3dashFunc()
double * LTRAh2Coeffs
Definition: ltradefs.h:102
double * LTRAibr2Neg1Ptr
Definition: ltradefs.h:54
unsigned LTRAinductGiven
Definition: ltradefs.h:144
double LTRArlcH2Func()
unsigned LTRAicV2Given
Definition: ltradefs.h:68
double LTRAcByR
Definition: ltradefs.h:117
int LTRAposNode1
Definition: ltradefs.h:25
IFuid LTRAmodName
Definition: ltradefs.h:86
double * LTRAi1
Definition: ltradefs.h:40
double * LTRAneg1Ibr1Ptr
Definition: ltradefs.h:57
double * LTRAibr1Pos2Ptr
Definition: ltradefs.h:49
double LTRAmaxSafeStep
Definition: ltradefs.h:140
int LTRAlteConType
Definition: ltradefs.h:147
double * LTRAibr2Pos1Ptr
Definition: ltradefs.h:53
int LTRAinstListSize
Definition: ltradefs.h:43
int LTRAmDelete()
double LTRAinitVolt1
Definition: ltradefs.h:35
unsigned LTRAconductGiven
Definition: ltradefs.h:143
unsigned LTRAicC1Given
Definition: ltradefs.h:67
double LTRAbeta
Definition: ltradefs.h:115
double * LTRApos2Ibr2Ptr
Definition: ltradefs.h:60
int LTRAnegNode2
Definition: ltradefs.h:28
double LTRArclsqr
Definition: ltradefs.h:118
double * LTRAh3dashCoeffs
Definition: ltradefs.h:103
double LTRAtd
Definition: ltradefs.h:111
double LTRAlteCalculate()
double LTRAcoshlrootGR
Definition: ltradefs.h:123
int LTRAauxIndex
Definition: ltradefs.h:127
double LTRAadmit
Definition: ltradefs.h:113
unsigned LTRAicV1Given
Definition: ltradefs.h:66
double LTRAinitCur1
Definition: ltradefs.h:36
void LTRArcCoeffsSetup()
double * LTRAneg2Ibr2Ptr
Definition: ltradefs.h:58
int LTRAstraightLineCheck()
struct sLTRAmodel * LTRAnextModel
Definition: ltradefs.h:82
int LTRAbrEq2
Definition: ltradefs.h:30
double LTRAchopAbstol
Definition: ltradefs.h:131
double LTRAh2FirstVal
Definition: ltradefs.h:90
int LTRAtrunc()
double LTRAconduct
Definition: ltradefs.h:106
unsigned LTRAcapacGiven
Definition: ltradefs.h:145
unsigned LTRAicC2Given
Definition: ltradefs.h:69
#define SMPmatrix
Definition: smpdefs.h:11
double LTRAinitCur2
Definition: ltradefs.h:38
struct sLTRAmodel LTRAmodel
double * LTRAneg2Neg2Ptr
Definition: ltradefs.h:64
int LTRAparam()
unsigned LTRAreltolGiven
Definition: ltradefs.h:133
unsigned LTRAtruncNR
Definition: ltradefs.h:135
double LTRAattenuation
Definition: ltradefs.h:116
double * LTRAh1dashCoeffs
Definition: ltradefs.h:101
int LTRAmodType
Definition: ltradefs.h:81
double * LTRAibr1Neg1Ptr
Definition: ltradefs.h:48
int LTRAposNode2
Definition: ltradefs.h:27
int LTRAdelete()
double * LTRApos1Ibr1Ptr
Definition: ltradefs.h:59
void LTRAparse()
double * LTRAv1
Definition: ltradefs.h:39
double * LTRAibr1Ibr1Ptr
Definition: ltradefs.h:45
double LTRAh1dashFirstCoeff
Definition: ltradefs.h:94
int LTRAmAsk()
char GENERIC
Definition: ifsim.h:27
double LTRAresist
Definition: ltradefs.h:107
unsigned LTRAabstolGiven
Definition: ltradefs.h:134
int LTRAspecialCase
Definition: ltradefs.h:158