<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="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."><metaname="keywords"content="rust, rustlang, rust-lang, sim"><title>sim - Rust</title><linkrel="stylesheet"type="text/css"href="../normalize.css"><linkrel="stylesheet"type="text/css"href="../rustdoc.css"id="mainThemeStyle"><linkrel="stylesheet"type="text/css"href="../light.css"id="themeStyle"><linkrel="stylesheet"type="text/css"href="../dark.css"disabled><linkrel="stylesheet"type="text/css"href="../ayu.css"disabled><scriptid="default-settings"></script><scriptsrc="../storage.js"></script><scriptsrc="../crates.js"></script><scriptdefersrc="../main.js"></script>
<noscript><linkrel="stylesheet"href="../noscript.css"></noscript><linkrel="alternate icon"type="image/png"href="../favicon-16x16.png"><linkrel="alternate icon"type="image/png"href="../favicon-32x32.png"><linkrel="icon"type="image/svg+xml"href="../favicon.svg"><styletype="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><bodyclass="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="sidebar"><divclass="sidebar-menu"role="button">☰</div><ahref='../sim/index.html'><divclass='logo-container rust-logo'><imgsrc='../rust-logo.png'alt='logo'></div></a><h2class="location">Crate sim</h2><divclass="block version"><divclass="narrow-helper"></div><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><divid="sidebar-vars"data-name="sim"data-ty="mod"data-relpath=""></div><scriptdefersrc="sidebar-items.js"></script></div></nav><divclass="theme-picker"><buttonid="theme-picker"aria-label="Pick another theme!"aria-haspopup="menu"title="themes"><imgwidth="18"height="18"alt="Pick another theme!"src="../brush.svg"></button><divid="theme-choices"role="menu"></div></div><navclass="sub"><formclass="search-form"><divclass="search-container"><div><selectid="crate-search"><optionvalue="All crates">All crates</option></select><inputclass="search-input"name="search"autocomplete="off"spellcheck="false"placeholder="Click or press ‘S’ to search, ‘?’ for more options…"type="search"></div><buttontype="button"id="help-button"title="help">?</button><aid="settings-menu"href="../settings.html"title="settings"><imgwidth="18"height="18"alt="Change settings"src="../wheel.svg"></a></div></form></nav><sectionid="main"class="content"><h1class="fqn"><spanclass="in-band">Crate <aclass="mod"href="#">sim</a><buttonid="copy-path"onclick="copy_path(this)"title="Copy item path to clipboard"><imgsrc="../clipboard.svg"width="19"height="18"alt="Copy item path"></button></span><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-603"title="goto source code">[src]</a></span></h1><detailsclass="rustdoc-toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>The sim crate runs a traffic simulation on top of the map_model. See also
<ahref="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><divclass="item-row"><divclass="item-left module-item"><aclass="mod"href="mechanics/index.html"title="sim::mechanics mod">mechanics</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="mod"href="pandemic/index.html"title="sim::pandemic mod">pandemic</a></div><divclass="item-right docblock-short"><p>An experimental SEIR model by https://github.com/omalaspinas/ glued to the traffic simulation.
</div></div><divclass="item-row"><divclass="item-left module-item"><aclass="mod"href="recorder/index.html"title="sim::recorder mod">recorder</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="mod"href="render/index.html"title="sim::render mod">render</a></div><divclass="item-right docblock-short"><p>Intermediate structures so that sim and game crates don’t have a cyclic dependency.</p>
</div></div><divclass="item-row"><divclass="item-left module-item"><aclass="mod"href="router/index.html"title="sim::router mod">router</a></div><divclass="item-right docblock-short"><p>For vehicles only, not pedestrians. Follows a Path from map_model, but can opportunistically
<divclass="item-table"><divclass="item-row"><divclass="item-left module-item"><aclass="struct"href="struct.AgentProperties.html"title="sim::AgentProperties struct">AgentProperties</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="struct"href="struct.Analytics.html"title="sim::Analytics struct">Analytics</a></div><divclass="item-right docblock-short"><p>As a simulation runs, different pieces emit Events. The Analytics object listens to these,
</div></div><divclass="item-row"><divclass="item-left module-item"><aclass="struct"href="struct.BorderSpawnOverTime.html"title="sim::BorderSpawnOverTime struct">BorderSpawnOverTime</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="struct"href="struct.CarID.html"title="sim::CarID struct">CarID</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="struct"href="struct.CommutersVehiclesCounts.html"title="sim::CommutersVehiclesCounts struct">CommutersVehiclesCounts</a></div><divclass="item-right docblock-short"><p>The number of active vehicles and commuters, broken into different categories.</p>
</div></div><divclass="item-row"><divclass="item-left module-item"><aclass="struct"href="struct.SimFlags.html"title="sim::SimFlags struct">SimFlags</a></div><divclass="item-right docblock-short"><p>SimFlags specifies a simulation to setup. After parsing from structopt, you must call
</div></div><divclass="item-row"><divclass="item-left module-item"><aclass="struct"href="struct.SimOptions.html"title="sim::SimOptions struct">SimOptions</a></div><divclass="item-right docblock-short"><p>Options controlling the traffic simulation.</p>
</div></div><divclass="item-row"><divclass="item-left module-item"><aclass="struct"href="struct.SlidingWindow.html"title="sim::SlidingWindow struct">SlidingWindow</a></div><divclass="item-right docblock-short"><p>A sliding window, used to count something over time</p>
</div></div><divclass="item-row"><divclass="item-left module-item"><aclass="enum"href="enum.DrivingGoal.html"title="sim::DrivingGoal enum">DrivingGoal</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="enum"href="enum.Intent.html"title="sim::Intent enum">Intent</a></div><divclass="item-right docblock-short"><p>Shows an agent’s current inner intention or thoughts.</p>
</div></div><divclass="item-row"><divclass="item-left module-item"><aclass="enum"href="enum.ParkingSpot.html"title="sim::ParkingSpot enum">ParkingSpot</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="enum"href="enum.PedCrowdLocation.html"title="sim::PedCrowdLocation enum">PedCrowdLocation</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="enum"href="enum.PersonState.html"title="sim::PersonState enum">PersonState</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="enum"href="enum.Problem.html"title="sim::Problem enum">Problem</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="enum"href="enum.SidewalkPOI.html"title="sim::SidewalkPOI enum">SidewalkPOI</a></div><divclass="item-right docblock-short"><p>Point of interest, that is</p>
<divclass="item-table"><divclass="item-row"><divclass="item-left module-item"><aclass="constant"href="constant.BIKE_LENGTH.html"title="sim::BIKE_LENGTH constant">BIKE_LENGTH</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="constant"href="constant.BUS_LENGTH.html"title="sim::BUS_LENGTH constant">BUS_LENGTH</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="constant"href="constant.FOLLOWING_DISTANCE.html"title="sim::FOLLOWING_DISTANCE constant">FOLLOWING_DISTANCE</a></div><divclass="item-right docblock-short"><p>At all speeds (including at rest), cars must be at least this far apart, measured from front of
</div></div><divclass="item-row"><divclass="item-left module-item"><aclass="constant"href="constant.LIGHT_RAIL_LENGTH.html"title="sim::LIGHT_RAIL_LENGTH constant">LIGHT_RAIL_LENGTH</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="constant"href="constant.MAX_CAR_LENGTH.html"title="sim::MAX_CAR_LENGTH constant">MAX_CAR_LENGTH</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="constant"href="constant.MIN_CAR_LENGTH.html"title="sim::MIN_CAR_LENGTH constant">MIN_CAR_LENGTH</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="constant"href="constant.SPAWN_DIST.html"title="sim::SPAWN_DIST constant">SPAWN_DIST</a></div><divclass="item-right docblock-short"><p>When spawning at borders, start the front of the vehicle this far along and gradually appear.
<divclass="item-table"><divclass="item-row"><divclass="item-left module-item"><aclass="fn"href="fn.count_parked_cars_per_bldg.html"title="sim::count_parked_cars_per_bldg fn">count_parked_cars_per_bldg</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="fn"href="fn.fork_rng.html"title="sim::fork_rng fn">fork_rng</a></div><divclass="item-right docblock-short"><p>Need to explain this trick – basically keeps consistency between two different simulations when