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)
Example block output

DataFrame of the business plan

business_plan(ANC_Model)
21×11 DataFrame
RowYearCUM_DCFCAPEXOEMFUELEN_SELLEN_CONSPEAKREPREWARDRV
Int64Float64Float64Float64Float64Float64Float64Float64Float64Float64Float64
10-299297.0299297.00.00.00.00.00.00.00.00.0
21-360288.00.04673.140.0610.96556853.72478.270.0573.3890.0
32-4.19503e50.04673.140.0610.96556853.72478.270.0573.3890.0
43-4.76992e50.04673.140.0610.96556853.72478.270.0573.3890.0
54-5.32808e50.04673.140.0610.96556853.72478.270.0573.3890.0
65-5.86998e50.04673.140.0610.96556853.72478.270.0573.3890.0
76-6.39609e50.04673.140.0610.96556853.72478.270.0573.3890.0
87-6.90688e50.04673.140.0610.96556853.72478.270.0573.3890.0
98-7.40279e50.04673.140.0610.96556853.72478.270.0573.3890.0
109-788426.00.04673.140.0610.96556853.72478.270.0573.3890.0
1110-8.36018e50.04673.140.0610.96556853.72478.271138.92573.3890.0
1211-8.81401e50.04673.140.0610.96556853.72478.270.0573.3890.0
1312-9.25462e50.04673.140.0610.96556853.72478.270.0573.3890.0
1413-968240.00.04673.140.0610.96556853.72478.270.0573.3890.0
1514-1.00977e60.04673.140.0610.96556853.72478.270.0573.3890.0
1615-1.05156e60.04673.140.0610.96556853.72478.272277.85573.3890.0
1716-1.0907e60.04673.140.0610.96556853.72478.270.0573.3890.0
1817-1.12871e60.04673.140.0610.96556853.72478.270.0573.3890.0
1918-1.16561e60.04673.140.0610.96556853.72478.270.0573.3890.0
2019-1.20144e60.04673.140.0610.96556853.72478.270.0573.3890.0
2120-1.21421e60.04673.140.0610.96556853.72478.270.0573.38939750.4

plot business plan

business_plan_plot(ANC_Model)
Example block output

This page was generated using Literate.jl.