1 /********** 2 Copyright 1990 Regents of the University of California. All rights reserved. 3 **********/ 4 5 #include "ngspice/ngspice.h" 6 #include "ngspice/pzdefs.h" 7 #include "ngspice/smpdefs.h" 8 #include "ngspice/cktdefs.h" 9 #include "ngspice/complex.h" 10 #include "ngspice/devdefs.h" 11 #include "ngspice/sperror.h" 12 13 14 int CKTpzLoad(CKTcircuit * ckt,SPcomplex * s)15CKTpzLoad(CKTcircuit *ckt, SPcomplex *s) 16 { 17 PZAN *job = (PZAN *) ckt->CKTcurJob; 18 19 int error; 20 int i; 21 22 for (i = 0; i <= SMPmatSize(ckt->CKTmatrix); i++) { 23 ckt->CKTrhs[i] = 0.0; 24 ckt->CKTirhs[i] = 0.0; 25 } 26 27 SMPcClear(ckt->CKTmatrix); 28 for (i = 0; i < DEVmaxnum; i++) { 29 if (DEVices[i] && DEVices[i]->DEVpzLoad != NULL && ckt->CKThead[i] != NULL) { 30 error = DEVices[i]->DEVpzLoad (ckt->CKThead[i], ckt, s); 31 if(error) return(error); 32 } 33 } 34 35 if (job->PZbalance_col && job->PZsolution_col) { 36 SMPcAddCol(ckt->CKTmatrix, job->PZbalance_col, job->PZsolution_col); 37 /* AC sources ?? XXX */ 38 } 39 40 if (job->PZsolution_col) { 41 SMPcZeroCol(ckt->CKTmatrix, job->PZsolution_col); 42 } 43 44 /* Driving function (current source) */ 45 if (job->PZdrive_pptr) 46 *job->PZdrive_pptr = 1.0; 47 if (job->PZdrive_nptr) 48 *job->PZdrive_nptr = -1.0; 49 50 return(OK); 51 } 52