Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

Onboard dispatcher: executes a dispatchable network online, without allocation.

A dispatchable network is a set of DispatchEdges (t_to - t_from <= weight) and Waits over executable and contingent time points. The ground side derives it from an Stn or a dynamically controllable Stnu; the onboard side only loads and executes it.

§Execution semantics

The dispatcher keeps, per time point, a window [lb, ub] (initially unbounded) and the number of precedence edges x -> y (defined below) whose head y has not happened yet. When a time point happens at t (executed by the agent or observed for a contingent point), the dispatcher propagates only along that point’s own edges:

  • edge x -> y with weight w and x happened: ub[y] = min(ub[y], t + w);
  • edge y -> x with weight w and x happened: lb[y] = max(lb[y], t - w).

An edge x -> y with weight w < 0 is a precedence edge: y must happen strictly before x. A consistent network has no cycle of precedence edges. Zero-weight edges are not precedence edges; x may happen first and then caps y’s window at its own time.

An executable point x may execute at now iff it has not happened, every precedence edge x -> y has y happened, lb[x] <= now <= ub[x], and every wait (x, c, d) is satisfied: c has been observed, or its activation point happened at a and now >= a + d.

Reaction time. Within one tick, observations are processed first, so a point may execute in the same tick in which a contingent point it waits for was observed (instantaneous reaction at tick granularity). Dispatcher::step follows that order.

stateDiagram-v2
    [*] --> Waiting
    Waiting --> Enabled: all negative-edge heads happened
    Enabled --> Executable: lb <= now, waits satisfied
    Executable --> Happened: execute(now)
    Executable --> Missed: now > ub
    Happened --> [*]

§Memory

Dispatcher has fixed capacities: N time points and E adjacency entries. Every edge takes two entries (one per endpoint) and every wait one. Work per event is O(degree); Dispatcher::step is O(N * degree) per executed point. Internal handles are stored in an Index type (usize by default, or u16/u32).

Re-exports§

pub use encoding::DecodeError;
pub use encoding::EncodeError;

Modules§

encoding
Compact, checksummed binary encoding of a dispatchable network.

Structs§

DispatchEdge
A dispatchable edge t_to - t_from <= weight.
DispatchableNetwork
A dispatchable network produced on the ground, ready to load into a Dispatcher.
Dispatcher
Fixed-capacity online dispatcher for up to N time points and E adjacency entries, storing internal handles as I (see Index).
Wait
A wait: waiter must not execute before activation(contingent) + delay, unless contingent has been observed first.

Enums§

DispatchError
Reasons a dispatcher call failed or detected a problem.
PointKind
What kind of time point a dispatcher node is.

Traits§

Index
Unsigned integer type a Dispatcher stores point and entry handles in: u16, u32 or usize (the default).