[][src]Struct sim::mechanics::driving::DrivingSimState

pub struct DrivingSimState {
    cars: FixedMap<CarID, Car>,
    queues: BTreeMap<Traversable, Queue>,
    events: Vec<Event>,
    recalc_lanechanging: bool,
    handle_uber_turns: bool,
    time_to_unpark_onstreet: Duration,
    time_to_park_onstreet: Duration,
    time_to_unpark_offstreet: Duration,
    time_to_park_offstreet: Duration,
}

Simulates vehicles!

Fields

cars: FixedMap<CarID, Car>queues: BTreeMap<Traversable, Queue>events: Vec<Event>recalc_lanechanging: boolhandle_uber_turns: booltime_to_unpark_onstreet: Durationtime_to_park_onstreet: Durationtime_to_unpark_offstreet: Durationtime_to_park_offstreet: Duration

Implementations

impl DrivingSimState[src]

pub fn new(map: &Map, opts: &SimOptions) -> DrivingSimState[src]

pub fn start_car_on_lane(
    &mut self,
    now: Time,
    params: CreateCar,
    map: &Map,
    intersections: &IntersectionSimState,
    parking: &ParkingSimState,
    scheduler: &mut Scheduler
) -> bool
[src]

True if it worked

pub fn update_car(
    &mut self,
    id: CarID,
    now: Time,
    ctx: &mut Ctx<'_>,
    trips: &mut TripManager,
    transit: &mut TransitSimState,
    walking: &mut WalkingSimState
)
[src]

State transitions for this car:

Crossing -> Queued or WaitingToAdvance Unparking -> Crossing IdlingAtStop -> Crossing Queued -> last step handling (Parking or done) WaitingToAdvance -> try to advance to the next step of the path Parking -> done

State transitions for other cars:

Crossing -> Crossing (recalculate dist/time) Queued -> Crossing

Why is it safe to process cars in any order, rather than making sure to follow the order of queues? Because of the invariant that distances should never suddenly jump when a car has entered/exiting a queue. This car might have reached the router's end distance, but maybe not -- might actually be stuck behind other cars. We have to calculate the distances right now to be sure.

fn update_car_without_distances(
    &mut self,
    car: &mut Car,
    now: Time,
    ctx: &mut Ctx<'_>,
    transit: &mut TransitSimState
) -> bool
[src]

fn update_car_with_distances(
    &mut self,
    car: &mut Car,
    dists: &Vec<(CarID, Distance)>,
    idx: usize,
    now: Time,
    ctx: &mut Ctx<'_>,
    trips: &mut TripManager,
    transit: &mut TransitSimState,
    walking: &mut WalkingSimState
) -> bool
[src]

pub fn delete_car(&mut self, c: CarID, now: Time, ctx: &mut Ctx<'_>) -> Vehicle[src]

fn delete_car_internal(
    &mut self,
    car: &mut Car,
    dists: Vec<(CarID, Distance)>,
    idx: usize,
    now: Time,
    ctx: &mut Ctx<'_>
)
[src]

pub fn update_laggy_head(&mut self, id: CarID, now: Time, ctx: &mut Ctx<'_>)[src]

fn trim_last_steps(
    &mut self,
    car: &mut Car,
    now: Time,
    n: usize,
    ctx: &mut Ctx<'_>
)
[src]

pub fn get_unzoomed_agents(&self, now: Time, map: &Map) -> Vec<UnzoomedAgent>[src]

pub fn does_car_exist(&self, id: CarID) -> bool[src]

pub fn get_all_draw_cars(
    &self,
    now: Time,
    map: &Map,
    transit: &TransitSimState
) -> Vec<DrawCarInput>
[src]

pub fn get_single_draw_car(
    &self,
    id: CarID,
    now: Time,
    map: &Map,
    transit: &TransitSimState
) -> Option<DrawCarInput>
[src]

This is about as expensive as get_draw_cars_on.

pub fn get_draw_cars_on(
    &self,
    now: Time,
    on: Traversable,
    map: &Map,
    transit: &TransitSimState
) -> Vec<DrawCarInput>
[src]

pub fn debug_car(&self, id: CarID)[src]

pub fn debug_lane(&self, id: LaneID)[src]

pub fn agent_properties(&self, id: CarID, now: Time) -> AgentProperties[src]

pub fn get_path(&self, id: CarID) -> Option<&Path>[src]

pub fn get_all_driving_paths(&self) -> Vec<&Path>[src]

pub fn trace_route(
    &self,
    now: Time,
    id: CarID,
    map: &Map,
    dist_ahead: Option<Distance>
) -> Option<PolyLine>
[src]

pub fn percent_along_route(&self, id: CarID) -> f64[src]

pub fn get_owner_of_car(&self, id: CarID) -> Option<PersonID>[src]

pub fn find_blockage_front(
    &self,
    start: CarID,
    map: &Map,
    intersections: &IntersectionSimState
) -> String
[src]

pub fn collect_events(&mut self) -> Vec<Event>[src]

pub fn target_lane_penalty(&self, l: LaneID) -> (usize, usize)[src]

pub fn find_trips_to_edited_parking(
    &self,
    spots: BTreeSet<ParkingSpot>
) -> Vec<(AgentID, TripID)>
[src]

pub fn all_waiting_people(
    &self,
    now: Time,
    delays: &mut BTreeMap<PersonID, Duration>
)
[src]

Trait Implementations

impl Clone for DrivingSimState[src]

impl<'de> Deserialize<'de> for DrivingSimState[src]

impl Serialize for DrivingSimState[src]

Auto Trait Implementations

impl RefUnwindSafe for DrivingSimState

impl Send for DrivingSimState

impl Sync for DrivingSimState

impl Unpin for DrivingSimState

impl UnwindSafe for DrivingSimState

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,