Skip to content

tieline visualisation#1374

Open
andrew-welker wants to merge 14 commits intomainfrom
tieline-visualisation
Open

tieline visualisation#1374
andrew-welker wants to merge 14 commits intomainfrom
tieline-visualisation

Conversation

@andrew-welker
Copy link
Copy Markdown
Contributor

@andrew-welker andrew-welker commented Jan 14, 2026

This pull request introduces significant performance optimizations and new features to the routing logic in the Essentials Core, particularly in the Extensions class. The main improvements include the addition of indexed lookups for TieLines, caching of impossible routes to avoid redundant calculations, and the introduction of a pre-mapping mechanism for route descriptors. These changes are aimed at making route discovery and execution much faster and more efficient, especially in large systems.

Routing Performance Optimizations:

  • Added indexed lookup dictionaries (_tieLinesByDestination, _tieLinesBySource) for TieLines to speed up route lookups and provided methods to initialize and use these indexes instead of repeated LINQ queries.
  • Introduced a cache (_impossibleRoutes) for impossible routes to prevent repeated attempts at finding non-existent paths, including logic to add to and clear this cache. [1] [2]

Route Descriptor Pre-mapping and Utilization:

  • Added a global RouteDescriptors dictionary, mapping each signal type to a collection of RouteDescriptor objects, and implemented a MapDestinationsToSources method to precompute and store all possible routes at startup. [1] [2]
  • Modified the routing execution logic to use pre-mapped route descriptors when possible, falling back to dynamic route discovery only if a pre-mapped route is not found.

Other Improvements and Bug Fixes:

  • Improved the return logic of GetRouteToSource to ensure only valid, non-empty route descriptors are returned, preventing downstream errors.
  • Enhanced console output in DeviceManager.GetRoutingPorts to display both the key and signal type for each port, aiding in debugging and diagnostics.

These changes collectively make routing operations more scalable and reliable, particularly in environments with many devices and complex routing requirements.

  • feat: improve routing feedback manager
  • fix: getroutingports command now prints port types
  • feat: map routes/tielines at startup and new console commands
  • feat: add CWS endpoint to get routing devices & tielines together

* Performance improvment by mapping out midpoint to sinks on startup
* Use existing routing methods
* Debounce event handling
* Check all signal types for route updates
* visualizeroutes allows visualizing configured routes based on tielines and signal type
  * can be filtered by source key, destination key, and type, along with partial matches for source & destination keys
* visualizecurrentroutes visualizes what Essentials says is currently routed by type
  * uses same filtering as visualizeroutes
* improvements to how the routing algorithm works
@ndorin ndorin marked this pull request as ready for review April 11, 2026 00:41
Copilot AI review requested due to automatic review settings April 11, 2026 00:41
ndorin
ndorin previously approved these changes Apr 11, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds route/tieline visualization and introduces several routing performance optimizations in Essentials Core, including TieLine indexing, “impossible route” caching, and startup pre-mapping of route descriptors. It also expands diagnostics via console output updates and a new Web API endpoint to fetch routing devices and tielines in one call.

Changes:

  • Added console commands to list tielines and visualize mapped/current routes, plus startup route mapping after tielines load.
  • Implemented routing optimizations: tieline indexes, impossible-route caching, and precomputed route-descriptor tables with preloaded lookup during execution.
  • Added a CWS endpoint to return routing devices + tielines together, and improved getroutingports console output.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/PepperDash.Essentials/ControlSystem.cs Adds console commands and triggers route mapping after tielines load
src/PepperDash.Essentials.Core/Web/RequestHandlers/GetRoutingDevicesAndTieLinesHandler.cs New endpoint returning routing devices/ports and tielines
src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs Registers the new routingDevicesAndTieLines route
src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs Adds midpoint→sink optimization and debounced sink updates; refactors root-source discovery
src/PepperDash.Essentials.Core/Routing/RouteSwitchDescriptor.cs Simplifies/modernizes descriptor implementation and string output
src/PepperDash.Essentials.Core/Routing/RouteDescriptorCollection.cs Adds public descriptor enumeration and changes de-dupe logic
src/PepperDash.Essentials.Core/Routing/RouteDescriptor.cs Improves route string formatting; minor cleanup
src/PepperDash.Essentials.Core/Routing/Extensions.cs Adds tieline indexing, impossible-route caching, startup mapping, and preloaded route lookup
src/PepperDash.Essentials.Core/Devices/DeviceManager.cs Improves console output to include port signal type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/PepperDash.Essentials/ControlSystem.cs Outdated
Comment thread src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs
Comment thread src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs Outdated
Comment thread src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs Outdated
Comment thread src/PepperDash.Essentials.Core/Routing/Extensions.cs
Comment thread src/PepperDash.Essentials.Core/Routing/Extensions.cs
Comment thread src/PepperDash.Essentials.Core/Routing/Extensions.cs
Comment thread src/PepperDash.Essentials.Core/Routing/RouteDescriptorCollection.cs
ndorin added 2 commits April 14, 2026 22:12
…s. Resolve issues with client closing websocket connection to DebugWebsocketSink
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 14 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs Outdated
Comment thread src/PepperDash.Core/Web/WebApiServer.cs
Comment thread src/PepperDash.Essentials.Core/Routing/Extensions.cs Outdated
Comment thread src/PepperDash.Essentials.Core/Routing/Extensions.cs Outdated
Comment thread src/PepperDash.Essentials/ControlSystem.cs
Comment thread src/PepperDash.Essentials.Core/Web/EssentialsWebApiHelpers.cs
Comment thread src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs
@ndorin ndorin removed the request for review from ngenovese11 April 17, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants