From eb0ebaec53da38f0a0efbffe2918e8935a2677ac Mon Sep 17 00:00:00 2001 From: Davide Fioriti Date: Mon, 13 Nov 2023 18:31:20 +0100 Subject: [PATCH] Add cumulative discounted cash flows to yearly finantial terms --- src/ECModel.jl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ECModel.jl b/src/ECModel.jl index c94000a..6a9b640 100644 --- a/src/ECModel.jl +++ b/src/ECModel.jl @@ -873,6 +873,7 @@ Returns ------- The output value is a NamedTuple with the following elements - NPV: the NPV of each user given the final profit_distribution adjustment by game theory techniques + - CUM_DCF: cumulative discounted cash flows - CAPEX: the annualized CAPEX - OPEX: the annualized operating costs (yearly maintenance and yearly peak and energy grid charges) - REP: the annualized replacement costs @@ -983,9 +984,15 @@ function split_yearly_financial_terms(ECModel::AbstractEC, profit_distribution=n ], year_set, user_set_financial ) + # Cumulative Discounted Cash Flows + CUM_DCF = JuMP.Containers.DenseAxisArray( + cumsum((Ann_reward .- CAPEX .- OPEX .- Ann_Replacement .+ Ann_Recovery).data .* ann_factor, dims=1), + year_set + ) return ( NPV=NPV, + CUM_DCF=CUM_DCF, CAPEX=CAPEX, OPEX=OPEX, OEM=Ann_Maintenance, @@ -1037,10 +1044,11 @@ function business_plan(ECModel::AbstractEC,profit_distribution=nothing, user_set year_set = business_plan.year_set # Create an empty DataFrame - df_business = DataFrame(Year = Int[], CAPEX = Float64[], OEM = Float64[], EN_SELL = Float64[], EN_CONS = EN_SELL = Float64[], PEAK = Float64[], REP = Float64[], + df_business = DataFrame(Year = Int[], CUM_DCF=Float[], CAPEX = Float64[], OEM = Float64[], EN_SELL = Float64[], EN_CONS = EN_SELL = Float64[], PEAK = Float64[], REP = Float64[], REWARD = Float64[], RV = Float64[]) for i in year_set Year = year_set[i+1] + CUM_DCF = CAPEX = sum(business_plan.CAPEX[i, :]) OEM = sum(business_plan.OEM[i, :]) EN_SELL = sum(business_plan.EN_SELL[i, :])