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 VOLTAGESOURCE_H
0012 #define VOLTAGESOURCE_H
0013 
0014 #include "element.h"
0015 
0016 /**
0017 CNode n0 is the negative terminal, CNode n1 is the positive terminal
0018 @short Voltage Source
0019 */
0020 class VoltageSource : public Element
0021 {
0022 public:
0023     VoltageSource(const double voltage);
0024     ~VoltageSource() override;
0025 
0026     Type type() const override
0027     {
0028         return Element_VoltageSource;
0029     }
0030     void setVoltage(const double v);
0031 
0032 protected:
0033     void updateCurrents() override;
0034     void add_initial_dc() override;
0035 
0036 private:
0037     double m_v; // Voltage
0038 };
0039 
0040 #endif