Truckโshovel fleet deployment engine with a finite-source queue/bunching model and an interactive Shiny dashboard for haulage planning.
haulplan answers the three questions every open-pit shift planner asks:
| Question | Tool |
|---|---|
| How many trucks does this circuit need? |
finite_source_queue(), queue_curve()
|
| Where should my trucks go? | deploy_fleet() |
| How did we actually perform? |
haul_kpis() on raw cycle logs |
โฆplus a discrete-event simulator (simulate_shift()) for validating the analytic model, plotting helpers, realistic bundled datasets, a KPI dictionary, and a four-tab Shiny dashboard (run_haulplan_app()).
๐ Documentation & tutorials: https://imanojkumar.github.io/haulplan/
Quick start
library(haulplan)
# 1. Model one circuit: 7 x 90 t trucks, 2 shovels
q <- finite_source_queue(n_trucks = 7, n_shovels = 2,
cycle_min = 18.5, load_min = 3, payload_t = 90)
q
#> Production : 1370.0 t/h ...
#> Queue per truck : 0.94 min ...
# 2. Where does production saturate?
curve <- queue_curve(14, 2, 18.5, 3, 90)
plot_queue_curve(curve, target_tph = 1500)
# 3. Deploy 18 trucks across 5 routes, optimally
dep <- deploy_fleet(haul_example("routes"), n_trucks = 18)
plot_deployment(dep)
# 4. KPIs from a real (or the bundled) shift cycle log
haul_kpis(haul_example("cycles"), shift_hours = 12)$fleet
# 5. Interactive dashboard
run_haulplan_app()The model in one paragraph
A haul circuit is a finite-source queue (M/M/c//N): the trucks are the customers, and a truck waiting at the shovel is a truck not generating the next arrival. haulplan solves this machine-repair model analytically - production, queue time, shovel utilisation, match factor and bunching efficiency (realised vs queue-free ideal output) - and layers a greedy marginal-productivity optimiser on top to split a fleet across routes. Because route production is concave in fleet size, the greedy allocation is optimal. A discrete-event simulator cross-validates the analytics and covers non-exponential (lognormal) cycle times.
Tutorials
- Getting started
- The finite-source queue and truck bunching
- Fleet deployment across haul routes
- Haulage KPIs: definitions and interpretation
- The haulplan dashboard
A one-page cheat sheet covers the whole API, the KPI dictionary and the CSV formats.
Sample data
Three realistic synthetic datasets ship with the package, both as lazy data and as CSVs (inst/extdata/) you can use as upload templates for the dashboard:
-
haul_routes- 5 routes with shovels, cycle/load times and constraints -
haul_fleet- 22-truck mixed fleet register -
haul_cycles- one 12-hour shift cycle log (~620 cycles)
Regenerate or customise them with data-raw/make_sample_data.R.
Launching the tutorial site (GitHub Pages)
The repo ships a ready pkgdown workflow. After pushing to GitHub:
- Push to
main- the pkgdown action builds the site to thegh-pagesbranch. - Repo Settings โ Pages โ deploy from branch
gh-pages, folder/. - The site appears at
https://<user>.github.io/haulplan/.
Project structure
haulplan/
โโโ R/ # queue model, deployment, simulator, KPIs, plots
โโโ inst/shinyapp/ # the dashboard (app.R)
โโโ inst/extdata/ # sample CSVs + KPI dictionary
โโโ inst/cheatsheet/ # one-page cheat sheet
โโโ data/ data-raw/ # lazy data + generator script
โโโ vignettes/ # the five tutorials (pkgdown articles)
โโโ tests/testthat/ # 40+ tests incl. analytic-vs-DES validation
โโโ .github/workflows/ # R CMD check + pkgdown deploy
โโโ HANDOFF.md # project handoff / maintainer guide
Related projects
Part of the same open-source mining-analytics ecosystem as MiningAnalytics and MiningCostBench. haulplan is deliberately standalone (see HANDOFF.md for the architecture decision).
