Losses Output

Contents

Overview | Columns | Calculation | Configuration | Assumptions | Examples | See Also

Overview

File: edge_losses.csv

edge_losses.csv records the commodity lost on every edge with a nonzero loss_fraction (e.g. a lossy transmission line) at every representative time step.

Losses are a derived quantity

Losses are not an optimization variable. They are computed after the solve from the optimal values of the edge's flow variables.

Columns

ColumnTypeDescription
commodityStringCommodity carried by the edge
node_inStringStart vertex of the edge
node_outStringEnd vertex of the edge
resource_idStringUnique identifier of the parent asset
component_idStringUnique identifier of the edge
resource_typeStringAsset type (e.g., TransmissionLink{Electricity})
component_typeStringType of the edge (e.g., BidirectionalEdge{Electricity})
variableStringAlways "loss"
timeIntRepresentative time step index (1-based integer, matches time in other output files)
valueFloat64Commodity lost at this time step, in the same units as flows.csv (default: MW for electricity)

Calculation

For a unidirectional edge, the loss at time step $t$ is taken from the flow arriving at the end vertex:

\[\text{loss}(t) = \text{loss\_fraction}(t) \times \text{flow}(t)\]

A lossy bidirectional edge splits its flow into two nonnegative parts, $\text{flow}(t) = \text{flow\_pos}(t) - \text{flow\_neg}(t)$. The end vertex receives $(1 - \text{loss\_fraction}(t))\,\text{flow\_pos}(t)$ and the start vertex receives $(1 - \text{loss\_fraction}(t))\,\text{flow\_neg}(t)$, so:

\[\text{loss}(t) = \text{loss\_fraction}(t) \times \big(\text{flow\_pos}(t) + \text{flow\_neg}(t)\big)\]

The model does not force one of flow_pos and flow_neg to be zero. When both are positive in the same time step, the edge dissipates commodity at both vertices, and the loss is larger than $\text{loss\_fraction}(t) \times |\text{flow}(t)|$. For this reason the loss cannot be recovered from flows.csv alone.

Annual losses

To compute total annual losses for an edge, multiply value(t) × weight(t) and sum over all time steps, where weight(t) comes from time_weights.csv:

Annual losses (MWh) = Σ_t  loss(t) × weight(t) × hours_per_timestep

Configuration

SettingFileDefaultEffect
OutputLayout (or OutputLayout.Losses)macro_settings.json"long"Set to "wide" to pivot time steps into rows and edges (component_id) into columns.
OutputFormat (or OutputFormat.Losses)macro_settings.json"csv"Set to "csv.gz" or "parquet" to write a compressed file (.csv.gz or .parquet). See Output Format and Size.
WriteOutputs.Lossesmacro_settings.jsontrueSet to false to skip this output. See Selecting Outputs.
OutputSignificantDigitsmacro_settings.jsonnullSet to an integer to round values to that many significant digits before writing.
WriteFullTimeseriescase_settings.jsonfalseWhen true and TDR is active, also write full-year losses to full_time_series/edge_losses.csv.

Assumptions

  • Every lossy edge. All edges with loss_fraction > 0 in at least one time step are included, whatever asset they belong to. Edges without losses do not produce rows.
  • File not written if empty. If no edge in the system has a nonzero loss_fraction, edge_losses.csv is not written.

Examples

Default Long Format (example rows)

commoditynode_innode_outresource_idcomponent_idresource_typecomponent_typevariabletimevalue
Electricityelec_MAelec_CTMA_to_CTMA_to_CT_transmission_edgeTransmissionLink{Electricity}BidirectionalEdge{Electricity}loss120.0
Electricityelec_MAelec_CTMA_to_CTMA_to_CT_transmission_edgeTransmissionLink{Electricity}BidirectionalEdge{Electricity}loss20.0

Computing Annual Losses

using CSV, DataFrames

losses = CSV.read("results/edge_losses.csv", DataFrame)
weights = CSV.read("results/time_weights.csv", DataFrame)

df = leftjoin(losses, weights, on=:time)
df.annual_MWh = df.value .* df.weight

annual_by_edge = combine(groupby(df, :component_id), :annual_MWh => sum => :annual_losses_MWh)

See Also