My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
nigbt.core.cpp
Go to the documentation of this file.
1 /*
2  * nigbt.core.cpp - device implementations for nigbt module
3  *
4  * This is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2, or (at your option)
7  * any later version.
8  *
9  */
10 
11 #if HAVE_CONFIG_H
12 #include <config.h>
13 #endif
14 
15 #include "nigbt.analogfunction.h"
16 #include "component.h"
17 #include "device.h"
18 #include "nigbt.core.h"
19 
20 #ifndef CIR_nigbt
21 #define CIR_nigbt -1
22 #endif
23 
24 // external nodes
25 #define C 0
26 #define G 1
27 #define E 2
28 // internal nodes
29 #define e 3
30 #define b 4
31 #define var_Ql 5
32 #define var_Mucinv 6
33 #define var_Nsat 7
34 #define var_dVecdt 8
35 
36 // useful macro definitions
37 #define NP(node) real (getV (node))
38 #define BP(pnode,nnode) (NP(pnode) - NP(nnode))
39 #define _load_static_residual2(pnode,nnode,current)\
40  _rhs[pnode] -= current;\
41  _rhs[nnode] += current;
42 #define _load_static_augmented_residual2(pnode,nnode,current)\
43  _rhs[pnode] -= current;\
44  _rhs[nnode] += current;
45 #define _load_static_residual1(node,current)\
46  _rhs[node] -= current;
47 #define _load_static_augmented_residual1(node,current)\
48  _rhs[node] -= current;
49 #define _load_static_jacobian4(pnode,nnode,vpnode,vnnode,conductance)\
50  _jstat[pnode][vpnode] += conductance;\
51  _jstat[nnode][vnnode] += conductance;\
52  _jstat[pnode][vnnode] -= conductance;\
53  _jstat[nnode][vpnode] -= conductance;\
54  if (doHB) {\
55  _ghs[pnode] += conductance * BP(vpnode,vnnode);\
56  _ghs[nnode] -= conductance * BP(vpnode,vnnode);\
57  } else {\
58  _rhs[pnode] += conductance * BP(vpnode,vnnode);\
59  _rhs[nnode] -= conductance * BP(vpnode,vnnode);\
60  }
61 #define _load_static_jacobian2p(node,vpnode,vnnode,conductance)\
62  _jstat[node][vpnode] += conductance;\
63  _jstat[node][vnnode] -= conductance;\
64  if (doHB) {\
65  _ghs[node] += conductance * BP(vpnode,vnnode);\
66  } else {\
67  _rhs[node] += conductance * BP(vpnode,vnnode);\
68  }
69 #define _load_static_jacobian2s(pnode,nnode,node,conductance)\
70  _jstat[pnode][node] += conductance;\
71  _jstat[nnode][node] -= conductance;\
72  if (doHB) {\
73  _ghs[pnode] += conductance * NP(node);\
74  _ghs[nnode] -= conductance * NP(node);\
75  } else {\
76  _rhs[pnode] += conductance * NP(node);\
77  _rhs[nnode] -= conductance * NP(node);\
78  }
79 #define _load_static_jacobian1(node,vnode,conductance)\
80  _jstat[node][vnode] += conductance;\
81  if (doHB) {\
82  _ghs[node] += conductance * NP(vnode);\
83  } else {\
84  _rhs[node] += conductance * NP(vnode);\
85  }
86 #define _load_dynamic_residual2(pnode,nnode,charge)\
87  if (doTR) _charges[pnode][nnode] += charge;\
88  if (doHB) {\
89  _qhs[pnode] -= charge;\
90  _qhs[nnode] += charge;\
91  }
92 #define _load_dynamic_residual1(node,charge)\
93  if (doTR) _charges[node][node] += charge;\
94  if (doHB) {\
95  _qhs[node] -= charge;\
96  }
97 #define _load_dynamic_jacobian4(pnode,nnode,vpnode,vnnode,capacitance)\
98  if (doAC) {\
99  _jdyna[pnode][vpnode] += capacitance;\
100  _jdyna[nnode][vnnode] += capacitance;\
101  _jdyna[pnode][vnnode] -= capacitance;\
102  _jdyna[nnode][vpnode] -= capacitance;\
103  }\
104  if (doTR) {\
105  _caps[pnode][nnode][vpnode][vnnode] += capacitance;\
106  }\
107  if (doHB) {\
108  _chs[pnode] += capacitance * BP(vpnode,vnnode);\
109  _chs[nnode] -= capacitance * BP(vpnode,vnnode);\
110  }
111 #define _load_dynamic_jacobian2s(pnode,nnode,vnode,capacitance)\
112  if (doAC) {\
113  _jdyna[pnode][vnode] += capacitance;\
114  _jdyna[nnode][vnode] -= capacitance;\
115  }\
116  if (doTR) {\
117  _caps[pnode][nnode][vnode][vnode] += capacitance;\
118  }\
119  if (doHB) {\
120  _chs[pnode] += capacitance * NP(vnode);\
121  _chs[nnode] -= capacitance * NP(vnode);\
122  }
123 #define _load_dynamic_jacobian2p(node,vpnode,vnnode,capacitance)\
124  if (doAC) {\
125  _jdyna[node][vpnode] += capacitance;\
126  _jdyna[node][vnnode] -= capacitance;\
127  }\
128  if (doTR) {\
129  _caps[node][node][vpnode][vnnode] += capacitance;\
130  }\
131  if (doHB) {\
132  _chs[node] += capacitance * BP(vpnode,vnnode);\
133  }
134 #define _load_dynamic_jacobian1(node,vnode,capacitance)\
135  if (doAC) {\
136  _jdyna[node][vnode] += capacitance;\
137  }\
138  if (doTR) {\
139  _caps[node][node][vnode][vnode] += capacitance;\
140  }\
141  if (doHB) {\
142  _chs[node] += capacitance * NP(vnode);\
143  }
144 
145 #define _save_whitenoise1(n1,pwr,type)\
146  _white_pwr[n1][n1] += pwr;
147 #define _save_whitenoise2(n1,n2,pwr,type)\
148  _white_pwr[n1][n2] += pwr;
149 #define _save_flickernoise1(n1,pwr,exp,type)\
150  _flicker_pwr[n1][n1] += pwr;\
151  _flicker_exp[n1][n1] += exp;
152 #define _save_flickernoise2(n1,n2,pwr,exp,type)\
153  _flicker_pwr[n1][n2] += pwr;\
154  _flicker_exp[n1][n2] += exp;
155 #define _load_whitenoise2(n1,n2,pwr)\
156  cy (n1,n2) -= pwr/kB/T0; cy (n2,n1) -= pwr/kB/T0;\
157  cy (n1,n1) += pwr/kB/T0; cy (n2,n2) += pwr/kB/T0;
158 #define _load_whitenoise1(n1,pwr)\
159  cy (n1,n1) += pwr/kB/T0;
160 #define _load_flickernoise2(n1,n2,pwr,exp)\
161  cy (n1,n2) -= pwr*pow(_freq,-exp)/kB/T0;\
162  cy (n2,n1) -= pwr*pow(_freq,-exp)/kB/T0;\
163  cy (n1,n1) += pwr*pow(_freq,-exp)/kB/T0;\
164  cy (n2,n2) += pwr*pow(_freq,-exp)/kB/T0;
165 #define _load_flickernoise1(n1,pwr,exp)\
166  cy (n1,n1) += pwr*pow(_freq,-exp)/kB/T0;
167 
168 // derivative helper macros
169 #define m00_hypot(v00,x,y) v00 = xhypot(x,y);
170 #define m10_hypot(v10,v00,x,y) v10 = (x)/(v00);
171 #define m11_hypot(v11,v00,x,y) v11 = (y)/(v00);
172 #define m00_max(v00,x,y) v00 = ((x)>(y))?(x):(y);
173 #define m10_max(v10,v00,x,y) v10 = ((x)>(y))?1.0:0.0;
174 #define m11_max(v11,v00,x,y) v11 = ((x)>(y))?0.0:1.0;
175 #define m00_min(v00,x,y) v00 = ((x)<(y))?(x):(y);
176 #define m10_min(v10,v00,x,y) v10 = ((x)<(y))?1.0:0.0;
177 #define m11_min(v11,v00,x,y) v11 = ((x)<(y))?0.0:1.0;
178 #define m00_pow(v00,x,y) v00 = pow(x,y);
179 #define m10_pow(v10,v00,x,y) v10 = (x==0.0)?0.0:(v00)*(y)/(x);
180 #define m11_pow(v11,v00,x,y) v11 = (x==0.0)?0.0:(log(x)*(v00));
181 
182 #define m00_div(v00,v10,x,y) double v10=1/(y); double v00=(x)*v10;
183 #define m10_div(v10,v00,vv,x,y)
184 #define m11_div(v11,v00,vv,x,y) double v11 = -v00*vv;
185 
186 #define m00_mult(v00,v10,v11,x,y) double v10=(x); double v11=(y); double v00=v10*v11;
187 #define m00_add(v00,x,y) double v00=(x)+(y);
188 
189 #define m00_cos(v00,x) v00 = cos(x);
190 #define m10_cos(v10,v00,x) v10 = (-sin(x));
191 #define m00_sin(v00,x) v00 = sin(x);
192 #define m10_sin(v10,v00,x) v10 = (cos(x));
193 #define m00_tan(v00,x) v00 = tan(x);
194 #define m10_tan(v10,v00,x) v10 = (1.0/cos(x)/cos(x));
195 #define m00_cosh(v00,x) v00 = cosh(x);
196 #define m10_cosh(v10,v00,x) v10 = (sinh(x));
197 #define m00_sinh(v00,x) v00 = sinh(x);
198 #define m10_sinh(v10,v00,x) v10 = (cosh(x));
199 #define m00_tanh(v00,x) v00 = tanh(x);
200 #define m10_tanh(v10,v00,x) v10 = (1.0/cosh(x)/cosh(x));
201 #define m00_acos(v00,x) v00 = acos(x);
202 #define m10_acos(v10,v00,x) v10 = (-1.0/sqrt(1-x*x));
203 #define m00_asin(v00,x) v00 = asin(x);
204 #define m10_asin(v10,v00,x) v10 = (+1.0/sqrt(1-x*x));
205 #define m00_atan(v00,x) v00 = atan(x);
206 #define m10_atan(v10,v00,x) v10 = (+1.0/(1+x*x));
207 #define m00_atanh(v00,x) v00 = atanh(x);
208 #define m10_atanh(v10,v00,x) v10 = (+1.0/(1-x*x));
209 #define m00_logE(v00,x) v00 = log(x);
210 #define m10_logE(v10,v00,x) v10 = (1.0/x);
211 #define m00_log10(v00,x) v00 = log10(x);
212 #define m10_log10(v10,v00,x) v10 = (1.0/x/M_LN10);
213 #define m00_sqrt(v00,x) v00 = sqrt(x);
214 #define m10_sqrt(v10,v00,x) v10 = (0.5/v00);
215 #define m00_fabs(v00,x) v00 = fabs(x);
216 #define m10_fabs(v10,v00,x) v10 = (((x)>=0)?(+1.0):(-1.0));
217 
218 #define m00_exp(v00,x) v00 = exp(x);
219 #define m10_exp(v10,v00,x) v10 = v00;
220 
221 #define m00_abs(v00) ((v00)<(0)?(-(v00)):(v00))
222 #define m00_floor(v00,x) v00 = floor(x);
223 #define m00_limexp(v00,x) v00 = ((x)<80.0?exp(x):exp(80.0)*(x-79.0));
224 #define m10_limexp(v10,v00,x) v10 = ((x)<80.0?(v00):exp(80.0));
225 
226 #define m20_logE(v00) (-1.0/v00/v00)
227 #define m20_exp(v00) exp(v00)
228 #define m20_limexp(v00) ((v00)<80.0?exp(v00):0.0)
229 #define m20_sqrt(v00) (-0.25/(v00)/sqrt(v00))
230 #define m20_fabs(v00) 0.0
231 #define m20_pow(x,y) ((y)*((y)-1.0)*pow(x,y)/(x)/(x))
232 #define m00_vt(x) (kBoverQ*(x))
233 #define m10_vt(x) (kBoverQ)
234 
235 // simulator specific definitions
236 #define _modelname "nigbt"
237 #define _instancename getName()
238 #define _circuit_temp (getPropertyDouble("Temp")+273.15)
239 #define _param_given(p) (isPropertyGiven(p)?1:0)
240 
241 
242 // $vt and $vt() functions
243 #define _vt_nom (kBoverQ*_circuit_temp)
244 
245 using namespace device;
246 
247 /* Device constructor. */
248 nigbt::nigbt() : circuit (9)
249 {
250  type = CIR_nigbt;
251 }
252 
253 /* Initialization of model. */
254 void nigbt::initModel (void)
255 {
256  // create internal nodes
257  setInternalNode (e, "e");
258  setInternalNode (b, "b");
259  setInternalNode (var_Ql, "var_Ql");
260  setInternalNode (var_Mucinv, "var_Mucinv");
261  setInternalNode (var_Nsat, "var_Nsat");
262  setInternalNode (var_dVecdt, "var_dVecdt");
263 
264  // get device model parameters
265  loadVariables ();
266  // evaluate global model equations
267  initializeModel ();
268  // evaluate initial step equations
269  initialStep ();
270  // evaluate global instance equations
271  initializeInstance ();
272 }
273 
274 /* Initialization of DC analysis. */
275 void nigbt::initDC (void)
276 {
277  allocMatrixMNA ();
278  initModel ();
279  pol = 1;
280  restartDC ();
281  doAC = 1;
282  doTR = 0;
283  doHB = 0;
284 }
285 
286 /* Run when DC is restarted (fallback algorithms). */
287 void nigbt::restartDC (void)
288 {
289 }
290 
291 /* Initialize Verilog-AMS code. */
292 void nigbt::initVerilog (void)
293 {
294  // initialization of noise variables
295 
296  int i1, i2, i3, i4;
297 
298  // zero charges
299  for (i1 = 0; i1 < 9; i1++) {
300  for (i2 = 0; i2 < 9; i2++) {
301  _charges[i1][i2] = 0.0;
302  } }
303 
304  // zero capacitances
305  for (i1 = 0; i1 < 9; i1++) {
306  for (i2 = 0; i2 < 9; i2++) {
307  for (i3 = 0; i3 < 9; i3++) {
308  for (i4 = 0; i4 < 9; i4++) {
309  _caps[i1][i2][i3][i4] = 0.0;
310  } } } }
311 
312  // zero right hand side, static and dynamic jacobian
313  for (i1 = 0; i1 < 9; i1++) {
314  _rhs[i1] = 0.0;
315  _qhs[i1] = 0.0;
316  _chs[i1] = 0.0;
317  _ghs[i1] = 0.0;
318  for (i2 = 0; i2 < 9; i2++) {
319  _jstat[i1][i2] = 0.0;
320  _jdyna[i1][i2] = 0.0;
321  }
322  }
323 }
324 
325 /* Load device model input parameters. */
326 void nigbt::loadVariables (void)
327 {
328  Agd = getPropertyDouble ("Agd");
329  Area = getPropertyDouble ("Area");
330  Kp = getPropertyDouble ("Kp");
331  Tau = getPropertyDouble ("Tau");
332  Wb = getPropertyDouble ("Wb");
333  BVf = getPropertyDouble ("BVf");
334  BVn = getPropertyDouble ("BVn");
335  Cgs = getPropertyDouble ("Cgs");
336  Coxd = getPropertyDouble ("Coxd");
337  Jsne = getPropertyDouble ("Jsne");
338  Kf = getPropertyDouble ("Kf");
339  Mun = getPropertyDouble ("Mun");
340  Mup = getPropertyDouble ("Mup");
341  Nb = getPropertyDouble ("Nb");
342  Theta = getPropertyDouble ("Theta");
343  Vt = getPropertyDouble ("Vt");
344  Vtd = getPropertyDouble ("Vtd");
345  Tnom = getPropertyDouble ("Tnom");
346 }
347 
348 /* #define's for translated code */
349 #undef _DDT
350 #define _DDT(q) q
351 #define _DYNAMIC
352 #define _DERIVATE
353 #define _DDX
354 #define _DERIVATEFORDDX
355 
356 /* Evaluate Verilog-AMS equations in model initialization. */
357 void nigbt::initializeModel (void)
358 {
359 double Dn;
360 double Nh;
361 #if defined(_DYNAMIC)
362 #endif
363 double To;
364 {
365 Tj=_circuit_temp;
366 To=(Tnom+273.15);
367 A=Area;
368 #if defined(_DYNAMIC)
369 Ads=(A-Agd);
370 #endif
371 B=(Mun/Mup);
372 #if defined(_DYNAMIC)
373 Nh=2.4e17;
374 #endif
375 Nl=Nb;
376 Ni=1.05e10;
377 {
378 double m00_pow(d00_pow0,Tj,1.5)
379 double m00_exp(d00_exp1,(7000.0/Tj))
380 Ni=((3.88e16*d00_pow0)/d00_exp1);
381 }
382 {
383 double m00_pow(d00_pow0,(300/Tj),0.87)
384 Vnsat=(10.0e6*d00_pow0);
385 }
386 {
387 double m00_pow(d00_pow0,(300/Tj),0.52)
388 Vpsat=(8.37e6*d00_pow0);
389 }
390 {
391 double m00_pow(d00_pow0,(Tj/300),1.5)
392 Alpha1=(1.04e21*d00_pow0);
393 }
394 {
395 double m00_pow(d00_pow0,(Tj/300),2.0)
396 Alpha2=(7.45e13*d00_pow0);
397 }
398 {
399 double m00_pow(d00_pow0,(Tj/To),(Jsne*A))
400 double m00_exp(d00_exp1,(14000*((1/Tj)-(1/To))))
401 Isne=(((Jsne*A)*d00_pow0)/d00_exp1);
402 }
403 {
404 double m00_pow(d00_pow0,(To/Tj),Kp)
405 KpT=(Kp*d00_pow0);
406 }
407 Wl=Wb;
408 Dp=(Mup*m00_vt(Tj));
409 #if defined(_DYNAMIC)
410 Dn=(Mun*m00_vt(Tj));
411 #endif
412 }
413 }
414 
415 /* Evaluate Verilog-AMS equations in instance initialization. */
416 void nigbt::initializeInstance (void)
417 {
418 }
419 
420 /* Evaluate Verilog-AMS equations in initial step. */
421 void nigbt::initialStep (void)
422 {
423 }
424 
425 /* Evaluate Verilog-AMS equations in final step. */
426 void nigbt::finalStep (void)
427 {
428 }
429 
430 /* Evaluate Verilog-AMS equations in analog block. */
431 void nigbt::calcVerilog (void)
432 {
433 
434 /* ----------------- evaluate verilog analog equations -------------------- */
435 double iNsat;
436 #if defined(_DERIVATE)
437 double iNsat_VC_e;
438 double iNsat_Vvar_Ql_GND;
439 double iNsat_Vb_E;
440 double iNsat_Vvar_Nsat_GND;
441 double iNsat_Vvar_Mucinv_GND;
442 double iNsat_Vvar_dVecdt_GND;
443 double iNsat_VG_E;
444 #endif
445 double iQl;
446 #if defined(_DERIVATE)
447 double iQl_Vb_E;
448 double iQl_Vvar_Nsat_GND;
449 double iQl_Vvar_Ql_GND;
450 double iQl_Vvar_Mucinv_GND;
451 #endif
452 double iMucinv;
453 #if defined(_DERIVATE)
454 double iMucinv_Vvar_Ql_GND;
455 double iMucinv_Vvar_Mucinv_GND;
456 double iMucinv_Vb_E;
457 double iMucinv_Vvar_Nsat_GND;
458 #endif
459 #if defined(_DYNAMIC)
460 double Qmult;
461 #if defined(_DERIVATE)
462 double Qmult_Vb_E;
463 double Qmult_Vvar_Nsat_GND;
464 double Qmult_Vvar_Ql_GND;
465 double Qmult_Ve_E;
466 #endif
467 #endif
468 #if defined(_DYNAMIC)
469 double Qcer;
470 #if defined(_DERIVATE)
471 double Qcer_Vvar_Ql_GND;
472 double Qcer_Vb_E;
473 double Qcer_Vvar_Nsat_GND;
474 double Qcer_Ve_E;
475 #endif
476 #endif
477 #if defined(_DYNAMIC)
478 double Qgd;
479 #if defined(_DERIVATE)
480 double Qgd_Vb_G;
481 double Qgd_Vvar_Nsat_GND;
482 #endif
483 #endif
484 double Imult;
485 #if defined(_DERIVATE)
486 double Imult_Vb_E;
487 double Imult_Vvar_Nsat_GND;
488 double Imult_VG_E;
489 double Imult_VC_e;
490 double Imult_Vvar_Ql_GND;
491 double Imult_Vvar_Mucinv_GND;
492 double Imult_Vvar_dVecdt_GND;
493 #endif
494 double Igen;
495 #if defined(_DERIVATE)
496 double Igen_Vb_E;
497 double Igen_Vvar_Nsat_GND;
498 #endif
499 double Imos;
500 #if defined(_DERIVATE)
501 double Imos_Vb_E;
502 double Imos_VG_E;
503 #endif
504 double Ibss;
505 #if defined(_DERIVATE)
506 double Ibss_Vvar_Ql_GND;
507 double Ibss_Vb_E;
508 double Ibss_Vvar_Nsat_GND;
509 #endif
510 double Ic;
511 #if defined(_DERIVATE)
512 double Ic_VC_e;
513 double Ic_Vvar_Ql_GND;
514 double Ic_Vb_E;
515 double Ic_Vvar_Nsat_GND;
516 double Ic_Vvar_Mucinv_GND;
517 double Ic_Vvar_dVecdt_GND;
518 #endif
519 double Icss;
520 #if defined(_DERIVATE)
521 double Icss_VC_e;
522 double Icss_Vvar_Ql_GND;
523 double Icss_Vb_E;
524 double Icss_Vvar_Nsat_GND;
525 double Icss_Vvar_Mucinv_GND;
526 #endif
527 double It;
528 #if defined(_DERIVATE)
529 double It_VC_e;
530 double It_Vvar_Ql_GND;
531 double It_Vb_E;
532 double It_Vvar_Nsat_GND;
533 double It_Vvar_Mucinv_GND;
534 #endif
535 double M;
536 #if defined(_DERIVATE)
537 double M_Vb_E;
538 double M_Vvar_Nsat_GND;
539 #endif
540 double Vnrt;
541 #if defined(_DERIVATE)
542 double Vnrt_Vb_E;
543 #endif
544 double BVcbo;
545 #if defined(_DERIVATE)
546 double BVcbo_Vvar_Nsat_GND;
547 #endif
548 double Vebq;
549 double Vebd;
550 double Vebj;
551 double Rb;
552 #if defined(_DERIVATE)
553 double Rb_Vvar_Ql_GND;
554 double Rb_Vb_E;
555 double Rb_Vvar_Nsat_GND;
556 double Rb_Vvar_Mucinv_GND;
557 #endif
558 double Neff;
559 #if defined(_DERIVATE)
560 double Neff_Vb_E;
561 double Neff_Vvar_Nsat_GND;
562 double Neff_Vvar_Mucinv_GND;
563 double Neff_Vvar_Ql_GND;
564 #endif
565 double Deltap;
566 #if defined(_DERIVATE)
567 double Deltap_Vvar_Ql_GND;
568 double Deltap_Vvar_Mucinv_GND;
569 double Deltap_Vb_E;
570 double Deltap_Vvar_Nsat_GND;
571 #endif
572 double Plo;
573 #if defined(_DERIVATE)
574 double Plo_Vvar_Ql_GND;
575 double Plo_Vvar_Mucinv_GND;
576 double Plo_Vb_E;
577 double Plo_Vvar_Nsat_GND;
578 #endif
579 double Tanh;
580 #if defined(_DERIVATE)
581 double Tanh_Vb_E;
582 double Tanh_Vvar_Nsat_GND;
583 double Tanh_Vvar_Mucinv_GND;
584 #endif
585 double WL2;
586 #if defined(_DERIVATE)
587 double WL2_Vb_E;
588 double WL2_Vvar_Nsat_GND;
589 double WL2_Vvar_Mucinv_GND;
590 #endif
591 double WL;
592 #if defined(_DERIVATE)
593 double WL_Vb_E;
594 double WL_Vvar_Nsat_GND;
595 double WL_Vvar_Mucinv_GND;
596 #endif
597 double L;
598 #if defined(_DERIVATE)
599 double L_Vvar_Mucinv_GND;
600 #endif
601 double Dc;
602 #if defined(_DERIVATE)
603 double Dc_Vvar_Mucinv_GND;
604 #endif
605 double Mueff;
606 #if defined(_DERIVATE)
607 double Mueff_Vvar_Mucinv_GND;
608 double Mueff_Vvar_Ql_GND;
609 double Mueff_Vb_E;
610 double Mueff_Vvar_Nsat_GND;
611 #endif
612 double Mupc;
613 #if defined(_DERIVATE)
614 double Mupc_Vvar_Mucinv_GND;
615 #endif
616 double Munc;
617 #if defined(_DERIVATE)
618 double Munc_Vvar_Mucinv_GND;
619 #endif
620 #if defined(_DYNAMIC)
621 double Cgd;
622 #if defined(_DERIVATE)
623 double Cgd_Vb_G;
624 double Cgd_Vvar_Nsat_GND;
625 #endif
626 #endif
627 #if defined(_DYNAMIC)
628 double Cgdj;
629 #if defined(_DERIVATE)
630 double Cgdj_Vb_G;
631 double Cgdj_Vvar_Nsat_GND;
632 #endif
633 #endif
634 double Cdsj;
635 double Ccer;
636 #if defined(_DERIVATE)
637 double Ccer_Vvar_Ql_GND;
638 double Ccer_Vb_E;
639 double Ccer_Vvar_Nsat_GND;
640 #endif
641 double Cbcj;
642 #if defined(_DERIVATE)
643 double Cbcj_Vb_E;
644 double Cbcj_Vvar_Nsat_GND;
645 #endif
646 double Qbi;
647 double Qb;
648 #if defined(_DERIVATE)
649 double Qb_Vb_E;
650 double Qb_Vvar_Nsat_GND;
651 #endif
652 #if defined(_DYNAMIC)
653 double Qds;
654 #if defined(_DERIVATE)
655 double Qds_Vb_E;
656 double Qds_Vvar_Nsat_GND;
657 #endif
658 #endif
659 #if defined(_DYNAMIC)
660 double Qgs;
661 #if defined(_DERIVATE)
662 double Qgs_VG_E;
663 #endif
664 #endif
665 double W;
666 #if defined(_DERIVATE)
667 double W_Vb_E;
668 double W_Vvar_Nsat_GND;
669 #endif
670 double Wbcj;
671 #if defined(_DERIVATE)
672 double Wbcj_Vb_E;
673 double Wbcj_Vvar_Nsat_GND;
674 #endif
675 double Wdsj;
676 #if defined(_DYNAMIC)
677 double Wgdj;
678 #if defined(_DERIVATE)
679 double Wgdj_Vb_G;
680 double Wgdj_Vvar_Nsat_GND;
681 #endif
682 #endif
683 double Nscl;
684 #if defined(_DERIVATE)
685 double Nscl_Vvar_Nsat_GND;
686 #endif
687 double dVecdt;
688 #if defined(_DERIVATE)
689 double dVecdt_Vvar_dVecdt_GND;
690 #endif
691 double Mucinv;
692 #if defined(_DERIVATE)
693 double Mucinv_Vvar_Mucinv_GND;
694 #endif
695 double Nsat;
696 #if defined(_DERIVATE)
697 double Nsat_Vvar_Nsat_GND;
698 #endif
699 double Ql;
700 #if defined(_DERIVATE)
701 double Ql_Vvar_Ql_GND;
702 #endif
703 double Vth;
704 #if defined(_DERIVATE)
705 double Vth_VG_E;
706 #endif
707 double Vbc;
708 #if defined(_DERIVATE)
709 double Vbc_Vb_E;
710 #endif
711 double Vec;
712 #if defined(_DERIVATE)
713 double Vec_Ve_E;
714 #endif
715 double Vae;
716 #if defined(_DERIVATE)
717 double Vae_VC_e;
718 #endif
719 double Veb;
720 #if defined(_DERIVATE)
721 double Veb_Ve_b;
722 #endif
723 double Vds;
724 #if defined(_DERIVATE)
725 double Vds_Vb_E;
726 #endif
727 double Vgs;
728 #if defined(_DERIVATE)
729 double Vgs_VG_E;
730 #endif
731 double Vdg;
732 #if defined(_DERIVATE)
733 double Vdg_Vb_G;
734 #endif
735 #if defined(_DERIVATE)
736 Vdg_Vb_G=1.0;
737 #endif
738 Vdg=BP(b,G);
739 #if defined(_DERIVATE)
740 Vgs_VG_E=1.0;
741 #endif
742 Vgs=BP(G,E);
743 #if defined(_DERIVATE)
744 Vds_Vb_E=1.0;
745 #endif
746 Vds=BP(b,E);
747 #if defined(_DERIVATE)
748 Veb_Ve_b=1.0;
749 #endif
750 Veb=BP(e,b);
751 #if defined(_DERIVATE)
752 Vae_VC_e=1.0;
753 #endif
754 Vae=BP(C,e);
755 #if defined(_DERIVATE)
756 Vec_Ve_E=1.0;
757 #endif
758 Vec=BP(e,E);
759 #if defined(_DERIVATE)
760 Vbc_Vb_E=Vds_Vb_E;
761 #endif
762 Vbc=Vds;
763 #if defined(_DERIVATE)
764 Vth_VG_E=Vgs_VG_E;
765 #endif
766 Vth=(Vgs-Vt);
767 #if defined(_DERIVATE)
768 Ql_Vvar_Ql_GND=1.0;
769 #endif
770 Ql=NP(var_Ql);
771 #if defined(_DERIVATE)
772 Nsat_Vvar_Nsat_GND=1.0;
773 #endif
774 Nsat=NP(var_Nsat);
775 #if defined(_DERIVATE)
776 Mucinv_Vvar_Mucinv_GND=1.0;
777 #endif
778 Mucinv=NP(var_Mucinv);
779 #if defined(_DERIVATE)
780 dVecdt_Vvar_dVecdt_GND=1.0;
781 #endif
782 dVecdt=NP(var_dVecdt);
783 {
784 double m00_max(d00_max0,(Nl+Nsat),1e-20)
785 #if defined(_DERIVATE)
786 double m10_max(d10_max0,d00_max0,(Nl+Nsat),1e-20)
787 #endif
788 #if defined(_DERIVATE)
789 Nscl_Vvar_Nsat_GND=(d10_max0*Nsat_Vvar_Nsat_GND);
790 #endif
791 Nscl=d00_max0;
792 }
793 #ifdef _DYNAMIC
794 if
795 ((Vdg>(-Vtd)))
796 {
797 #if defined(_DYNAMIC)
798 {
799 double m00_sqrt(d00_sqrt0,((((2*1.03594e-10)*(Vdg+Vtd))/1.602176462e-19)/Nscl))
800 double m00_min(d00_min1,d00_sqrt0,Wl)
801 #if defined(_DERIVATE)
802 double m10_sqrt(d10_sqrt0,d00_sqrt0,((((2*1.03594e-10)*(Vdg+Vtd))/1.602176462e-19)/Nscl))
803 double m10_min(d10_min1,d00_min1,d00_sqrt0,Wl)
804 #endif
805 #if defined(_DERIVATE)
806 Wgdj_Vb_G=(d10_min1*((((2*1.03594e-10)*Vdg_Vb_G)/1.602176462e-19)/Nscl)*d10_sqrt0);
807 Wgdj_Vvar_Nsat_GND=(d10_min1*(-(((2*1.03594e-10)*(Vdg+Vtd))/1.602176462e-19)*Nscl_Vvar_Nsat_GND/Nscl/Nscl)*d10_sqrt0);
808 #endif
809 Wgdj=d00_min1;
810 }
811 #endif
812 }
813 else
814 {
815 #if defined(_DYNAMIC)
816 #if defined(_DERIVATE)
817 Wgdj_Vb_G=0.0;
818 Wgdj_Vvar_Nsat_GND=0.0;
819 #endif
820 Wgdj=0;
821 #endif
822 }
823 #endif /* if (...) */
824 #ifdef _DYNAMIC
825 if
826 ((Vds>(-0.6)))
827 {
828 #if defined(_DYNAMIC)
829 {
830 double m00_sqrt(d00_sqrt0,((((2*1.03594e-10)*(Vds+0.6))/1.602176462e-19)/Nscl))
831 double m00_min(d00_min1,d00_sqrt0,Wl)
832 #if defined(_DERIVATE)
833 double m10_sqrt(d10_sqrt0,d00_sqrt0,((((2*1.03594e-10)*(Vds+0.6))/1.602176462e-19)/Nscl))
834 double m10_min(d10_min1,d00_min1,d00_sqrt0,Wl)
835 #endif
836 Wdsj=d00_min1;
837 }
838 #endif
839 }
840 else
841 {
842 #if defined(_DYNAMIC)
843 Wdsj=0;
844 #endif
845 }
846 #endif /* if (...) */
847 if
848 ((Vbc>(-0.6)))
849 {
850 {
851 double m00_sqrt(d00_sqrt0,((((2*1.03594e-10)*(Vbc+0.6))/1.602176462e-19)/Nscl))
852 double m00_min(d00_min1,d00_sqrt0,Wl)
853 #if defined(_DERIVATE)
854 double m10_sqrt(d10_sqrt0,d00_sqrt0,((((2*1.03594e-10)*(Vbc+0.6))/1.602176462e-19)/Nscl))
855 double m10_min(d10_min1,d00_min1,d00_sqrt0,Wl)
856 #endif
857 #if defined(_DERIVATE)
858 Wbcj_Vb_E=(d10_min1*((((2*1.03594e-10)*Vbc_Vb_E)/1.602176462e-19)/Nscl)*d10_sqrt0);
859 Wbcj_Vvar_Nsat_GND=(d10_min1*(-(((2*1.03594e-10)*(Vbc+0.6))/1.602176462e-19)*Nscl_Vvar_Nsat_GND/Nscl/Nscl)*d10_sqrt0);
860 #endif
861 Wbcj=d00_min1;
862 }
863 }
864 else
865 {
866 #if defined(_DERIVATE)
867 Wbcj_Vb_E=0.0;
868 Wbcj_Vvar_Nsat_GND=0.0;
869 #endif
870 Wbcj=0;
871 }
872 #if defined(_DERIVATE)
873 W_Vb_E=(-Wbcj_Vb_E);
874 W_Vvar_Nsat_GND=(-Wbcj_Vvar_Nsat_GND);
875 #endif
876 W=(Wl-Wbcj);
877 #if defined(_DYNAMIC)
878 #if defined(_DERIVATE)
879 Qgs_VG_E=(Cgs*Vgs_VG_E);
880 #endif
881 Qgs=(Cgs*Vgs);
882 #endif
883 #ifdef _DYNAMIC
884 if
885 ((Vds>(-0.6)))
886 {
887 #if defined(_DYNAMIC)
888 {
889 double m00_sqrt(d00_sqrt0,((((2*1.03594e-10)*(Vds+0.6))*1.602176462e-19)*Nscl))
890 #if defined(_DERIVATE)
891 double m10_sqrt(d10_sqrt0,d00_sqrt0,((((2*1.03594e-10)*(Vds+0.6))*1.602176462e-19)*Nscl))
892 #endif
893 #if defined(_DERIVATE)
894 Qds_Vb_E=(Ads*((2*1.03594e-10)*Vds_Vb_E)*1.602176462e-19*Nscl*d10_sqrt0);
895 Qds_Vvar_Nsat_GND=(Ads*((((2*1.03594e-10)*(Vds+0.6))*1.602176462e-19)*Nscl_Vvar_Nsat_GND)*d10_sqrt0);
896 #endif
897 Qds=(Ads*d00_sqrt0);
898 }
899 #endif
900 }
901 else
902 {
903 #if defined(_DYNAMIC)
904 #if defined(_DERIVATE)
905 Qds_Vb_E=0.0;
906 Qds_Vvar_Nsat_GND=0.0;
907 #endif
908 Qds=0;
909 #endif
910 }
911 #endif /* if (...) */
912 #if defined(_DERIVATE)
913 Qb_Vb_E=((1.602176462e-19*A)*W_Vb_E)*Nscl;
914 Qb_Vvar_Nsat_GND=((((1.602176462e-19*A)*W_Vvar_Nsat_GND)*Nscl)+(((1.602176462e-19*A)*W)*Nscl_Vvar_Nsat_GND));
915 #endif
916 Qb=(((1.602176462e-19*A)*W)*Nscl);
917 #if defined(_DYNAMIC)
918 {
919 double m00_sqrt(d00_sqrt0,((((2*1.03594e-10)*1.602176462e-19)*Nl)*0.6))
920 Qbi=(A*d00_sqrt0);
921 }
922 #endif
923 #if defined(_DERIVATE)
924 Cbcj_Vb_E=(-(A*1.03594e-10)*Wbcj_Vb_E/(Wbcj+1e-20)/(Wbcj+1e-20));
925 Cbcj_Vvar_Nsat_GND=(-(A*1.03594e-10)*Wbcj_Vvar_Nsat_GND/(Wbcj+1e-20)/(Wbcj+1e-20));
926 #endif
927 Cbcj=((A*1.03594e-10)/(Wbcj+1e-20));
928 #if defined(_DERIVATE)
929 Ccer_Vvar_Ql_GND=((Ql_Vvar_Ql_GND*Cbcj/3)/(Qb+1e-20));
930 Ccer_Vb_E=((((Ql*Cbcj_Vb_E)/3)*(Qb+1e-20)-((Ql*Cbcj)/3)*Qb_Vb_E)/(Qb+1e-20)/(Qb+1e-20));
931 Ccer_Vvar_Nsat_GND=((((Ql*Cbcj_Vvar_Nsat_GND)/3)*(Qb+1e-20)-((Ql*Cbcj)/3)*Qb_Vvar_Nsat_GND)/(Qb+1e-20)/(Qb+1e-20));
932 #endif
933 Ccer=(((Ql*Cbcj)/3)/(Qb+1e-20));
934 #if defined(_DYNAMIC)
935 Cdsj=((Ads*1.03594e-10)/(Wdsj+1e-20));
936 #endif
937 #if defined(_DYNAMIC)
938 #if defined(_DERIVATE)
939 Cgdj_Vb_G=(-(Agd*1.03594e-10)*Wgdj_Vb_G/(Wgdj+1e-20)/(Wgdj+1e-20));
940 Cgdj_Vvar_Nsat_GND=(-(Agd*1.03594e-10)*Wgdj_Vvar_Nsat_GND/(Wgdj+1e-20)/(Wgdj+1e-20));
941 #endif
942 Cgdj=((Agd*1.03594e-10)/(Wgdj+1e-20));
943 #endif
944 #ifdef _DYNAMIC
945 if
946 ((Vds<(Vgs-Vtd)))
947 {
948 #if defined(_DYNAMIC)
949 #if defined(_DERIVATE)
950 Cgd_Vb_G=0.0;
951 Cgd_Vvar_Nsat_GND=0.0;
952 #endif
953 Cgd=Coxd;
954 #endif
955 }
956 else
957 {
958 #if defined(_DYNAMIC)
959 #if defined(_DERIVATE)
960 Cgd_Vb_G=(((Coxd*Cgdj_Vb_G)*(Coxd+Cgdj)-(Coxd*Cgdj)*Cgdj_Vb_G)/(Coxd+Cgdj)/(Coxd+Cgdj));
961 Cgd_Vvar_Nsat_GND=(((Coxd*Cgdj_Vvar_Nsat_GND)*(Coxd+Cgdj)-(Coxd*Cgdj)*Cgdj_Vvar_Nsat_GND)/(Coxd+Cgdj)/(Coxd+Cgdj));
962 #endif
963 Cgd=((Coxd*Cgdj)/(Coxd+Cgdj));
964 #endif
965 }
966 #endif /* if (...) */
967 #if defined(_DERIVATE)
968 Munc_Vvar_Mucinv_GND=(-1*Mucinv_Vvar_Mucinv_GND/((1/Mun)+Mucinv)/((1/Mun)+Mucinv));
969 #endif
970 Munc=(1/((1/Mun)+Mucinv));
971 #if defined(_DERIVATE)
972 Mupc_Vvar_Mucinv_GND=(-1*Mucinv_Vvar_Mucinv_GND/((1/Mup)+Mucinv)/((1/Mup)+Mucinv));
973 #endif
974 Mupc=(1/((1/Mup)+Mucinv));
975 if
976 ((Ql>0))
977 {
978 #if defined(_DERIVATE)
979 Mueff_Vvar_Mucinv_GND=(Munc_Vvar_Mucinv_GND+(Mupc_Vvar_Mucinv_GND*Ql/(Ql+Qb)));
980 Mueff_Vvar_Ql_GND=(((Mupc*Ql_Vvar_Ql_GND)*(Ql+Qb)-(Mupc*Ql)*Ql_Vvar_Ql_GND)/(Ql+Qb)/(Ql+Qb));
981 Mueff_Vb_E=(-(Mupc*Ql)*Qb_Vb_E/(Ql+Qb)/(Ql+Qb));
982 Mueff_Vvar_Nsat_GND=(-(Mupc*Ql)*Qb_Vvar_Nsat_GND/(Ql+Qb)/(Ql+Qb));
983 #endif
984 Mueff=(Munc+((Mupc*Ql)/(Ql+Qb)));
985 }
986 else
987 {
988 #if defined(_DERIVATE)
989 Mueff_Vvar_Mucinv_GND=Munc_Vvar_Mucinv_GND;
990 Mueff_Vvar_Ql_GND=0.0;
991 Mueff_Vb_E=0.0;
992 Mueff_Vvar_Nsat_GND=0.0;
993 #endif
994 Mueff=Munc;
995 }
996 #if defined(_DERIVATE)
997 Dc_Vvar_Mucinv_GND=(((((((2*0.0*m10_vt(Tj))*Munc)+((2*m00_vt(Tj))*Munc_Vvar_Mucinv_GND))*Mupc)+(((2*m00_vt(Tj))*Munc)*Mupc_Vvar_Mucinv_GND))*(Munc+Mupc)-(((2*m00_vt(Tj))*Munc)*Mupc)*(Munc_Vvar_Mucinv_GND+Mupc_Vvar_Mucinv_GND))/(Munc+Mupc)/(Munc+Mupc));
998 #endif
999 Dc=((((2*m00_vt(Tj))*Munc)*Mupc)/(Munc+Mupc));
1000 {
1001 double m00_sqrt(d00_sqrt0,(Dc*Tau))
1002 #if defined(_DERIVATE)
1003 double m10_sqrt(d10_sqrt0,d00_sqrt0,(Dc*Tau))
1004 #endif
1005 #if defined(_DERIVATE)
1006 L_Vvar_Mucinv_GND=Dc_Vvar_Mucinv_GND*Tau*d10_sqrt0;
1007 #endif
1008 L=d00_sqrt0;
1009 }
1010 #if defined(_DERIVATE)
1011 WL_Vb_E=(W_Vb_E/L);
1012 WL_Vvar_Nsat_GND=(W_Vvar_Nsat_GND/L);
1013 WL_Vvar_Mucinv_GND=(-W*L_Vvar_Mucinv_GND/L/L);
1014 #endif
1015 WL=(W/L);
1016 #if defined(_DERIVATE)
1017 WL2_Vb_E=(WL_Vb_E/2);
1018 WL2_Vvar_Nsat_GND=(WL_Vvar_Nsat_GND/2);
1019 WL2_Vvar_Mucinv_GND=(WL_Vvar_Mucinv_GND/2);
1020 #endif
1021 WL2=(WL/2);
1022 {
1023 double m00_tanh(d00_tanh0,WL2)
1024 #if defined(_DERIVATE)
1025 double m10_tanh(d10_tanh0,d00_tanh0,WL2)
1026 #endif
1027 #if defined(_DERIVATE)
1028 Tanh_Vb_E=WL2_Vb_E*d10_tanh0;
1029 Tanh_Vvar_Nsat_GND=WL2_Vvar_Nsat_GND*d10_tanh0;
1030 Tanh_Vvar_Mucinv_GND=WL2_Vvar_Mucinv_GND*d10_tanh0;
1031 #endif
1032 Tanh=d00_tanh0;
1033 }
1034 if
1035 ((WL>0))
1036 {
1037 #if defined(_DERIVATE)
1038 Plo_Vvar_Ql_GND=(Ql_Vvar_Ql_GND/(((1.602176462e-19*A)*L)*Tanh));
1039 Plo_Vvar_Mucinv_GND=(-Ql*((((1.602176462e-19*A)*L_Vvar_Mucinv_GND)*Tanh)+(((1.602176462e-19*A)*L)*Tanh_Vvar_Mucinv_GND))/(((1.602176462e-19*A)*L)*Tanh)/(((1.602176462e-19*A)*L)*Tanh));
1040 Plo_Vb_E=(-Ql*(((1.602176462e-19*A)*L)*Tanh_Vb_E)/(((1.602176462e-19*A)*L)*Tanh)/(((1.602176462e-19*A)*L)*Tanh));
1041 Plo_Vvar_Nsat_GND=(-Ql*(((1.602176462e-19*A)*L)*Tanh_Vvar_Nsat_GND)/(((1.602176462e-19*A)*L)*Tanh)/(((1.602176462e-19*A)*L)*Tanh));
1042 #endif
1043 Plo=(Ql/(((1.602176462e-19*A)*L)*Tanh));
1044 }
1045 else
1046 {
1047 #if defined(_DERIVATE)
1048 Plo_Vvar_Ql_GND=0.0;
1049 Plo_Vvar_Mucinv_GND=0.0;
1050 Plo_Vb_E=0.0;
1051 Plo_Vvar_Nsat_GND=0.0;
1052 #endif
1053 Plo=0;
1054 }
1055 if
1056 ((WL>0))
1057 {
1058 {
1059 double m00_sinh(d00_sinh0,WL2)
1060 double m00_sinh(d00_sinh1,WL)
1061 #if defined(_DERIVATE)
1062 double m10_sinh(d10_sinh0,d00_sinh0,WL2)
1063 double m10_sinh(d10_sinh1,d00_sinh1,WL)
1064 #endif
1065 #if defined(_DERIVATE)
1066 Deltap_Vvar_Ql_GND=(Plo_Vvar_Ql_GND*d00_sinh0/d00_sinh1);
1067 Deltap_Vvar_Mucinv_GND=((((Plo_Vvar_Mucinv_GND*d00_sinh0)+(Plo*WL2_Vvar_Mucinv_GND*d10_sinh0))*d00_sinh1-(Plo*d00_sinh0)*WL_Vvar_Mucinv_GND*d10_sinh1)/d00_sinh1/d00_sinh1);
1068 Deltap_Vb_E=((((Plo_Vb_E*d00_sinh0)+(Plo*WL2_Vb_E*d10_sinh0))*d00_sinh1-(Plo*d00_sinh0)*WL_Vb_E*d10_sinh1)/d00_sinh1/d00_sinh1);
1069 Deltap_Vvar_Nsat_GND=((((Plo_Vvar_Nsat_GND*d00_sinh0)+(Plo*WL2_Vvar_Nsat_GND*d10_sinh0))*d00_sinh1-(Plo*d00_sinh0)*WL_Vvar_Nsat_GND*d10_sinh1)/d00_sinh1/d00_sinh1);
1070 #endif
1071 Deltap=((Plo*d00_sinh0)/d00_sinh1);
1072 }
1073 }
1074 else
1075 {
1076 #if defined(_DERIVATE)
1077 Deltap_Vvar_Ql_GND=0.0;
1078 Deltap_Vvar_Mucinv_GND=0.0;
1079 Deltap_Vb_E=0.0;
1080 Deltap_Vvar_Nsat_GND=0.0;
1081 #endif
1082 Deltap=0;
1083 }
1084 if
1085 ((WL>0))
1086 {
1087 double Nl2;
1088 double Plo2;
1089 double Con2;
1090 double Con3;
1091 double Con4;
1092 #if defined(_DERIVATE)
1093 double Plo2_Vvar_Ql_GND;
1094 #endif
1095 #if defined(_DERIVATE)
1096 double Plo2_Vvar_Mucinv_GND;
1097 #endif
1098 #if defined(_DERIVATE)
1099 double Plo2_Vb_E;
1100 #endif
1101 #if defined(_DERIVATE)
1102 double Plo2_Vvar_Nsat_GND;
1103 #endif
1104 #if defined(_DERIVATE)
1105 double Con2_Vb_E;
1106 #endif
1107 #if defined(_DERIVATE)
1108 double Con2_Vvar_Nsat_GND;
1109 #endif
1110 #if defined(_DERIVATE)
1111 double Con2_Vvar_Mucinv_GND;
1112 #endif
1113 #if defined(_DERIVATE)
1114 double Con3_Vvar_Ql_GND;
1115 #endif
1116 #if defined(_DERIVATE)
1117 double Con3_Vvar_Mucinv_GND;
1118 #endif
1119 #if defined(_DERIVATE)
1120 double Con3_Vb_E;
1121 #endif
1122 #if defined(_DERIVATE)
1123 double Con3_Vvar_Nsat_GND;
1124 #endif
1125 #if defined(_DERIVATE)
1126 double Con4_Vvar_Ql_GND;
1127 #endif
1128 #if defined(_DERIVATE)
1129 double Con4_Vvar_Mucinv_GND;
1130 #endif
1131 #if defined(_DERIVATE)
1132 double Con4_Vb_E;
1133 #endif
1134 #if defined(_DERIVATE)
1135 double Con4_Vvar_Nsat_GND;
1136 #endif
1137 Nl2=(Nl*Nl);
1138 #if defined(_DERIVATE)
1139 Plo2_Vvar_Ql_GND=((Plo_Vvar_Ql_GND*Plo)+(Plo*Plo_Vvar_Ql_GND));
1140 Plo2_Vvar_Mucinv_GND=((Plo_Vvar_Mucinv_GND*Plo)+(Plo*Plo_Vvar_Mucinv_GND));
1141 Plo2_Vb_E=((Plo_Vb_E*Plo)+(Plo*Plo_Vb_E));
1142 Plo2_Vvar_Nsat_GND=((Plo_Vvar_Nsat_GND*Plo)+(Plo*Plo_Vvar_Nsat_GND));
1143 #endif
1144 Plo2=(Plo*Plo);
1145 {
1146 double m00_sinh(d00_sinh0,WL)
1147 #if defined(_DERIVATE)
1148 double m10_sinh(d10_sinh0,d00_sinh0,WL)
1149 #endif
1150 #if defined(_DERIVATE)
1151 Con2_Vb_E=(-1*WL_Vb_E*d10_sinh0/d00_sinh0/d00_sinh0);
1152 Con2_Vvar_Nsat_GND=(-1*WL_Vvar_Nsat_GND*d10_sinh0/d00_sinh0/d00_sinh0);
1153 Con2_Vvar_Mucinv_GND=(-1*WL_Vvar_Mucinv_GND*d10_sinh0/d00_sinh0/d00_sinh0);
1154 #endif
1155 Con2=(1/d00_sinh0);
1156 }
1157 #if defined(_DERIVATE)
1158 Con3_Vvar_Ql_GND=Plo2_Vvar_Ql_GND*Con2*Con2;
1159 Con3_Vvar_Mucinv_GND=((((Plo2_Vvar_Mucinv_GND*Con2)+(Plo2*Con2_Vvar_Mucinv_GND))*Con2)+((Plo2*Con2)*Con2_Vvar_Mucinv_GND));
1160 Con3_Vb_E=((((Plo2_Vb_E*Con2)+(Plo2*Con2_Vb_E))*Con2)+((Plo2*Con2)*Con2_Vb_E));
1161 Con3_Vvar_Nsat_GND=((((Plo2_Vvar_Nsat_GND*Con2)+(Plo2*Con2_Vvar_Nsat_GND))*Con2)+((Plo2*Con2)*Con2_Vvar_Nsat_GND));
1162 #endif
1163 Con3=((Plo2*Con2)*Con2);
1164 {
1165 double m00_sqrt(d00_sqrt0,(Nl2+Con3))
1166 #if defined(_DERIVATE)
1167 double m10_sqrt(d10_sqrt0,d00_sqrt0,(Nl2+Con3))
1168 #endif
1169 #if defined(_DERIVATE)
1170 Con4_Vvar_Ql_GND=((Con3_Vvar_Ql_GND*d10_sqrt0*Tanh*(Nl+((Plo*Con2)*Tanh))-(d00_sqrt0*Tanh)*Plo_Vvar_Ql_GND*Con2*Tanh)/(Nl+((Plo*Con2)*Tanh))/(Nl+((Plo*Con2)*Tanh)));
1171 Con4_Vvar_Mucinv_GND=((((Con3_Vvar_Mucinv_GND*d10_sqrt0*Tanh)+(d00_sqrt0*Tanh_Vvar_Mucinv_GND))*(Nl+((Plo*Con2)*Tanh))-(d00_sqrt0*Tanh)*((((Plo_Vvar_Mucinv_GND*Con2)+(Plo*Con2_Vvar_Mucinv_GND))*Tanh)+((Plo*Con2)*Tanh_Vvar_Mucinv_GND)))/(Nl+((Plo*Con2)*Tanh))/(Nl+((Plo*Con2)*Tanh)));
1172 Con4_Vb_E=((((Con3_Vb_E*d10_sqrt0*Tanh)+(d00_sqrt0*Tanh_Vb_E))*(Nl+((Plo*Con2)*Tanh))-(d00_sqrt0*Tanh)*((((Plo_Vb_E*Con2)+(Plo*Con2_Vb_E))*Tanh)+((Plo*Con2)*Tanh_Vb_E)))/(Nl+((Plo*Con2)*Tanh))/(Nl+((Plo*Con2)*Tanh)));
1173 Con4_Vvar_Nsat_GND=((((Con3_Vvar_Nsat_GND*d10_sqrt0*Tanh)+(d00_sqrt0*Tanh_Vvar_Nsat_GND))*(Nl+((Plo*Con2)*Tanh))-(d00_sqrt0*Tanh)*((((Plo_Vvar_Nsat_GND*Con2)+(Plo*Con2_Vvar_Nsat_GND))*Tanh)+((Plo*Con2)*Tanh_Vvar_Nsat_GND)))/(Nl+((Plo*Con2)*Tanh))/(Nl+((Plo*Con2)*Tanh)));
1174 #endif
1175 Con4=((d00_sqrt0*Tanh)/(Nl+((Plo*Con2)*Tanh)));
1176 }
1177 {
1178 double m00_sqrt(d00_sqrt0,(Nl2+Con3))
1179 double m00_atanh(d00_atanh1,Con4)
1180 #if defined(_DERIVATE)
1181 double m10_sqrt(d10_sqrt0,d00_sqrt0,(Nl2+Con3))
1182 double m10_atanh(d10_atanh1,d00_atanh1,Con4)
1183 #endif
1184 #if defined(_DERIVATE)
1185 Neff_Vb_E=((((WL2_Vb_E*d00_sqrt0)+(WL2*Con3_Vb_E*d10_sqrt0))*d00_atanh1-(WL2*d00_sqrt0)*Con4_Vb_E*d10_atanh1)/d00_atanh1/d00_atanh1);
1186 Neff_Vvar_Nsat_GND=((((WL2_Vvar_Nsat_GND*d00_sqrt0)+(WL2*Con3_Vvar_Nsat_GND*d10_sqrt0))*d00_atanh1-(WL2*d00_sqrt0)*Con4_Vvar_Nsat_GND*d10_atanh1)/d00_atanh1/d00_atanh1);
1187 Neff_Vvar_Mucinv_GND=((((WL2_Vvar_Mucinv_GND*d00_sqrt0)+(WL2*Con3_Vvar_Mucinv_GND*d10_sqrt0))*d00_atanh1-(WL2*d00_sqrt0)*Con4_Vvar_Mucinv_GND*d10_atanh1)/d00_atanh1/d00_atanh1);
1188 Neff_Vvar_Ql_GND=(((WL2*Con3_Vvar_Ql_GND*d10_sqrt0)*d00_atanh1-(WL2*d00_sqrt0)*Con4_Vvar_Ql_GND*d10_atanh1)/d00_atanh1/d00_atanh1);
1189 #endif
1190 Neff=((WL2*d00_sqrt0)/d00_atanh1);
1191 }
1192 }
1193 else
1194 {
1195 #if defined(_DERIVATE)
1196 Neff_Vb_E=0.0;
1197 Neff_Vvar_Nsat_GND=0.0;
1198 Neff_Vvar_Mucinv_GND=0.0;
1199 Neff_Vvar_Ql_GND=0.0;
1200 #endif
1201 Neff=0;
1202 }
1203 if
1204 ((Ql<0))
1205 {
1206 #if defined(_DERIVATE)
1207 Rb_Vvar_Ql_GND=0.0;
1208 Rb_Vb_E=(W_Vb_E/(((1.602176462e-19*Munc)*A)*Nl));
1209 Rb_Vvar_Nsat_GND=(W_Vvar_Nsat_GND/(((1.602176462e-19*Munc)*A)*Nl));
1210 Rb_Vvar_Mucinv_GND=(-W*(1.602176462e-19*Munc_Vvar_Mucinv_GND)*A*Nl/(((1.602176462e-19*Munc)*A)*Nl)/(((1.602176462e-19*Munc)*A)*Nl));
1211 #endif
1212 Rb=(W/(((1.602176462e-19*Munc)*A)*Nl));
1213 }
1214 else
1215 {
1216 #if defined(_DERIVATE)
1217 Rb_Vvar_Ql_GND=(-W*(((1.602176462e-19*Mueff_Vvar_Ql_GND)*A*Neff)+(((1.602176462e-19*Mueff)*A)*Neff_Vvar_Ql_GND))/(((1.602176462e-19*Mueff)*A)*Neff)/(((1.602176462e-19*Mueff)*A)*Neff));
1218 Rb_Vb_E=((W_Vb_E*(((1.602176462e-19*Mueff)*A)*Neff)-W*(((1.602176462e-19*Mueff_Vb_E)*A*Neff)+(((1.602176462e-19*Mueff)*A)*Neff_Vb_E)))/(((1.602176462e-19*Mueff)*A)*Neff)/(((1.602176462e-19*Mueff)*A)*Neff));
1219 Rb_Vvar_Nsat_GND=((W_Vvar_Nsat_GND*(((1.602176462e-19*Mueff)*A)*Neff)-W*(((1.602176462e-19*Mueff_Vvar_Nsat_GND)*A*Neff)+(((1.602176462e-19*Mueff)*A)*Neff_Vvar_Nsat_GND)))/(((1.602176462e-19*Mueff)*A)*Neff)/(((1.602176462e-19*Mueff)*A)*Neff));
1220 Rb_Vvar_Mucinv_GND=(-W*(((1.602176462e-19*Mueff_Vvar_Mucinv_GND)*A*Neff)+(((1.602176462e-19*Mueff)*A)*Neff_Vvar_Mucinv_GND))/(((1.602176462e-19*Mueff)*A)*Neff)/(((1.602176462e-19*Mueff)*A)*Neff));
1221 #endif
1222 Rb=(W/(((1.602176462e-19*Mueff)*A)*Neff));
1223 }
1224 #if defined(_DYNAMIC)
1225 Vebj=(0.6-(((Ql-Qbi)*(Ql-Qbi))/(((((2*1.602176462e-19)*Nl)*1.03594e-10)*A)*A)));
1226 #endif
1227 #if defined(_DYNAMIC)
1228 {
1229 double m00_logE(d00_logE0,((((Plo/Ni)/Ni)+(1/Nl))*(Nl+Plo)))
1230 double m00_logE(d00_logE1,((Plo+Nl)/Nl))
1231 #if defined(_DERIVATE)
1232 double m10_logE(d10_logE0,d00_logE0,((((Plo/Ni)/Ni)+(1/Nl))*(Nl+Plo)))
1233 double m10_logE(d10_logE1,d00_logE1,((Plo+Nl)/Nl))
1234 #endif
1235 Vebd=((m00_vt(Tj)*d00_logE0)-((Dc/Munc)*d00_logE1));
1236 }
1237 #endif
1238 #ifdef _DYNAMIC
1239 if
1240 ((Ql<0))
1241 {
1242 #if defined(_DYNAMIC)
1243 Vebq=Vebj;
1244 #endif
1245 }
1246 else
1247 {
1248 #ifdef _DYNAMIC
1249 if
1250 ((Ql>=Qbi))
1251 {
1252 #if defined(_DYNAMIC)
1253 Vebq=Vebd;
1254 #endif
1255 }
1256 else
1257 {
1258 #if defined(_DYNAMIC)
1259 {
1260 double m00_min(d00_min0,Vebj,Vebd)
1261 #if defined(_DERIVATE)
1262 double m10_min(d10_min0,d00_min0,Vebj,Vebd)
1263 double m11_min(d11_min0,d00_min0,Vebj,Vebd)
1264 #endif
1265 Vebq=d00_min0;
1266 }
1267 #endif
1268 }
1269 #endif /* if (...) */
1270 }
1271 #endif /* if (...) */
1272 {
1273 double m00_pow(d00_pow0,Nscl,0.75)
1274 #if defined(_DERIVATE)
1275 double m10_pow(d10_pow0,d00_pow0,Nscl,0.75)
1276 #endif
1277 #if defined(_DERIVATE)
1278 BVcbo_Vvar_Nsat_GND=(-(BVf*5.34e13)*(d10_pow0*Nscl_Vvar_Nsat_GND)/d00_pow0/d00_pow0);
1279 #endif
1280 BVcbo=((BVf*5.34e13)/d00_pow0);
1281 }
1282 #if defined(_DERIVATE)
1283 Vnrt_Vb_E=Vbc_Vb_E;
1284 #endif
1285 Vnrt=Vbc;
1286 {
1287 double m00_pow(d00_pow0,(Vnrt/BVcbo),BVn)
1288 #if defined(_DERIVATE)
1289 double m10_pow(d10_pow0,d00_pow0,(Vnrt/BVcbo),BVn)
1290 #endif
1291 #if defined(_DERIVATE)
1292 M_Vb_E=(-1*(-(d10_pow0*(Vnrt_Vb_E/BVcbo)))/(1-d00_pow0)/(1-d00_pow0));
1293 M_Vvar_Nsat_GND=(-1*(-(d10_pow0*(-Vnrt*BVcbo_Vvar_Nsat_GND/BVcbo/BVcbo)))/(1-d00_pow0)/(1-d00_pow0));
1294 #endif
1295 M=(1/(1-d00_pow0));
1296 }
1297 if
1298 ((Rb>0))
1299 {
1300 #if defined(_DERIVATE)
1301 It_VC_e=(Vae_VC_e/Rb);
1302 It_Vvar_Ql_GND=(-Vae*Rb_Vvar_Ql_GND/Rb/Rb);
1303 It_Vb_E=(-Vae*Rb_Vb_E/Rb/Rb);
1304 It_Vvar_Nsat_GND=(-Vae*Rb_Vvar_Nsat_GND/Rb/Rb);
1305 It_Vvar_Mucinv_GND=(-Vae*Rb_Vvar_Mucinv_GND/Rb/Rb);
1306 #endif
1307 It=(Vae/Rb);
1308 }
1309 else
1310 {
1311 #if defined(_DERIVATE)
1312 It_VC_e=(Vae_VC_e/1e-6);
1313 It_Vvar_Ql_GND=0.0;
1314 It_Vb_E=0.0;
1315 It_Vvar_Nsat_GND=0.0;
1316 It_Vvar_Mucinv_GND=0.0;
1317 #endif
1318 It=(Vae/1e-6);
1319 }
1320 if
1321 ((Veb>0))
1322 {
1323 #if defined(_DERIVATE)
1324 Icss_VC_e=((1/(1+B))*It_VC_e);
1325 Icss_Vvar_Ql_GND=(((1/(1+B))*It_Vvar_Ql_GND)+(((B/(1+B))*((4*Dp)/((W*W)+1e-20)))*Ql_Vvar_Ql_GND));
1326 Icss_Vb_E=(((1/(1+B))*It_Vb_E)+((B/(1+B))*(-(4*Dp)*((W_Vb_E*W)+(W*W_Vb_E))/((W*W)+1e-20)/((W*W)+1e-20)))*Ql);
1327 Icss_Vvar_Nsat_GND=(((1/(1+B))*It_Vvar_Nsat_GND)+((B/(1+B))*(-(4*Dp)*((W_Vvar_Nsat_GND*W)+(W*W_Vvar_Nsat_GND))/((W*W)+1e-20)/((W*W)+1e-20)))*Ql);
1328 Icss_Vvar_Mucinv_GND=((1/(1+B))*It_Vvar_Mucinv_GND);
1329 #endif
1330 Icss=(((1/(1+B))*It)+(((B/(1+B))*((4*Dp)/((W*W)+1e-20)))*Ql));
1331 }
1332 else
1333 {
1334 #if defined(_DERIVATE)
1335 Icss_VC_e=0.0;
1336 Icss_Vvar_Ql_GND=0.0;
1337 Icss_Vb_E=0.0;
1338 Icss_Vvar_Nsat_GND=0.0;
1339 Icss_Vvar_Mucinv_GND=0.0;
1340 #endif
1341 Icss=0;
1342 }
1343 #if defined(_DERIVATE)
1344 Ic_VC_e=Icss_VC_e;
1345 Ic_Vvar_Ql_GND=(Icss_Vvar_Ql_GND+Ccer_Vvar_Ql_GND*dVecdt);
1346 Ic_Vb_E=(Icss_Vb_E+Ccer_Vb_E*dVecdt);
1347 Ic_Vvar_Nsat_GND=(Icss_Vvar_Nsat_GND+Ccer_Vvar_Nsat_GND*dVecdt);
1348 Ic_Vvar_Mucinv_GND=Icss_Vvar_Mucinv_GND;
1349 Ic_Vvar_dVecdt_GND=(Ccer*dVecdt_Vvar_dVecdt_GND);
1350 #endif
1351 Ic=(Icss+(Ccer*dVecdt));
1352 if
1353 ((Veb>0))
1354 {
1355 if
1356 ((Qb>0))
1357 {
1358 #if defined(_DERIVATE)
1359 Ibss_Vvar_Ql_GND=((Ql_Vvar_Ql_GND/Tau)+((((((Ql_Vvar_Ql_GND*Ql)+(Ql*Ql_Vvar_Ql_GND))/Qb)/Qb)*4*Nscl*Nscl/Ni)/Ni)*Isne);
1360 Ibss_Vb_E=(((((-(Ql*Ql)*Qb_Vb_E/Qb/Qb)*Qb-((Ql*Ql)/Qb)*Qb_Vb_E)/Qb/Qb)*4*Nscl*Nscl/Ni)/Ni)*Isne;
1361 Ibss_Vvar_Nsat_GND=(((((((((-(Ql*Ql)*Qb_Vvar_Nsat_GND/Qb/Qb)*Qb-((Ql*Ql)/Qb)*Qb_Vvar_Nsat_GND)/Qb/Qb)*4*Nscl)+(((((Ql*Ql)/Qb)/Qb)*4)*Nscl_Vvar_Nsat_GND))*Nscl)+((((((Ql*Ql)/Qb)/Qb)*4)*Nscl)*Nscl_Vvar_Nsat_GND))/Ni)/Ni)*Isne;
1362 #endif
1363 Ibss=((Ql/Tau)+(((((((((Ql*Ql)/Qb)/Qb)*4)*Nscl)*Nscl)/Ni)/Ni)*Isne));
1364 }
1365 else
1366 {
1367 #if defined(_DERIVATE)
1368 Ibss_Vvar_Ql_GND=(Ql_Vvar_Ql_GND/Tau);
1369 Ibss_Vb_E=0.0;
1370 Ibss_Vvar_Nsat_GND=0.0;
1371 #endif
1372 Ibss=(Ql/Tau);
1373 }
1374 }
1375 else
1376 {
1377 #if defined(_DERIVATE)
1378 Ibss_Vvar_Ql_GND=0.0;
1379 Ibss_Vb_E=0.0;
1380 Ibss_Vvar_Nsat_GND=0.0;
1381 #endif
1382 Ibss=0;
1383 }
1384 if
1385 ((Vgs<Vt))
1386 {
1387 #if defined(_DERIVATE)
1388 Imos_Vb_E=0.0;
1389 Imos_VG_E=0.0;
1390 #endif
1391 Imos=0;
1392 }
1393 else
1394 {
1395 if
1396 ((Vds>(Vth/Kf)))
1397 {
1398 #if defined(_DERIVATE)
1399 Imos_Vb_E=0.0;
1400 Imos_VG_E=((((((KpT*Vth_VG_E)*Vth)+((KpT*Vth)*Vth_VG_E))/2)*(1+(Theta*Vth))-(((KpT*Vth)*Vth)/2)*(Theta*Vth_VG_E))/(1+(Theta*Vth))/(1+(Theta*Vth)));
1401 #endif
1402 Imos=((((KpT*Vth)*Vth)/2)/(1+(Theta*Vth)));
1403 }
1404 else
1405 {
1406 #if defined(_DERIVATE)
1407 Imos_Vb_E=(((Kf*KpT)*((Vth*Vds_Vb_E)-((((Kf*Vds_Vb_E)*Vds)+((Kf*Vds)*Vds_Vb_E))/2)))/(1+(Theta*Vth)));
1408 Imos_VG_E=((((Kf*KpT)*Vth_VG_E*Vds)*(1+(Theta*Vth))-((Kf*KpT)*((Vth*Vds)-(((Kf*Vds)*Vds)/2)))*(Theta*Vth_VG_E))/(1+(Theta*Vth))/(1+(Theta*Vth)));
1409 #endif
1410 Imos=(((Kf*KpT)*((Vth*Vds)-(((Kf*Vds)*Vds)/2)))/(1+(Theta*Vth)));
1411 }
1412 }
1413 if
1414 ((Vbc>0))
1415 {
1416 {
1417 double m00_sqrt(d00_sqrt0,((((2*1.03594e-10)*Vbc)/1.602176462e-19)/Nscl))
1418 #if defined(_DERIVATE)
1419 double m10_sqrt(d10_sqrt0,d00_sqrt0,((((2*1.03594e-10)*Vbc)/1.602176462e-19)/Nscl))
1420 #endif
1421 #if defined(_DERIVATE)
1422 Igen_Vb_E=((((1.602176462e-19*Ni)*A)*((((2*1.03594e-10)*Vbc_Vb_E)/1.602176462e-19)/Nscl)*d10_sqrt0)/Tau);
1423 Igen_Vvar_Nsat_GND=((((1.602176462e-19*Ni)*A)*(-(((2*1.03594e-10)*Vbc)/1.602176462e-19)*Nscl_Vvar_Nsat_GND/Nscl/Nscl)*d10_sqrt0)/Tau);
1424 #endif
1425 Igen=((((1.602176462e-19*Ni)*A)*d00_sqrt0)/Tau);
1426 }
1427 }
1428 else
1429 {
1430 #if defined(_DERIVATE)
1431 Igen_Vb_E=0.0;
1432 Igen_Vvar_Nsat_GND=0.0;
1433 #endif
1434 Igen=0;
1435 }
1436 #if defined(_DERIVATE)
1437 Imult_Vb_E=(((M_Vb_E*(Imos+Ic))+((M-1)*(Imos_Vb_E+Ic_Vb_E)))+((M_Vb_E*Igen)+(M*Igen_Vb_E)));
1438 Imult_Vvar_Nsat_GND=(((M_Vvar_Nsat_GND*(Imos+Ic))+((M-1)*Ic_Vvar_Nsat_GND))+((M_Vvar_Nsat_GND*Igen)+(M*Igen_Vvar_Nsat_GND)));
1439 Imult_VG_E=((M-1)*Imos_VG_E);
1440 Imult_VC_e=((M-1)*Ic_VC_e);
1441 Imult_Vvar_Ql_GND=((M-1)*Ic_Vvar_Ql_GND);
1442 Imult_Vvar_Mucinv_GND=((M-1)*Ic_Vvar_Mucinv_GND);
1443 Imult_Vvar_dVecdt_GND=((M-1)*Ic_Vvar_dVecdt_GND);
1444 #endif
1445 Imult=(((M-1)*(Imos+Ic))+(M*Igen));
1446 #if defined(_DYNAMIC)
1447 #if defined(_DERIVATE)
1448 Qgd_Vb_G=((Cgd_Vb_G*Vdg)+(Cgd*Vdg_Vb_G));
1449 Qgd_Vvar_Nsat_GND=Cgd_Vvar_Nsat_GND*Vdg;
1450 #endif
1451 Qgd=(Cgd*Vdg);
1452 #endif
1453 #if defined(_DYNAMIC)
1454 #if defined(_DERIVATE)
1455 Qcer_Vvar_Ql_GND=Ccer_Vvar_Ql_GND*Vec;
1456 Qcer_Vb_E=Ccer_Vb_E*Vec;
1457 Qcer_Vvar_Nsat_GND=Ccer_Vvar_Nsat_GND*Vec;
1458 Qcer_Ve_E=(Ccer*Vec_Ve_E);
1459 #endif
1460 Qcer=(Ccer*Vec);
1461 #endif
1462 #if defined(_DYNAMIC)
1463 #if defined(_DERIVATE)
1464 Qmult_Vb_E=((M_Vb_E*Qcer)+((M-1)*Qcer_Vb_E));
1465 Qmult_Vvar_Nsat_GND=((M_Vvar_Nsat_GND*Qcer)+((M-1)*Qcer_Vvar_Nsat_GND));
1466 Qmult_Vvar_Ql_GND=((M-1)*Qcer_Vvar_Ql_GND);
1467 Qmult_Ve_E=((M-1)*Qcer_Ve_E);
1468 #endif
1469 Qmult=((M-1)*Qcer);
1470 #endif
1471 if
1472 ((Deltap>0))
1473 {
1474 {
1475 double m00_pow(d00_pow0,Deltap,(2.0/3.0))
1476 double m00_logE(d00_logE1,(1+(Alpha2/d00_pow0)))
1477 #if defined(_DERIVATE)
1478 double m10_pow(d10_pow0,d00_pow0,Deltap,(2.0/3.0))
1479 double m10_logE(d10_logE1,d00_logE1,(1+(Alpha2/d00_pow0)))
1480 #endif
1481 #if defined(_DERIVATE)
1482 iMucinv_Vvar_Ql_GND=(((Deltap_Vvar_Ql_GND*d00_logE1)+(Deltap*(-Alpha2*(d10_pow0*Deltap_Vvar_Ql_GND)/d00_pow0/d00_pow0)*d10_logE1))/Alpha1);
1483 iMucinv_Vvar_Mucinv_GND=(((Deltap_Vvar_Mucinv_GND*d00_logE1)+(Deltap*(-Alpha2*(d10_pow0*Deltap_Vvar_Mucinv_GND)/d00_pow0/d00_pow0)*d10_logE1))/Alpha1);
1484 iMucinv_Vb_E=(((Deltap_Vb_E*d00_logE1)+(Deltap*(-Alpha2*(d10_pow0*Deltap_Vb_E)/d00_pow0/d00_pow0)*d10_logE1))/Alpha1);
1485 iMucinv_Vvar_Nsat_GND=(((Deltap_Vvar_Nsat_GND*d00_logE1)+(Deltap*(-Alpha2*(d10_pow0*Deltap_Vvar_Nsat_GND)/d00_pow0/d00_pow0)*d10_logE1))/Alpha1);
1486 #endif
1487 iMucinv=((Deltap*d00_logE1)/Alpha1);
1488 }
1489 }
1490 else
1491 {
1492 #if defined(_DERIVATE)
1493 iMucinv_Vvar_Ql_GND=0.0;
1494 iMucinv_Vvar_Mucinv_GND=0.0;
1495 iMucinv_Vb_E=0.0;
1496 iMucinv_Vvar_Nsat_GND=0.0;
1497 #endif
1498 iMucinv=0;
1499 }
1500 #if defined(_DERIVATE)
1501 iQl_Vb_E=(((((1.602176462e-19*A)*W_Vb_E)*Plo)+(((1.602176462e-19*A)*W)*Plo_Vb_E))/2);
1502 iQl_Vvar_Nsat_GND=(((((1.602176462e-19*A)*W_Vvar_Nsat_GND)*Plo)+(((1.602176462e-19*A)*W)*Plo_Vvar_Nsat_GND))/2);
1503 iQl_Vvar_Ql_GND=((((1.602176462e-19*A)*W)*Plo_Vvar_Ql_GND)/2);
1504 iQl_Vvar_Mucinv_GND=((((1.602176462e-19*A)*W)*Plo_Vvar_Mucinv_GND)/2);
1505 #endif
1506 iQl=((((1.602176462e-19*A)*W)*Plo)/2);
1507 #if defined(_DERIVATE)
1508 iNsat_VC_e=(Ic_VC_e/((1.602176462e-19*A)*Vpsat));
1509 iNsat_Vvar_Ql_GND=(Ic_Vvar_Ql_GND/((1.602176462e-19*A)*Vpsat));
1510 iNsat_Vb_E=((Ic_Vb_E/((1.602176462e-19*A)*Vpsat))-(Imos_Vb_E/((1.602176462e-19*A)*Vnsat)));
1511 iNsat_Vvar_Nsat_GND=(Ic_Vvar_Nsat_GND/((1.602176462e-19*A)*Vpsat));
1512 iNsat_Vvar_Mucinv_GND=(Ic_Vvar_Mucinv_GND/((1.602176462e-19*A)*Vpsat));
1513 iNsat_Vvar_dVecdt_GND=(Ic_Vvar_dVecdt_GND/((1.602176462e-19*A)*Vpsat));
1514 iNsat_VG_E=(-(Imos_VG_E/((1.602176462e-19*A)*Vnsat)));
1515 #endif
1516 iNsat=((Ic/((1.602176462e-19*A)*Vpsat))-(Imos/((1.602176462e-19*A)*Vnsat)));
1517 _load_static_residual2(G,E,(Vgs*1e-12));
1518 #if defined(_DERIVATE)
1519 _load_static_jacobian4(G,E,G,E,Vgs_VG_E*1e-12);
1520 #endif
1521 #if defined(_DYNAMIC)
1523 #if defined(_DERIVATE)
1524 _load_dynamic_jacobian4(G,E,G,E,Qgs_VG_E);
1525 #endif
1526 #endif
1527 _load_static_residual2(b,G,(Vdg*1e-12));
1528 #if defined(_DERIVATE)
1529 _load_static_jacobian4(b,G,b,G,Vdg_Vb_G*1e-12);
1530 #endif
1531 #if defined(_DYNAMIC)
1533 #if defined(_DERIVATE)
1534 _load_dynamic_jacobian2s(b,G,var_Nsat,Qgd_Vvar_Nsat_GND);
1535 _load_dynamic_jacobian4(b,G,b,G,Qgd_Vb_G);
1536 #endif
1537 #endif
1538 _load_static_residual2(b,E,((Imos+Imult)+(Vds*1e-12)));
1539 #if defined(_DERIVATE)
1540 _load_static_jacobian2s(b,E,var_dVecdt,Imult_Vvar_dVecdt_GND);
1541 _load_static_jacobian2s(b,E,var_Mucinv,Imult_Vvar_Mucinv_GND);
1542 _load_static_jacobian2s(b,E,var_Ql,Imult_Vvar_Ql_GND);
1543 _load_static_jacobian4(b,E,C,e,Imult_VC_e);
1544 _load_static_jacobian2s(b,E,var_Nsat,Imult_Vvar_Nsat_GND);
1545 _load_static_jacobian4(b,E,G,E,(Imos_VG_E+Imult_VG_E));
1546 _load_static_jacobian4(b,E,b,E,((Imos_Vb_E+Imult_Vb_E)+Vds_Vb_E*1e-12));
1547 #endif
1548 #if defined(_DYNAMIC)
1550 #if defined(_DERIVATE)
1551 _load_dynamic_jacobian2s(b,E,var_Nsat,Qds_Vvar_Nsat_GND);
1552 _load_dynamic_jacobian4(b,E,b,E,Qds_Vb_E);
1553 #endif
1554 #endif
1555 #if defined(_DYNAMIC)
1557 #if defined(_DERIVATE)
1558 _load_dynamic_jacobian4(b,E,e,E,Qmult_Ve_E);
1559 _load_dynamic_jacobian2s(b,E,var_Ql,Qmult_Vvar_Ql_GND);
1560 _load_dynamic_jacobian2s(b,E,var_Nsat,Qmult_Vvar_Nsat_GND);
1561 _load_dynamic_jacobian4(b,E,b,E,Qmult_Vb_E);
1562 #endif
1563 #endif
1564 _load_static_residual2(e,E,(Icss+(Vec*1e-12)));
1565 #if defined(_DERIVATE)
1566 _load_static_jacobian4(e,E,e,E,Vec_Ve_E*1e-12);
1567 _load_static_jacobian2s(e,E,var_Mucinv,Icss_Vvar_Mucinv_GND);
1568 _load_static_jacobian2s(e,E,var_Nsat,Icss_Vvar_Nsat_GND);
1569 _load_static_jacobian4(e,E,b,E,Icss_Vb_E);
1570 _load_static_jacobian2s(e,E,var_Ql,Icss_Vvar_Ql_GND);
1571 _load_static_jacobian4(e,E,C,e,Icss_VC_e);
1572 #endif
1573 #if defined(_DYNAMIC)
1575 #if defined(_DERIVATE)
1576 _load_dynamic_jacobian4(e,E,e,E,Qcer_Ve_E);
1577 _load_dynamic_jacobian2s(e,E,var_Nsat,Qcer_Vvar_Nsat_GND);
1578 _load_dynamic_jacobian4(e,E,b,E,Qcer_Vb_E);
1579 _load_dynamic_jacobian2s(e,E,var_Ql,Qcer_Vvar_Ql_GND);
1580 #endif
1581 #endif
1582 _load_static_residual2(e,b,(Ibss+(Veb*1e-12)));
1583 #if defined(_DERIVATE)
1584 _load_static_jacobian4(e,b,e,b,Veb_Ve_b*1e-12);
1585 _load_static_jacobian2s(e,b,var_Nsat,Ibss_Vvar_Nsat_GND);
1586 _load_static_jacobian4(e,b,b,E,Ibss_Vb_E);
1587 _load_static_jacobian2s(e,b,var_Ql,Ibss_Vvar_Ql_GND);
1588 #endif
1589 #if defined(_DYNAMIC)
1591 #if defined(_DERIVATE)
1592 _load_dynamic_jacobian2s(e,b,var_Mucinv,iQl_Vvar_Mucinv_GND);
1593 _load_dynamic_jacobian2s(e,b,var_Ql,iQl_Vvar_Ql_GND);
1594 _load_dynamic_jacobian2s(e,b,var_Nsat,iQl_Vvar_Nsat_GND);
1595 _load_dynamic_jacobian4(e,b,b,E,iQl_Vb_E);
1596 #endif
1597 #endif
1599 #if defined(_DERIVATE)
1600 _load_static_jacobian2s(C,e,var_Mucinv,It_Vvar_Mucinv_GND);
1601 _load_static_jacobian2s(C,e,var_Nsat,It_Vvar_Nsat_GND);
1602 _load_static_jacobian4(C,e,b,E,It_Vb_E);
1603 _load_static_jacobian2s(C,e,var_Ql,It_Vvar_Ql_GND);
1604 _load_static_jacobian4(C,e,C,e,It_VC_e);
1605 #endif
1606 _load_static_residual1(var_Ql,(Ql-iQl));
1607 #if defined(_DERIVATE)
1608 _load_static_jacobian1(var_Ql,var_Mucinv,(-iQl_Vvar_Mucinv_GND));
1609 _load_static_jacobian1(var_Ql,var_Nsat,(-iQl_Vvar_Nsat_GND));
1610 _load_static_jacobian2p(var_Ql,b,E,(-iQl_Vb_E));
1611 _load_static_jacobian1(var_Ql,var_Ql,(Ql_Vvar_Ql_GND-iQl_Vvar_Ql_GND));
1612 #endif
1613 _load_static_residual1(var_Mucinv,(Mucinv-iMucinv));
1614 #if defined(_DERIVATE)
1615 _load_static_jacobian1(var_Mucinv,var_Nsat,(-iMucinv_Vvar_Nsat_GND));
1616 _load_static_jacobian2p(var_Mucinv,b,E,(-iMucinv_Vb_E));
1617 _load_static_jacobian1(var_Mucinv,var_Ql,(-iMucinv_Vvar_Ql_GND));
1618 _load_static_jacobian1(var_Mucinv,var_Mucinv,(Mucinv_Vvar_Mucinv_GND-iMucinv_Vvar_Mucinv_GND));
1619 #endif
1620 _load_static_residual1(var_Nsat,(Nsat-iNsat));
1621 #if defined(_DERIVATE)
1622 _load_static_jacobian2p(var_Nsat,G,E,(-iNsat_VG_E));
1623 _load_static_jacobian1(var_Nsat,var_dVecdt,(-iNsat_Vvar_dVecdt_GND));
1624 _load_static_jacobian1(var_Nsat,var_Mucinv,(-iNsat_Vvar_Mucinv_GND));
1625 _load_static_jacobian2p(var_Nsat,b,E,(-iNsat_Vb_E));
1626 _load_static_jacobian1(var_Nsat,var_Ql,(-iNsat_Vvar_Ql_GND));
1627 _load_static_jacobian2p(var_Nsat,C,e,(-iNsat_VC_e));
1628 _load_static_jacobian1(var_Nsat,var_Nsat,(Nsat_Vvar_Nsat_GND-iNsat_Vvar_Nsat_GND));
1629 #endif
1631 #if defined(_DERIVATE)
1632 _load_static_jacobian1(var_dVecdt,var_dVecdt,dVecdt_Vvar_dVecdt_GND);
1633 #endif
1634 #if defined(_DYNAMIC)
1636 #if defined(_DERIVATE)
1637 _load_dynamic_jacobian2p(var_dVecdt,e,E,(-Vec_Ve_E));
1638 #endif
1639 #endif
1640 
1641 /* ------------------ end of verilog analog equations --------------------- */
1642 
1643 /* ------------------ evaluate verilog noise equations -------------------- */
1644 
1645 /* ------------------- end of verilog noise equations --------------------- */
1646 }
1647 
1648 /* Perform DC iteration. */
1649 void nigbt::calcDC (void)
1650 {
1651  // evaluate Verilog code
1652  initVerilog ();
1653  calcVerilog ();
1654 
1655  // fill right hand side and static jacobian
1656  for (int i1 = 0; i1 < 9; i1++) {
1657  setI (i1, _rhs[i1]);
1658  for (int i2 = 0; i2 < 9; i2++) {
1659  setY (i1, i2, _jstat[i1][i2]);
1660  }
1661  }
1662 }
1663 
1664 /* Save operating points. */
1666 {
1667  // save global instance operating points
1668 }
1669 
1670 /* Load operating points. */
1672 {
1673 }
1674 
1675 /* Calculate operating points. */
1677 {
1678 }
1679 
1680 /* Initialization of AC analysis. */
1681 void nigbt::initAC (void)
1682 {
1683  allocMatrixMNA ();
1684 }
1685 
1686 /* Perform AC calculations. */
1687 void nigbt::calcAC (nr_double_t frequency)
1688 {
1689  setMatrixY (calcMatrixY (frequency));
1690 }
1691 
1692 /* Compute Y-matrix for AC analysis. */
1693 matrix nigbt::calcMatrixY (nr_double_t frequency)
1694 {
1695  _freq = frequency;
1697  matrix y (9);
1698 
1699  for (int i1 = 0; i1 < 9; i1++) {
1700  for (int i2 = 0; i2 < 9; i2++) {
1701  y (i1,i2) = rect (_jstat[i1][i2], _jdyna[i1][i2] * 2 * M_PI * _freq);
1702  }
1703  }
1704 
1705  return y;
1706 }
1707 
1708 /* Initialization of S-parameter analysis. */
1709 void nigbt::initSP (void)
1710 {
1711  allocMatrixS ();
1712 }
1713 
1714 /* Perform S-parameter calculations. */
1715 void nigbt::calcSP (nr_double_t frequency)
1716 {
1717  setMatrixS (ytos (calcMatrixY (frequency)));
1718 }
1719 
1720 /* Initialization of transient analysis. */
1721 void nigbt::initTR (void)
1722 {
1723  setStates (2 * 9 * 9);
1724  initDC ();
1725 }
1726 
1727 /* Perform transient analysis iteration step. */
1728 void nigbt::calcTR (nr_double_t)
1729 {
1730  doHB = 0;
1731  doAC = 1;
1732  doTR = 1;
1733  calcDC ();
1734 
1735  int i1, i2, i3, i4, state;
1736 
1737  // 2-node charge integrations
1738  for (i1 = 0; i1 < 9; i1++) {
1739  for (i2 = 0; i2 < 9; i2++) {
1740  state = 2 * (i2 + 9 * i1);
1741  if (i1 != i2)
1742  if (_charges[i1][i2] != 0.0)
1743  transientCapacitanceQ (state, i1, i2, _charges[i1][i2]);
1744  } }
1745 
1746  // 1-node charge integrations
1747  for (i1 = 0; i1 < 9; i1++) {
1748  state = 2 * (i1 + 9 * i1);
1749  if (_charges[i1][i1] != 0.0)
1750  transientCapacitanceQ (state, i1, _charges[i1][i1]);
1751  }
1752 
1753  // charge: 2-node, voltage: 2-node
1754  for (i1 = 0; i1 < 9; i1++) {
1755  for (i2 = 0; i2 < 9; i2++) {
1756  if (i1 != i2)
1757  for (i3 = 0; i3 < 9; i3++) {
1758  for (i4 = 0; i4 < 9; i4++) {
1759  if (i3 != i4)
1760  if (_caps[i1][i2][i3][i4] != 0.0)
1761  transientCapacitanceC (i1, i2, i3, i4, _caps[i1][i2][i3][i4], BP(i3,i4));
1762  } } } }
1763 
1764  // charge: 2-node, voltage: 1-node
1765  for (i1 = 0; i1 < 9; i1++) {
1766  for (i2 = 0; i2 < 9; i2++) {
1767  if (i1 != i2)
1768  for (i3 = 0; i3 < 9; i3++) {
1769  if (_caps[i1][i2][i3][i3] != 0.0)
1770  transientCapacitanceC2Q (i1, i2, i3, _caps[i1][i2][i3][i3], NP(i3));
1771  } } }
1772 
1773  // charge: 1-node, voltage: 2-node
1774  for (i1 = 0; i1 < 9; i1++) {
1775  for (i3 = 0; i3 < 9; i3++) {
1776  for (i4 = 0; i4 < 9; i4++) {
1777  if (i3 != i4)
1778  if (_caps[i1][i1][i3][i4] != 0.0)
1779  transientCapacitanceC2V (i1, i3, i4, _caps[i1][i1][i3][i4], BP(i3,i4));
1780  } } }
1781 
1782  // charge: 1-node, voltage: 1-node
1783  for (i1 = 0; i1 < 9; i1++) {
1784  for (i3 = 0; i3 < 9; i3++) {
1785  if (_caps[i1][i1][i3][i3] != 0.0)
1786  transientCapacitanceC (i1, i3, _caps[i1][i1][i3][i3], NP(i3));
1787  } }
1788 }
1789 
1790 /* Compute Cy-matrix for AC noise analysis. */
1791 matrix nigbt::calcMatrixCy (nr_double_t frequency)
1792 {
1793  _freq = frequency;
1794  matrix cy (9);
1795 
1796 
1797  return cy;
1798 }
1799 
1800 /* Perform AC noise computations. */
1801 void nigbt::calcNoiseAC (nr_double_t frequency)
1802 {
1803  setMatrixN (calcMatrixCy (frequency));
1804 }
1805 
1806 /* Perform S-parameter noise computations. */
1807 void nigbt::calcNoiseSP (nr_double_t frequency)
1808 {
1809  setMatrixN (cytocs (calcMatrixCy (frequency) * z0, getMatrixS ()));
1810 }
1811 
1812 /* Initialization of HB analysis. */
1813 void nigbt::initHB (int)
1814 {
1815  initDC ();
1816  allocMatrixHB ();
1817 }
1818 
1819 /* Perform HB analysis. */
1820 void nigbt::calcHB (int)
1821 {
1822  doHB = 1;
1823  doAC = 1;
1824  doTR = 0;
1825 
1826  // jacobian dI/dV and currents get filled
1827  calcDC ();
1829 
1830  // fill in HB matrices
1831  for (int i1 = 0; i1 < 9; i1++) {
1832  setQ (i1, _qhs[i1]); // charges
1833  setCV (i1, _chs[i1]); // jacobian dQ/dV * V
1834  setGV (i1, _ghs[i1]); // jacobian dI/dV * V
1835  for (int i2 = 0; i2 < 9; i2++) {
1836  setQV (i1, i2, _jdyna[i1][i2]); // jacobian dQ/dV
1837  }
1838  }
1839 }
1840 
1841 #include "nigbt.defs.h"