Warning, file /sdk/ktechlab/src/electronics/simulation/nonlinear.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) 2003-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 NONLINEAR_H 0012 #define NONLINEAR_H 0013 0014 #include "element.h" 0015 0016 /** 0017 @short Represents a non-linear circuit element (such as a diode) 0018 @author David Saxton 0019 */ 0020 class NonLinear : public Element 0021 { 0022 public: 0023 NonLinear(); 0024 0025 bool isNonLinear() const override 0026 { 0027 return true; 0028 } 0029 /** 0030 * Newton-Raphson iteration: Update equation system. 0031 */ 0032 virtual void update_dc() = 0; 0033 0034 protected: 0035 /** 0036 * The diode current. 0037 */ 0038 double diodeCurrent(double v, double I_S, double N) const; 0039 /** 0040 * Conductance of the diode - the derivative of Schockley's 0041 * approximation. 0042 */ 0043 double diodeConductance(double v, double I_S, double N) const; 0044 /** 0045 * Limits the diode voltage to prevent divergence in the nonlinear 0046 * iterations. 0047 */ 0048 double diodeVoltage(double v, double V_prev, double N, double V_lim) const; 0049 /** 0050 * Current and conductance for a diode junction. 0051 */ 0052 void diodeJunction(double v, double I_S, double N, double *I, double *g) const; 0053 /** 0054 * Current and conductance for a MOS diode junction. 0055 */ 0056 void mosDiodeJunction(double V, double I_S, double N, double *I, double *g) const; 0057 /** 0058 * Limits the drain-source voltage to prevent divergence in the 0059 * nonlinear iterations. 0060 */ 0061 double fetVoltageDS(double V, double V_prev) const; 0062 /** 0063 * Limits the forward voltage to prevent divergence in the nonlinear 0064 * iterations. 0065 */ 0066 double fetVoltage(double V, double V_prev, double Vth) const; 0067 0068 double diodeLimitedVoltage(double I_S, double N) const; 0069 }; 0070 0071 #endif