-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsource.hpp
More file actions
42 lines (32 loc) · 1.01 KB
/
source.hpp
File metadata and controls
42 lines (32 loc) · 1.01 KB
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
#ifndef source_hpp
#define source_hpp
#include "base_class.hpp"
//Class for IV sources
class source: public base_class
{
protected:
string output_type;
double frequency, amplitude;
public:
//Constructor
source(char c_type, string c_output_type, node *c_node1, node *c_node2, string c_name, double c_frequency, double c_value, double c_amplitude){
type = c_type;
output_type = c_output_type;
node1 = c_node1;
node2 = c_node2;
name = c_name;
frequency = c_frequency;
value = c_value;
amplitude = c_amplitude;
}
//Returns the output value of the source depending on the type of the source
double return_value(double t, bool final_loop_checker){
if (output_type == "sine"){
return ( amplitude*sin(2*M_PI*frequency*t) ) + value;
}
if (output_type == "dc"){
return value;
}
}
};
#endif