45 using namespace qucs::device;
57 const char *
c,
const char *
n,
64 res->setNode (0, base->getNode(
internal)->getName ());
65 res->setNode (1, node, 1);
66 base->getNet()->insertCircuit (res);
70 base->setNode (
internal, res->getNode(1)->getName (), 1);
79 base->getNet()->removeCircuit (res, 0);
80 base->setNode (
internal, res->getNode(1)->getName (), 0);
94 cap->setNode (0, n1->getName ());
95 cap->setNode (1, n2->getName ());
98 base->getNet()->insertCircuit (cap);
105 base->getNet()->removeCircuit (cap, 0);
113 if (c != NULL && c->isEnabled ())
122 nr_double_t Ut, nr_double_t Ucrit) {
124 if (Ud > Ucrit && fabs (Ud - Uold) > 2 * Ut) {
126 arg = (Ud - Uold) / Ut;
128 Ud = Uold + Ut * (2 +
log (arg - 2));
130 Ud = Uold - Ut * (2 +
log (2 - arg));
132 else Ud = Uold < 0 ? Ut *
log (Ud / Ut) : Ucrit;
136 arg = Uold > 0 ? -1 - Uold : 2 * Uold - 1;
137 if (Ud < arg) Ud =
arg;
145 nr_double_t& I, nr_double_t& g) {
151 nr_double_t e =
exp (
MIN (Upn / Ute, 709));
159 nr_double_t& I, nr_double_t& g) {
160 if (Upn < -3 * Ute) {
161 nr_double_t a = 3 * Ute / (Upn *
M_E);
164 g = +Iss * 3 * a / Upn;
167 nr_double_t e =
exp (
MIN (Upn / Ute, 709));
176 return Iss * (
exp (
MIN (Upn / Ute, 709)) - 1);
182 return Iss *
exp (
MIN (Upn / Ute, 709)) / Ute;
188 nr_double_t Mj, nr_double_t Fc) {
191 c = Cj *
exp (-Mj *
log (1 - Uj / Vj));
193 c = Cj *
exp (-Mj *
log (1 - Fc)) *
194 (1 + Mj * (Uj - Fc * Vj) / Vj / (1 - Fc));
200 nr_double_t Mj, nr_double_t Fc) {
204 b =
exp ((1 - Mj) *
log (a));
205 q = Cj * Vj / (1 - Mj) * (1 - b);
210 b =
exp ((1 - Mj) *
log (a));
211 a =
exp ((1 + Mj) *
log (a));
212 nr_double_t
c = 1 - Fc * (1 + Mj);
213 nr_double_t
d = Fc * Vj;
214 nr_double_t e = Vj * (1 - b) / (1 - Mj);
215 q = Cj * (e + (c * (Uj -
d) + Mj / 2 / Vj * (
sqr (Uj) -
sqr (d))) / a);
219 nr_double_t f = Fc * Vj;
220 nr_double_t c = Cj * (1 - Fc * (1 + Mj)) * b / a;
221 nr_double_t d = Cj * Mj * b / a / Vj;
222 nr_double_t e = Cj * Vj * (1 - a * b) / (1 - Mj) - d / 2 * f * f - f *
c;
223 q = e + Uj * (c + Uj * d / 2);
236 c = Cj *
exp (-Mj *
log (1 - Uj / Vj));
238 c = Cj * (1 + Mj * Uj / Vj);
248 q = Cj * Vj / (1 - Mj) * (1 -
exp ((1 - Mj) *
log (1 - Uj / Vj)));
250 q = Cj * Uj * (1 + Mj * Uj / 2 / Vj);
264 nr_double_t Utsthi = fabs (2 * (Uold - Uth)) + 2.0;
265 nr_double_t Utstlo = Utsthi / 2;
266 nr_double_t Utox = Uth + 3.5;
267 nr_double_t DeltaU = Ufet - Uold;
273 if (-DeltaU > Utstlo) {
274 Ufet = Uold - Utstlo;
277 Ufet =
MAX (Ufet, Uth + 2);
280 if (DeltaU >= Utsthi) {
281 Ufet = Uold + Utsthi;
286 Ufet =
MAX (Ufet, Uth - 0.5);
288 Ufet =
MIN (Ufet, Uth + 4);
293 if (-DeltaU > Utsthi) {
294 Ufet = Uold - Utsthi;
297 if (Ufet <= Uth + 0.5) {
298 if (DeltaU > Utstlo) {
299 Ufet = Uold + Utstlo;
315 Ufet =
MIN (Ufet, 3 * Uold + 2);
316 }
else if (Ufet < 3.5) {
317 Ufet =
MAX (Ufet, 2);
321 Ufet =
MIN (Ufet, 4);
323 Ufet =
MAX (Ufet, -0.5);
334 nr_double_t Udsat, nr_double_t Phi,
335 nr_double_t Cox, nr_double_t& Cgs,
336 nr_double_t& Cgd, nr_double_t& Cgb) {
338 nr_double_t Utst = Ugs - Uth;
343 }
else if (Utst <= -Phi / 2) {
344 Cgb = -Utst * Cox / Phi;
347 }
else if (Utst <= 0) {
348 Cgb = -Utst * Cox / Phi;
349 Cgs = Utst * Cox * 4 / 3 / Phi + 2 * Cox / 3;
353 nr_double_t Uds = Ugs - Ugd;
358 nr_double_t Sqr1 =
sqr (Udsat - Uds);
359 nr_double_t Sqr2 =
sqr (2 * Udsat - Uds);
360 Cgs = Cox * (1 - Sqr1 / Sqr2) * 2 / 3;
361 Cgd = Cox * (1 - Udsat * Udsat / Sqr2) * 2 / 3;
368 nr_double_t a = 7.02e-4;
369 nr_double_t b = 1108;
370 return Eg0 - (a *
sqr (T)) / (T + b);
375 nr_double_t TR = 300.00;
376 nr_double_t E1 =
Egap (TR, Eg0);
377 nr_double_t E2 =
Egap (T, Eg0);
378 nr_double_t NI =
NiSi / 1e6;
379 return NI *
exp (1.5 *
log (T / TR) + (E1 / TR - E2 / T) /
kBoverQ / 2);
385 nr_double_t Eg, nr_double_t
N, nr_double_t Xti) {
389 return Is *
exp (Xti / N *
log (TR) - Eg / N / Vt * (1 - TR));
396 nr_double_t Vt, TR, E1, E2;
401 return TR * Vj - 3 * Vt *
log (TR) - (TR * E1 - E2);
407 nr_double_t VR, nr_double_t Cj) {
415 nr_double_t DT = T2 - T1;
416 return 1 + M * (4e-4 * DT - VR + 1);
#define M_E
Euler's constant ( )
#define NiSi
Intrinsic carrier concentration in 1/m^3 of Silicon.
void disableCapacitor(circuit *base, circuit *cap)
nr_double_t pnConductance(nr_double_t Upn, nr_double_t Iss, nr_double_t Ute)
circuit * splitResistor(circuit *base, circuit *res, const char *c, const char *n, int internal)
int deviceEnabled(circuit *c)
Global physical constants header file.
void pnJunctionMOS(nr_double_t Upn, nr_double_t Iss, nr_double_t Ute, nr_double_t &I, nr_double_t &g)
circuit * splitCapacitor(circuit *base, circuit *cap, const char *c, node *n1, node *n2)
void fetCapacitanceMeyer(nr_double_t Ugs, nr_double_t Ugd, nr_double_t Uth, nr_double_t Udsat, nr_double_t Phi, nr_double_t Cox, nr_double_t &Cgs, nr_double_t &Cgd, nr_double_t &Cgb)
nr_double_t pnCapacitance(nr_double_t Uj, nr_double_t Cj, nr_double_t Vj, nr_double_t Mj, nr_double_t Fc)
nr_complex_t sqr(const nr_complex_t z)
Square of complex number.
nr_double_t Egap(nr_double_t T, nr_double_t Eg0=Eg0Si)
nr_double_t pnCurrent_T(nr_double_t T1, nr_double_t T2, nr_double_t Is, nr_double_t Eg, nr_double_t N=1, nr_double_t Xti=0)
nr_double_t fetVoltage(nr_double_t Ufet, nr_double_t Uold, nr_double_t Uth)
nr_double_t pnCapacitance_T(nr_double_t T1, nr_double_t T2, nr_double_t M, nr_double_t VR, nr_double_t Cj)
#define kBoverQ
Boltzmann constant over Elementary charge ( )
void disableResistor(circuit *base, circuit *res, int internal)
void pnJunctionBIP(nr_double_t Upn, nr_double_t Iss, nr_double_t Ute, nr_double_t &I, nr_double_t &g)
The circuit class header file.
nr_double_t pnCapacitance_F(nr_double_t T1, nr_double_t T2, nr_double_t M, nr_double_t VR)
static char * createInternal(const char *, const char *)
nr_double_t pnPotential_T(nr_double_t T1, nr_double_t T2, nr_double_t Vj, nr_double_t Eg0=Eg0Si)
nr_double_t pnCharge(nr_double_t Uj, nr_double_t Cj, nr_double_t Vj, nr_double_t Mj, nr_double_t Fc)
#define MIN(x, y)
Minimum of x and y.
nr_double_t intrinsicDensity(nr_double_t T, nr_double_t Eg0=Eg0Si)
nr_double_t fetVoltageDS(nr_double_t Ufet, nr_double_t Uold)
nr_complex_t exp(const nr_complex_t z)
Compute complex exponential.
nr_double_t pnCriticalVoltage(nr_double_t Iss, nr_double_t Ute)
nr_complex_t log(const nr_complex_t z)
Compute principal value of natural logarithm of z.
#define M_SQRT2
Square root of 2 ( )
nr_double_t pnCurrent(nr_double_t Upn, nr_double_t Iss, nr_double_t Ute)
matrix arg(matrix a)
Computes the argument of each matrix element.
#define MAX(x, y)
Maximum of x and y.
nr_double_t pnVoltage(nr_double_t Ud, nr_double_t Uold, nr_double_t Ut, nr_double_t Ucrit)