Template Class BusBase

Inheritance Relationships

Base Type

Derived Types

Class Documentation

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

BusBase model implementation base class.

Subclassed by GridKit::PhasorDynamics::Bus< scalar_type, index_type >, GridKit::PhasorDynamics::BusInfinite< 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 bus’s state and residual vectors to the slice [offset, offset + size()) of the system vectors.

After binding, the bus 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 bus’s slice in the system vectors

Pre:

System vectors hold current HOST data of at least offset + size() elements. This bus’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 BusTypeT BusType() const

Pure virtual function, returns bus type (DEFAULT or SLACK).

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

Is the Jacobian defined. Used in IDA to determine wether DQ is used or not.

Returns:

true

Returns:

false

virtual const Model::VariableMonitorBase *getMonitor() const override

Get non-owning reference to monitor.