Xyce  6.1
N_DEV_ADMSbjt504va.h
Go to the documentation of this file.
1 
2 // -*-c++-*-
3 //-----------------------------------------------------------------------------
4 // Copyright Notice
5 //
6 // Copyright 2002 Sandia Corporation. Under the terms
7 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
8 // Government retains certain rights in this software.
9 //
10 // Xyce(TM) Parallel Electrical Simulator
11 // Copyright (C) 2002-2015 Sandia Corporation
12 //
13 // This program is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // This program is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program. If not, see <http://www.gnu.org/licenses/>.
25 //-----------------------------------------------------------------------------
26 
27 //-----------------------------------------------------------------------------
28 // Filename : $RCSfile: N_DEV_ADMSbjt504va.h,v $
29 //
30 // Purpose :
31 //
32 // Special Notes : Generated from verilog file bjt504.va with ADMS
33 // interface for Xyce 6.4.0
34 // DO NOT EDIT THIS FILE DIRECTLY! It may be overwritten!
35 //
36 // Creator : admsXml-2.3.4
37 //
38 // Creation Date : Wed, 04 Nov 2015 14:10:20
39 //
40 // Revision Information:
41 // ---------------------
42 //
43 // Revision Number: $Revision: 1.9 $
44 //
45 // Revision Date : $Date: 2015/11/04 21:33:46 $
46 //
47 // Current Owner : $Author: tvrusso $
48 //-----------------------------------------------------------------------------
49 #ifndef Xyce_N_DEV_ADMSbjt504va_h
50 #define Xyce_N_DEV_ADMSbjt504va_h
51 
52 
53 #include <Sacado.hpp>
54 
55 #include <N_DEV_Configuration.h>
56 #include <N_DEV_Const.h>
57 #include <N_DEV_DeviceBlock.h>
58 #include <N_DEV_DeviceInstance.h>
59 #include <N_DEV_DeviceModel.h>
60 #include <N_DEV_BJT.h>
61 
62 
63 namespace Xyce {
64 namespace Device {
65 namespace ADMSbjt504va {
66 
67 // This typedef is for our automatic differentiation:
68 typedef Sacado::Fad::SFad<double,15> AdmsFadType;
69 typedef Sacado::Fad::SFad<double,1> AdmsSensFadType;
70 
71 class Model;
72 class Instance;
73 class InstanceSensitivity;
74 
75 #ifdef Xyce_ADMS_SENSITIVITIES
76 //-----------------------------------------------------------------------------
77 // Class : InstanceSensitivity
78 //
79 // Purpose : This class is a functor for sensitivity
80 //
81 // Special Notes :
82 // Creator :
83 // Creation Date :
84 //-----------------------------------------------------------------------------
85 class InstanceSensitivity : public baseSensitivity
86 {
87 public:
88  InstanceSensitivity() :
89  baseSensitivity() {};
90 
91  virtual ~InstanceSensitivity() {};
92 
93  virtual void operator()(
94  const ParameterBase &entity,
95  const std::string &param,
96  std::vector<double> & dfdp,
97  std::vector<double> & dqdp,
98  std::vector<double> & dbdp,
99  std::vector<int> & Findices,
100  std::vector<int> & Qindices,
101  std::vector<int> & Bindices
102  ) const ;
103 };
104 
105 static InstanceSensitivity instSens;
106 
107 
108 //-----------------------------------------------------------------------------
109 // Class : ModelSensitivity
110 //
111 // Purpose : This class is a functor for sensitivity
112 //
113 // Special Notes :
114 // Creator :
115 // Creation Date :
116 //-----------------------------------------------------------------------------
117 class ModelSensitivity : public baseSensitivity
118 {
119 public:
120  ModelSensitivity() :
121  baseSensitivity() {};
122 
123  virtual ~ModelSensitivity() {};
124 
125  virtual void operator()(
126  const ParameterBase &entity,
127  const std::string &param,
128  std::vector<double> & dfdp,
129  std::vector<double> & dqdp,
130  std::vector<double> & dbdp,
131  std::vector<int> & Findices,
132  std::vector<int> & Qindices,
133  std::vector<int> & Bindices
134  ) const ;
135 };
136 
137 static ModelSensitivity modSens;
138 #endif // Xyce_ADMS_SENSITIVITIES
139 
140 // general purpose free functions
141 // thermal voltage at kelvin temperature temp)
142 template <typename T> static inline T adms_vt(const T temp) {return(CONSTKoverQ*temp);};
143 
144 // Figure out how to template this shiznit!
145 //-----------------------------------------------------------------------------
146 
147 
148 template<typename Tin>
149 static Tin adms_ternary_op(const bool cond, const Tin &ifTrue, const Tin &ifFalse)
150 {
151  if (cond)
152  return ifTrue;
153  else
154  return ifFalse;
155 }
156 
157 template<typename Tin>
158 static Tin adms_ternary_op(const bool cond, const Tin &ifTrue, const double &ifFalse)
159 {
160  if (cond)
161  return ifTrue;
162  else
163  return Tin(ifFalse);
164 }
165 
166 template<typename Tin>
167 static Tin adms_ternary_op(const bool cond, const double &ifTrue, const Tin &ifFalse)
168 {
169  if (cond)
170  return Tin(ifTrue);
171  else
172  return ifFalse;
173 }
174 
175 
176 
177 
178 #ifdef Xyce_ADMS_SENSITIVITIES
179 //-----------------------------------------------------------------------------
180 // Free functions used by sensitivity
181 //
182 //-----------------------------------------------------------------------------
183 void evaluateModelEquations(
184  std::vector <double> & probeVars,
185  // probe constants
186  const int admsProbeID_V_noi_e1,
187  const int admsProbeID_V_c3_c1,
188  const int admsProbeID_V_c3_c4,
189  const int admsProbeID_V_c4_c1,
190  const int admsProbeID_V_b_c,
191  const int admsProbeID_V_b_e,
192  const int admsProbeID_V_b_b1,
193  const int admsProbeID_V_e_e1,
194  const int admsProbeID_V_c1_c2,
195  const int admsProbeID_V_s_c1,
196  const int admsProbeID_V_b1_b2,
197  const int admsProbeID_V_b1_e1,
198  const int admsProbeID_V_b2_e1,
199  const int admsProbeID_V_b2_c2,
200  const int admsProbeID_V_b2_c1,
201  // node constants
202  const int admsNodeID_c,
203  const int admsNodeID_b,
204  const int admsNodeID_e,
205  const int admsNodeID_s,
206  const int admsNodeID_e1,
207  const int admsNodeID_b1,
208  const int admsNodeID_b2,
209  const int admsNodeID_c3,
210  const int admsNodeID_c4,
211  const int admsNodeID_c2,
212  const int admsNodeID_c1,
213  const int admsNodeID_noi,
214  // instance parameters
215  // reals
216  AdmsSensFadType & instancePar_MULT,
217  bool instancePar_given_MULT,
218  // instance variables
219  // reals
220  AdmsSensFadType & instanceVar_Izteb,
221  AdmsSensFadType & instanceVar_qBI,
222  AdmsSensFadType & instanceVar_Ir,
223  AdmsSensFadType & instanceVar_If,
224  AdmsSensFadType & instanceVar_Ib1,
225  AdmsSensFadType & instanceVar_Ib1_s,
226  AdmsSensFadType & instanceVar_Ib2,
227  AdmsSensFadType & instanceVar_Ib3,
228  AdmsSensFadType & instanceVar_Iex,
229  AdmsSensFadType & instanceVar_XIex,
230  AdmsSensFadType & instanceVar_Isub,
231  AdmsSensFadType & instanceVar_XIsub,
232  AdmsSensFadType & instanceVar_Rb2,
233  AdmsSensFadType & instanceVar_Gem,
234  AdmsSensFadType & instanceVar_eVb1b2,
235  // model parameters
236  // reals
237  AdmsSensFadType & modelPar_TREF,
238  bool modelPar_given_TREF,
239  AdmsSensFadType & modelPar_DTA,
240  bool modelPar_given_DTA,
241  AdmsSensFadType & modelPar_IS,
242  bool modelPar_given_IS,
243  AdmsSensFadType & modelPar_IK,
244  bool modelPar_given_IK,
245  AdmsSensFadType & modelPar_VER,
246  bool modelPar_given_VER,
247  AdmsSensFadType & modelPar_VEF,
248  bool modelPar_given_VEF,
249  AdmsSensFadType & modelPar_BF,
250  bool modelPar_given_BF,
251  AdmsSensFadType & modelPar_IBF,
252  bool modelPar_given_IBF,
253  AdmsSensFadType & modelPar_MLF,
254  bool modelPar_given_MLF,
255  AdmsSensFadType & modelPar_XIBI,
256  bool modelPar_given_XIBI,
257  AdmsSensFadType & modelPar_IZEB,
258  bool modelPar_given_IZEB,
259  AdmsSensFadType & modelPar_NZEB,
260  bool modelPar_given_NZEB,
261  AdmsSensFadType & modelPar_BRI,
262  bool modelPar_given_BRI,
263  AdmsSensFadType & modelPar_IBR,
264  bool modelPar_given_IBR,
265  AdmsSensFadType & modelPar_VLR,
266  bool modelPar_given_VLR,
267  AdmsSensFadType & modelPar_XEXT,
268  bool modelPar_given_XEXT,
269  AdmsSensFadType & modelPar_WAVL,
270  bool modelPar_given_WAVL,
271  AdmsSensFadType & modelPar_VAVL,
272  bool modelPar_given_VAVL,
273  AdmsSensFadType & modelPar_SFH,
274  bool modelPar_given_SFH,
275  AdmsSensFadType & modelPar_RE,
276  bool modelPar_given_RE,
277  AdmsSensFadType & modelPar_RBC,
278  bool modelPar_given_RBC,
279  AdmsSensFadType & modelPar_RBV,
280  bool modelPar_given_RBV,
281  AdmsSensFadType & modelPar_RCC,
282  bool modelPar_given_RCC,
283  AdmsSensFadType & modelPar_RCV,
284  bool modelPar_given_RCV,
285  AdmsSensFadType & modelPar_SCRCV,
286  bool modelPar_given_SCRCV,
287  AdmsSensFadType & modelPar_IHC,
288  bool modelPar_given_IHC,
289  AdmsSensFadType & modelPar_AXI,
290  bool modelPar_given_AXI,
291  AdmsSensFadType & modelPar_CJE,
292  bool modelPar_given_CJE,
293  AdmsSensFadType & modelPar_VDE,
294  bool modelPar_given_VDE,
295  AdmsSensFadType & modelPar_PE,
296  bool modelPar_given_PE,
297  AdmsSensFadType & modelPar_XCJE,
298  bool modelPar_given_XCJE,
299  AdmsSensFadType & modelPar_CBEO,
300  bool modelPar_given_CBEO,
301  AdmsSensFadType & modelPar_CJC,
302  bool modelPar_given_CJC,
303  AdmsSensFadType & modelPar_VDC,
304  bool modelPar_given_VDC,
305  AdmsSensFadType & modelPar_PC,
306  bool modelPar_given_PC,
307  AdmsSensFadType & modelPar_XP,
308  bool modelPar_given_XP,
309  AdmsSensFadType & modelPar_MC,
310  bool modelPar_given_MC,
311  AdmsSensFadType & modelPar_XCJC,
312  bool modelPar_given_XCJC,
313  AdmsSensFadType & modelPar_RCBLX,
314  bool modelPar_given_RCBLX,
315  AdmsSensFadType & modelPar_RCBLI,
316  bool modelPar_given_RCBLI,
317  AdmsSensFadType & modelPar_CBCO,
318  bool modelPar_given_CBCO,
319  AdmsSensFadType & modelPar_MTAU,
320  bool modelPar_given_MTAU,
321  AdmsSensFadType & modelPar_TAUE,
322  bool modelPar_given_TAUE,
323  AdmsSensFadType & modelPar_TAUB,
324  bool modelPar_given_TAUB,
325  AdmsSensFadType & modelPar_TEPI,
326  bool modelPar_given_TEPI,
327  AdmsSensFadType & modelPar_TAUR,
328  bool modelPar_given_TAUR,
329  AdmsSensFadType & modelPar_DEG,
330  bool modelPar_given_DEG,
331  AdmsSensFadType & modelPar_XREC,
332  bool modelPar_given_XREC,
333  AdmsSensFadType & modelPar_AQBO,
334  bool modelPar_given_AQBO,
335  AdmsSensFadType & modelPar_AE,
336  bool modelPar_given_AE,
337  AdmsSensFadType & modelPar_AB,
338  bool modelPar_given_AB,
339  AdmsSensFadType & modelPar_AEPI,
340  bool modelPar_given_AEPI,
341  AdmsSensFadType & modelPar_AEX,
342  bool modelPar_given_AEX,
343  AdmsSensFadType & modelPar_AC,
344  bool modelPar_given_AC,
345  AdmsSensFadType & modelPar_ACBL,
346  bool modelPar_given_ACBL,
347  AdmsSensFadType & modelPar_DVGBF,
348  bool modelPar_given_DVGBF,
349  AdmsSensFadType & modelPar_DVGBR,
350  bool modelPar_given_DVGBR,
351  AdmsSensFadType & modelPar_VGB,
352  bool modelPar_given_VGB,
353  AdmsSensFadType & modelPar_VGC,
354  bool modelPar_given_VGC,
355  AdmsSensFadType & modelPar_VGJ,
356  bool modelPar_given_VGJ,
357  AdmsSensFadType & modelPar_VGZEB,
358  bool modelPar_given_VGZEB,
359  AdmsSensFadType & modelPar_AVGEB,
360  bool modelPar_given_AVGEB,
361  AdmsSensFadType & modelPar_TVGEB,
362  bool modelPar_given_TVGEB,
363  AdmsSensFadType & modelPar_DVGTE,
364  bool modelPar_given_DVGTE,
365  AdmsSensFadType & modelPar_DAIS,
366  bool modelPar_given_DAIS,
367  AdmsSensFadType & modelPar_AF,
368  bool modelPar_given_AF,
369  AdmsSensFadType & modelPar_KF,
370  bool modelPar_given_KF,
371  AdmsSensFadType & modelPar_KFN,
372  bool modelPar_given_KFN,
373  AdmsSensFadType & modelPar_ISS,
374  bool modelPar_given_ISS,
375  AdmsSensFadType & modelPar_ICSS,
376  bool modelPar_given_ICSS,
377  AdmsSensFadType & modelPar_IKS,
378  bool modelPar_given_IKS,
379  AdmsSensFadType & modelPar_CJS,
380  bool modelPar_given_CJS,
381  AdmsSensFadType & modelPar_VDS,
382  bool modelPar_given_VDS,
383  AdmsSensFadType & modelPar_PS,
384  bool modelPar_given_PS,
385  AdmsSensFadType & modelPar_VGS,
386  bool modelPar_given_VGS,
387  AdmsSensFadType & modelPar_AS,
388  bool modelPar_given_AS,
389  AdmsSensFadType & modelPar_ASUB,
390  bool modelPar_given_ASUB,
391  AdmsSensFadType & modelPar_MULT,
392  bool modelPar_given_MULT,
393  AdmsSensFadType & modelPar_GMIN,
394  bool modelPar_given_GMIN,
395  // non-reals (including hidden)
396  int modelPar_LEVEL,
397  bool modelPar_given_LEVEL,
398  int modelPar_EXMOD,
399  bool modelPar_given_EXMOD,
400  int modelPar_EXPHI,
401  bool modelPar_given_EXPHI,
402  int modelPar_EXAVL,
403  bool modelPar_given_EXAVL,
404  int modelPar_EXSUB,
405  bool modelPar_given_EXSUB,
406  int modelPar_KAVL,
407  bool modelPar_given_KAVL,
408  int modelPar_TYPE,
409  bool modelPar_given_TYPE// model variables
410  ,
411  // reals
412  AdmsSensFadType & modelVar_An,
413  AdmsSensFadType & modelVar_Tk,
414  AdmsSensFadType & modelVar_Vt,
415  AdmsSensFadType & modelVar_VtINV,
416  AdmsSensFadType & modelVar_VDE_T,
417  AdmsSensFadType & modelVar_VDC_T,
418  AdmsSensFadType & modelVar_XP_T,
419  AdmsSensFadType & modelVar_BF_T,
420  AdmsSensFadType & modelVar_BRI_T,
421  AdmsSensFadType & modelVar_IS_T,
422  AdmsSensFadType & modelVar_VEF_T,
423  AdmsSensFadType & modelVar_VER_T,
424  AdmsSensFadType & modelVar_nZEB_T,
425  AdmsSensFadType & modelVar_pow2_2mPE,
426  AdmsSensFadType & modelVar_pow2_PEm2,
427  AdmsSensFadType & modelVar_inv_VDE_T,
428  AdmsSensFadType & modelVar_VGZEB_T,
429  AdmsSensFadType & modelVar_TAUE_T,
430  AdmsSensFadType & modelVar_TAUB_T,
431  AdmsSensFadType & modelVar_TEPI_T,
432  AdmsSensFadType & modelVar_TAUR_T,
433  AdmsSensFadType & modelVar_BnT,
434  AdmsSensFadType & modelVar_DEG_T,
435  AdmsSensFadType & modelVar_VDS_T,
436  AdmsSensFadType & modelVar_IKS_T,
437  AdmsSensFadType & modelVar_IS_TM,
438  AdmsSensFadType & modelVar_IK_TM,
439  AdmsSensFadType & modelVar_IBF_TM,
440  AdmsSensFadType & modelVar_IBR_TM,
441  AdmsSensFadType & modelVar_IHC_M,
442  AdmsSensFadType & modelVar_IZEB_TM,
443  AdmsSensFadType & modelVar_CJE_TM,
444  AdmsSensFadType & modelVar_CJC_TM,
445  AdmsSensFadType & modelVar_RE_TM,
446  AdmsSensFadType & modelVar_RBC_TM,
447  AdmsSensFadType & modelVar_RBV_TM,
448  AdmsSensFadType & modelVar_RCV_TM,
449  AdmsSensFadType & modelVar_SCRCV_M,
450  AdmsSensFadType & modelVar_RCCxx_TM,
451  AdmsSensFadType & modelVar_GCCxx_TM,
452  AdmsSensFadType & modelVar_GCCex_TM,
453  AdmsSensFadType & modelVar_GCCin_TM,
454  AdmsSensFadType & modelVar_KF_M,
455  AdmsSensFadType & modelVar_KFN_M,
456  AdmsSensFadType & modelVar_ISS_TM,
457  AdmsSensFadType & modelVar_ICSS_TM,
458  AdmsSensFadType & modelVar_IKS_TM,
459  AdmsSensFadType & modelVar_CJS_TM,
460  AdmsSensFadType & modelVar_Xext1,
461  AdmsSensFadType & modelVar_CBEO_M,
462  AdmsSensFadType & modelVar_CBCO_M,
463  // basic variables
464  double admsTemperature, double adms_vt_nom, double gmin, std::vector <AdmsSensFadType> & staticContributions, std::vector <AdmsSensFadType> & dynamicContributions, const Instance & theInstance);
465 
466 void evaluateInitialInstance(
467  // instance parameters
468  // reals
469  AdmsSensFadType & instancePar_MULT,
470  bool instancePar_given_MULT,
471  // instance variables
472  // reals
473  AdmsSensFadType & instanceVar_Izteb,
474  AdmsSensFadType & instanceVar_qBI,
475  AdmsSensFadType & instanceVar_Ir,
476  AdmsSensFadType & instanceVar_If,
477  AdmsSensFadType & instanceVar_Ib1,
478  AdmsSensFadType & instanceVar_Ib1_s,
479  AdmsSensFadType & instanceVar_Ib2,
480  AdmsSensFadType & instanceVar_Ib3,
481  AdmsSensFadType & instanceVar_Iex,
482  AdmsSensFadType & instanceVar_XIex,
483  AdmsSensFadType & instanceVar_Isub,
484  AdmsSensFadType & instanceVar_XIsub,
485  AdmsSensFadType & instanceVar_Rb2,
486  AdmsSensFadType & instanceVar_Gem,
487  AdmsSensFadType & instanceVar_eVb1b2,
488  // model parameters
489  // reals
490  AdmsSensFadType & modelPar_TREF,
491  bool modelPar_given_TREF,
492  AdmsSensFadType & modelPar_DTA,
493  bool modelPar_given_DTA,
494  AdmsSensFadType & modelPar_IS,
495  bool modelPar_given_IS,
496  AdmsSensFadType & modelPar_IK,
497  bool modelPar_given_IK,
498  AdmsSensFadType & modelPar_VER,
499  bool modelPar_given_VER,
500  AdmsSensFadType & modelPar_VEF,
501  bool modelPar_given_VEF,
502  AdmsSensFadType & modelPar_BF,
503  bool modelPar_given_BF,
504  AdmsSensFadType & modelPar_IBF,
505  bool modelPar_given_IBF,
506  AdmsSensFadType & modelPar_MLF,
507  bool modelPar_given_MLF,
508  AdmsSensFadType & modelPar_XIBI,
509  bool modelPar_given_XIBI,
510  AdmsSensFadType & modelPar_IZEB,
511  bool modelPar_given_IZEB,
512  AdmsSensFadType & modelPar_NZEB,
513  bool modelPar_given_NZEB,
514  AdmsSensFadType & modelPar_BRI,
515  bool modelPar_given_BRI,
516  AdmsSensFadType & modelPar_IBR,
517  bool modelPar_given_IBR,
518  AdmsSensFadType & modelPar_VLR,
519  bool modelPar_given_VLR,
520  AdmsSensFadType & modelPar_XEXT,
521  bool modelPar_given_XEXT,
522  AdmsSensFadType & modelPar_WAVL,
523  bool modelPar_given_WAVL,
524  AdmsSensFadType & modelPar_VAVL,
525  bool modelPar_given_VAVL,
526  AdmsSensFadType & modelPar_SFH,
527  bool modelPar_given_SFH,
528  AdmsSensFadType & modelPar_RE,
529  bool modelPar_given_RE,
530  AdmsSensFadType & modelPar_RBC,
531  bool modelPar_given_RBC,
532  AdmsSensFadType & modelPar_RBV,
533  bool modelPar_given_RBV,
534  AdmsSensFadType & modelPar_RCC,
535  bool modelPar_given_RCC,
536  AdmsSensFadType & modelPar_RCV,
537  bool modelPar_given_RCV,
538  AdmsSensFadType & modelPar_SCRCV,
539  bool modelPar_given_SCRCV,
540  AdmsSensFadType & modelPar_IHC,
541  bool modelPar_given_IHC,
542  AdmsSensFadType & modelPar_AXI,
543  bool modelPar_given_AXI,
544  AdmsSensFadType & modelPar_CJE,
545  bool modelPar_given_CJE,
546  AdmsSensFadType & modelPar_VDE,
547  bool modelPar_given_VDE,
548  AdmsSensFadType & modelPar_PE,
549  bool modelPar_given_PE,
550  AdmsSensFadType & modelPar_XCJE,
551  bool modelPar_given_XCJE,
552  AdmsSensFadType & modelPar_CBEO,
553  bool modelPar_given_CBEO,
554  AdmsSensFadType & modelPar_CJC,
555  bool modelPar_given_CJC,
556  AdmsSensFadType & modelPar_VDC,
557  bool modelPar_given_VDC,
558  AdmsSensFadType & modelPar_PC,
559  bool modelPar_given_PC,
560  AdmsSensFadType & modelPar_XP,
561  bool modelPar_given_XP,
562  AdmsSensFadType & modelPar_MC,
563  bool modelPar_given_MC,
564  AdmsSensFadType & modelPar_XCJC,
565  bool modelPar_given_XCJC,
566  AdmsSensFadType & modelPar_RCBLX,
567  bool modelPar_given_RCBLX,
568  AdmsSensFadType & modelPar_RCBLI,
569  bool modelPar_given_RCBLI,
570  AdmsSensFadType & modelPar_CBCO,
571  bool modelPar_given_CBCO,
572  AdmsSensFadType & modelPar_MTAU,
573  bool modelPar_given_MTAU,
574  AdmsSensFadType & modelPar_TAUE,
575  bool modelPar_given_TAUE,
576  AdmsSensFadType & modelPar_TAUB,
577  bool modelPar_given_TAUB,
578  AdmsSensFadType & modelPar_TEPI,
579  bool modelPar_given_TEPI,
580  AdmsSensFadType & modelPar_TAUR,
581  bool modelPar_given_TAUR,
582  AdmsSensFadType & modelPar_DEG,
583  bool modelPar_given_DEG,
584  AdmsSensFadType & modelPar_XREC,
585  bool modelPar_given_XREC,
586  AdmsSensFadType & modelPar_AQBO,
587  bool modelPar_given_AQBO,
588  AdmsSensFadType & modelPar_AE,
589  bool modelPar_given_AE,
590  AdmsSensFadType & modelPar_AB,
591  bool modelPar_given_AB,
592  AdmsSensFadType & modelPar_AEPI,
593  bool modelPar_given_AEPI,
594  AdmsSensFadType & modelPar_AEX,
595  bool modelPar_given_AEX,
596  AdmsSensFadType & modelPar_AC,
597  bool modelPar_given_AC,
598  AdmsSensFadType & modelPar_ACBL,
599  bool modelPar_given_ACBL,
600  AdmsSensFadType & modelPar_DVGBF,
601  bool modelPar_given_DVGBF,
602  AdmsSensFadType & modelPar_DVGBR,
603  bool modelPar_given_DVGBR,
604  AdmsSensFadType & modelPar_VGB,
605  bool modelPar_given_VGB,
606  AdmsSensFadType & modelPar_VGC,
607  bool modelPar_given_VGC,
608  AdmsSensFadType & modelPar_VGJ,
609  bool modelPar_given_VGJ,
610  AdmsSensFadType & modelPar_VGZEB,
611  bool modelPar_given_VGZEB,
612  AdmsSensFadType & modelPar_AVGEB,
613  bool modelPar_given_AVGEB,
614  AdmsSensFadType & modelPar_TVGEB,
615  bool modelPar_given_TVGEB,
616  AdmsSensFadType & modelPar_DVGTE,
617  bool modelPar_given_DVGTE,
618  AdmsSensFadType & modelPar_DAIS,
619  bool modelPar_given_DAIS,
620  AdmsSensFadType & modelPar_AF,
621  bool modelPar_given_AF,
622  AdmsSensFadType & modelPar_KF,
623  bool modelPar_given_KF,
624  AdmsSensFadType & modelPar_KFN,
625  bool modelPar_given_KFN,
626  AdmsSensFadType & modelPar_ISS,
627  bool modelPar_given_ISS,
628  AdmsSensFadType & modelPar_ICSS,
629  bool modelPar_given_ICSS,
630  AdmsSensFadType & modelPar_IKS,
631  bool modelPar_given_IKS,
632  AdmsSensFadType & modelPar_CJS,
633  bool modelPar_given_CJS,
634  AdmsSensFadType & modelPar_VDS,
635  bool modelPar_given_VDS,
636  AdmsSensFadType & modelPar_PS,
637  bool modelPar_given_PS,
638  AdmsSensFadType & modelPar_VGS,
639  bool modelPar_given_VGS,
640  AdmsSensFadType & modelPar_AS,
641  bool modelPar_given_AS,
642  AdmsSensFadType & modelPar_ASUB,
643  bool modelPar_given_ASUB,
644  AdmsSensFadType & modelPar_MULT,
645  bool modelPar_given_MULT,
646  AdmsSensFadType & modelPar_GMIN,
647  bool modelPar_given_GMIN,
648  // non-reals (including hidden)
649  int modelPar_LEVEL,
650  bool modelPar_given_LEVEL,
651  int modelPar_EXMOD,
652  bool modelPar_given_EXMOD,
653  int modelPar_EXPHI,
654  bool modelPar_given_EXPHI,
655  int modelPar_EXAVL,
656  bool modelPar_given_EXAVL,
657  int modelPar_EXSUB,
658  bool modelPar_given_EXSUB,
659  int modelPar_KAVL,
660  bool modelPar_given_KAVL,
661  int modelPar_TYPE,
662  bool modelPar_given_TYPE// model variables
663  ,
664  // reals
665  AdmsSensFadType & modelVar_An,
666  AdmsSensFadType & modelVar_Tk,
667  AdmsSensFadType & modelVar_Vt,
668  AdmsSensFadType & modelVar_VtINV,
669  AdmsSensFadType & modelVar_VDE_T,
670  AdmsSensFadType & modelVar_VDC_T,
671  AdmsSensFadType & modelVar_XP_T,
672  AdmsSensFadType & modelVar_BF_T,
673  AdmsSensFadType & modelVar_BRI_T,
674  AdmsSensFadType & modelVar_IS_T,
675  AdmsSensFadType & modelVar_VEF_T,
676  AdmsSensFadType & modelVar_VER_T,
677  AdmsSensFadType & modelVar_nZEB_T,
678  AdmsSensFadType & modelVar_pow2_2mPE,
679  AdmsSensFadType & modelVar_pow2_PEm2,
680  AdmsSensFadType & modelVar_inv_VDE_T,
681  AdmsSensFadType & modelVar_VGZEB_T,
682  AdmsSensFadType & modelVar_TAUE_T,
683  AdmsSensFadType & modelVar_TAUB_T,
684  AdmsSensFadType & modelVar_TEPI_T,
685  AdmsSensFadType & modelVar_TAUR_T,
686  AdmsSensFadType & modelVar_BnT,
687  AdmsSensFadType & modelVar_DEG_T,
688  AdmsSensFadType & modelVar_VDS_T,
689  AdmsSensFadType & modelVar_IKS_T,
690  AdmsSensFadType & modelVar_IS_TM,
691  AdmsSensFadType & modelVar_IK_TM,
692  AdmsSensFadType & modelVar_IBF_TM,
693  AdmsSensFadType & modelVar_IBR_TM,
694  AdmsSensFadType & modelVar_IHC_M,
695  AdmsSensFadType & modelVar_IZEB_TM,
696  AdmsSensFadType & modelVar_CJE_TM,
697  AdmsSensFadType & modelVar_CJC_TM,
698  AdmsSensFadType & modelVar_RE_TM,
699  AdmsSensFadType & modelVar_RBC_TM,
700  AdmsSensFadType & modelVar_RBV_TM,
701  AdmsSensFadType & modelVar_RCV_TM,
702  AdmsSensFadType & modelVar_SCRCV_M,
703  AdmsSensFadType & modelVar_RCCxx_TM,
704  AdmsSensFadType & modelVar_GCCxx_TM,
705  AdmsSensFadType & modelVar_GCCex_TM,
706  AdmsSensFadType & modelVar_GCCin_TM,
707  AdmsSensFadType & modelVar_KF_M,
708  AdmsSensFadType & modelVar_KFN_M,
709  AdmsSensFadType & modelVar_ISS_TM,
710  AdmsSensFadType & modelVar_ICSS_TM,
711  AdmsSensFadType & modelVar_IKS_TM,
712  AdmsSensFadType & modelVar_CJS_TM,
713  AdmsSensFadType & modelVar_Xext1,
714  AdmsSensFadType & modelVar_CBEO_M,
715  AdmsSensFadType & modelVar_CBCO_M,
716  double admsTemperature);
717 
718 void evaluateInitialModel(
719  // model parameters
720  // reals
721  AdmsSensFadType & modelPar_TREF,
722  bool modelPar_given_TREF,
723  AdmsSensFadType & modelPar_DTA,
724  bool modelPar_given_DTA,
725  AdmsSensFadType & modelPar_IS,
726  bool modelPar_given_IS,
727  AdmsSensFadType & modelPar_IK,
728  bool modelPar_given_IK,
729  AdmsSensFadType & modelPar_VER,
730  bool modelPar_given_VER,
731  AdmsSensFadType & modelPar_VEF,
732  bool modelPar_given_VEF,
733  AdmsSensFadType & modelPar_BF,
734  bool modelPar_given_BF,
735  AdmsSensFadType & modelPar_IBF,
736  bool modelPar_given_IBF,
737  AdmsSensFadType & modelPar_MLF,
738  bool modelPar_given_MLF,
739  AdmsSensFadType & modelPar_XIBI,
740  bool modelPar_given_XIBI,
741  AdmsSensFadType & modelPar_IZEB,
742  bool modelPar_given_IZEB,
743  AdmsSensFadType & modelPar_NZEB,
744  bool modelPar_given_NZEB,
745  AdmsSensFadType & modelPar_BRI,
746  bool modelPar_given_BRI,
747  AdmsSensFadType & modelPar_IBR,
748  bool modelPar_given_IBR,
749  AdmsSensFadType & modelPar_VLR,
750  bool modelPar_given_VLR,
751  AdmsSensFadType & modelPar_XEXT,
752  bool modelPar_given_XEXT,
753  AdmsSensFadType & modelPar_WAVL,
754  bool modelPar_given_WAVL,
755  AdmsSensFadType & modelPar_VAVL,
756  bool modelPar_given_VAVL,
757  AdmsSensFadType & modelPar_SFH,
758  bool modelPar_given_SFH,
759  AdmsSensFadType & modelPar_RE,
760  bool modelPar_given_RE,
761  AdmsSensFadType & modelPar_RBC,
762  bool modelPar_given_RBC,
763  AdmsSensFadType & modelPar_RBV,
764  bool modelPar_given_RBV,
765  AdmsSensFadType & modelPar_RCC,
766  bool modelPar_given_RCC,
767  AdmsSensFadType & modelPar_RCV,
768  bool modelPar_given_RCV,
769  AdmsSensFadType & modelPar_SCRCV,
770  bool modelPar_given_SCRCV,
771  AdmsSensFadType & modelPar_IHC,
772  bool modelPar_given_IHC,
773  AdmsSensFadType & modelPar_AXI,
774  bool modelPar_given_AXI,
775  AdmsSensFadType & modelPar_CJE,
776  bool modelPar_given_CJE,
777  AdmsSensFadType & modelPar_VDE,
778  bool modelPar_given_VDE,
779  AdmsSensFadType & modelPar_PE,
780  bool modelPar_given_PE,
781  AdmsSensFadType & modelPar_XCJE,
782  bool modelPar_given_XCJE,
783  AdmsSensFadType & modelPar_CBEO,
784  bool modelPar_given_CBEO,
785  AdmsSensFadType & modelPar_CJC,
786  bool modelPar_given_CJC,
787  AdmsSensFadType & modelPar_VDC,
788  bool modelPar_given_VDC,
789  AdmsSensFadType & modelPar_PC,
790  bool modelPar_given_PC,
791  AdmsSensFadType & modelPar_XP,
792  bool modelPar_given_XP,
793  AdmsSensFadType & modelPar_MC,
794  bool modelPar_given_MC,
795  AdmsSensFadType & modelPar_XCJC,
796  bool modelPar_given_XCJC,
797  AdmsSensFadType & modelPar_RCBLX,
798  bool modelPar_given_RCBLX,
799  AdmsSensFadType & modelPar_RCBLI,
800  bool modelPar_given_RCBLI,
801  AdmsSensFadType & modelPar_CBCO,
802  bool modelPar_given_CBCO,
803  AdmsSensFadType & modelPar_MTAU,
804  bool modelPar_given_MTAU,
805  AdmsSensFadType & modelPar_TAUE,
806  bool modelPar_given_TAUE,
807  AdmsSensFadType & modelPar_TAUB,
808  bool modelPar_given_TAUB,
809  AdmsSensFadType & modelPar_TEPI,
810  bool modelPar_given_TEPI,
811  AdmsSensFadType & modelPar_TAUR,
812  bool modelPar_given_TAUR,
813  AdmsSensFadType & modelPar_DEG,
814  bool modelPar_given_DEG,
815  AdmsSensFadType & modelPar_XREC,
816  bool modelPar_given_XREC,
817  AdmsSensFadType & modelPar_AQBO,
818  bool modelPar_given_AQBO,
819  AdmsSensFadType & modelPar_AE,
820  bool modelPar_given_AE,
821  AdmsSensFadType & modelPar_AB,
822  bool modelPar_given_AB,
823  AdmsSensFadType & modelPar_AEPI,
824  bool modelPar_given_AEPI,
825  AdmsSensFadType & modelPar_AEX,
826  bool modelPar_given_AEX,
827  AdmsSensFadType & modelPar_AC,
828  bool modelPar_given_AC,
829  AdmsSensFadType & modelPar_ACBL,
830  bool modelPar_given_ACBL,
831  AdmsSensFadType & modelPar_DVGBF,
832  bool modelPar_given_DVGBF,
833  AdmsSensFadType & modelPar_DVGBR,
834  bool modelPar_given_DVGBR,
835  AdmsSensFadType & modelPar_VGB,
836  bool modelPar_given_VGB,
837  AdmsSensFadType & modelPar_VGC,
838  bool modelPar_given_VGC,
839  AdmsSensFadType & modelPar_VGJ,
840  bool modelPar_given_VGJ,
841  AdmsSensFadType & modelPar_VGZEB,
842  bool modelPar_given_VGZEB,
843  AdmsSensFadType & modelPar_AVGEB,
844  bool modelPar_given_AVGEB,
845  AdmsSensFadType & modelPar_TVGEB,
846  bool modelPar_given_TVGEB,
847  AdmsSensFadType & modelPar_DVGTE,
848  bool modelPar_given_DVGTE,
849  AdmsSensFadType & modelPar_DAIS,
850  bool modelPar_given_DAIS,
851  AdmsSensFadType & modelPar_AF,
852  bool modelPar_given_AF,
853  AdmsSensFadType & modelPar_KF,
854  bool modelPar_given_KF,
855  AdmsSensFadType & modelPar_KFN,
856  bool modelPar_given_KFN,
857  AdmsSensFadType & modelPar_ISS,
858  bool modelPar_given_ISS,
859  AdmsSensFadType & modelPar_ICSS,
860  bool modelPar_given_ICSS,
861  AdmsSensFadType & modelPar_IKS,
862  bool modelPar_given_IKS,
863  AdmsSensFadType & modelPar_CJS,
864  bool modelPar_given_CJS,
865  AdmsSensFadType & modelPar_VDS,
866  bool modelPar_given_VDS,
867  AdmsSensFadType & modelPar_PS,
868  bool modelPar_given_PS,
869  AdmsSensFadType & modelPar_VGS,
870  bool modelPar_given_VGS,
871  AdmsSensFadType & modelPar_AS,
872  bool modelPar_given_AS,
873  AdmsSensFadType & modelPar_ASUB,
874  bool modelPar_given_ASUB,
875  AdmsSensFadType & modelPar_MULT,
876  bool modelPar_given_MULT,
877  AdmsSensFadType & modelPar_GMIN,
878  bool modelPar_given_GMIN,
879  // non-reals (including hidden)
880  int modelPar_LEVEL,
881  bool modelPar_given_LEVEL,
882  int modelPar_EXMOD,
883  bool modelPar_given_EXMOD,
884  int modelPar_EXPHI,
885  bool modelPar_given_EXPHI,
886  int modelPar_EXAVL,
887  bool modelPar_given_EXAVL,
888  int modelPar_EXSUB,
889  bool modelPar_given_EXSUB,
890  int modelPar_KAVL,
891  bool modelPar_given_KAVL,
892  int modelPar_TYPE,
893  bool modelPar_given_TYPE// model variables
894  ,
895  // reals
896  AdmsSensFadType & modelVar_An,
897  AdmsSensFadType & modelVar_Tk,
898  AdmsSensFadType & modelVar_Vt,
899  AdmsSensFadType & modelVar_VtINV,
900  AdmsSensFadType & modelVar_VDE_T,
901  AdmsSensFadType & modelVar_VDC_T,
902  AdmsSensFadType & modelVar_XP_T,
903  AdmsSensFadType & modelVar_BF_T,
904  AdmsSensFadType & modelVar_BRI_T,
905  AdmsSensFadType & modelVar_IS_T,
906  AdmsSensFadType & modelVar_VEF_T,
907  AdmsSensFadType & modelVar_VER_T,
908  AdmsSensFadType & modelVar_nZEB_T,
909  AdmsSensFadType & modelVar_pow2_2mPE,
910  AdmsSensFadType & modelVar_pow2_PEm2,
911  AdmsSensFadType & modelVar_inv_VDE_T,
912  AdmsSensFadType & modelVar_VGZEB_T,
913  AdmsSensFadType & modelVar_TAUE_T,
914  AdmsSensFadType & modelVar_TAUB_T,
915  AdmsSensFadType & modelVar_TEPI_T,
916  AdmsSensFadType & modelVar_TAUR_T,
917  AdmsSensFadType & modelVar_BnT,
918  AdmsSensFadType & modelVar_DEG_T,
919  AdmsSensFadType & modelVar_VDS_T,
920  AdmsSensFadType & modelVar_IKS_T,
921  AdmsSensFadType & modelVar_IS_TM,
922  AdmsSensFadType & modelVar_IK_TM,
923  AdmsSensFadType & modelVar_IBF_TM,
924  AdmsSensFadType & modelVar_IBR_TM,
925  AdmsSensFadType & modelVar_IHC_M,
926  AdmsSensFadType & modelVar_IZEB_TM,
927  AdmsSensFadType & modelVar_CJE_TM,
928  AdmsSensFadType & modelVar_CJC_TM,
929  AdmsSensFadType & modelVar_RE_TM,
930  AdmsSensFadType & modelVar_RBC_TM,
931  AdmsSensFadType & modelVar_RBV_TM,
932  AdmsSensFadType & modelVar_RCV_TM,
933  AdmsSensFadType & modelVar_SCRCV_M,
934  AdmsSensFadType & modelVar_RCCxx_TM,
935  AdmsSensFadType & modelVar_GCCxx_TM,
936  AdmsSensFadType & modelVar_GCCex_TM,
937  AdmsSensFadType & modelVar_GCCin_TM,
938  AdmsSensFadType & modelVar_KF_M,
939  AdmsSensFadType & modelVar_KFN_M,
940  AdmsSensFadType & modelVar_ISS_TM,
941  AdmsSensFadType & modelVar_ICSS_TM,
942  AdmsSensFadType & modelVar_IKS_TM,
943  AdmsSensFadType & modelVar_CJS_TM,
944  AdmsSensFadType & modelVar_Xext1,
945  AdmsSensFadType & modelVar_CBEO_M,
946  AdmsSensFadType & modelVar_CBCO_M,
947  double admsTemperature);
948 
949 #endif // Xyce_ADMS_SENSITIVITIES
950 
951 
952 // Limited exponential --- NOT what verilog LRM says, but what qucs,
953 // ng-spice, and zspice do.
954 
955 template <typename T>
956 T limexp(const T &x)
957 {
958  if ((x) < 80.0)
959  return (exp(x));
960  else
961  return (exp(80.0)*(x-79.0));
962 }
963 
964 // Maybe this will do as a substitute for a sacado-provided "floor" and "ceil"?
965 // It is wrong to try to propagate the Sacado derivatives to the return
966 // value, as the floor and ceil functions have zero derivative w.r.t. any
967 // of the variables in the argument, except when X is an integer at which
968 // point the derivative is undefined.
969 template <typename T>
970 double ADMSfloor(const T & x)
971 {
972  return (floor(x.val()));
973 }
974 
975 template <typename T>
976 double ADMSceil(const T & x)
977 {
978  return (ceil(x.val()));
979 }
980 
981 
982 struct Traits: public DeviceTraits<Model, Instance, BJT::Traits>
983 {
984  static const char *name() {return "MEXTRAM 504.11.0";}
985  static const char *deviceTypeName() {return "q level 504";}
986 
987  static int numNodes() {return 4;}
988  static bool modelRequired() {return true;}
989  static bool isLinearDevice() {return false;}
990 
991  static Device *factory(const Configuration &configuration, const FactoryBlock &factory_block);
992  static void loadModelParameters(ParametricData<Model> &model_parameters);
993  static void loadInstanceParameters(ParametricData<Instance> &instance_parameters);
994 };
995 
996 //-----------------------------------------------------------------------------
997 // Class : Instance
998 
999 //
1000 // Purpose : This class represents a single instance of the
1001 // device. It mainly contains indices and pointers into
1002 // the matrix equation (see the resistor instance class for
1003 // more details).
1004 //
1005 // Special Notes :
1006 // Creator :
1007 // Creation Date :
1008 //-----------------------------------------------------------------------------
1009 class Instance : public DeviceInstance
1010 {
1011  friend class ParametricData<Instance>;
1012  friend class Model;
1013 #ifdef Xyce_ADMS_SENSITIVITIES
1014  friend class InstanceSensitivity;
1015  friend class ModelSensitivity;
1016 #endif // Xyce_ADMS_SENSITIVITIES
1017  friend class Traits;
1018 
1019 public:
1020  Instance(
1021  const Configuration & configuration,
1022  const InstanceBlock & instance_block,
1023  Model & model,
1024  const FactoryBlock & factory_block);
1025 
1026  ~Instance();
1027 
1028 private:
1029  Instance(const Instance &);
1030  Instance &operator=(const Instance &);
1031 
1032 public:
1033  void registerLIDs( const LocalIdVector & intLIDVecRef,
1034  const LocalIdVector & extLIDVecRef );
1035  void registerStateLIDs( const LocalIdVector & staLIDVecRef );
1036  void setupPointers();
1037 
1038  void loadNodeSymbols(Util::SymbolTable &symbol_table) const;
1039 
1040  const JacobianStamp & jacobianStamp() const;
1041  void registerJacLIDs( const JacobianStamp & jacLIDVec );
1042 
1043  bool processParams();
1044  bool updateTemperature ( const double & temp = -999.0 );
1045  bool updateIntermediateVars ();
1046  bool updatePrimaryState ();
1047  bool updateSecondaryState ();
1048 
1049  // load functions, residual:
1050  bool loadDAEQVector ();
1051  bool loadDAEFVector ();
1052 
1053  // load functions, Jacobian:
1054  bool loadDAEdQdx ();
1055  bool loadDAEdFdx ();
1056 
1057  void collapseNodes();
1058 
1059 private:
1060 
1061 public:
1062  // iterator reference to the bjt504va model which owns this instance.
1063  // Getters and setters
1065  {
1066  return model_;
1067  }
1068 
1069 private:
1070 
1071  Model & model_; //< Owning Model
1072  // Begin verilog Instance Variables
1073  // Instance Parameters
1074  double MULT;
1075  // Variables of global_instance scope
1076  AdmsFadType Izteb;
1077  AdmsFadType qBI;
1078  AdmsFadType Ir;
1079  AdmsFadType If;
1080  AdmsFadType Ib1;
1081  AdmsFadType Ib1_s;
1082  AdmsFadType Ib2;
1083  AdmsFadType Ib3;
1084  AdmsFadType Iex;
1085  AdmsFadType XIex;
1086  AdmsFadType Isub;
1087  AdmsFadType XIsub;
1088  AdmsFadType Rb2;
1089  AdmsFadType Gem;
1090  AdmsFadType eVb1b2;
1091  // end verilog Instance Variables=====
1092  // Nodal LID Variables
1093  int li_c;
1094  int li_b;
1095  int li_e;
1096  int li_s;
1097  int li_e1;
1098  int li_b1;
1099  int li_b2;
1100  int li_c3;
1101  int li_c4;
1102  int li_c2;
1103  int li_c1;
1104  int li_noi;
1105  // end Nodal LID Variables
1106  // Branch LID Variables
1107  // end Branch LID Variables
1108  // Jacobian pointers
1325  // end of Jacobian and pointers
1326  // node numbers
1327  static const int admsNodeID_c = 0;
1328  static const int admsNodeID_b = 1;
1329  static const int admsNodeID_e = 2;
1330  static const int admsNodeID_s = 3;
1331  static const int admsNodeID_e1 = 4;
1332  static const int admsNodeID_b1 = 5;
1333  static const int admsNodeID_b2 = 6;
1334  static const int admsNodeID_c3 = 7;
1335  static const int admsNodeID_c4 = 8;
1336  static const int admsNodeID_c2 = 9;
1337  static const int admsNodeID_c1 = 10;
1338  static const int admsNodeID_noi = 11;
1339  // end node numbers
1340  // Additional IDs for branch equations
1341  // end branch numbers
1342  // Probe numbers
1343  static const int admsProbeID_V_noi_e1 = 0;
1344  static const int admsProbeID_V_c3_c1 = 1;
1345  static const int admsProbeID_V_c3_c4 = 2;
1346  static const int admsProbeID_V_c4_c1 = 3;
1347  static const int admsProbeID_V_b_c = 4;
1348  static const int admsProbeID_V_b_e = 5;
1349  static const int admsProbeID_V_b_b1 = 6;
1350  static const int admsProbeID_V_e_e1 = 7;
1351  static const int admsProbeID_V_c1_c2 = 8;
1352  static const int admsProbeID_V_s_c1 = 9;
1353  static const int admsProbeID_V_b1_b2 = 10;
1354  static const int admsProbeID_V_b1_e1 = 11;
1355  static const int admsProbeID_V_b2_e1 = 12;
1356  static const int admsProbeID_V_b2_c2 = 13;
1357  static const int admsProbeID_V_b2_c1 = 14;
1358  // end probe numbers
1359  // State LIDs
1364  // end state LIDs
1365  // bools for collapsing nodes
1368  // Arrays to hold probes
1369  std::vector < AdmsFadType > probeVars;
1370  // Arrays to hold contributions
1371  // dynamic contributions are differentiated w.r.t time
1372  std::vector < AdmsFadType > staticContributions;
1373  std::vector < AdmsFadType > dynamicContributions;
1374 
1375  // This array stores the differences between original and limited variables.
1376  std::vector<double> probeDiffs;
1377  // These store the Jdxp's for F and Q, respectively
1378  std::vector<double> Jdxp_static;
1379  std::vector<double> Jdxp_dynamic;
1380 
1381  // this is what we'll use when any model uses $temperature. We'll
1382  // set it in updateTemperature, and initialize it to whatever
1383  // is in devOptions when the instance is constructed.
1385 
1386  // vt at $temperature;
1387  double adms_vt_nom;
1388 
1389 
1390  // This one is for the annoying bogus "XyceADMSInstTemp" parameter
1391  // that we need so we can set it from the device manager when there's no
1392  // "TEMP" parameter to use
1394 
1395 
1396  std::vector< std::vector<int> > jacStamp;
1397  std::vector<int> jacMap;
1398  std::vector< std::vector<int> > jacMap2;
1399 };
1400 
1401 
1402 
1403 namespace AnalogFunctions
1404 {
1405 
1406 // Analog Function trunc_ev
1407 template<typename ScalarT> ScalarT trunc_ev(ScalarT Val, ScalarT Vprev, ScalarT Vmin, ScalarT Vmax)
1408 {
1409 
1410 
1411  ScalarT trunc_ev;
1412  ScalarT result;
1413  {
1414  result = Val;
1415  if ((Val>Vmax))
1416  {
1417  if ((Vprev>(Vmax-0.05)))
1418  {
1419  if (((Val-Vprev)>0.05))
1420  {
1421  result = (Vprev+0.05);
1422  }
1423  }
1424  else
1425  {
1426  result = Vmax;
1427  }
1428  }
1429  else
1430  {
1431  if ((Val<Vmin))
1432  {
1433  if ((Vprev<(0.9*Vmin)))
1434  {
1435  if ((Val<((1.5*Vprev)+(0.10*Vmin))))
1436  {
1437  result = ((1.5*Vprev)+(0.10*Vmin));
1438  }
1439  }
1440  else
1441  {
1442  result = Vmin;
1443  }
1444  }
1445  }
1446  trunc_ev = result;
1447  }
1448  return(trunc_ev);
1449 }
1450 
1451 }
1452 
1453 
1454 //-----------------------------------------------------------------------------
1455 // Class : Model
1456 
1457 // Purpose :
1458 // Special Notes :
1459 // Creator :
1460 // Creation Date :
1461 //-----------------------------------------------------------------------------
1462 class Model : public DeviceModel
1463 {
1464  typedef std::vector<Instance *> InstanceVector;
1465 
1466  friend class ParametricData<Model>;
1467  friend class Instance;
1468 #ifdef Xyce_ADMS_SENSITIVITIES
1469  friend class InstanceSensitivity;
1470  friend class ModelSensitivity;
1471 #endif // Xyce_ADMS_SENSITIVITIES
1472  friend class Traits;
1473 
1474 public:
1475  Model(
1476  const Configuration & configuration,
1477  const ModelBlock & model_block,
1478  const FactoryBlock & factory_block);
1479 
1480  ~Model();
1481 
1482 private:
1483  Model(const Model &);
1484  Model &operator=(const Model &);
1485 
1486 public:
1487  virtual void forEachInstance(DeviceInstanceOp &op) const /* override */;
1488  virtual std::ostream &printOutInstances(std::ostream &os) const;
1489  bool processParams();
1490  bool processInstanceParams();
1491 
1492 private:
1493 
1494 public:
1495  void addInstance(Instance *instance)
1496  {
1497  instanceContainer.push_back(instance);
1498  }
1499 
1500 private:
1501  std::vector<Instance*> instanceContainer;
1502 
1503 private:
1504 
1505  // This one is for the annoying bogus "XyceADMSInstTemp" parameter
1506  // that we need so we can set it from the device manager when there's no
1507  // "TEMP" model parameter to use
1508  double admsModTemp;
1509  // Begin verilog Model Variables
1510  // Model Parameters
1511  int LEVEL;
1512  double TREF;
1513  double DTA;
1514  int EXMOD;
1515  int EXPHI;
1516  int EXAVL;
1517  int EXSUB;
1518  double IS;
1519  double IK;
1520  double VER;
1521  double VEF;
1522  double BF;
1523  double IBF;
1524  double MLF;
1525  double XIBI;
1526  double IZEB;
1527  double NZEB;
1528  double BRI;
1529  double IBR;
1530  double VLR;
1531  double XEXT;
1532  double WAVL;
1533  double VAVL;
1534  double SFH;
1535  double RE;
1536  double RBC;
1537  double RBV;
1538  double RCC;
1539  double RCV;
1540  double SCRCV;
1541  double IHC;
1542  double AXI;
1543  double CJE;
1544  double VDE;
1545  double PE;
1546  double XCJE;
1547  double CBEO;
1548  double CJC;
1549  double VDC;
1550  double PC;
1551  double XP;
1552  double MC;
1553  double XCJC;
1554  double RCBLX;
1555  double RCBLI;
1556  double CBCO;
1557  double MTAU;
1558  double TAUE;
1559  double TAUB;
1560  double TEPI;
1561  double TAUR;
1562  double DEG;
1563  double XREC;
1564  double AQBO;
1565  double AE;
1566  double AB;
1567  double AEPI;
1568  double AEX;
1569  double AC;
1570  double ACBL;
1571  double DVGBF;
1572  double DVGBR;
1573  double VGB;
1574  double VGC;
1575  double VGJ;
1576  double VGZEB;
1577  double AVGEB;
1578  double TVGEB;
1579  double DVGTE;
1580  double DAIS;
1581  double AF;
1582  double KF;
1583  double KFN;
1584  int KAVL;
1585  double ISS;
1586  double ICSS;
1587  double IKS;
1588  double CJS;
1589  double VDS;
1590  double PS;
1591  double VGS;
1592  double AS;
1593  double ASUB;
1594  double MULT;
1595  int TYPE;
1596  double GMIN;
1597  // Variables of global_model scope
1598  double An;
1599  double Tk;
1600  double Vt;
1601  double VtINV;
1602  double VDE_T;
1603  double VDC_T;
1604  double XP_T;
1605  double BF_T;
1606  double BRI_T;
1607  double IS_T;
1608  double VEF_T;
1609  double VER_T;
1610  double nZEB_T;
1611  double pow2_2mPE;
1612  double pow2_PEm2;
1613  double inv_VDE_T;
1614  double VGZEB_T;
1615  double TAUE_T;
1616  double TAUB_T;
1617  double TEPI_T;
1618  double TAUR_T;
1619  double BnT;
1620  double DEG_T;
1621  double VDS_T;
1622  double IKS_T;
1623  double IS_TM;
1624  double IK_TM;
1625  double IBF_TM;
1626  double IBR_TM;
1627  double IHC_M;
1628  double IZEB_TM;
1629  double CJE_TM;
1630  double CJC_TM;
1631  double RE_TM;
1632  double RBC_TM;
1633  double RBV_TM;
1634  double RCV_TM;
1635  double SCRCV_M;
1636  double RCCxx_TM;
1637  double GCCxx_TM;
1638  double GCCex_TM;
1639  double GCCin_TM;
1640  double KF_M;
1641  double KFN_M;
1642  double ISS_TM;
1643  double ICSS_TM;
1644  double IKS_TM;
1645  double CJS_TM;
1646  double Xext1;
1647  double CBEO_M;
1648  double CBCO_M;
1649  // end verilog model variables=====
1650 };
1651 
1652 void registerDevice();
1653 
1654 } // namespace ADMSbjt504va
1655 } // namespace Device
1656 } // namespace Xyce
1657 #endif //Xyce_N_DEV_ADMSbjt504va_h
std::vector< std::vector< int > > jacMap2
std::vector< Instance * > InstanceVector
std::vector< AdmsFadType > staticContributions
ScalarT trunc_ev(ScalarT Val, ScalarT Vprev, ScalarT Vmin, ScalarT Vmax)
virtual std::ostream & printOutInstances(std::ostream &os) const
Pure virtual class to augment a linear system.
static T adms_vt(const T temp)
virtual void forEachInstance(DeviceInstanceOp &op) const
Apply a device instance "op" to all instances associated with this model.
const JacobianStamp & jacobianStamp() const
void registerStateLIDs(const LocalIdVector &staLIDVecRef)
Sacado::Fad::SFad< double, 1 > AdmsSensFadType
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
bool processInstanceParams()
processInstanceParams
Instance & operator=(const Instance &)
void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
void registerJacLIDs(const JacobianStamp &jacLIDVec)
std::vector< std::vector< int > > JacobianStamp
Definition: N_DEV_fwd.h:196
The Device class is an interface for device implementations.
Definition: N_DEV_Device.h:101
IdVector LocalIdVector
Definition: N_DEV_fwd.h:198
Model(const Configuration &configuration, const ModelBlock &model_block, const FactoryBlock &factory_block)
Class Configuration contains device configuration data.
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
std::vector< AdmsFadType > dynamicContributions
Sacado::Fad::SFad< double, 15 > AdmsFadType
static void loadModelParameters(ParametricData< Model > &model_parameters)
std::vector< AdmsFadType > probeVars
std::vector< std::vector< int > > jacStamp
void addInstance(Instance *instance)
Instance(const Configuration &configuration, const InstanceBlock &instance_block, Model &model, const FactoryBlock &factory_block)
#define CONSTKoverQ
Definition: N_DEV_Const.h:58
Base sensitivity functor.
Definition: N_DEV_Pars.h:148
ModelBlock represents a .MODEL line from the netlist.
The DeviceTraits template describes the configuration of a device.
Manages parameter binding for class C.
Definition: N_DEV_Pars.h:214
InstanceBlock represent a device instance line from the netlist.
std::vector< Instance * > instanceContainer
bool updateTemperature(const double &temp=-999.0)
Model & operator=(const Model &)
void registerLIDs(const LocalIdVector &intLIDVecRef, const LocalIdVector &extLIDVecRef)
static Tin adms_ternary_op(const bool cond, const Tin &ifTrue, const Tin &ifFalse)