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

@sakibcoolz/simulation

v0.2.0

Published

Optional deterministic mass-balance simulation for @scada3d scenes; results are always SIMULATED.

Readme

@sakibcoolz/simulation

Optional, deterministic process simulation for scenes built with the 3D SCADA SDK: tank levels and pipe flows over time, for demos, training and what-if checks. Two models: a fast mass-balance model and a hydraulic model with friction, fitting losses and pump curves. Results are always labelled SIMULATED.

npm install @sakibcoolz/simulation @sakibcoolz/core @sakibcoolz/components

ESM only · Node.js 20+ or browser · TypeScript types included · MIT

Quick start

import { createSimulation } from '@sakibcoolz/simulation';

const at = (id, type, properties) => ({
  id, type, position: { x: 0, y: 0, z: 0 }, rotation: { x: 0, y: 0, z: 0, w: 1 },
  scale: { x: 1, y: 1, z: 1 }, properties,
});
const plant = {
  schemaVersion: 3, units: 'm',
  components: [at('t', 'tank', { level: 80 }), at('v', 'valve', { open: true }), at('p', 'pipe', { length: 2 })],
  connections: [
    { id: 'c1', from: { instanceId: 't', portId: 'outlet' }, to: { instanceId: 'v', portId: 'in' } },
    { id: 'c2', from: { instanceId: 'v', portId: 'out' }, to: { instanceId: 'p', portId: 'in' } },
  ],
};

const sim = createSimulation(plant);               // mass balance (default)
const state = sim.step(30);                         // advance 30 s
state.levels.t;                                     // tank level in %, lower than 80
state.flows;                                        // per connection, source: 'SIMULATED'
state.model;                                        // { name: 'mass-balance', version: 1 }

const hydraulic = createSimulation(plant, { model: 'hydraulic' }).step(30);

Show it in 3D by passing the state to the viewer, which then marks levels and flows as SIMULATED: <Scada3DViewer scene={plant} simulation={state} /> (@sakibcoolz/react).

API

  • createSimulation(scene, { model?, feeds?, pumps?, dt?, clock? }) → { state(), step(seconds), update(scene), configure({ feeds, pumps }), reset() }.
    • feeds: [{ at: { instanceId, portId }, rate }] (m³/s) into a free port or a tank.
    • pumps: per pump id, a rate (mass balance) or a curve { shutoffHead, design: { rate, head } } (hydraulic).
    • update(scene) keeps tank volumes when topology or valve states change.
  • vesselOf(type, properties?) — vessel shape from the catalog, following each tank's dimensions: volumeAt, heightAt, portHeight, percentAt, volumeAtPercent, maxVolume.
  • MODEL, HYDRAULIC — model constants; frictionFactor(re, relativeRoughness); TANK.

Mass balance: gravity drain q = Cd·A·√(2gΔh) through open paths, feeds and pump rates, equal tee splits, closed valves and stopped pumps block; explicit Euler in 0.1 s steps; notes such as overflow, dry, blocked. Hydraulic: elevation and pressure, Darcy–Weisbach friction (Swamee–Jain), K-factor fittings, pump curves, resistance-based tee splits, tank-to-tank flow and backflow; trees only (a loop is reported as loop).

Not a control system

Simulation only: it never reads from or writes to real equipment, and every result carries source: 'SIMULATED'.

Licence: MIT