Skip to content

Commit

Permalink
Add cumulative discounted cash flows to yearly finantial terms
Browse files Browse the repository at this point in the history
  • Loading branch information
davide-f committed Nov 13, 2023
1 parent 0ed794d commit eb0ebae
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ECModel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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, :])
Expand Down

0 comments on commit eb0ebae

Please sign in to comment.