4.6. discounting module¶
- discounting.annualize_calendar_year_values(settings, dict_of_values, *non_emission_cost_args)[source]¶
- Note:
This function makes use of a cumulative sum of annual discounted values. As such, the cumulative sums represent a present value through the given calendar year. The Offset is included to reflect costs beginning at the start of the year (Offset=1) or the end of the year (Offset=0).
The equation used here is shown below.
AC = PV * DR * (1+DR)^(period) / [(1+DR)^(period+Offset) - 1]
where,
AC = Annualized Cost
PV = Present Value (here, the cumulative summary of discounted annual values)
DR = Discount Rate
CY = Calendar Year (yearID)
period = the current CY minus the year to which to discount values + a discount_offset value where discount_offset equals the costs_start input value
Offset = 1 for costs at the start of the year, 0 for cost at the end of the year
- Parameters:
settings: The SetInputs class.
dict_of_values: A dictionary of present values containing optionID, yearID, DiscountRate and Cost arguments.
non_emission_cost_args: Args to be annualized at both social discount rates.
- Return:
A Dictionary of annualized values through the given calendar year and by key for any monetized arg in the passed dictionary.
- discounting.annualize_model_year_values(settings, dict_of_values, max_age, *non_emission_cost_args)[source]¶
- Note:
This function makes use of a cumulative sum of annual discounted values. As such, the cumulative sums represent a present value through the given calendar year. The Offset is included to reflect costs beginning at the start of the year (Offset=1) or the end of the year (Offset=0).
The equation used here is shown below.
AC = PV * DR * (1+DR)^(period) / [(1+DR)^(period+Offset) - 1]
where,
AC = Annualized Cost
PV = Present Value (here, the cumulative summary of discounted annual values)
DR = Discount Rate
CY = Calendar Year (yearID)
period = the current CY minus the year to which to discount values + a discount_offset value where discount_offset equals the costs_start input value
Offset = 1 for costs at the start of the year, 0 for cost at the end of the year
- Parameters:
settings: The SetInputs class.
dict_of_values: A dictionary of present values.
non_emission_cost_args: Args to be annualized at both social discount rates.
- Return:
A Dictionary of annualized values for the given model year lifetime for any monetized arg in the passed dictionary.
- discounting.calc_present_values(settings, dict_of_values, *non_emission_cost_args)[source]¶
- Note:
This function calculates present values based on the discounted values in the passed dictionary.
- Parameters:
settings: The SetInputs class.
dict_of_values: A Dictionary of values with keys of:
(scenario_name, year, reg_class, discount_rate) or (scenario_name, model_year, age, calendar_year, reg_class, discount_rate)
non_emission_cost_args: Attributes for which present values are needed at both social discount rates.
- Return:
A Dictionary of present values (for annual values: cumulative summations through the given calendar year; for model year lifetime values: present values of monetized values through the full lifetime) by key for any monetized arg in the passed dictionary.
- discounting.discount_values(settings, df, id_cols, discount_rates, *non_emission_cost_args)[source]¶
- Note:
The discount function discounts non-emission args at the social discount rates entered in the SetInputs class and discounts emission args at their internally consistent discount rate ONLY. Results are reported according ot the social discount rates, but emission args are always discounted at their internally consistent discount rate. Values are discounted to a given year and assume costs start at the beginning or end of that year.
The passed dictionary keys should consist of:
(scenario_name, year, reg_class, discount_rate) or (scenario_name, model_year, age, calendar_year, reg_class, discount_rate)
The costs_start entry of the SetInputs class should be set to ‘start-year’ or ‘end-year’, where start-year represents costs starting at time t=0 (i.e., first year costs are undiscounted), and end-year represents costs starting at time t=1 (i.e., first year costs are discounted).
- Parameters:
settings: The SetInputs class.
df: A DataFrame of values to be discounted.
id_cols: The identifying columns to use as keys for the dictionary that is created in function.
discount_rates: The social discount rates to use.
non_emission_cost_args: Args to be discounted at both social discount rates.
- Return:
The passed DataFrame with discounted values added; a DataFrame of present values (through the given calendar year); a DataFrame of annualized values (through the given calendar year).