EtherCAT.Bus.Link.RedundantMerge (ethercat v0.5.0)

Copy Markdown View Source

Pure helpers for redundant exchange interpretation.

Given sent datagrams and the replies from primary and secondary ports, classifies the rx pattern and merges both replies into a best-effort result with combined WKC.

All functions are deterministic and side-effect free — the hardest redundant-path logic is testable without a live bus or transports.

Summary

Types

interpretation_t()

@type interpretation_t() :: %{
  status: :ok | :partial | :timeout,
  redundancy: :full | :degraded | :none,
  path_shape: path_shape_t(),
  primary_rx_kind: rx_kind_t(),
  secondary_rx_kind: rx_kind_t(),
  datagrams: [EtherCAT.Bus.Datagram.t()] | nil
}

path_shape_t()

@type path_shape_t() ::
  :single
  | :full_redundancy
  | :primary_only
  | :secondary_only
  | :complementary_partials
  | :no_valid_return
  | :invalid

rx_kind_t()

@type rx_kind_t() :: :processed | :passthrough | :partial | :none | :invalid

Functions

interpret(sent_datagrams, primary_datagrams, secondary_datagrams)

merge_bounces(sent_datagrams, primary_bounced, secondary_bounced)

Merge two bounced replies from a broken ring.

When both ports receive their own frame back (bounce-back), each side only processed the slaves reachable from that port. This function merges the complementary data using byte-level logical merge for commands 10/11/12.