Utility Functions

GenX.by_rid_res — Method
by_rid_res(rid::Integer, sym::Symbol, rs::Vector{<:AbstractResource})

This function returns the value of the attribute `sym` for the resource given by the ID `rid`.
source
GenX.hoursafter — Method
hoursafter(p::Int, t::Int, a::Int)

Determines the time index a hours after index t in a landscape starting from t=1 which is separated into distinct periods of length p.

For example, if p = 10, 1 hour after t=9 is t=10, 1 hour after t=10 is t=1, 1 hour after t=11 is t=2

source
GenX.hoursafter — Method
hoursafter(p::Int, t::Int, b::UnitRange)

This is a generalization of hoursafter(... b::Int) to allow for example a=1:3 to fetch a Vector{Int} of the three hours after time index t.

source
GenX.hoursbefore — Method
hoursbefore(p::Int, t::Int, b::Int)

Determines the time index b hours before index t in a landscape starting from t=1 which is separated into distinct periods of length p.

For example, if p = 10, 1 hour before t=1 is t=10, 1 hour before t=10 is t=9 1 hour before t=11 is t=20

source
GenX.hoursbefore — Method
hoursbefore(p::Int, t::Int, b::UnitRange)

This is a generalization of hoursbefore(... b::Int) to allow for example b=1:3 to fetch a Vector{Int} of the three hours before time index t.

source
GenX.is_nonzero — Method
is_nonzero(df::DataFrame, col::Symbol)::BitVector

This function checks if a column in a dataframe is all zeros.

source
GenX.resolve_discount_rate_setting! — Function
resolve_discount_rate_setting!(model_settings::Dict, settings_path::String)

Accept the former name WACC for the general discount rate.

The setting was called WACC, which collided with the per-resource WACC column of Resource_multistage_data.csv: the first is the planner's time value of money, the second a technology's cost of capital. They were never the same quantity. The setting is now DiscountRate; WACC is still read so existing cases keep working, with a warning.

source
GenX.warn_if_not_converged — Function
warn_if_not_converged(settings_d::Dict, stats_d::Union{Dict, Nothing})

Warn when dual dynamic programming stopped before closing the optimality gap.

run_ddp returns the models it has when it hits its iteration limit, and the stage costs are then reported the same way as for a converged run. They describe the last forward pass rather than an optimal trajectory, so summing them across stages does not give the cost of an optimal plan.

source