feat: Add fault propagation to FaultController#676
Conversation
ST-LIB Release Plan
Pending changes
|
There was a problem hiding this comment.
Pull request overview
Adds Ethernet-enabled fault propagation to FaultController so that entering FAULT locally broadcasts a FAULT order to registered TCP peers, and receiving a FAULT order from a peer forces the local controller into FAULT while suppressing re-propagation loops.
Changes:
- Introduces
FaultController::register_fault_propagation(OrderProtocol*, Order*)(guarded bySTLIB_ETH) plus internal tracking of up to 8 propagation targets. - Adds reception path via an order callback (
on_fault_order_received) that triggersrequest_fault(), and a send path (propagate_fault()) invoked only on first transition into FAULT. - Adds a changeset documenting the new (backwards-compatible) feature.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
Src/ST-LIB_HIGH/Protections/FaultController.cpp |
Implements registration, reception callback, and propagation-on-fault entry (guarded by STLIB_ETH). |
Inc/ST-LIB_HIGH/Protections/FaultController.hpp |
Declares the new public API and the private propagation state/handlers (guarded by STLIB_ETH). |
.changesets/fault-propagation.md |
Adds release note entry for the new fault propagation behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
805bb52 to
81b7c32
Compare
81b7c32 to
6a61145
Compare
Copilot Review ResponsesAddressed 4 of 7 comments in
|
70f4840 to
b7b229f
Compare
Re: boot-time fault clearing propagation targetsValid catch. Fixed in Root cause: Fix: Moved the propagation state reset out of
|
b7b229f to
d781bb5
Compare
Copilot Review Round 3 ResponsesAddressed 2 of 5 new comments in
|
b3efe75 to
39a6c40
Compare
Summary
Add automatic fault propagation to
FaultControllerso that when a board enters FAULT, it sends the FAULT order (ID 0) to all registered TCP peers, and conversely detects incoming FAULT orders from peers to enter FAULT automatically.Changes
FaultController.hpp#ifdef STLIB_ETHguarded includes forOrder.hppandOrderProtocol.hppregister_fault_propagation(OrderProtocol* socket, Order* fault_order)FaultPropagationTargetstruct, static storage for up to 8 targets,propagate_fault(),on_fault_order_received()FaultController.cppregister_fault_propagation(): stores socket+order pair and replaces the order's callback withon_fault_order_receivedso that when the FAULT order arrives on that socket, FaultController enters FAULT automatically.on_fault_order_received(): callsrequest_fault()— this is the reception path.propagate_fault(): iterates all registered sockets and sends the FAULT order viasend_order().request_fault()now callspropagate_fault()inside theif (!faulted)block — so propagation only fires on the initial fault entry, not on subsequent duplicate calls.Loop Prevention
The
if (!faulted)guard inrequest_fault()is the only loop breaker. Each board propagates exactly once, on the!faulted → faultedtransition. Nofault_received_from_peerflag needed.Designed for star topology (VCU at center):
!faulted → faulted→ propagate to VCU. VCU:!faulted → faulted→ propagate to CS, HVBMS, PCU, LCU. All replies: already faulted → stop.!faulted → faulted→ propagate to CS, HVBMS, PCU, LCU. All replies: already faulted → stop.Socket*andServerSocket*(both inherit fromOrderProtocol).STLIB_ETH(all code guarded).Usage (application side)
Registration enables both reception (callback hijack) and sending (propagation on local fault). Without registration, neither works.