Xyce  6.1
N_DEV_ADMSvbic13.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_ADMSvbic13.h,v $
29 //
30 // Purpose :
31 //
32 // Special Notes : Generated from verilog file vbic_1p3.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 13:24:19
39 //
40 // Revision Information:
41 // ---------------------
42 //
43 // Revision Number: $Revision: 1.4 $
44 //
45 // Revision Date : $Date: 2015/11/04 21:33:46 $
46 //
47 // Current Owner : $Author: tvrusso $
48 //-----------------------------------------------------------------------------
49 #ifndef Xyce_N_DEV_ADMSvbic13_h
50 #define Xyce_N_DEV_ADMSvbic13_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 ADMSvbic13 {
66 
67 // This typedef is for our automatic differentiation:
68 typedef Sacado::Fad::SFad<double,18> 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_xf2_GND,
187  const int admsProbeID_V_xf1_GND,
188  const int admsProbeID_V_bp_cx,
189  const int admsProbeID_V_e_ei,
190  const int admsProbeID_V_bx_bi,
191  const int admsProbeID_V_b_bx,
192  const int admsProbeID_V_cx_ci,
193  const int admsProbeID_V_c_cx,
194  const int admsProbeID_V_b_c,
195  const int admsProbeID_V_b_e,
196  const int admsProbeID_V_bx_bp,
197  const int admsProbeID_V_ci_ei,
198  const int admsProbeID_V_bx_cx,
199  const int admsProbeID_V_bi_cx,
200  const int admsProbeID_V_bi_ci,
201  const int admsProbeID_V_bx_ei,
202  const int admsProbeID_V_bi_ei,
203  const int admsProbeID_Temp_dt_GND,
204  // node constants
205  const int admsNodeID_c,
206  const int admsNodeID_b,
207  const int admsNodeID_e,
208  const int admsNodeID_dt,
209  const int admsNodeID_cx,
210  const int admsNodeID_ci,
211  const int admsNodeID_bx,
212  const int admsNodeID_bi,
213  const int admsNodeID_ei,
214  const int admsNodeID_bp,
215  const int admsNodeID_xf1,
216  const int admsNodeID_xf2,
217  // instance parameters
218  // reals
219  AdmsSensFadType & instancePar_m,
220  bool instancePar_given_m,
221  AdmsSensFadType & instancePar_trise,
222  bool instancePar_given_trise,
223  // non-reals(including hidden)
224  int instancePar_sw_noise,
225  bool instancePar_given_sw_noise,
226  int instancePar_sw_et,
227  bool instancePar_given_sw_et,
228  // model parameters
229  // reals
230  AdmsSensFadType & modelPar_npn,
231  bool modelPar_given_npn,
232  AdmsSensFadType & modelPar_pnp,
233  bool modelPar_given_pnp,
234  AdmsSensFadType & modelPar_scale,
235  bool modelPar_given_scale,
236  AdmsSensFadType & modelPar_shrink,
237  bool modelPar_given_shrink,
238  AdmsSensFadType & modelPar_tmin,
239  bool modelPar_given_tmin,
240  AdmsSensFadType & modelPar_tmax,
241  bool modelPar_given_tmax,
242  AdmsSensFadType & modelPar_gmin,
243  bool modelPar_given_gmin,
244  AdmsSensFadType & modelPar_pnjmaxi,
245  bool modelPar_given_pnjmaxi,
246  AdmsSensFadType & modelPar_maxexp,
247  bool modelPar_given_maxexp,
248  AdmsSensFadType & modelPar_tnom,
249  bool modelPar_given_tnom,
250  AdmsSensFadType & modelPar_tminclip,
251  bool modelPar_given_tminclip,
252  AdmsSensFadType & modelPar_tmaxclip,
253  bool modelPar_given_tmaxclip,
254  AdmsSensFadType & modelPar_rcx,
255  bool modelPar_given_rcx,
256  AdmsSensFadType & modelPar_rci,
257  bool modelPar_given_rci,
258  AdmsSensFadType & modelPar_vo,
259  bool modelPar_given_vo,
260  AdmsSensFadType & modelPar_gamm,
261  bool modelPar_given_gamm,
262  AdmsSensFadType & modelPar_hrcf,
263  bool modelPar_given_hrcf,
264  AdmsSensFadType & modelPar_rbx,
265  bool modelPar_given_rbx,
266  AdmsSensFadType & modelPar_rbi,
267  bool modelPar_given_rbi,
268  AdmsSensFadType & modelPar_re,
269  bool modelPar_given_re,
270  AdmsSensFadType & modelPar_rs,
271  bool modelPar_given_rs,
272  AdmsSensFadType & modelPar_rbp,
273  bool modelPar_given_rbp,
274  AdmsSensFadType & modelPar_is,
275  bool modelPar_given_is,
276  AdmsSensFadType & modelPar_isrr,
277  bool modelPar_given_isrr,
278  AdmsSensFadType & modelPar_nf,
279  bool modelPar_given_nf,
280  AdmsSensFadType & modelPar_nr,
281  bool modelPar_given_nr,
282  AdmsSensFadType & modelPar_isp,
283  bool modelPar_given_isp,
284  AdmsSensFadType & modelPar_wsp,
285  bool modelPar_given_wsp,
286  AdmsSensFadType & modelPar_nfp,
287  bool modelPar_given_nfp,
288  AdmsSensFadType & modelPar_fc,
289  bool modelPar_given_fc,
290  AdmsSensFadType & modelPar_cbeo,
291  bool modelPar_given_cbeo,
292  AdmsSensFadType & modelPar_cje,
293  bool modelPar_given_cje,
294  AdmsSensFadType & modelPar_pe,
295  bool modelPar_given_pe,
296  AdmsSensFadType & modelPar_me,
297  bool modelPar_given_me,
298  AdmsSensFadType & modelPar_aje,
299  bool modelPar_given_aje,
300  AdmsSensFadType & modelPar_cbco,
301  bool modelPar_given_cbco,
302  AdmsSensFadType & modelPar_cjc,
303  bool modelPar_given_cjc,
304  AdmsSensFadType & modelPar_pc,
305  bool modelPar_given_pc,
306  AdmsSensFadType & modelPar_mc,
307  bool modelPar_given_mc,
308  AdmsSensFadType & modelPar_ajc,
309  bool modelPar_given_ajc,
310  AdmsSensFadType & modelPar_vrt,
311  bool modelPar_given_vrt,
312  AdmsSensFadType & modelPar_art,
313  bool modelPar_given_art,
314  AdmsSensFadType & modelPar_qco,
315  bool modelPar_given_qco,
316  AdmsSensFadType & modelPar_cjep,
317  bool modelPar_given_cjep,
318  AdmsSensFadType & modelPar_cjcp,
319  bool modelPar_given_cjcp,
320  AdmsSensFadType & modelPar_ps,
321  bool modelPar_given_ps,
322  AdmsSensFadType & modelPar_ms,
323  bool modelPar_given_ms,
324  AdmsSensFadType & modelPar_ajs,
325  bool modelPar_given_ajs,
326  AdmsSensFadType & modelPar_ccso,
327  bool modelPar_given_ccso,
328  AdmsSensFadType & modelPar_ibei,
329  bool modelPar_given_ibei,
330  AdmsSensFadType & modelPar_wbe,
331  bool modelPar_given_wbe,
332  AdmsSensFadType & modelPar_nei,
333  bool modelPar_given_nei,
334  AdmsSensFadType & modelPar_qnibeir,
335  bool modelPar_given_qnibeir,
336  AdmsSensFadType & modelPar_iben,
337  bool modelPar_given_iben,
338  AdmsSensFadType & modelPar_nen,
339  bool modelPar_given_nen,
340  AdmsSensFadType & modelPar_ibci,
341  bool modelPar_given_ibci,
342  AdmsSensFadType & modelPar_nci,
343  bool modelPar_given_nci,
344  AdmsSensFadType & modelPar_ibcn,
345  bool modelPar_given_ibcn,
346  AdmsSensFadType & modelPar_ncn,
347  bool modelPar_given_ncn,
348  AdmsSensFadType & modelPar_ibeip,
349  bool modelPar_given_ibeip,
350  AdmsSensFadType & modelPar_ibenp,
351  bool modelPar_given_ibenp,
352  AdmsSensFadType & modelPar_ibcip,
353  bool modelPar_given_ibcip,
354  AdmsSensFadType & modelPar_ncip,
355  bool modelPar_given_ncip,
356  AdmsSensFadType & modelPar_ibcnp,
357  bool modelPar_given_ibcnp,
358  AdmsSensFadType & modelPar_ncnp,
359  bool modelPar_given_ncnp,
360  AdmsSensFadType & modelPar_vef,
361  bool modelPar_given_vef,
362  AdmsSensFadType & modelPar_ver,
363  bool modelPar_given_ver,
364  AdmsSensFadType & modelPar_ikf,
365  bool modelPar_given_ikf,
366  AdmsSensFadType & modelPar_nkf,
367  bool modelPar_given_nkf,
368  AdmsSensFadType & modelPar_ikr,
369  bool modelPar_given_ikr,
370  AdmsSensFadType & modelPar_ikp,
371  bool modelPar_given_ikp,
372  AdmsSensFadType & modelPar_tf,
373  bool modelPar_given_tf,
374  AdmsSensFadType & modelPar_qtf,
375  bool modelPar_given_qtf,
376  AdmsSensFadType & modelPar_xtf,
377  bool modelPar_given_xtf,
378  AdmsSensFadType & modelPar_vtf,
379  bool modelPar_given_vtf,
380  AdmsSensFadType & modelPar_itf,
381  bool modelPar_given_itf,
382  AdmsSensFadType & modelPar_tr,
383  bool modelPar_given_tr,
384  AdmsSensFadType & modelPar_td,
385  bool modelPar_given_td,
386  AdmsSensFadType & modelPar_avc1,
387  bool modelPar_given_avc1,
388  AdmsSensFadType & modelPar_avc2,
389  bool modelPar_given_avc2,
390  AdmsSensFadType & modelPar_avcx1,
391  bool modelPar_given_avcx1,
392  AdmsSensFadType & modelPar_avcx2,
393  bool modelPar_given_avcx2,
394  AdmsSensFadType & modelPar_mcx,
395  bool modelPar_given_mcx,
396  AdmsSensFadType & modelPar_vbbe,
397  bool modelPar_given_vbbe,
398  AdmsSensFadType & modelPar_nbbe,
399  bool modelPar_given_nbbe,
400  AdmsSensFadType & modelPar_ibbe,
401  bool modelPar_given_ibbe,
402  AdmsSensFadType & modelPar_tvbbe1,
403  bool modelPar_given_tvbbe1,
404  AdmsSensFadType & modelPar_tvbbe2,
405  bool modelPar_given_tvbbe2,
406  AdmsSensFadType & modelPar_tnbbe,
407  bool modelPar_given_tnbbe,
408  AdmsSensFadType & modelPar_vpte,
409  bool modelPar_given_vpte,
410  AdmsSensFadType & modelPar_ibk0,
411  bool modelPar_given_ibk0,
412  AdmsSensFadType & modelPar_abk,
413  bool modelPar_given_abk,
414  AdmsSensFadType & modelPar_bbk,
415  bool modelPar_given_bbk,
416  AdmsSensFadType & modelPar_kfn,
417  bool modelPar_given_kfn,
418  AdmsSensFadType & modelPar_afn,
419  bool modelPar_given_afn,
420  AdmsSensFadType & modelPar_bfn,
421  bool modelPar_given_bfn,
422  AdmsSensFadType & modelPar_rth,
423  bool modelPar_given_rth,
424  AdmsSensFadType & modelPar_cth,
425  bool modelPar_given_cth,
426  AdmsSensFadType & modelPar_xre,
427  bool modelPar_given_xre,
428  AdmsSensFadType & modelPar_xrb,
429  bool modelPar_given_xrb,
430  AdmsSensFadType & modelPar_xrbi,
431  bool modelPar_given_xrbi,
432  AdmsSensFadType & modelPar_xrbx,
433  bool modelPar_given_xrbx,
434  AdmsSensFadType & modelPar_xrc,
435  bool modelPar_given_xrc,
436  AdmsSensFadType & modelPar_xrci,
437  bool modelPar_given_xrci,
438  AdmsSensFadType & modelPar_xrcx,
439  bool modelPar_given_xrcx,
440  AdmsSensFadType & modelPar_xrbp,
441  bool modelPar_given_xrbp,
442  AdmsSensFadType & modelPar_xrs,
443  bool modelPar_given_xrs,
444  AdmsSensFadType & modelPar_xvo,
445  bool modelPar_given_xvo,
446  AdmsSensFadType & modelPar_ea,
447  bool modelPar_given_ea,
448  AdmsSensFadType & modelPar_eaie,
449  bool modelPar_given_eaie,
450  AdmsSensFadType & modelPar_eaic,
451  bool modelPar_given_eaic,
452  AdmsSensFadType & modelPar_eais,
453  bool modelPar_given_eais,
454  AdmsSensFadType & modelPar_eane,
455  bool modelPar_given_eane,
456  AdmsSensFadType & modelPar_eanc,
457  bool modelPar_given_eanc,
458  AdmsSensFadType & modelPar_eans,
459  bool modelPar_given_eans,
460  AdmsSensFadType & modelPar_eap,
461  bool modelPar_given_eap,
462  AdmsSensFadType & modelPar_dear,
463  bool modelPar_given_dear,
464  AdmsSensFadType & modelPar_xis,
465  bool modelPar_given_xis,
466  AdmsSensFadType & modelPar_xii,
467  bool modelPar_given_xii,
468  AdmsSensFadType & modelPar_xin,
469  bool modelPar_given_xin,
470  AdmsSensFadType & modelPar_xisr,
471  bool modelPar_given_xisr,
472  AdmsSensFadType & modelPar_xikf,
473  bool modelPar_given_xikf,
474  AdmsSensFadType & modelPar_tavc,
475  bool modelPar_given_tavc,
476  AdmsSensFadType & modelPar_tavcx,
477  bool modelPar_given_tavcx,
478  AdmsSensFadType & modelPar_tnf,
479  bool modelPar_given_tnf,
480  AdmsSensFadType & modelPar_tcvef,
481  bool modelPar_given_tcvef,
482  AdmsSensFadType & modelPar_tcver,
483  bool modelPar_given_tcver,
484  AdmsSensFadType & modelPar_tcrth,
485  bool modelPar_given_tcrth,
486  // non-reals (including hidden)
487  int modelPar_type,
488  bool modelPar_given_type,
489  int modelPar_VBICtype,
490  int modelPar_qbm,
491  bool modelPar_given_qbm,
492  // basic variables
493  double admsTemperature, double adms_vt_nom, double gmin, std::vector <AdmsSensFadType> & staticContributions, std::vector <AdmsSensFadType> & dynamicContributions, const Instance & theInstance);
494 
495 void evaluateInitialInstance(
496  // instance parameters
497  // reals
498  AdmsSensFadType & instancePar_m,
499  bool instancePar_given_m,
500  AdmsSensFadType & instancePar_trise,
501  bool instancePar_given_trise,
502  // non-reals(including hidden)
503  int instancePar_sw_noise,
504  bool instancePar_given_sw_noise,
505  int instancePar_sw_et,
506  bool instancePar_given_sw_et,
507  // model parameters
508  // reals
509  AdmsSensFadType & modelPar_npn,
510  bool modelPar_given_npn,
511  AdmsSensFadType & modelPar_pnp,
512  bool modelPar_given_pnp,
513  AdmsSensFadType & modelPar_scale,
514  bool modelPar_given_scale,
515  AdmsSensFadType & modelPar_shrink,
516  bool modelPar_given_shrink,
517  AdmsSensFadType & modelPar_tmin,
518  bool modelPar_given_tmin,
519  AdmsSensFadType & modelPar_tmax,
520  bool modelPar_given_tmax,
521  AdmsSensFadType & modelPar_gmin,
522  bool modelPar_given_gmin,
523  AdmsSensFadType & modelPar_pnjmaxi,
524  bool modelPar_given_pnjmaxi,
525  AdmsSensFadType & modelPar_maxexp,
526  bool modelPar_given_maxexp,
527  AdmsSensFadType & modelPar_tnom,
528  bool modelPar_given_tnom,
529  AdmsSensFadType & modelPar_tminclip,
530  bool modelPar_given_tminclip,
531  AdmsSensFadType & modelPar_tmaxclip,
532  bool modelPar_given_tmaxclip,
533  AdmsSensFadType & modelPar_rcx,
534  bool modelPar_given_rcx,
535  AdmsSensFadType & modelPar_rci,
536  bool modelPar_given_rci,
537  AdmsSensFadType & modelPar_vo,
538  bool modelPar_given_vo,
539  AdmsSensFadType & modelPar_gamm,
540  bool modelPar_given_gamm,
541  AdmsSensFadType & modelPar_hrcf,
542  bool modelPar_given_hrcf,
543  AdmsSensFadType & modelPar_rbx,
544  bool modelPar_given_rbx,
545  AdmsSensFadType & modelPar_rbi,
546  bool modelPar_given_rbi,
547  AdmsSensFadType & modelPar_re,
548  bool modelPar_given_re,
549  AdmsSensFadType & modelPar_rs,
550  bool modelPar_given_rs,
551  AdmsSensFadType & modelPar_rbp,
552  bool modelPar_given_rbp,
553  AdmsSensFadType & modelPar_is,
554  bool modelPar_given_is,
555  AdmsSensFadType & modelPar_isrr,
556  bool modelPar_given_isrr,
557  AdmsSensFadType & modelPar_nf,
558  bool modelPar_given_nf,
559  AdmsSensFadType & modelPar_nr,
560  bool modelPar_given_nr,
561  AdmsSensFadType & modelPar_isp,
562  bool modelPar_given_isp,
563  AdmsSensFadType & modelPar_wsp,
564  bool modelPar_given_wsp,
565  AdmsSensFadType & modelPar_nfp,
566  bool modelPar_given_nfp,
567  AdmsSensFadType & modelPar_fc,
568  bool modelPar_given_fc,
569  AdmsSensFadType & modelPar_cbeo,
570  bool modelPar_given_cbeo,
571  AdmsSensFadType & modelPar_cje,
572  bool modelPar_given_cje,
573  AdmsSensFadType & modelPar_pe,
574  bool modelPar_given_pe,
575  AdmsSensFadType & modelPar_me,
576  bool modelPar_given_me,
577  AdmsSensFadType & modelPar_aje,
578  bool modelPar_given_aje,
579  AdmsSensFadType & modelPar_cbco,
580  bool modelPar_given_cbco,
581  AdmsSensFadType & modelPar_cjc,
582  bool modelPar_given_cjc,
583  AdmsSensFadType & modelPar_pc,
584  bool modelPar_given_pc,
585  AdmsSensFadType & modelPar_mc,
586  bool modelPar_given_mc,
587  AdmsSensFadType & modelPar_ajc,
588  bool modelPar_given_ajc,
589  AdmsSensFadType & modelPar_vrt,
590  bool modelPar_given_vrt,
591  AdmsSensFadType & modelPar_art,
592  bool modelPar_given_art,
593  AdmsSensFadType & modelPar_qco,
594  bool modelPar_given_qco,
595  AdmsSensFadType & modelPar_cjep,
596  bool modelPar_given_cjep,
597  AdmsSensFadType & modelPar_cjcp,
598  bool modelPar_given_cjcp,
599  AdmsSensFadType & modelPar_ps,
600  bool modelPar_given_ps,
601  AdmsSensFadType & modelPar_ms,
602  bool modelPar_given_ms,
603  AdmsSensFadType & modelPar_ajs,
604  bool modelPar_given_ajs,
605  AdmsSensFadType & modelPar_ccso,
606  bool modelPar_given_ccso,
607  AdmsSensFadType & modelPar_ibei,
608  bool modelPar_given_ibei,
609  AdmsSensFadType & modelPar_wbe,
610  bool modelPar_given_wbe,
611  AdmsSensFadType & modelPar_nei,
612  bool modelPar_given_nei,
613  AdmsSensFadType & modelPar_qnibeir,
614  bool modelPar_given_qnibeir,
615  AdmsSensFadType & modelPar_iben,
616  bool modelPar_given_iben,
617  AdmsSensFadType & modelPar_nen,
618  bool modelPar_given_nen,
619  AdmsSensFadType & modelPar_ibci,
620  bool modelPar_given_ibci,
621  AdmsSensFadType & modelPar_nci,
622  bool modelPar_given_nci,
623  AdmsSensFadType & modelPar_ibcn,
624  bool modelPar_given_ibcn,
625  AdmsSensFadType & modelPar_ncn,
626  bool modelPar_given_ncn,
627  AdmsSensFadType & modelPar_ibeip,
628  bool modelPar_given_ibeip,
629  AdmsSensFadType & modelPar_ibenp,
630  bool modelPar_given_ibenp,
631  AdmsSensFadType & modelPar_ibcip,
632  bool modelPar_given_ibcip,
633  AdmsSensFadType & modelPar_ncip,
634  bool modelPar_given_ncip,
635  AdmsSensFadType & modelPar_ibcnp,
636  bool modelPar_given_ibcnp,
637  AdmsSensFadType & modelPar_ncnp,
638  bool modelPar_given_ncnp,
639  AdmsSensFadType & modelPar_vef,
640  bool modelPar_given_vef,
641  AdmsSensFadType & modelPar_ver,
642  bool modelPar_given_ver,
643  AdmsSensFadType & modelPar_ikf,
644  bool modelPar_given_ikf,
645  AdmsSensFadType & modelPar_nkf,
646  bool modelPar_given_nkf,
647  AdmsSensFadType & modelPar_ikr,
648  bool modelPar_given_ikr,
649  AdmsSensFadType & modelPar_ikp,
650  bool modelPar_given_ikp,
651  AdmsSensFadType & modelPar_tf,
652  bool modelPar_given_tf,
653  AdmsSensFadType & modelPar_qtf,
654  bool modelPar_given_qtf,
655  AdmsSensFadType & modelPar_xtf,
656  bool modelPar_given_xtf,
657  AdmsSensFadType & modelPar_vtf,
658  bool modelPar_given_vtf,
659  AdmsSensFadType & modelPar_itf,
660  bool modelPar_given_itf,
661  AdmsSensFadType & modelPar_tr,
662  bool modelPar_given_tr,
663  AdmsSensFadType & modelPar_td,
664  bool modelPar_given_td,
665  AdmsSensFadType & modelPar_avc1,
666  bool modelPar_given_avc1,
667  AdmsSensFadType & modelPar_avc2,
668  bool modelPar_given_avc2,
669  AdmsSensFadType & modelPar_avcx1,
670  bool modelPar_given_avcx1,
671  AdmsSensFadType & modelPar_avcx2,
672  bool modelPar_given_avcx2,
673  AdmsSensFadType & modelPar_mcx,
674  bool modelPar_given_mcx,
675  AdmsSensFadType & modelPar_vbbe,
676  bool modelPar_given_vbbe,
677  AdmsSensFadType & modelPar_nbbe,
678  bool modelPar_given_nbbe,
679  AdmsSensFadType & modelPar_ibbe,
680  bool modelPar_given_ibbe,
681  AdmsSensFadType & modelPar_tvbbe1,
682  bool modelPar_given_tvbbe1,
683  AdmsSensFadType & modelPar_tvbbe2,
684  bool modelPar_given_tvbbe2,
685  AdmsSensFadType & modelPar_tnbbe,
686  bool modelPar_given_tnbbe,
687  AdmsSensFadType & modelPar_vpte,
688  bool modelPar_given_vpte,
689  AdmsSensFadType & modelPar_ibk0,
690  bool modelPar_given_ibk0,
691  AdmsSensFadType & modelPar_abk,
692  bool modelPar_given_abk,
693  AdmsSensFadType & modelPar_bbk,
694  bool modelPar_given_bbk,
695  AdmsSensFadType & modelPar_kfn,
696  bool modelPar_given_kfn,
697  AdmsSensFadType & modelPar_afn,
698  bool modelPar_given_afn,
699  AdmsSensFadType & modelPar_bfn,
700  bool modelPar_given_bfn,
701  AdmsSensFadType & modelPar_rth,
702  bool modelPar_given_rth,
703  AdmsSensFadType & modelPar_cth,
704  bool modelPar_given_cth,
705  AdmsSensFadType & modelPar_xre,
706  bool modelPar_given_xre,
707  AdmsSensFadType & modelPar_xrb,
708  bool modelPar_given_xrb,
709  AdmsSensFadType & modelPar_xrbi,
710  bool modelPar_given_xrbi,
711  AdmsSensFadType & modelPar_xrbx,
712  bool modelPar_given_xrbx,
713  AdmsSensFadType & modelPar_xrc,
714  bool modelPar_given_xrc,
715  AdmsSensFadType & modelPar_xrci,
716  bool modelPar_given_xrci,
717  AdmsSensFadType & modelPar_xrcx,
718  bool modelPar_given_xrcx,
719  AdmsSensFadType & modelPar_xrbp,
720  bool modelPar_given_xrbp,
721  AdmsSensFadType & modelPar_xrs,
722  bool modelPar_given_xrs,
723  AdmsSensFadType & modelPar_xvo,
724  bool modelPar_given_xvo,
725  AdmsSensFadType & modelPar_ea,
726  bool modelPar_given_ea,
727  AdmsSensFadType & modelPar_eaie,
728  bool modelPar_given_eaie,
729  AdmsSensFadType & modelPar_eaic,
730  bool modelPar_given_eaic,
731  AdmsSensFadType & modelPar_eais,
732  bool modelPar_given_eais,
733  AdmsSensFadType & modelPar_eane,
734  bool modelPar_given_eane,
735  AdmsSensFadType & modelPar_eanc,
736  bool modelPar_given_eanc,
737  AdmsSensFadType & modelPar_eans,
738  bool modelPar_given_eans,
739  AdmsSensFadType & modelPar_eap,
740  bool modelPar_given_eap,
741  AdmsSensFadType & modelPar_dear,
742  bool modelPar_given_dear,
743  AdmsSensFadType & modelPar_xis,
744  bool modelPar_given_xis,
745  AdmsSensFadType & modelPar_xii,
746  bool modelPar_given_xii,
747  AdmsSensFadType & modelPar_xin,
748  bool modelPar_given_xin,
749  AdmsSensFadType & modelPar_xisr,
750  bool modelPar_given_xisr,
751  AdmsSensFadType & modelPar_xikf,
752  bool modelPar_given_xikf,
753  AdmsSensFadType & modelPar_tavc,
754  bool modelPar_given_tavc,
755  AdmsSensFadType & modelPar_tavcx,
756  bool modelPar_given_tavcx,
757  AdmsSensFadType & modelPar_tnf,
758  bool modelPar_given_tnf,
759  AdmsSensFadType & modelPar_tcvef,
760  bool modelPar_given_tcvef,
761  AdmsSensFadType & modelPar_tcver,
762  bool modelPar_given_tcver,
763  AdmsSensFadType & modelPar_tcrth,
764  bool modelPar_given_tcrth,
765  // non-reals (including hidden)
766  int modelPar_type,
767  bool modelPar_given_type,
768  int modelPar_VBICtype,
769  int modelPar_qbm,
770  bool modelPar_given_qbm,
771  double admsTemperature);
772 
773 void evaluateInitialModel(
774  // model parameters
775  // reals
776  AdmsSensFadType & modelPar_npn,
777  bool modelPar_given_npn,
778  AdmsSensFadType & modelPar_pnp,
779  bool modelPar_given_pnp,
780  AdmsSensFadType & modelPar_scale,
781  bool modelPar_given_scale,
782  AdmsSensFadType & modelPar_shrink,
783  bool modelPar_given_shrink,
784  AdmsSensFadType & modelPar_tmin,
785  bool modelPar_given_tmin,
786  AdmsSensFadType & modelPar_tmax,
787  bool modelPar_given_tmax,
788  AdmsSensFadType & modelPar_gmin,
789  bool modelPar_given_gmin,
790  AdmsSensFadType & modelPar_pnjmaxi,
791  bool modelPar_given_pnjmaxi,
792  AdmsSensFadType & modelPar_maxexp,
793  bool modelPar_given_maxexp,
794  AdmsSensFadType & modelPar_tnom,
795  bool modelPar_given_tnom,
796  AdmsSensFadType & modelPar_tminclip,
797  bool modelPar_given_tminclip,
798  AdmsSensFadType & modelPar_tmaxclip,
799  bool modelPar_given_tmaxclip,
800  AdmsSensFadType & modelPar_rcx,
801  bool modelPar_given_rcx,
802  AdmsSensFadType & modelPar_rci,
803  bool modelPar_given_rci,
804  AdmsSensFadType & modelPar_vo,
805  bool modelPar_given_vo,
806  AdmsSensFadType & modelPar_gamm,
807  bool modelPar_given_gamm,
808  AdmsSensFadType & modelPar_hrcf,
809  bool modelPar_given_hrcf,
810  AdmsSensFadType & modelPar_rbx,
811  bool modelPar_given_rbx,
812  AdmsSensFadType & modelPar_rbi,
813  bool modelPar_given_rbi,
814  AdmsSensFadType & modelPar_re,
815  bool modelPar_given_re,
816  AdmsSensFadType & modelPar_rs,
817  bool modelPar_given_rs,
818  AdmsSensFadType & modelPar_rbp,
819  bool modelPar_given_rbp,
820  AdmsSensFadType & modelPar_is,
821  bool modelPar_given_is,
822  AdmsSensFadType & modelPar_isrr,
823  bool modelPar_given_isrr,
824  AdmsSensFadType & modelPar_nf,
825  bool modelPar_given_nf,
826  AdmsSensFadType & modelPar_nr,
827  bool modelPar_given_nr,
828  AdmsSensFadType & modelPar_isp,
829  bool modelPar_given_isp,
830  AdmsSensFadType & modelPar_wsp,
831  bool modelPar_given_wsp,
832  AdmsSensFadType & modelPar_nfp,
833  bool modelPar_given_nfp,
834  AdmsSensFadType & modelPar_fc,
835  bool modelPar_given_fc,
836  AdmsSensFadType & modelPar_cbeo,
837  bool modelPar_given_cbeo,
838  AdmsSensFadType & modelPar_cje,
839  bool modelPar_given_cje,
840  AdmsSensFadType & modelPar_pe,
841  bool modelPar_given_pe,
842  AdmsSensFadType & modelPar_me,
843  bool modelPar_given_me,
844  AdmsSensFadType & modelPar_aje,
845  bool modelPar_given_aje,
846  AdmsSensFadType & modelPar_cbco,
847  bool modelPar_given_cbco,
848  AdmsSensFadType & modelPar_cjc,
849  bool modelPar_given_cjc,
850  AdmsSensFadType & modelPar_pc,
851  bool modelPar_given_pc,
852  AdmsSensFadType & modelPar_mc,
853  bool modelPar_given_mc,
854  AdmsSensFadType & modelPar_ajc,
855  bool modelPar_given_ajc,
856  AdmsSensFadType & modelPar_vrt,
857  bool modelPar_given_vrt,
858  AdmsSensFadType & modelPar_art,
859  bool modelPar_given_art,
860  AdmsSensFadType & modelPar_qco,
861  bool modelPar_given_qco,
862  AdmsSensFadType & modelPar_cjep,
863  bool modelPar_given_cjep,
864  AdmsSensFadType & modelPar_cjcp,
865  bool modelPar_given_cjcp,
866  AdmsSensFadType & modelPar_ps,
867  bool modelPar_given_ps,
868  AdmsSensFadType & modelPar_ms,
869  bool modelPar_given_ms,
870  AdmsSensFadType & modelPar_ajs,
871  bool modelPar_given_ajs,
872  AdmsSensFadType & modelPar_ccso,
873  bool modelPar_given_ccso,
874  AdmsSensFadType & modelPar_ibei,
875  bool modelPar_given_ibei,
876  AdmsSensFadType & modelPar_wbe,
877  bool modelPar_given_wbe,
878  AdmsSensFadType & modelPar_nei,
879  bool modelPar_given_nei,
880  AdmsSensFadType & modelPar_qnibeir,
881  bool modelPar_given_qnibeir,
882  AdmsSensFadType & modelPar_iben,
883  bool modelPar_given_iben,
884  AdmsSensFadType & modelPar_nen,
885  bool modelPar_given_nen,
886  AdmsSensFadType & modelPar_ibci,
887  bool modelPar_given_ibci,
888  AdmsSensFadType & modelPar_nci,
889  bool modelPar_given_nci,
890  AdmsSensFadType & modelPar_ibcn,
891  bool modelPar_given_ibcn,
892  AdmsSensFadType & modelPar_ncn,
893  bool modelPar_given_ncn,
894  AdmsSensFadType & modelPar_ibeip,
895  bool modelPar_given_ibeip,
896  AdmsSensFadType & modelPar_ibenp,
897  bool modelPar_given_ibenp,
898  AdmsSensFadType & modelPar_ibcip,
899  bool modelPar_given_ibcip,
900  AdmsSensFadType & modelPar_ncip,
901  bool modelPar_given_ncip,
902  AdmsSensFadType & modelPar_ibcnp,
903  bool modelPar_given_ibcnp,
904  AdmsSensFadType & modelPar_ncnp,
905  bool modelPar_given_ncnp,
906  AdmsSensFadType & modelPar_vef,
907  bool modelPar_given_vef,
908  AdmsSensFadType & modelPar_ver,
909  bool modelPar_given_ver,
910  AdmsSensFadType & modelPar_ikf,
911  bool modelPar_given_ikf,
912  AdmsSensFadType & modelPar_nkf,
913  bool modelPar_given_nkf,
914  AdmsSensFadType & modelPar_ikr,
915  bool modelPar_given_ikr,
916  AdmsSensFadType & modelPar_ikp,
917  bool modelPar_given_ikp,
918  AdmsSensFadType & modelPar_tf,
919  bool modelPar_given_tf,
920  AdmsSensFadType & modelPar_qtf,
921  bool modelPar_given_qtf,
922  AdmsSensFadType & modelPar_xtf,
923  bool modelPar_given_xtf,
924  AdmsSensFadType & modelPar_vtf,
925  bool modelPar_given_vtf,
926  AdmsSensFadType & modelPar_itf,
927  bool modelPar_given_itf,
928  AdmsSensFadType & modelPar_tr,
929  bool modelPar_given_tr,
930  AdmsSensFadType & modelPar_td,
931  bool modelPar_given_td,
932  AdmsSensFadType & modelPar_avc1,
933  bool modelPar_given_avc1,
934  AdmsSensFadType & modelPar_avc2,
935  bool modelPar_given_avc2,
936  AdmsSensFadType & modelPar_avcx1,
937  bool modelPar_given_avcx1,
938  AdmsSensFadType & modelPar_avcx2,
939  bool modelPar_given_avcx2,
940  AdmsSensFadType & modelPar_mcx,
941  bool modelPar_given_mcx,
942  AdmsSensFadType & modelPar_vbbe,
943  bool modelPar_given_vbbe,
944  AdmsSensFadType & modelPar_nbbe,
945  bool modelPar_given_nbbe,
946  AdmsSensFadType & modelPar_ibbe,
947  bool modelPar_given_ibbe,
948  AdmsSensFadType & modelPar_tvbbe1,
949  bool modelPar_given_tvbbe1,
950  AdmsSensFadType & modelPar_tvbbe2,
951  bool modelPar_given_tvbbe2,
952  AdmsSensFadType & modelPar_tnbbe,
953  bool modelPar_given_tnbbe,
954  AdmsSensFadType & modelPar_vpte,
955  bool modelPar_given_vpte,
956  AdmsSensFadType & modelPar_ibk0,
957  bool modelPar_given_ibk0,
958  AdmsSensFadType & modelPar_abk,
959  bool modelPar_given_abk,
960  AdmsSensFadType & modelPar_bbk,
961  bool modelPar_given_bbk,
962  AdmsSensFadType & modelPar_kfn,
963  bool modelPar_given_kfn,
964  AdmsSensFadType & modelPar_afn,
965  bool modelPar_given_afn,
966  AdmsSensFadType & modelPar_bfn,
967  bool modelPar_given_bfn,
968  AdmsSensFadType & modelPar_rth,
969  bool modelPar_given_rth,
970  AdmsSensFadType & modelPar_cth,
971  bool modelPar_given_cth,
972  AdmsSensFadType & modelPar_xre,
973  bool modelPar_given_xre,
974  AdmsSensFadType & modelPar_xrb,
975  bool modelPar_given_xrb,
976  AdmsSensFadType & modelPar_xrbi,
977  bool modelPar_given_xrbi,
978  AdmsSensFadType & modelPar_xrbx,
979  bool modelPar_given_xrbx,
980  AdmsSensFadType & modelPar_xrc,
981  bool modelPar_given_xrc,
982  AdmsSensFadType & modelPar_xrci,
983  bool modelPar_given_xrci,
984  AdmsSensFadType & modelPar_xrcx,
985  bool modelPar_given_xrcx,
986  AdmsSensFadType & modelPar_xrbp,
987  bool modelPar_given_xrbp,
988  AdmsSensFadType & modelPar_xrs,
989  bool modelPar_given_xrs,
990  AdmsSensFadType & modelPar_xvo,
991  bool modelPar_given_xvo,
992  AdmsSensFadType & modelPar_ea,
993  bool modelPar_given_ea,
994  AdmsSensFadType & modelPar_eaie,
995  bool modelPar_given_eaie,
996  AdmsSensFadType & modelPar_eaic,
997  bool modelPar_given_eaic,
998  AdmsSensFadType & modelPar_eais,
999  bool modelPar_given_eais,
1000  AdmsSensFadType & modelPar_eane,
1001  bool modelPar_given_eane,
1002  AdmsSensFadType & modelPar_eanc,
1003  bool modelPar_given_eanc,
1004  AdmsSensFadType & modelPar_eans,
1005  bool modelPar_given_eans,
1006  AdmsSensFadType & modelPar_eap,
1007  bool modelPar_given_eap,
1008  AdmsSensFadType & modelPar_dear,
1009  bool modelPar_given_dear,
1010  AdmsSensFadType & modelPar_xis,
1011  bool modelPar_given_xis,
1012  AdmsSensFadType & modelPar_xii,
1013  bool modelPar_given_xii,
1014  AdmsSensFadType & modelPar_xin,
1015  bool modelPar_given_xin,
1016  AdmsSensFadType & modelPar_xisr,
1017  bool modelPar_given_xisr,
1018  AdmsSensFadType & modelPar_xikf,
1019  bool modelPar_given_xikf,
1020  AdmsSensFadType & modelPar_tavc,
1021  bool modelPar_given_tavc,
1022  AdmsSensFadType & modelPar_tavcx,
1023  bool modelPar_given_tavcx,
1024  AdmsSensFadType & modelPar_tnf,
1025  bool modelPar_given_tnf,
1026  AdmsSensFadType & modelPar_tcvef,
1027  bool modelPar_given_tcvef,
1028  AdmsSensFadType & modelPar_tcver,
1029  bool modelPar_given_tcver,
1030  AdmsSensFadType & modelPar_tcrth,
1031  bool modelPar_given_tcrth,
1032  // non-reals (including hidden)
1033  int modelPar_type,
1034  bool modelPar_given_type,
1035  int modelPar_VBICtype,
1036  int modelPar_qbm,
1037  bool modelPar_given_qbm,
1038  double admsTemperature);
1039 
1040 #endif // Xyce_ADMS_SENSITIVITIES
1041 
1042 
1043 // Limited exponential --- NOT what verilog LRM says, but what qucs,
1044 // ng-spice, and zspice do.
1045 
1046 template <typename T>
1047 T limexp(const T &x)
1048 {
1049  if ((x) < 80.0)
1050  return (exp(x));
1051  else
1052  return (exp(80.0)*(x-79.0));
1053 }
1054 
1055 // Maybe this will do as a substitute for a sacado-provided "floor" and "ceil"?
1056 // It is wrong to try to propagate the Sacado derivatives to the return
1057 // value, as the floor and ceil functions have zero derivative w.r.t. any
1058 // of the variables in the argument, except when X is an integer at which
1059 // point the derivative is undefined.
1060 template <typename T>
1061 double ADMSfloor(const T & x)
1062 {
1063  return (floor(x.val()));
1064 }
1065 
1066 template <typename T>
1067 double ADMSceil(const T & x)
1068 {
1069  return (ceil(x.val()));
1070 }
1071 
1072 
1073 struct Traits: public DeviceTraits<Model, Instance, BJT::Traits>
1074 {
1075  static const char *name() {return "VBIC 1.3 3T";}
1076  static const char *deviceTypeName() {return "q level 11";}
1077 
1078  static int numNodes() {return 3;}
1079  static int numOptionalNodes() { return 6;}
1080  static bool modelRequired() {return true;}
1081  static bool isLinearDevice() {return false;}
1082 
1083  static Device *factory(const Configuration &configuration, const FactoryBlock &factory_block);
1084  static void loadModelParameters(ParametricData<Model> &model_parameters);
1085  static void loadInstanceParameters(ParametricData<Instance> &instance_parameters);
1086 };
1087 
1088 //-----------------------------------------------------------------------------
1089 // Class : Instance
1090 
1091 //
1092 // Purpose : This class represents a single instance of the
1093 // device. It mainly contains indices and pointers into
1094 // the matrix equation (see the resistor instance class for
1095 // more details).
1096 //
1097 // Special Notes :
1098 // Creator :
1099 // Creation Date :
1100 //-----------------------------------------------------------------------------
1101 class Instance : public DeviceInstance
1102 {
1103  friend class ParametricData<Instance>;
1104  friend class Model;
1105 #ifdef Xyce_ADMS_SENSITIVITIES
1106  friend class InstanceSensitivity;
1107  friend class ModelSensitivity;
1108 #endif // Xyce_ADMS_SENSITIVITIES
1109  friend class Traits;
1110 
1111 public:
1112  Instance(
1113  const Configuration & configuration,
1114  const InstanceBlock & instance_block,
1115  Model & model,
1116  const FactoryBlock & factory_block);
1117 
1118  ~Instance();
1119 
1120 private:
1121  Instance(const Instance &);
1122  Instance &operator=(const Instance &);
1123 
1124 public:
1125  void registerLIDs( const LocalIdVector & intLIDVecRef,
1126  const LocalIdVector & extLIDVecRef );
1127  void registerStateLIDs( const LocalIdVector & staLIDVecRef );
1128  void setupPointers();
1129 
1130  void loadNodeSymbols(Util::SymbolTable &symbol_table) const;
1131 
1132  const JacobianStamp & jacobianStamp() const;
1133  void registerJacLIDs( const JacobianStamp & jacLIDVec );
1134 
1135  bool processParams();
1136  bool updateTemperature ( const double & temp = -999.0 );
1137  bool updateIntermediateVars ();
1138  bool updatePrimaryState ();
1139  bool updateSecondaryState ();
1140 
1141  // load functions, residual:
1142  bool loadDAEQVector ();
1143  bool loadDAEFVector ();
1144 
1145  // load functions, Jacobian:
1146  bool loadDAEdQdx ();
1147  bool loadDAEdFdx ();
1148 
1149 
1150 private:
1151 
1152 public:
1153  // iterator reference to the vbic13 model which owns this instance.
1154  // Getters and setters
1156  {
1157  return model_;
1158  }
1159 
1160 private:
1161 
1162  Model & model_; //< Owning Model
1163  // Begin verilog Instance Variables
1164  // Instance Parameters
1165  double m;
1166  double trise;
1168  int sw_et;
1169  // Variables of global_instance scope
1170  // end verilog Instance Variables=====
1171  // Nodal LID Variables
1172  int li_c;
1173  int li_b;
1174  int li_e;
1175  int li_dt;
1176  int li_cx;
1177  int li_ci;
1178  int li_bx;
1179  int li_bi;
1180  int li_ei;
1181  int li_bp;
1182  int li_xf1;
1183  int li_xf2;
1184  // end Nodal LID Variables
1185  // Branch LID Variables
1186  // end Branch LID Variables
1187  // Jacobian pointers
1350  // end of Jacobian and pointers
1351  // node numbers
1352  static const int admsNodeID_c = 0;
1353  static const int admsNodeID_b = 1;
1354  static const int admsNodeID_e = 2;
1355  static const int admsNodeID_dt = 3;
1356  static const int admsNodeID_cx = 4;
1357  static const int admsNodeID_ci = 5;
1358  static const int admsNodeID_bx = 6;
1359  static const int admsNodeID_bi = 7;
1360  static const int admsNodeID_ei = 8;
1361  static const int admsNodeID_bp = 9;
1362  static const int admsNodeID_xf1 = 10;
1363  static const int admsNodeID_xf2 = 11;
1364  // end node numbers
1365  // Additional IDs for branch equations
1366  // end branch numbers
1367  // Probe numbers
1368  static const int admsProbeID_V_xf2_GND = 0;
1369  static const int admsProbeID_V_xf1_GND = 1;
1370  static const int admsProbeID_V_bp_cx = 2;
1371  static const int admsProbeID_V_e_ei = 3;
1372  static const int admsProbeID_V_bx_bi = 4;
1373  static const int admsProbeID_V_b_bx = 5;
1374  static const int admsProbeID_V_cx_ci = 6;
1375  static const int admsProbeID_V_c_cx = 7;
1376  static const int admsProbeID_V_b_c = 8;
1377  static const int admsProbeID_V_b_e = 9;
1378  static const int admsProbeID_V_bx_bp = 10;
1379  static const int admsProbeID_V_ci_ei = 11;
1380  static const int admsProbeID_V_bx_cx = 12;
1381  static const int admsProbeID_V_bi_cx = 13;
1382  static const int admsProbeID_V_bi_ci = 14;
1383  static const int admsProbeID_V_bx_ei = 15;
1384  static const int admsProbeID_V_bi_ei = 16;
1385  static const int admsProbeID_Temp_dt_GND = 17;
1386  // end probe numbers
1387  // State LIDs
1396  // end state LIDs
1397  // Arrays to hold probes
1398  std::vector < AdmsFadType > probeVars;
1399  // Arrays to hold contributions
1400  // dynamic contributions are differentiated w.r.t time
1401  std::vector < AdmsFadType > staticContributions;
1402  std::vector < AdmsFadType > dynamicContributions;
1403 
1404  // This array stores the differences between original and limited variables.
1405  std::vector<double> probeDiffs;
1406  // These store the Jdxp's for F and Q, respectively
1407  std::vector<double> Jdxp_static;
1408  std::vector<double> Jdxp_dynamic;
1409 
1410  // this is what we'll use when any model uses $temperature. We'll
1411  // set it in updateTemperature, and initialize it to whatever
1412  // is in devOptions when the instance is constructed.
1414 
1415  // vt at $temperature;
1416  double adms_vt_nom;
1417 
1418  // This is used to flag whether any internal nodes are exposed on the instance
1419  // line. They are set if the user specifies more than the minimum number of
1420  // required nodes.
1427 
1428  // This one is for the annoying bogus "XyceADMSInstTemp" parameter
1429  // that we need so we can set it from the device manager when there's no
1430  // "TEMP" parameter to use
1432 
1433 
1434  static std::vector< std::vector<int> > jacStamp;
1435  static std::vector<int> jacMap;
1436  static std::vector< std::vector<int> > jacMap2;
1437 };
1438 
1439 
1440 
1441 namespace AnalogFunctions
1442 {
1443 
1444 // Analog Function limRTH
1445 template<typename ScalarT> ScalarT limRTH(ScalarT orig, ScalarT old)
1446 {
1447 
1448 
1449  ScalarT limRTH;
1450  ScalarT t0;
1451  ScalarT t1;
1452  ScalarT retval;
1453  {
1454  t0 = (orig-old);
1455  t1 = fabs(t0);
1456  retval = orig;
1457  if ((t1>5.0))
1458  {
1459  if ((t0>0))
1460  {
1461  retval = (old+5.0);
1462  }
1463  else
1464  {
1465  retval = (old-5.0);
1466  }
1467  }
1468  limRTH = retval;
1469  }
1470  return(limRTH);
1471 }
1472 
1473 }
1474 
1475 
1476 //-----------------------------------------------------------------------------
1477 // Class : Model
1478 
1479 // Purpose :
1480 // Special Notes :
1481 // Creator :
1482 // Creation Date :
1483 //-----------------------------------------------------------------------------
1484 class Model : public DeviceModel
1485 {
1486  typedef std::vector<Instance *> InstanceVector;
1487 
1488  friend class ParametricData<Model>;
1489  friend class Instance;
1490 #ifdef Xyce_ADMS_SENSITIVITIES
1491  friend class InstanceSensitivity;
1492  friend class ModelSensitivity;
1493 #endif // Xyce_ADMS_SENSITIVITIES
1494  friend class Traits;
1495 
1496 public:
1497  Model(
1498  const Configuration & configuration,
1499  const ModelBlock & model_block,
1500  const FactoryBlock & factory_block);
1501 
1502  ~Model();
1503 
1504 private:
1505  Model(const Model &);
1506  Model &operator=(const Model &);
1507 
1508 public:
1509  virtual void forEachInstance(DeviceInstanceOp &op) const /* override */;
1510  virtual std::ostream &printOutInstances(std::ostream &os) const;
1511  bool processParams();
1512  bool processInstanceParams();
1513 
1514 private:
1515 
1516 public:
1517  void addInstance(Instance *instance)
1518  {
1519  instanceContainer.push_back(instance);
1520  }
1521 
1522 private:
1523  std::vector<Instance*> instanceContainer;
1524 
1525 private:
1526 
1527  // This one is for the annoying bogus "XyceADMSInstTemp" parameter
1528  // that we need so we can set it from the device manager when there's no
1529  // "TEMP" model parameter to use
1530  double admsModTemp;
1531  // Begin verilog Model Variables
1532  // Model Parameters
1533  double npn;
1534  double pnp;
1535  int type;
1537  double scale;
1538  double shrink;
1539  double tmin;
1540  double tmax;
1541  double gmin;
1542  double pnjmaxi;
1543  double maxexp;
1544  double tnom;
1545  double tminclip;
1546  double tmaxclip;
1547  double rcx;
1548  double rci;
1549  double vo;
1550  double gamm;
1551  double hrcf;
1552  double rbx;
1553  double rbi;
1554  double re;
1555  double rs;
1556  double rbp;
1557  double is;
1558  double isrr;
1559  double nf;
1560  double nr;
1561  int qbm;
1562  double isp;
1563  double wsp;
1564  double nfp;
1565  double fc;
1566  double cbeo;
1567  double cje;
1568  double pe;
1569  double me;
1570  double aje;
1571  double cbco;
1572  double cjc;
1573  double pc;
1574  double mc;
1575  double ajc;
1576  double vrt;
1577  double art;
1578  double qco;
1579  double cjep;
1580  double cjcp;
1581  double ps;
1582  double ms;
1583  double ajs;
1584  double ccso;
1585  double ibei;
1586  double wbe;
1587  double nei;
1588  double qnibeir;
1589  double iben;
1590  double nen;
1591  double ibci;
1592  double nci;
1593  double ibcn;
1594  double ncn;
1595  double ibeip;
1596  double ibenp;
1597  double ibcip;
1598  double ncip;
1599  double ibcnp;
1600  double ncnp;
1601  double vef;
1602  double ver;
1603  double ikf;
1604  double nkf;
1605  double ikr;
1606  double ikp;
1607  double tf;
1608  double qtf;
1609  double xtf;
1610  double vtf;
1611  double itf;
1612  double tr;
1613  double td;
1614  double avc1;
1615  double avc2;
1616  double avcx1;
1617  double avcx2;
1618  double mcx;
1619  double vbbe;
1620  double nbbe;
1621  double ibbe;
1622  double tvbbe1;
1623  double tvbbe2;
1624  double tnbbe;
1625  double vpte;
1626  double ibk0;
1627  double abk;
1628  double bbk;
1629  double kfn;
1630  double afn;
1631  double bfn;
1632  double rth;
1633  double cth;
1634  double xre;
1635  double xrb;
1636  double xrbi;
1637  double xrbx;
1638  double xrc;
1639  double xrci;
1640  double xrcx;
1641  double xrbp;
1642  double xrs;
1643  double xvo;
1644  double ea;
1645  double eaie;
1646  double eaic;
1647  double eais;
1648  double eane;
1649  double eanc;
1650  double eans;
1651  double eap;
1652  double dear;
1653  double xis;
1654  double xii;
1655  double xin;
1656  double xisr;
1657  double xikf;
1658  double tavc;
1659  double tavcx;
1660  double tnf;
1661  double tcvef;
1662  double tcver;
1663  double tcrth;
1664  // Variables of global_model scope
1665  // end verilog model variables=====
1666 };
1667 
1668 void registerDevice();
1669 
1670 } // namespace ADMSvbic13
1671 } // namespace Device
1672 } // namespace Xyce
1673 #endif //Xyce_N_DEV_ADMSvbic13_h
Instance(const Configuration &configuration, const InstanceBlock &instance_block, Model &model, const FactoryBlock &factory_block)
double ADMSceil(const T &x)
Pure virtual class to augment a linear system.
ScalarT limRTH(ScalarT orig, ScalarT old)
std::vector< AdmsFadType > dynamicContributions
Model & operator=(const Model &)
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
void addInstance(Instance *instance)
void registerJacLIDs(const JacobianStamp &jacLIDVec)
static void loadModelParameters(ParametricData< Model > &model_parameters)
Sacado::Fad::SFad< double, 18 > AdmsFadType
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
const JacobianStamp & jacobianStamp() const
std::vector< AdmsFadType > probeVars
void registerStateLIDs(const LocalIdVector &staLIDVecRef)
double ADMSfloor(const T &x)
std::vector< std::vector< int > > JacobianStamp
Definition: N_DEV_fwd.h:196
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
Instance & operator=(const Instance &)
static std::vector< int > jacMap
The Device class is an interface for device implementations.
Definition: N_DEV_Device.h:101
IdVector LocalIdVector
Definition: N_DEV_fwd.h:198
static std::vector< std::vector< int > > jacStamp
Class Configuration contains device configuration data.
static std::vector< std::vector< int > > jacMap2
bool processParams()
processParams
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.
Sacado::Fad::SFad< double, 1 > AdmsSensFadType
bool updateTemperature(const double &temp=-999.0)
virtual std::ostream & printOutInstances(std::ostream &os) const
#define CONSTKoverQ
Definition: N_DEV_Const.h:58
bool processInstanceParams()
processInstanceParams
void registerLIDs(const LocalIdVector &intLIDVecRef, const LocalIdVector &extLIDVecRef)
static const char * deviceTypeName()
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
std::vector< Instance * > instanceContainer
InstanceBlock represent a device instance line from the netlist.
Model(const Configuration &configuration, const ModelBlock &model_block, const FactoryBlock &factory_block)
std::vector< AdmsFadType > staticContributions
void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
std::vector< Instance * > InstanceVector
static Tin adms_ternary_op(const bool cond, const Tin &ifTrue, const Tin &ifFalse)