SPSUnipi / EnergyCommunity.jl

Optimization of Energy Communities in Julia
GNU General Public License v3.0
6 stars 5 forks source link

Business plan plot #12

Closed TomFer97 closed 7 months ago

TomFer97 commented 12 months ago

I've renamed the back but it still shows sankey_branch should I do git fetch?

davide-f commented 12 months ago

Have you tested the execution of the function?

TomFer97 commented 9 months ago

Unfortunately the last commit allow me to obtain something like this. business_plan

davide-f commented 9 months ago

I see. May you please check and post the screen of the table calculated by business_plan?

TomFer97 commented 9 months ago

This is the dataframe. For sure OEM, EN_SELL, REWARD and RV must be 0 the first year. And REP 0 except the year of substitution. EN_CONS and PEAK is always 0 except for last year

21×9 DataFrame Row │ Year CAPEX OEM EN_SELL EN_CONS REP REWARD RV PEAK
│ Int64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 ───┼─────────────────────────────────────────────────────────────────────── 1 │ 0 3.96488e5 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 2 │ 1 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 3 │ 2 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 4 │ 3 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 5 │ 4 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 6 │ 5 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 7 │ 6 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 8 │ 7 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 9 │ 8 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 10 │ 9 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 11 │ 10 0.0 5568.01 2337.41 1686.68 -1.07268e5 1666.37 52369.5 0.0 12 │ 11 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 13 │ 12 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 14 │ 13 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 15 │ 14 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 16 │ 15 0.0 5568.01 2337.41 3373.36 -1.07268e5 1666.37 52369.5 0.0 17 │ 16 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 18 │ 17 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 19 │ 18 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 20 │ 19 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 0.0 21 │ 20 0.0 5568.01 2337.41 0.0 -1.07268e5 1666.37 52369.5 36447.2

TomFer97 commented 9 months ago

This is the ouptut as last modify. I think it doesn't take the negative values. I've modified ylim but I think it's the not right bar plot to show it. The other make errors using @df I don't know :( business_plan

davide-f commented 9 months ago

You may check out here: https://discourse.julialang.org/t/stacked-bar-chart-with-both-positive-and-negative-values/70852/3 I believe the plot function is not functioning as expected. As comments:

  1. the measurement units shall be revised, some
  2. May be good to focus and group the information to have less categories
  3. Please, drop the option ylims=(0, maximum([capex; oem; en_sell; en_cons; rep; reward; rv; peak])*1.2),: this removes the negative side of the bar, or instead of 0, you may specify "minimum". May not be needed though
TomFer97 commented 9 months ago

We stat getting some real results. However Reward comes negative. I think it's not properly calculated in the previous function. It should get the reward from the shared energy of the community. What do you think?

business_plan

Row │ Year CAPEX OEM EN_SELL EN_CONS PEAK REP REWARD RV
│ Int64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 ─────┼──────────────────────────────────────────────────────────────────────────────────── 1 │ 0 3.96488e5 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 2 │ 1 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 3 │ 2 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 4 │ 3 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 5 │ 4 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 6 │ 5 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 7 │ 6 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 8 │ 7 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 9 │ 8 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 10 │ 9 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 11 │ 10 0.0 5568.01 1666.37 52369.5 2337.41 1686.68 -1.07041e5 0.0 12 │ 11 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 13 │ 12 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 14 │ 13 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 15 │ 14 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 16 │ 15 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 17 │ 16 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 18 │ 17 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 19 │ 18 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 20 │ 19 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 0.0 21 │ 20 0.0 5568.01 1666.37 52369.5 2337.41 0.0 -1.07041e5 36447.2

TomFer97 commented 8 months ago

I forgot in which part of the code insert ECModel.results[:R_Reward_agg_tot] = 0 for non_cooperative in order to create a reward variable that is = 0 for non cooperative and >0 for cooperative and ANC. You showed it to me but I forgot and I didn't apply the changes

davide-f commented 8 months ago

I forgot in which part of the code insert ECModel.results[:R_Reward_agg_tot] = 0 for non_cooperative in order to create a reward variable that is = 0 for non cooperative and >0 for cooperative and ANC. You showed it to me but I forgot and I didn't apply the changes

Here :) https://github.com/SPSUnipi/EnergyCommunity.jl/blob/fc3420ff96ab6aecd4beb448af606395c96fc4c3/src/non_cooperative.jl#L692

You can get inspiration from here: https://github.com/SPSUnipi/EnergyCommunity.jl/blob/fc3420ff96ab6aecd4beb448af606395c96fc4c3/src/aggregated_non_cooperative.jl#L203-L265

Basically all expressions mentioned there should be available in the NC configuration as well, with appropriate values (including many 0s)

Apologies for the late reply, I didn't see the message at first

TomFer97 commented 8 months ago

plot_25 I Think that It's almost completed but I still get this problem with the label of the plot. Probably collect(keys(plot_struct)) is making some problems. I tought that with a list it would have been resolved

davide-f commented 8 months ago

Maybe its the key: "labelS". Test it locally

TomFer97 commented 8 months ago

The key labelS=bar_labels, kwargs...) cancel completely the following keys. Maybe it's because it's a vector and maybe should require a list but I've tried with [keys(plot_struct)] and It gives me a strange error. Maybe list(keys(plot_struct))?

davide-f commented 8 months ago

It may be the type of object that is a matrix instead.

[1 2 3] is a 2D matrix 1×3 [1, 2, 3] is a 1D vector

hcat(collect(keys(..))...) May work. Maybe the collect is not needed but I'm unsure

davide-f commented 7 months ago

@TomFer97 Merged :D