Jspice3
traacld.c
Go to the documentation of this file.
1 /**********
2 Copyright 1990 Regents of the University of California. All rights reserved.
3 Author: 1985 Thomas L. Quarles
4 **********/
5 
6 #include "spice.h"
7 #include <stdio.h>
8 #include <math.h>
9 #include "tradefs.h"
10 #include "sperror.h"
11 
12 
13 int
14 TRAacLoad(inModel,ckt)
15 
16 GENmodel *inModel;
17 CKTcircuit *ckt;
18  /* actually load the current values into the
19  * sparse matrix previously provided
20  */
21 {
22  TRAmodel *model = (TRAmodel *)inModel;
23  TRAinstance *here;
24  double real;
25  double imag;
26 
27  /* loop through all the transmission line models */
28  for( ; model != NULL; model = model->TRAnextModel ) {
29 
30  /* loop through all the instances of the model */
31  for (here = model->TRAinstances; here != NULL ;
32  here=here->TRAnextInstance) {
33  real = cos(-ckt->CKTomega*here->TRAtd);
34  imag = sin(-ckt->CKTomega*here->TRAtd);
35 
36  *(here->TRApos1Pos1Ptr) += here->TRAconduct;
37  *(here->TRApos1Int1Ptr) -= here->TRAconduct;
38  *(here->TRAneg1Ibr1Ptr) -= 1;
39  *(here->TRApos2Pos2Ptr) += here->TRAconduct;
40  *(here->TRAneg2Ibr2Ptr) -= 1;
41  *(here->TRAint1Pos1Ptr) -= here->TRAconduct;
42  *(here->TRAint1Int1Ptr) += here->TRAconduct;
43  *(here->TRAint1Ibr1Ptr) += 1;
44  *(here->TRAint2Int2Ptr) += here->TRAconduct;
45  *(here->TRAint2Ibr2Ptr) += 1;
46  *(here->TRAibr1Neg1Ptr) -= 1;
47  *(here->TRAibr1Pos2Ptr+0) -= real;
48  *(here->TRAibr1Pos2Ptr+1) -= imag;
49  *(here->TRAibr1Neg2Ptr+0) += real;
50  *(here->TRAibr1Neg2Ptr+1) += imag;
51  *(here->TRAibr1Int1Ptr) += 1;
52  *(here->TRAibr1Ibr2Ptr+0) -= real * here->TRAimped;
53  *(here->TRAibr1Ibr2Ptr+1) -= imag * here->TRAimped;
54  *(here->TRAibr2Pos1Ptr+0) -= real;
55  *(here->TRAibr2Pos1Ptr+1) -= imag;
56  *(here->TRAibr2Neg1Ptr+0) += real;
57  *(here->TRAibr2Neg1Ptr+1) += imag;
58  *(here->TRAibr2Neg2Ptr) -= 1;
59  *(here->TRAibr2Int2Ptr) += 1;
60  *(here->TRAibr2Ibr1Ptr+0) -= real * here->TRAimped;
61  *(here->TRAibr2Ibr1Ptr+1) -= imag * here->TRAimped;
62  *(here->TRApos2Int2Ptr) -= here->TRAconduct;
63  *(here->TRAint2Pos2Ptr) -= here->TRAconduct;
64 
65  }
66  }
67  return(OK);
68 }
double * TRAibr1Neg1Ptr
Definition: tradefs.h:50
struct sTRAinstance * TRAnextInstance
Definition: tradefs.h:20
TRAinstance * TRAinstances
Definition: tradefs.h:89
double * TRAint1Pos1Ptr
Definition: tradefs.h:60
struct sTRAmodel * TRAnextModel
Definition: tradefs.h:87
double TRAimped
Definition: tradefs.h:30
double * TRApos2Pos2Ptr
Definition: tradefs.h:69
double TRAtd
Definition: tradefs.h:32
double * TRApos1Pos1Ptr
Definition: tradefs.h:67
double * TRAint2Pos2Ptr
Definition: tradefs.h:63
double * TRAint1Int1Ptr
Definition: tradefs.h:59
int TRAacLoad(GENmodel *inModel, CKTcircuit *ckt)
Definition: traacld.c:14
#define OK
Definition: iferrmsg.h:17
double * TRAibr2Ibr1Ptr
Definition: tradefs.h:53
double * TRAibr2Neg2Ptr
Definition: tradefs.h:56
double * TRAibr1Pos2Ptr
Definition: tradefs.h:52
#define NULL
Definition: spdefs.h:121
double cos()
double * TRAibr2Pos1Ptr
Definition: tradefs.h:57
double * TRAibr1Ibr2Ptr
Definition: tradefs.h:48
double CKTomega
Definition: cktdefs.h:198
double sin()
double * TRAibr1Int1Ptr
Definition: tradefs.h:49
double * TRAibr2Neg1Ptr
Definition: tradefs.h:55
static char model[32]
Definition: subckt.c:76
double * TRAneg1Ibr1Ptr
Definition: tradefs.h:64
double TRAconduct
Definition: tradefs.h:31
double * TRAibr1Neg2Ptr
Definition: tradefs.h:51
double * TRAint2Ibr2Ptr
Definition: tradefs.h:61
double * TRApos1Int1Ptr
Definition: tradefs.h:66
double * TRAint2Int2Ptr
Definition: tradefs.h:62
double * TRAint1Ibr1Ptr
Definition: tradefs.h:58
double * TRAneg2Ibr2Ptr
Definition: tradefs.h:65
double * TRApos2Int2Ptr
Definition: tradefs.h:68
double * TRAibr2Int2Ptr
Definition: tradefs.h:54