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