Jspice3
swdefs.h
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3e2 - Copyright (c) Stephen R. Whiteley 1992
3 Copyright 1990 Regents of the University of California. All rights reserved.
4 Authors: 1985 Gordon M. Jacobs
5  1992 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #ifndef SW
9 #define SW
10 
11 #include "devdefs.h"
12 
13  /* structures used to describe switches */
14 
15 
16 /* information to describe each instance */
17 
18 typedef struct sSWinstance {
19  struct sSWmodel *SWmodPtr; /* backpointer to model */
20  struct sSWinstance *SWnextInstance; /* pointer to next instance of
21  * current model*/
22  IFuid SWname; /* pointer to character string naming this instance */
23  int SWstate; /* pointer to start of switch's section of state vector */
24 
25  int SWposNode; /* number of positive node of switch */
26  int SWnegNode; /* number of negative node of switch */
27  int SWposCntrlNode; /* number of positive controlling node of switch */
28  int SWnegCntrlNode; /* number of negative controlling node of switch */
29  int SWcontBranch; /* number of branch of controlling current */
30  IFuid SWcontName; /* name of controlling source */
31 
32  double *SWposPosptr; /* pointer to sparse matrix diagonal at
33  (positive,positive) for switch conductance */
34  double *SWnegPosptr; /* pointer to sparse matrix offdiagonal at
35  (neagtive,positive) for switch conductance */
36  double *SWposNegptr; /* pointer to sparse matrix offdiagonal at
37  (positive,neagtive) for switch conductance */
38  double *SWnegNegptr; /* pointer to sparse matrix diagonal at
39  (neagtive,neagtive) for switch conductance */
40 
41  double SWcond; /* conductance of the switch now */
42 
43  unsigned SWzero_stateGiven : 1; /* flag to indicate initial state */
44 #ifndef NONOISE
45  double SWnVar[NSTATVARS];
46 #else /* NONOISE */
47  double *SWnVar;
48 #endif /* NONOISE */
49 
50 } SWinstance;
51 
52 /* data per model */
53 
54 #define SW_ON_CONDUCTANCE 1.0 /* default on conductance = 1 mho */
55 #define SW_OFF_CONDUCTANCE ckt->CKTgmin /* default off conductance */
56 #define SW_NUM_STATES 1
57 
58 typedef struct sSWmodel { /* model structure for a switch */
59  int SWmodType; /* type index of this device type */
60  struct sSWmodel *SWnextModel; /* pointer to next possible model in
61  * linked list */
62  SWinstance *SWinstances; /* pointer to list of instances that have this
63  * model */
64  IFuid SWmodName; /* pointer to character string naming this model */
65 
66  double SWonResistance; /* switch "on" resistance */
67  double SWoffResistance; /* switch "off" resistance */
68  double SWvThreshold; /* switching threshold voltage */
69  double SWvHysteresis; /* switching hysteresis voltage */
70  double SWiThreshold; /* switching threshold current */
71  double SWiHysteresis; /* switching hysteresis current */
72  double SWonConduct; /* switch "on" conductance */
73  double SWoffConduct; /* switch "off" conductance */
74 
75  /* flags to indicate... */
76  unsigned SWonGiven : 1; /* on-resistance was given */
77  unsigned SWoffGiven : 1; /* off-resistance was given */
78  unsigned SWvThreshGiven : 1; /* threshold volt was given */
79  unsigned SWvHystGiven : 1; /* hysteresis volt was given */
80  unsigned SWiThreshGiven : 1; /* threshold current was given */
81  unsigned SWiHystGiven : 1; /* hysteresis current was given */
82 
83 } SWmodel;
84 
85 /* device parameters */
86 #define SW_IC_ON 1
87 #define SW_IC_OFF 2
88 #define SW_POS_NODE 3
89 #define SW_NEG_NODE 4
90 #define SW_POS_CONT_NODE 5
91 #define SW_NEG_CONT_NODE 6
92 #define SW_CONTROL 7
93 #define SW_CURRENT 8
94 #define SW_POWER 9
95 
96 /* model parameters */
97 #define SW_MOD_SW 101
98 #define SW_MOD_RON 102
99 #define SW_MOD_ROFF 103
100 #define SW_MOD_VTH 104
101 #define SW_MOD_VHYS 105
102 #define SW_MOD_ITH 106
103 #define SW_MOD_IHYS 107
104 #define SW_MOD_GON 108
105 #define SW_MOD_GOFF 109
106 
107 
108 #ifdef __STDC__
109 
110 extern int SWacLoad(GENmodel*,CKTcircuit*);
111 extern int SWask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*);
112 extern int SWload(GENmodel*,CKTcircuit*);
113 extern int SWmAsk(CKTcircuit*,GENmodel*,int,IFvalue*);
114 extern int SWmParam(int,IFvalue*,GENmodel*);
115 extern int SWnoise(int,int,GENmodel*,CKTcircuit*,GENERIC*,double*);
116 extern int SWparam(CKTcircuit*,int,IFvalue*,GENinstance*,IFvalue*);
117 extern void SWparse(int,GENERIC*,GENERIC*,GENERIC*);
118 extern int SWpzLoad(GENmodel*,CKTcircuit*,SPcomplex*);
119 extern int SWsetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*);
120 
121 #else /* stdc */
122 
123 extern int SWacLoad();
124 extern int SWask();
125 extern int SWload();
126 extern int SWmAsk();
127 extern int SWmParam();
128 extern int SWnoise();
129 extern int SWparam();
130 extern void SWparse();
131 extern int SWpzLoad();
132 extern int SWsetup();
133 
134 #endif /* stdc */
135 
136 
137 #endif /*SW*/
struct sSWmodel * SWmodPtr
Definition: swdefs.h:19
int SWmParam()
IFuid SWcontName
Definition: swdefs.h:30
double SWiHysteresis
Definition: swdefs.h:71
unsigned SWiHystGiven
Definition: swdefs.h:81
int SWask()
int SWcontBranch
Definition: swdefs.h:29
struct sSWmodel SWmodel
int SWnegNode
Definition: swdefs.h:26
unsigned SWonGiven
Definition: swdefs.h:76
struct sSWinstance SWinstance
double SWonResistance
Definition: swdefs.h:66
unsigned SWiThreshGiven
Definition: swdefs.h:80
int SWposCntrlNode
Definition: swdefs.h:27
unsigned SWoffGiven
Definition: swdefs.h:77
unsigned SWzero_stateGiven
Definition: swdefs.h:43
int SWnegCntrlNode
Definition: swdefs.h:28
int SWmAsk()
GENERIC * IFuid
Definition: ifsim.h:72
double SWvHysteresis
Definition: swdefs.h:69
double * SWposNegptr
Definition: swdefs.h:36
double SWvThreshold
Definition: swdefs.h:68
int SWload()
double SWnVar[NSTATVARS]
Definition: swdefs.h:45
double SWonConduct
Definition: swdefs.h:72
struct sSWinstance * SWnextInstance
Definition: swdefs.h:20
int SWacLoad()
int SWstate
Definition: swdefs.h:23
double * SWnegPosptr
Definition: swdefs.h:34
int SWparam()
int SWpzLoad()
double * SWnegNegptr
Definition: swdefs.h:38
unsigned SWvHystGiven
Definition: swdefs.h:79
int SWnoise()
SWinstance * SWinstances
Definition: swdefs.h:62
double * SWposPosptr
Definition: swdefs.h:32
int SWmodType
Definition: swdefs.h:59
IFuid SWname
Definition: swdefs.h:22
double SWiThreshold
Definition: swdefs.h:70
int SWsetup()
double SWoffConduct
Definition: swdefs.h:73
int SWposNode
Definition: swdefs.h:25
IFuid SWmodName
Definition: swdefs.h:64
void SWparse()
#define NSTATVARS
Definition: cktdefs.h:21
struct sSWmodel * SWnextModel
Definition: swdefs.h:60
#define SMPmatrix
Definition: smpdefs.h:11
double SWoffResistance
Definition: swdefs.h:67
unsigned SWvThreshGiven
Definition: swdefs.h:78
double SWcond
Definition: swdefs.h:41
char GENERIC
Definition: ifsim.h:27