JUK1
SimulationEnvironment< VT > Class Template Reference

The main class to hold all of the relevant simulation data. More...

#include <Simulator.hpp>

Collaboration diagram for SimulationEnvironment< VT >:

Public Member Functions

 SimulationEnvironment (std::string netlistPath)
 Setup the simulation environment from a netlist. More...
 
void setDCOpPoint ()
 a function to determine and set the DC operating point More...
 
void simulate ()
 Where a lot of the magic starts. This is what runs the simulation. More...
 
void printGraph (size_t node)
 Outputs a single node's (or current's) time series to a graph, saving as both eps and png. More...
 
void printMultipleOnGraph (std::vector< size_t > nodeVec, std::string suffix="")
 Similar to printGraph, but instead can plot multiple series on the same graph. More...
 
void dataDump ()
 Simple function to dump the output of the simulator in a matlab table readable format. More...
 

Private Member Functions

void parseGraph (std::string line)
 Helper function to pull indices from graph netlist directive. More...
 

Private Attributes

std::string outputFilePath = "datadump.txt"
 
std::string netlistPath = ""
 
double initialTime
 
double timestep
 
double finalTime
 
size_t steps
 
size_t numNodes = 1
 
size_t numCurrents = 0
 
size_t numDCCurrents = 0
 
bool performDCAnalysis = true
 
CircuitElements< VT > elements
 A collection of all the circuit elements. More...
 
LUPair< VT > luPair
 Preallocated space to prevent repeated allocations and deallocations. More...
 
Matrix< VT > scratchSpace
 Preallocated space to prevent repeated allocations and deallocations. using during the leftDivide to solve the MNA system. More...
 
std::vector< std::vector< size_t > > nodesToGraph
 Keeps track of the nodes to be graphed after simulation. More...
 
Matrix< VT > solutionMat
 Preallocated space to store the results in. More...
 

Detailed Description

template<typename VT>
class SimulationEnvironment< VT >

The main class to hold all of the relevant simulation data.

Template Parameters
VTThe type used for values. e.g. double, float, etc

Definition at line 46 of file Simulator.hpp.

Constructor & Destructor Documentation

◆ SimulationEnvironment()

template<typename VT >
SimulationEnvironment< VT >::SimulationEnvironment ( std::string  netlistPath)
inline

Setup the simulation environment from a netlist.

Parameters
netlistPathPath to the netlist that is going to be used in the simulation

Definition at line 52 of file Simulator.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ dataDump()

template<typename VT >
void SimulationEnvironment< VT >::dataDump ( )
inline

Simple function to dump the output of the simulator in a matlab table readable format.

Definition at line 392 of file Simulator.hpp.

Here is the caller graph for this function:

◆ parseGraph()

template<typename VT >
void SimulationEnvironment< VT >::parseGraph ( std::string  line)
inlineprivate

Helper function to pull indices from graph netlist directive.

Parameters
lineThe line to parse

Definition at line 466 of file Simulator.hpp.

Here is the caller graph for this function:

◆ printGraph()

template<typename VT >
void SimulationEnvironment< VT >::printGraph ( size_t  node)
inline

Outputs a single node's (or current's) time series to a graph, saving as both eps and png.

Parameters
nodeThe index of the node to plot

Definition at line 333 of file Simulator.hpp.

Here is the call graph for this function:

◆ printMultipleOnGraph()

template<typename VT >
void SimulationEnvironment< VT >::printMultipleOnGraph ( std::vector< size_t >  nodeVec,
std::string  suffix = "" 
)
inline

Similar to printGraph, but instead can plot multiple series on the same graph.

Parameters
nodeVecA vector of node indices
suffixWhat's appended to "Graph" to make the name of the output file.

Definition at line 362 of file Simulator.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDCOpPoint()

template<typename VT >
void SimulationEnvironment< VT >::setDCOpPoint ( )
inline

a function to determine and set the DC operating point

Definition at line 230 of file Simulator.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ simulate()

template<typename VT >
void SimulationEnvironment< VT >::simulate ( )
inline

Where a lot of the magic starts. This is what runs the simulation.

This function is a simple newton-raphson solver, it still has room for improvement, such as early termination when the loop converges.

After the simulation has run to completion, the raw data is dumped, and any graphs that were due to be generated are created.

Definition at line 265 of file Simulator.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ elements

template<typename VT >
CircuitElements<VT> SimulationEnvironment< VT >::elements
private

A collection of all the circuit elements.

Definition at line 493 of file Simulator.hpp.

◆ finalTime

template<typename VT >
double SimulationEnvironment< VT >::finalTime
private

Definition at line 485 of file Simulator.hpp.

◆ initialTime

template<typename VT >
double SimulationEnvironment< VT >::initialTime
private

Definition at line 483 of file Simulator.hpp.

◆ luPair

template<typename VT >
LUPair<VT> SimulationEnvironment< VT >::luPair
private

Preallocated space to prevent repeated allocations and deallocations.

Definition at line 496 of file Simulator.hpp.

◆ netlistPath

template<typename VT >
std::string SimulationEnvironment< VT >::netlistPath = ""
private

Definition at line 481 of file Simulator.hpp.

◆ nodesToGraph

template<typename VT >
std::vector<std::vector<size_t> > SimulationEnvironment< VT >::nodesToGraph
private

Keeps track of the nodes to be graphed after simulation.

Definition at line 502 of file Simulator.hpp.

◆ numCurrents

template<typename VT >
size_t SimulationEnvironment< VT >::numCurrents = 0
private

Definition at line 489 of file Simulator.hpp.

◆ numDCCurrents

template<typename VT >
size_t SimulationEnvironment< VT >::numDCCurrents = 0
private

Definition at line 490 of file Simulator.hpp.

◆ numNodes

template<typename VT >
size_t SimulationEnvironment< VT >::numNodes = 1
private

Definition at line 488 of file Simulator.hpp.

◆ outputFilePath

template<typename VT >
std::string SimulationEnvironment< VT >::outputFilePath = "datadump.txt"
private

Definition at line 480 of file Simulator.hpp.

◆ performDCAnalysis

template<typename VT >
bool SimulationEnvironment< VT >::performDCAnalysis = true
private

Definition at line 491 of file Simulator.hpp.

◆ scratchSpace

template<typename VT >
Matrix<VT> SimulationEnvironment< VT >::scratchSpace
private

Preallocated space to prevent repeated allocations and deallocations. using during the leftDivide to solve the MNA system.

Definition at line 499 of file Simulator.hpp.

◆ solutionMat

template<typename VT >
Matrix<VT> SimulationEnvironment< VT >::solutionMat
private

Preallocated space to store the results in.

Definition at line 505 of file Simulator.hpp.

◆ steps

template<typename VT >
size_t SimulationEnvironment< VT >::steps
private

Definition at line 486 of file Simulator.hpp.

◆ timestep

template<typename VT >
double SimulationEnvironment< VT >::timestep
private

Definition at line 484 of file Simulator.hpp.


The documentation for this class was generated from the following file: