Template Class PowerElectronicsModel

Inheritance Relationships

Base Type

Class Documentation

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

Public Functions

inline PowerElectronicsModel()

Default constructor for the system model.

Post:

System model parameters set as default

inline PowerElectronicsModel(double rel_tol = 1e-4, double abs_tol = 1e-4, bool use_jac = false, IdxT max_steps = 2000)

Constructor for the system model.

Parameters:
  • rel_tol[in] Relative tolerance for the system model

  • abs_tol[in] Absolute tolerance for the system model

  • use_jac[in] Boolean to choose if to use jacobian

  • max_steps[in] Maximum number of steps for the system model

Post:

System model parameters set as input

inline virtual ~PowerElectronicsModel()

Destructor for the system model.

Pre:

System components are allocated

Post:

System components are deallocated

inline virtual bool hasJacobian() final

Will check if each component has jacobian avalible. If one doesn’t have it, return false.

Returns:

true if all components have jacobian

Returns:

false otherwise

inline virtual int allocate() final

Allocate system vectors and construct the system CSR Jacobian.

Parameters:

s[in] size of the vector (total number of unknowns)

Post:

System model vectors allocated with size s

Post:

CSR Jacobian sparsity pattern is computed

Post:

COO->CSR mapping is computed

Post:

Every component’s CircuitComponent::y_int_, CircuitComponent::yp_int_, and CircuitComponent::f_int_ pointers are set to their appropriate offsets in the system vector, allowing them to directly access their internal variables, derivatives, and residuals.

Returns:

int 0 if successful, positive if there’s a recoverable error, negative if unrecoverable

inline virtual int initialize() final

Set intial y and y’ of each component.

Returns:

int 0 if successful, positive if there’s a recoverable error, negative if unrecoverable

inline int distributeVectors()

Distribute y and y’ to each component based of node connection graph.

Post:

Each component has y and y’ set

Returns:

int 0 if successful, positive if there’s a recoverable error, negative if unrecoverable

inline virtual int evaluateInternalResidual() final

Evaluate Residuals at each component then collect them.

Returns:

int 0 if successful, positive if there’s a recoverable error, negative if unrecoverable

inline virtual int evaluateExternalResidual() final

Todo:

implement this for nested systems

inline virtual int evaluateJacobian() final

Creates the system Jacobian representing \alpha dF/dy’ + dF/dy.

Updates the CSR Jacobian values using the per-component mappings computed during allocate().

Returns:

int 0 if successful, positive if there’s a recoverable error, negative if unrecoverable

inline virtual int evaluateIntegrand() final

Evaluate integrands for the system quadratures.

inline virtual int initializeAdjoint() final

Initialize system adjoint.

Updates variables and optimization parameters, then initializes adjoints locally and copies them to the system adjoint vector.

inline virtual int evaluateAdjointResidual() final

Compute adjoint residual for the system model.

inline virtual int evaluateAdjointIntegrand() final

Evaluate adjoint integrand for the system model.

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

Distribute time and time scaling for each component.

Parameters:
  • t

  • a

inline void printResidualMatrixMarket(std::string filename, std::string title)

print the system residual in COO format

Parameters:
  • filename[in]

  • title[in]

inline virtual CsrMatrixT *getCsrJacobian() const override

Return a pointer to the CSR Jacobian.

Todo:

Remove this and use CsrMatirx for jac_