Struct sim::mechanics::driving::DrivingSimState [−][src]
Simulates vehicles!
Fields
cars: FixedMap<CarID, Car>
queues: HashMap<Traversable, Queue>
events: Vec<Event>
waiting_to_spawn: BTreeMap<CarID, (Position, Option<PersonID>)>
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
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,
ctx: &mut Ctx<'_>
) -> Option<CreateCar>
[src]
&mut self,
now: Time,
params: CreateCar,
ctx: &mut Ctx<'_>
) -> Option<CreateCar>
None if it worked, otherwise returns the CreateCar unmodified for possible retry.
pub fn vehicle_waiting_to_spawn(
&mut self,
id: CarID,
pos: Position,
person: Option<PersonID>
)
[src]
&mut self,
id: CarID,
pos: Position,
person: Option<PersonID>
)
If start_car_on_lane fails and a retry is scheduled, this is an idempotent way to mark the vehicle as active, but waiting to spawn.
pub fn update_car(
&mut self,
id: CarID,
now: Time,
ctx: &mut Ctx<'_>,
trips: &mut TripManager,
transit: &mut TransitSimState,
walking: &mut WalkingSimState
)
[src]
&mut self,
id: CarID,
now: Time,
ctx: &mut Ctx<'_>,
trips: &mut TripManager,
transit: &mut TransitSimState,
walking: &mut WalkingSimState
)
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]
&mut self,
car: &mut Car,
now: Time,
ctx: &mut Ctx<'_>,
transit: &mut TransitSimState
) -> bool
fn update_car_with_distances(
&mut self,
car: &mut Car,
dists: &[(CarID, Distance)],
idx: usize,
now: Time,
ctx: &mut Ctx<'_>,
trips: &mut TripManager,
transit: &mut TransitSimState,
walking: &mut WalkingSimState
) -> bool
[src]
&mut self,
car: &mut Car,
dists: &[(CarID, Distance)],
idx: usize,
now: Time,
ctx: &mut Ctx<'_>,
trips: &mut TripManager,
transit: &mut TransitSimState,
walking: &mut WalkingSimState
) -> bool
pub fn delete_car(&mut self, c: CarID, now: Time, ctx: &mut Ctx<'_>) -> Vehicle
[src]
Abruptly remove a vehicle from the simulation. They may be in any arbitrary state, like in the middle of a turn or parking.
fn delete_car_internal(
&mut self,
car: &mut Car,
dists: Vec<(CarID, Distance)>,
idx: usize,
now: Time,
ctx: &mut Ctx<'_>
)
[src]
&mut self,
car: &mut Car,
dists: Vec<(CarID, Distance)>,
idx: usize,
now: Time,
ctx: &mut Ctx<'_>
)
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]
&mut self,
car: &mut Car,
now: Time,
n: usize,
ctx: &mut Ctx<'_>
)
pub fn collect_events(&mut self) -> Vec<Event>
[src]
pub fn handle_live_edits(&mut self, map: &Map)
[src]
impl DrivingSimState
[src]
pub fn get_unzoomed_agents(&self, now: Time, map: &Map) -> Vec<UnzoomedAgent>
[src]
Note the ordering of results is non-deterministic!
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]
&self,
now: Time,
map: &Map,
transit: &TransitSimState
) -> Vec<DrawCarInput>
Note the ordering of results is non-deterministic!
pub fn get_single_draw_car(
&self,
id: CarID,
now: Time,
map: &Map,
transit: &TransitSimState
) -> Option<DrawCarInput>
[src]
&self,
id: CarID,
now: Time,
map: &Map,
transit: &TransitSimState
) -> Option<DrawCarInput>
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]
&self,
now: Time,
on: Traversable,
map: &Map,
transit: &TransitSimState
) -> Vec<DrawCarInput>
pub fn debug_car(&self, id: CarID)
[src]
pub fn debug_car_ui(&self, id: CarID) -> String
[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) -> 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 target_lane_penalty(&self, l: LaneID) -> (usize, usize)
[src]
pub fn find_trips_to_edited_parking(
&self,
spots: BTreeSet<ParkingSpot>
) -> Vec<(AgentID, TripID)>
[src]
&self,
spots: BTreeSet<ParkingSpot>
) -> Vec<(AgentID, TripID)>
pub fn find_vehicles_affected_by_live_edits(
&self,
closed_intersections: &HashSet<IntersectionID>,
edited_lanes: &BTreeSet<LaneID>
) -> Vec<(AgentID, TripID)>
[src]
&self,
closed_intersections: &HashSet<IntersectionID>,
edited_lanes: &BTreeSet<LaneID>
) -> Vec<(AgentID, TripID)>
Finds vehicles that’re laggy heads on affected parts of the map.
pub fn all_waiting_people(
&self,
now: Time,
delays: &mut BTreeMap<PersonID, Duration>
)
[src]
&self,
now: Time,
delays: &mut BTreeMap<PersonID, Duration>
)
pub fn debug_queue_lengths(&self, l: LaneID) -> Option<(Distance, Distance)>
[src]
pub fn get_blocked_by_graph(
&self,
now: Time,
map: &Map,
intersections: &IntersectionSimState
) -> BTreeMap<AgentID, (Duration, DelayCause)>
[src]
&self,
now: Time,
map: &Map,
intersections: &IntersectionSimState
) -> BTreeMap<AgentID, (Duration, DelayCause)>
fn get_car_front(&self, now: Time, car: &Car) -> Distance
[src]
fn wants_to_overtake(&self, car: &Car) -> Option<CarID>
[src]
Does the given car want to over-take the vehicle in front of it?
Trait Implementations
impl Clone for DrivingSimState
[src]
fn clone(&self) -> DrivingSimState
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'de> Deserialize<'de> for DrivingSimState
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> Downcast for T where
T: Any,
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DowncastSync for T where
T: Any + Send + Sync,
T: Any + Send + Sync,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,