My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HBT_X.analogfunction.cpp
Go to the documentation of this file.
1 /*
2  * HBT_X.analogfunction.cpp - analog function implementations
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 #include <stdio.h>
12 #include "HBT_X.analogfunction.h"
13 #include <math.h>
14 
15 /* math functions and appropriate derivatives */
16 inline double _cos(double arg) { return cos(arg); }
17 inline double _d0_cos(double arg) { return (-sin(arg)); }
18 inline double _sin(double arg) { return sin(arg); }
19 inline double _d0_sin(double arg) { return (cos(arg)); }
20 inline double _tan(double arg) { return tan(arg); }
21 inline double _d0_tan(double arg) { return (1.0/cos(arg)/cos(arg)); }
22 inline double _cosh(double arg) { return cosh(arg); }
23 inline double _d0_cosh(double arg) { return (sinh(arg)); }
24 inline double _sinh(double arg) { return sinh(arg); }
25 inline double _d0_sinh(double arg) { return (cosh(arg)); }
26 inline double _tanh(double arg) { return tanh(arg); }
27 inline double _d0_tanh(double arg) { return (1.0/cosh(arg)/cosh(arg)); }
28 inline double _acos(double arg) { return acos(arg); }
29 inline double _d0_acos(double arg) { return (-1.0/sqrt(1-arg*arg)); }
30 inline double _asin(double arg) { return asin(arg); }
31 inline double _d0_asin(double arg) { return (+1.0/sqrt(1-arg*arg)); }
32 inline double _atan(double arg) { return atan(arg); }
33 inline double _d0_atan(double arg) { return (+1.0/(1+arg*arg)); }
34 inline double _atanh(double arg) { return atanh(arg); }
35 inline double _d0_atanh(double arg) { return (+1.0/(1-arg*arg)); }
36 inline double _logE(double arg) { return log(arg); }
37 inline double _d0_logE(double arg) { return (1.0/arg); }
38 inline double _log10(double arg) { return log10(arg); }
39 inline double _d0_log10(double arg) { return (1.0/arg/log(10.0)); }
40 inline double _exp(double arg) { return exp(arg); }
41 inline double _d0_exp(double arg) { return exp(arg); }
42 inline double _sqrt(double arg) { return sqrt(arg); }
43 inline double _d0_sqrt(double arg) { return (1.0/sqrt(arg)/2.0); }
44 inline double _abs(double arg) { return fabs(arg); }
45 inline double _d0_abs(double arg) { return (((arg)>=0)?(+1.0):(-1.0)); }
46 inline int _floor(double arg) { return floor(arg); }
47 inline int _d0_floor(double) { return (1.0); }
48 
49 inline double _hypot(double x,double y) { return sqrt((x)*(x)+(y)*(y)); }
50 inline double _d0_hypot(double x,double y) { return (x)/sqrt((x)*(x)+(y)*(y)); }
51 inline double _d1_hypot(double x,double y) { return (y)/sqrt((x)*(x)+(y)*(y)); }
52 
53 inline double _max(double x,double y) { return ((x)>(y))?(x):(y); }
54 inline double _d0_max(double x,double y) { return ((x)>(y))?1.0:0.0; }
55 inline double _d1_max(double x,double y) { return ((x)>(y))?0.0:1.0; }
56 
57 inline double _min(double x,double y) { return ((x)<(y))?(x):(y); }
58 inline double _d0_min(double x,double y) { return ((x)<(y))?1.0:0.0; }
59 inline double _d1_min(double x,double y) { return ((x)<(y))?0.0:1.0; }
60 
61 inline double _pow(double x,double y) { return pow(x,y); }
62 inline double _d0_pow(double x,double y) { return (x==0.0)?0.0:((y/x)*pow(x,y)); }
63 inline double _d1_pow(double x,double y) { return (x==0.0)?0.0:((log(x)/exp(0.0))*pow(x,y)); }
64 
65 inline double _limexp(double arg) { return ((arg)<(80))?(exp(arg)):(exp(80.0)*(1.0+(arg-80))); }
66 inline double _d0_limexp(double arg) { return ((arg)<(80))?(exp(arg)):(exp(80.0)); }
67 
68 inline double _vt(double arg) { return 1.3806503e-23*arg/1.602176462e-19; }
69 inline double _d0_vt(double) { return 1.3806503e-23/1.602176462e-19; }
70 
71 
72 /*
73  * analog function: exp_soft
74  */
75 double HBT_X_exp_soft (double x)
76 {
77 double exp_soft=0.0;
78 double maxexp=0.0;
79 double maxarg=0.0;
80 {maxexp=1.0e25;
81 maxarg=_logE(maxexp);
82 if((x<maxarg))
83 {exp_soft=_exp(x);
84 }else
85 {exp_soft=(((x+1.0)-maxarg)*maxexp);
86 }}
87 return exp_soft;
88 }
89 double HBT_X_d_exp_soft (double x, double d_x)
90 {
91 double exp_soft=0.0;
92 double exp_soft_x=0.0;
93 double maxexp=0.0;
94 double maxexp_x=0.0;
95 double maxarg=0.0;
96 double maxarg_x=0.0;
97 {{maxexp_x=0.0;
98 maxexp=1.0e25;
99 }
100 {maxarg_x=_d0_logE(maxexp)*(maxexp_x);
101 maxarg=_logE(maxexp);
102 }
103 if((x<maxarg))
104 {{exp_soft_x=_d0_exp(x)*(1.0);
105 exp_soft=_exp(x);
106 }
107 }else
108 {{exp_soft_x=(((1.0-maxarg_x)*maxexp)+(((x+1.0)-maxarg)*maxexp_x));
109 exp_soft=(((x+1.0)-maxarg)*maxexp);
110 }
111 }}
112 return exp_soft_x*d_x;
113 }
114 
115 /*
116  * analog function: Vt
117  */
118 double HBT_X_Vt (double U, double Ud)
119 {
120 double Vt=0.0;
121 double Vch=0.0;
122 double VF=0.0;
123 {Vch=(0.1*Ud);
124 VF=(0.9*Ud);
125 if((U<VF))
126 Vt=(U-(Vch*_logE((1.0+_exp(((U-VF)/Vch))))));
127 else
128 Vt=(VF-(Vch*_logE((1.0+_exp(((VF-U)/Vch))))));
129 }
130 return Vt;
131 }
132 double HBT_X_d_Vt (double U, double Ud, double d_U, double d_Ud)
133 {
134 double Vt=0.0;
135 double Vt_U=0.0;
136 double Vt_Ud=0.0;
137 double Vch=0.0;
138 double Vch_U=0.0;
139 double Vch_Ud=0.0;
140 double VF=0.0;
141 double VF_U=0.0;
142 double VF_Ud=0.0;
143 {{Vch_U=0.0;
144 Vch_Ud=(0.1);
145 Vch=(0.1*Ud);
146 }
147 {VF_U=0.0;
148 VF_Ud=(0.9);
149 VF=(0.9*Ud);
150 }
151 if((U<VF))
152 {Vt_U=(1.0-((Vch_U*_logE((1.0+_exp(((U-VF)/Vch)))))+(Vch*_d0_logE((1.0+_exp(((U-VF)/Vch))))*((+_d0_exp(((U-VF)/Vch))*(((1.0-VF_U)*Vch-(U-VF)*Vch_U)/(Vch*Vch)))))));
153 Vt_Ud=(-((Vch_Ud*_logE((1.0+_exp(((U-VF)/Vch)))))+(Vch*_d0_logE((1.0+_exp(((U-VF)/Vch))))*((+_d0_exp(((U-VF)/Vch))*(((-VF_Ud)*Vch-(U-VF)*Vch_Ud)/(Vch*Vch)))))));
154 Vt=(U-(Vch*_logE((1.0+_exp(((U-VF)/Vch))))));
155 }
156 else
157 {Vt_U=(VF_U-((Vch_U*_logE((1.0+_exp(((VF-U)/Vch)))))+(Vch*_d0_logE((1.0+_exp(((VF-U)/Vch))))*((+_d0_exp(((VF-U)/Vch))*(((VF_U-1.0)*Vch-(VF-U)*Vch_U)/(Vch*Vch)))))));
158 Vt_Ud=(VF_Ud-((Vch_Ud*_logE((1.0+_exp(((VF-U)/Vch)))))+(Vch*_d0_logE((1.0+_exp(((VF-U)/Vch))))*((+_d0_exp(((VF-U)/Vch))*((VF_Ud*Vch-(VF-U)*Vch_Ud)/(Vch*Vch)))))));
159 Vt=(VF-(Vch*_logE((1.0+_exp(((VF-U)/Vch))))));
160 }
161 }
162 return Vt_U*d_U+Vt_Ud*d_Ud;
163 }
164 
165 /*
166  * analog function: diode
167  */
168 double HBT_X_diode (double U, double Is, double Ug, double N, double AREA, double TJ, double TNOM)
169 {
170 double diode=0.0;
171 double VTH0=0.0;
172 double VTHJ=0.0;
173 double VTHNOM=0.0;
174 double maxi=0.0;
175 double Tmax=0.0;
176 double TJM=0.0;
177 double KDURCHQ=0.0;
178 double lnIs=0.0;
179 {VTH0=_vt((20.0+273.15));
180 VTHNOM=_vt((TNOM+273.15));
181 KDURCHQ=0.861708692e-4;
182 lnIs=_logE((Is*AREA));
183 maxi=_logE(1e6);
184 if(((maxi<(Ug/VTHNOM))&&(U<0.0)))
185 {Tmax=(((Ug*VTHNOM)/((Ug-(maxi*VTHNOM))*KDURCHQ))-273.15);
186 TJM=HBT_X_Vt(TJ,Tmax);
187 }else
188 {TJM=TJ;
189 }VTHJ=_vt((TJM+273.15));
190 if((Ug>0.0))
191 {diode=(HBT_X_exp_soft(((((U/(N*VTHJ))+(Ug/VTHNOM))-(Ug/VTHJ))+lnIs))-HBT_X_exp_soft((((Ug/VTHNOM)-(Ug/VTHJ))+lnIs)));
192 }else
193 {diode=(HBT_X_exp_soft(((U/(N*VTH0))+lnIs))-(Is*AREA));
194 }}
195 return diode;
196 }
197 double HBT_X_d_diode (double U, double Is, double Ug, double N, double AREA, double TJ, double TNOM, double d_U, double d_Is, double d_Ug, double d_N, double d_AREA, double d_TJ, double d_TNOM)
198 {
199 double diode=0.0;
200 double diode_U=0.0;
201 double diode_Is=0.0;
202 double diode_Ug=0.0;
203 double diode_N=0.0;
204 double diode_AREA=0.0;
205 double diode_TJ=0.0;
206 double diode_TNOM=0.0;
207 double VTH0=0.0;
208 double VTH0_U=0.0;
209 double VTH0_Is=0.0;
210 double VTH0_Ug=0.0;
211 double VTH0_N=0.0;
212 double VTH0_AREA=0.0;
213 double VTH0_TJ=0.0;
214 double VTH0_TNOM=0.0;
215 double VTHJ=0.0;
216 double VTHJ_U=0.0;
217 double VTHJ_Is=0.0;
218 double VTHJ_Ug=0.0;
219 double VTHJ_N=0.0;
220 double VTHJ_AREA=0.0;
221 double VTHJ_TJ=0.0;
222 double VTHJ_TNOM=0.0;
223 double VTHNOM=0.0;
224 double VTHNOM_U=0.0;
225 double VTHNOM_Is=0.0;
226 double VTHNOM_Ug=0.0;
227 double VTHNOM_N=0.0;
228 double VTHNOM_AREA=0.0;
229 double VTHNOM_TJ=0.0;
230 double VTHNOM_TNOM=0.0;
231 double maxi=0.0;
232 double maxi_U=0.0;
233 double maxi_Is=0.0;
234 double maxi_Ug=0.0;
235 double maxi_N=0.0;
236 double maxi_AREA=0.0;
237 double maxi_TJ=0.0;
238 double maxi_TNOM=0.0;
239 double Tmax=0.0;
240 double Tmax_U=0.0;
241 double Tmax_Is=0.0;
242 double Tmax_Ug=0.0;
243 double Tmax_N=0.0;
244 double Tmax_AREA=0.0;
245 double Tmax_TJ=0.0;
246 double Tmax_TNOM=0.0;
247 double TJM=0.0;
248 double TJM_U=0.0;
249 double TJM_Is=0.0;
250 double TJM_Ug=0.0;
251 double TJM_N=0.0;
252 double TJM_AREA=0.0;
253 double TJM_TJ=0.0;
254 double TJM_TNOM=0.0;
255 double KDURCHQ=0.0;
256 double KDURCHQ_U=0.0;
257 double KDURCHQ_Is=0.0;
258 double KDURCHQ_Ug=0.0;
259 double KDURCHQ_N=0.0;
260 double KDURCHQ_AREA=0.0;
261 double KDURCHQ_TJ=0.0;
262 double KDURCHQ_TNOM=0.0;
263 double lnIs=0.0;
264 double lnIs_U=0.0;
265 double lnIs_Is=0.0;
266 double lnIs_Ug=0.0;
267 double lnIs_N=0.0;
268 double lnIs_AREA=0.0;
269 double lnIs_TJ=0.0;
270 double lnIs_TNOM=0.0;
271 {{VTH0_U=_d0_vt((20.0+273.15))*(0.0);
272 VTH0_Is=_d0_vt((20.0+273.15))*(0.0);
273 VTH0_Ug=_d0_vt((20.0+273.15))*(0.0);
274 VTH0_N=_d0_vt((20.0+273.15))*(0.0);
275 VTH0_AREA=_d0_vt((20.0+273.15))*(0.0);
276 VTH0_TJ=_d0_vt((20.0+273.15))*(0.0);
277 VTH0_TNOM=_d0_vt((20.0+273.15))*(0.0);
278 VTH0=_vt((20.0+273.15));
279 }
280 {VTHNOM_U=_d0_vt((TNOM+273.15))*(0.0);
281 VTHNOM_Is=_d0_vt((TNOM+273.15))*(0.0);
282 VTHNOM_Ug=_d0_vt((TNOM+273.15))*(0.0);
283 VTHNOM_N=_d0_vt((TNOM+273.15))*(0.0);
284 VTHNOM_AREA=_d0_vt((TNOM+273.15))*(0.0);
285 VTHNOM_TJ=_d0_vt((TNOM+273.15))*(0.0);
286 VTHNOM_TNOM=_d0_vt((TNOM+273.15))*(1.0);
287 VTHNOM=_vt((TNOM+273.15));
288 }
289 {KDURCHQ_U=0.0;
290 KDURCHQ_Is=0.0;
291 KDURCHQ_Ug=0.0;
292 KDURCHQ_N=0.0;
293 KDURCHQ_AREA=0.0;
294 KDURCHQ_TJ=0.0;
295 KDURCHQ_TNOM=0.0;
296 KDURCHQ=0.861708692e-4;
297 }
298 {lnIs_U=_d0_logE((Is*AREA))*(0.0);
299 lnIs_Is=_d0_logE((Is*AREA))*((AREA));
300 lnIs_Ug=_d0_logE((Is*AREA))*(0.0);
301 lnIs_N=_d0_logE((Is*AREA))*(0.0);
302 lnIs_AREA=_d0_logE((Is*AREA))*((Is));
303 lnIs_TJ=_d0_logE((Is*AREA))*(0.0);
304 lnIs_TNOM=_d0_logE((Is*AREA))*(0.0);
305 lnIs=_logE((Is*AREA));
306 }
307 {maxi_U=_d0_logE(1e6)*(0.0);
308 maxi_Is=_d0_logE(1e6)*(0.0);
309 maxi_Ug=_d0_logE(1e6)*(0.0);
310 maxi_N=_d0_logE(1e6)*(0.0);
311 maxi_AREA=_d0_logE(1e6)*(0.0);
312 maxi_TJ=_d0_logE(1e6)*(0.0);
313 maxi_TNOM=_d0_logE(1e6)*(0.0);
314 maxi=_logE(1e6);
315 }
316 if(((maxi<(Ug/VTHNOM))&&(U<0.0)))
317 {{Tmax_U=((Ug*VTHNOM_U)*((Ug-(maxi*VTHNOM))*KDURCHQ)-(Ug*VTHNOM)*(((-((maxi_U*VTHNOM)+(maxi*VTHNOM_U)))*KDURCHQ)+((Ug-(maxi*VTHNOM))*KDURCHQ_U)))/(((Ug-(maxi*VTHNOM))*KDURCHQ)*((Ug-(maxi*VTHNOM))*KDURCHQ));
318 Tmax_Is=((Ug*VTHNOM_Is)*((Ug-(maxi*VTHNOM))*KDURCHQ)-(Ug*VTHNOM)*(((-((maxi_Is*VTHNOM)+(maxi*VTHNOM_Is)))*KDURCHQ)+((Ug-(maxi*VTHNOM))*KDURCHQ_Is)))/(((Ug-(maxi*VTHNOM))*KDURCHQ)*((Ug-(maxi*VTHNOM))*KDURCHQ));
319 Tmax_Ug=((VTHNOM+(VTHNOM_Ug*Ug))*((Ug-(ma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);
325 }
326 {TJM_U=HBT_X_d_Vt(TJ,Tmax,(0.0),(Tmax_U));
327 TJM_Is=HBT_X_d_Vt(TJ,Tmax,(0.0),(Tmax_Is));
328 TJM_Ug=HBT_X_d_Vt(TJ,Tmax,(0.0),(Tmax_Ug));
329 TJM_N=HBT_X_d_Vt(TJ,Tmax,(0.0),(Tmax_N));
330 TJM_AREA=HBT_X_d_Vt(TJ,Tmax,(0.0),(Tmax_AREA));
331 TJM_TJ=HBT_X_d_Vt(TJ,Tmax,(1.0),(Tmax_TJ));
332 TJM_TNOM=HBT_X_d_Vt(TJ,Tmax,(0.0),(Tmax_TNOM));
333 TJM=HBT_X_Vt(TJ,Tmax);
334 }
335 }else
336 {{TJM_U=0.0;
337 TJM_Is=0.0;
338 TJM_Ug=0.0;
339 TJM_N=0.0;
340 TJM_AREA=0.0;
341 TJM_TJ=1.0;
342 TJM_TNOM=0.0;
343 TJM=TJ;
344 }
345 }{VTHJ_U=_d0_vt((TJM+273.15))*(TJM_U);
346 VTHJ_Is=_d0_vt((TJM+273.15))*(TJM_Is);
347 VTHJ_Ug=_d0_vt((TJM+273.15))*(TJM_Ug);
348 VTHJ_N=_d0_vt((TJM+273.15))*(TJM_N);
349 VTHJ_AREA=_d0_vt((TJM+273.15))*(TJM_AREA);
350 VTHJ_TJ=_d0_vt((TJM+273.15))*(TJM_TJ);
351 VTHJ_TNOM=_d0_vt((TJM+273.15))*(TJM_TNOM);
352 VTHJ=_vt((TJM+273.15));
353 }
354 if((Ug>0.0))
355 {{diode_U=(HBT_X_d_exp_soft(((((U/(N*VTHJ))+(Ug/VTHNOM))-(Ug/VTHJ))+lnIs),(((((((N*VTHJ)-(U*(N*VTHJ_U)))/((N*VTHJ)*(N*VTHJ)))+(-(Ug*VTHNOM_U)/(VTHNOM*VTHNOM)))-(-(Ug*VTHJ_U)/(VTHJ*VTHJ)))+lnIs_U)))-HBT_X_d_exp_soft((((Ug/VTHNOM)-(Ug/VTHJ))+lnIs),((((-(Ug*V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OM)-(Ug/VTHJ))+lnIs)));
363 }
364 }else
365 {{diode_U=HBT_X_d_exp_soft(((U/(N*VTH0))+lnIs),(((((N*VTH0)-(U*(N*VTH0_U)))/((N*VTH0)*(N*VTH0)))+lnIs_U)));
366 diode_Is=(HBT_X_d_exp_soft(((U/(N*VTH0))+lnIs),(((-(U*(N*VTH0_Is))/((N*VTH0)*(N*VTH0)))+lnIs_Is)))-(AREA));
367 diode_Ug=HBT_X_d_exp_soft(((U/(N*VTH0))+lnIs),(((-(U*(N*VTH0_Ug))/((N*VTH0)*(N*VTH0)))+lnIs_Ug)));
368 diode_N=HBT_X_d_exp_soft(((U/(N*VTH0))+lnIs),(((-(U*(VTH0+(VTH0_N*N)))/((N*VTH0)*(N*VTH0)))+lnIs_N)));
369 diode_AREA=(HBT_X_d_exp_soft(((U/(N*VTH0))+lnIs),(((-(U*(N*VTH0_AREA))/((N*VTH0)*(N*VTH0)))+lnIs_AREA)))-(Is));
370 diode_TJ=HBT_X_d_exp_soft(((U/(N*VTH0))+lnIs),(((-(U*(N*VTH0_TJ))/((N*VTH0)*(N*VTH0)))+lnIs_TJ)));
371 diode_TNOM=HBT_X_d_exp_soft(((U/(N*VTH0))+lnIs),(((-(U*(N*VTH0_TNOM))/((N*VTH0)*(N*VTH0)))+lnIs_TNOM)));
372 diode=(HBT_X_exp_soft(((U/(N*VTH0))+lnIs))-(Is*AREA));
373 }
374 }}
375 return diode_U*d_U+diode_Is*d_Is+diode_Ug*d_Ug+diode_N*d_N+diode_AREA*d_AREA+diode_TJ*d_TJ+diode_TNOM*d_TNOM;
376 }
377 
378 /*
379  * analog function: MM
380  */
381 double HBT_X_MM (double VBCI, double VCBO, double MC, double VCBLIN, double BF, double KC)
382 {
383 double MM=0.0;
384 double FBD=0.0;
385 double vcbi=0.0;
386 {if((((KC>0.0)&&(MC>0.0))&&(VCBO>0.0)))
387 {vcbi=VBCI;
388 FBD=(VCBLIN/VCBO);
389 if((VBCI>0.0))
390 MM=1.0;
391 else
392 if((VBCI>(-VCBLIN)))
393 {if((MC==1))
394 MM=(1.0/(1.0-(vcbi/(-VCBO))));
395 else
396 MM=(1.0/(1.0-_pow((vcbi/(-VCBO)),MC)));
397 }else
398 if((VBCI<=(-VCBLIN)))
399 {if((MC==1))
400 {MM=((1.0/(1.0-FBD))-((((1.0/VCBO)*1.0)/_pow((1.0-FBD),2.0))*(vcbi+(FBD*VCBO))));
401 }else
402 {MM=((1.0/(1.0-_pow(FBD,MC)))-((((MC/VCBO)*_pow(FBD,(MC-1.0)))/_pow((1.0-_pow(FBD,MC)),2.0))*(vcbi+(FBD*VCBO))));
403 }}}else
404 MM=1.0;
405 }
406 return MM;
407 }
408 double HBT_X_d_MM (double VBCI, double VCBO, double MC, double VCBLIN, double BF, double KC, double d_VBCI, double d_VCBO, double d_MC, double d_VCBLIN, double d_BF, double d_KC)
409 {
410 double MM=0.0;
411 double MM_VBCI=0.0;
412 double MM_VCBO=0.0;
413 double MM_MC=0.0;
414 double MM_VCBLIN=0.0;
415 double MM_BF=0.0;
416 double MM_KC=0.0;
417 double FBD=0.0;
418 double FBD_VBCI=0.0;
419 double FBD_VCBO=0.0;
420 double FBD_MC=0.0;
421 double FBD_VCBLIN=0.0;
422 double FBD_BF=0.0;
423 double FBD_KC=0.0;
424 double vcbi=0.0;
425 double vcbi_VBCI=0.0;
426 double vcbi_VCBO=0.0;
427 double vcbi_MC=0.0;
428 double vcbi_VCBLIN=0.0;
429 double vcbi_BF=0.0;
430 double vcbi_KC=0.0;
431 {if((((KC>0.0)&&(MC>0.0))&&(VCBO>0.0)))
432 {{vcbi_VBCI=1.0;
433 vcbi_VCBO=0.0;
434 vcbi_MC=0.0;
435 vcbi_VCBLIN=0.0;
436 vcbi_BF=0.0;
437 vcbi_KC=0.0;
438 vcbi=VBCI;
439 }
440 {FBD_VBCI=0.0;
441 FBD_VCBO=(-VCBLIN/(VCBO*VCBO));
442 FBD_MC=0.0;
443 FBD_VCBLIN=(1/VCBO);
444 FBD_BF=0.0;
445 FBD_KC=0.0;
446 FBD=(VCBLIN/VCBO);
447 }
448 if((VBCI>0.0))
449 {MM_VBCI=0.0;
450 MM_VCBO=0.0;
451 MM_MC=0.0;
452 MM_VCBLIN=0.0;
453 MM_BF=0.0;
454 MM_KC=0.0;
455 MM=1.0;
456 }
457 else
458 if((VBCI>(-VCBLIN)))
459 {if((MC==1))
460 {MM_VBCI=(-(-vcbi_VBCI/(-VCBO))/((1.0-(vcbi/(-VCBO)))*(1.0-(vcbi/(-VCBO)))));
461 MM_VCBO=(-(-vcbi_VCBO/(-VCBO))/((1.0-(vcbi/(-VCBO)))*(1.0-(vcbi/(-VCBO)))));
462 MM_MC=(-(-vcbi_MC/(-VCBO))/((1.0-(vcbi/(-VCBO)))*(1.0-(vcbi/(-VCBO)))));
463 MM_VCBLIN=(-(-vcbi_VCBLIN/(-VCBO))/((1.0-(vcbi/(-VCBO)))*(1.0-(vcbi/(-VCBO)))));
464 MM_BF=(-(-vcbi_BF/(-VCBO))/((1.0-(vcbi/(-VCBO)))*(1.0-(vcbi/(-VCBO)))));
465 MM_KC=(-(-vcbi_KC/(-VCBO))/((1.0-(vcbi/(-VCBO)))*(1.0-(vcbi/(-VCBO)))));
466 MM=(1.0/(1.0-(vcbi/(-VCBO))));
467 }
468 else
469 {MM_VBCI=(-(-_d0_pow((vcbi/(-VCBO)),MC)*(vcbi_VBCI/(-VCBO))+_d1_pow((vcbi/(-VCBO)),MC)*(0.0))/((1.0-_pow((vcbi/(-VCBO)),MC))*(1.0-_pow((vcbi/(-VCBO)),MC))));
470 MM_VCBO=(-(-_d0_pow((vcbi/(-VCBO)),MC)*(vcbi_VCBO/(-VCBO))+_d1_pow((vcbi/(-VCBO)),MC)*(0.0))/((1.0-_pow((vcbi/(-VCBO)),MC))*(1.0-_pow((vcbi/(-VCBO)),MC))));
471 MM_MC=(-(-_d0_pow((vcbi/(-VCBO)),MC)*(vcbi_MC/(-VCBO))+_d1_pow((vcbi/(-VCBO)),MC)*(1.0))/((1.0-_pow((vcbi/(-VCBO)),MC))*(1.0-_pow((vcbi/(-VCBO)),MC))));
472 MM_VCBLIN=(-(-_d0_pow((vcbi/(-VCBO)),MC)*(vcbi_VCBLIN/(-VCBO))+_d1_pow((vcbi/(-VCBO)),MC)*(0.0))/((1.0-_pow((vcbi/(-VCBO)),MC))*(1.0-_pow((vcbi/(-VCBO)),MC))));
473 MM_BF=(-(-_d0_pow((vcbi/(-VCBO)),MC)*(vcbi_BF/(-VCBO))+_d1_pow((vcbi/(-VCBO)),MC)*(0.0))/((1.0-_pow((vcbi/(-VCBO)),MC))*(1.0-_pow((vcbi/(-VCBO)),MC))));
474 MM_KC=(-(-_d0_pow((vcbi/(-VCBO)),MC)*(vcbi_KC/(-VCBO))+_d1_pow((vcbi/(-VCBO)),MC)*(0.0))/((1.0-_pow((vcbi/(-VCBO)),MC))*(1.0-_pow((vcbi/(-VCBO)),MC))));
475 MM=(1.0/(1.0-_pow((vcbi/(-VCBO)),MC)));
476 }
477 }else
478 if((VBCI<=(-VCBLIN)))
479 {if((MC==1))
480 {{MM_VBCI=((-(-FBD_VBCI)/((1.0-FBD)*(1.0-FBD)))-(((-(((1.0/VCBO)*1.0)*_d0_pow((1.0-FBD),2.0)*((-FBD_VBCI))+_d1_pow((1.0-FBD),2.0)*(0.0))/(_pow((1.0-FBD),2.0)*_pow((1.0-FBD),2.0)))*(vcbi+(FBD*VCBO)))+((((1.0/VCBO)*1.0)/_pow((1.0-FBD),2.0))*(vcbi_VBCI+FBD_VBCI*VCBO))));
481 MM_VCBO=((-(-FBD_VCBO)/((1.0-FBD)*(1.0-FBD)))-((((-1/(VCBO*VCBO))*1.0*_pow((1.0-FBD),2.0)-((1.0/VCBO)*1.0)*_d0_pow((1.0-FBD),2.0)*((-FBD_VCBO))+_d1_pow((1.0-FBD),2.0)*(0.0))/(_pow((1.0-FBD),2.0)*_pow((1.0-FBD),2.0))*(vcbi+(FBD*VCBO)))+((((1.0/VCBO)*1.0)/_pow((1.0-FBD),2.0))*(vcbi_VCBO+(FBD_VCBO*VCBO)+FBD))));
482 MM_MC=((-(-FBD_MC)/((1.0-FBD)*(1.0-FBD)))-(((-(((1.0/VCBO)*1.0)*_d0_pow((1.0-FBD),2.0)*((-FBD_MC))+_d1_pow((1.0-FBD),2.0)*(0.0))/(_pow((1.0-FBD),2.0)*_pow((1.0-FBD),2.0)))*(vcbi+(FBD*VCBO)))+((((1.0/VCBO)*1.0)/_pow((1.0-FBD),2.0))*(vcbi_MC+FBD_MC*VCBO))));
483 MM_VCBLIN=((-(-FBD_VCBLIN)/((1.0-FBD)*(1.0-FBD)))-(((-(((1.0/VCBO)*1.0)*_d0_pow((1.0-FBD),2.0)*((-FBD_VCBLIN))+_d1_pow((1.0-FBD),2.0)*(0.0))/(_pow((1.0-FBD),2.0)*_pow((1.0-FBD),2.0)))*(vcbi+(FBD*VCBO)))+((((1.0/VCBO)*1.0)/_pow((1.0-FBD),2.0))*(vcbi_VCBLIN+FBD_VCBLIN*VCBO))));
484 MM_BF=((-(-FBD_BF)/((1.0-FBD)*(1.0-FBD)))-(((-(((1.0/VCBO)*1.0)*_d0_pow((1.0-FBD),2.0)*((-FBD_BF))+_d1_pow((1.0-FBD),2.0)*(0.0))/(_pow((1.0-FBD),2.0)*_pow((1.0-FBD),2.0)))*(vcbi+(FBD*VCBO)))+((((1.0/VCBO)*1.0)/_pow((1.0-FBD),2.0))*(vcbi_BF+FBD_BF*VCBO))));
485 MM_KC=((-(-FBD_KC)/((1.0-FBD)*(1.0-FBD)))-(((-(((1.0/VCBO)*1.0)*_d0_pow((1.0-FBD),2.0)*((-FBD_KC))+_d1_pow((1.0-FBD),2.0)*(0.0))/(_pow((1.0-FBD),2.0)*_pow((1.0-FBD),2.0)))*(vcbi+(FBD*VCBO)))+((((1.0/VCBO)*1.0)/_pow((1.0-FBD),2.0))*(vcbi_KC+FBD_KC*VCBO))));
486 MM=((1.0/(1.0-FBD))-((((1.0/VCBO)*1.0)/_pow((1.0-FBD),2.0))*(vcbi+(FBD*VCBO))));
487 }
488 }else
489 {{MM_VBCI=((-(-_d0_pow(FBD,MC)*(FBD_VBCI)+_d1_pow(FBD,MC)*(0.0))/((1.0-_pow(FBD,MC))*(1.0-_pow(FBD,MC))))-(((((MC/VCBO)*_d0_pow(FBD,(MC-1.0))*(FBD_VBCI)+_d1_pow(FBD,(MC-1.0))*(0.0))*_pow((1.0-_pow(FBD,MC)),2.0)-((MC/VCBO)*_pow(FBD,(MC-1.0)))*_d0_pow((1.0-_pow(FBD,MC)),2.0)*((-_d0_pow(FBD,MC)*(FBD_VBCI)+_d1_pow(FBD,MC)*(0.0)))+_d1_pow((1.0-_pow(FBD,MC)),2.0)*(0.0))/(_pow((1.0-_pow(FBD,MC)),2.0)*_pow((1.0-_pow(FBD,MC)),2.0))*(vcbi+(FBD*VCBO)))+((((MC/VCBO)*_pow(FBD,(MC-1.0)))/_pow((1.0-_pow(FBD,MC)),2.0))*(vcbi_VBCI+FBD_VBCI*VCBO))));
490 MM_VCBO=((-(-_d0_pow(FBD,MC)*(FBD_VCBO)+_d1_pow(FBD,MC)*(0.0))/((1.0-_pow(FBD,MC))*(1.0-_pow(FBD,MC))))-((((((-MC/(VCBO*VCBO))*_pow(FBD,(MC-1.0)))+((MC/VCBO)*_d0_pow(FBD,(MC-1.0))*(FBD_VCBO)+_d1_pow(FBD,(MC-1.0))*(0.0)))*_pow((1.0-_pow(FBD,MC)),2.0)-((MC/VCBO)*_pow(FBD,(MC-1.0)))*_d0_pow((1.0-_pow(FBD,MC)),2.0)*((-_d0_pow(FBD,MC)*(FBD_VCBO)+_d1_pow(FBD,MC)*(0.0)))+_d1_pow((1.0-_pow(FBD,MC)),2.0)*(0.0))/(_pow((1.0-_pow(FBD,MC)),2.0)*_pow((1.0-_pow(FBD,MC)),2.0))*(vcbi+(FBD*VCBO)))+((((MC/VCBO)*_pow(FBD,(MC-1.0)))/_pow((1.0-_pow(FBD,MC)),2.0))*(vcbi_VCBO+(FBD_VCBO*VCBO)+FBD))));
491 MM_MC=((-(-_d0_pow(FBD,MC)*(FBD_MC)+_d1_pow(FBD,MC)*(1.0))/((1.0-_pow(FBD,MC))*(1.0-_pow(FBD,MC))))-((((((1/VCBO)*_pow(FBD,(MC-1.0)))+((MC/VCBO)*_d0_pow(FBD,(MC-1.0))*(FBD_MC)+_d1_pow(FBD,(MC-1.0))*(1.0)))*_pow((1.0-_pow(FBD,MC)),2.0)-((MC/VCBO)*_pow(FBD,(MC-1.0)))*_d0_pow((1.0-_pow(FBD,MC)),2.0)*((-_d0_pow(FBD,MC)*(FBD_MC)+_d1_pow(FBD,MC)*(1.0)))+_d1_pow((1.0-_pow(FBD,MC)),2.0)*(0.0))/(_pow((1.0-_pow(FBD,MC)),2.0)*_pow((1.0-_pow(FBD,MC)),2.0))*(vcbi+(FBD*VCBO)))+((((MC/VCBO)*_pow(FBD,(MC-1.0)))/_pow((1.0-_pow(FBD,MC)),2.0))*(vcbi_MC+FBD_MC*VCBO))));
492 MM_VCBLIN=((-(-_d0_pow(FBD,MC)*(FBD_VCBLIN)+_d1_pow(FBD,MC)*(0.0))/((1.0-_pow(FBD,MC))*(1.0-_pow(FBD,MC))))-(((((MC/VCBO)*_d0_pow(FBD,(MC-1.0))*(FBD_VCBLIN)+_d1_pow(FBD,(MC-1.0))*(0.0))*_pow((1.0-_pow(FBD,MC)),2.0)-((MC/VCBO)*_pow(FBD,(MC-1.0)))*_d0_pow((1.0-_pow(FBD,MC)),2.0)*((-_d0_pow(FBD,MC)*(FBD_VCBLIN)+_d1_pow(FBD,MC)*(0.0)))+_d1_pow((1.0-_pow(FBD,MC)),2.0)*(0.0))/(_pow((1.0-_pow(FBD,MC)),2.0)*_pow((1.0-_pow(FBD,MC)),2.0))*(vcbi+(FBD*VCBO)))+((((MC/VCBO)*_pow(FBD,(MC-1.0)))/_pow((1.0-_pow(FBD,MC)),2.0))*(vcbi_VCBLIN+FBD_VCBLIN*VCBO))));
493 MM_BF=((-(-_d0_pow(FBD,MC)*(FBD_BF)+_d1_pow(FBD,MC)*(0.0))/((1.0-_pow(FBD,MC))*(1.0-_pow(FBD,MC))))-(((((MC/VCBO)*_d0_pow(FBD,(MC-1.0))*(FBD_BF)+_d1_pow(FBD,(MC-1.0))*(0.0))*_pow((1.0-_pow(FBD,MC)),2.0)-((MC/VCBO)*_pow(FBD,(MC-1.0)))*_d0_pow((1.0-_pow(FBD,MC)),2.0)*((-_d0_pow(FBD,MC)*(FBD_BF)+_d1_pow(FBD,MC)*(0.0)))+_d1_pow((1.0-_pow(FBD,MC)),2.0)*(0.0))/(_pow((1.0-_pow(FBD,MC)),2.0)*_pow((1.0-_pow(FBD,MC)),2.0))*(vcbi+(FBD*VCBO)))+((((MC/VCBO)*_pow(FBD,(MC-1.0)))/_pow((1.0-_pow(FBD,MC)),2.0))*(vcbi_BF+FBD_BF*VCBO))));
494 MM_KC=((-(-_d0_pow(FBD,MC)*(FBD_KC)+_d1_pow(FBD,MC)*(0.0))/((1.0-_pow(FBD,MC))*(1.0-_pow(FBD,MC))))-(((((MC/VCBO)*_d0_pow(FBD,(MC-1.0))*(FBD_KC)+_d1_pow(FBD,(MC-1.0))*(0.0))*_pow((1.0-_pow(FBD,MC)),2.0)-((MC/VCBO)*_pow(FBD,(MC-1.0)))*_d0_pow((1.0-_pow(FBD,MC)),2.0)*((-_d0_pow(FBD,MC)*(FBD_KC)+_d1_pow(FBD,MC)*(0.0)))+_d1_pow((1.0-_pow(FBD,MC)),2.0)*(0.0))/(_pow((1.0-_pow(FBD,MC)),2.0)*_pow((1.0-_pow(FBD,MC)),2.0))*(vcbi+(FBD*VCBO)))+((((MC/VCBO)*_pow(FBD,(MC-1.0)))/_pow((1.0-_pow(FBD,MC)),2.0))*(vcbi_KC+FBD_KC*VCBO))));
495 MM=((1.0/(1.0-_pow(FBD,MC)))-((((MC/VCBO)*_pow(FBD,(MC-1.0)))/_pow((1.0-_pow(FBD,MC)),2.0))*(vcbi+(FBD*VCBO))));
496 }
497 }}}else
498 {MM_VBCI=0.0;
499 MM_VCBO=0.0;
500 MM_MC=0.0;
501 MM_VCBLIN=0.0;
502 MM_BF=0.0;
503 MM_KC=0.0;
504 MM=1.0;
505 }
506 }
507 return MM_VBCI*d_VBCI+MM_VCBO*d_VCBO+MM_MC*d_MC+MM_VCBLIN*d_VCBLIN+MM_BF*d_BF+MM_KC*d_KC;
508 }
509 
510 /*
511  * analog function: charge
512  */
513 double HBT_X_charge (double U, double C0, double Ud, double m, double Area)
514 {
515 double charge=0.0;
516 double Vj=0.0;
517 double Vjo=0.0;
518 double VF=0.0;
519 {Vj=HBT_X_Vt(U,Ud);
520 Vjo=HBT_X_Vt(0.0,Ud);
521 VF=(0.9*Ud);
522 if((m==1.0))
523 {charge=((Area*C0)*((Ud*(_logE((1.0-(Vjo/Ud)))-_logE((1.0-(Vj/Ud)))))+((1.0/(1.0-(VF/Ud)))*((U-Vj)+Vjo))));
524 }else
525 {charge=((Area*C0)*((((Ud/(1.0-m))*(_pow((1.0-(Vjo/Ud)),(1.0-m))-_pow((1.0-(Vj/Ud)),(1.0-m))))+(_pow((1.0-(VF/Ud)),(-m))*((U-Vj)+Vjo)))-(Ud*(1.0/(1.0-m)))));
526 }}
527 return charge;
528 }
529 double HBT_X_d_charge (double U, double C0, double Ud, double m, double Area, double d_U, double d_C0, double d_Ud, double d_m, double d_Area)
530 {
531 double charge=0.0;
532 double charge_U=0.0;
533 double charge_C0=0.0;
534 double charge_Ud=0.0;
535 double charge_m=0.0;
536 double charge_Area=0.0;
537 double Vj=0.0;
538 double Vj_U=0.0;
539 double Vj_C0=0.0;
540 double Vj_Ud=0.0;
541 double Vj_m=0.0;
542 double Vj_Area=0.0;
543 double Vjo=0.0;
544 double Vjo_U=0.0;
545 double Vjo_C0=0.0;
546 double Vjo_Ud=0.0;
547 double Vjo_m=0.0;
548 double Vjo_Area=0.0;
549 double VF=0.0;
550 double VF_U=0.0;
551 double VF_C0=0.0;
552 double VF_Ud=0.0;
553 double VF_m=0.0;
554 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j_C0)+Vjo_C0))))));
579 charge_Ud=((Area*C0)*(((_logE((1.0-(Vjo/Ud)))-_logE((1.0-(Vj/Ud))))+((_d0_logE((1.0-(Vjo/Ud)))*((-((Vjo_Ud*Ud)-Vjo)/(Ud*Ud)))-_d0_logE((1.0-(Vj/Ud)))*((-((Vj_Ud*Ud)-Vj)/(Ud*Ud))))*Ud))+(((-(-((VF_Ud*Ud)-VF)/(Ud*Ud))/((1.0-(VF/Ud))*(1.0-(VF/Ud))))*((U-Vj)+Vjo))+((1.0/(1.0-(VF/Ud)))*((-Vj_Ud)+Vjo_Ud)))));
580 charge_m=((Area*C0)*((Ud*(_d0_logE((1.0-(Vjo/Ud)))*((-Vjo_m/Ud))-_d0_logE((1.0-(Vj/Ud)))*((-Vj_m/Ud))))+(((-(-VF_m/Ud)/((1.0-(VF/Ud))*(1.0-(VF/Ud))))*((U-Vj)+Vjo))+((1.0/(1.0-(VF/Ud)))*((-Vj_m)+Vjo_m)))));
581 charge_Area=(((C0)*((Ud*(_logE((1.0-(Vjo/Ud)))-_logE((1.0-(Vj/Ud)))))+((1.0/(1.0-(VF/Ud)))*((U-Vj)+Vjo))))+((Area*C0)*((Ud*(_d0_logE((1.0-(Vjo/Ud)))*((-Vjo_Area/Ud))-_d0_logE((1.0-(Vj/Ud)))*((-Vj_Area/Ud))))+(((-(-VF_Area/Ud)/((1.0-(VF/Ud))*(1.0-(VF/Ud))))*((U-Vj)+Vjo))+((1.0/(1.0-(VF/Ud)))*((-Vj_Area)+Vjo_Area))))));
582 charge=((Area*C0)*((Ud*(_logE((1.0-(Vjo/Ud)))-_logE((1.0-(Vj/Ud)))))+((1.0/(1.0-(VF/Ud)))*((U-Vj)+Vjo))));
583 }
584 }else
585 {{charge_U=((Area*C0)*(((Ud/(1.0-m))*(_d0_pow((1.0-(Vjo/Ud)),(1.0-m))*((-Vjo_U/Ud))+_d1_pow((1.0-(Vjo/Ud)),(1.0-m))*(0.0)-_d0_pow((1.0-(Vj/Ud)),(1.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+Vjo))+(_pow((1.0-(VF/Ud)),(-m))*((-Vj_Ud)+Vjo_Ud))))-((1.0/(1.0-m)))));
588 charge_m=((Area*C0)*(((((-(Ud*(-1.0))/((1.0-m)*(1.0-m)))*(_pow((1.0-(Vjo/Ud)),(1.0-m))-_pow((1.0-(Vj/Ud)),(1.0-m))))+((Ud/(1.0-m))*(_d0_pow((1.0-(Vjo/Ud)),(1.0-m))*((-Vjo_m/Ud))+_d1_pow((1.0-(Vjo/Ud)),(1.0-m))*((-1.0))-_d0_pow((1.0-(Vj/Ud)),(1.0-m))*((-Vj_m/Ud))+_d1_pow((1.0-(Vj/Ud)),(1.0-m))*((-1.0)))))+((_d0_pow((1.0-(VF/Ud)),(-m))*((-VF_m/Ud))+_d1_pow((1.0-(VF/Ud)),(-m))*(0.0)*((U-Vj)+Vjo))+(_pow((1.0-(VF/Ud)),(-m))*((-Vj_m)+Vjo_m))))-(Ud*(-(-1.0)/((1.0-m)*(1.0-m))))));
589 charge_Area=(((C0)*((((Ud/(1.0-m))*(_pow((1.0-(Vjo/Ud)),(1.0-m))-_pow((1.0-(Vj/Ud)),(1.0-m))))+(_pow((1.0-(VF/Ud)),(-m))*((U-Vj)+Vjo)))-(Ud*(1.0/(1.0-m)))))+((Area*C0)*(((Ud/(1.0-m))*(_d0_pow((1.0-(Vjo/Ud)),(1.0-m))*((-Vjo_Area/Ud))+_d1_pow((1.0-(Vjo/Ud)),(1.0-m))*(0.0)-_d0_pow((1.0-(Vj/Ud)),(1.0-m))*((-Vj_Area/Ud))+_d1_pow((1.0-(Vj/Ud)),(1.0-m))*(0.0)))+((_d0_pow((1.0-(VF/Ud)),(-m))*((-VF_Area/Ud))+_d1_pow((1.0-(VF/Ud)),(-m))*(0.0)*((U-Vj)+Vjo))+(_pow((1.0-(VF/Ud)),(-m))*((-Vj_Area)+Vjo_Area))))));
590 charge=((Area*C0)*((((Ud/(1.0-m))*(_pow((1.0-(Vjo/Ud)),(1.0-m))-_pow((1.0-(Vj/Ud)),(1.0-m))))+(_pow((1.0-(VF/Ud)),(-m))*((U-Vj)+Vjo)))-(Ud*(1.0/(1.0-m)))));
591 }
592 }}
593 return charge_U*d_U+charge_C0*d_C0+charge_Ud*d_Ud+charge_m*d_m+charge_Area*d_Area;
594 }
595 
596 /*
597  * analog function: Vceff
598  */
599 double HBT_X_Vceff (double U, double VCES)
600 {
601 double Vceff=0.0;
602 double Vth0=0.0;
603 {Vth0=0.025;
604 if((U<VCES))
605 Vceff=(Vth0+(Vth0*_logE((1.0+_exp((((U-VCES)/Vth0)-1.0))))));
606 else
607 Vceff=((U-VCES)+(Vth0*_logE((1.0+_exp((1.0-((U-VCES)/Vth0)))))));
608 }
609 return Vceff;
610 }
611 double HBT_X_d_Vceff (double U, double VCES, double d_U, double d_VCES)
612 {
613 double Vceff=0.0;
614 double Vceff_U=0.0;
615 double Vceff_VCES=0.0;
616 double Vth0=0.0;
617 double Vth0_U=0.0;
618 double Vth0_VCES=0.0;
619 {{Vth0_U=0.0;
620 Vth0_VCES=0.0;
621 Vth0=0.025;
622 }
623 if((U<VCES))
624 {Vceff_U=(Vth0_U+((Vth0_U*_logE((1.0+_exp((((U-VCES)/Vth0)-1.0)))))+(Vth0*_d0_logE((1.0+_exp((((U-VCES)/Vth0)-1.0))))*((+_d0_exp((((U-VCES)/Vth0)-1.0))*(((Vth0-((U-VCES)*Vth0_U))/(Vth0*Vth0))))))));
625 Vceff_VCES=(Vth0_VCES+((Vth0_VCES*_logE((1.0+_exp((((U-VCES)/Vth0)-1.0)))))+(Vth0*_d0_logE((1.0+_exp((((U-VCES)/Vth0)-1.0))))*((+_d0_exp((((U-VCES)/Vth0)-1.0))*(((-1.0)*Vth0-(U-VCES)*Vth0_VCES)/(Vth0*Vth0)))))));
626 Vceff=(Vth0+(Vth0*_logE((1.0+_exp((((U-VCES)/Vth0)-1.0))))));
627 }
628 else
629 {Vceff_U=(1.0+((Vth0_U*_logE((1.0+_exp((1.0-((U-VCES)/Vth0))))))+(Vth0*_d0_logE((1.0+_exp((1.0-((U-VCES)/Vth0)))))*((+_d0_exp((1.0-((U-VCES)/Vth0)))*((-((Vth0-((U-VCES)*Vth0_U))/(Vth0*Vth0)))))))));
630 Vceff_VCES=((-1.0)+((Vth0_VCES*_logE((1.0+_exp((1.0-((U-VCES)/Vth0))))))+(Vth0*_d0_logE((1.0+_exp((1.0-((U-VCES)/Vth0)))))*((+_d0_exp((1.0-((U-VCES)/Vth0)))*((-((-1.0)*Vth0-(U-VCES)*Vth0_VCES)/(Vth0*Vth0))))))));
631 Vceff=((U-VCES)+(Vth0*_logE((1.0+_exp((1.0-((U-VCES)/Vth0)))))));
632 }
633 }
634 return Vceff_U*d_U+Vceff_VCES*d_VCES;
635 }
636 
637 /*
638  * analog function: ICK
639  */
640 double HBT_X_ICK (double U, double RCI0, double VLIM, double InvVPT, double VCES)
641 {
642 double ICK=0.0;
643 double VC=0.0;
644 double x=0.0;
645 {VC=HBT_X_Vceff(U,VCES);
646 x=((VC-VLIM)*InvVPT);
647 ICK=(((VC/RCI0)*(1.0/_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))*(1.0+((x+_sqrt(((x*x)+0.001)))/2.0)));
648 }
649 return ICK;
650 }
651 double HBT_X_d_ICK (double U, double RCI0, double VLIM, double InvVPT, double VCES, double d_U, double d_RCI0, double d_VLIM, double d_InvVPT, double d_VCES)
652 {
653 double ICK=0.0;
654 double ICK_U=0.0;
655 double ICK_RCI0=0.0;
656 double ICK_VLIM=0.0;
657 double ICK_InvVPT=0.0;
658 double ICK_VCES=0.0;
659 double VC=0.0;
660 double VC_U=0.0;
661 double VC_RCI0=0.0;
662 double VC_VLIM=0.0;
663 double VC_InvVPT=0.0;
664 double VC_VCES=0.0;
665 double x=0.0;
666 double x_U=0.0;
667 double x_RCI0=0.0;
668 double x_VLIM=0.0;
669 double x_InvVPT=0.0;
670 double x_VCES=0.0;
671 {{VC_U=HBT_X_d_Vceff(U,VCES,(1.0),(0.0));
672 VC_RCI0=HBT_X_d_Vceff(U,VCES,(0.0),(0.0));
673 VC_VLIM=HBT_X_d_Vceff(U,VCES,(0.0),(0.0));
674 VC_InvVPT=HBT_X_d_Vceff(U,VCES,(0.0),(0.0));
675 VC_VCES=HBT_X_d_Vceff(U,VCES,(0.0),(1.0));
676 VC=HBT_X_Vceff(U,VCES);
677 }
678 {x_U=VC_U*InvVPT;
679 x_RCI0=VC_RCI0*InvVPT;
680 x_VLIM=(VC_VLIM-1.0)*InvVPT;
681 x_InvVPT=(VC_InvVPT*InvVPT)+(VC-VLIM);
682 x_VCES=VC_VCES*InvVPT;
683 x=((VC-VLIM)*InvVPT);
684 }
685 {ICK_U=((((VC_U/RCI0*(1.0/_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))+((VC/RCI0)*(-_d0_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))*((+((VC_U/VLIM*(VC/VLIM))+((VC/VLIM)*VC_U/VLIM))))/(_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))*_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))))*(1.0+((x+_sqrt(((x*x)+0.001)))/2.0)))+(((VC/RCI0)*(1.0/_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))*(+(x_U+_d0_sqrt(((x*x)+0.001))*(((x_U*x)+(x*x_U))))/2.0)));
686 ICK_RCI0=((((((VC_RCI0*RCI0)-VC)/(RCI0*RCI0)*(1.0/_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))+((VC/RCI0)*(-_d0_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))*((+((VC_RCI0/VLIM*(VC/VLIM))+((VC/VLIM)*VC_RCI0/VLIM))))/(_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))*_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))))*(1.0+((x+_sqrt(((x*x)+0.001)))/2.0)))+(((VC/RCI0)*(1.0/_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))*(+(x_RCI0+_d0_sqrt(((x*x)+0.001))*(((x_RCI0*x)+(x*x_RCI0))))/2.0)));
687 ICK_VLIM=((((VC_VLIM/RCI0*(1.0/_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))+((VC/RCI0)*(-_d0_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))*((+((((VC_VLIM*VLIM)-VC)/(VLIM*VLIM)*(VC/VLIM))+((VC/VLIM)*((VC_VLIM*VLIM)-VC)/(VLIM*VLIM)))))/(_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))*_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))))*(1.0+((x+_sqrt(((x*x)+0.001)))/2.0)))+(((VC/RCI0)*(1.0/_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))*(+(x_VLIM+_d0_sqrt(((x*x)+0.001))*(((x_VLIM*x)+(x*x_VLIM))))/2.0)));
688 ICK_InvVPT=((((VC_InvVPT/RCI0*(1.0/_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))+((VC/RCI0)*(-_d0_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))*((+((VC_InvVPT/VLIM*(VC/VLIM))+((VC/VLIM)*VC_InvVPT/VLIM))))/(_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))*_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))))*(1.0+((x+_sqrt(((x*x)+0.001)))/2.0)))+(((VC/RCI0)*(1.0/_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))*(+(x_InvVPT+_d0_sqrt(((x*x)+0.001))*(((x_InvVPT*x)+(x*x_InvVPT))))/2.0)));
689 ICK_VCES=((((VC_VCES/RCI0*(1.0/_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))+((VC/RCI0)*(-_d0_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))*((+((VC_VCES/VLIM*(VC/VLIM))+((VC/VLIM)*VC_VCES/VLIM))))/(_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))*_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))))*(1.0+((x+_sqrt(((x*x)+0.001)))/2.0)))+(((VC/RCI0)*(1.0/_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))*(+(x_VCES+_d0_sqrt(((x*x)+0.001))*(((x_VCES*x)+(x*x_VCES))))/2.0)));
690 ICK=(((VC/RCI0)*(1.0/_sqrt((1.0+((VC/VLIM)*(VC/VLIM))))))*(1.0+((x+_sqrt(((x*x)+0.001)))/2.0)));
691 }
692 }
693 return ICK_U*d_U+ICK_RCI0*d_RCI0+ICK_VLIM*d_VLIM+ICK_InvVPT*d_InvVPT+ICK_VCES*d_VCES;
694 }