Discounted_Cash_Flow#
Classes:
|
Class to perform discounted cash flow analysis. |
Functions:
|
Calculation of MACRS depreciations. |
|
Wrapper function for |
|
Calculation of index for MACRS calculation. |
|
Calculation of net present value. |
- class pyH2A.Discounted_Cash_Flow.Discounted_Cash_Flow(input_file, print_info=True, check_processing=True)[source]#
Class to perform discounted cash flow analysis.
- Parameters
- input_filestr or dict
Path to input file or dictionary containing input file data.
- print_infobool
Boolean flag to control if detailed info on action of plugins is printed.
- check_processingbool
Boolean flag to control if check_processing is run at the end of discounted cash flow analysis, which checks if all tables in input file have been processed during run.
- Returns
- Discounted_Cash_Flowobject
Discounted cash flow analysis object.
Notes
Numerical inputs
Numbers use decimal points. Commas can be used as thousands seperator, they are removed from numbers during processing. the “%” can be used after a number, indicating that it will be divided by 100 before being used.
Special symbols
Tables in the input file are formatted using GitHub flavoured Markdown. This means that “#” at the beginning of a line indicates a header. “|” is used to seperate columns. “—” is used on its own line to seperate table headers from table entries.
Paths to locations in the input file/in self.inp are specified using “>”. Paths are always composed of three levels: top key > middle key > bottom key.
File name paths are specified using “/”.
In cases where multiple numbers are used in one field (e.g. during sensitivity analysis), these numbers are seperated using “;”.
Order in the input file
Order matters in the following cases:
1. For a group of
sum_all_tables()
processed tables (sharing the specified part of their key, e.g. “Direct Capital Cost”), they are processed in their provided order.2. Within a table, the first column will be used to generate the “middle key” of self.inp. The order of the other columns is not important.
Input
Processed input cells can contain either a number or path(s) (if multiple paths are used, they have to be seperated by “;”) to other cells. The use of process_input() (and hence, process_table(), sum_table() and sum_all_tables()) also allows for the value of an input cell to be multiplied by another cell by including path(s) in an additiona column (column name typically “Path”).
Workflow
Workflow specifies which functions and plugins are used and in which order they are executed. The listed five functions have to be executed in the specified order for pyH2A to work. Plugins can be inserted at appropiate positions (Type: “plugin”). Plugins have to be located in the ./Plugins/ directory. Execcution order is determined by the “Position” input. If the specified position is equal to an already exisiting one, the function/plugin will be executed after the already specified one. If multiple plugins/function are specified with the same position, they will be executed in the order in which they are listed in the input file.
Plugins
Plugins needs to be composed of a class with the same name as the plugin file name. This class uses two inputs, a discounted cash flow object (usually indicated by “self”) and “print_info”, which controls the printing of run time statements. Within the __init__ function of the class the actions of the plugins are specified, typically call(s) of the “insert()” function to modify the discounted cash flow object’s “inp” dictionary (self.inp).
- Attributes
h2_cost
floatCalculate levelized H2 cost.
- contributionsdict
Cost contributions to H2 price.
- plugsdict
Dictionary containing plugin class objects used during analysis.
Methods:
Calculate cash flow.
Check whether all tables in input file were used.
Compile contributions to H2 cost.
Calculate constant debt financing.
Calculate depreciation charge.
execute_function
(function_name, npv_dict)Execute class function named function_name and store output in npv_dict
expenses_per_kg_H2
(value)Calculate expenses per kg H2.
Calculate fixed operating costs.
h2_cost
()Calculate levelized H2 cost.
Calculate H2 sales revenue.
h2_sales
()Calculate H2 sales.
income
()Calculate total income.
Calculate inflation correction and inflators for specific commodities.
Calculate initial equity depreciable capital.
Calculate non-depreciable capital costs.
Functions executed after workflow.
Functions executed before workflow.
Get plant outpuer per year at gate.
Calculate replacement costs.
Calculate salvage and decomissioning costs.
time
()Creating time scale information for discounted cash flow analysis.
Calculate variable operating costs.
workflow
(inp, npv_dict, plugs_dict)Executing plugins and functions for discounted cash flow.
Calculate working capital reserve.
- check_processing()[source]#
Check whether all tables in input file were used.
Notes
‘Workflow’ and ‘Display Parameters’ tables are exempted. Furthermore, all tables that have the term ‘Analysis’ in their name are also exempted.
- execute_function(function_name, npv_dict)[source]#
Execute class function named function_name and store output in npv_dict
- fixed_operating_costs()[source]#
Calculate fixed operating costs.
- Parameters
- Financial Input Values > startup time > Valueint
Startup time in years.
- Financial Input Values > startup cost fixed > Valuefloat
Percentage of fixed operating costs during start-up.
- Fixed Operating Costs > Total > Valuefloat
Total fixed operating costs.
- initial_equity_depreciable_capital()[source]#
Calculate initial equity depreciable capital.
- Parameters
- Financial Input Values > equity > Valuefloat
Percentage of equity financing.
- Financial Input Values > irr > Valuefloat
After tax real internal rate of return.
- Depreciable Capital Costs > Inflated > Valuefloat
Inflated depreciable capital costs.
- non_depreciable_capital_costs()[source]#
Calculate non-depreciable capital costs.
- Parameters
- Non-Depreciable Capital Costs > Inflated > Valuefloat
Inflated non-depreciable capital costs.
- post_workflow()[source]#
Functions executed after workflow.
- Parameters
- Financial Input Values > depreciation length > Valueint
Depreciation length in years.
- Financial Input Values > depreciation type > Valuestr
Type of depreciation, currently only MACRS is implemented.
- Financial Input Values > interest > Valuefloat
Interest rate on debt.
- Financial Input Values > debt > Valuestr
Debt period, currently only constant debt is implemented.
- Financial Input Values > startup revenues > Valuefloat
Percentage of revenues during start-up.
- Financial Input Values > decommissioning > Valuefloat
Decomissioning cost in percentage of depreciable capital investment.
- Financial Input Values > salvage > Valuefloat
Salvage value in percentage of total capital investment.
- Financial Input Values > state tax > Valuefloat
State tax.
- Financial Input Values > federal tax > Valuefloat
Federal tax.
- Financial Input Values > working capital > Valuefloat
Working capital as percentage of yearly change in operating costs.
- pre_workflow()[source]#
Functions executed before workflow.
- Parameters
- Workflow > initial_equity_depreciable_capital > Typefunction
Initial equity depreciable capital function.
- Workflow > initial_equity_depreciable_capital > Positionint
Position of initial equity depreciable capital function.
- Workflow > non_depreciable_capital_costs > Typefunction
Non-depreciable capital costs function.
- Workflow > non_depreciable_capital_costs > Positionint
Position of non-depreciable capital costs function.
- Workflow > replacement_costs > Typefunction
Replacement costs function.
- Workflow > replacement_costs > Positionint
Position of replacement costs function.
- Workflow > fixed_operating_costs > Typefunction
Fixed operating costs function.
- Workflow > fixed_operating_costs > Positionint
Position of fixed operating costs function.
- Workflow > variable_operating_costs > Typefunction
Variable operating costs function.
- Workflow > variable_operating_costs > Positionint
Position of variable operating costs function.
- Workflow > […] > Typeplugin, optional
Plugin to be executed.
- Workflow > […] > Positionint, optional
Position of plugin to be executed.
- Financial Input Values > ref year > Valueint
Financial reference year.
- Financial Input Values > startup year > Valueint
Startup year for plant.
- Financial Input Values > basis year > Valueint
Financial basis year.
- Financial Input Values > current year capital costs > Valueint
Current year for capital costs.
- Financial Input Values > plant life > Valueint
Plant life in years.
- Financial Input Values > inflation > Valuefloat
Inflation rate.
- Construction > […] > Valuefloat
Percentage of capital spent in given year of construction. Number of entries determines construction period in year (each entry corresponds to one year). Have to be in order (first entry corresponds to first construction year etc.). Values of all entries have to sum to 100%.
- Returns
- Financial Input Values > construction time > Valueint
Construction time in years.
- production_scaling()[source]#
Get plant outpuer per year at gate.
- Parameters
- Technical Operating Parameters and Specifications > Output per Year at Gate > Valuefloat
Output per year at gate in kg.
- replacement_costs()[source]#
Calculate replacement costs.
- Parameters
- Replacement > Total > Valuendarray
Total replacement costs.
- variable_operating_costs()[source]#
Calculate variable operating costs.
- Parameters
- Financial Input Values > startup cost variable > Valuefloat
Percentage of variable operating costs during start-up.
- Variable Operating Costs > Total > Valuendarray
Total variable operating costs.
- pyH2A.Discounted_Cash_Flow.MACRS_depreciation(plant_years, depreciation_length, annual_depreciable_capital)[source]#
Calculation of MACRS depreciations.
- Parameters
- plant_yearsndarray
Array of plant years.
- depreciation_lengthint
Depreciation length.
- annual_depreicable_capitalndarray
Depreciable capital by year.
- Returns
- annual_chargendarray
Charge by year.
- pyH2A.Discounted_Cash_Flow.discounted_cash_flow_function(inp, values, parameters, attribute='h2_cost', plugin=None, plugin_attr=None)[source]#
Wrapper function for
Discounted_Cash_Flow
, substituting provided values at specified parameter positions and returning desired attribute ofDiscounted_Cash_Flow
object.- Parameters
- inpdict or str
Dictionary containing input information. If inp is a file path, the provided file is converted to a dictionary using
convert_input_to_dictionary
.- valuesndarray
1D (in case of one parameter) or 2D array (in case of multiple parameters) containing the values which are to be used.
- parametersndarray
1D or 2D array containing the parameter specifications (location within inp); Format: [top_key, middle_key, bottom_key].
- attributestr, optional
Desired attribute of
Discounted_Cash_Flow
object, which should be returned. If the attribute is plugs, the .plugs dictionary attribute is accessed, which contains information of all used plugins (see plugin and plugin_attr). Defaults to h2_cost.- pluginstr, optional
If attribute is set to plugs, a plugin has to be specified, which should be accessed. Furthermore, a corresponding attribute of the plugin needs to be provided, see plugin_attr.
- plugin_attrstr, optional
If attribute is set to plugs, plugin_attr controls which attribute of the specified plugin is accessed.
- Returns
- resultsndarray
For each value (1D array) or set of values (2D array), the values are substituted in inp, Discounted_Cash_Flow (dcf) is executed and the dcf object is generated. Then, the requested attribute is stored in results, which is finally returned.