mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-28 08:53:26 +03:00
intersection delay is broken down by agent type, not trip mode
This commit is contained in:
parent
233b662bfa
commit
68d3c5b340
@ -49,9 +49,9 @@ data/system/maps/montlake.bin,1232e900355ba1cb9837e2790c16870c,https://www.dropb
|
|||||||
data/system/maps/south_seattle.bin,bb701fcf4abe9330cfb58121d3e5bad7,https://www.dropbox.com/s/2kfgbtz2jd3xav2/south_seattle.bin.zip?dl=0
|
data/system/maps/south_seattle.bin,bb701fcf4abe9330cfb58121d3e5bad7,https://www.dropbox.com/s/2kfgbtz2jd3xav2/south_seattle.bin.zip?dl=0
|
||||||
data/system/maps/udistrict.bin,0dbd16d4b45a2efbf9d98d89054231bc,https://www.dropbox.com/s/1651xn91s8ihr2n/udistrict.bin.zip?dl=0
|
data/system/maps/udistrict.bin,0dbd16d4b45a2efbf9d98d89054231bc,https://www.dropbox.com/s/1651xn91s8ihr2n/udistrict.bin.zip?dl=0
|
||||||
data/system/maps/west_seattle.bin,57411a6e8a0ed843c96d35cf929af6ff,https://www.dropbox.com/s/iulfhcgsn4atduk/west_seattle.bin.zip?dl=0
|
data/system/maps/west_seattle.bin,57411a6e8a0ed843c96d35cf929af6ff,https://www.dropbox.com/s/iulfhcgsn4atduk/west_seattle.bin.zip?dl=0
|
||||||
data/system/prebaked_results/lakeslice/weekday.bin,6a9d066ef0f34ddce4611961a5fbee2e,https://www.dropbox.com/s/tnxikn11hjv3mmz/weekday.bin.zip?dl=0
|
data/system/prebaked_results/lakeslice/weekday.bin,119f695d602c0fbd6ff60ad0733b533a,https://www.dropbox.com/s/auuq2enda6t45gg/weekday.bin.zip?dl=0
|
||||||
data/system/prebaked_results/montlake/car vs bike contention.bin,fba6493b919e8cc50854088367e38d95,https://www.dropbox.com/s/jefg0ikjy9dsrdd/car%20vs%20bike%20contention.bin.zip?dl=0
|
data/system/prebaked_results/montlake/car vs bike contention.bin,fba6493b919e8cc50854088367e38d95,https://www.dropbox.com/s/jefg0ikjy9dsrdd/car%20vs%20bike%20contention.bin.zip?dl=0
|
||||||
data/system/prebaked_results/montlake/weekday.bin,4153a77f3b781172ce59da33c6dc4a38,https://www.dropbox.com/s/nbe8u7eptc50pwj/weekday.bin.zip?dl=0
|
data/system/prebaked_results/montlake/weekday.bin,e7f975ccf56b67dc31563286742118f1,https://www.dropbox.com/s/t3os651iqdck801/weekday.bin.zip?dl=0
|
||||||
data/system/scenarios/ballard/weekday.bin,97f3262146d9b84fe61326a81d9eef1a,https://www.dropbox.com/s/rmhxak4i3at7c76/weekday.bin.zip?dl=0
|
data/system/scenarios/ballard/weekday.bin,97f3262146d9b84fe61326a81d9eef1a,https://www.dropbox.com/s/rmhxak4i3at7c76/weekday.bin.zip?dl=0
|
||||||
data/system/scenarios/downtown/weekday.bin,18563e48427406a9ecf162f0e33a9649,https://www.dropbox.com/s/n36jlq6q7ghai21/weekday.bin.zip?dl=0
|
data/system/scenarios/downtown/weekday.bin,18563e48427406a9ecf162f0e33a9649,https://www.dropbox.com/s/n36jlq6q7ghai21/weekday.bin.zip?dl=0
|
||||||
data/system/scenarios/huge_seattle/weekday.bin,844d779efe4d20d3a40586dcca7d4ad5,https://www.dropbox.com/s/elf3cir98xyx7xj/weekday.bin.zip?dl=0
|
data/system/scenarios/huge_seattle/weekday.bin,844d779efe4d20d3a40586dcca7d4ad5,https://www.dropbox.com/s/elf3cir98xyx7xj/weekday.bin.zip?dl=0
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::app::App;
|
use crate::app::App;
|
||||||
use crate::helpers::color_for_mode;
|
use crate::helpers::color_for_agent_type;
|
||||||
use crate::info::{header_btns, make_tabs, throughput, DataOptions, Details, Tab};
|
use crate::info::{header_btns, make_tabs, throughput, DataOptions, Details, Tab};
|
||||||
use abstutil::prettyprint_usize;
|
use abstutil::prettyprint_usize;
|
||||||
use ezgui::{
|
use ezgui::{
|
||||||
@ -7,7 +7,7 @@ use ezgui::{
|
|||||||
};
|
};
|
||||||
use geom::{ArrowCap, Distance, Duration, PolyLine, Time};
|
use geom::{ArrowCap, Distance, Duration, PolyLine, Time};
|
||||||
use map_model::{IntersectionID, IntersectionType};
|
use map_model::{IntersectionID, IntersectionType};
|
||||||
use sim::TripMode;
|
use sim::AgentType;
|
||||||
use std::collections::{BTreeMap, BTreeSet};
|
use std::collections::{BTreeMap, BTreeSet};
|
||||||
|
|
||||||
pub fn info(ctx: &EventCtx, app: &App, details: &mut Details, id: IntersectionID) -> Vec<Widget> {
|
pub fn info(ctx: &EventCtx, app: &App, details: &mut Details, id: IntersectionID) -> Vec<Widget> {
|
||||||
@ -221,9 +221,9 @@ fn delay_plot(ctx: &EventCtx, app: &App, i: IntersectionID, opts: &DataOptions)
|
|||||||
} else {
|
} else {
|
||||||
app.primary.sim.get_analytics()
|
app.primary.sim.get_analytics()
|
||||||
};
|
};
|
||||||
let mut by_mode: BTreeMap<TripMode, Vec<(Time, Duration)>> = TripMode::all()
|
let mut by_type: BTreeMap<AgentType, Vec<(Time, Duration)>> = AgentType::all()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|m| (m, Vec::new()))
|
.map(|t| (t, Vec::new()))
|
||||||
.collect();
|
.collect();
|
||||||
let limit = if opts.show_end_of_day {
|
let limit = if opts.show_end_of_day {
|
||||||
app.primary.sim.get_end_of_day()
|
app.primary.sim.get_end_of_day()
|
||||||
@ -231,18 +231,18 @@ fn delay_plot(ctx: &EventCtx, app: &App, i: IntersectionID, opts: &DataOptions)
|
|||||||
app.primary.sim.time()
|
app.primary.sim.time()
|
||||||
};
|
};
|
||||||
if let Some(list) = data.intersection_delays.get(&i) {
|
if let Some(list) = data.intersection_delays.get(&i) {
|
||||||
for (t, dt, mode) in list {
|
for (t, dt, agent_type) in list {
|
||||||
if *t > limit {
|
if *t > limit {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
by_mode.get_mut(mode).unwrap().push((*t, *dt));
|
by_type.get_mut(agent_type).unwrap().push((*t, *dt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let series: Vec<Series<Duration>> = by_mode
|
let series: Vec<Series<Duration>> = by_type
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(mode, pts)| Series {
|
.map(|(agent_type, pts)| Series {
|
||||||
label: mode.noun().to_string(),
|
label: agent_type.noun().to_string(),
|
||||||
color: color_for_mode(app, mode),
|
color: color_for_agent_type(app, agent_type),
|
||||||
pts,
|
pts,
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
@ -23,7 +23,8 @@ pub struct Analytics {
|
|||||||
pub finished_trips: Vec<(Time, TripID, Option<TripMode>, Duration)>,
|
pub finished_trips: Vec<(Time, TripID, Option<TripMode>, Duration)>,
|
||||||
// TODO This subsumes finished_trips
|
// TODO This subsumes finished_trips
|
||||||
pub trip_log: Vec<(Time, TripID, Option<PathRequest>, TripPhaseType)>,
|
pub trip_log: Vec<(Time, TripID, Option<PathRequest>, TripPhaseType)>,
|
||||||
pub intersection_delays: BTreeMap<IntersectionID, Vec<(Time, Duration, TripMode)>>,
|
// TODO Transit riders aren't represented here yet, just the vehicle they're riding.
|
||||||
|
pub intersection_delays: BTreeMap<IntersectionID, Vec<(Time, Duration, AgentType)>>,
|
||||||
// Per parking lane or lot, when does a spot become filled (true) or free (false)
|
// Per parking lane or lot, when does a spot become filled (true) or free (false)
|
||||||
pub parking_lane_changes: BTreeMap<LaneID, Vec<(Time, bool)>>,
|
pub parking_lane_changes: BTreeMap<LaneID, Vec<(Time, bool)>>,
|
||||||
pub parking_lot_changes: BTreeMap<ParkingLotID, Vec<(Time, bool)>>,
|
pub parking_lot_changes: BTreeMap<ParkingLotID, Vec<(Time, bool)>>,
|
||||||
@ -138,11 +139,11 @@ impl Analytics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Intersection delays
|
// Intersection delays
|
||||||
if let Event::IntersectionDelayMeasured(id, delay, mode) = ev {
|
if let Event::IntersectionDelayMeasured(id, delay, agent) = ev {
|
||||||
self.intersection_delays
|
self.intersection_delays
|
||||||
.entry(id)
|
.entry(id)
|
||||||
.or_insert_with(Vec::new)
|
.or_insert_with(Vec::new)
|
||||||
.push((time, delay, mode));
|
.push((time, delay, agent.to_type()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parking spot changes
|
// Parking spot changes
|
||||||
|
@ -38,7 +38,7 @@ pub enum Event {
|
|||||||
// If the agent is a transit vehicle, then include a count of how many passengers are on
|
// If the agent is a transit vehicle, then include a count of how many passengers are on
|
||||||
// board.
|
// board.
|
||||||
AgentEntersTraversable(AgentID, Traversable, Option<usize>),
|
AgentEntersTraversable(AgentID, Traversable, Option<usize>),
|
||||||
IntersectionDelayMeasured(IntersectionID, Duration, TripMode),
|
IntersectionDelayMeasured(IntersectionID, Duration, AgentID),
|
||||||
|
|
||||||
TripFinished {
|
TripFinished {
|
||||||
trip: TripID,
|
trip: TripID,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::mechanics::car::Car;
|
use crate::mechanics::car::Car;
|
||||||
use crate::mechanics::Queue;
|
use crate::mechanics::Queue;
|
||||||
use crate::{AgentID, AlertLocation, CarID, Command, Event, Scheduler, Speed, TripMode};
|
use crate::{AgentID, AlertLocation, CarID, Command, Event, Scheduler, Speed};
|
||||||
use abstutil::{deserialize_btreemap, retain_btreeset, serialize_btreemap};
|
use abstutil::{deserialize_btreemap, retain_btreeset, serialize_btreemap};
|
||||||
use geom::{Duration, Time};
|
use geom::{Duration, Time};
|
||||||
use map_model::{
|
use map_model::{
|
||||||
@ -392,11 +392,8 @@ impl IntersectionSimState {
|
|||||||
let state = self.state.get_mut(&turn.parent).unwrap();
|
let state = self.state.get_mut(&turn.parent).unwrap();
|
||||||
let delay = now - state.waiting.remove(&req).unwrap();
|
let delay = now - state.waiting.remove(&req).unwrap();
|
||||||
if map.maybe_get_traffic_signal(state.id).is_some() {
|
if map.maybe_get_traffic_signal(state.id).is_some() {
|
||||||
self.events.push(Event::IntersectionDelayMeasured(
|
self.events
|
||||||
turn.parent,
|
.push(Event::IntersectionDelayMeasured(turn.parent, delay, agent));
|
||||||
delay,
|
|
||||||
TripMode::from_agent(agent),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
state.accepted.insert(req);
|
state.accepted.insert(req);
|
||||||
if self.break_turn_conflict_cycles {
|
if self.break_turn_conflict_cycles {
|
||||||
|
@ -1373,21 +1373,6 @@ impl TripMode {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn from_agent(id: AgentID) -> TripMode {
|
|
||||||
match id {
|
|
||||||
AgentID::Pedestrian(_) => TripMode::Walk,
|
|
||||||
AgentID::Car(id) => match id.1 {
|
|
||||||
VehicleType::Car => TripMode::Drive,
|
|
||||||
VehicleType::Bike => TripMode::Bike,
|
|
||||||
// TODO Little confusing; this means buses, not bus riders.
|
|
||||||
VehicleType::Bus => TripMode::Transit,
|
|
||||||
VehicleType::Train => TripMode::Transit,
|
|
||||||
},
|
|
||||||
// TODO Now we can detangle this, right?
|
|
||||||
AgentID::BusPassenger(_, _) => TripMode::Transit,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn verb(self) -> &'static str {
|
pub fn verb(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
TripMode::Walk => "walk",
|
TripMode::Walk => "walk",
|
||||||
|
Loading…
Reference in New Issue
Block a user