TypeScript icon, indicating that this package has built-in type declarations

0.13.0 • Public • Published


"Sim" or "SimRS" is a discrete event simulation package that facilitates
Rust- and npm-based simulation products and projects

Sim Website | Sim Demo | Sim Docs

stability-experimental GitHub Workflow Status npm npm Codecov

"Sim" or "SimRS" is a discrete event simulation package that facilitates Rust- and npm-based simulation products and projects.

This repository contains:

  1. Random variable framework, for easy specification of stochastic model behaviors.
  2. Out-of-the-box models, for quickly building out simulations of dynamic systems with common modular components.
  3. Output analysis framework, for analyzing simulation outputs statistically.
  4. Simulator engine, for managing and executing discrete event simulations.
  5. Custom model macros, for seamlessly integrating custom models into simulations.

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

Table of Contents


Simulation is a powerful tool for analyzing and designing complex systems. However, most simulators have steep learning curves, are proprietary, and suffer from limited portability. Sim aspires to reduce the time required to build new simulation products, complete simulation projects, and learn simulation fundamentals. Sim is open source and, by virtue of compilation target flexibility, relatively portable.


For use in Rust code bases, leverage the package as a cargo dependency

sim = "0.13"

For use as a WebAssembly module in a JavaScript/TypeScript code base, leverage the package as a npm dependency

npm i sim-rs


Rust simulations are created by passing Models and Connectors to Simulation's post constructor. WebAssembly simulations are defined in a declarative YAML or JSON format, and then ingested through WebSimulation's post_yaml or post_json constructors. Both models and connectors are required to define the simulation. For descriptions of the out-of-the-box models, see

Simulations may be stepped with the step, step_n, and step_until methods. Input injection is possible with the inject_input method.

Analyzing simulations will typically involve some combination of processing model records, collecting message transfers, and using output analysis tools. Analysis of IID samples and time series data are possible.

Please refer to the documentation at Also, the test simulations are a good reference for creating, running, and analyzing simulations with Sim.


Issues, feature requests, and pull requests are always welcome!


This project is licensed under either of Apache License, Version 2.0 or MIT License at your option.

Apache License, Version 2.0

MIT License

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in sim by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Package Sidebar


npm i sim-rs

Weekly Downloads





MIT OR Apache-2.0

Unpacked Size

734 kB

Total Files


Last publish


  • ndebuhr