Skip to content

A Rust library that provides types and traits for representing driveways and common track elements.

Notifications You must be signed in to change notification settings

simulate-digital-rail/track_element

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

track_element

This crate provides types and traits to represent and interact with common track elements. It includes types for:

  • Points
  • KS Light Signals
  • Vacancy Sections

Furthermore, it defines the Driveway type around which our interlocking architecture is built. In our model, a driveway is defined as a set of track elements with target states.

Furthermore, this crate defines a basic CLI control station that is useful for testing purposes.

Example

// Create the elements of the driveway
let p1 = Point::new_arc(PointState::Left, "P1".to_string());
let p2 = Point::new_arc(PointState::Left, "P2".to_string());
let s = Signal::new_arc(
    SignalState::default(),
    SupportedSignalStates::default()
        .main(&mut vec![MainSignalState::Hp0, MainSignalState::Ks1]),
    "S".to_string(),
    None,
);

// Define its target state
let ts = DrivewayState::new(
    vec![
        (p1.clone(), PointState::Right),
        (p2.clone(), PointState::Left),
    ],
    vec![(s.clone(), (MainSignalState::Ks1).into())],
    vec![],
);

let mut dw = Driveway::new(Vec::new(), ts, s.clone(), s.clone());

About

A Rust library that provides types and traits for representing driveways and common track elements.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages