# chargers

Chargers and battery-swap stations at network nodes, used by fleets that declare a `battery`.

In the model file this key holds a list of `charger` entries, each named by its `name`.

A scenario, an experiment or an optimizer can set a field by the path `chargers.<name>.<field>`.

## 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 |
|---|---|---|---|---|---|
| `name` | string | yes |  |  | The charger's name. |
| `description` | string |  |  |  | What the charger stands for; the run does not read it. |
| `node` | string | yes |  |  | The network node it stands at. |
| `kind` | choice |  | `"charge"` |  | "charge" refills the battery in place, "swap" exchanges it for a full one. One of `charge`, `swap`. |
| `points` | integer |  | `1` | count | Vehicles served at once. |
| `power_kw` | number | yes |  | power | kW per point; for "swap", the rate a removed pack recharges at. |
| `knee` | number |  | `0.8` | ratio | Above this SoC the power falls linearly. |
| `taper_floor` | number |  | `0.1` | ratio | Share of `power_kw` left at 100 %. |
| `efficiency` | number |  | `1.0` | ratio | Grid kWh = battery kWh / efficiency. |
| `swap_time` | string or number |  |  | time (`swap_time_unit`) | Swap only: expression, in `swap_time_unit`. |
| `swap_time_unit` | choice |  | `"base"` |  | Unit `swap_time` is in. One of `base`, `milliseconds`, `seconds`, `minutes`, `hours`, `days`, `weeks`, `months`, `years`. |
| `spare_packs` | integer or null |  |  | count | Swap only: charged packs in stock at the start; a swap waits for one. Absent = unlimited. |

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

## Example

The fragment refers to entries that are defined elsewhere in the same file:

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

The fragment:

```json
{"chargers": [{"name": "Dock", "node": "A", "power_kw": 10}]}
```

In the Python builder:

```python
from nagasim import build as nb
m = nb.Model()
m.add_charger(name='Dock', node='A', power_kw=10)
```

## Used in

Bundled models: [Hub day: electrifying the ground support equipment](../../gallery/logistics.md), [Container terminal: electrification](../../gallery/logistics.md), [Automation floor (robot cells, AMR, palletiser)](../../gallery/manufacturing.md).

Guides: [Batteries and charging](../../modelling-guide/batteries.md).

## See also

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