Skip to content

Add node objects to PowerElectronics module#367

Open
alexander-novo wants to merge 21 commits intodevelopfrom
alex/pow-elec-node-objects
Open

Add node objects to PowerElectronics module#367
alexander-novo wants to merge 21 commits intodevelopfrom
alex/pow-elec-node-objects

Conversation

@alexander-novo
Copy link
Copy Markdown
Collaborator

Description

Partially addresses #353

Adds node objects to system so the system can calculate the optimal variable mappings itself. Right now, these node objects consist of:

  • Bus (single voltage bus)
  • MicrogridBus (two voltage bus)
  • InfiniteBus (single voltage reference bus)
  • SignalNode (single-variable signal node)

All of the PowerElectronics examples have been updated to use these nodes, and there original logic for creating variable mappings has been removed. Since the RLCircuit example didn't have the correct mapping, some of its variables have been re-arranged.

As well, all component models included in these examples have been updated. Other component models can also be updated, since I feel fairly confident that I should be able to update them correctly... I just don't have tests to verify.

Proposed changes

Node objects work fairly similarly to components:

  • they have an internal size, which contributes to the overall system size
  • they have an external size (for e.g. reference nodes)
  • they have a mapping from these variables to system variables

The system adds up the internal sizes for all of the nodes and components to get its own internal size, and then is able to form mappings for all of the node and component internal variables - putting the node variables at the end of the system vector for correct Jacobian sparsity.

Components with external variables take node pointers in their constructor, and in the allocate() function will query the mapping of the node variables to properly construct the mapping for their own external variables. Reference variable mappings are also set here.

Checklist

  • All tests pass.
  • Code compiles cleanly with flags -Wall -Wpedantic -Wconversion -Wextra.
  • The new code follows GridKit™ style guidelines.
  • There are unit tests for the new code.
  • The new code is documented.
  • The feature branch is rebased with respect to the target branch.
  • I have updated CHANGELOG.md to reflect the changes in this PR. If this is a minor PR that is part of a larger fix already included in the file, state so.

Further comments

@alexander-novo alexander-novo requested a review from pelesh April 9, 2026 14:53
@alexander-novo alexander-novo added enhancement New feature or request labels Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant