Skip to content

Replace ComponentSignals with IOPorts implementation#481

Draft
PhilipFackler wants to merge 1 commit into
developfrom
PhilipFackler/signal-ports
Draft

Replace ComponentSignals with IOPorts implementation#481
PhilipFackler wants to merge 1 commit into
developfrom
PhilipFackler/signal-ports

Conversation

@PhilipFackler

Copy link
Copy Markdown
Collaborator

Description

This is a refactor of ComponentSignals to be (hopefully) more intuitive and also make model development a bit easier.

Proposed changes

Manage signal node connections via input and output ports

  • Introduce a set of classes that represent a collection of input and output ports that manage connection to signal nodes
  • Make input/output ports directly available to components
  • Clear up terminology: distinguish between signal node and signal. Use "connect" rather than "assign" and "attach" (keep "assign" as implementation detail) and "link" rather than "set"
  • Introduce SignalNodeSet class for managing the signal nodes for the system. This can then be passed to components since it doesn't require access to the SystemModel implementation. This maps either signal_id or name to signal nodes.
  • Have IOPorts automatically connect signal nodes to ports at construction (rather than doing it manually in SystemModel
  • Remove ComponentSignals

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.

@PhilipFackler PhilipFackler requested review from lukelowry, nkoukpaizan and pelesh and removed request for lukelowry July 9, 2026 16:12
@lukelowry

Copy link
Copy Markdown
Collaborator

This looks awesome!!

@lukelowry lukelowry left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So so helpful for my development. This is very intuitive and helps understand and debug intermodel behavior. I would like this to be merged before the new Phasor Dynamics models so I can use this syntax!

Masterful this helps so much with modeling

@lukelowry

Copy link
Copy Markdown
Collaborator

As a related question, for future development in EMT: how difficult would this be to implement for vector-typed signals instead of scalar-typed? In an ideal world, the best possible design for EMT is a N width signal (decided at runtime), which I have no clue how to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants