Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional outputs for customers, utility, IPP, and DER aggregator #35

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Dualization = "191a621a-6537-11e9-281d-650236a99e60"
Expand Down
1 change: 1 addition & 0 deletions script/configs/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

data_selection:
# Specify the path to the inputs for the model. If using HolisticElectricityModelData.jl, it should point to the test case folder under runs/.
# If on Windows, enter paths like "C:\\projects\\HolisticElectricityModelData.jl\\runs\\..."
input_path: "../HolisticElectricityModelData.jl/runs/ba_6_base_2020_future_15_ipps_1/"

# ------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/HolisticElectricityModel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ using DataStructures
using Logging
using JuMP
using XLSX
using DelimitedFiles
using Lazy: @forward
import AxisKeys
import AxisKeys: KeyedArray
Expand Down
3 changes: 2 additions & 1 deletion src/agents/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ function solve_equilibrium_problem!(
window_length,
jump_model,
export_file_path,
true
true,
false,
)
end
@assert !isnothing(diff_one) "Nothing returned by solve_agent_problem!($(typeof(agent))): $(diff_one)"
Expand Down
204 changes: 172 additions & 32 deletions src/agents/customer_group.jl

Large diffs are not rendered by default.

38 changes: 27 additions & 11 deletions src/agents/der_aggregator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ function solve_agent_problem!(
window_length,
jump_model,
export_file_path,
update_results::Bool
update_results::Bool,
output_intermediate_results::Bool
)

ipp = get_agent(IPPGroup, agent_store)
Expand Down Expand Up @@ -125,7 +126,8 @@ function solve_agent_problem!(
window_length,
jump_model,
export_file_path,
update_results::Bool
update_results::Bool,
output_intermediate_results::Bool
)

utility = get_agent(Utility, agent_store)
Expand Down Expand Up @@ -166,7 +168,8 @@ function solve_agent_problem!(
window_length,
jump_model,
export_file_path,
update_results::Bool
update_results::Bool,
output_intermediate_results::Bool
)

reg_year, reg_year_index = get_reg_year(model_data)
Expand Down Expand Up @@ -419,7 +422,8 @@ function solve_agent_problem!(
window_length,
jump_model,
export_file_path,
update_results::Bool
update_results::Bool,
output_intermediate_results::Bool
)

reg_year, reg_year_index = get_reg_year(model_data)
Expand Down Expand Up @@ -471,6 +475,9 @@ function solve_agent_problem!(
der_aggregator.aggregation_level(reg_year_index_pre, z, :) .= 0.0
end

base_cem_dir = joinpath(export_file_path, "$(reg_year)_viu_dera_base")
mkdir(base_cem_dir)

diff_one_base = solve_agent_problem!(
utility,
utility_opts,
Expand All @@ -480,8 +487,9 @@ function solve_agent_problem!(
w_iter,
window_length,
jump_model,
export_file_path,
false
base_cem_dir,
false,
true
)
viu_obj_value_base = deepcopy(utility._obj_value)

Expand All @@ -497,7 +505,9 @@ function solve_agent_problem!(
total_der_stor_capacity(z, h) / customers.Opti_DG_E(z, h, :BTMStorage) * customers.Opti_DG_E(z, h, :BTMPV)
for h in model_data.index_h
)


incentive_function_cem_dir = joinpath(export_file_path, "$(reg_year)_viu_dera_$(z)_agg_level_$(i)")
mkdir(incentive_function_cem_dir)

diff_one = solve_agent_problem!(
utility,
Expand All @@ -508,8 +518,9 @@ function solve_agent_problem!(
w_iter,
window_length,
jump_model,
export_file_path,
false
incentive_function_cem_dir,
false,
true,
)
viu_obj_value = deepcopy(utility._obj_value)

Expand Down Expand Up @@ -734,8 +745,7 @@ function solve_agent_problem!(

# since we moved some BTM storage to transmission level, need to reduce the BTM net load accordingly (in bulk power system, regulator, customers (maybe?)).

return 0.0

return 0.0
end

function save_results(
Expand Down Expand Up @@ -769,4 +779,10 @@ function save_results(
:aggregation_pv_mw,
joinpath(export_file_path, "dera_aggregation_pv_mw.csv"),
)
save_param(
der_aggregator.revenue.values,
[:Year, :Zone],
:dollars_per_year,
joinpath(export_file_path, "dera_aggregation_revenue.csv"),
)
end
6 changes: 4 additions & 2 deletions src/agents/green_developer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ function solve_agent_problem!(
window_length,
jump_model,
export_file_path,
update_results::Bool
update_results::Bool,
output_intermediate_results::Bool
)

utility = get_agent(Utility, agent_store)
Expand Down Expand Up @@ -146,7 +147,8 @@ function solve_agent_problem!(
window_length,
jump_model,
export_file_path,
update_results::Bool
update_results::Bool,
output_intermediate_results::Bool
)

reg_year, reg_year_index = get_reg_year(model_data)
Expand Down
Loading