losses_to_balancing.Rd
This function relocates losses to the balancing matrix B. The Balancing matrix is akin to an additional final demand matrix.
losses_to_balancing(
.tidy_iea_df,
flow = IEATools::iea_cols$flow,
matnames = IEATools::mat_meta_cols$matnames,
e_dot = IEATools::iea_cols$e_dot,
ledger_side = IEATools::iea_cols$ledger_side,
losses = IEATools::tfc_compare_flows$losses,
balancing_matrix = "B"
)
The .tidy_iea_df
for which losses need to be relocated in the Balancing matrix.
See IEATools::iea_cols
.
The column name of the column containing matrices names.
Default is IEATools::mat_meta_cols$matnames
.
The name of losses flows.
Default is IEATools::tfc_compare_flows$losses
.
The name of the Balancing matrix. Default is "B".
A .tidy_iea_df
with losses relocated in the Balancing matrix.
See the Balancing matrix vignette for more information.
Note: one needs to add the column containing matrices names first,
most likely using the IEATools::add_psut_matnames()
function.
Importantly, we change the sign of losses flows when moving them to the balancing matrix, so that they stay akin to final demand flows. And we change their ledger side to "Consumption" so that the energy balance is respected.
tidy_AB_data %>%
tibble::add_row(
Country = "A",
Method = "PCM",
Energy.type = "E",
Last.stage = "Final",
Year = 2018,
Ledger.side = "Supply",
Flow.aggregation.point = "TFC compare",
Flow = "Losses",
Product = "Electricity",
Unit = "ktoe",
E.dot = -100,
) %>%
IEATools::add_psut_matnames() %>%
dplyr::filter(matnames == "B")
#> # A tibble: 0 × 12
#> # ℹ 12 variables: Country <chr>, Method <chr>, Energy.type <chr>,
#> # Last.stage <chr>, Year <dbl>, Ledger.side <chr>,
#> # Flow.aggregation.point <chr>, Flow <chr>, Product <chr>, Unit <chr>,
#> # E.dot <dbl>, matnames <chr>