Template Class CircuitComponent

Inheritance Relationships

Base Type

Derived Types

Class Documentation

template<class ScalarT, typename IdxT>
class CircuitComponent : public GridKit::Model::Evaluator<ScalarT, IdxT>

Declaration of a CircuitComponent class.

Subclassed by GridKit::Capacitor< ScalarT, IdxT >, GridKit::DistributedGenerator< ScalarT, IdxT >, GridKit::InductionMotor< ScalarT, IdxT >, GridKit::Inductor< ScalarT, IdxT >, GridKit::LinearTransformer< ScalarT, IdxT >, GridKit::MicrogridBusDQ< ScalarT, IdxT >, GridKit::MicrogridLine< ScalarT, IdxT >, GridKit::MicrogridLoad< ScalarT, IdxT >, GridKit::PowerElectronicsModel< ScalarT, IdxT >, GridKit::Resistor< ScalarT, IdxT >, GridKit::SynchronousMachine< ScalarT, IdxT >, GridKit::TransmissionLine< ScalarT, IdxT >, GridKit::VoltageSource< ScalarT, IdxT >

Public Functions

inline virtual void updateTime(RealT t, RealT a) override

Note

Cannot be marked final, since it is overriden to recurse in the system model.

inline virtual bool hasJacobian() override

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

Returns:

true

Returns:

false

inline int setExternalConnectionNodes(IdxT local_index, IdxT global_index)

Create the mappings from local to global indices.

Parameters:
  • local_index

  • global_index

Returns:

int

inline IdxT getNodeConnection(IdxT local_index) const

Given the location of value in the local vector map to global index.

f(local_index) = global_index

Parameters:

local_index – index of local value in vector

Returns:

IdxT Index of the same value in the global vector

inline virtual int allocate() override

Allocates all of the internal buffers for the component. If a components needs a more specialized allocation (such as by having additional internal buffers), it should override this function and then call it in the body to ensure it stays up-to-date with new implementations.

Pre:

nnz_ and size_ must be set. Typically these are set by the child object in its constructor.

Returns:

An error code, or 0 if success

inline virtual int evaluateResidual() final

Evaluating the residual of a CircuitComponent should be done by evaluating the internal residuals and external residuals. CircuitComponents should overload those functions for their residuals (and the system will call those function instead of this one), so there is no reason to overload this functionality.

Returns:

An error code, or 0 is successful.

virtual int evaluateInternalResidual() = 0

Evaluate all of the residuals of internal variables of the component, modifying f_.

Returns:

An error code, or 0 if successful.

virtual int evaluateExternalResidual() = 0

Evaluate all of the residuals of external variables of the component, modifying f_.

Returns:

An error code, or 0 if successful.