ES
← Back to Portfolio
category.mining-simulation August 2026

StockTwin — Run-of-Mine Stockpile Twin (Built Truck by Truck)

A run-of-mine stockpile built the way one actually is: by trucks, one load at a time, following a dump plan, on ground they have to be able to climb. StockTwin routes every load over the trafficable surface, stands the material at its angle of repose, dozes the heaps into a floor, sorts each load down a real face with the Gray-Thornton kinetic-sieving model, and then reclaims in campaigns, so you can measure the three questions that matter: how much the pile homogenises the feed (variance reduction against the 1/N independent-layer bound, withheld where unreliable), where each reclaimed tonne came from (a per-cell lot ledger whose fractions sum to one on every cut), and how much size segregation biases the cut. Twenty-two scenarios across six axes, 22,656 placed loads, every one relaxing to ZERO cell pairs over the angle of repose, gated on the actual artifact. The physics is the separately published bedblend package; this repo declares none of its own. Synthetic and MineLib-public data only. Not a blending optimizer and it emits no plant setpoint.

What it does
Builds a ROM stockpile truck by truck under a dump plan, then measures homogenisation, provenance and size segregation; ships the pile as a volume (one deposition event per voxel on a half-metre grid), not a surface
Engine
bedblend (published separately on PyPI, consumed pinned); this repo declares NO package of its own; data-pipeline invoked by path
Scenario matrix
22 cases across 6 axes, 22,656 placed loads; each states its kill criterion in advance; bake gate enforced on the artifact (zero over-repose pairs, ledger agrees column-by-column, mass to 1e-6, no cell below ground)
Physics
Gray-Thornton kinetic sieving down a real terrain face; four measured dump profiles calibrated to a published UAV envelope (Young & Rogers 2022, doi:10.3390/mining2010006, 28 surveyed dumps)
Data
Synthetic lane committed and byte-reproducible; MineLib public block models (real Cu grades) fetched at runtime into browser memory only, never committed; no open truck-by-truck dump log exists at a usable licence, so one is generated to the FMS schema
Deploy
React 19 + Vite + @fasl-work/caos-app-shell, three.js 3-D stage, canvas 2-D sections; TypeScript verdict lane in-browser; static SPA on GitHub Pages; MIT; part of the Faena hub
StockTwin — Run-of-Mine Stockpile Twin (Built Truck by Truck) — Architecture
#mining-simulation #stockpile #blending #grade-control #kinetic-sieving #discrete-event #three-js #digital-twin #mining

Business Context

A ROM stockpile is where grade-control error and blending benefit both hide, and both show up in the accounts: public disclosures name lower grade and lower recovery on stockpiles as write-down drivers, and auditors have raised stockpile grade and tonnage estimation as a Critical Audit Matter. The value of a twin like this is not a prettier pile, it is a defensible reading of what is going to the plant and how far traceability still reaches once the dozer has moved material and the built sequence has drifted from the planned one. Per-truck records are one sample per 100 to 400 tonnes where conventional practice is closer to one per 175,000, so the sampling density to answer these questions already exists at most operations; what has been missing is a build model honest enough to trust the answer. StockTwin exposes the per-cell grade field and reclaim-front state a blending optimizer would consume, without pretending to be one.

Strategic Value

StockTwin is a stockpile twin that earns trust by building under real constraints and measuring against the right bounds. Its scenario matrix is its validation design: twenty-two cases across six axes (feed structure, yard and routing, landform, campaign, operating choices, plus a reference), 22,656 placed loads, each stating in advance what result would mean the code is wrong, with the bake gate enforced on the ACTUAL artifact (zero cell pairs over the angle of repose, the lot ledger agreeing with the terrain column by column, mass conserved to one part in a million, no cell below original ground). The kill criteria held: shovel dwell moves the measured stream range from 852 t through 5242 to 13826 with geometry and seed identical, confinement takes a valley to 27.0 m against a flat pad at 13.7 from the same load budget, and wet material at 43 degrees of repose stands at 15.8 m. Two scenarios that would not relax were WITHDRAWN rather than shipped with a surface the product itself rejects, and that cost (the matrix does not cover all five published fill types) is recorded as a finding rather than hidden. The engine is the separately published bedblend package, per the rule that a product is deployed and a reusable engine gets its own repo. It is the open, synthetic reflection of a real mineral-tracking line of work, and it is honest about what it is not: not metal accounting, not a comminution or flotation model, not a blending optimizer, and it emits no plant setpoint.

