Modules¶
npa_howtopay.model
¶
YearContext
dataclass
¶
Context for all values needed in a given year
Source code in src/npa_howtopay/model.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
calculate_avg_bill_per_user(inflation_adjusted_revenue, num_users)
¶
Calculate the average bill per user by dividing total revenue by number of users.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inflation_adjusted_revenue
|
float
|
Total revenue adjusted for inflation |
required |
num_users
|
int
|
Total number of users to divide revenue among |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Average bill amount per user |
Source code in src/npa_howtopay/model.py
205 206 207 208 209 210 211 212 213 214 215 | |
calculate_converts_electric_bill_per_user(electric_fixed_charge, electric_variable_tariff, per_user_electric_need, per_user_heating_need, per_user_water_heating_need, hp_efficiency, water_heater_efficiency)
¶
Calculate electric bill per user for converts (includes heating).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
electric_fixed_charge
|
float
|
Fixed charge per user |
required |
electric_variable_tariff
|
float
|
Variable tariff per kWh |
required |
per_user_electric_need
|
float
|
Electric need per user |
required |
per_user_heating_need
|
float
|
Heating need per user (therms) |
required |
per_user_water_heating_need
|
float
|
Water heating need per user (therms) |
required |
hp_efficiency
|
float
|
Heat pump efficiency |
required |
water_heater_efficiency
|
float
|
Water heater efficiency |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Electric bill per user for converts |
Source code in src/npa_howtopay/model.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
calculate_converts_total_bill_per_user(converts_gas_bill, converts_electric_bill)
¶
Calculate total bill per user for converts (gas + electric).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
converts_gas_bill
|
float
|
Gas bill per user for converts |
required |
converts_electric_bill
|
float
|
Electric bill per user for converts |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Total bill per user for converts |
Source code in src/npa_howtopay/model.py
333 334 335 336 337 338 339 340 341 342 343 | |
calculate_electric_fixed_charge_per_user(fixed_charge)
¶
Return electric fixed charge per user. Currently a user defined constant
Source code in src/npa_howtopay/model.py
220 221 222 | |
calculate_electric_variable_tariff_per_kwh(electric_infl_adj_revenue, total_electric_usage_kwh, fixed_charge, num_users)
¶
Calculate electric variable cost per kWh.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
electric_infl_adj_revenue
|
float
|
Total electric revenue adjusted for inflation |
required |
total_electric_usage_kwh
|
float
|
Total electric usage in kWh |
required |
fixed_charge
|
float
|
Fixed charge per user |
required |
num_users
|
int
|
Number of users |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Variable cost per kWh calculated by subtracting total fixed charges from revenue and dividing by total usage |
Source code in src/npa_howtopay/model.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
calculate_gas_fixed_charge_per_user(fixed_charge)
¶
Return gas fixed cost per user. Currently a user defined constant
Source code in src/npa_howtopay/model.py
244 245 246 | |
calculate_gas_variable_tariff_per_therm(gas_infl_adj_revenue, total_gas_usage_therms, fixed_charge, num_users)
¶
Calculate gas variable cost per therm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gas_infl_adj_revenue
|
float
|
Total gas revenue adjusted for inflation |
required |
total_gas_usage_therms
|
float
|
Total gas usage in therms |
required |
fixed_charge
|
float
|
Fixed charge per user |
required |
num_users
|
int
|
Number of users |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Variable cost per therm calculated by subtracting total fixed charges from revenue and dividing by total usage |
Source code in src/npa_howtopay/model.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | |
calculate_nonconverts_electric_bill_per_user(electric_fixed_charge, electric_variable_tariff, per_user_electric_need)
¶
Calculate electric bill per user for nonconverts (no heating).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
electric_fixed_charge
|
float
|
Fixed charge per user |
required |
electric_variable_tariff
|
float
|
Variable tariff per kWh |
required |
per_user_electric_need
|
float
|
Electric need per user |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Electric bill per user for nonconverts |
Source code in src/npa_howtopay/model.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
calculate_nonconverts_gas_bill_per_user(gas_fixed_charge, gas_variable_tariff, per_user_heating_need)
¶
Calculate gas bill per user for nonconverts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gas_fixed_charge
|
float
|
Fixed charge per user |
required |
gas_variable_tariff
|
float
|
Variable tariff per therm |
required |
per_user_heating_need
|
float
|
Heating need per user |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Gas bill per user for nonconverts |
Source code in src/npa_howtopay/model.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
calculate_nonconverts_total_bill_per_user(nonconverts_gas_bill, nonconverts_electric_bill)
¶
Calculate total bill per user for nonconverts (gas + electric).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nonconverts_gas_bill
|
float
|
Gas bill per user for nonconverts |
required |
nonconverts_electric_bill
|
float
|
Electric bill per user for nonconverts |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Total bill per user for nonconverts |
Source code in src/npa_howtopay/model.py
346 347 348 349 350 351 352 353 354 355 356 | |
compute_bill_costs(df, input_params)
¶
Compute bill costs and tariffs for gas and electric utilities.
Takes a DataFrame with revenue requirements and usage data and computes: - Inflation adjusted revenue requirements for gas and electric - Fixed charges per user and Variable tariffs per therm (gas) and kWh (electric) - Utility bills per user for converts and nonconverts - Total bills per user for converts and nonconverts
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
DataFrame containing revenue requirements and usage data |
required |
input_params
|
InputParams
|
Input parameters containing utility rates and user counts |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with added columns for adjusted revenue requirements and tariffs |
Source code in src/npa_howtopay/model.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | |
compute_intermediate_cols_electric(context, input_params, ts_params)
¶
Compute intermediate columns for electric utility calculations.
Calculates electric utility metrics for a given year including: - Number of users and cumulative heat pump converts - Total electric usage in kWh (base usage + heating from converts) - Fixed and volumetric costs - Operating expenses and revenue requirements
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
YearContext
|
Year context containing ratebase, depreciation and maintenance costs |
required |
input_params
|
InputParams
|
Input parameters with utility rates and user counts |
required |
ts_params
|
TimeSeriesParams
|
Time series parameters with NPA projects and overhead costs |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with calculated electric utility metrics for the given year |
Source code in src/npa_howtopay/model.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
compute_intermediate_cols_gas(context, input_params, ts_params)
¶
Compute intermediate columns for gas utility calculations.
Calculates gas utility metrics for a given year including: - Number of users (accounting for heat pump converts) - Total gas usage in therms - Fixed and volumetric costs - Operating expenses and revenue requirements
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
YearContext
|
Year context containing ratebase, depreciation and maintenance costs |
required |
input_params
|
InputParams
|
Input parameters with utility rates and user counts |
required |
ts_params
|
TimeSeriesParams
|
Time series parameters with NPA projects and overhead costs |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with calculated gas utility metrics for the given year |
Source code in src/npa_howtopay/model.py
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 | |
create_scenario_runs(start_year, end_year, gas_electric, capex_opex)
¶
Create a dictionary of scenario parameters for different model runs.
Creates scenarios for business-as-usual (BAU), taxpayer-funded, and combinations of gas/electric and capex/opex interventions. Each scenario specifies the time period and configuration parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_year
|
int
|
First year of the scenario analysis |
required |
end_year
|
int
|
Last year of the scenario analysis |
required |
gas_electric
|
list[Literal['gas', 'electric']]
|
List specifying which utilities to analyze ("gas" and/or "electric") |
required |
capex_opex
|
list[Literal['capex', 'opex']]
|
List specifying which cost types to analyze ("capex" and/or "opex") |
required |
Returns:
| Type | Description |
|---|---|
dict[str, ScenarioParams]
|
Dictionary mapping scenario names to ScenarioParams objects containing the |
dict[str, ScenarioParams]
|
configuration for that scenario. Includes "bau" and "taxpayer" base scenarios |
dict[str, ScenarioParams]
|
plus combinations of gas/electric and capex/opex parameters. |
Source code in src/npa_howtopay/model.py
38 39 40 41 42 43 44 45 46 47 48 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 | |
inflation_adjust_revenue_requirement(revenue_req, year, start_year, real_dollar_discount_rate)
¶
Adjust revenue requirement for inflation using discount rate.
Source code in src/npa_howtopay/model.py
195 196 197 198 199 200 201 | |
npa_howtopay.params
¶
TimeSeriesParams
¶
Source code in src/npa_howtopay/params.py
127 128 129 130 131 132 133 134 135 136 137 138 | |
__attrs_post_init__()
¶
Automatically append scattershot electrification to npa projects. In the BAU scenario, this will only return the scattershot electrification dataframe.
Source code in src/npa_howtopay/params.py
135 136 137 138 | |
get_available_runs(data_dir='data')
¶
Get list of available run_names from YAML files
Source code in src/npa_howtopay/params.py
204 205 206 207 208 209 210 | |
load_scenario_from_yaml(run_name, data_dir='data')
¶
Load default parameters for a specific run_name from its YAML file
Source code in src/npa_howtopay/params.py
213 214 215 216 217 218 219 220 221 | |
load_time_series_params_from_web_params(web_params, start_year, end_year, cost_inflation_rate=0.0)
¶
Load time series parameters from web parameters (scalar values)
Source code in src/npa_howtopay/params.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
load_time_series_params_from_yaml(run_name, data_dir='data')
¶
Load time series parameters from YAML file
Source code in src/npa_howtopay/params.py
224 225 226 227 228 229 230 231 232 | |
npa_howtopay.capex_project
¶
NpvSavingsProject
¶
Represents NPV savings from NPA projects that generate performance incentives.
Source code in src/npa_howtopay/capex_project.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
compute_depreciation_expense_from_capex_projects(year, df)
¶
Compute annual depreciation expense for capital projects.
For each project, depreciation expense is the original cost divided evenly over the depreciation lifetime. Depreciation starts the year after the project year and continues for the depreciation lifetime.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
The year to compute depreciation expense for |
required |
df
|
DataFrame
|
DataFrame containing capital projects with columns: - project_year: int - Year project was initiated - original_cost: float - Original cost of the project - depreciation_lifetime: int - Number of years to depreciate over |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Total depreciation expense for the year across all projects |
Source code in src/npa_howtopay/capex_project.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | |
compute_maintanence_costs(year, df, maintenance_cost_pct)
¶
Compute annual maintenance costs for capital projects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
The year to compute maintenance costs for |
required |
df
|
DataFrame
|
DataFrame containing capital projects with columns: - project_type: str - Type of project (npa or other) - original_cost: float - Original cost of the project |
required |
maintenance_cost_pct
|
float
|
float - Annual maintenance cost as percentage of original cost |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Total maintenance costs for the year, excluding NPA projects |
Source code in src/npa_howtopay/capex_project.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
compute_npv_of_capex_investment(initial_cost, lifetime, ror, real_dollar_discount_rate, year)
¶
Compute NPV of a capex investment. Year one incurrs a cost, then subsequent years earn a return equal to the ror on the annually depreciated value of the investment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_cost
|
float
|
Initial investment cost |
required |
lifetime
|
int
|
Investment lifetime in years |
required |
ror
|
float
|
Rate of return on ratebase |
required |
real_dollar_discount_rate
|
float
|
Discount rate for NPV |
required |
year
|
int
|
Year of investment |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
NPV of the investment |
Source code in src/npa_howtopay/capex_project.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | |
compute_npv_savings_from_npa_projects(year, npa_projects, npa_install_cost, npa_lifetime, pipeline_depreciation_lifetime, gas_ror, npv_discount_rate, performance_incentive_pct, incentive_payback_period)
¶
Generate NPV savings projects for NPA installations.
This function calculates the NPV difference between NPA investment and avoided LPP spending. The savings are tracked as projects that generate performance incentives over a payback period.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
The year to generate NPV savings projects for |
required |
npa_projects
|
DataFrame
|
DataFrame containing NPA project details |
required |
npa_install_cost
|
float
|
Cost per household of installing an NPA |
required |
npa_lifetime
|
int
|
Expected lifetime in years of an NPA installation |
required |
pipeline_depreciation_lifetime
|
int
|
Depreciation lifetime for avoided pipe projects |
required |
gas_ror
|
float
|
Rate of return on gas utility investments |
required |
npv_discount_rate
|
float
|
Discount rate for NPV calculations |
required |
performance_incentive_pct
|
float
|
Percentage of savings on which gas utility receives a performance incentive |
required |
Returns: pl.DataFrame with columns: - project_year: Year the NPV savings project was initiated - savings_amount: Total NPV savings amount - payback_period: Number of years to pay incentives - end_year: Year the incentive payments end
Source code in src/npa_howtopay/capex_project.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | |
compute_performance_incentive_this_year(year, df)
¶
Compute the ratebase value for a given year from NPV savings projects.
For each savings project, the ratebase value is the savings amount divided by payback period. Projects that haven't started yet (year < project_year) have zero ratebase value. Projects that are fully paid back have zero ratebase value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
The year to compute ratebase for |
required |
df
|
DataFrame
|
DataFrame containing NPV savings projects with columns: - project_year: int - Year project was initiated - savings_amount: float - Total NPV savings amount - payback_period: int - Number of years to pay incentives |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Total ratebase value for the year across all savings projects |
Source code in src/npa_howtopay/capex_project.py
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | |
compute_ratebase_from_capex_projects(year, df)
¶
Compute the ratebase value for a given year from capital projects.
For each project, the ratebase value declines linearly from the original cost to zero over the depreciation lifetime. Projects that haven't started yet (year < project_year) have zero ratebase value. Projects that are fully depreciated have zero ratebase value. Projects that are in the year of the project have the full original cost added to the ratebase.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
The year to compute ratebase for |
required |
df
|
DataFrame
|
DataFrame containing capital projects with columns: - project_year: int - Year project was initiated - original_cost: float - Original cost of the project - depreciation_lifetime: int - Number of years to depreciate over |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Total ratebase value for the year across all projects |
Source code in src/npa_howtopay/capex_project.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
get_grid_upgrade_capex_projects(year, npa_projects, peak_hp_kw, peak_aircon_kw, distribution_cost_per_peak_kw_increase, grid_upgrade_depreciation_lifetime)
¶
Generate capex projects for grid upgrades needed to support NPA installations.
This function calculates the required grid upgrades based on the peak power increase from heat pumps and air conditioners installed as part of NPA projects. The cost scales linearly with the total peak power increase.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
The year to generate projects for |
required |
npa_projects
|
DataFrame
|
DataFrame containing NPA project details |
required |
peak_hp_kw
|
float
|
Peak power draw in kW for a heat pump |
required |
peak_aircon_kw
|
float
|
Peak power draw in kW for an air conditioner |
required |
distribution_cost_per_peak_kw_increase
|
float
|
Cost per kW of increasing grid capacity in year of project |
required |
grid_upgrade_depreciation_lifetime
|
int
|
Depreciation lifetime in years for grid upgrades |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame with columns: - project_year: Year the project was initiated - project_type: "grid_upgrade" for grid capacity upgrades - original_cost: Total cost of grid upgrades - depreciation_lifetime: Depreciation lifetime in years |
Source code in src/npa_howtopay/capex_project.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
get_lpp_gas_capex_projects(year, gas_bau_lpp_costs_per_year, npa_projects, depreciation_lifetime)
¶
Generate capex projects for leak-prone pipe (LPP) replacement in the gas system.
This function calculates the remaining pipe replacement costs after accounting for pipe replacements avoided by NPA projects. If NPAs avoid all planned pipe replacements in a given year, returns an empty dataframe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
The year to generate projects for |
required |
gas_bau_lpp_costs_per_year
|
DataFrame
|
DataFrame containing business-as-usual pipe replacement costs with columns: - year: Year of planned replacement - cost: Cost of planned replacement Note: Multiple entries may exist per year |
required |
npa_projects
|
DataFrame
|
DataFrame containing NPA project details, used to calculate avoided pipe costs |
required |
depreciation_lifetime
|
int
|
Depreciation lifetime in years for pipe replacement projects |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame with columns: - project_year: Year the project was initiated - project_type: "pipeline" for pipe replacement projects - original_cost: Cost of the project after subtracting avoided costs - depreciation_lifetime: Depreciation lifetime in years - retirement_year: Year the project is fully depreciated |
Source code in src/npa_howtopay/capex_project.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
get_non_lpp_gas_capex_projects(year, current_ratebase, baseline_non_lpp_gas_ratebase_growth, depreciation_lifetime, construction_inflation_rate)
¶
Generate capex projects for non-LPP (non-leak prone pipe) gas infrastructure.
These represent routine gas infrastructure investments not related to pipe replacement or npas, such as meter replacements, regulator stations, etc. The cost is calculated as a percentage of current ratebase, adjusted for construction cost inflation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
The year to generate projects for |
required |
current_ratebase
|
float
|
Current value of the gas utility's ratebase |
required |
baseline_non_lpp_gas_ratebase_growth
|
float
|
Annual growth rate for non-LPP capex as fraction of ratebase |
required |
depreciation_lifetime
|
int
|
Blended depreciation lifetime in years for these projects |
required |
construction_inflation_rate
|
float
|
Annual inflation rate for construction costs |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame with columns: - project_year: Year the project was initiated - project_type: "misc" for miscellaneous gas infrastructure - original_cost: Cost of the project - depreciation_lifetime: Depreciation lifetime in years - retirement_year: Year the project is fully depreciated |
Source code in src/npa_howtopay/capex_project.py
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 | |
get_non_npa_electric_capex_projects(year, current_ratebase, baseline_electric_ratebase_growth, depreciation_lifetime, construction_inflation_rate)
¶
Generate capex projects for non-NPA non-grid upgrade electric system upgrades.
This function calculates the baseline capital expenditures for the electric system, excluding NPA-related projects. The expenditure grows with both the baseline growth rate and construction inflation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
The year to generate projects for |
required |
current_ratebase
|
float
|
Current value of the electric utility's ratebase |
required |
baseline_electric_ratebase_growth
|
float
|
Annual growth rate of non-NPA electric capex as fraction of ratebase |
required |
depreciation_lifetime
|
int
|
Blended depreciation lifetime in years for electric system projects |
required |
construction_inflation_rate
|
float
|
Annual inflation rate for construction costs |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame with columns: - project_year: Year the project was initiated - project_type: "misc" for miscellaneous electric system upgrades - original_cost: Cost of the project including construction inflation - depreciation_lifetime: Depreciation lifetime in years |
Source code in src/npa_howtopay/capex_project.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
get_npa_capex_projects(year, npa_projects, npa_install_cost, npa_lifetime)
¶
Generate capex projects for NPA (non-pipe alternative) installations.
This function calculates the capital costs associated with installing NPAs in a given year. The total cost is based on the number of heat pump conversions and the per-unit installation cost.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
The year to generate projects for |
required |
npa_projects
|
DataFrame
|
DataFrame containing NPA project details |
required |
npa_install_cost
|
float
|
Cost per household of installing an NPA |
required |
npa_lifetime
|
int
|
Expected lifetime in years of an NPA installation |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame with columns: - project_year: Year the project was initiated - project_type: "npa" for NPA installations - original_cost: Total cost of NPA installations - depreciation_lifetime: Depreciation lifetime in years |
Source code in src/npa_howtopay/capex_project.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
get_synthetic_initial_capex_projects(start_year, initial_ratebase, depreciation_lifetime)
¶
Generate synthetic capex projects to represent the projects that make up the initial ratebase.
Creates a series of historical capex projects that would result in the given initial ratebase value, assuming straight-line depreciation. Uses the triangular number formula to create a uniform distribution of projects over the depreciation lifetime, where each project has the same original cost. Projects are distributed evenly over depreciation_lifetime years leading up to start_year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_year
|
int
|
The first year of the model |
required |
initial_ratebase
|
float
|
The target ratebase value at start_year |
required |
depreciation_lifetime
|
int
|
The blended depreciation lifetime for the synthetic projects |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame with columns: - project_year: Year the project was initiated - project_type: "synthetic_initial" - original_cost: Cost of the project - depreciation_lifetime: Depreciation lifetime in years - retirement_year: Year the project is fully depreciated |
Source code in src/npa_howtopay/capex_project.py
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 | |
return_empty_npv_savings_df()
¶
Return empty DataFrame for NPV savings projects with proper schema.
Source code in src/npa_howtopay/capex_project.py
504 505 506 507 508 509 510 511 | |
npa_howtopay.npa_project
¶
append_scattershot_electrification_df(npa_projects_df, scattershot_electrification_df)
¶
Append a dataframe of scattershot electrification projects to the npa projects df. Scattershot electrification projects match the schema for npa projects, but will only affect the number of users and total electric usage, not anything related to pipe value or grid upgrades. It is meant to capture customers leaving the gas network independent of NPA projects.
Source code in src/npa_howtopay/npa_project.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
npa_howtopay.web_params
¶
create_scattershot_electrification_df(web_params, start_year, end_year)
¶
Generate a dataframe of scattershot electrification projects, one per year. The projects are distributed evenly across the years. These match the schema for npa projects, but will only affect the number of users, not anything related to pipe value or grid upgrades
Source code in src/npa_howtopay/web_params.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
create_time_series_from_web_params(web_params, start_year, end_year, cost_inflation_rate=0.0)
¶
Create all time series DataFrames from web parameters
Source code in src/npa_howtopay/web_params.py
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 | |