--- title: "Entity flow analysis" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Entity flow analysis} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} resource_files: - figures/logo.svg - figures/logo-dark.svg --- [![R-CMD-check](https://github.com/CTTIR/dynasimR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/CTTIR/dynasimR/actions/workflows/R-CMD-check.yaml) [![pkgdown](https://github.com/CTTIR/dynasimR/actions/workflows/pkgdown.yaml/badge.svg)](https://cttir.github.io/dynasimR/) [![Codecov test coverage](https://codecov.io/gh/CTTIR/dynasimR/branch/main/graph/badge.svg)](https://app.codecov.io/gh/CTTIR/dynasimR?branch=main) [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) ```{r setup, include = FALSE} knitr::opts_chunk$set(collapse = TRUE, comment = "#>") ``` Many simulations move entities through sequential processing stages (Stage 1 -> Stage 2 -> Stage 3 -> Stage 4). This vignette shows how to quantify throughput and identify bottlenecks. ```{r} library(dynasimR) sim <- load_example_data() ``` ## Stage throughput ```{r} st <- stage_throughput(sim) st ``` Only `Stage2` (time_to_stage2) is present in the shipped example, but the machinery generalises to Stage1..Stage4 when the columns exist in your simulation output. ## Bottleneck detection ```{r} detect_bottlenecks(st, threshold = 0.75) ``` ## Visualising first-service times ```{r, fig.width = 6, fig.height = 4} plot_scenario_heatmap( sim, metrics = c("median_time_to_first_service", "median_time_to_stage2") ) ```