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
175 176 177 178 179 180 181 182 183 184 | |
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
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
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 |
Source code in workflow/scripts/add_electricity.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |