Qucs-core  0.0.19
device.h
Go to the documentation of this file.
00001 /*
00002  * device.h - device class definitions
00003  *
00004  * Copyright (C) 2004, 2005, 2006 Stefan Jahn <stefan@lkcc.org>
00005  *
00006  * This is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2, or (at your option)
00009  * any later version.
00010  *
00011  * This software is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this package; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020  *
00021  * $Id$
00022  *
00023  */
00024 
00025 #ifndef __DEVICE_H__
00026 #define __DEVICE_H__
00027 
00028 namespace qucs {
00029 
00030 class circuit;
00031 class node;
00032 class net;
00033 
00034 namespace device {
00035 
00036   // creates external resistor circuit
00037   circuit *
00038     splitResistor (
00039       circuit * base, // calling circuit (this)
00040       circuit * res,  // additional resistor circuit (can be NULL)
00041       const char * c, // name of the additional circuit
00042       const char * n, // name of the inserted (internal) node
00043       int internal);  // number of new node (the original external node)
00044 
00045   // removes external resistor circuit
00046   void
00047     disableResistor (
00048       circuit * base, // calling circuit (this)
00049       circuit * res,  // additional resistor circuit
00050       int internal);  // number of new node (the original external node)
00051 
00052   // creates external capacitor circuit
00053   circuit *
00054     splitCapacitor (
00055       circuit * base, // calling circuit (this)
00056       circuit * cap,  // additional capacitor circuit (can be NULL)
00057       const char * c, // name of the additional circuit
00058       node * n1,      // first node of new capacitor
00059       node * n2);     // second node of new capacitor
00060 
00061   // removes external capacitor circuit
00062   void
00063     disableCapacitor (
00064       circuit * base, // calling circuit (this)
00065       circuit * cap); // additional capacitor circuit
00066 
00067   // checks whether circuit is enabled
00068   int
00069     deviceEnabled (
00070       circuit * c); // circuit to be checked
00071 
00072   // computes current and its derivative for a MOS pn-junction
00073   void
00074     pnJunctionMOS (
00075       nr_double_t Upn, // pn-voltage
00076       nr_double_t Iss, // saturation current
00077       nr_double_t Ute, // temperature voltage
00078       nr_double_t& I,  // result current
00079       nr_double_t& g); // result derivative
00080 
00081   // computes current and its derivative for a bipolar pn-junction
00082   void
00083     pnJunctionBIP (
00084       nr_double_t Upn, // pn-voltage
00085       nr_double_t Iss, // saturation current
00086       nr_double_t Ute, // temperature voltage
00087       nr_double_t& I,  // result current
00088       nr_double_t& g); // result derivative
00089 
00090   // limits the forward pn-voltage
00091   nr_double_t
00092      pnVoltage (
00093        nr_double_t Ud,     // current pn-voltage
00094        nr_double_t Uold,   // previous pn-voltage
00095        nr_double_t Ut,     // temperature voltage
00096        nr_double_t Ucrit); // critical voltage
00097 
00098   // computes the exponential pn-junction current
00099   nr_double_t
00100     pnCurrent (
00101       nr_double_t Upn,  // pn-voltage
00102       nr_double_t Iss,  // saturation current
00103       nr_double_t Ute); // temperature voltage
00104 
00105   // computes the exponential pn-junction current's derivative
00106   nr_double_t
00107     pnConductance (
00108       nr_double_t Upn,  // pn-voltage
00109       nr_double_t Iss,  // saturation current
00110       nr_double_t Ute); // temperature voltage
00111 
00112   // computes pn-junction depletion capacitance
00113   nr_double_t
00114     pnCapacitance (
00115       nr_double_t Uj,  // pn-voltage
00116       nr_double_t Cj,  // zero-bias capacitance
00117       nr_double_t Vj,  // built-in potential
00118       nr_double_t Mj,  // grading coefficient
00119       nr_double_t Fc); // forward-bias coefficient
00120 
00121   // computes pn-junction depletion charge
00122   nr_double_t
00123     pnCharge (
00124       nr_double_t Uj,  // pn-voltage
00125       nr_double_t Cj,  // zero-bias capacitance
00126       nr_double_t Vj,  // built-in potential
00127       nr_double_t Mj,  // grading coefficient
00128       nr_double_t Fc); // forward-bias coefficient
00129 
00130   // computes pn-junction depletion capacitance
00131   nr_double_t
00132     pnCapacitance (
00133       nr_double_t Uj,  // pn-voltage
00134       nr_double_t Cj,  // zero-bias capacitance
00135       nr_double_t Vj,  // built-in potential
00136       nr_double_t Mj); // grading coefficient
00137 
00138   // computes pn-junction depletion charge
00139   nr_double_t
00140     pnCharge (
00141       nr_double_t Uj,  // pn-voltage
00142       nr_double_t Cj,  // zero-bias capacitance
00143       nr_double_t Vj,  // built-in potential
00144       nr_double_t Mj); // grading coefficient
00145 
00146   // compute critical voltage of pn-junction
00147   nr_double_t
00148     pnCriticalVoltage (
00149       nr_double_t Iss,  // saturation current
00150       nr_double_t Ute); // temperature voltage
00151 
00152   // limits the forward fet-voltage
00153   nr_double_t
00154     fetVoltage (
00155       nr_double_t Ufet, // current fet voltage
00156       nr_double_t Uold, // previous fet voltage
00157       nr_double_t Uth); // threshold voltage
00158 
00159   // limits the drain-source voltage
00160   nr_double_t
00161     fetVoltageDS (
00162       nr_double_t Ufet,  // current fet voltage
00163       nr_double_t Uold); // previous fet voltage
00164 
00165   // calculates the overlap capacitance for mosfet (meyer model)
00166   void
00167     fetCapacitanceMeyer (
00168       nr_double_t Ugs,   // gate-source voltage
00169       nr_double_t Ugd,   // gate-drain voltage
00170       nr_double_t Uth,   // threshold voltage
00171       nr_double_t Udsat, // drain-source saturation voltage
00172       nr_double_t Phi,   // built-in potential
00173       nr_double_t Cox,   // oxide capacitance
00174       nr_double_t& Cgs,  // resulting gate-source capacitance
00175       nr_double_t& Cgd,  // resulting gate-drain capacitance
00176       nr_double_t& Cgb); // resulting gate-bulk capacitance
00177 
00178   // computes temperature dependency of energy bandgap
00179   nr_double_t
00180     Egap (
00181       nr_double_t T,            // temperature
00182       nr_double_t Eg0 = Eg0Si); // bandgap at 0K
00183 
00184   // computes temperature dependency of intrinsic density
00185   nr_double_t
00186     intrinsicDensity (
00187       nr_double_t T,            // temperature
00188       nr_double_t Eg0 = Eg0Si); // bandgap at 0K
00189 
00190   // calculates temperature dependence for saturation current
00191   nr_double_t
00192     pnCurrent_T (
00193       nr_double_t T1,       // reference temperature
00194       nr_double_t T2,       // temperature
00195       nr_double_t Is,       // saturation current
00196       nr_double_t Eg,       // bandgap at 300K
00197       nr_double_t N = 1,    // emission coefficient
00198       nr_double_t Xti = 0); // temperature coefficient
00199 
00200   // calculates temperature dependence for junction potential
00201   nr_double_t
00202     pnPotential_T (
00203       nr_double_t T1,           // reference temperature
00204       nr_double_t T2,           // temperature
00205       nr_double_t Vj,           // built-in potential
00206       nr_double_t Eg0 = Eg0Si); // bandgap at 0K
00207 
00208   // calculates temperature dependence for junction capacitance
00209   nr_double_t
00210     pnCapacitance_T (
00211       nr_double_t T1,  // reference temperature
00212       nr_double_t T2,  // temperature
00213       nr_double_t M,   // grading coefficient
00214       nr_double_t VR,  // built-in potential ratio
00215       nr_double_t Cj); // zero-bias capacitance
00216 
00217   // calculates temperature dependence for junction capacitance
00218   nr_double_t
00219     pnCapacitance_F (
00220       nr_double_t T1,  // reference temperature
00221       nr_double_t T2,  // temperature
00222       nr_double_t M,   // grading coefficient
00223       nr_double_t VR); // built-in potential ratio: Vj(T2) / Vj(T1)
00224 
00225 } // namespace device
00226 
00227 } // namespace qucs
00228 
00229 #endif /* __DEVICE_H__ */