npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rwth-pads/cpnsim

v0.4.8

Published

CPNsim is a Rust library and command-line tool with WebAssembly target for simulating Colored Petri Nets (CPNs)

Readme

CPNsim

CPNsim is a Rust library and command-line tool for simulating Colored Petri Nets (CPNs). It parses CPN models in the .ocpn JSON format and executes simulations step by step — handling token consumption, guard evaluation, and token production based on arc inscriptions and variable bindings.

Note: This library is a work in progress. Feel free to leave an issue with your feature request or bug report — your feedback is greatly appreciated!

CPNsim powers the simulation engine behind OCPN Tools and compiles to WebAssembly for in-browser execution.

Features

Core Simulation

  • CPN model parsing — Reads .ocpn JSON format with support for places, transitions, and arcs
  • Color sets — Basic types (INT, STRING, BOOL, UNIT), product types, record types, enumerated types, indexed types, subsets, lists, and INT with ranges
  • Variables & bindings — Automatic variable binding during transition firing with support for multi-variable arcs
  • Guard evaluation — Transition guards evaluated using the Rhai scripting engine
  • Arc inscriptions — Input and output arc expressions evaluated via Rhai for flexible token manipulation
  • Timed simulation — Time expressions, arc delays, and automatic time advancement for timed CPN models
  • Hierarchical nets — Substitution transitions with port/socket bindings and fusion places
  • Priority levels — Transition priority support for controlling firing order
  • Distribution functions — 14 CPN Tools-compatible stochastic functions: bernoulli, beta, binomial, chisq, discrete, erlang, exponential, gamma, normal, poisson, rayleigh, student, uniform, weibull

Monitors

  • Marking-size monitors — Track token counts on watched places over simulation steps
  • Transition-count monitors — Count firings of specific transitions
  • Breakpoint monitors — Stop simulation when a place-based or transition-based predicate is met (e.g., place empty, transition fires)
  • Data collector monitors — User-defined monitors with custom Rhai observation and predicate scripts
  • Statistics — Each monitor computes running statistics: count, sum, average, min, max, and standard deviation

State Space Analysis

  • BFS exploration — Breadth-first state space construction with configurable limits (max states, max arcs)
  • Canonical markings — Deterministic state deduplication; timed models include simulation time in the state key
  • SCC decomposition — Tarjan's algorithm for strongly connected component detection
  • Report metrics — Dead markings, home markings, terminal SCCs, place bounds (min/max tokens), dead/live transitions, and transition fairness (arc occurrence counts)
  • Timed state spaces — Supports timed CPN models with configurable time bounds
  • Deterministic overrides — Replace stochastic distribution functions and IntRange random bindings with constant values for finite, deterministic exploration

Integration

  • Library interface — Use as a Rust crate in other projects
  • WebAssembly — Compiles to WASM via wasm-pack for browser-based simulation
  • Debug CLI — Command-line executable for running simulations and inspecting model behavior

Building

Debug (CLI)

cargo run -- examples/petrinet-2.ocpn

WebAssembly

wasm-pack build --scope rwth-pads --target web --release -- --features wasm

License

This project is licensed under the MIT License. See the LICENSE file for details.