1 /***************************************************************************
2 JSPICE3 adaptation of Spice3e2 - Copyright (c) Stephen R. Whiteley 1992
3 Author: 1992 Stephen R. Whiteley
4 ****************************************************************************/
5 
6 #ifndef JJ
7 #define JJ
8 
9 #include "devdefs.h"
10 
11 /* data structures used to describe Jopsephson junctions */
12 
13 /* information needed per instance */
14 
15 typedef struct sJJinstance {
16     struct sJJmodel *JJmodPtr;     /* backpointer to model */
17     struct sJJinstance *JJnextInstance;   /* pointer to next instance of
18                                            * current model */
19     IFuid JJname;                  /* pointer to character string naming
20                                     * this instance */
21     int JJstate;                   /* pointer to start of state vector for
22                                     * junction */
23     int JJposNode;                 /* number of positive node of junction */
24     int JJnegNode;                 /* number of negative node of junction */
25     int JJphsNode;                 /* number of phase node of junction */
26     int JJbranch;                  /* number of control current branch */
27     IFuid JJcontrol;               /* name of controlling device */
28     double JJarea;                 /* area factor for the junction */
29 
30     double JJinitCnd[2];           /* initial condition vector */
31 #define JJinitVoltage JJinitCnd[0]
32 #define JJinitPhase JJinitCnd[1]
33 
34     double JJinitControl;          /* initial control current */
35 
36     double JJdelVdelT;             /* dvdt storage */
37 
38     /* These parameters scale with area */
39     double JJcriti;                /* junction critical current */
40     double JJcap;                  /* junction capacitance */
41     double JJg0;                   /* junction subgap conductance */
42     double JJgn;                   /* junction normal conductance */
43     double JJgs;                   /* junction step conductance */
44     double JJg1;                   /* NbN model parameter */
45     double JJg2;                   /* NbN model parameter */
46 
47     double *JJposNegPtr;           /* pointer to sparse matrix at
48                                     * (positive, negative) */
49     double *JJnegPosPtr;           /* pointer to sparse matrix at
50                                     * (negative, positive) */
51     double *JJposPosPtr;           /* pointer to sparse matrix at
52                                     * (positive, positive) */
53     double *JJnegNegPtr;           /* pointer to sparse matrix at
54                                     * (negative, negative) */
55     double *JJphsPhsPtr;           /* pointer to sparse matrix at
56                                     * (phase, phase) */
57     double *JJposIbrPtr;           /* pointer to sparse matrix at
58                                     * (positive, branch equation) */
59     double *JJnegIbrPtr;           /* pointer to sparse matrix at
60                                     * (negative, branch equation) */
61     int JJtopcod;                  /* connection topology code */
62     unsigned JJareaGiven : 1;      /* flag to indicate area was specified */
63     unsigned JJinitVoltGiven : 1;  /* flag to indicate ic was specified   */
64     unsigned JJinitPhaseGiven : 1; /* flag to indicate ic was specified   */
65     unsigned JJcontrolGiven : 1;   /* control ind or vsource specified    */
66 
67 } JJinstance;
68 
69 
70 #define JJvoltage JJstate
71 #define JJdvdt    JJstate + 1
72 #define JJphase   JJstate + 2
73 #define JJconI    JJstate + 3
74 #define JJphsInt  JJstate + 4
75 #define JJxtra1   JJstate + 5
76 #define JJxtra2   JJstate + 6
77 
78 /* per model data */
79 
80 typedef struct sJJmodel {          /* model structure for a junction */
81     int JJmodType;                 /* type index of this device */
82     struct sJJmodel *JJnextModel;  /* pointer to next possible model in
83                                     * linked list */
84     JJinstance * JJinstances;      /* pointer to list of instances
85                                     * that have this model */
86     IFuid JJmodName;               /* pointer to character string naming
87                                     * this model */
88     int JJrtype;
89     int JJictype;
90     double JJvg;
91     double JJdelv;
92     double JJcriti;
93     double JJcap;
94     double JJr0;
95     double JJrn;
96     double JJccsens;
97     double JJvless;
98     double JJvmore;
99     double JJvdpbak;
100     unsigned JJrtypeGiven : 1;
101     unsigned JJictypeGiven : 1;
102     unsigned JJvgGiven : 1;
103     unsigned JJdelvGiven : 1;
104     unsigned JJccsensGiven : 1;
105     unsigned JJr0Given : 1;
106     unsigned JJrnGiven : 1;
107     unsigned JJcritiGiven : 1;
108     unsigned JJcapGiven : 1;
109 
110 } JJmodel;
111 
112 
113 /* from jspice2
114 #define JJcphi 3.291090738e-16
115 */
116 /* from jsim */
117 #define JJcphi 3.291086546e-16
118 
119 extern double JJdphi;        /* max phase change between time points */
120 
121 /* device parameters */
122 #define JJ_AREA 1
123 #define JJ_IC   2
124 #define JJ_ICP  3
125 #define JJ_ICV  4
126 #define JJ_CON  5
127 
128 /* device questions */
129 
130 #define JJ_QUEST_CRT 6
131 #define JJ_QUEST_CAP 7
132 #define JJ_QUEST_G0  8
133 #define JJ_QUEST_GN  9
134 #define JJ_QUEST_GS  10
135 #define JJ_QUEST_G1  11
136 #define JJ_QUEST_G2  12
137 
138 /* model parameters */
139 
140 #define JJ_MOD_RT  101
141 #define JJ_MOD_IC  102
142 #define JJ_MOD_VG  103
143 #define JJ_MOD_DV  104
144 #define JJ_MOD_CRT 105
145 #define JJ_MOD_CAP 106
146 #define JJ_MOD_R0  107
147 #define JJ_MOD_RN  108
148 #define JJ_MOD_CCS 109
149 #define JJ_MOD_JJ  113
150 
151 /* model questions */
152 
153 #define JJ_MQUEST_VL  110
154 #define JJ_MQUEST_VM  111
155 #define JJ_MQUEST_VDP 112
156 
157 #ifdef __STDC__
158 
159 extern int  JJaccept(CKTcircuit*,GENmodel*);
160 extern int  JJask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*);
161 extern int  JJgetic(GENmodel*,CKTcircuit*);
162 extern int  JJload(GENmodel*,CKTcircuit*);
163 extern int  JJmAsk(CKTcircuit*,GENmodel*,int,IFvalue*);
164 extern int  JJmParam(int,IFvalue*,GENmodel*);
165 extern int  JJparam(CKTcircuit*,int,IFvalue*,GENinstance*,IFvalue*);
166 extern void JJparse(int,GENERIC*,GENERIC*,GENERIC*);
167 extern int  JJsetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*);
168 extern int  JJtrunc(GENmodel*,CKTcircuit*,double*);
169 
170 #else /* stdc */
171 
172 extern int  JJaccept();
173 extern int  JJask();
174 extern int  JJgetic();
175 extern int  JJload();
176 extern int  JJmAsk();
177 extern int  JJmParam();
178 extern int  JJparam();
179 extern void JJparse();
180 extern int  JJsetup();
181 extern int  JJtrunc();
182 
183 #endif /* stdc */
184 
185 #endif /*JJ*/
186