Warning, file /sdk/ktechlab/src/electronics/simulation/capacitance.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-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 CAPACITANCE_H
0012 #define CAPACITANCE_H
0013 
0014 #include "reactive.h"
0015 
0016 /**
0017 @author David Saxton
0018 @short Capacitance
0019 */
0020 class Capacitance : 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     Capacitance(const double capacitance, const double delta);
0029     ~Capacitance() override;
0030 
0031     Type type() const override
0032     {
0033         return Element_Capacitance;
0034     }
0035     /**
0036      * Set the stepping use for numerical integration of capacitance,
0037      * and the interval between successive updates
0038      */
0039     void setMethod(Method m);
0040     void time_step() override;
0041     void add_initial_dc() override;
0042     void setCapacitance(const double c);
0043 
0044 protected:
0045     void updateCurrents() override;
0046     bool updateStatus() override;
0047 
0048 private:
0049     double m_cap;    // Capacitance
0050     Method m_method; // Method of integration
0051 
0052     double m_scaled_cap; // capacitance scaled to time base of latest m_delta
0053     double i_eq_old;
0054 };
0055 
0056 #endif