Template Class Component

Inheritance Relationships

Base Type

Derived Types

Class Documentation

template<class scalar_type, typename index_type>
class Component : public GridKit::Model::Evaluator<scalar_type, index_type>

Component model implementation base class.

Subclassed by GridKit::PhasorDynamics::Branch< scalar_type, index_type >, GridKit::PhasorDynamics::ConstantSignalSource< scalar_type, index_type >, GridKit::PhasorDynamics::Controller::Reecb< scalar_type, index_type >, GridKit::PhasorDynamics::Controller::Repca< scalar_type, index_type >, GridKit::PhasorDynamics::Converter::Regca< scalar_type, index_type >, GridKit::PhasorDynamics::Exciter::Esdc1a< scalar_type, index_type >, GridKit::PhasorDynamics::Exciter::Ieeet1< scalar_type, index_type >, GridKit::PhasorDynamics::Exciter::SexsPti< scalar_type, index_type >, GridKit::PhasorDynamics::FunctionSignalSource< scalar_type, index_type >, GridKit::PhasorDynamics::GenClassical< scalar_type, index_type >, GridKit::PhasorDynamics::Genrou< scalar_type, index_type >, GridKit::PhasorDynamics::Gensal< scalar_type, index_type >, GridKit::PhasorDynamics::Governor::GastPti< scalar_type, index_type >, GridKit::PhasorDynamics::Governor::Hygov< scalar_type, index_type >, GridKit::PhasorDynamics::Governor::Tgov1< scalar_type, index_type >, GridKit::PhasorDynamics::LoadZ< scalar_type, index_type >, GridKit::PhasorDynamics::LoadZIP< scalar_type, index_type >, GridKit::PhasorDynamics::Stabilizer::Ieeest< scalar_type, index_type >, GridKit::PhasorDynamics::SystemModel< scalar_type, index_type >

Public Functions

virtual Model::ConfigurationChecks verify() const = 0

Report configuration problems.

inline virtual IdxT size() final override

How many variables exist in the model.

inline virtual IdxT nnz() final override

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

getCsrJacobian()

inline virtual std::vector<bool> &tag() override

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() override

Get the absolute tolerance for each variable in the model.

Returns:

a reference to the absolute tolerance vector.

Pre:

setAbsoluteTolerance must have been called first.

inline virtual const VectorT &absoluteTolerance() const override

Get the absolute tolerance for each variable in the model.

Returns:

a const reference to the absolute tolerance vector.

Pre:

setAbsoluteTolerance must have been called first.

inline int bind(VectorT &y, VectorT &yp, VectorT &f, VectorT &abs_tol, IdxT offset)

Bind this component’s state and residual vectors to the slice [offset, offset + size()) of the system vectors.

After binding, the component reads and writes system storage directly and allocate() will not allocate local vector data. Rebinding is allowed and refreshes the aliases, e.g. after system storage is reallocated when the topology changes.

Only HOST data is bound because PhasorDynamics currently evaluates models on the CPU. Supporting DEVICE data would also require sharing the matching DEVICE pointer and keeping the HOST and DEVICE copies in sync. This bind operation does neither, so DEVICE access is unsupported.

Parameters:
  • y – [in] - System state vector

  • yp – [in] - System state derivative vector

  • f – [in] - System residual vector

  • abs_tol – [in] - System absolute tolerance vector

  • offset – [in] - Position of this component’s slice in the system vectors

Pre:

System vectors hold current HOST data of at least offset + size() elements. This component’s vectors are unallocated or already bound.

Post:

allocated_ is true and y_, yp_, f_, abs_tol_ alias system storage.

Returns:

0 if successful, non-zero otherwise.

inline virtual CsrMatrixT *getCsrJacobian() const override

Return a pointer to the CSR Jacobian.

Pre:

allocate() must have been called.

inline virtual bool hasJacobian() override

Todo:

Remove this method. It should be part of DynamicSolver class.

inline void setSystemBase(RealT freq_system_base, RealT va_system_base)

Set system frequency and power bases.

Parameters:
  • freq_system_base – [in] - System frequency base in Hz.

  • va_system_base – [in] - System power base in VA.

inline int constructCsr()

CSR construction dispatch depending on ScalarT.

Note

Currently only used for testing, particularly for comparing Enzyme and DependencyTracking Jacobians.