File indexing completed on 2024-04-28 05:43:16
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 REACTIVE_H 0012 #define REACTIVE_H 0013 0014 #include "element.h" 0015 0016 /** 0017 @short Represents a reactive element (such as a capacitor) 0018 @author David Saxton 0019 */ 0020 class Reactive : public Element 0021 { 0022 public: 0023 Reactive(const double delta); 0024 ~Reactive() override; 0025 0026 bool isReactive() const override 0027 { 0028 return true; 0029 } 0030 /** 0031 * Call this function to set the time period (in seconds) 0032 */ 0033 void setDelta(double delta); 0034 /** 0035 * Called on every time step for the element to update itself 0036 */ 0037 virtual void time_step() = 0; 0038 0039 protected: 0040 bool updateStatus() override; 0041 0042 double m_delta; // Delta time interval 0043 }; 0044 0045 #endif