> ## Documentation Index
> Fetch the complete documentation index at: https://developers.kardinal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Heavy long distance

> Reserved warehouse slots, load-aware CO2 accounting, self-closing consolidation loops, and a real overnight rest on one long-haul lane.

A heavy long-distance operation runs multi-day corridors between distribution points, mixing scheduled warehouse pickups, loop tours that consolidate full loads without a fixed endpoint, and a real overnight rest built into the schedule rather than assumed. Fuel and CO2 costs scale with the actual load carried, not just the kilometres driven.

## What makes this vertical distinctive

* **Reserved warehouse slots** — an early pickup window at the warehouse is reserved for one specific vehicle, on top of the standard hours everyone else sees.
* **Load-aware CO2 accounting** — CO2 is calculated from the load actually carried per leg, not from distance alone.
* **Consolidation loops** — a truck with no fixed home base opens and closes its tour on whichever point it visits first, minimizing empty running.
* **A real overnight rest** — a two-day route plans an explicit rest period, not just a working window that happens to span two days.

## Combined example

```json theme={null}
{
  "resources": [
    {
      "id": "truck-1",
      "vehicleProfile": { "type": "truck", "grossWeight": 40000 },
      "workingTimeWindow": { "begin": "2026-08-03T06:00:00Z", "end": "2026-08-04T20:00:00Z" },
      "capacities": { "weight": 24000 },
      "breaks": [
        { "type": "workingDurationSlidingBreak", "minBreakDuration": "PT11H", "maxInterBreakDuration": "PT12H" }
      ],
      "CO2EmissionCalculation": {
        "km": { "costCoeff": 0.82 },
        "costPerCapacityPerTravelledKm": { "weight": { "costCoeff": 1.45e-05 } }
      }
    },
    {
      "id": "tractor-reserved-1",
      "vehicleProfile": { "type": "truck" },
      "tags": ["dock-slot:reserved-a"]
    },
    {
      "id": "truck-loops-1",
      "vehicleProfile": { "type": "truck" },
      "arrival": "atFirstPosition",
      "capacities": { "weight": 24000 }
    }
  ],
  "orders": [
    {
      "id": "order-warehouse-dock",
      "stops": [
        {
          "type": "single",
          "id": "stop-warehouse-dock",
          "position": { "lon": 2.55, "lat": 48.635 },
          "kind": "pickup",
          "operationDuration": "PT30M",
          "authorizedTimeWindows": [
            { "begin": "2026-08-03T06:00:00Z", "end": "2026-08-03T07:00:00Z", "resourceTags": ["dock-slot:reserved-a"] }
          ]
        }
      ]
    },
    {
      "id": "order-loop-0",
      "stops": [
        { "type": "single", "id": "stop-pickup-0", "position": { "lon": 2.595, "lat": 48.63 }, "kind": "pickup", "operationDuration": "PT30M", "capacities": { "weight": 8000 } },
        { "type": "single", "id": "stop-delivery-0", "position": { "lon": 2.568, "lat": 48.606 }, "kind": "delivery", "operationDuration": "PT30M", "capacities": { "weight": 8000 } }
      ],
      "successiveStops": true
    },
    {
      "id": "order-day2-delivery",
      "stops": [
        {
          "type": "single",
          "id": "stop-day2-delivery",
          "position": { "lon": 2.605, "lat": 48.615 },
          "kind": "delivery",
          "operationDuration": "PT25M",
          "authorizedTimeWindows": [{ "begin": "2026-08-04T08:00:00Z", "end": "2026-08-04T18:00:00Z" }]
        }
      ]
    }
  ]
}
```

### Reserved warehouse slots

`order-warehouse-dock`'s window carries `resourceTags: ["dock-slot:reserved-a"]` — only `tractor-reserved-1`, which holds that tag, can be assigned this early slot; every other resource is restricted to whatever untagged window exists elsewhere on the same stop. See [Restricting a window to specific resources](/guides/advanced-constraints#restricting-a-window-to-specific-resources) — the exact worked example this follows.

### Emissions scaled to load carried

`truck-1.CO2EmissionCalculation` mirrors the `Cost` object's shape: a flat `km` rate plus `costPerCapacityPerTravelledKm`, which multiplies the `weight` actually carried on each leg by the distance travelled. A fully loaded leg reports more CO2 than an empty return leg over the same kilometres, instead of both being priced identically by distance alone.

### Consolidation loops

`truck-loops-1` has no `departure` and sets `arrival: "atFirstPosition"` — its tour closes on whichever stop the engine assigns first, rather than a fixed depot. Paired with `order-loop-0`'s pickup-then-delivery stops (`successiveStops: true`, matching `weight` capacities), this lets the engine build a self-contained loop sized to whatever load it consolidates. See [Depot vs. position](/reference/data-model#depot-vs-position) for how `"atFirstPosition"` fits alongside a normal fixed `departure`/`arrival`.

### A real overnight rest

`truck-1.workingTimeWindow` spans two calendar days, but that alone wouldn't force any rest between them — the `workingDurationSlidingBreak` (an 11-hour minimum every 12 hours) is what actually reserves the overnight period, which is why `order-day2-delivery`'s window only opens the next day. See [Modeling multi-day sleepovers](/guides/advanced-constraints#modeling-multi-day-sleepovers) — the exact worked example this follows.

## See also

* [Modeling advanced constraints](/guides/advanced-constraints#modeling-multi-day-sleepovers) — multi-day `workingTimeWindow` and the sliding break that actually forces rest.
* [Modeling advanced constraints](/guides/advanced-constraints#restricting-a-window-to-specific-resources) — `resourceTags` on a time window.
* [Data model](/reference/data-model#depot-vs-position) — `departure`/`arrival`, including `"atFirstPosition"`.
