Jspice3
pzld.c
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: UCB CAD Group
5  1993 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #include "spice.h"
9 #include <stdio.h>
10 #include "devdefs.h"
11 #include "pzdefs.h"
12 #include "sperror.h"
13 #include "cktext.h"
14 
15 extern SPICEdev *DEVices[];
16 
17 
18 int
19 CKTpzLoad(ckt, s)
20 
21 CKTcircuit *ckt;
22 SPcomplex *s;
23 {
24  PZAN *pzan = (PZAN *) (ckt->CKTcurJob);
25  int solution_col;
26  int error;
27  struct sCKTmodHead *mh;
28  int i, size;
29  int (*func)();
30 
31  size = spGetSize(ckt->CKTmatrix,1);
32  for (i = 0; i <= size; i++) {
33  ckt->CKTrhs[i] = 0.0;
34  ckt->CKTirhs[i] = 0.0;
35  }
36 
37  spSetComplex(ckt->CKTmatrix);
38  spClear(ckt->CKTmatrix);
39  for (mh = ckt->CKTheadList; mh != NULL; mh = mh->next) {
40  if ((func = DEVices[mh->type]->DEVpzLoad) != NULL) {
41  error = (*func)(mh->head, ckt, s);
42  if (error) return (error);
43  }
44  }
45 
46 #ifdef notdef
47  printf("*** Before PZ adjustments *\n");
48  spPrint(ckt->CKTmatrix,0,1,1);
49 #endif
50 
51  if (pzan->PZbalance_col && pzan->PZsolution_col) {
52  spAddCol(ckt->CKTmatrix, pzan->PZbalance_col, pzan->PZsolution_col);
53  /* AC sources ?? XXX */
54  }
55 
56  if (pzan->PZsolution_col) {
57  spZeroCol(ckt->CKTmatrix, pzan->PZsolution_col);
58  }
59 
60  /* Driving function (current source) */
61  if (pzan->PZdrive_pptr)
62  *pzan->PZdrive_pptr = 1.0;
63  if (pzan->PZdrive_nptr)
64  *pzan->PZdrive_nptr = -1.0;
65 
66 #ifdef notdef
67  printf("*** After PZ adjustments *\n");
68  spPrint(ckt->CKTmatrix,0,1,1);
69 #endif
70 
71  return(OK);
72 }
int PZbalance_col
Definition: pzdefs.h:34
void spPrint()
struct sCKTmodHead * next
Definition: cktdefs.h:58
Definition: cddefs.h:119
SPICEdev * DEVices[]
Definition: sconfig.c:109
#define OK
Definition: iferrmsg.h:17
int PZsolution_col
Definition: pzdefs.h:35
#define NULL
Definition: spdefs.h:121
int spAddCol()
int spGetSize()
void spClear()
Definition: fteparse.h:37
int CKTpzLoad(CKTcircuit *ckt, SPcomplex *s)
Definition: pzld.c:19
void spSetComplex()
int type
Definition: cktdefs.h:56
double * PZdrive_pptr
Definition: pzdefs.h:40
int(* DEVpzLoad)()
Definition: devdefs.h:106
int spZeroCol()
double * PZdrive_nptr
Definition: pzdefs.h:41
GENmodel * head
Definition: cktdefs.h:57
Definition: pzdefs.h:23