Skip to contents

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/

Installation

# install.packages("remotes")
remotes::install_github("imanojkumar/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.

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:

  1. Push to main - the pkgdown action builds the site to the gh-pages branch.
  2. Repo Settings โ†’ Pages โ†’ deploy from branch gh-pages, folder /.
  3. 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

Part of the same open-source mining-analytics ecosystem as MiningAnalytics and MiningCostBench. haulplan is deliberately standalone (see HANDOFF.md for the architecture decision).

License

MIT ยฉ 2026 Manoj Kumar