Template Class BaseBus

Inheritance Relationships

Base Type

Derived Types

Class Documentation

template<class ScalarT, typename IdxT>
class BaseBus : public GridKit::ModelEvaluatorImpl<ScalarT, IdxT>

Base class for all power flow buses.

Derived bus types: 0 - swing bus (V and theta are constants) 1 - PV bus (P and V are constants) 2 - PQ bus (P and Q are constants)

Todo:

Consider static instead of dynamic polymorphism for bus types. Create Bus class that takes template parameter BusType.

Subclassed by GridKit::BusPQ< ScalarT, IdxT >, GridKit::BusPV< ScalarT, IdxT >, GridKit::BusSlack< ScalarT, IdxT >

Public Functions

inline virtual int allocate()

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 requires allocate() to be called in between modifying the model and reallocating may invoke undefined behaviour.

inline virtual int tagDifferentiable()

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)

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.

Returns:

int 0 if successful, non-zero otherwise.

inline virtual int evaluateResidual()

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