Skip to content

Add method(s) to update variables of a specific component #145

@pelesh

Description

@pelesh

Summary

Based on issues #142 and #143 consider adding following method to the GridKit::PhasorDynamics::SystemModel class:

int updateComponentVariables(index_type component_id);

The method would prompt component (or subsystem) component_id to copy variable values from the system solution vector to component member variables. These are denoted as $y^r$ in #143.

Similarly, method

int updateBusVariables(index_type bus_id);

would prompt bus bus_id to update its own variables from the system solution vector. These variables are (should have been) denoted as $w^b$ in #143.

CC @Steven-Roberts @reid-g

Rationale

Multimethod numerical schemes may need to update only a subset of system variables, so there need to be methods that allow for that.

Description

In current GridKit implementation, the proposed function would look like this:

template<class scalar_type, class index_type>
int SystemSolver<scalar_type, index_type>::updateComponentVariables(index_type component_id)
{
  for (IdxT j = 0; j < component->size(); ++j)
  {
    component->y()[j]  = y_[varOffset[component_id] + j];
    component->yp()[j] = yp_[varOffset[component_id] + j];
  }
  return 0;
}

Additional information

Eventually, with tighter integration with numerical integrator, these methods may become obsolete. Component internal variables could be simply references to the elements of system variables vector. In that case, the numerical integrator would write solution to the appropriate elements in the system solution vector and each component would have the up-to-date variables.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestquestionFurther information is requested
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions