File indexing completed on 2024-04-28 05:43:17

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 VOLTAGESIGNAL_H
0012 #define VOLTAGESIGNAL_H
0013 
0014 #include "elementsignal.h"
0015 #include "reactive.h"
0016 
0017 /**
0018 @short VoltageSignal
0019 @author David saxton
0020 */
0021 class VoltageSignal : public Reactive, public ElementSignal
0022 {
0023 public:
0024     VoltageSignal(const double delta, const double voltage);
0025     ~VoltageSignal() override;
0026 
0027     Element::Type type() const override
0028     {
0029         return Element_VoltageSignal;
0030     }
0031     void setVoltage(const double voltage);
0032     double voltage()
0033     {
0034         return m_voltage;
0035     }
0036     void time_step() override;
0037 
0038 protected:
0039     void updateCurrents() override;
0040     void add_initial_dc() override;
0041 
0042 private:
0043     double m_voltage; // Voltage
0044 };
0045 
0046 #endif