Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

Pluggable dispatch strategies (SCAN, LOOK, nearest-car, ETD). Pluggable dispatch strategies for assigning elevators to stops.

§Example: custom dispatch strategy

use elevator_core::prelude::*;
use elevator_core::dispatch::{
    DispatchDecision, DispatchManifest, ElevatorGroup,
};

struct AlwaysFirstStop;

impl DispatchStrategy for AlwaysFirstStop {
    fn decide(
        &mut self,
        _elevator: EntityId,
        _elevator_position: f64,
        group: &ElevatorGroup,
        _manifest: &DispatchManifest,
        _world: &elevator_core::world::World,
    ) -> DispatchDecision {
        group.stop_entities().first()
            .map(|&stop| DispatchDecision::GoToStop(stop))
            .unwrap_or(DispatchDecision::Idle)
    }
}

let sim = SimulationBuilder::demo()
    .dispatch(AlwaysFirstStop)
    .build()
    .unwrap();

Re-exports§

pub use destination::AssignedCar;
pub use destination::DestinationDispatch;
pub use etd::EtdDispatch;
pub use look::LookDispatch;
pub use nearest_car::NearestCarDispatch;
pub use scan::ScanDispatch;

Modules§

destination
Hall-call destination dispatch algorithm. Hall-call destination dispatch (“DCS”).
etd
Estimated Time to Destination dispatch algorithm. Estimated Time to Destination (ETD) dispatch algorithm.
look
LOOK dispatch algorithm. LOOK dispatch algorithm — reverses at the last request, not the shaft end.
nearest_car
Nearest-car dispatch algorithm. Nearest-car dispatch — assigns each call to the closest idle elevator.
reposition
Built-in repositioning strategies. Built-in repositioning strategies for idle elevators.
scan
SCAN dispatch algorithm. SCAN (elevator) dispatch algorithm — sweeps end-to-end before reversing.

Structs§

DispatchManifest
Full demand picture for dispatch decisions.
ElevatorGroup
Runtime elevator group: a set of lines sharing a dispatch strategy.
LineInfo
Per-line relationship data within an ElevatorGroup.
RiderInfo
Metadata about a single rider, available to dispatch strategies.

Enums§

BuiltinReposition
Serializable identifier for built-in repositioning strategies.
BuiltinStrategy
Serializable identifier for built-in dispatch strategies.
DispatchDecision
Decision returned by a dispatch strategy.

Traits§

DispatchStrategy
Pluggable dispatch algorithm.
RepositionStrategy
Pluggable strategy for repositioning idle elevators.