[−][src]Struct sim::Sim
The Sim ties together all the pieces of the simulation. Its main property is the current time.
Fields
driving: DrivingSimState
parking: ParkingSimState
walking: WalkingSimState
intersections: IntersectionSimState
transit: TransitSimState
cap: CapSimState
trips: TripManager
pandemic: Option<PandemicModel>
scheduler: Scheduler
time: Time
map_name: MapName
edits_name: String
run_name: String
step_count: usize
analytics: Analytics
recorder: Option<TrafficRecorder>
alerts: AlertHandler
Implementations
impl Sim
[src]
pub fn time(&self) -> Time
[src]
pub fn is_done(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn num_trips(&self) -> (usize, usize)
[src]
(number of finished trips, number of unfinished trips)
pub fn num_agents(&self) -> Counter<AgentType>
[src]
pub fn num_commuters_vehicles(&self) -> CommutersVehiclesCounts
[src]
pub fn num_ppl(&self) -> (usize, usize, usize)
[src]
(total number of people, just in buildings, just off map)
pub fn debug_ped(&self, id: PedestrianID)
[src]
pub fn debug_car(&self, id: CarID)
[src]
pub fn debug_intersection(&self, id: IntersectionID, map: &Map)
[src]
pub fn debug_lane(&self, id: LaneID)
[src]
pub fn agent_properties(&self, id: AgentID) -> AgentProperties
[src]
Only call for active agents, will panic otherwise
pub fn num_transit_passengers(&self, car: CarID) -> usize
[src]
pub fn bus_route_id(&self, maybe_bus: CarID) -> Option<BusRouteID>
[src]
pub fn active_agents(&self) -> Vec<AgentID>
[src]
pub fn num_active_agents(&self) -> usize
[src]
pub fn agent_to_trip(&self, id: AgentID) -> Option<TripID>
[src]
pub fn trip_to_agent(&self, id: TripID) -> TripResult<AgentID>
[src]
pub fn trip_info(&self, id: TripID) -> TripInfo
[src]
pub fn all_trip_info(&self) -> Vec<(TripID, TripInfo)>
[src]
pub fn finished_trip_time(&self, id: TripID) -> Option<(Duration, Duration)>
[src]
If trip is finished, returns (total time, total waiting time)
pub fn trip_blocked_time(&self, id: TripID) -> Duration
[src]
pub fn trip_to_person(&self, id: TripID) -> PersonID
[src]
pub fn agent_to_person(&self, id: AgentID) -> Option<PersonID>
[src]
pub fn person_to_agent(&self, id: PersonID) -> Option<AgentID>
[src]
pub fn get_owner_of_car(&self, id: CarID) -> Option<PersonID>
[src]
pub fn lookup_parked_car(&self, id: CarID) -> Option<&ParkedCar>
[src]
pub fn all_parked_car_positions(&self, map: &Map) -> Vec<(Position, Position)>
[src]
For every parked car, (position of parking spot, position of owner)
pub fn lookup_person(&self, id: PersonID) -> Option<&Person>
[src]
pub fn get_person(&self, id: PersonID) -> &Person
[src]
pub fn find_person_by_orig_id(&self, id: OrigPersonID) -> Option<PersonID>
[src]
pub fn get_all_people(&self) -> &Vec<Person>
[src]
pub fn lookup_car_id(&self, idx: usize) -> Option<CarID>
[src]
pub fn get_path(&self, id: AgentID) -> Option<&Path>
[src]
pub fn get_all_driving_paths(&self) -> Vec<&Path>
[src]
pub fn trace_route(
&self,
id: AgentID,
map: &Map,
dist_ahead: Option<Distance>
) -> Option<PolyLine>
[src]
&self,
id: AgentID,
map: &Map,
dist_ahead: Option<Distance>
) -> Option<PolyLine>
pub fn get_canonical_pt_per_trip(
&self,
trip: TripID,
map: &Map
) -> TripResult<Pt2D>
[src]
&self,
trip: TripID,
map: &Map
) -> TripResult<Pt2D>
pub fn get_canonical_pt_per_person(
&self,
p: PersonID,
map: &Map
) -> Option<Pt2D>
[src]
&self,
p: PersonID,
map: &Map
) -> Option<Pt2D>
pub fn canonical_pt_for_agent(&self, id: AgentID, map: &Map) -> Option<Pt2D>
[src]
pub fn get_accepted_agents(&self, id: IntersectionID) -> Vec<(AgentID, TurnID)>
[src]
pub fn get_waiting_agents(
&self,
id: IntersectionID
) -> Vec<(AgentID, TurnID, Time)>
[src]
&self,
id: IntersectionID
) -> Vec<(AgentID, TurnID, Time)>
pub fn get_blocked_by(&self, a: AgentID) -> HashSet<AgentID>
[src]
pub fn status_of_buses(
&self,
route: BusRouteID,
map: &Map
) -> Vec<(CarID, Option<usize>, f64, Pt2D)>
[src]
&self,
route: BusRouteID,
map: &Map
) -> Vec<(CarID, Option<usize>, f64, Pt2D)>
(bus, stop index it's coming from, percent to next stop, location)
pub fn get_analytics(&self) -> &Analytics
[src]
pub fn find_blockage_front(&self, car: CarID, map: &Map) -> String
[src]
pub fn delayed_intersections(
&self,
threshold: Duration
) -> Vec<(IntersectionID, Time)>
[src]
&self,
threshold: Duration
) -> Vec<(IntersectionID, Time)>
For intersections with an agent waiting beyond some threshold, return when they started waiting. Sorted by earliest waiting (likely the root cause of gridlock).
pub fn bldg_to_people(&self, b: BuildingID) -> Vec<PersonID>
[src]
pub fn get_pandemic_model(&self) -> Option<&PandemicModel>
[src]
pub fn get_end_of_day(&self) -> Time
[src]
pub fn current_stage_and_remaining_time(
&self,
i: IntersectionID
) -> (usize, Duration)
[src]
&self,
i: IntersectionID
) -> (usize, Duration)
pub fn all_arrivals_at_border(
&self,
i: IntersectionID
) -> Vec<(AgentType, Vec<(Time, usize)>)>
[src]
&self,
i: IntersectionID
) -> Vec<(AgentType, Vec<(Time, usize)>)>
pub fn target_lane_penalty(&self, lane: &Lane) -> (usize, usize)
[src]
(number of vehicles in the lane, penalty if a bike or other slow vehicle is present)
pub fn get_people_waiting_at_stop(
&self,
at: BusStopID
) -> &Vec<(PedestrianID, BusRouteID, Option<BusStopID>, Time)>
[src]
&self,
at: BusStopID
) -> &Vec<(PedestrianID, BusRouteID, Option<BusStopID>, Time)>
pub fn generate_scenario(&self, map: &Map, name: String) -> Scenario
[src]
pub fn get_cap_counter(&self, l: LaneID) -> usize
[src]
pub fn infinite_parking(&self) -> bool
[src]
pub fn all_waiting_people(&self) -> BTreeMap<PersonID, Duration>
[src]
pub fn describe_internal_stats(&self) -> Vec<String>
[src]
pub fn debug_queue_lengths(&self, l: LaneID) -> Option<(Distance, Distance)>
[src]
impl Sim
[src]
pub fn step_count(&self) -> usize
[src]
pub fn get_draw_car(&self, id: CarID, map: &Map) -> Option<DrawCarInput>
[src]
pub fn get_draw_ped(
&self,
id: PedestrianID,
map: &Map
) -> Option<DrawPedestrianInput>
[src]
&self,
id: PedestrianID,
map: &Map
) -> Option<DrawPedestrianInput>
pub fn get_draw_cars(&self, on: Traversable, map: &Map) -> Vec<DrawCarInput>
[src]
pub fn get_draw_peds(
&self,
on: Traversable,
map: &Map
) -> (Vec<DrawPedestrianInput>, Vec<DrawPedCrowdInput>)
[src]
&self,
on: Traversable,
map: &Map
) -> (Vec<DrawPedestrianInput>, Vec<DrawPedCrowdInput>)
pub fn get_all_draw_cars(&self, map: &Map) -> Vec<DrawCarInput>
[src]
pub fn get_all_draw_peds(&self, map: &Map) -> Vec<DrawPedestrianInput>
[src]
pub fn get_unzoomed_agents(&self, map: &Map) -> Vec<UnzoomedAgent>
[src]
impl Sim
[src]
pub fn new(map: &Map, opts: SimOptions, timer: &mut Timer<'_>) -> Sim
[src]
pub(crate) fn flush_spawner(
&mut self,
spawner: TripSpawner,
map: &Map,
timer: &mut Timer<'_>
)
[src]
&mut self,
spawner: TripSpawner,
map: &Map,
timer: &mut Timer<'_>
)
pub fn get_free_onstreet_spots(&self, l: LaneID) -> Vec<ParkingSpot>
[src]
pub fn get_free_offstreet_spots(&self, b: BuildingID) -> Vec<ParkingSpot>
[src]
pub fn get_free_lot_spots(&self, pl: ParkingLotID) -> Vec<ParkingSpot>
[src]
pub fn get_all_parking_spots(&self) -> (Vec<ParkingSpot>, Vec<ParkingSpot>)
[src]
(Filled, available)
pub fn bldg_to_parked_cars(&self, b: BuildingID) -> Vec<CarID>
[src]
pub fn walking_path_to_nearest_parking_spot(
&self,
map: &Map,
b: BuildingID
) -> Option<(Path, Distance)>
[src]
&self,
map: &Map,
b: BuildingID
) -> Option<(Path, Distance)>
Also returns the start distance of the building. TODO Do that in the Path properly.
pub(crate) fn new_person(
&mut self,
p: PersonID,
orig_id: Option<OrigPersonID>,
ped_speed: Speed,
vehicle_specs: Vec<VehicleSpec>
)
[src]
&mut self,
p: PersonID,
orig_id: Option<OrigPersonID>,
ped_speed: Speed,
vehicle_specs: Vec<VehicleSpec>
)
pub(crate) fn seed_parked_car(&mut self, vehicle: Vehicle, spot: ParkingSpot)
[src]
pub(crate) fn seed_bus_route(&mut self, route: &BusRoute)
[src]
fn start_bus(&mut self, route: &BusRoute, map: &Map)
[src]
pub fn set_name(&mut self, name: String)
[src]
impl Sim
[src]
fn minimal_step(
&mut self,
map: &Map,
max_dt: Duration,
maybe_cb: &mut Option<Box<dyn SimCallback>>
) -> bool
[src]
&mut self,
map: &Map,
max_dt: Duration,
maybe_cb: &mut Option<Box<dyn SimCallback>>
) -> bool
fn do_step(
&mut self,
map: &Map,
time: Time,
cmd: Command,
maybe_cb: &mut Option<Box<dyn SimCallback>>
) -> bool
[src]
&mut self,
map: &Map,
time: Time,
cmd: Command,
maybe_cb: &mut Option<Box<dyn SimCallback>>
) -> bool
fn dispatch_events(&mut self, events: Vec<Event>, map: &Map)
[src]
pub fn timed_step(
&mut self,
map: &Map,
dt: Duration,
maybe_cb: &mut Option<Box<dyn SimCallback>>,
timer: &mut Timer<'_>
)
[src]
&mut self,
map: &Map,
dt: Duration,
maybe_cb: &mut Option<Box<dyn SimCallback>>,
timer: &mut Timer<'_>
)
pub fn tiny_step(
&mut self,
map: &Map,
maybe_cb: &mut Option<Box<dyn SimCallback>>
)
[src]
&mut self,
map: &Map,
maybe_cb: &mut Option<Box<dyn SimCallback>>
)
pub fn time_limited_step(
&mut self,
map: &Map,
dt: Duration,
real_time_limit: Duration,
maybe_cb: &mut Option<Box<dyn SimCallback>>
)
[src]
&mut self,
map: &Map,
dt: Duration,
real_time_limit: Duration,
maybe_cb: &mut Option<Box<dyn SimCallback>>
)
pub fn dump_before_abort(&self)
[src]
impl Sim
[src]
pub fn save_dir(&self) -> String
[src]
fn save_path(&self, base_time: Time) -> String
[src]
pub fn save(&mut self) -> String
[src]
pub fn find_previous_savestate(&self, base_time: Time) -> Option<String>
[src]
pub fn find_next_savestate(&self, base_time: Time) -> Option<String>
[src]
pub fn load_savestate(
path: String,
map: &Map,
timer: &mut Timer<'_>
) -> Result<Sim, Box<dyn Error>>
[src]
path: String,
map: &Map,
timer: &mut Timer<'_>
) -> Result<Sim, Box<dyn Error>>
pub fn restore_paths(&mut self, map: &Map, timer: &mut Timer<'_>)
[src]
impl Sim
[src]
pub fn handle_live_edited_traffic_signals(&mut self, map: &Map)
[src]
pub fn handle_live_edits(&mut self, map: &Map) -> (usize, usize)
[src]
Respond to arbitrary map edits without resetting the simulation. Returns the number of (trips cancelled, parked cars displaced).
fn find_trips_affected_by_live_edits(
&mut self,
map: &Map
) -> (BTreeSet<(AgentID, TripID)>, usize)
[src]
&mut self,
map: &Map
) -> (BTreeSet<(AgentID, TripID)>, usize)
Returns (trips affected, number of parked cars displaced)
impl Sim
[src]
pub fn delete_car(&mut self, id: CarID, map: &Map)
[src]
pub fn clear_alerts(&mut self) -> Vec<(Time, AlertLocation, String)>
[src]
impl Sim
[src]
pub fn set_periodic_callback(&mut self, frequency: Duration)
[src]
Only one at a time supported.
pub fn unset_periodic_callback(&mut self)
[src]
impl Sim
[src]
pub fn record_traffic_for(&mut self, intersections: BTreeSet<IntersectionID>)
[src]
pub fn num_recorded_trips(&self) -> Option<usize>
[src]
pub fn save_recorded_traffic(&mut self, map: &Map)
[src]
Trait Implementations
impl Clone for Sim
[src]
impl<'de> Deserialize<'de> for Sim
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for Sim
[src]
Auto Trait Implementations
impl RefUnwindSafe for Sim
impl Send for Sim
impl Sync for Sim
impl Unpin for Sim
impl UnwindSafe for Sim
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,
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,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DowncastSync for T where
T: Send + Sync + Any,
T: Send + Sync + Any,
impl<T> From<T> for T
[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.
fn to_owned(&self) -> T
[src]
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.
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.
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>,