Closed TomFer97 closed 7 months ago
Have you tested the execution of the function?
Unfortunately the last commit allow me to obtain something like this.
I see. May you please check and post the screen of the table calculated by business_plan?
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
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 :(
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:
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 thoughWe 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?
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
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
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
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
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
Maybe its the key: "labelS". Test it locally
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))?
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
@TomFer97 Merged :D
I've renamed the back but it still shows sankey_branch should I do git fetch?