# Logistics

8 of the bundled models. The numbers are from a run made when this page was generated: see [how](index.md#how-the-numbers-are-made).

## Belt with stops, a divert and a merge

One accumulating belt with every kind of point: a label stop, a scale stop that needs an operator, a divert that pushes returns onto a lane, and a merge that brings rush cartons in from a side belt. Every number is invented for teaching.

```console
naga run belt_points --replications 3
```

```mermaid
flowchart LR
    b0["cartons (CREATE)"]
    b1["returns_in (CREATE)"]
    b2["rush_in (CREATE)"]
    b3["rush_belt (CONVEYOR)"]
    b4["main_belt (CONVEYOR)"]
    b5["pack (PROCESS)"]
    b6["shipped (DISPOSE)"]
    b7["returns_lane (CONVEYOR)"]
    b8["returns_desk (PROCESS)"]
    b9["restocked (DISPOSE)"]
    b0 --> b4
    b1 --> b4
    b2 --> b3
    b3 --> b4
    b4 --> b5
    b4 --> b7
    b5 --> b6
    b7 --> b8
    b8 --> b9
```

3 replications, seed 0:

| KPI | Mean | 95% half-width |
|---|---|---|
| `system/Total Entities Completed` | 995 | 48 |
| `system/Avg Throughput Time` | 3.12 | 1.6 |
| `system/Avg Queue Length` | 0.72 | 0.12 |
| `system/Avg Resource Usage %` | 60.1 | 2 |

## Conveyor line with a sorter, a transfer and a two-way chain

A carton line laid out as conveyor pieces on the floor: a curved infeed with a scanner eye and a label stop, a zoned accumulation belt, a metering belt, a sorter whose angled divert sends one carton in five to a quality desk and whose merge takes them back, a pop-up transfer sharing the cartons between two lines, a timed link to the packing area and a two-way chain that runs backward to hand cartons to rework. Every number is invented for teaching.

```console
naga run conveyor_line
```

```mermaid
flowchart LR
    b0["Cartons arrive (CREATE)"]
    b1["Infeed (CONVEYOR)"]
    b2["Accumulation (CONVEYOR)"]
    b3["Metering (CONVEYOR)"]
    b4["Sorter (CONVEYOR)"]
    b5["Main line (CONVEYOR)"]
    b6["QA lane (CONVEYOR)"]
    b7["QA check (PROCESS)"]
    b8["QA return (CONVEYOR)"]
    b9["Transfer (CONVEYOR_TRANSFER)"]
    b10["Line A (CONVEYOR)"]
    b11["Packing (CONVEYOR)"]
    b12["Pack station (PROCESS)"]
    b13["Shipped (DISPOSE)"]
    b14["Line B (CONVEYOR)"]
    b15["Two-way 1 (CONVEYOR)"]
    b16["Two-way 2 (CONVEYOR)"]
    b17["Dispatched (DISPOSE)"]
    b18["Rework (DISPOSE)"]
    b0 --> b1
    b1 --> b2
    b2 --> b3
    b3 --> b4
    b4 --> b5
    b4 --> b6
    b6 --> b7
    b8 --> b5
    b7 --> b8
    b5 --> b9
    b9 --> b10
    b10 --> b11
    b11 --> b12
    b12 --> b13
    b9 --> b14
    b14 --> b15
    b15 --> b16
    b16 --> b17
    b15 --> b18
```

3 replications, seed 0:

| KPI | Mean | 95% half-width |
|---|---|---|
| `system/Total Entities Completed` | 262 | 5.2 |
| `system/Avg Throughput Time` | 121 | 2.6 |
| `system/Avg Queue Length` | 0.209 | 0.15 |
| `system/Avg Resource Usage %` | 40.6 | 8.9 |

## Hub day: electrifying the ground support equipment

The hub day of the turnaround workload model with its ground support equipment's energy priced and counted: diesel as it is, the same fleets electric at the same counts charging in a night window or whenever a vehicle is free, and the latter with spares. The question it answers: what do energy cost, CO2 and the grid's peak become, do departures stay on time, and does the extra capital pay back? Read on_time_departure, the flow summary (fuel and grid kWh, peak kW), the battery summary (depleted events) and the investment case across scenarios. Illustrative figures.

```console
naga run gse_electrification
```

1 replication, seed 0:

| KPI | Mean | 95% half-width |
|---|---|---|
| `system/Total Entities Completed` | 570 |  |
| `system/Avg Throughput Time` | 57.1 |  |
| `system/Avg Queue Length` | 7.71 |  |
| `system/Avg Resource Usage %` | 41.2 |  |
| `user/on_time_departure` | 0.868 |  |
| `user/turnaround_wide_min` | 86 |  |
| `user/turnaround_narrow_min` | 56.7 |  |
| `system/Total Cost` | 39,900 |  |

## Container terminal: electrification

The quay-to-yard terminal with its straddle carriers' energy priced and counted: diesel as it is, battery straddle carriers charging opportunistically, and AGVs on pack swap. The question it answers: what do energy cost, CO2 and the grid's peak become, and does the extra capital pay back? Read the flow summary (fuel and grid kWh, peak kW), the cost summary, and the investment case across scenarios. Illustrative figures.

```console
naga run terminal_electrification
```

```mermaid
flowchart LR
    b0["vessel_calls_1 (SUBMODEL)"]
    b1["quay_crane_1 (SUBMODEL)"]
    b2["truck_gate_1 (SUBMODEL)"]
    b3["yard_block_1 (SUBMODEL)"]
    b4["yard_block_2 (SUBMODEL)"]
    b5["transport (SUBMODEL)"]
    b6["Quay (STATION)"]
    b7["Yard A in (STATION)"]
    b8["Yard B in (STATION)"]
    b9["Quay load (STATION)"]
    b10["to_a (TRANSPORT)"]
    b11["to_b (TRANSPORT)"]
    b12["split (DECIDE)"]
    b13["export (DECIDE)"]
    b14["by_type (DECIDE)"]
    b15["Yard out (DECIDE)"]
    b16["done (DISPOSE)"]
    b17["stacked (DISPOSE)"]
    b18["loaded (DISPOSE)"]
    b19["grid_connection_1 (SUBMODEL)"]
    b20["equipment_draw_1 (SUBMODEL)"]
    b21["equipment_draw_2 (SUBMODEL)"]
    b0 --> b14
    b14 --> b1
    b14 --> b13
    b13 --> b7
    b13 --> b8
    b1 --> b6
    b6 --> b12
    b12 --> b10
    b12 --> b11
    b10 --> b7
    b11 --> b8
    b7 --> b3
    b3 --> b15
    b8 --> b4
    b4 --> b15
    b15 --> b17
    b5 --> b16
    b15 --> b5
    b9 --> b1
    b1 --> b18
```

1 replication, seed 0:

| KPI | Mean | 95% half-width |
|---|---|---|
| `system/Total Entities Completed` | 9,030 |  |
| `system/Avg Throughput Time` | 544 |  |
| `system/Avg Queue Length` | 482 |  |
| `system/Avg Resource Usage %` | 35.2 |  |
| `user/truck_gate_1/truck turn time` | 130 |  |
| `system/Total Cost` | 182,000 |  |

## Container terminal: quay to yard

One berth with three quay cranes, straddle carriers between the quay and two yard blocks with an RTG each, a truck gate, and a week of synthetic vessel calls. The question it answers: how many straddle carriers per crane keep the cranes at their target moves per hour? In the results, read the crane pool's seizes (gross moves), the order summary (vessel turn time per call), the fleet summary (carrier utilisation and waiting) and the truck turn time. Illustrative figures.

```console
naga run terminal_quay_to_yard
```

```mermaid
flowchart LR
    b0["vessel_calls_1 (SUBMODEL)"]
    b1["quay_crane_1 (SUBMODEL)"]
    b2["truck_gate_1 (SUBMODEL)"]
    b3["yard_block_1 (SUBMODEL)"]
    b4["yard_block_2 (SUBMODEL)"]
    b5["transport (SUBMODEL)"]
    b6["Quay (STATION)"]
    b7["Yard A in (STATION)"]
    b8["Yard B in (STATION)"]
    b9["Quay load (STATION)"]
    b10["to_a (TRANSPORT)"]
    b11["to_b (TRANSPORT)"]
    b12["split (DECIDE)"]
    b13["export (DECIDE)"]
    b14["by_type (DECIDE)"]
    b15["Yard out (DECIDE)"]
    b16["done (DISPOSE)"]
    b17["stacked (DISPOSE)"]
    b18["loaded (DISPOSE)"]
    b0 --> b14
    b14 --> b1
    b14 --> b13
    b13 --> b7
    b13 --> b8
    b1 --> b6
    b6 --> b12
    b12 --> b10
    b12 --> b11
    b10 --> b7
    b11 --> b8
    b7 --> b3
    b3 --> b15
    b8 --> b4
    b4 --> b15
    b15 --> b17
    b5 --> b16
    b15 --> b5
    b9 --> b1
    b1 --> b18
```

1 replication, seed 0:

| KPI | Mean | 95% half-width |
|---|---|---|
| `system/Total Entities Completed` | 9,030 |  |
| `system/Avg Throughput Time` | 544 |  |
| `system/Avg Queue Length` | 482 |  |
| `system/Avg Resource Usage %` | 35.2 |  |
| `user/truck_gate_1/truck turn time` | 130 |  |
| `system/Total Cost` | 152,000 |  |

## Hub day: turnaround workload (crews, ground equipment, on-time departures)

A synthetic hub day for a ground handler: about 114 flights in three banks on ten stands (eight contact for narrow-bodies, two remote for wide-bodies). Each turnaround draws on one ramp crew on three shifts and on diesel ground equipment, one fleet per type. The flights are read from data/airport_flight_schedule.csv at run time, so tomorrow's file replaces today's. In the results, read on_time_departure (share of flights off block by their scheduled time), the turnaround times by aircraft class, the hourly crew and equipment series, and the request wait of each equipment fleet. Time 0 is 04:00. Synthetic data; the task times are estimates.

```console
naga run turnaround_workload
```

1 replication, seed 0:

| KPI | Mean | 95% half-width |
|---|---|---|
| `system/Total Entities Completed` | 570 |  |
| `system/Avg Throughput Time` | 57.1 |  |
| `system/Avg Queue Length` | 7.71 |  |
| `system/Avg Resource Usage %` | 41.2 |  |
| `user/on_time_departure` | 0.868 |  |
| `user/turnaround_wide_min` | 86 |  |
| `user/turnaround_narrow_min` | 56.7 |  |
| `system/Total Cost` | 36,700 |  |

## Warehouse with forklifts (floor plan)

A small warehouse on a real-metre floor plan: pallets are unloaded at the dock, driven by forklift to one of two storage zones, driven again to picking, and leave on a take-away conveyor to shipping. Travel time is geometry -- distance along the aisle network divided by the forklift speed -- so moving the dock or adding a truck changes the KPIs the way hand reasoning says it should.

```console
naga run warehouse_forklifts --replications 3
```

```mermaid
flowchart LR
    b0["pallets_fast (CREATE)"]
    b1["pallets_bulk (CREATE)"]
    b2["to_first_stop (ROUTE)"]
    b3["Dock (STATION)"]
    b4["unload (PROCESS)"]
    b5["Storage A (STATION)"]
    b6["putaway_a (DELAY)"]
    b7["Storage B (STATION)"]
    b8["putaway_b (DELAY)"]
    b9["Picking (STATION)"]
    b10["pick_order (PROCESS)"]
    b11["forklift_move (TRANSPORT)"]
    b12["takeaway_belt (CONVEYOR)"]
    b13["Shipping (STATION)"]
    b14["load_truck (PROCESS)"]
    b15["shipped (DISPOSE)"]
    b0 --> b2
    b1 --> b2
    b2 --> b15
    b3 --> b4
    b4 --> b11
    b5 --> b6
    b6 --> b11
    b7 --> b8
    b8 --> b11
    b9 --> b10
    b10 --> b11
    b11 --> b12
    b12 --> b13
    b13 --> b14
    b14 --> b15
```

3 replications, seed 0:

| KPI | Mean | 95% half-width |
|---|---|---|
| `system/Total Entities Completed` | 306 | 19 |
| `system/Avg Throughput Time` | 23.8 | 1.9 |
| `system/Avg Queue Length` | 1.17 | 0.75 |
| `system/Avg Resource Usage %` | 63.4 | 4.1 |
| `system/Total Cost` | 3,700 | 73 |

## Order-driven warehouse (library assets)

An order-driven warehouse built from the Logistics library alone: inbound trucks, a receiving dock, forklifts putting pallets away into two rack zones that HOLD them as stock, customer orders drawing that stock with backorders when it is short, order picking, a take-away belt and an outbound dock that consolidates truck loads. Inbound and outbound are two entity streams that meet at each zone's level; each asset brought its own network node when it was placed, and the aisles joining them are the only geometry drawn by hand.

```console
naga run warehouse_library --replications 3
```

```mermaid
flowchart LR
    b0["trucks_fast (SUBMODEL)"]
    b1["trucks_bulk (SUBMODEL)"]
    b2["dock (SUBMODEL)"]
    b3["zone_a (SUBMODEL)"]
    b4["zone_b (SUBMODEL)"]
    b5["orders_fast (SUBMODEL)"]
    b6["orders_bulk (SUBMODEL)"]
    b7["pick_a (SUBMODEL)"]
    b8["pick_b (SUBMODEL)"]
    b9["belt (SUBMODEL)"]
    b10["shipping (SUBMODEL)"]
    b11["forklifts (SUBMODEL)"]
    b12["left_site (DISPOSE)"]
    b0 --> b2
    b1 --> b2
    b2 --> b11
    b3 --> b12
    b4 --> b12
    b11 --> b12
    b5 --> b7
    b6 --> b8
    b7 --> b9
    b8 --> b9
    b9 --> b10
    b10 --> b12
```

3 replications, seed 0:

| KPI | Mean | 95% half-width |
|---|---|---|
| `system/Total Entities Completed` | 435 | 35 |
| `system/Avg Throughput Time` | 44.7 | 25 |
| `system/Avg Queue Length` | 6.15 | 1.3 |
| `system/Avg Resource Usage %` | 46.4 | 2.2 |
| `user/pick_a/Log fill rate` | 0.98 | 0.045 |
| `user/pick_a/Log backorder time` | 0.117 | 0.36 |
| `user/pick_b/Log fill rate` | 0.8 | 0.86 |
| `level/zone_a/Log Zone stock/Average` | 12.5 | 11 |
| `level/zone_b/Log Zone stock/Average` | 29.6 | 54 |
| `system/Total Cost` | 1,070 | 13 |
