Skip to content

Commit 6452ac3

Browse files
authored
Merge branch 'master' into input_data_updates
2 parents 75882be + 2568878 commit 6452ac3

File tree

8 files changed

+36
-34
lines changed

8 files changed

+36
-34
lines changed
-34 Bytes
Binary file not shown.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- master
77
schedule:
8-
- cron: '0 0 * * *' # Daily “At 00:00”
8+
- cron: '0 0 1,15 * *' # First and fifteenth of month “At 00:00”
99
workflow_dispatch:
1010

1111
concurrency:

.github/workflows/docker_ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
name: docker-compose-actions-workflow
22
on:
33
push:
4+
branches:
5+
- master
46
pull_request:
7+
schedule:
8+
- cron: '0 0 1,15 * *' # First and fifteenth of month “At 00:00”
9+
510
jobs:
611

712
docker_compose:

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
| CI | [![GitHub Workflow Status][github-ci-badge]][github-ci-link] |
2-
| :----------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
1+
| CI | [![GitHub Workflow Status][github-ci-badge]][github-ci-link] [![GitHub Workflow Status][github-docker-badge]][github-docker-link] |
2+
| :----------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------: |
33
| **Docs** | [![Documentation Status][rtd-badge]][rtd-link] |
44
| **Version** | [![Version][version-badge]][version-link] |
55

@@ -204,6 +204,8 @@ Notes:
204204

205205
[github-ci-badge]: https://img.shields.io/github/actions/workflow/status/NREL/dgen/ci.yml?branch=master&style=for-the-badge&label=CI
206206
[github-ci-link]: https://github.com/NREL/dgen/actions/workflows/ci.yml
207+
[github-docker-badge]: https://img.shields.io/github/actions/workflow/status/NREL/dgen/docker_ci.yml?branch=master&style=for-the-badge&label=Docker
208+
[github-docker-link]:https://github.com/NREL/dgen/actions/workflows/docker_ci.yml
207209
[rtd-badge]: https://img.shields.io/badge/docs-ready-blue.svg
208210
[rtd-link]: https://nrel.github.io/dgen/
209211
[version-link]: https://github.com/NREL/dgen/releases/latest

build_envs/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ dependencies:
1616
- scipy
1717
- spyder
1818
- sqlalchemy
19-
- nrel-pysam>=5.1.0
19+
- nrel-pysam=7.1.0

