Template Class SystemModel
Defined in File SystemModel.hpp
Inheritance Relationships
Base Type
public GridKit::PhasorDynamics::Component< scalar_type, index_type >(Template Class Component)
Class Documentation
-
template<typename scalar_type, typename index_type>
class SystemModel : public GridKit::PhasorDynamics::Component<scalar_type, index_type> Prototype for a system model class.
This class maps component data to system data and implements Model::Evaluator for the system model. This is still work in progress and code is not optimized.
- Todo:
Address thread safety for the system model methods.
Public Functions
-
virtual int allocate() override
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 requiresallocate()to be called in between modifying the model and reallocating may invoke undefined behaviour.
-
virtual Model::ConfigurationChecks verify() const override
Report configuration problems.
-
virtual bool hasJacobian() override
- Todo:
Remove this method. It should be part of DynamicSolver class.
-
virtual void startMonitor() override
Get monitor ready for output.
-
virtual void stopMonitor() override
Tell monitor to wrap up.
-
virtual bool monitoring() const override
Is there something to monitor? Defaults to
false.
-
virtual void printMonitoredVariables() const override
Print variables at current state.
-
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 setAbsoluteTolerance(RealT rel_tol) override
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.
-
virtual int evaluateResidual() override
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().