abstreet/rustdoc/sim/index.html
2021-02-11 18:43:41 +00:00

50 lines
19 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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="API documentation for the Rust `sim` crate."><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><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"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../sim/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><p class="location">Crate sim</p><div class="block version"><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><p class="location"></p><script>window.sidebarCurrent = {name: "sim", ty: "mod", relpath: "../"};</script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../theme.js"></script><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" class="help-button">?</button>
<a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><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">&#x2212;</span>]</a></span><a class="srclink" href="../src/sim/lib.rs.html#1-637" title="goto source code">[src]</a></span><span class="in-band">Crate <a class="mod" href="">sim</a></span></h1><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/trafficsim/index.html.</p>
<p>The simulation is very roughly layered into two pieces: the low-level &quot;mechanics&quot; 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><h2 id="modules" class="section-header"><a href="#modules">Modules</a></h2>
<table><tr class="module-item"><td><a class="mod" href="analytics/index.html" title="sim::analytics mod">analytics</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="cap/index.html" title="sim::cap mod">cap</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="events/index.html" title="sim::events mod">events</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="make/index.html" title="sim::make mod">make</a></td><td class="docblock-short"><p>Everything needed to setup a simulation.
<a href="https://a-b-street.github.io/docs/trafficsim/travel_demand.html">https://a-b-street.github.io/docs/trafficsim/travel_demand.html</a> for context.</p>
</td></tr><tr class="module-item"><td><a class="mod" href="mechanics/index.html" title="sim::mechanics mod">mechanics</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="pandemic/index.html" title="sim::pandemic mod">pandemic</a></td><td class="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>
</td></tr><tr class="module-item"><td><a class="mod" href="recorder/index.html" title="sim::recorder mod">recorder</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="render/index.html" title="sim::render mod">render</a></td><td class="docblock-short"><p>Intermediate structures so that sim and game crates don't have a cyclic dependency.</p>
</td></tr><tr class="module-item"><td><a class="mod" href="router/index.html" title="sim::router mod">router</a></td><td class="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>
</td></tr><tr class="module-item"><td><a class="mod" href="scheduler/index.html" title="sim::scheduler mod">scheduler</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="sim/index.html" title="sim::sim mod">sim</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="transit/index.html" title="sim::transit mod">transit</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="trips/index.html" title="sim::trips mod">trips</a></td><td class="docblock-short"></td></tr></table><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
<table><tr class="module-item"><td><a class="struct" href="struct.AgentProperties.html" title="sim::AgentProperties struct">AgentProperties</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Analytics.html" title="sim::Analytics struct">Analytics</a></td><td class="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>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.BorderSpawnOverTime.html" title="sim::BorderSpawnOverTime struct">BorderSpawnOverTime</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.CarID.html" title="sim::CarID struct">CarID</a></td><td class="docblock-short"><p>The numeric ID must be globally unique, without considering VehicleType. VehicleType is bundled
for convenient debugging.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.CommutersVehiclesCounts.html" title="sim::CommutersVehiclesCounts struct">CommutersVehiclesCounts</a></td><td class="docblock-short"><p>The number of active vehicles and commuters, broken into different categories.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.CreateCar.html" title="sim::CreateCar struct">CreateCar</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.CreatePedestrian.html" title="sim::CreatePedestrian struct">CreatePedestrian</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.DistanceInterval.html" title="sim::DistanceInterval struct">DistanceInterval</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.DrawCarInput.html" title="sim::DrawCarInput struct">DrawCarInput</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.DrawPedCrowdInput.html" title="sim::DrawPedCrowdInput struct">DrawPedCrowdInput</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.DrawPedestrianInput.html" title="sim::DrawPedestrianInput struct">DrawPedestrianInput</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.ExternalPerson.html" title="sim::ExternalPerson struct">ExternalPerson</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.ExternalTrip.html" title="sim::ExternalTrip struct">ExternalTrip</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.IndividTrip.html" title="sim::IndividTrip struct">IndividTrip</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.MapBorders.html" title="sim::MapBorders struct">MapBorders</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.OrigPersonID.html" title="sim::OrigPersonID struct">OrigPersonID</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.ParkedCar.html" title="sim::ParkedCar struct">ParkedCar</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.PedestrianID.html" title="sim::PedestrianID struct">PedestrianID</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Person.html" title="sim::Person struct">Person</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.PersonID.html" title="sim::PersonID struct">PersonID</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.PersonSpec.html" title="sim::PersonSpec struct">PersonSpec</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Scenario.html" title="sim::Scenario struct">Scenario</a></td><td class="docblock-short"><p>A Scenario describes all the input to a simulation. Usually a scenario covers one day.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.ScenarioGenerator.html" title="sim::ScenarioGenerator struct">ScenarioGenerator</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.SidewalkSpot.html" title="sim::SidewalkSpot struct">SidewalkSpot</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Sim.html" title="sim::Sim struct">Sim</a></td><td class="docblock-short"><p>The Sim ties together all the pieces of the simulation. Its main property is the current time.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.SimFlags.html" title="sim::SimFlags struct">SimFlags</a></td><td class="docblock-short"><p>SimFlags specifies a simulation to setup.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.SimOptions.html" title="sim::SimOptions struct">SimOptions</a></td><td class="docblock-short"><p>Options controlling the traffic simulation.</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.SpawnOverTime.html" title="sim::SpawnOverTime struct">SpawnOverTime</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.TimeInterval.html" title="sim::TimeInterval struct">TimeInterval</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.TripID.html" title="sim::TripID struct">TripID</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.TripInfo.html" title="sim::TripInfo struct">TripInfo</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.TripPhase.html" title="sim::TripPhase struct">TripPhase</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.UnzoomedAgent.html" title="sim::UnzoomedAgent struct">UnzoomedAgent</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Vehicle.html" title="sim::Vehicle struct">Vehicle</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.VehicleSpec.html" title="sim::VehicleSpec struct">VehicleSpec</a></td><td class="docblock-short"></td></tr></table><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
<table><tr class="module-item"><td><a class="enum" href="enum.AgentID.html" title="sim::AgentID enum">AgentID</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.AgentType.html" title="sim::AgentType enum">AgentType</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.AlertHandler.html" title="sim::AlertHandler enum">AlertHandler</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.AlertLocation.html" title="sim::AlertLocation enum">AlertLocation</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.CarStatus.html" title="sim::CarStatus enum">CarStatus</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.DelayCause.html" title="sim::DelayCause enum">DelayCause</a></td><td class="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>
</td></tr><tr class="module-item"><td><a class="enum" href="enum.DrivingGoal.html" title="sim::DrivingGoal enum">DrivingGoal</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.ExternalTripEndpoint.html" title="sim::ExternalTripEndpoint enum">ExternalTripEndpoint</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.ParkingSpot.html" title="sim::ParkingSpot enum">ParkingSpot</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.PedCrowdLocation.html" title="sim::PedCrowdLocation enum">PedCrowdLocation</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.PersonState.html" title="sim::PersonState enum">PersonState</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.ScenarioModifier.html" title="sim::ScenarioModifier enum">ScenarioModifier</a></td><td class="docblock-short"><p>Transforms an existing Scenario before instantiating it.</p>
</td></tr><tr class="module-item"><td><a class="enum" href="enum.SidewalkPOI.html" title="sim::SidewalkPOI enum">SidewalkPOI</a></td><td class="docblock-short"><p>Point of interest, that is</p>
</td></tr><tr class="module-item"><td><a class="enum" href="enum.TripEndpoint.html" title="sim::TripEndpoint enum">TripEndpoint</a></td><td class="docblock-short"><p>Specifies where a trip begins or ends.</p>
</td></tr><tr class="module-item"><td><a class="enum" href="enum.TripMode.html" title="sim::TripMode enum">TripMode</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.TripPhaseType.html" title="sim::TripPhaseType enum">TripPhaseType</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.TripPurpose.html" title="sim::TripPurpose enum">TripPurpose</a></td><td class="docblock-short"><p>Lifted from Seattle's Soundcast model, but seems general enough to use anyhere.</p>
</td></tr><tr class="module-item"><td><a class="enum" href="enum.TripResult.html" title="sim::TripResult enum">TripResult</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.VehicleType.html" title="sim::VehicleType enum">VehicleType</a></td><td class="docblock-short"></td></tr></table><h2 id="constants" class="section-header"><a href="#constants">Constants</a></h2>
<table><tr class="module-item"><td><a class="constant" href="constant.BIKE_LENGTH.html" title="sim::BIKE_LENGTH constant">BIKE_LENGTH</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="constant" href="constant.BUS_LENGTH.html" title="sim::BUS_LENGTH constant">BUS_LENGTH</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="constant" href="constant.FOLLOWING_DISTANCE.html" title="sim::FOLLOWING_DISTANCE constant">FOLLOWING_DISTANCE</a></td><td class="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>
</td></tr><tr class="module-item"><td><a class="constant" href="constant.LIGHT_RAIL_LENGTH.html" title="sim::LIGHT_RAIL_LENGTH constant">LIGHT_RAIL_LENGTH</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="constant" href="constant.MAX_CAR_LENGTH.html" title="sim::MAX_CAR_LENGTH constant">MAX_CAR_LENGTH</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="constant" href="constant.MIN_CAR_LENGTH.html" title="sim::MIN_CAR_LENGTH constant">MIN_CAR_LENGTH</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="constant" href="constant.SPAWN_DIST.html" title="sim::SPAWN_DIST constant">SPAWN_DIST</a></td><td class="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>
</td></tr></table><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
<table><tr class="module-item"><td><a class="trait" href="trait.SimCallback.html" title="sim::SimCallback trait">SimCallback</a></td><td class="docblock-short"></td></tr></table><h2 id="functions" class="section-header"><a href="#functions">Functions</a></h2>
<table><tr class="module-item"><td><a class="fn" href="fn.fork_rng.html" title="sim::fork_rng fn">fork_rng</a></td><td class="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>
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "sim";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>