Thin benchmarking helper that takes the optimization context opt_data
(the same tibble passed to optimize_demand()) and an optimized
flexible-demand vector O, and returns the total grid energy cost.
Makes cost benchmarking a single call:
Arguments
- opt_data
tibble, same shape expected by
optimize_demand(). Must containdatetime. Optional columnsstatic,production,price_importedandprice_exporteddefault to0,0,1and0respectively when missing – matching the defaults used byoptimize_demand().- O
numeric vector of flexible demand (kW), same length as
opt_data$datetime. Passopt_data$flexiblefor the baseline cost, or the return value ofoptimize_demand()for the optimized cost.
Details
# Baseline cost (no flexibility)
evaluate_cost(opt_data, opt_data$flexible)
# Cost after optimization
O <- optimize_demand(opt_data, opt_objective = "cost")
evaluate_cost(opt_data, O)Internally this builds the equivalent consumption = O + static column
and delegates to get_energy_total_cost(), so the pricing convention
matches the rest of the package.
