00001 /*************************************************************************** 00002 * Copyright (C) 2003-2005 by David Saxton * 00003 * david@bluehaze.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 ***************************************************************************/ 00010 00011 #ifndef BJT_H 00012 #define BJT_H 00013 00014 #include "nonlinear.h" 00015 00016 class BJTState 00017 { 00018 public: 00019 BJTState(); 00020 void reset(); 00021 00022 BJTState operator-( const BJTState & s ) const; 00023 00024 double A[3][3]; 00025 double I[3]; 00026 }; 00027 00028 // why isn't this a part of the BJT class? 00029 class BJTSettings 00030 { 00031 public: 00032 BJTSettings(); 00033 00034 double I_S; 00035 double N_F; 00036 double N_R; 00037 double B_F; 00038 double B_R; 00039 }; 00040 00046 class BJT : public NonLinear 00047 { 00048 public: 00049 BJT( bool isNPN ); 00050 virtual ~BJT(); 00051 00052 virtual Type type() const { return Element_BJT; } 00053 virtual void update_dc(); 00054 virtual void add_initial_dc(); 00055 virtual void add_map(); 00056 BJTSettings settings() const { return m_bjtSettings; } 00057 void setBJTSettings( const BJTSettings & settings ); 00058 00059 protected: 00060 virtual void updateCurrents(); 00064 void calc_eq(); 00065 00066 void calcIg(double V_BE, double V_BC, double *I_BE, double *I_BC, double *I_T, double *g_BE, double *g_BC, double *g_IF, double *g_IR); 00067 00068 BJTState m_os; 00069 BJTState m_ns; 00070 int m_pol; 00071 double V_BE_prev, V_BC_prev; 00072 BJTSettings m_bjtSettings; 00073 }; 00074 00075 #endif
1.5.1