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::BusFault< scalar_type, index_type >, GridKit::PhasorDynamics::BusToSignalAdapter< scalar_type, index_type >, GridKit::PhasorDynamics::ConstantSignalSource< scalar_type, index_type >, GridKit::PhasorDynamics::Exciter::Ieeet1< scalar_type, index_type >, GridKit::PhasorDynamics::Exciter::SexsPti< 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::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

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.

Todo:

Remove this and use CsrMatrix for jac_

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.