1 /********** 2 Copyright 1990 Regents of the University of California. All rights reserved. 3 Author: 1985 Thomas L. Quarles 4 **********/ 5 /* 6 */ 7 8 /* 9 * This routine gets the device initial conditions for the BJTs 10 * from the RHS vector 11 */ 12 13 #include "ngspice/ngspice.h" 14 #include "ngspice/cktdefs.h" 15 #include "bjtdefs.h" 16 #include "ngspice/sperror.h" 17 #include "ngspice/suffix.h" 18 19 20 int BJTgetic(GENmodel * inModel,CKTcircuit * ckt)21BJTgetic(GENmodel *inModel, CKTcircuit *ckt) 22 23 { 24 25 BJTmodel *model = (BJTmodel*)inModel; 26 BJTinstance *here; 27 /* 28 * grab initial conditions out of rhs array. User specified, so use 29 * external nodes to get values 30 */ 31 32 for( ; model ; model = BJTnextModel(model)) { 33 for(here = BJTinstances(model); here ; here = BJTnextInstance(here)) { 34 35 if(!here->BJTicVBEGiven) { 36 here->BJTicVBE = 37 *(ckt->CKTrhs + here->BJTbaseNode) - 38 *(ckt->CKTrhs + here->BJTemitNode); 39 } 40 if(!here->BJTicVCEGiven) { 41 here->BJTicVCE = 42 *(ckt->CKTrhs + here->BJTcolNode) - 43 *(ckt->CKTrhs + here->BJTemitNode); 44 } 45 } 46 } 47 return(OK); 48 } 49