Jspice3
cktinit.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: 1985 Thomas L. Quarles
5  1993 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #include "spice.h"
9 #include <stdio.h>
10 #include <math.h>
11 #include "cktdefs.h"
12 #include "optdefs.h"
13 #include "const.h"
14 #include "sperror.h"
15 #include "util.h"
16 #include "cktext.h"
17 #include "niext.h"
18 
19 
20 int
21 CKTinit(ckt)
22 
23 GENERIC **ckt; /* new circuit to create */
24 {
25  int i;
26  CKTcircuit *sckt;
27  int error;
28 
29  sckt = (CKTcircuit *)( *ckt = (char *)MALLOC(sizeof(CKTcircuit)) );
30  if (sckt == NULL) return (E_NOMEM);
31  for (i = 0; i < DEVmaxnum; i++) {
32  (sckt)->CKThead[i] = (GENmodel *) NULL;
33  }
34  (sckt)->CKTheadList = (struct sCKTmodHead *)NULL;
35  (sckt)->CKTmaxEqNum = 1;
36  (sckt)->CKTnodes = (CKTnode *)NULL;
37  (sckt)->CKTlastNode = (CKTnode *)NULL;
38  error = NIinit(sckt);
39  if (error) return (error);
40 
41  (sckt)->CKTgmin = 1e-12;
42  (sckt)->CKTabstol = 1e-12;
43  (sckt)->CKTreltol = 1e-3;
44  (sckt)->CKTchgtol = 1e-14;
45  (sckt)->CKTvoltTol = 1e-6;
46  (sckt)->CKTtrtol = 7;
47  (sckt)->CKTbypass = 1;
48  (sckt)->CKTtranMaxIter = 10;
49  (sckt)->CKTdcMaxIter = 100;
50  (sckt)->CKTdcTrcvMaxIter = 50;
51  (sckt)->CKTintegrateMethod = TRAPEZOIDAL;
52  (sckt)->CKTorder = 1;
53  (sckt)->CKTmaxOrder = 2;
54  (sckt)->CKTpivotAbsTol = 1e-13;
55  (sckt)->CKTpivotRelTol = 1e-3;
56  (sckt)->CKTtemp = 300.15;
57  (sckt)->CKTnomTemp = 300.15;
58  (sckt)->CKTdefaultMosL = 1e-4;
59  (sckt)->CKTdefaultMosW = 1e-4;
60  (sckt)->CKTdefaultMosAD = 0;
61  (sckt)->CKTdefaultMosAS = 0;
62  (sckt)->CKTsrcFact=1;
63  (sckt)->CKTdiagGmin=0;
64  (sckt)->CKTstat = (GENERIC *)MALLOC(sizeof(STATistics));
65  (sckt)->CKTtroubleNode = 0;
66  (sckt)->CKTtroubleElt = NULL;
67  if ( (sckt)->CKTstat == (GENERIC *)NULL) return (E_NOMEM);
68 
69  return (OK);
70 }
#define TRAPEZOIDAL
Definition: cktdefs.h:92
int NIinit()
static double e
Definition: vectors.c:17
int CKTinit(GENERIC **ckt)
Definition: cktinit.c:21
#define OK
Definition: iferrmsg.h:17
#define MALLOC(x)
Definition: util.h:9
#define NULL
Definition: spdefs.h:121
#define E_NOMEM
Definition: iferrmsg.h:27
int CKTtemp()
int DEVmaxnum
Definition: sconfig.c:166
char GENERIC
Definition: ifsim.h:27