1 #ifndef _CIRCUITELEMENTS_HPP_INC_
2 #define _CIRCUITELEMENTS_HPP_INC_
19 #include "MatlabEngine.hpp"
20 #include "MatlabDataArray.hpp"
63 std::shared_ptr<matlab::engine::MATLABEngine> matlabEngine;
89 size_t numDCCurrents = 0)
92 dcStamp(numNodes, numCurrents + numDCCurrents) {
142 const size_t currentSolutionIndex, T timestep) {
150 currentSolutionIndex, timestep);
155 currentSolutionIndex, timestep);
172 const size_t currentSolutionIndex, T timestep) {
180 currentSolutionIndex, timestep);
197 const size_t currentSolutionIndex, T timestep) {
238 dcStamp.addDCAnalysisStamp(component, solutionVector, numCurrents);
242 dcStamp.addDCAnalysisStamp(component, solutionVector, numCurrents);
246 dcStamp.addDCAnalysisStamp(component, solutionVector, numCurrents);
260 const size_t currentSolutionIndex, T timestep) {
264 component->updateStoredState(solutionMatrix, currentSolutionIndex,
268 component->updateStoredState(solutionMatrix, currentSolutionIndex,
280 component->updateDCStoredState(solutionVector,
dcStamp.sizeG_A,
284 component->updateDCStoredState(solutionVector,
dcStamp.sizeG_A,
288 component->updateDCStoredState(solutionVector,
dcStamp.sizeG_A,
SolutionStage
An enum to track how far we want to go in a solution.
ComponentType
An enum for component types. Current unused.
a glorified container for the different types of components.
Stamp< T > & generateStaticStamp()
Forces a clear of the static stamp, and generates a new one.
Stamp< T > & generateCompleteStamp(SolutionStage stage, const Matrix< T > &solutionMatrix, const size_t currentSolutionIndex, T timestep)
Generates the complete stamp up to a certain point.
void updateDCStoredState(const Matrix< T > &solutionVector, size_t numCurrents)
Updates the components based on their DC value. Applies to dynamic and non-linear components.
std::vector< std::shared_ptr< Component< T > > > dynamicElements
A container to store the dynamic components.
Stamp< T > dcStamp
Preallocated stamp. Used for caching between loop iterations. DC stamps must be updated on every newt...
std::vector< std::shared_ptr< Component< T > > > staticElements
A container to store the static components.
Stamp< T > staticStamp
Preallocated stamp. Used for caching between loop iterations. Static stamps will only be generated on...
bool staticStampIsFresh
A variable used to track if the cached stamp is current.
Stamp< T > & generateNonLinearStamp(const Matrix< T > &solutionMatrix, const size_t currentSolutionIndex, T timestep)
Obtains the dynamic stamp, then adds dynamic components to it.
std::vector< std::shared_ptr< Component< T > > > nonLinearElements
A container to store the Non-Linear components.
CircuitElements(size_t numNodes=0, size_t numCurrents=0, size_t numDCCurrents=0)
Initialisation.
void setNewStampSize(size_t numNodes, size_t numCurrents, size_t numDCCurrents=0)
Updates the size of all stamps.
std::multimap< size_t, std::shared_ptr< Component< T > > > nodeComponentMap
A map to pair nodes with the components connected to them.
Stamp< T > dynamicStamp
Preallocated stamp. Used for caching between loop iterations. Dynamic stamps need to be updated on ev...
Stamp< T > & generateDynamicStamp(const Matrix< T > &solutionMatrix, const size_t currentSolutionIndex, T timestep)
Obtains the static stamp, then adds dynamic components to it.
bool nonLinearStampIsFresh
A variable used to track if the cached stamp is current.
Stamp< T > nonLinearStamp
Preallocated stamp. Used for caching between loop iterations. Non-Linear stamps must be updated on ev...
Stamp< T > & generateDCStamp(const Matrix< T > &solutionVector, size_t numCurrents)
Generates the complete DC stamp.
void updateTimeStep(const Matrix< T > &solutionMatrix, const size_t currentSolutionIndex, T timestep)
Updates the components at the end of each time step. Applies to dynamic and non-linear components.
bool dynamicStampIsFresh
A variable used to track if the cached stamp is current.
An ebbers moll diode model.
A matrix class with support for LU-decomposition, and left division.
A helper struct to store the preallocated stamps for MNA.