Struct sim::sim::Sim [−][src]
pub struct Sim {}Show fields
driving: DrivingSimState, parking: ParkingSimState, walking: WalkingSimState, intersections: IntersectionSimState, transit: TransitSimState, trips: TripManager, pandemic: Option<PandemicModel>, scheduler: Scheduler, time: Time, pub(crate) map_name: MapName, pub(crate) edits_name: String, run_name: String, step_count: usize, highlighted_people: Option<BTreeSet<PersonID>>, analytics: Analytics, recorder: Option<TrafficRecorder>, alerts: AlertHandler,
Expand description
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
trips: TripManager
pandemic: Option<PandemicModel>
scheduler: Scheduler
time: Time
map_name: MapName
edits_name: String
run_name: String
step_count: usize
highlighted_people: Option<BTreeSet<PersonID>>
analytics: Analytics
recorder: Option<TrafficRecorder>
alerts: AlertHandler
Implementations
(number of finished trips, number of unfinished trips)
(total number of people, just in buildings, just off map)
Return a short string to debug a car in the UI.
Only call for active agents, will panic otherwise
If trip is finished, returns (total time, total waiting time, total distance)
For every parked car, (position of parking spot, position of owner)
For every agent that’s currently not moving, figure out how long they’ve been waiting and why they’re blocked.
(bus, stop index it’s coming from, percent to next stop, location)
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 all_arrivals_at_border(
&self,
i: IntersectionID
) -> Vec<(AgentType, Vec<(Time, 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]Returns the best-case time for a trip in a world with no traffic or intersection delays. Might fail in some cases where the real trip succeeds, but the single-mode path can’t be found. Assumes the TripID exists.
pub fn get_draw_peds(
&self,
on: Traversable,
map: &Map
) -> (Vec<DrawPedestrianInput>, Vec<DrawPedCrowdInput>)
[src]This does not include transit riders. Some callers need those in addition, but the rendering ones don’t.
pub(crate) fn spawn_trips(
&mut self,
input: Vec<(PersonID, TripInfo, StartTripArgs)>,
map: &Map,
timer: &mut Timer<'_>
)
[src](Filled, available)
pub(crate) fn new_person(
&mut self,
orig_id: Option<OrigPersonID>,
ped_speed: Speed,
vehicle_specs: Vec<VehicleSpec>
) -> &Person
[src]fn minimal_step(
&mut self,
map: &Map,
max_dt: Duration,
maybe_cb: &mut Option<Box<dyn SimCallback>>
) -> bool
[src]fn do_step(
&mut self,
map: &Map,
time: Time,
cmd: Command,
maybe_cb: &mut Option<Box<dyn SimCallback>>
) -> bool
[src]pub fn timed_step(
&mut self,
map: &Map,
dt: Duration,
maybe_cb: &mut Option<Box<dyn SimCallback>>,
timer: &mut Timer<'_>
)
[src]pub fn time_limited_step(
&mut self,
map: &Map,
dt: Duration,
real_time_limit: Duration,
maybe_cb: &mut Option<Box<dyn SimCallback>>
)
[src]Respond to arbitrary map edits without resetting the simulation. Returns the number of (trips cancelled, parked cars displaced).
Only one at a time supported.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Sim
impl UnwindSafe for Sim
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self