1 #ifndef _COMPONENT_HPP_INC_
2 #define _COMPONENT_HPP_INC_
36 Stamp(
size_t _sizeG_A,
size_t _sizeG_D)
38 G(_sizeG_A + _sizeG_D, _sizeG_A + _sizeG_D, 0),
39 s(_sizeG_A + _sizeG_D, 1, 0) {
61 rhs->addStaticStampTo(*
this);
69 const size_t currentSolutionIndex, T timestep) {
70 rhs->addDynamicStampTo(*
this, solutionMatrix, currentSolutionIndex,
79 const size_t currentSolutionIndex, T timestep = 0) {
80 rhs->addNonLinearStampTo(*
this, solutionMatrix, currentSolutionIndex,
89 const Matrix<T> & solutionMatrix,
const size_t numCurrents) {
90 rhs->addDCAnalysisStampTo(*
this, solutionMatrix, numCurrents);
97 return G.leftDivide(
s);
126 const size_t currentSolutionIndex, T timestep)
const {
137 const size_t currentSolutionIndex, T timestep = 0)
const {
138 throw std::exception(
"not implemented");
149 const size_t currentSolutionIndex, T timestep,
150 size_t numCurrents) {
160 size_t numCurrents)
const {
161 throw std::exception(
"not implemented");
171 size_t sizeG_A,
size_t numCurrents) {
190 size_t & numNodes,
size_t & numCurrents,
size_t & numDCCurrents) {
191 throw std::exception(
"not implemented");
common weighting for all matrix elements
a glorified container for the different types of components.
A template base class to define the fundamental things a component should define.
static void addToElements(const std::string &line, CircuitElements< T > &elements, size_t &numNodes, size_t &numCurrents, size_t &numDCCurrents)
Called as a helper to add the component to the elements class.
virtual void addNonLinearStampTo(Stamp< T > &destination, const Matrix< T > &solutionMatrix, const size_t currentSolutionIndex, T timestep=0) const
adds this component's non-linear stamp to the target stamp.
virtual void setTimestep(T timestep)
initialises the component
virtual void addStaticStampTo(Stamp< T > &destination) const
Adds this component's static stamp to the target stamp.
virtual void addDCAnalysisStampTo(Stamp< T > &destination, const Matrix< T > &solutionVector, size_t numCurrents) const
adds this component's DC stamp to the target stamp.
virtual void updateDCStoredState(const Matrix< T > &solutionVector, size_t sizeG_A, size_t numCurrents)
a function to update the stored state of a component based on a DC value
virtual void addDynamicStampTo(Stamp< T > &destination, const Matrix< T > &solutionMatrix, const size_t currentSolutionIndex, T timestep) const
Adds this component's dynamic stamp to the target stamp.
virtual void updateStoredState(const Matrix< T > &solutionMatrix, const size_t currentSolutionIndex, T timestep, size_t numCurrents)
Updates any stored state based on the current solution index.
std::string designator
The designator as in the netlist for e.g.
A matrix class with support for LU-decomposition, and left division.
A helper struct to store the preallocated stamps for MNA.
void addDCAnalysisStamp(const std::shared_ptr< Component< T > > &rhs, const Matrix< T > &solutionMatrix, const size_t numCurrents)
A helper function to add a DC component to the stamp.
void addDynamicStamp(const std::shared_ptr< Component< T > > &rhs, const Matrix< T > &solutionMatrix, const size_t currentSolutionIndex, T timestep)
A helper function to add a dynamic component to the stamp.
void clear()
Clears the stamps to 0s.
Matrix< T > solve()
An alias for left dividing G by s.
Stamp(size_t _sizeG_A, size_t _sizeG_D)
Sets the initial size of the stamp pair.
void addNonLinearStamp(const std::shared_ptr< Component< T > > &rhs, const Matrix< T > &solutionMatrix, const size_t currentSolutionIndex, T timestep=0)
A helper function to add a non-linear component to the stamp.
void add(const Stamp< T > &rhs)
Combines two stamps together into the current stamp. This is not done via the operator,...
void addStaticStamp(const std::shared_ptr< Component< T > > &rhs)
A helper function to add a static component to the stamp.