Aggregated Non-Cooperative Energy Community
This example is taken from the article Optimal sizing of energy communities with fair revenue sharing and exit clauses: Value, role and business model of aggregators and users by Davide Fioriti et al, url but for a subset of users
The energy community considered in this example consists of 3 users, where:
- all users can install PV system
- only the first user cannot install batteries, whereas the others can
- the third user can install also wind turbines
Import the needed packages
using EnergyCommunity, JuMP
using HiGHS, Plots
Create a base Energy Community example in the data folder; use the default configuration.
folder = joinpath(@__DIR__, "data")
create_example_data(folder, config_name="default")
Input file to load the structure of the energy community based on a yaml file.
input_file = joinpath(@__DIR__, "data/energy_community_model.yml");
Output path of the summary and of the plots
output_file_isolated = joinpath(@__DIR__, "./results/output_file_ANC.xlsx");
output_plot_isolated = joinpath(@__DIR__, "./results/Img/plot_user_{:s}_ANC.png");
define optimizer and options
optimizer = optimizer_with_attributes(HiGHS.Optimizer, "ipm_optimality_tolerance"=>1e-6)
MathOptInterface.OptimizerWithAttributes(HiGHS.Optimizer, Pair{MathOptInterface.AbstractOptimizerAttribute, Any}[MathOptInterface.RawOptimizerAttribute("ipm_optimality_tolerance") => 1.0e-6])
Define the Non Cooperative model
ANC_Model = ModelEC(input_file, EnergyCommunity.GroupANC(), optimizer)
An Energy Community Model
Energy Community problem for a Aggregating-Non-Cooperative Model
User set: ["user1", "user2", "user3"]
Build the mathematical model
build_model!(ANC_Model)
An Energy Community Model
Energy Community problem for a Aggregating-Non-Cooperative Model
User set: ["user1", "user2", "user3"]
Optimize the model
optimize!(ANC_Model)
An Energy Community Model
Energy Community problem for a Aggregating-Non-Cooperative Model
User set: ["user1", "user2", "user3"]
get objective value
objective_value(ANC_Model)
-1.2142113113248872e6
Create plots of the results
plot(ANC_Model, output_plot_isolated)
Print summaries of the results
print_summary(ANC_Model)
[ Info: List of users not specified: all users selected
WARNING: Optimizer of the EnergyCommunity model not specified
RESULTS - AGGREGATOR
NPV Agg [k€] : 8.53e+00
SWtot [k€] : -1.21e+03
SWus [k€] : -1.22e+03
ESha [MWh] : 6.98e-01
RESULTS - USER
USER : user1, user2, user3
PV : 5.00e+01, 2.55e+01, 4.40e+01
batt : 0.00e+00, 1.97e+00, 3.72e+00
conv : 0.00e+00, 1.97e+00, 3.72e+00
wind : 0.00e+00, 0.00e+00, 3.49e+01
NPV [k€] : -5.64e+02, -2.23e+02, -4.36e+02
CAPEX [k€] : 8.50e+01, 3.69e+01, 1.77e+02
OPEX [k€] : 1.50e+00, 7.78e-01, 2.39e+00
YBill [k€] : -3.16e+01, -1.22e+01, -1.72e+01
Cthermal [k€] : 0.00e+00, 0.00e+00, 0.00e+00
Energy flows
USER : user1, user2, user3
PtotPusP [MWh] : 1.09e+00, 1.38e+00, 2.26e+00
PtotPusN [MWh] : 2.12e+01, 8.27e+00, 9.79e+00
PconvP [MWh] : 0.00e+00, 1.18e-01, 2.81e-01
PconvN [MWh] : 0.00e+00, 1.28e-01, 3.05e-01
Pren [MWh] : 1.04e+01, 5.28e+00, 1.70e+01
Pgen [MWh] : 0.00e+00, 0.00e+00, 0.00e+00
Load [MWh] : 3.05e+01, 1.22e+01, 2.45e+01
Save summaries
save_summary(ANC_Model, output_file_isolated)
Plot the sankey plot of resources
plot_sankey(ANC_Model)
DataFrame of the business plan
business_plan(ANC_Model)
Row | Year | CUM_DCF | CAPEX | OEM | FUEL | EN_SELL | EN_CONS | PEAK | REP | REWARD | RV |
---|---|---|---|---|---|---|---|---|---|---|---|
Int64 | Float64 | Float64 | Float64 | Float64 | Float64 | Float64 | Float64 | Float64 | Float64 | Float64 | |
1 | 0 | -299297.0 | 299297.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
2 | 1 | -360288.0 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
3 | 2 | -4.19503e5 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
4 | 3 | -4.76992e5 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
5 | 4 | -5.32808e5 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
6 | 5 | -5.86998e5 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
7 | 6 | -6.39609e5 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
8 | 7 | -6.90688e5 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
9 | 8 | -7.40279e5 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
10 | 9 | -788426.0 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
11 | 10 | -8.36018e5 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 1138.92 | 573.389 | 0.0 |
12 | 11 | -8.81401e5 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
13 | 12 | -9.25462e5 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
14 | 13 | -968240.0 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
15 | 14 | -1.00977e6 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
16 | 15 | -1.05156e6 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 2277.85 | 573.389 | 0.0 |
17 | 16 | -1.0907e6 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
18 | 17 | -1.12871e6 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
19 | 18 | -1.16561e6 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
20 | 19 | -1.20144e6 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 0.0 |
21 | 20 | -1.21421e6 | 0.0 | 4673.14 | 0.0 | 610.965 | 56853.7 | 2478.27 | 0.0 | 573.389 | 39750.4 |
plot business plan
business_plan_plot(ANC_Model)
This page was generated using Literate.jl.