Add method(s) to update variables of a specific component
@pelesh is already working on this.
Since Jun 18, 2025.
- Dominant language
- C++
- Stars
- 27
- Forks
- 11
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 23
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.