Warning, file /sdk/ktechlab/src/electronics/simulation/mosfet.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /***************************************************************************
0002  *   Copyright (C) 2005 by David Saxton                                    *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #ifndef MOSFET_H
0012 #define MOSFET_H
0013 
0014 #include "nonlinear.h"
0015 
0016 class MOSFETState
0017 {
0018 public:
0019     MOSFETState();
0020     void reset();
0021 
0022     MOSFETState operator-(const MOSFETState &s) const;
0023 
0024     double A[4][4];
0025     double I[4];
0026 };
0027 
0028 class MOSFETSettings
0029 {
0030 public:
0031     MOSFETSettings();
0032 
0033     double I_S; ///< bulk junction saturation current
0034     double N;   ///< bulk junction emission coefficient
0035     double K_P; ///< transconductance coeffecient
0036     double W;   ///< channel width
0037     double L;   ///< channel length
0038 
0039     double beta() const
0040     {
0041         return K_P * W / L;
0042     }
0043 
0044 #if 0
0045         double phi;     ///< surface potential
0046         double T_OX;    ///< oxide thickness
0047         double P_b;     ///< bulk junction potential
0048         double M_J;     ///< bulk junction bottom grading coefficient
0049         double F_C;     ///< bulk junction forward-bbias depletion capacitance coefficient
0050         double M_JSW;   ///< bulk junction periphery grading coefficient
0051         double U_0;     ///< surface mobility
0052         int N_RD;       ///< number of equivalent drain squares
0053         int N_RS;       ///< number of equivalent source squares
0054 #endif
0055 };
0056 
0057 /**
0058 @author David Saxton
0059  */
0060 class MOSFET : public NonLinear
0061 {
0062 public:
0063     enum MOSFET_type { neMOSFET, peMOSFET /*, ndMOSFET, pdMOSFET*/ };
0064 
0065     MOSFET(MOSFET_type type);
0066     ~MOSFET() override;
0067 
0068     Type type() const override
0069     {
0070         return Element_MOSFET;
0071     }
0072     void update_dc() override;
0073     void add_initial_dc() override;
0074     MOSFETSettings settings() const
0075     {
0076         return m_mosfetSettings;
0077     }
0078     void setMOSFETSettings(const MOSFETSettings &settings);
0079 
0080 protected:
0081     void calcIg(double V_BS, double V_BD, double V_DS, double V_GS, double V_GD, double *I_BS, double *I_BD, double *I_DS, double *g_BS, double *g_BD, double *g_DS, double *g_M) const;
0082 
0083     void updateLim();
0084     void updateCurrents() override;
0085     /**
0086      * Calculates the new MOSFETState from the voltages on the nodes.
0087      */
0088     void calc_eq();
0089 
0090     MOSFETState m_os;
0091     MOSFETState m_ns;
0092     int m_pol;
0093     double V_lim;
0094     double V_GS_prev, V_GD_prev, V_BD_prev, V_DS_prev, V_BS_prev;
0095     MOSFETSettings m_mosfetSettings;
0096 
0097     static const uint PinD, PinG, PinS, PinB;
0098 };
0099 
0100 #endif