Template Class NodeBase
Defined in File NodeBase.hpp
Inheritance Relationships
Base Type
public GridKit::Model::Evaluator< ScalarT, IdxT >(Template Class Evaluator)
Derived Types
public GridKit::PowerElectronics::Bus< ScalarT, IdxT >(Template Class Bus)public GridKit::PowerElectronics::GroundedBus< ScalarT, IdxT >(Template Class GroundedBus)public GridKit::PowerElectronics::MicrogridBus< ScalarT, IdxT >(Template Class MicrogridBus)public GridKit::PowerElectronics::SignalNode< ScalarT, IdxT >(Template Class SignalNode)
Class Documentation
-
template<typename ScalarT, typename IdxT>
class NodeBase : public GridKit::Model::Evaluator<ScalarT, IdxT> Subclassed by GridKit::PowerElectronics::Bus< ScalarT, IdxT >, GridKit::PowerElectronics::GroundedBus< ScalarT, IdxT >, GridKit::PowerElectronics::MicrogridBus< ScalarT, IdxT >, GridKit::PowerElectronics::SignalNode< ScalarT, IdxT >
Public Functions
-
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 bool hasJacobian() final
Is the Jacobian defined. Used in IDA to determine whether DQ is used or not.
- Returns:
true
- Returns:
false
-
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 int setExternalConnectionNodes(IdxT local_index, ExternalConnection<ScalarT, IdxT> connection)
Create the mappings from local to global indices for a node variable (either internal or external), to be used from an attached component.
- 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 ExternalConnection<ScalarT, IdxT> getNodeConnection(size_t local_index) const
Get connection information for a particular variable, to be consumed by an attached component so they can properly access their externals.
-
inline int setConnectionNodes(size_t local_index, IdxT connection_index)
Update the connection index for a variable.
Changes 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 virtual int allocate() override
Allocate all internal memory used by the model.
- Post:
Changing the model by changing its internal topology (i.e. size(), nnz(), sparsity pattern in getCsrJacobian(), etc.) may invalidate the model until
allocate()is called again. Calling any function that requiresallocate()to be called in between modifying the model and reallocating may invoke undefined behaviour.
-
inline virtual int tagDifferentiable() final
Fill the tag() vector with proper indicators.
Note
For some models, this may be a no-op, and the vector returned by tag() will still be empty.
- Pre:
allocate() must have been called.
-
inline virtual int setAbsoluteTolerance(RealT rel_tol) final
Compute the absolute tolerance for each variable in the model.
This represents a “noise” level close to zero for which pure relative error cannot be used.
- Parameters:
rel_tol – The relative tolerance which can be used to pick the absolute tolerance.
- Template Parameters:
ScalarT – Scalar data type
IdxT – Index data type
- Returns:
int 0 if successful, non-zero otherwise.
-
inline virtual int evaluateResidual() final
Evaluate the model’s residual function.
For models which can be appropriately modeled in semi-explicit form, this will evaluate
\[F(t, y, \dot{y}) = f(t,y) - M \dot{y},\]where\[M\]is the mass matrix. For models which can be modeled in Hessenberg form,\[M\]should be a simple indicator function for if the variable is differential (if\[\dot{y}\]appears in its equation). This indicator should be given by tag().
-
inline bool isAllocated() const
Check whether the Node has already been allocated.
- Returns:
true if allocate() has previously completed, false otherwise.
-
inline virtual IdxT nnz() final