mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-01 02:33:54 +03:00
52 lines
24 KiB
HTML
52 lines
24 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The sim crate runs a traffic simulation on top of the map_model. See also https://a-b-street.github.io/docs/tech/trafficsim/index.html."><meta name="keywords" content="rust, rustlang, rust-lang, sim"><title>sim - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><script defer src="../main.js"></script>
|
||
<noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../sim/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div>
|
||
</a><h2 class="location"></h2>
|
||
</nav>
|
||
<nav class="sidebar"><a class="sidebar-logo" href="../sim/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div>
|
||
</a><h2 class="location"><a href="#">Crate sim</a></h2><div class="sidebar-elems"><div class="block"><ul><li class="version">Version 0.1.0</li><li><a id="all-types" href="all.html">All Items</a></li></div></ul><section><div class="block"><ul><li><a href="#reexports">Re-exports</a></li><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#constants">Constants</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></div></section><div id="sidebar-vars" data-name="sim" data-ty="mod" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../sim/index.html"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></a><nav class="sub"><div class="theme-picker hidden"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="22" height="22" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></form></nav></div><section id="main-content" class="content"><div class="main-heading">
|
||
<h1 class="fqn"><span class="in-band">Crate <a class="mod" href="#">sim</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/sim/lib.rs.html#1-613">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The sim crate runs a traffic simulation on top of the map_model. See also
|
||
https://a-b-street.github.io/docs/tech/trafficsim/index.html.</p>
|
||
<p>The simulation is very roughly layered into two pieces: the low-level “mechanics” of simulating
|
||
individual agents over time, and higher-level systems like TripManager and TransitSimState that
|
||
glue together individual goals executed by the agents.</p>
|
||
<p>Helpful terminology:</p>
|
||
<ul>
|
||
<li>sov = single occupancy vehicle, a car with just a driver and no passengers. (Car passengers
|
||
are not currently modelled)</li>
|
||
</ul>
|
||
</div></details><h2 id="reexports" class="small-section-header"><a href="#reexports">Re-exports</a></h2>
|
||
<div class="item-table"><div class="item-row"><div class="item-left import-item" id="reexport.PrebakeSummary"><code>pub use self::prebake::<a class="struct" href="prebake/struct.PrebakeSummary.html" title="struct sim::prebake::PrebakeSummary">PrebakeSummary</a>;</code></div><div class="item-right docblock-short"></div></div></div><h2 id="modules" class="small-section-header"><a href="#modules">Modules</a></h2>
|
||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="analytics/index.html" title="sim::analytics mod">analytics</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="events/index.html" title="sim::events mod">events</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="make/index.html" title="sim::make mod">make</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"><p>Everything needed to setup a simulation.
|
||
<a href="https://a-b-street.github.io/docs/tech/trafficsim/travel_demand.html">https://a-b-street.github.io/docs/tech/trafficsim/travel_demand.html</a> for context.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="mechanics/index.html" title="sim::mechanics mod">mechanics</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="pandemic/index.html" title="sim::pandemic mod">pandemic</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"><p>An experimental SEIR model by https://github.com/omalaspinas/ glued to the traffic simulation.
|
||
Transmission may occur when people spend time in shared spaces like buildings, bus stops, and
|
||
buses.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="prebake/index.html" title="sim::prebake mod">prebake</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="recorder/index.html" title="sim::recorder mod">recorder</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="render/index.html" title="sim::render mod">render</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"><p>Intermediate structures so that sim and game crates don’t have a cyclic dependency.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="router/index.html" title="sim::router mod">router</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"><p>For vehicles only, not pedestrians. Follows a Path from map_model, but can opportunistically
|
||
lane-change to avoid a slow lane, can can handle re-planning to look for available parking.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="scheduler/index.html" title="sim::scheduler mod">scheduler</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="sim/index.html" title="sim::sim mod">sim</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="transit/index.html" title="sim::transit mod">transit</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="trips/index.html" title="sim::trips mod">trips</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2>
|
||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.AgentProperties.html" title="sim::AgentProperties struct">AgentProperties</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Analytics.html" title="sim::Analytics struct">Analytics</a></div><div class="item-right docblock-short"><p>As a simulation runs, different pieces emit Events. The Analytics object listens to these,
|
||
organizing and storing some information from them. The UI queries Analytics to draw time-series
|
||
and display statistics.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.BorderSpawnOverTime.html" title="sim::BorderSpawnOverTime struct">BorderSpawnOverTime</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.CarID.html" title="sim::CarID struct">CarID</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.CommutersVehiclesCounts.html" title="sim::CommutersVehiclesCounts struct">CommutersVehiclesCounts</a></div><div class="item-right docblock-short"><p>The number of active vehicles and commuters, broken into different categories.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.CreateCar.html" title="sim::CreateCar struct">CreateCar</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.CreatePedestrian.html" title="sim::CreatePedestrian struct">CreatePedestrian</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.DistanceInterval.html" title="sim::DistanceInterval struct">DistanceInterval</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.DrawCarInput.html" title="sim::DrawCarInput struct">DrawCarInput</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.DrawPedCrowdInput.html" title="sim::DrawPedCrowdInput struct">DrawPedCrowdInput</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.DrawPedestrianInput.html" title="sim::DrawPedestrianInput struct">DrawPedestrianInput</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ParkedCar.html" title="sim::ParkedCar struct">ParkedCar</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.PedestrianID.html" title="sim::PedestrianID struct">PedestrianID</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Person.html" title="sim::Person struct">Person</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.PersonID.html" title="sim::PersonID struct">PersonID</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ScenarioGenerator.html" title="sim::ScenarioGenerator struct">ScenarioGenerator</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.SidewalkSpot.html" title="sim::SidewalkSpot struct">SidewalkSpot</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Sim.html" title="sim::Sim struct">Sim</a></div><div class="item-right docblock-short"><p>The Sim ties together all the pieces of the simulation. Its main property is the current time.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.SimFlags.html" title="sim::SimFlags struct">SimFlags</a></div><div class="item-right docblock-short"><p>SimFlags specifies a simulation to setup. After parsing from structopt, you must call
|
||
<code>initialize</code>.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.SimOptions.html" title="sim::SimOptions struct">SimOptions</a></div><div class="item-right docblock-short"><p>Options controlling the traffic simulation.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.SlidingWindow.html" title="sim::SlidingWindow struct">SlidingWindow</a></div><div class="item-right docblock-short"><p>A sliding window, used to count something over time</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.SpawnOverTime.html" title="sim::SpawnOverTime struct">SpawnOverTime</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.TimeInterval.html" title="sim::TimeInterval struct">TimeInterval</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.TripID.html" title="sim::TripID struct">TripID</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.TripInfo.html" title="sim::TripInfo struct">TripInfo</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.TripPhase.html" title="sim::TripPhase struct">TripPhase</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.UnzoomedAgent.html" title="sim::UnzoomedAgent struct">UnzoomedAgent</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Vehicle.html" title="sim::Vehicle struct">Vehicle</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.VehicleSpec.html" title="sim::VehicleSpec struct">VehicleSpec</a></div><div class="item-right docblock-short"></div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2>
|
||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.AgentID.html" title="sim::AgentID enum">AgentID</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.AgentType.html" title="sim::AgentType enum">AgentType</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.AlertHandler.html" title="sim::AlertHandler enum">AlertHandler</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.AlertLocation.html" title="sim::AlertLocation enum">AlertLocation</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.CarStatus.html" title="sim::CarStatus enum">CarStatus</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.DelayCause.html" title="sim::DelayCause enum">DelayCause</a></div><div class="item-right docblock-short"><p>Why is an agent delayed? If there are multiple reasons, arbitrarily pick one – ie, somebody
|
||
could be blocked by two conflicting turns.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.DrivingGoal.html" title="sim::DrivingGoal enum">DrivingGoal</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Intent.html" title="sim::Intent enum">Intent</a></div><div class="item-right docblock-short"><p>Shows an agent’s current inner intention or thoughts.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.ParkingSpot.html" title="sim::ParkingSpot enum">ParkingSpot</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.PedCrowdLocation.html" title="sim::PedCrowdLocation enum">PedCrowdLocation</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.PersonState.html" title="sim::PersonState enum">PersonState</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Problem.html" title="sim::Problem enum">Problem</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.ProblemType.html" title="sim::ProblemType enum">ProblemType</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.SidewalkPOI.html" title="sim::SidewalkPOI enum">SidewalkPOI</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"><p>Point of interest, that is</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.TripPhaseType.html" title="sim::TripPhaseType enum">TripPhaseType</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.TripResult.html" title="sim::TripResult enum">TripResult</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.VehicleType.html" title="sim::VehicleType enum">VehicleType</a></div><div class="item-right docblock-short"></div></div></div><h2 id="constants" class="small-section-header"><a href="#constants">Constants</a></h2>
|
||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="constant" href="constant.BIKE_LENGTH.html" title="sim::BIKE_LENGTH constant">BIKE_LENGTH</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="constant" href="constant.BUS_LENGTH.html" title="sim::BUS_LENGTH constant">BUS_LENGTH</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="constant" href="constant.FOLLOWING_DISTANCE.html" title="sim::FOLLOWING_DISTANCE constant">FOLLOWING_DISTANCE</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"><p>At all speeds (including at rest), cars must be at least this far apart, measured from front of
|
||
one car to the back of the other.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="constant" href="constant.LIGHT_RAIL_LENGTH.html" title="sim::LIGHT_RAIL_LENGTH constant">LIGHT_RAIL_LENGTH</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="constant" href="constant.MAX_CAR_LENGTH.html" title="sim::MAX_CAR_LENGTH constant">MAX_CAR_LENGTH</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="constant" href="constant.MIN_CAR_LENGTH.html" title="sim::MIN_CAR_LENGTH constant">MIN_CAR_LENGTH</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="constant" href="constant.SPAWN_DIST.html" title="sim::SPAWN_DIST constant">SPAWN_DIST</a><span title="Restricted Visibility"> 🔒</span> </div><div class="item-right docblock-short"><p>When spawning at borders, start the front of the vehicle this far along and gradually appear.
|
||
Getting too close to EPSILON_DIST can lead to get_draw_car having no geometry at all.</p>
|
||
</div></div></div><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2>
|
||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.SimCallback.html" title="sim::SimCallback trait">SimCallback</a></div><div class="item-right docblock-short"></div></div></div><h2 id="functions" class="small-section-header"><a href="#functions">Functions</a></h2>
|
||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.count_parked_cars_per_bldg.html" title="sim::count_parked_cars_per_bldg fn">count_parked_cars_per_bldg</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.fork_rng.html" title="sim::fork_rng fn">fork_rng</a></div><div class="item-right docblock-short"><p>Need to explain this trick – basically keeps consistency between two different simulations when
|
||
each one might make slightly different sequences of calls to the RNG.</p>
|
||
</div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.pedestrian_body_radius.html" title="sim::pedestrian_body_radius fn">pedestrian_body_radius</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="fn" href="fn.rand_dist.html" title="sim::rand_dist fn">rand_dist</a></div><div class="item-right docblock-short"></div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="sim" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.62.1 (e092d0b6b 2022-07-16)" ></div>
|
||
</body></html> |