41 using namespace qucs::device;
 
   43 bjt::bjt () : circuit (4) {
 
   44   cbcx = rb = re = rc = NULL;
 
   80   nr_double_t phase = 
rad (Ptf) * Tf * 2 * 
M_PI * frequency;
 
  146   nr_double_t ib = 2 * Ibe * 
QoverkB / 
T0 +            
 
  154   matrix cy = matrix (4);
 
  175   nr_double_t T1, T2, IsT;
 
  185   nr_double_t VjeT, VjcT, VjsT;
 
  241               "BJT `%s'\n", Vtf, 
getName ());
 
  292   pol = !strcmp (type, 
"pnp") ? -1 : 1;
 
  338   if (Rbm <= 0.0) Rbm = Rb; 
 
  339   if (Rb < Rbm)   Rbm = Rb; 
 
  363 #define cexState 6 // extra excess phase state 
  386   nr_double_t Ut, Q1, Q2;
 
  387   nr_double_t Iben, Ibcn, Ibei, Ibci, Ibc, gbe, gbc, gtiny;
 
  388   nr_double_t IeqB, IeqC, IeqE, IeqS, UbeCrit, UbcCrit;
 
  392   Ikf = Ikf > 0 ? 1.0 / Ikf : 0;
 
  393   Ikr = Ikr > 0 ? 1.0 / Ikr : 0;
 
  394   Vaf = Vaf > 0 ? 1.0 / Vaf : 0;
 
  395   Var = Var > 0 ? 1.0 / Var : 0;
 
  411   gtiny = 
Ube < - 10 * Ut * Nf ? (Is + Ise) : 0;
 
  419   Ibe = Ibei + Iben + gtiny * 
Ube;
 
  433   gtiny = Ubc < - 10 * Ut * Nr ? (Is + Isc) : 0;
 
  441   Ibc = Ibci + Ibcn + gtiny * 
Ubc;
 
  455   Q1 = 1 / (1 - Ubc * Vaf - Ube * Var);
 
  456   Q2 = If * Ikf + Ir * Ikr;
 
  457   nr_double_t SArg = 1.0 + 4.0 * Q2;
 
  458   nr_double_t Sqrt = SArg > 0 ? 
qucs::sqrt (SArg) : 1;
 
  459   Qb = Q1 * (1 + Sqrt) / 2;
 
  488       a = (Ibci + Ibcn + Ibei + Iben) / Irb;
 
  489       a = 
MAX (a, NR_TINY); 
 
  492       Rbb = Rbm + 3 * (Rb - Rbm) * (b - z) / z / 
sqr (b);
 
  495       Rbb = Rbm + (Rb - Rbm) / 
Qb;
 
  502   IeqB = 
Ibe - Ube * gbe;
 
  503   IeqC = Ibc - Ubc * gbc;
 
  507   IeqE = 
It - Ube * gm - 
Uce * go;
 
  554   nr_double_t Vbe, Vbc;
 
  595   nr_double_t Cbe, Cbci, Cbcx, Ccs;
 
  598   Vtf = Vtf > 0 ? 1.0 / Vtf : 0;
 
  606     nr_double_t e, Tff, dTffdUbe, dTffdUbc, a;
 
  607     a = 1 / (1 + Itf / 
If);
 
  609     Tff = Tf * (1 + Xtf * 
sqr (a) * e);
 
  610     dTffdUbe = Tf * Xtf * 2 * 
gif * Itf * 
cubic (a) / 
sqr (
If) * e;
 
  613     dTffdUbc = Tf * Xtf * Vtf * 
sqr (a) * e;
 
  659   if (Rbm != 0.0 && Cjc0 != 0.0 && Xcjc != 1.0) {
 
  688 #define qbeState 0 // base-emitter charge state 
  689 #define cbeState 1 // base-emitter current state 
  690 #define qbcState 2 // base-collector charge state 
  691 #define cbcState 3 // base-collector current state 
  692 #define qcsState 4 // collector-substrate charge state 
  693 #define ccsState 5 // collector-substrate current state 
  695 #define qbxState 0 // external base-collector charge state 
  696 #define cbxState 1 // external base-collector current state 
  747   nr_double_t td = 
rad (Ptf) * Tf;
 
  750   if (td == 0.0) 
return;
 
  757   nr_double_t c3, 
c2, 
c1, dn, ra;
 
  763   ra = delta[0] / delta[1];
 
  764   c2 = (1 + ra + 
c2) / dn;
 
void setProperty(const char *, char *)
std::complex< nr_double_t > nr_complex_t
nr_double_t getOperatingPoint(const char *)
matrix ytos(matrix y, qucs::vector z0)
Admittance matrix to scattering parameters. 
matrix real(matrix a)
Real part matrix. 
#define T0
standard temperature 
void disableCapacitor(circuit *base, circuit *cap)
void fillState(int, state_type_t)
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)
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. 
int deviceEnabled(circuit *c)
qucs::matrix calcMatrixY(nr_double_t)
#define QoverkB
Elementary charge over Boltzmann constant ( ) 
#define K
Absolute 0 in centigrade. 
nr_double_t getScaledProperty(const char *)
void loadOperatingPoints(void)
static const nr_double_t z0
void initSP(void)
placehoder for S-Parameter initialisation function 
circuit * splitCapacitor(circuit *base, circuit *cap, const char *c, node *n1, node *n2)
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)
void excessPhase(int, nr_double_t &, nr_double_t &)
nr_complex_t sqr(const nr_complex_t z)
Square of complex number. 
virtual void initNoiseAC(void)
virtual void initAC(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)
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)
void calcOperatingPoints(void)
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 ( ) 
virtual void initSP(void)
placehoder for S-Parameter initialisation function 
#define kB
Boltzmann constant ( ) 
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)
#define M_PI
Archimedes' constant ( ) 
state_type_t getState(int, int n=0)
void setI(int, nr_complex_t)
virtual void initTR(void)
nr_double_t pnPotential_T(nr_double_t T1, nr_double_t T2, nr_double_t Vj, nr_double_t Eg0=Eg0Si)
#define rad(x)
Convert degree to radian. 
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)
void saveOperatingPoints(void)
#define MIN(x, y)
Minimum of x and y. 
void calcNoiseAC(nr_double_t)
matrix cytocs(matrix cy, matrix s)
Admittance noise correlation matrix to S-parameter noise correlation matrix. 
void allocMatrixMNA(void)
void transientCapacitanceC(int, int, int, int, nr_double_t, nr_double_t)
virtual void initNoiseSP(void)
nr_double_t getV(int, nr_double_t)
nr_complex_t tan(const nr_complex_t z)
Compute complex tangent. 
nr_complex_t exp(const nr_complex_t z)
Compute complex exponential. 
qucs::matrix calcMatrixCy(nr_double_t)
void calcNoiseSP(nr_double_t)
nr_complex_t polar(const nr_double_t mag, const nr_double_t ang)
Construct a complex number using polar notation. 
void setOperatingPoint(const char *, nr_double_t)
nr_double_t pnCriticalVoltage(nr_double_t Iss, nr_double_t Ute)
char * getPropertyString(const char *)
void setState(int, state_type_t, int n=0)
virtual void calcDC(void)
void logprint(int level, const char *format,...)
nr_complex_t log(const nr_complex_t z)
Compute principal value of natural logarithm of z. 
#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 * getDelta(void)
virtual void calcTR(nr_double_t)
#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)