-
Notifications
You must be signed in to change notification settings - Fork 0
/
circuit4.hpp
54 lines (43 loc) · 1.41 KB
/
circuit4.hpp
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
44
45
46
47
48
49
50
51
52
53
54
#ifndef circuit4_hpp
#define circuit4_hpp
#include <string>
#include <vector>
#include <iostream>
#include <cmath>
#include <cassert>
#include <fstream>
#include "eigen-3.3.7/Eigen/Dense"
using namespace std;
class component
{
public:
char type;
string nodep;
string nodem;
double value;
string input_function;
double amplitude;
double frequency;
double DC_offset;
string identifier;
string nodey;
string model;
};
class circuit
{
public:
vector<component> comps;
//returns a sorted vector of nodes in the circuit (with no duplicates)
vector<string> find_nodes();
//find components connected to a node
vector<component> find_components(string node);
//finds components in between two nodes
vector<component> find_components_between(string node1, string node2);
//do an operating point simulation for circuits without taking into account capacitors or inductors
void op_simulate();
void op_simulate(Eigen::MatrixXd &conductance_matrix, Eigen::MatrixXd ¤t_vector, Eigen::MatrixXd &voltage_vector, vector<double> ¤ts);
void op_simple(Eigen::MatrixXd &conductance_matrix, Eigen::MatrixXd ¤t_vector, Eigen::MatrixXd &voltage_vector, vector<double> ¤ts);
//do a transient simulation of the circuit, then outputs node voltages in a .csv format
void trans_simulate(double stoptime, double timestep);
};
#endif