mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 09:24:26 +03:00
51 lines
21 KiB
HTML
51 lines
21 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="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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg"><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></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="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../sim/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Crate sim</h2><div class="block version"><div class="narrow-helper"></div><p>Version 0.1.0</p></div><div class="sidebar-elems"><a id="all-types" href="all.html"><p>See all sim's items</p></a><div class="block items"><ul><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><div id="sidebar-vars" data-name="sim" data-ty="mod" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input"name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Crate <a class="mod" href="#">sim</a><button id="copy-path" onclick="copy_path(this)" title="copy path"><img src="../clipboard.svg" width="19" height="18" alt="Copy item import" title="Copy item import to clipboard"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../src/sim/lib.rs.html#1-648" title="goto source code">[src]</a></span></h1><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="modules" class="section-header"><a href="#modules">Modules</a></h2>
|
||
<div class="item-table"><div class="item-left module-item"><a class="mod" href="analytics/index.html" title="sim::analytics mod">analytics</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="mod" href="events/index.html" title="sim::events mod">events</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="mod" href="make/index.html" title="sim::make mod">make</a></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 class="item-left module-item"><a class="mod" href="mechanics/index.html" title="sim::mechanics mod">mechanics</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="mod" href="pandemic/index.html" title="sim::pandemic mod">pandemic</a></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 class="item-left module-item"><a class="mod" href="recorder/index.html" title="sim::recorder mod">recorder</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="mod" href="render/index.html" title="sim::render mod">render</a></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 class="item-left module-item"><a class="mod" href="router/index.html" title="sim::router mod">router</a></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 class="item-left module-item"><a class="mod" href="scheduler/index.html" title="sim::scheduler mod">scheduler</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="mod" href="sim/index.html" title="sim::sim mod">sim</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="mod" href="transit/index.html" title="sim::transit mod">transit</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="mod" href="trips/index.html" title="sim::trips mod">trips</a></div><div class="item-right docblock-short"></div></div><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||
<div class="item-table"><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 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 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 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 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 class="item-left module-item"><a class="struct" href="struct.CreateCar.html" title="sim::CreateCar struct">CreateCar</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="struct" href="struct.CreatePedestrian.html" title="sim::CreatePedestrian struct">CreatePedestrian</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="struct" href="struct.DistanceInterval.html" title="sim::DistanceInterval struct">DistanceInterval</a></div><div class="item-right docblock-short"></div><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 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 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 class="item-left module-item"><a class="struct" href="struct.ExternalPerson.html" title="sim::ExternalPerson struct">ExternalPerson</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="struct" href="struct.ExternalTrip.html" title="sim::ExternalTrip struct">ExternalTrip</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="struct" href="struct.IndividTrip.html" title="sim::IndividTrip struct">IndividTrip</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="struct" href="struct.MapBorders.html" title="sim::MapBorders struct">MapBorders</a></div><div class="item-right docblock-short"><p>Lists all border intersections of the map, broken down by mode and whether they support
|
||
incoming or outgoing traffic.</p>
|
||
</div><div class="item-left module-item"><a class="struct" href="struct.OrigPersonID.html" title="sim::OrigPersonID struct">OrigPersonID</a></div><div class="item-right docblock-short"></div><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 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 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 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 class="item-left module-item"><a class="struct" href="struct.PersonSpec.html" title="sim::PersonSpec struct">PersonSpec</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="struct" href="struct.Scenario.html" title="sim::Scenario struct">Scenario</a></div><div class="item-right docblock-short"><p>A Scenario describes all the input to a simulation. Usually a scenario covers one day.</p>
|
||
</div><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 class="item-left module-item"><a class="struct" href="struct.SidewalkSpot.html" title="sim::SidewalkSpot struct">SidewalkSpot</a></div><div class="item-right docblock-short"></div><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 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.</p>
|
||
</div><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 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 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 class="item-left module-item"><a class="struct" href="struct.TimeInterval.html" title="sim::TimeInterval struct">TimeInterval</a></div><div class="item-right docblock-short"></div><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 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 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 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 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 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><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||
<div class="item-table"><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 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 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 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 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 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 class="item-left module-item"><a class="enum" href="enum.DrivingGoal.html" title="sim::DrivingGoal enum">DrivingGoal</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="enum" href="enum.ExternalTripEndpoint.html" title="sim::ExternalTripEndpoint enum">ExternalTripEndpoint</a></div><div class="item-right docblock-short"></div><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 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 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 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 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 class="item-left module-item"><a class="enum" href="enum.ScenarioModifier.html" title="sim::ScenarioModifier enum">ScenarioModifier</a></div><div class="item-right docblock-short"><p>Transforms an existing Scenario before instantiating it.</p>
|
||
</div><div class="item-left module-item"><a class="enum" href="enum.SidewalkPOI.html" title="sim::SidewalkPOI enum">SidewalkPOI</a></div><div class="item-right docblock-short"><p>Point of interest, that is</p>
|
||
</div><div class="item-left module-item"><a class="enum" href="enum.TripEndpoint.html" title="sim::TripEndpoint enum">TripEndpoint</a></div><div class="item-right docblock-short"><p>Specifies where a trip begins or ends.</p>
|
||
</div><div class="item-left module-item"><a class="enum" href="enum.TripMode.html" title="sim::TripMode enum">TripMode</a></div><div class="item-right docblock-short"></div><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 class="item-left module-item"><a class="enum" href="enum.TripPurpose.html" title="sim::TripPurpose enum">TripPurpose</a></div><div class="item-right docblock-short"><p>Lifted from Seattle’s Soundcast model, but seems general enough to use anyhere.</p>
|
||
</div><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 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><h2 id="constants" class="section-header"><a href="#constants">Constants</a></h2>
|
||
<div class="item-table"><div class="item-left module-item"><a class="constant" href="constant.BIKE_LENGTH.html" title="sim::BIKE_LENGTH constant">BIKE_LENGTH</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="constant" href="constant.BUS_LENGTH.html" title="sim::BUS_LENGTH constant">BUS_LENGTH</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="constant" href="constant.FOLLOWING_DISTANCE.html" title="sim::FOLLOWING_DISTANCE constant">FOLLOWING_DISTANCE</a></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 class="item-left module-item"><a class="constant" href="constant.LIGHT_RAIL_LENGTH.html" title="sim::LIGHT_RAIL_LENGTH constant">LIGHT_RAIL_LENGTH</a></div><div class="item-right docblock-short"></div><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></div><div class="item-right docblock-short"></div><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></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="constant" href="constant.SPAWN_DIST.html" title="sim::SPAWN_DIST constant">SPAWN_DIST</a></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><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||
<div class="item-table"><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><h2 id="functions" class="section-header"><a href="#functions">Functions</a></h2>
|
||
<div class="item-table"><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></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="sim" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||
<script src="../main.js"></script>
|
||
</body></html> |