dgen_os/python/agent_mutation/elec.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def apply_export_tariff_params(dataframe, net_metering_state_df, net_metering_ut
117117
net_metering_utility_df = net_metering_utility_df[['eia_id','sector_abbr','state_abbr']+nem_columns]
118118

119119
# check if utility-specific NEM parameters apply to any agents - need to join on state too (e.g. Pacificorp UT vs Pacificorp ID)
120-
temp_df = pd.merge(dataframe, net_metering_utility_df, how='left', on=['eia_id','sector_abbr','state_abbr'])
120+
temp_df = pd.merge(dataframe, net_metering_utility_df.drop_duplicates(), how='left', on=['eia_id','sector_abbr','state_abbr'])
121121

122122
# filter agents with non-null nem_system_kw_limit - these are agents WITH utility NEM
123123
agents_with_utility_nem = temp_df[pd.notnull(temp_df['nem_system_kw_limit'])]
@@ -127,7 +127,7 @@ def apply_export_tariff_params(dataframe, net_metering_state_df, net_metering_ut
127127

128128
# merge agents with state-specific NEM parameters
129129
net_metering_state_df = net_metering_state_df[['state_abbr', 'sector_abbr']+nem_columns]
130-
agents_without_utility_nem = pd.merge(agents_without_utility_nem, net_metering_state_df, how='left', on=['state_abbr', 'sector_abbr'])
130+
agents_without_utility_nem = pd.merge(agents_without_utility_nem, net_metering_state_df.drop_duplicates(), how='left', on=['state_abbr', 'sector_abbr'])
131131

132132
# re-combine agents list and fill nan's
133133
dataframe = pd.concat([agents_with_utility_nem, agents_without_utility_nem], sort=False)
@@ -401,11 +401,9 @@ def apply_financial_params(dataframe, financing_terms, itc_options, inflation_ra
401401
'''
402402
dataframe = dataframe.reset_index()
403403

404-
# Merge financing terms onto agent DataFrame
405-
dataframe = dataframe.merge(financing_terms, how='left', on=['year', 'sector_abbr'])
404+
dataframe = dataframe.merge(financing_terms.drop_duplicates(), how='left', on=['year', 'sector_abbr'])
406405

407-
# Merge ITC options on to DataFrame
408-
dataframe = dataframe.merge(itc_options[['itc_fraction_of_capex', 'year', 'tech', 'sector_abbr']],
406+
dataframe = dataframe.merge(itc_options[['itc_fraction_of_capex', 'year', 'tech', 'sector_abbr']].drop_duplicates(),
409407
how='left', on=['year', 'tech', 'sector_abbr'])
410408

411409
# Set inflation rate data to 'inflation_rate' column in agent DataFrame
@@ -441,9 +439,7 @@ def apply_load_growth(dataframe, load_growth_df):
441439

442440
# Create 'county_id' column in agent DataFrame
443441
dataframe["county_id"] = dataframe.county_id.astype(int)
444-
445-
# Merge load growth data onto agent DataFrame
446-
dataframe = pd.merge(dataframe, load_growth_df, how='left', on=['year', 'sector_abbr', 'county_id'])
442+
dataframe = pd.merge(dataframe, load_growth_df.drop_duplicates(), how='left', on=['year', 'sector_abbr', 'county_id'])
447443

448444
# For residential agents, load growth translates to kwh_per_customer change
449445
dataframe['load_kwh_per_customer_in_bin'] = np.where(dataframe['sector_abbr']=='res',
@@ -1049,17 +1045,16 @@ def estimate_initial_market_shares(dataframe, state_starting_capacities_df):
10491045
'developable_agent_weight', 'developable_customers_in_state')
10501046
state_total_agents.columns = state_total_agents.columns.str.replace(
10511047
'developable_agent_weight', 'agent_count')
1052-
1053-
# Merge together
1054-
state_denominators = pd.merge(state_total_developable_customers, state_total_agents, how='left', on=[
1048+
# merge together
1049+
state_denominators = pd.merge(state_total_developable_customers, state_total_agents.drop_duplicates(), how='left', on=[
10551050
'state_abbr', 'sector_abbr', 'tech'])
10561051

1057-
# Merge back to the main dataframe
1058-
dataframe = pd.merge(dataframe, state_denominators, how='left', on=[
1052+
# merge back to the main dataframe
1053+
dataframe = pd.merge(dataframe, state_denominators.drop_duplicates(), how='left', on=[
10591054
'state_abbr', 'sector_abbr', 'tech'])
10601055

1061-
# Merge in the state starting capacities
1062-
dataframe = pd.merge(dataframe, state_starting_capacities_df, how='left',
1056+
# merge in the state starting capacities
1057+
dataframe = pd.merge(dataframe, state_starting_capacities_df.drop_duplicates(), how='left',
10631058
on=['state_abbr', 'sector_abbr'])
10641059

10651060

dgen_os/python/dg3n.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ dependencies:
1616
- scipy
1717
- spyder
1818
- sqlalchemy
19-
- nrel-pysam
19+
- nrel-pysam=7.1.0
2020

2121

dgen_os/python/financial_functions.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ def calc_system_performance(kw, pv, utilityrate, loan, batt, costs, agent, rate_
237237
# Assign calculated values to the CashLoan module
238238
loan.SystemOutput.annual_energy_value = annual_energy_value
239239
loan.SystemOutput.gen = utilityrate.SystemOutput.gen
240-
loan.ThirdPartyOwnership.elec_cost_with_system = utilityrate.Outputs.elec_cost_with_system
241-
loan.ThirdPartyOwnership.elec_cost_without_system = utilityrate.Outputs.elec_cost_without_system
240+
loan.ChargesByMonth.utility_bill_w_sys = utilityrate.Outputs.utility_bill_w_sys
242241

243242
# Calculate system costs
244243
direct_costs = (system_costs + batt_costs) * costs['cap_cost_multiplier']
@@ -327,15 +326,16 @@ def calc_system_size_and_performance(agent, rate_switch_table):
327326

328327
# Set the battery type to use based on agent sector
329328
if agent.loc['sector_abbr'] == 'res':
330-
batt = battery.default("GenericBatteryResidential")
329+
batt = battery.default("CustomGenerationBatteryResidential")
331330
else:
332-
batt = battery.default("GenericBatteryCommercial")
331+
batt = battery.default("CustomGenerationBatteryCommercial")
333332

334333
# Instantiate utilityrate5 model based on agent sector
335334
if agent.loc['sector_abbr'] == 'res':
336-
utilityrate = utility.from_existing(batt, "GenericBatteryResidential")
335+
utilityrate = utility.from_existing(batt, "CustomGenerationBatteryResidential")
337336
else:
338-
utilityrate = utility.from_existing(batt, "GenericBatteryCommercial")
337+
utilityrate = utility.from_existing(batt, "CustomGenerationBatteryCommercial")
338+
tariff_dict = agent.loc['tariff_dict']
339339

340340
######################################
341341
###--------- UTILITYRATE5 ---------###
@@ -424,11 +424,11 @@ def calc_system_size_and_performance(agent, rate_switch_table):
424424
# Assume res agents do not evaluate depreciation at all
425425
# Assume non-res agents only evaluate federal depreciation (not state)
426426
if agent.loc['sector_abbr'] == 'res':
427-
loan = cashloan.from_existing(utilityrate, "GenericBatteryResidential")
427+
loan = cashloan.from_existing(utilityrate, "CustomGenerationBatteryResidential")
428428
loan.FinancialParameters.market = 0
429429

430430
else:
431-
loan = cashloan.from_existing(utilityrate, "GenericBatteryCommercial")
431+
loan = cashloan.from_existing(utilityrate, "CustomGenerationBatteryCommercial")
432432
loan.FinancialParameters.market = 1
433433

434434
# Assign values to PySAM CashLoan module
@@ -574,8 +574,8 @@ def calc_system_size_and_performance(agent, rate_switch_table):
574574
if npv_w_batt >= npv_no_batt:
575575
system_kw = res_with_batt.x
576576
annual_energy_production_kwh = batt_annual_energy_kwh
577-
first_year_elec_bill_with_system = batt_util_outputs['elec_cost_with_system_year1']
578-
first_year_elec_bill_without_system = batt_util_outputs['elec_cost_without_system_year1']
577+
first_year_elec_bill_with_system = batt_util_outputs['utility_bill_w_sys_year1']
578+
first_year_elec_bill_without_system = batt_util_outputs['utility_bill_wo_sys_year1']
579579

580580
npv = npv_w_batt
581581

@@ -602,8 +602,8 @@ def calc_system_size_and_performance(agent, rate_switch_table):
602602
else:
603603
system_kw = res_no_batt.x
604604
annual_energy_production_kwh = no_batt_annual_energy_kwh
605-
first_year_elec_bill_with_system = no_batt_util_outputs['elec_cost_with_system_year1']
606-
first_year_elec_bill_without_system = no_batt_util_outputs['elec_cost_without_system_year1']
605+
first_year_elec_bill_with_system = no_batt_util_outputs['utility_bill_w_sys_year1']
606+
first_year_elec_bill_without_system = no_batt_util_outputs['utility_bill_wo_sys_year1']
607607

608608
npv = npv_no_batt
609609
payback = no_batt_loan_outputs['payback']
@@ -1077,7 +1077,7 @@ def calc_max_market_share(dataframe, max_market_share_df):
10771077
max_market_share_df['payback_period_as_factor'] = (max_market_share_df['payback_period'] * 100).round().astype('int')
10781078

10791079
# Join the max_market_share table and dataframe in order to select the ultimate mms based on the metric value.
1080-
dataframe = pd.merge(dataframe, max_market_share_df[['sector_abbr', 'max_market_share', 'metric', 'payback_period_as_factor', 'business_model']],
1080+
dataframe = pd.merge(dataframe, max_market_share_df[['sector_abbr', 'max_market_share', 'metric', 'payback_period_as_factor', 'business_model']].drop_duplicates(),
10811081
how = 'left', on = ['sector_abbr', 'metric','payback_period_as_factor','business_model'])
10821082

10831083
# Select for only necessary columns to be returned with dataframe

0 commit comments

Comments
 (0)