File indexing completed on 2024-05-05 05:46:12
0001 /*************************************************************************** 0002 * Copyright (C) 2003-2004 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 RESISTANCE_H 0012 #define RESISTANCE_H 0013 0014 #include "element.h" 0015 0016 /** 0017 @short Resistance 0018 @author David saxton 0019 */ 0020 class Resistance : public Element 0021 { 0022 public: 0023 Resistance(const double resistance); 0024 ~Resistance() override; 0025 0026 Type type() const override 0027 { 0028 return Element_Resistance; 0029 } 0030 0031 void setConductance(const double g); 0032 void setResistance(const double r); 0033 0034 double resistance() 0035 { 0036 return 1 / m_g; 0037 } 0038 double conductance() 0039 { 0040 return m_g; 0041 } 0042 0043 protected: 0044 void updateCurrents() override; 0045 void add_initial_dc() override; 0046 0047 private: 0048 double m_g; // Conductance 0049 }; 0050 0051 #endif