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 >, GridKit::PhasorDynamics::BusSignalVoltageIn< scalar_type, index_type >, GridKit::PhasorDynamics::BusSignalVoltageOut< scalar_type, index_type >

Public Functions

inline virtual Model::ConfigurationChecks verify() const

Report every configuration problem; passed() when the bus can initialize.

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 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.

Pre:

allocate() must have been called.

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 virtual int setFault(bool, RealT, RealT)

Apply (status true) or clear a fault to ground with impedance R + jX.

inline int clearFault()

Clear a fault to ground.

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

Get non-owning reference to monitor.