summaryrefslogtreecommitdiffstats
path: root/src/electronics/simulation/resistance.h
blob: 7e5a62eeb572f727991c53f0c0a85d250e44729d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/***************************************************************************
 *   Copyright (C) 2003-2004 by David Saxton                               *
 *   [email protected]                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

#ifndef RESISTANCE_H
#define RESISTANCE_H

#include "element.h"

/**
@short Resistance
@author David saxton
*/
class Resistance : public Element
{
public:
	Resistance( const double resistance );
	virtual ~Resistance();
	
	virtual Type type() const { return Element_Resistance; }
	
	void setConductance( const double g );
	void setResistance( const double r );
	
	double resistance() { return 1/m_g; }
	double conductance() { return m_g; }
	virtual void add_map();
	
protected:
	virtual void updateCurrents();
	virtual void add_initial_dc();
	
private:
	double m_g; // Conductance
};

#endif