~ubuntu-branches/ubuntu/maverick/ktechlab/maverick

« back to all changes in this revision

Viewing changes to src/electronics/simulation/mosfet.h

  • Committer: Bazaar Package Importer
  • Author(s): Georges Khaznadar
  • Date: 2009-02-09 00:28:49 UTC
  • mfrom: (5.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090209002849-9o8eqqiczqo4vat3
Tags: 0.3.6-4
modified debian/rules so it does not invoke make if there is no 
Makefile
Closes: #514552

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2005 by David Saxton                                    *
 
3
 *   david@bluehaze.org                                                    *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU General Public License as published by  *
 
7
 *   the Free Software Foundation; either version 2 of the License, or     *
 
8
 *   (at your option) any later version.                                   *
 
9
 ***************************************************************************/
 
10
 
 
11
#ifndef MOSFET_H
 
12
#define MOSFET_H
 
13
 
 
14
#include "matrix.h"
 
15
#include "nonlinear.h"
 
16
 
 
17
class MOSFETState
 
18
{
 
19
        public:
 
20
                MOSFETState();
 
21
                void reset();
 
22
                
 
23
                MOSFETState operator-( const MOSFETState & s ) const;
 
24
        
 
25
                double A[4][4];
 
26
                double I[4];
 
27
};
 
28
 
 
29
 
 
30
class MOSFETSettings
 
31
{
 
32
        public:
 
33
                MOSFETSettings();
 
34
                
 
35
                double I_S;             ///< bulk junction saturation current
 
36
                double N;               ///< bulk junction emission coefficient
 
37
                double K_P;             ///< transconductance coeffecient
 
38
                double W;               ///< channel width
 
39
                double L;               ///< channel length
 
40
                
 
41
                double beta() const { return K_P * W / L; }
 
42
                
 
43
#if 0
 
44
                double phi;             ///< surface potential
 
45
                double T_OX;    ///< oxide thickness
 
46
                double P_b;             ///< bulk junction potential
 
47
                double M_J;             ///< bulk junction bottom grading coefficient
 
48
                double F_C;             ///< bulk junction forward-bbias depletion capacitance coefficient
 
49
                double M_JSW;   ///< bulk junction periphery grading coefficient
 
50
                double U_0;             ///< surface mobility
 
51
                int N_RD;               ///< number of equivalent drain squares
 
52
                int N_RS;               ///< number of equivalent source squares
 
53
#endif
 
54
};
 
55
 
 
56
 
 
57
/**
 
58
@author David Saxton
 
59
 */
 
60
class MOSFET : public NonLinear
 
61
{
 
62
        public:
 
63
                enum MOSFET_type { neMOSFET, peMOSFET/*, ndMOSFET, pdMOSFET*/ };
 
64
                
 
65
                MOSFET( MOSFET_type type );
 
66
                virtual ~MOSFET();
 
67
        
 
68
                virtual Type type() const { return Element_MOSFET; }
 
69
                virtual void update_dc();
 
70
                virtual void add_initial_dc();
 
71
                MOSFETSettings settings() const { return m_mosfetSettings; }
 
72
                void setMOSFETSettings( const MOSFETSettings & settings );
 
73
        
 
74
        protected:
 
75
                void calcIg( double V_BS, double V_BD, double V_DS, double V_GS, double V_GD,
 
76
                                                         double * I_BS, double * I_BD, double * I_DS,
 
77
                                                         double * g_BS, double * g_BD, double * g_DS,
 
78
                                                         double * g_M ) const;
 
79
                
 
80
                void updateLim();
 
81
                virtual void updateCurrents();
 
82
                /**
 
83
                 * Calculates the new MOSFETState from the voltages on the nodes.
 
84
                 */
 
85
                void calc_eq();
 
86
                
 
87
                MOSFETState m_os;
 
88
                MOSFETState m_ns;
 
89
                int m_pol;
 
90
                double V_lim;
 
91
                double V_GS_prev, V_GD_prev, V_BD_prev, V_DS_prev, V_BS_prev;
 
92
                MOSFETSettings m_mosfetSettings;
 
93
                
 
94
                static const uint PinD, PinG, PinS, PinB;
 
95
};
 
96
 
 
97
#endif