Template Class Component
Defined in File Component.hpp
Inheritance Relationships
Base Type
public GridKit::Model::Evaluator< ScalarT, IdxT >(Template Class Evaluator)
Derived Types
public GridKit::PowerElectronics::Capacitor< ScalarT, IdxT >(Template Class Capacitor)public GridKit::PowerElectronics::DistributedGenerator< ScalarT, IdxT >(Template Class DistributedGenerator)public GridKit::PowerElectronics::InductionMotor< ScalarT, IdxT >(Template Class InductionMotor)public GridKit::PowerElectronics::Inductor< ScalarT, IdxT >(Template Class Inductor)public GridKit::PowerElectronics::LinearTransformer< ScalarT, IdxT >(Template Class LinearTransformer)public GridKit::PowerElectronics::MicrogridBusDQ< ScalarT, IdxT >(Template Class MicrogridBusDQ)public GridKit::PowerElectronics::MicrogridLine< ScalarT, IdxT >(Template Class MicrogridLine)public GridKit::PowerElectronics::MicrogridLoad< ScalarT, IdxT >(Template Class MicrogridLoad)public GridKit::PowerElectronics::Resistor< ScalarT, IdxT >(Template Class Resistor)public GridKit::PowerElectronics::SynchronousMachine< ScalarT, IdxT >(Template Class SynchronousMachine)public GridKit::PowerElectronics::SystemModel< ScalarT, IdxT >(Template Class SystemModel)public GridKit::PowerElectronics::TransmissionLine< ScalarT, IdxT >(Template Class TransmissionLine)public GridKit::PowerElectronics::VoltageSource< ScalarT, IdxT >(Template Class VoltageSource)
Class Documentation
-
template<class ScalarT, typename IdxT>
class Component : public GridKit::Model::Evaluator<ScalarT, IdxT> Declaration of a Component class.
Subclassed by GridKit::PowerElectronics::Capacitor< ScalarT, IdxT >, GridKit::PowerElectronics::DistributedGenerator< ScalarT, IdxT >, GridKit::PowerElectronics::InductionMotor< ScalarT, IdxT >, GridKit::PowerElectronics::Inductor< ScalarT, IdxT >, GridKit::PowerElectronics::LinearTransformer< ScalarT, IdxT >, GridKit::PowerElectronics::MicrogridBusDQ< ScalarT, IdxT >, GridKit::PowerElectronics::MicrogridLine< ScalarT, IdxT >, GridKit::PowerElectronics::MicrogridLoad< ScalarT, IdxT >, GridKit::PowerElectronics::Resistor< ScalarT, IdxT >, GridKit::PowerElectronics::SynchronousMachine< ScalarT, IdxT >, GridKit::PowerElectronics::SystemModel< ScalarT, IdxT >, GridKit::PowerElectronics::TransmissionLine< ScalarT, IdxT >, GridKit::PowerElectronics::VoltageSource< ScalarT, IdxT >
Public Functions
-
inline virtual Component<ScalarT, IdxT> *clone() const
Create an independent copy of this component.
The clone preserves the component’s model configuration, parameters, topology, and structural data, but does not preserve bindings to system-owned state or residual storage.
Note
By default, the cloned component’s state, state-derivative, and residual pointers are not set. The user is responsible for setting these pointers to the appropriate storage before evaluating the residual.
-
inline virtual bool isCloneable() const
Indicates whether this component supports cloning.
Derived components that implement clone() should override this method and return true.
- Returns:
true if the component can be cloned, false otherwise.
-
inline virtual void updateTime(RealT t, RealT a) override
Note
Cannot be marked final, since it is overridden to recurse in the system model.
-
inline virtual bool hasJacobian() override
Is the Jacobian defined. Used in IDA to determine whether DQ is used or not.
- Returns:
true
- Returns:
false
-
inline int setInternalConnectionNodes(size_t local_index, IdxT global_index)
Create the mappings from local to global indices for an internal variable. Used for constructing system Jacobians.
See also
connection_nodes_.
- Parameters:
local_index – The index of the local variable
global_index – The index of the corresponding system variable.
- Pre:
local_indexmust be the index of an internal variable. Using this method for an external variable will not properly setup the data pointers for that variable.
-
inline int setExternalConnectionNodes(size_t local_index, ExternalConnection<ScalarT, IdxT> connection)
Create the mappings from local to global indices for an external variable. External variables need extra information than internal variables - their data pointers y_ext_, yp_ext_, and f_ext_.
- Parameters:
local_index – The index of the local variable
connection – The necessary connection information for the variable
- Pre:
local_indexmust be the index of an external variable. As of now, using this method to set information for a local variable will silently discard the unnecessary information, but this may change in the future.
-
inline int setConnectionNodes(size_t local_index, IdxT connection_index)
Update the connection index for a variable.
Sets only the connection index without modifying the variable’s internal/external classification or its associated data pointers.
- Parameters:
local_index – Index of the local variable.
connection_index – New connection index for the variable.
- Returns:
int 0 if successful.
-
inline IdxT getNodeConnection(size_t local_index) const
Given the location of value in the local vector map to global index.
f(local_index) = global_index
- Parameters:
local_index – index of local value in vector
- Returns:
size_t Index of the same value in the global vector
-
inline virtual int allocate() override
Allocates all of the internal buffers for the component. If a components needs a more specialized allocation (such as by having additional internal buffers), it should override this function and then call it in the body to ensure it stays up-to-date with new implementations.
- Pre:
nnz_ and size_ must be set. Typically these are set by the child object in its constructor.
- Returns:
An error code, or 0 if success
-
inline virtual int evaluateResidual() final
Evaluating the residual of a Component should be done by evaluating the internal residuals and external residuals. Components should overload those functions for their residuals (and the system will call those function instead of this one), so there is no reason to overload this functionality.
- Returns:
An error code, or 0 is successful.
-
virtual int evaluateInternalResidual() = 0
Evaluate all residuals for the component’s internal variables, writing them through
f_int_.- Returns:
An error code, or 0 if successful.
-
virtual int evaluateExternalResidual() = 0
Evaluate all residual contributions for the component’s external variables, accumulating them through
f_ext_.- Returns:
An error code, or 0 if successful.
-
inline virtual IdxT nnz() final
How many non-zero elements are in this model’s Jacobian.
This knowledge may be needed to allocate the buffers for the model’s Jacobian, so it it should not depend on allocate() having been called.
See also
-
inline virtual std::vector<bool> &tag() final
An indicator for which variables in the model are differential (true) or algebraic (false).
This information may be required for certain integrator features (such as the AnalysisManager::NativeDynamicSolver::Rosenbrock integrator), but is not required to be set. A reference to an empty vector may be returned.
- Pre:
tagDifferentiable() must have been called.
-
inline virtual VectorT &absoluteTolerance() final
Get the absolute tolerance for each variable in the model.
- Returns:
a reference to the absolute tolerance vector.
- Pre:
setAbsoluteTolerancemust have been called first.
-
inline virtual const VectorT &absoluteTolerance() const final
Get the absolute tolerance for each variable in the model.
- Returns:
a const reference to the absolute tolerance vector.
- Pre:
setAbsoluteTolerancemust have been called first.
-
inline bool isAllocated() const
Check whether the component has already been allocated.
- Returns:
true if allocate() has previously completed, false otherwise.
-
inline virtual Component<ScalarT, IdxT> *clone() const