Crate sim

source ·
Expand description


“Sim” or “Sim-RS” provides a discrete event simulation engine, to facilitate Rust- and npm-based simulation products and projects.

This repository contains:

  • Random variable framework, for easy specification of stochastic model behaviors.
  • Pre-built atomic models, for quickly building out simulations of dynamic systems with common modular components.
  • Output analysis framework, for analyzing simulation outputs statistically.
  • Simulator engine, for managing and executing discrete event simulations.

Sim is compatible with a wide variety of compilation targets, including WASM. Sim does not require nightly Rust.


  • The input modeling module provides a foundation for configurable model behaviors, whether that is deterministic or stochastic. The module includes a set of random variable distributions for use in atomic models, a system around “thinning” for non-stationary model behaviors, and a structure around random number generation.
  • The models module provides a set of prebuilt atomic models, for easy reuse in simulation products and projects. Additionally, this module specifies the requirements of any additional custom models, via the Model trait.
  • The output analysis module provides standard statistical analysis tools for analyzing simulation outputs. Independent, identically-distributed (IID) samples are analyzed with the IndependentSample. Time series (including those with initialization bias and autocorrelation) can be analyzed with TerminatingSimulationOutput or SteadyStateOutput.
  • The simulator module provides the mechanics to orchestrate the models and connectors via discrete event simulation. The specific formalism for simulation execution is the Discrete Event System Specification. User interaction is also captured in this module - simulation stepping and input injection.
  • The utilies module provides general capabilities, that may span the input modeling, models, output analysis, and simulator modules. The utilities are centered around debugging/traceability and common arithmetic.