Capacity Output
Contents
Overview | Columns | Variable Types | Configuration | Assumptions | Examples | See Also
Overview
File: capacity.csv
capacity.csv records the capacity of every edge and storage component in the system after the optimization. For each component, five capacity variables are reported: total optimal capacity, new capacity added in this period, capacity retired, capacity retrofitted, and existing (pre-installed) capacity at the start of the period.
This is one of the most important output files. Capacity decisions are the primary investment variables in Macro — the flows and costs all depend on the capacity choices made here.
The file uses long format by default: every (component, variable) combination occupies one row. However, to facilitate easier analysis of capacity breakdowns, an optional wide format pivots the variable column into separate columns for each capacity type (total, new, retired, existing, retrofitted).
Columns
| Column | Type | Description |
|---|---|---|
commodity | String | Commodity type carried by the component (e.g., Electricity, Biomass_Wood, CO2) |
zone | String | Zone (location) where the component's parent asset is installed |
resource_id | String | Unique identifier of the parent asset (e.g., SE_battery) |
component_id | String | Unique identifier of the specific edge or storage component (e.g., SE_battery_discharge_edge) |
resource_type | String | Asset type of the parent asset (e.g., Battery, ThermalPower{NaturalGas}, VRE) |
component_type | String | Type of the component (e.g., UnidirectionalEdge{Electricity}, Storage{Electricity}) |
variable | String | Which capacity metric is reported (see Variable Types) |
value | Float64 | Capacity value in the system's power or energy units (default: MW or MWh) |
Variable Types
The variable column takes one of five values, all reported for each component in the same file:
variable | Description |
|---|---|
capacity | Total installed capacity after the optimization: existing + new − retired |
new_capacity | Capacity newly added during this planning period |
retired_capacity | Capacity retired (decommissioned) during this planning period |
existing_capacity | Capacity that was pre-installed at the start of this planning period (not a decision variable) |
retrofitted_capacity | Capacity converted to a different technology via retrofitting (only non-zero when Retrofitting = true) |
retrofitted_capacity rows only appear when Retrofitting = true in macro_settings.json. In all other runs the row is omitted.
Configuration
| Setting | File | Default | Effect |
|---|---|---|---|
OutputLayout (or OutputLayout.Capacity) | macro_settings.json | "long" | Set to "wide" to pivot the variable column into separate columns: capacity, new_capacity, retired_capacity, existing_capacity (and retrofitted_capacity if applicable). |
Retrofitting | macro_settings.json | false | When true, a retrofitted_capacity row is added for each component. |
Assumptions
- Units follow whatever unit system you define in your inputs. The default assumption in the Macro documentation is MW for power capacity and MWh for energy storage capacity. Capacity is reported per component (edge or storage), not per asset. A single asset may contain multiple components with separate capacity rows.
- Components without capacity — components with
has_capacity = falseare excluded from the output. Only components wherehas_capacity = trueappear incapacity.csv. All storage components are always included (all storages have capacity variables by definition). - Multi-period models — each period's
results_period_N/directory contains capacity values reflecting the capacity available during that planning period. Per the multi-period accounting assumptions, new capacity comes online at the beginning of a period.existing_capacityreflects the carry-over from the previous period, andnew_capacityreflects investments made during period N. - Single-period models —
existing_capacityis the user-specifiedexisting_capacityfrom the input data.capacity = existing_capacity + new_capacity - retired_capacity. - Capacity is reported per component, not per asset. An asset such as a
Batterywill produce rows for each of its edges (charge, discharge) and its storage component separately. Especially for symmetric battery systems, users interested in the total installed battery capacity should typically look at the storage component or the discharge edge.
Examples
Default Long Format
| commodity | zone | resource_id | component_id | resource_type | component_type | variable | value |
|---|---|---|---|---|---|---|---|
| Electricity | SE | battery_SE | battery_SE_storage | Battery | Storage{Electricity} | capacity | 200.0 |
| Electricity | SE | battery_SE | battery_SE_storage | Battery | Storage{Electricity} | new_capacity | 200.0 |
| Electricity | SE | battery_SE | battery_SE_storage | Battery | Storage{Electricity} | retired_capacity | 0.0 |
| Electricity | SE | battery_SE | battery_SE_storage | Battery | Storage{Electricity} | existing_capacity | 0.0 |
Wide Format (OutputLayout.Capacity = "wide")
| commodity | zone | resource_id | component_id | resource_type | component_type | capacity | new_capacity | retired_capacity | existing_capacity |
|---|---|---|---|---|---|---|---|---|---|
| Electricity | SE | battery_SE | battery_SE_storage | Battery | Storage{Electricity} | 200.0 | 200.0 | 0.0 | 0.0 |
Writing Capacity Programmatically
write_capacityallows you to write capacity data to a custom file path, with optional filters for commodity, asset type, or component type. This is useful for exporting subsets of the capacity data or for writing to a different location.get_optimal_capacityreturns the capacity data as a DataFrame without writing a file. This is useful for programmatic access to capacity values within Julia.
# After solving:
(case, model) = solve_case(case_path, optimizer)
# Export capacity for a specific period/system
system = case.systems[1];
write_capacity("my_capacity.csv", system)
# Export only electricity capacity
write_capacity("elec_capacity.csv", system, commodity="Electricity")
# Export only Battery and VRE assets
write_capacity("storage_vre.csv", system, asset_type=["Battery", "VRE"])
# Get capacity as a DataFrame (no file written)
df = get_optimal_capacity(system)See Also
- Outputs Overview — overview of all output files and settings
- Costs Output — investment and O&M costs associated with capacity decisions
- Financial Assumptions — how investment costs are annualized from CAPEX
- Multi-Period Accounting — how capacity evolves across planning periods
- Edges — edge investment parameters (
can_expand,existing_capacity, etc.) - Storage — storage investment parameters