# network

Optional path network: nodes at layout coordinates and the segments joining them.

In the model file this key holds `null`, or an object.

## Typical uses

These sections describe things that move and the floor they move on. `network` is a path network of nodes and segments. `fleets` are pools of vehicles or workers that carry entities on it. `chargers` recharge batteries. `motion_profiles` and `zones` describe robots and their safety areas. Use them when distances and travel times matter.

## Behaviour and rules

Travel time is exact geometry: the shortest path on the network divided by the speed. A segment can limit the speed. The `length_factor` scales straight-line distances for a segment with no length of its own. A node is named by a STATION through its `node`.

A fleet is a resource under its own name. A TRANSPORT block requests one of its vehicles, which drives empty to the entity, loads, drives loaded to the destination and unloads. `dispatch` decides whose request is served when a vehicle frees, and `select` decides which idle vehicle serves it. With `park` set to `home`, an idle vehicle drives back to its `home` node.

A fleet with `kind` set to `worker` supplies people to PROCESS and SEIZE blocks through `worker_fleet`. A fleet with a `battery` drains it at its power draw and recharges at a charger when its job is done. A fleet with `motion` set to `gantry` ignores the network. A motion profile gives a robot its speed, acceleration, payload derating and a collaborative speed. A zone slows a robot to that speed when a worker is inside.

## Fields

| Field | Type | Required | Default | Unit | Description |
|---|---|---|---|---|---|
| `length_factor` | number |  | `1.0` | ratio | Multiplies the straight-line distance when a segment declares no explicit length. 1.0 is straight aisles. |
| `nodes` | list of object |  |  |  | -- |
| `segments` | list of object |  |  |  | -- |

A field of a nested object is described in the JSON Schema (`naga schema`).

## Example

```json
{"network": {"nodes": [{"name": "A", "x": 0, "y": 0}, {"name": "B", "x": 20, "y": 0}], "segments": [{"from": "A", "to": "B"}]}}
```

In the Python builder the section is a keyword of `Model`:

```python
from nagasim import build as nb
m = nb.Model(network={'nodes': [{'name': 'A', 'x': 0, 'y': 0}, {'name': 'B', 'x': 20, 'y': 0}], 'segments': [{'from': 'A', 'to': 'B'}]})
```

## Used in

Bundled models: [Courier on a path network](../../gallery/agent-based.md), [Hub day: electrifying the ground support equipment](../../gallery/logistics.md), [Container terminal: electrification](../../gallery/logistics.md), [Container terminal: quay to yard](../../gallery/logistics.md), [Hub day: turnaround workload (crews, ground equipment, on-time departures)](../../gallery/logistics.md), [Warehouse with forklifts (floor plan)](../../gallery/logistics.md) and 3 more.

Guides: [Layout, paths and vehicles](../../modelling-guide/layout-paths-vehicles.md), [Agent-based modelling](../../agent-based-modelling.md), [Coming from AnyLogic](../../coming-from/anylogic.md), [Coming from Arena](../../coming-from/arena.md), [Coming from Mesa](../../coming-from/mesa.md), [Coming from NetLogo](../../coming-from/netlogo.md) and 1 more.

## See also

- [All sections](index.md), [Model file keys](../schema.md), [Model file format](../../model-file-format.md)