The Challenge

A run-of-mine stockpile is inventory on the balance sheet whose value rests on an estimated grade and recovery for material that often nobody has measured again, and it is also the main blending device feeding the plant. Two hard facts make it easy to model wrongly. First, a stockpile is not a heap: fresh material stands at about 37 degrees and a haul truck climbs about two thirds of that, so a truck never stands on fresh material, which means tips are not arbitrary points on a pad but positions inside a designed dump plan reachable over a ramp a dozer maintains. Second, once material is placed it does not stay as booked: it is diluted, segregated and re-ordered as the pile grows and is reclaimed. Most stockpile tools either quietly teleport trucks to wherever the plan wants them, or report a homogenisation benefit an order of magnitude too good because they compare against nothing. The honest problem is to build the pile under the constraints a real operation faces and to measure blending, provenance and segregation against the right bounds.

Our Approach

StockTwin simulates the build, measures it, and shows the working. A truck routes over the trafficable surface, spots against the working face, tips, and leaves; the material stands at its angle of repose; a dozer turns the tipped heaps into a floor so the next lift starts higher. It builds in the two phases a bench is actually built in, paddock dumps short of the crest levelled into a floor, then edge dumping over the crest in radial sweeps, using four measured dump profiles selected by distance to the crest and calibrated against a published UAV-surveyed envelope (Young and Rogers 2022) rather than invented. As the pile grows, a tip a truck can no longer reach is REFUSED and recorded, about 17 percent of offered loads in most scenarios, because the plan is generated once while the pile grows away from it, and saying so is more useful than teleporting a truck. It answers three questions: homogenisation as the variance reduction ratio drawn against the 1/N independent-layer bound (with the bound WITHHELD where the effective layer count cannot be estimated reliably, since a raw ratio overstates the benefit by roughly an order of magnitude); provenance as a per-cell ordered lot ledger where each reclaim cut reports the tonnage fraction from each dump and those fractions sum to one, checked numerically on every cut; and segregation solved with the Gray-Thornton kinetic-sieving model down a REAL face taken from the terrain, so the coarse fraction across a pile spans 0.137 to 0.940 rather than a uniform nominal value. The physics lives in the separately published bedblend package, consumed as a pinned dependency; this repository declares no package of its own. The heavy simulation is baked offline into committed reproducible traces, and a TypeScript lane in the browser computes only the verdicts.

Key Performance Indicators

KPIBaselineResultImpact
A truck never stands on fresh materialTeleport the truck to wherever the plan wants the tipUnreachable tips are REFUSED and recorded (about 17.3% of offered loads in most scenarios; 58.7% in intensive_feed, which is that scenario subject)The pile is built on ground a truck could actually drive, and the re-plan gap is reported not hidden
Homogenisation against the right boundA bare variance-reduction ratio, which overstates the benefit by ~10xVRR drawn against the 1/N independent-layer bound, with the bound WITHHELD where the effective layer count cannot be estimated reliablyYou see how much of the ideal blend the pile actually recovered, not a flattering number
The stability gate, on the artifactA predecessor engine finished with 446 cell pairs over repose, the worst at 55.9 degrees against an imposed 37 (rendered as spikes)All 22 shipped scenarios (22,656 loads) relax to ZERO cell pairs over the angle of repose; 2 scenarios that would not relax were withdrawn, not shipped brokenThe surface obeys its own physics, and the gate is checked on the actual output not the code

Architecture

stocktwin pipeline

stocktwin pipeline

Technology Stack

Python bedblend NumPy TypeScript React Vite three.js MineLib

Reel

A short, composed reel of the product.

StockTwin — Run-of-Mine Stockpile Twin (Built Truck by Truck) reel

In action

A short tour of the live app — the real interface, recorded from the deployed site.

StockTwin — Run-of-Mine Stockpile Twin (Built Truck by Truck) in action

Application Screenshots

StockTwin — Run-of-Mine Stockpile Twin (Built Truck by Truck)
StockTwin — Run-of-Mine Stockpile Twin (Built Truck by Truck)