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 */ 21 struct sLTRAinstance *LTRAnextInstance; 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 */ 82 struct sLTRAmodel *LTRAnextModel; 83 /* pointer to next possible model in linked list */ 84 LTRAinstance *LTRAinstances; 85 /* pointer to list of instances that have this model */ 86 IFuid LTRAmodName; /* pointer to character string naming this model */ 87 88 double LTRAh1dashFirstVal; 89 /* first needed value of h1dash at current timepoint */ 90 double LTRAh2FirstVal; 91 /* first needed value of h2 at current timepoint */ 92 double LTRAh3dashFirstVal; 93 /* first needed value of h3dash at current timepoint */ 94 double LTRAh1dashFirstCoeff; 95 /* first needed coeff of h1dash for the current timepoint */ 96 double LTRAh2FirstCoeff; 97 /* first needed coeff of h2 for the current timepoint */ 98 double LTRAh3dashFirstCoeff; 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 */ 137 unsigned LTRAtruncDontCut; 138 /* don't bother about errors in impulse response calculations 139 due to large steps */ 140 double LTRAmaxSafeStep; 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 */ 147 int LTRAlteConType; 148 /* indicates whether full control, half control or no control */ 149 int LTRAhowToInterp; 150 /* indicates how to interpolate for delayed timepoint */ 151 int LTRAstepLimit; 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 261