<linkrel="alternate icon"type="image/png"href="../favicon-32x32.png"><styletype="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><bodyclass="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="sidebar"><divclass="sidebar-menu">☰</div><ahref='../sim/index.html'><divclass='logo-container rust-logo'><imgsrc='../rust-logo.png'alt='logo'></div></a><pclass="location">Crate sim</p><divclass="block version"><p>Version 0.1.0</p></div><divclass="sidebar-elems"><aid="all-types"href="all.html"><p>See all sim's items</p></a><divclass="block items"><ul><li><ahref="#modules">Modules</a></li><li><ahref="#structs">Structs</a></li><li><ahref="#enums">Enums</a></li><li><ahref="#constants">Constants</a></li><li><ahref="#traits">Traits</a></li><li><ahref="#functions">Functions</a></li></ul></div><pclass="location"></p><script>window.sidebarCurrent={name:"sim",ty:"mod",relpath:"../"};</script></div></nav><divclass="theme-picker"><buttonid="theme-picker"aria-label="Pick another theme!"aria-haspopup="menu"><imgsrc="../brush.svg"width="18"alt="Pick another theme!"></button><divid="theme-choices"role="menu"></div></div><scriptsrc="../theme.js"></script><navclass="sub"><formclass="search-form"><divclass="search-container"><div><selectid="crate-search"><optionvalue="All crates">All crates</option></select><inputclass="search-input"name="search"disabledautocomplete="off"spellcheck="false"placeholder="Click or press ‘S’ to search, ‘?’ for more options…"type="search"></div><spanclass="help-button">?</span>
<aid="settings-menu"href="../settings.html"><imgsrc="../wheel.svg"width="18"alt="Change settings"></a></div></form></nav><sectionid="main"class="content"><h1class="fqn"><spanclass="out-of-band"><spanid="render-detail"><aid="toggle-all-docs"href="javascript:void(0)"title="collapse all docs">[<spanclass="inner">−</span>]</a></span><aclass="srclink"href="../src/sim/lib.rs.html#1-637"title="goto source code">[src]</a></span><spanclass="in-band">Crate <aclass="mod"href="">sim</a></span></h1><divclass="docblock"><p>The sim crate runs a traffic simulation on top of the map_model. See also
<table><trclass="module-item"><td><aclass="mod"href="analytics/index.html"title="sim::analytics mod">analytics</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="mod"href="cap/index.html"title="sim::cap mod">cap</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="mod"href="events/index.html"title="sim::events mod">events</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="mod"href="make/index.html"title="sim::make mod">make</a></td><tdclass="docblock-short"><p>Everything needed to setup a simulation.
<ahref="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><trclass="module-item"><td><aclass="mod"href="mechanics/index.html"title="sim::mechanics mod">mechanics</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="mod"href="pandemic/index.html"title="sim::pandemic mod">pandemic</a></td><tdclass="docblock-short"><p>An experimental SEIR model by https://github.com/omalaspinas/ glued to the traffic simulation.
</td></tr><trclass="module-item"><td><aclass="mod"href="recorder/index.html"title="sim::recorder mod">recorder</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="mod"href="render/index.html"title="sim::render mod">render</a></td><tdclass="docblock-short"><p>Intermediate structures so that sim and game crates don't have a cyclic dependency.</p>
</td></tr><trclass="module-item"><td><aclass="mod"href="router/index.html"title="sim::router mod">router</a></td><tdclass="docblock-short"><p>For vehicles only, not pedestrians. Follows a Path from map_model, but can opportunistically
<table><trclass="module-item"><td><aclass="struct"href="struct.AgentProperties.html"title="sim::AgentProperties struct">AgentProperties</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.Analytics.html"title="sim::Analytics struct">Analytics</a></td><tdclass="docblock-short"><p>As a simulation runs, different pieces emit Events. The Analytics object listens to these,
</td></tr><trclass="module-item"><td><aclass="struct"href="struct.BorderSpawnOverTime.html"title="sim::BorderSpawnOverTime struct">BorderSpawnOverTime</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.CarID.html"title="sim::CarID struct">CarID</a></td><tdclass="docblock-short"><p>The numeric ID must be globally unique, without considering VehicleType. VehicleType is bundled
</td></tr><trclass="module-item"><td><aclass="struct"href="struct.CommutersVehiclesCounts.html"title="sim::CommutersVehiclesCounts struct">CommutersVehiclesCounts</a></td><tdclass="docblock-short"><p>The number of active vehicles and commuters, broken into different categories.</p>
</td></tr><trclass="module-item"><td><aclass="struct"href="struct.CreateCar.html"title="sim::CreateCar struct">CreateCar</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.CreatePedestrian.html"title="sim::CreatePedestrian struct">CreatePedestrian</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.DistanceInterval.html"title="sim::DistanceInterval struct">DistanceInterval</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.DrawCarInput.html"title="sim::DrawCarInput struct">DrawCarInput</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.DrawPedCrowdInput.html"title="sim::DrawPedCrowdInput struct">DrawPedCrowdInput</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.DrawPedestrianInput.html"title="sim::DrawPedestrianInput struct">DrawPedestrianInput</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.ExternalPerson.html"title="sim::ExternalPerson struct">ExternalPerson</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.ExternalTrip.html"title="sim::ExternalTrip struct">ExternalTrip</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.IndividTrip.html"title="sim::IndividTrip struct">IndividTrip</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.MapBorders.html"title="sim::MapBorders struct">MapBorders</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.OrigPersonID.html"title="sim::OrigPersonID struct">OrigPersonID</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.ParkedCar.html"title="sim::ParkedCar struct">ParkedCar</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.PedestrianID.html"title="sim::PedestrianID struct">PedestrianID</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.Person.html"title="sim::Person struct">Person</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.PersonID.html"title="sim::PersonID struct">PersonID</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.PersonSpec.html"title="sim::PersonSpec struct">PersonSpec</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.Scenario.html"title="sim::Scenario struct">Scenario</a></td><tdclass="docblock-short"><p>A Scenario describes all the input to a simulation. Usually a scenario covers one day.</p>
</td></tr><trclass="module-item"><td><aclass="struct"href="struct.ScenarioGenerator.html"title="sim::ScenarioGenerator struct">ScenarioGenerator</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.SidewalkSpot.html"title="sim::SidewalkSpot struct">SidewalkSpot</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="struct"href="struct.Sim.html"title="sim::Sim struct">Sim</a></td><tdclass="docblock-short"><p>The Sim ties together all the pieces of the simulation. Its main property is the current time.</p>
</td></tr><trclass="module-item"><td><aclass="struct"href="struct.SimFlags.html"title="sim::SimFlags struct">SimFlags</a></td><tdclass="docblock-short"><p>SimFlags specifies a simulation to setup.</p>
</td></tr><trclass="module-item"><td><aclass="struct"href="struct.SimOptions.html"title="sim::SimOptions struct">SimOptions</a></td><tdclass="docblock-short"><p>Options controlling the traffic simulation.</p>
<table><trclass="module-item"><td><aclass="enum"href="enum.AgentID.html"title="sim::AgentID enum">AgentID</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="enum"href="enum.AgentType.html"title="sim::AgentType enum">AgentType</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="enum"href="enum.AlertHandler.html"title="sim::AlertHandler enum">AlertHandler</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="enum"href="enum.AlertLocation.html"title="sim::AlertLocation enum">AlertLocation</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="enum"href="enum.CarStatus.html"title="sim::CarStatus enum">CarStatus</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="enum"href="enum.DelayCause.html"title="sim::DelayCause enum">DelayCause</a></td><tdclass="docblock-short"><p>Why is an agent delayed? If there are multiple reasons, arbitrarily pick one -- ie, somebody
</td></tr><trclass="module-item"><td><aclass="enum"href="enum.DrivingGoal.html"title="sim::DrivingGoal enum">DrivingGoal</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="enum"href="enum.ExternalTripEndpoint.html"title="sim::ExternalTripEndpoint enum">ExternalTripEndpoint</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="enum"href="enum.ParkingSpot.html"title="sim::ParkingSpot enum">ParkingSpot</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="enum"href="enum.PedCrowdLocation.html"title="sim::PedCrowdLocation enum">PedCrowdLocation</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="enum"href="enum.PersonState.html"title="sim::PersonState enum">PersonState</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="enum"href="enum.ScenarioModifier.html"title="sim::ScenarioModifier enum">ScenarioModifier</a></td><tdclass="docblock-short"><p>Transforms an existing Scenario before instantiating it.</p>
</td></tr><trclass="module-item"><td><aclass="enum"href="enum.SidewalkPOI.html"title="sim::SidewalkPOI enum">SidewalkPOI</a></td><tdclass="docblock-short"><p>Point of interest, that is</p>
</td></tr><trclass="module-item"><td><aclass="enum"href="enum.TripEndpoint.html"title="sim::TripEndpoint enum">TripEndpoint</a></td><tdclass="docblock-short"><p>Specifies where a trip begins or ends.</p>
</td></tr><trclass="module-item"><td><aclass="enum"href="enum.TripMode.html"title="sim::TripMode enum">TripMode</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="enum"href="enum.TripPhaseType.html"title="sim::TripPhaseType enum">TripPhaseType</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="enum"href="enum.TripPurpose.html"title="sim::TripPurpose enum">TripPurpose</a></td><tdclass="docblock-short"><p>Lifted from Seattle's Soundcast model, but seems general enough to use anyhere.</p>
<table><trclass="module-item"><td><aclass="constant"href="constant.BIKE_LENGTH.html"title="sim::BIKE_LENGTH constant">BIKE_LENGTH</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="constant"href="constant.BUS_LENGTH.html"title="sim::BUS_LENGTH constant">BUS_LENGTH</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="constant"href="constant.FOLLOWING_DISTANCE.html"title="sim::FOLLOWING_DISTANCE constant">FOLLOWING_DISTANCE</a></td><tdclass="docblock-short"><p>At all speeds (including at rest), cars must be at least this far apart, measured from front of
</td></tr><trclass="module-item"><td><aclass="constant"href="constant.LIGHT_RAIL_LENGTH.html"title="sim::LIGHT_RAIL_LENGTH constant">LIGHT_RAIL_LENGTH</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="constant"href="constant.MAX_CAR_LENGTH.html"title="sim::MAX_CAR_LENGTH constant">MAX_CAR_LENGTH</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="constant"href="constant.MIN_CAR_LENGTH.html"title="sim::MIN_CAR_LENGTH constant">MIN_CAR_LENGTH</a></td><tdclass="docblock-short"></td></tr><trclass="module-item"><td><aclass="constant"href="constant.SPAWN_DIST.html"title="sim::SPAWN_DIST constant">SPAWN_DIST</a></td><tdclass="docblock-short"><p>When spawning at borders, start the front of the vehicle this far along and gradually appear.
<table><trclass="module-item"><td><aclass="fn"href="fn.fork_rng.html"title="sim::fork_rng fn">fork_rng</a></td><tdclass="docblock-short"><p>Need to explain this trick -- basically keeps consistency between two different simulations when