[−][src]Struct sim::trips::TripManager
Manages people, each of which executes some trips through the day. Each trip is further broken down into legs -- for example, a driving trip might start with somebody walking to their car, driving somewhere, parking, and then walking to their final destination. https://a-b-street.github.io/docs/trafficsim/trips.html describes some of the variations.
Fields
trips: Vec<Trip>
people: Vec<Person>
active_trip_mode: BTreeMap<AgentID, TripID>
unfinished_trips: usize
car_id_counter: usize
events: Vec<Event>
Implementations
impl TripManager
[src]
pub fn new() -> TripManager
[src]
pub fn new_person(
&mut self,
orig_id: Option<OrigPersonID>,
home: TripEndpoint,
ped_speed: Speed,
vehicle_specs: Vec<VehicleSpec>
) -> &Person
[src]
&mut self,
orig_id: Option<OrigPersonID>,
home: TripEndpoint,
ped_speed: Speed,
vehicle_specs: Vec<VehicleSpec>
) -> &Person
pub fn new_car_id(&mut self) -> usize
[src]
pub fn new_trip(&mut self, person: PersonID, info: TripInfo) -> TripID
[src]
pub fn start_trip(
&mut self,
now: Time,
trip: TripID,
args: StartTripArgs,
ctx: &mut Ctx<'_>
)
[src]
&mut self,
now: Time,
trip: TripID,
args: StartTripArgs,
ctx: &mut Ctx<'_>
)
pub fn collect_events(&mut self) -> Vec<Event>
[src]
impl TripManager
[src]
pub fn agent_starting_trip_leg(&mut self, agent: AgentID, t: TripID)
[src]
This is idempotent to handle the case of cars retrying their spawning.
pub fn car_reached_parking_spot(
&mut self,
now: Time,
car: CarID,
spot: ParkingSpot,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
[src]
&mut self,
now: Time,
car: CarID,
spot: ParkingSpot,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
pub fn ped_reached_parking_spot(
&mut self,
now: Time,
ped: PedestrianID,
spot: ParkingSpot,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
[src]
&mut self,
now: Time,
ped: PedestrianID,
spot: ParkingSpot,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
pub fn ped_ready_to_bike(
&mut self,
now: Time,
ped: PedestrianID,
spot: SidewalkSpot,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
[src]
&mut self,
now: Time,
ped: PedestrianID,
spot: SidewalkSpot,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
pub fn bike_reached_end(
&mut self,
now: Time,
bike: CarID,
bike_rack: SidewalkSpot,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
[src]
&mut self,
now: Time,
bike: CarID,
bike_rack: SidewalkSpot,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
pub fn ped_reached_building(
&mut self,
now: Time,
ped: PedestrianID,
bldg: BuildingID,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
[src]
&mut self,
now: Time,
ped: PedestrianID,
bldg: BuildingID,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
pub fn ped_reached_bus_stop(
&mut self,
now: Time,
ped: PedestrianID,
stop: BusStopID,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>,
transit: &mut TransitSimState
) -> Option<BusRouteID>
[src]
&mut self,
now: Time,
ped: PedestrianID,
stop: BusStopID,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>,
transit: &mut TransitSimState
) -> Option<BusRouteID>
If no route is returned, the pedestrian boarded a bus immediately.
pub fn ped_boarded_bus(
&mut self,
now: Time,
ped: PedestrianID,
bus: CarID,
blocked_time: Duration,
walking: &mut WalkingSimState
) -> (TripID, PersonID)
[src]
&mut self,
now: Time,
ped: PedestrianID,
bus: CarID,
blocked_time: Duration,
walking: &mut WalkingSimState
) -> (TripID, PersonID)
pub fn person_left_bus(
&mut self,
now: Time,
person: PersonID,
bus: CarID,
ctx: &mut Ctx<'_>
)
[src]
&mut self,
now: Time,
person: PersonID,
bus: CarID,
ctx: &mut Ctx<'_>
)
pub fn ped_reached_border(
&mut self,
now: Time,
ped: PedestrianID,
i: IntersectionID,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
[src]
&mut self,
now: Time,
ped: PedestrianID,
i: IntersectionID,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
pub fn transit_rider_reached_border(
&mut self,
now: Time,
person: PersonID,
bus: CarID,
ctx: &mut Ctx<'_>
)
[src]
&mut self,
now: Time,
person: PersonID,
bus: CarID,
ctx: &mut Ctx<'_>
)
pub fn car_or_bike_reached_border(
&mut self,
now: Time,
car: CarID,
i: IntersectionID,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
[src]
&mut self,
now: Time,
car: CarID,
i: IntersectionID,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
fn trip_finished(&mut self, now: Time, id: TripID, ctx: &mut Ctx<'_>)
[src]
fn start_delayed_trip(&mut self, now: Time, id: PersonID, ctx: &mut Ctx<'_>)
[src]
fn spawn_ped(
&mut self,
now: Time,
id: TripID,
start: SidewalkSpot,
ctx: &mut Ctx<'_>
)
[src]
&mut self,
now: Time,
id: TripID,
start: SidewalkSpot,
ctx: &mut Ctx<'_>
)
fn maybe_spawn_car(
&mut self,
ctx: &mut Ctx<'_>,
now: Time,
trip: TripID,
req: PathRequest,
car: CarID
) -> Result<Path>
[src]
&mut self,
ctx: &mut Ctx<'_>,
now: Time,
trip: TripID,
req: PathRequest,
car: CarID
) -> Result<Path>
Returns the path to use if successful. Caller is responsible for handling both the success and failure case.
impl TripManager
[src]
pub fn cancel_unstarted_trip(&mut self, id: TripID, reason: String)
[src]
Cancel a trip before it's started. The person will stay where they are.
pub fn cancel_trip(
&mut self,
now: Time,
id: TripID,
reason: String,
abandoned_vehicle: Option<Vehicle>,
ctx: &mut Ctx<'_>
)
[src]
&mut self,
now: Time,
id: TripID,
reason: String,
abandoned_vehicle: Option<Vehicle>,
ctx: &mut Ctx<'_>
)
Cancel a trip after it's started. The person will be magically warped to their destination, along with their car, as if the trip had completed normally.
pub fn trip_abruptly_cancelled(&mut self, trip: TripID, agent: AgentID)
[src]
impl TripManager
[src]
pub fn active_agents(&self) -> Vec<AgentID>
[src]
pub fn active_agents_and_trips(&self) -> &BTreeMap<AgentID, TripID>
[src]
pub fn num_active_agents(&self) -> usize
[src]
pub fn trip_to_agent(&self, id: TripID) -> TripResult<AgentID>
[src]
pub fn agent_to_trip(&self, id: AgentID) -> Option<TripID>
[src]
This will be None for parked cars and buses. Should always work for pedestrians.
pub fn debug_trip(&self, id: AgentID)
[src]
pub fn num_trips(&self) -> (usize, usize)
[src]
pub fn num_agents(&self, transit: &TransitSimState) -> Counter<AgentType>
[src]
pub fn num_commuters_vehicles(
&self,
transit: &TransitSimState,
walking: &WalkingSimState
) -> CommutersVehiclesCounts
[src]
&self,
transit: &TransitSimState,
walking: &WalkingSimState
) -> CommutersVehiclesCounts
pub fn num_ppl(&self) -> (usize, usize, usize)
[src]
pub fn is_done(&self) -> bool
[src]
pub fn trip_info(&self, id: TripID) -> TripInfo
[src]
pub fn all_trip_info(&self) -> Vec<(TripID, TripInfo)>
[src]
pub fn finished_trip_details(
&self,
id: TripID
) -> Option<(Duration, Duration, Distance)>
[src]
&self,
id: TripID
) -> Option<(Duration, Duration, Distance)>
pub fn trip_blocked_time(&self, id: TripID) -> Duration
[src]
pub fn bldg_to_people(&self, b: BuildingID) -> Vec<PersonID>
[src]
pub fn get_person(&self, p: PersonID) -> Option<&Person>
[src]
pub fn get_all_people(&self) -> &Vec<Person>
[src]
pub fn trip_to_person(&self, id: TripID) -> Option<PersonID>
[src]
pub fn all_arrivals_at_border(
&self,
at: IntersectionID
) -> Vec<(Time, AgentType)>
[src]
&self,
at: IntersectionID
) -> Vec<(Time, AgentType)>
pub fn generate_scenario(&self, map: &Map, name: String) -> Scenario
[src]
Recreate the Scenario from an instantiated simulation. The results should match the original Scenario used.
Trait Implementations
impl Clone for TripManager
[src]
fn clone(&self) -> TripManager
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for TripManager
[src]
impl<'de> Deserialize<'de> for TripManager
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for TripManager
[src]
Auto Trait Implementations
impl RefUnwindSafe for TripManager
[src]
impl Send for TripManager
[src]
impl Sync for TripManager
[src]
impl Unpin for TripManager
[src]
impl UnwindSafe for TripManager
[src]
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: Send + Sync + Any,
T: Send + Sync + Any,
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>,