Add electricity
Misc collection of functions supporting network prep still to be cleaned up
add_missing_carriers(n, carriers)
Function to add missing carriers to the network without raising errors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n
|
Network
|
the pypsa network object |
required |
carriers
|
list | set
|
a list of carriers that should be included |
required |
Source code in workflow/scripts/add_electricity.py
calculate_annuity(lifetime, discount_rate)
Calculate the annuity factor for an asset with lifetime n years and discount rate of r, e.g. annuity(20, 0.05) * 20 = 1.6
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lifetime
|
int
|
ecomic asset lifetime for discounting/NPV calc |
required |
discount_rate
|
float
|
the WACC |
required |
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
the annuity factor |
Source code in workflow/scripts/add_electricity.py
load_costs(tech_costs, cost_config, elec_config, cost_year, n_years, econ_lifetime=40)
Calculate the anualised capex costs and OM costs for the technologies based on the input data
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tech_costs
|
PathLike
|
the csv containing the costs |
required |
cost_config
|
dict
|
the snakemake pypsa-china cost config |
required |
elec_config
|
dict
|
the snakemake pypsa-china electricity config |
required |
cost_year
|
int
|
the year for which the costs are retrived |
required |
n_years
|
int
|
the # of years represented by the snapshots/investment period |
required |
econ_lifetime
|
int
|
the max lifetime over which to discount. Defaults to 40. |
40
|
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: costs dataframe in [CURRENCY] per MW_ ... or per MWh_ ... |
Source code in workflow/scripts/add_electricity.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
sanitize_carriers(n, config)
Sanitize the carrier information in a PyPSA Network object.
The function ensures that all unique carrier names are present in the network's carriers attribute, and adds nice names and colors for each carrier according to the provided configuration dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n
|
Network
|
PyPSA Network object representing the electrical power system. |
required |
config
|
dict
|
A dictionary containing configuration information, specifically the "plotting" key with "nice_names" and "tech_colors" keys for carriers. |
required |