Struct sim::trips::TripManager [−][src]
pub(crate) struct TripManager { trips: Vec<Trip>, people: Vec<Person>, active_trip_mode: BTreeMap<AgentID, TripID>, unfinished_trips: usize, car_id_counter: usize, events: Vec<Event>, }
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/tech/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]
impl TripManager
[src]pub fn new() -> TripManager
[src]
pub fn new_person(
&mut self,
orig_id: Option<OrigPersonID>,
ped_speed: Speed,
vehicle_specs: Vec<VehicleSpec>
) -> &Person
[src]
&mut self,
orig_id: Option<OrigPersonID>,
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]
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<'_>
)
impl TripManager
[src]
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]
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]
impl Clone for TripManager
[src]fn clone(&self) -> TripManager
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'de> Deserialize<'de> 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]
impl Serialize for TripManager
[src]Auto Trait Implementations
impl RefUnwindSafe for TripManager
impl Send for TripManager
impl Sync for TripManager
impl Unpin for TripManager
impl UnwindSafe for TripManager
Blanket Implementations
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
impl<T> Instrument 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> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,