1 /**********
2 Copyright 1990 Regents of the University of California.  All rights reserved.
3 Author: 1985 Thomas L. Quarles
4 Modified: Alan Gillespie
5 **********/
6 /*
7  */
8 
9 #include "ngspice/ngspice.h"
10 #include "ngspice/cktdefs.h"
11 #include "mos9defs.h"
12 #include "ngspice/sperror.h"
13 #include "ngspice/suffix.h"
14 
15 
16 int
MOS9getic(GENmodel * inModel,CKTcircuit * ckt)17 MOS9getic(GENmodel *inModel, CKTcircuit *ckt)
18 {
19     MOS9model *model = (MOS9model *)inModel;
20     MOS9instance *here;
21     /*
22      * grab initial conditions out of rhs array.   User specified, so use
23      * external nodes to get values
24      */
25 
26     for( ; model ; model = MOS9nextModel(model)) {
27         for(here = MOS9instances(model); here ; here = MOS9nextInstance(here)) {
28 
29             if(!here->MOS9icVBSGiven) {
30                 here->MOS9icVBS =
31                         *(ckt->CKTrhs + here->MOS9bNode) -
32                         *(ckt->CKTrhs + here->MOS9sNode);
33             }
34             if(!here->MOS9icVDSGiven) {
35                 here->MOS9icVDS =
36                         *(ckt->CKTrhs + here->MOS9dNode) -
37                         *(ckt->CKTrhs + here->MOS9sNode);
38             }
39             if(!here->MOS9icVGSGiven) {
40                 here->MOS9icVGS =
41                         *(ckt->CKTrhs + here->MOS9gNode) -
42                         *(ckt->CKTrhs + here->MOS9sNode);
43             }
44         }
45     }
46     return(OK);
47 }
48