Template Class Pll

Inheritance Relationships

Base Type

Class Documentation

template<typename scalar_type, typename index_type>
class Pll : public GridKit::EMT::Component<scalar_type, index_type>

Synchronous-reference-frame PLL on a three-phase bus.

Public Functions

explicit Pll(const ModelDataT &data)

Construct a PLL on a three-phase voltage.

Layout: internal variables theta and x of size 1, input v of size 3, and output omega of size 1.

virtual Model::ConfigurationChecks verify() const override

Check that the gains are positive.

Returns:

The failed checks.

virtual int setAbsoluteTolerance(RealT rel_tol) override

Set the tolerance of the angle to rel_tol radians, and those of the integrator state and of the frequency to rel_tol times the system base frequency.

Parameters:

rel_tol – [in] Relative tolerance of the integrator.

Returns:

0.

virtual int tagDifferentiable() override

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.

virtual int evaluateResidual() override

Add the residual of a linear model to the system residual.

The residual of a linear model is its constant partials dF/dy and dF/dy’ applied to the values and the derivatives, so no kernel is evaluated. A model with any other term forwards evaluateResidual to its kernels.

Returns:

0.

Pre:

tagDifferentiable has stored the partials.

virtual int evaluateOutputs() override

Evaluate every output at the current values, whether or not it is connected.

virtual int evaluateJacobian() override

Set the Jacobian entries to dF/dy + alpha dF/dy’.

Returns:

0.

Pre:

tagDifferentiable has stored the partials of the entries.

template<typename T>
void internalResidual(const T *y, const T *yp, const T *w, const T *wp, T *f) const

Write the residuals of the angle and of the integrator state.

The indices are constants, since Enzyme needs the layout at compile time.

template<typename T>
void output(OutputsT output, const T *y, const T *yp, const T *w, const T *wp, T *f) const

Write the frequency omega.