# fixed_costs

Costs of the scenario rather than of the run: capex (flagged `capex: true` for the investment case), or an annuity over a sized parameter.

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

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

## Typical uses

These sections turn a model into a business case. `fixed_costs` are costs of the scenario rather than of the run, such as equipment capex. `investment` defines the case that `naga invest` reports: payback, NPV and return on investment against a baseline scenario. `dispatch` plans storage over a rolling horizon at the lowest grid cost.

## Behaviour and rules

Running costs are not set here. They come from the cost fields of resources, fleets, entity types, flows and RECORD blocks. A fixed cost flagged `capex` is the investment that the saving has to repay. The `investment` section needs a scenario to compare with, and a check warns when only one scenario exists.

The case scales the observed window to `operating_hours_per_year`. The saving over the baseline is counted for `horizon_years` and discounted at `discount_rate`. A `margin_per_part` adds the value of extra good parts to the saving. A value of 0 makes it a pure cost case.

The `dispatch` plan drives only the levels marked as storage. It prices grid flows with their own `price`. Without a `dispatch` section, those storage and grid settings do nothing. Both sections are absent by default.

## Fields

| Field | Type | Required | Default | Unit | Description |
|---|---|---|---|---|---|
| `name` | string | yes |  |  | The cost's name, as the cost summary lists it. |
| `description` | string |  |  |  | What the cost pays for; the run does not read it. |
| `amount` | string or number | yes | `"0"` | money | A number, or an expression over the model's variables and data evaluated once at run start. |
| `category` | string |  |  |  | Grouping shown in the cost_summary frame. |
| `capex` | boolean |  | `false` |  | An upfront investment: the investment case keeps it out of operating cost. Read by `nagasim.investment` only; Total Cost and every frame of a run are unchanged. |
| `locals` | object |  |  |  | Submodel parameter bindings, written by flattening; not authored by hand. |

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

## Example

```json
{"fixed_costs": [{"name": "Machine", "amount": 50000, "capex": true}]}
```

In the Python builder:

```python
from nagasim import build as nb
m = nb.Model()
m.add_fixed_cost(name='Machine', amount=50000, capex=True)
```

## Used in

Bundled models: [Berth: shore power](../../gallery/energy.md), [Biogas plant (library assets)](../../gallery/energy.md), [Depot: PV, EV charging and heat pump](../../gallery/energy.md), [PV + battery sizing and dispatch](../../gallery/energy.md), [PV + battery site (library assets)](../../gallery/energy.md), [Hub day: electrifying the ground support equipment](../../gallery/logistics.md) and 3 more.

Guides: [Costing](../../modelling-guide/costing.md), [Investment case](../../modelling-guide/investment.md), [Model file format](../../model-file-format.md), [Semantic diff](../../semantic-diff.md).

## See also

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