37 #define StateVars 1 // state variables
43 #define UdPrev deviceVar (_UdPrev)
46 using namespace qucs::device;
49 diode::diode () : circuit (2) {
72 if (Id < -Is) Id = -Is;
93 if (Id < -Is) Id = -Is;
101 nr_double_t
i = 2 * (Id + 2 * Is) *
QoverkB /
T0 +
135 "diode `%s'\n", Nr,
getName ());
139 "diode `%s'\n", N,
getName ());
157 "Diode `%s'\n", M,
getName ());
163 nr_double_t DT = T2 - T1;
171 Tt = Tt * (1 + Ttt1 * DT + Ttt2 * DT * DT);
177 M = M * (1 + Tm1 * DT + Tm2 * DT * DT);
183 Rs = Rs * (1 + Trs * DT);
223 nr_double_t Ibv, Is,
tol, Ut, Xbv, Xibv;
228 if (Ibv < Is *
Bv / Ut) {
232 "match the saturation current %g\n", Ibv, Is);
239 for (
int i = 0;
i < 25 ;
i++) {
240 Xbv =
Bv - Ut *
qucs::log (Ibv / Is + 1 - Xbv / Ut);
241 Xibv = Is * (
qucs::exp ((
Bv - Xbv) / Ut) - 1 + Xbv / Ut);
242 if (fabs (Xibv - Ibv) <
tol) {
250 "diode regions using Bv=%g and Ibv=%g\n",
Bv, Ibv);
279 nr_double_t Ut, Ieq, Ucrit, gtiny;
287 if (
Bv != 0 &&
Ud <
MIN (0, -
Bv + 10 * N * Ut)) {
288 nr_double_t
V = -(
Ud +
Bv);
298 gtiny = (
Ud < - 10 * Ut * N &&
Bv != 0) ? (Is + Isr) : 0;
300 if (
Ud >= -3 * N * Ut) {
304 else if (
Bv == 0 ||
Ud >= -
Bv) {
305 nr_double_t a = 3 * N * Ut / (
Ud *
M_E);
308 gd = +Is * 3 * a /
Ud;
313 gd = +Is * a / Ut /
N;
318 nr_double_t a = Ikf / (Ikf +
Id);
401 #define qState 0 // charge state
402 #define cState 1 // current state
void setProperty(const char *, char *)
#define M_E
Euler's constant ( )
std::complex< nr_double_t > nr_complex_t
qucs::matrix calcMatrixCy(nr_double_t)
nr_double_t getOperatingPoint(const char *)
matrix real(matrix a)
Real part matrix.
#define T0
standard temperature
void setQ(int, nr_complex_t)
nr_double_t pnConductance(nr_double_t Upn, nr_double_t Iss, nr_double_t Ute)
void calcNoiseAC(nr_double_t)
circuit * splitResistor(circuit *base, circuit *res, const char *c, const char *n, int internal)
nr_double_t getPropertyDouble(const char *)
nr_complex_t pow(const nr_complex_t z, const nr_double_t d)
Compute power function with real exponent.
#define QoverkB
Elementary charge over Boltzmann constant ( )
#define K
Absolute 0 in centigrade.
nr_double_t getScaledProperty(const char *)
static const nr_double_t z0
nr_double_t pnCapacitance(nr_double_t Uj, nr_double_t Cj, nr_double_t Vj, nr_double_t Mj, nr_double_t Fc)
void setScaledProperty(const char *, nr_double_t)
virtual void initDC(void)
nr_complex_t sqrt(const nr_complex_t z)
Compute principal value of square root.
void transientCapacitance(int, int, int, nr_double_t, nr_double_t, nr_double_t)
void calcNoiseSP(nr_double_t)
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 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 setCV(int, nr_complex_t)
void saveOperatingPoints(void)
#define kB
Boltzmann constant ( )
void disableResistor(circuit *base, circuit *res, int internal)
#define M_PI
Archimedes' constant ( )
void calcOperatingPoints(void)
void setI(int, nr_complex_t)
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)
void setY(int, int, nr_complex_t)
#define MIN(x, y)
Minimum of x and y.
matrix cytocs(matrix cy, matrix s)
Admittance noise correlation matrix to S-parameter noise correlation matrix.
void allocMatrixMNA(void)
nr_double_t norm(const nr_complex_t z)
Compute euclidian norm of complex number.
virtual void initHB(void)
nr_double_t getV(int, nr_double_t)
nr_complex_t exp(const nr_complex_t z)
Compute complex exponential.
void setQV(int, int, nr_complex_t)
void setS(int, int, nr_complex_t)
void setN(int, int, nr_complex_t)
void setOperatingPoint(const char *, nr_double_t)
void loadOperatingPoints(void)
nr_double_t pnCriticalVoltage(nr_double_t Iss, nr_double_t Ute)
void logprint(int level, const char *format,...)
nr_complex_t log(const nr_complex_t z)
Compute principal value of natural logarithm of z.
void setGV(int, nr_complex_t)
#define EgSi
Energy gap at 300K in eV of Silicon.
nr_double_t pnCurrent(nr_double_t Upn, nr_double_t Iss, nr_double_t Ute)
#define PROP_NO_SUBSTRATE
nr_double_t pnVoltage(nr_double_t Ud, nr_double_t Uold, nr_double_t Ut, nr_double_t Ucrit)