File indexing completed on 2024-04-28 05:43:15
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 INDUCTANCE_H 0012 #define INDUCTANCE_H 0013 0014 #include "reactive.h" 0015 0016 /** 0017 0018 @author David Saxton 0019 */ 0020 class Inductance : public Reactive 0021 { 0022 public: 0023 enum Method { 0024 m_none, // None 0025 m_euler, // Backward Euler 0026 m_trap // Trapezoidal (currently unimplemented) 0027 }; 0028 Inductance(double capacitance, double delta); 0029 ~Inductance() override; 0030 0031 Type type() const override 0032 { 0033 return Element_Inductance; 0034 } 0035 0036 /** 0037 * Set the stepping use for numerical integration of inductance, and the 0038 * interval between successive updates. 0039 */ 0040 void setMethod(Method m); 0041 void time_step() override; 0042 void add_initial_dc() override; 0043 void setInductance(double i); 0044 0045 protected: 0046 void updateCurrents() override; 0047 bool updateStatus() override; 0048 0049 private: 0050 double m_inductance; // Inductance 0051 Method m_method; // Method of integration 0052 0053 double scaled_inductance; 0054 double v_eq_old; 0055 }; 0056 0057 #endif