Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pysam #17

Merged
merged 37 commits into from
Jan 26, 2022
Merged

Update pysam #17

merged 37 commits into from
Jan 26, 2022

Conversation

dguittet
Copy link
Collaborator

@dguittet dguittet commented Oct 20, 2021

Depreciation

  • financial "hybridization" of Depreciation variables: using weight average for the allocation percents, and taking the union of each component's the deprecation types for the hybrid depreciation. This means, as an example, PV has 100MW allocated to straight line 5 year Fed bonus depreciation and Wind has 100MW allocated to straight line 15 yearFed bonus depreciation, then the Hybrid plant has 100MW allocated to each.

Debt, Construction, Reserve Accounts

Update PySAM to version 3.0.0

  • add required battery financial model input: batt_annual_discharge_energy
  • turn off LCOS calculation
  • update battery replacement cost name to om_batt_replacement_cost
  • update which om types contribute the the om_expenses output
  • allows use of updated MHK models, @barker59

@dguittet dguittet requested review from qualand and removed request for qualand October 20, 2021 17:23
@qualand
Copy link
Collaborator

qualand commented Oct 27, 2021

@dguittet This is looking good! I think the 'or' logic of handling the depreciation works out. Do you think we should be calculating the hybrid depreciation allocations using a weighted average of total installed cost and not system capacity?
image

@dguittet
Copy link
Collaborator Author

dguittet commented Nov 2, 2021

That's a good point about weighting by the total installed cost!

Also, I've been looking at the effect of adding the taxes to the dispatch which decreases the sales price. In the unit test, the battery performs better with taxes taken into account but in my larger example, it performs better when it pretends taxes are 0. I think this means I'm not understanding how the sales and purchases are being taxed by the financial model and so I'm tempted to remove the tax parameter...

@dguittet
Copy link
Collaborator Author

dguittet commented Nov 9, 2021

I've updated the averaging and I also added in the option to charge the battery entirely from PV in order to qualify for the ITC credits.

I would appreciate if you could review those, thanks!

production_ratios = []
total_production = sum([v.annual_energy_kw for v in generators])
for v in generators:
production_ratios.append(v.annual_energy_kw / total_production)
Copy link
Collaborator

@qualand qualand Nov 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dguittet How does the production_ratio work when the battery returns a negative value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set up a non_storage_production_ratio for the O&M variable costs, which are computed differently for storage and non-storage generation. For PV and wind, the om_production is applied to the gen vector, and for battery, the om_batt_variable_cost is applied to just the battery discharge.

I added new tests to make sure these variable costs and the production tax credits make sense:

def test_hybrid_om_costs(site):

@dguittet dguittet merged commit 1bfe81c into master Jan 26, 2022
@dguittet dguittet deleted the update_pysam branch January 26, 2022 02:23
dguittet pushed a commit that referenced this pull request Apr 14, 2022
Adds new development functionality for REopt. Off-grid and Electrolyzer
dguittet added a commit that referenced this pull request Apr 14, 2022
* Adds test_h2_main.py. Modifies h2_main and hopp_for_h2.py for better path compatibility when run from different dir

* Merge dev_merge from bayc into add_tests_h2_main (#2)

* fix if statement for weight_option checking

* update pysam version 2.2.2

* update requirements for new version 0.0.4

* update release notes for v 0.0.4

* update release to 0.0.5 by yanking 0.0.4

* Publish on release actions (#8)

* add conda packaging needs
add version file
update setup.py and README

* import version from package

* revert version get process

* fix version path

Co-authored-by: Darice L Guittet <dguittet@nrel.gov>

* Create ci.yml

* Update requirements.txt

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Battery dispatch (#10)

* open sourcing repo; all 5 examples running

* adding battery dispatch optimization and clustering code

These capabilities do not work in their current state.

* update latest open sourcing repo

* update gitignore to ignore log files

* merge in changes from master

* Revert deletion of battery dispatch scripts

* removed dynamic_voltage_model and main_dispatch

main_dispatch.py is outdated, dynamic_voltage_model.py is a toy model not required for dispatch.

* delete parameters folder

* restore deleted files

* delete accidentally duplicated files

* update to PySAM 2.2.0

* Adding integrated dispatch optimization model, a new battery class using statefulBattery model (storage.py), and a example file to run hybrid with dispatch.  Updated requirements to include Pyomo dependency.  Battery financial model has not be fully integrated.

* Adding normalized price data

* Add ElectricityPrices as Resource and start hybrid_npv.py as optimization example

* modify error messages on ElectricityPrices

* start creating Layout classes

* modify error messages on ElectricityPrices

* Move wind layout functions to WindLayout class; all tests passing

* Updates to dispatch integration

-Added battery Outputs class to store stateful and dispatch outputs
-Added plotting tools for viewing dispatch output
-updated battery surface area calculation (will update again when pySAM updates
-integrated gird prices from site to dispatch

* Update dispatch.py

removed made up price schedule

* Move solar layout functions to SolarLayout class; all tests passing

* Added number of look-ahead periods to dispatch class. Removed numpy dependence in dispatch class.  General clean up.

* Move grid prices from SiteInfo into all the financial models & update examples

* start adding HybridLayout

* added storage kw and kwh getter and setter

* add HybridLayout into HybridSimulation; change cost calculator; rename classes in PowerSources; add tests

* fix tests in hybrid_layout.py

* start flicker addition to HybridLayout

* make inputs and outputs of PySAM models class properties; need to check tests

* nearest flicker map loaded; all tests passing and examples working

* Add flicker loss calculation to hybrid_layout.py

* Update hybrid_npv.py example with layout plotting

* Adds storage cost to CostCalculator

* added simulation clustering to dispatch simulation method

Defaults for clustering have not been vetted!

* Adds storage_installed_cost to total_installed_cost

* changes storage_size to storage_size_mw in cost_calculator

* minor updates formatting

* Fix expected value for test_calculate_installed_costs_per_mw

* Updates expected value for test_calculate_installed_costs

* Add ATBLookup - atb_lookup.py function to look up ATB costs from 2018 - 2050. Modifies create_cost_calculator to accomodate

* Adds test_calculate_installed_costs_per_mw_atb to test ATB functionality

* Updates expected result for test_run_hopp_calc

* Added floris as an option for wind modeling

* Refactoring Dispatch Optimization model

- Split dispatch model by technology
- Combine Pyomo Block to create hybrid dispatch
- Added dispatch tests for each technology
- Added hybrid test with dispatch
- NEED to remove old dispatch full integration
- NEED to implement detailed battery dispatch
- NEED to re-implement clustering

* Adding Detailed battery dispatch

Detailed battery dispatch is not fully integrated. Detailed battery dispatch test will fail.  Working to get non-linear problem to solve with Mindtpy.

* Clean up interface for custom modules

* Convert wind_source.py to use "value" for accessing system model variables

* Rename `get_variable` fxn in PowerSource to `value` similar to that of component models

* Allow timestepping with FLORIS model

* annual_energy_kw to annual_energy

* cleaned up a couple thing before dispatch refactoring

* Refactored battery dispatch types into different classes

- built HybridDispatchBuilderSolver to build and solve dispatch problem
- moved HybridDispatch class which now:
     - links ports and builds arcs between technology dispatch models
     - builds objective function based on variables provided by other dispatch models
- created a Dispatch base class
- created a PowerStorageDispatch class which provides a simple battery dispatch and could be used to model other storage devices
- removed some out dated project files
- created directories for dispatch models

* handle project life in HybridSimulation.simulate

* fix solar layout; rename initialization fx in hybrid layout

* update lifetime input handling for simulation

* Add new optimization classes for OptimizationProblem and OptimizationDriver (base and HOPP)

* add lifetime degradation property; add DOF check in test_dispatch.py and only simulate for 1 year

* move module_specs to class var & add test for battery's simulate_with_dispatch

* change Constraint rule functions from class methods to local functions

* break out hybrid_dispatch_options.py and make Dispatch class instantiation based on RE type more generalized

* reduce number of functions in hybrid_dispatch.py & keep dictionary of variables

* minor re-org in hybrid_dispatch.py and add DOF test

* Rename "solar" objects to "pv" & fix up tests

* some missed conversion from 'solar' to 'pv'

* Added sizing design problem

Additionally,
 - Fixed 1-year simulate() dispatch error for available generation
- Fixed recursion bug when setting battery capacity property

* Added Battery Simple Heuristic Dispatch

- fixed "is" compare
- moved is_test to dispatch options
- added idaes_pse to requirements

* adding heuristic to sizing optimization problem

* updates based on comments

- refactored storage class to battery
- reduced the number of rounded digits between tech models and dispatch from 6 to 4 (To reduce the number of round-off warnings from setting dispatch initial SOC)
- added some comments to dispatch options
- reverted lifecycle rule to a class function so the linear voltage dispatch model can override this method
- refactored simple dispatch heuristic

* Added one cycle battery dispatch heuristic

* update merging of FLORIS module

* use dictionary for battery tech specs

* add floris to requirements.txt

* added floris to requirements

- removed a TODO in heuristic

* Updated pySAM and fixed dispatch test

- reduced assert window to the first 24 periods of dispatch solution
- relaxed assert tolerance

* Update test_dispatch.py

- Compare dispatch power to stateful battery model power only if battery is not on the SOC limits.

* Fix high temps in battery simulation

* update requirements.txt

* update requirements.txt

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* remove degrees_of_freedom tests

* comment out where mindtpy_test.py not running

* update test_run_hopp_calc.py

* fix shapely version in requirements.txt

* update test_layout.py

* less precision in test_run_hopp_calc.py

* less precision in test_layout.py.py

* less precision in test_layout.py.py

* add json for inputs for costs & PV

* fixed lifecycle warning

* checking if test on GitHub is configured correctly

* checking dispatch available generation

* fix broken dispatch tests by fixing Pyomo version

* Update ci.yml

* Fix financial calculations and allow CAPEX to be defined in input dictionary

* update example with battery

* Add hybrid_size_grid.py for parametric exploration

* add path

* minor edit to error reporting

* updates for pysam v2.2.3

* minor edits to hybrid_size_grid

* turn off print statement

* om_replacement_cost1 for PySAM v2.2.2

* clean up files before merging

* fix paths

* Clean up old files & examples

* Updated scaling in plot_tools

* Clean up old files & examples

Co-authored-by: WHamilt2 <william.hamilton@nrel.gov>
Co-authored-by: Aaron Barker <barker59@gmail.com>
Co-authored-by: King <jennifer.king@nrel.gov>
Co-authored-by: William Hamilton <34353104+qualand@users.noreply.github.com>

* Delete examples/ENGIE directory

* update requirements.txt

* Update requirements and readme for proper initial setup

* Detailed Financial Runs (#11)

* open sourcing repo; all 5 examples running

* adding battery dispatch optimization and clustering code

These capabilities do not work in their current state.

* update latest open sourcing repo

* update gitignore to ignore log files

* merge in changes from master

* Revert deletion of battery dispatch scripts

* removed dynamic_voltage_model and main_dispatch

main_dispatch.py is outdated, dynamic_voltage_model.py is a toy model not required for dispatch.

* delete parameters folder

* restore deleted files

* delete accidentally duplicated files

* update to PySAM 2.2.0

* Adding integrated dispatch optimization model, a new battery class using statefulBattery model (storage.py), and a example file to run hybrid with dispatch.  Updated requirements to include Pyomo dependency.  Battery financial model has not be fully integrated.

* Adding normalized price data

* Add ElectricityPrices as Resource and start hybrid_npv.py as optimization example

* modify error messages on ElectricityPrices

* start creating Layout classes

* modify error messages on ElectricityPrices

* Move wind layout functions to WindLayout class; all tests passing

* Updates to dispatch integration

-Added battery Outputs class to store stateful and dispatch outputs
-Added plotting tools for viewing dispatch output
-updated battery surface area calculation (will update again when pySAM updates
-integrated gird prices from site to dispatch

* Update dispatch.py

removed made up price schedule

* Move solar layout functions to SolarLayout class; all tests passing

* Added number of look-ahead periods to dispatch class. Removed numpy dependence in dispatch class.  General clean up.

* Move grid prices from SiteInfo into all the financial models & update examples

* start adding HybridLayout

* added storage kw and kwh getter and setter

* add HybridLayout into HybridSimulation; change cost calculator; rename classes in PowerSources; add tests

* fix tests in hybrid_layout.py

* start flicker addition to HybridLayout

* make inputs and outputs of PySAM models class properties; need to check tests

* nearest flicker map loaded; all tests passing and examples working

* Add flicker loss calculation to hybrid_layout.py

* Update hybrid_npv.py example with layout plotting

* Adds storage cost to CostCalculator

* added simulation clustering to dispatch simulation method

Defaults for clustering have not been vetted!

* Adds storage_installed_cost to total_installed_cost

* changes storage_size to storage_size_mw in cost_calculator

* minor updates formatting

* Fix expected value for test_calculate_installed_costs_per_mw

* Updates expected value for test_calculate_installed_costs

* Add ATBLookup - atb_lookup.py function to look up ATB costs from 2018 - 2050. Modifies create_cost_calculator to accomodate

* Adds test_calculate_installed_costs_per_mw_atb to test ATB functionality

* Updates expected result for test_run_hopp_calc

* Added floris as an option for wind modeling

* Refactoring Dispatch Optimization model

- Split dispatch model by technology
- Combine Pyomo Block to create hybrid dispatch
- Added dispatch tests for each technology
- Added hybrid test with dispatch
- NEED to remove old dispatch full integration
- NEED to implement detailed battery dispatch
- NEED to re-implement clustering

* Adding Detailed battery dispatch

Detailed battery dispatch is not fully integrated. Detailed battery dispatch test will fail.  Working to get non-linear problem to solve with Mindtpy.

* Clean up interface for custom modules

* Convert wind_source.py to use "value" for accessing system model variables

* Rename `get_variable` fxn in PowerSource to `value` similar to that of component models

* Allow timestepping with FLORIS model

* annual_energy_kw to annual_energy

* cleaned up a couple thing before dispatch refactoring

* Refactored battery dispatch types into different classes

- built HybridDispatchBuilderSolver to build and solve dispatch problem
- moved HybridDispatch class which now:
     - links ports and builds arcs between technology dispatch models
     - builds objective function based on variables provided by other dispatch models
- created a Dispatch base class
- created a PowerStorageDispatch class which provides a simple battery dispatch and could be used to model other storage devices
- removed some out dated project files
- created directories for dispatch models

* handle project life in HybridSimulation.simulate

* fix solar layout; rename initialization fx in hybrid layout

* update lifetime input handling for simulation

* Add new optimization classes for OptimizationProblem and OptimizationDriver (base and HOPP)

* add lifetime degradation property; add DOF check in test_dispatch.py and only simulate for 1 year

* move module_specs to class var & add test for battery's simulate_with_dispatch

* change Constraint rule functions from class methods to local functions

* break out hybrid_dispatch_options.py and make Dispatch class instantiation based on RE type more generalized

* reduce number of functions in hybrid_dispatch.py & keep dictionary of variables

* minor re-org in hybrid_dispatch.py and add DOF test

* Rename "solar" objects to "pv" & fix up tests

* some missed conversion from 'solar' to 'pv'

* Added sizing design problem

Additionally,
 - Fixed 1-year simulate() dispatch error for available generation
- Fixed recursion bug when setting battery capacity property

* Added Battery Simple Heuristic Dispatch

- fixed "is" compare
- moved is_test to dispatch options
- added idaes_pse to requirements

* adding heuristic to sizing optimization problem

* updates based on comments

- refactored storage class to battery
- reduced the number of rounded digits between tech models and dispatch from 6 to 4 (To reduce the number of round-off warnings from setting dispatch initial SOC)
- added some comments to dispatch options
- reverted lifecycle rule to a class function so the linear voltage dispatch model can override this method
- refactored simple dispatch heuristic

* Added one cycle battery dispatch heuristic

* update merging of FLORIS module

* use dictionary for battery tech specs

* add floris to requirements.txt

* added floris to requirements

- removed a TODO in heuristic

* Updated pySAM and fixed dispatch test

- reduced assert window to the first 24 periods of dispatch solution
- relaxed assert tolerance

* Update test_dispatch.py

- Compare dispatch power to stateful battery model power only if battery is not on the SOC limits.

* Fix high temps in battery simulation

* update requirements.txt

* update requirements.txt

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* remove degrees_of_freedom tests

* comment out where mindtpy_test.py not running

* update test_run_hopp_calc.py

* fix shapely version in requirements.txt

* update test_layout.py

* less precision in test_run_hopp_calc.py

* less precision in test_layout.py.py

* less precision in test_layout.py.py

* add json for inputs for costs & PV

* fixed lifecycle warning

* checking if test on GitHub is configured correctly

* checking dispatch available generation

* fix broken dispatch tests by fixing Pyomo version

* Update ci.yml

* Fix financial calculations and allow CAPEX to be defined in input dictionary

* update example with battery

* Add hybrid_size_grid.py for parametric exploration

* add path

* minor edit to error reporting

* updates for pysam v2.2.3

* minor edits to hybrid_size_grid

* turn off print statement

* om_replacement_cost1 for PySAM v2.2.2

* clean up files before merging

* fix paths

* Clean up old files & examples

* Updated scaling in plot_tools

* Clean up old files & examples

* add capacity payments

* remove setuptools_scm from requirements.txt

* fix tests

* add HOPP_examples to .gitignore

* update gitignore

* use absolute paths for examples

* update requirements.txt

* update financial model

* update analysis test results

* fix wind_resource.py to use PySAM converter

* add new financial outputs to hybrid simulation and update example

* fix typos

* Add grid charging to dispatch_options

* default construction financing cost multiplier to 0

* add more financial outputs

* add comments to financial outputs

* fix typo

* update test results

* update tests

* add new outputs for energy sales and purchases

* updates for hybrid simulation to be iterated with different sizes and layouts

* fix test_dispatch.py

* add time limit to dispatch solver

* Fix solar_resource data converter

* fix tests

* rename pv's degradation to dc_degradation

* allow assigning hybrid_plant inputs from dictionaries

* fix logging

* fix logging

* change exception to warning for hybrid_simulation's assign

* assign renamed to assign_fin_inputs and assign_tech_inputs

* minor edits to one_cycle_battery_dispatch_heuristic.py; test results show ~50% less energy revenue than optimized

* edit logging level for console reporting

* fix broken tests

* copy over replacements for battery to grid

* fix assign

* fix if battery statement

* add taxes to grid dispatch

* update test_run_hopp_calc.py expected results

* fix tests

* add financials test to test_hybrid.py

* fix test_reopt timeout reporting

* update pyomo requirement

* fix pv_layout when using Simple parameters

* reopt test fails but no error is returned, print warning

* update logging and error handling

* error handle when system_model has 0 capacity

* error handle when system_model has 0 capacity

* fix battery size = 0 while battery enabled

* add reporting to hybrid_simulation.py

* remove manual battery replacement in battery.py

* fix cf.hybrid calculation

* fix num iterations hybrid_npv.py

* pv_layout error catching

* fix broken tests

* fix pv_layout.py excess_buffer calculation

* modify error reporting for binary search fxns

* fix PV layout to use num_modules as design variable

* make hybrid, wind, and pv layout parameters size-agnostic

* replace exception of pv_layout failure with warning

* allow hybrid_size = 0

Co-authored-by: WHamilt2 <william.hamilton@nrel.gov>
Co-authored-by: Aaron Barker <barker59@gmail.com>
Co-authored-by: King <jennifer.king@nrel.gov>
Co-authored-by: William Hamilton <34353104+qualand@users.noreply.github.com>

* Improves verbosity of ValueError when getting developer key fails (#14)

* Increases verbosity of API value error in keys.py and provides better .env file guidance in Readme.md

* Adds set_nrel_key_dot_env() to site_info.py

* Fix setup.py (#15)

* fix files

* update README.md and keys.py

* Merge branch 'detail_example'

* removed glpk from requirements to fix install.py error

* update simulate_hybrid_wbattery_dispatch.py

* rename solar files in Docs to pv

* Readthedocs updates (#19)

* Update .readthedocs.yml

* add requirements-dev.txt

* update docs for flicker

* fix ReadTheDocs files

* fix _fix_dispatch_model_variables by adding (0, 1) bounds for soc

* Update ci.yml

* update expected_run_all_hybrid_calcs_result.csv

* Update ci.yml

* Update pysam (#17)

* update to pysam v 2.2.4

* fix some battery inputs for pysam v2.2.4

* fix om_expense outputs

* fix warning with log_name

* remove construction financing and add depreciation and debt

* fix test results

* update .gitignore

* fix battery financials for new version

* add battery replacement output

* remove taxes from grid_dispatch.py

* fix test results

* fix test results

* Update ci.yml

* fix test results

* fix test results

* fix test results

* modify solar PTC, add location from paper

* weight hybrid financials by production or cost ratio or evenly; add tax incentives output

* update tests

* fix tests

* add pv_charging_only to dispatch options for ITC qualification

* fix battery financial simulation to not run if 0 battery

* fix test results

* use power_sources for system_capacity_kw property

* rename solar files in Docs to pv

* add battery.rst

* update requirements-dev.txt

* update to pysam 3.0.0

* pvwattsv8 & O&M for battery

* O&M costs for hybrid with tests

* more tests for battery O&M variable cost

* production tax credits test

* fix tests

* fix accidental commit

* update test results

* Fixes csv.writer for Windows (#20)

* Fixes csv.writer for Windows: https://stackoverflow.com/questions/3191528

* Moving to vscode_debug branch

* Fix csv.writer for Windows compatibility

* Merge Attempt

* Update ci.yml

* Merge

* update tests

* fix cost_calculator

* set default dc_degradation

* set default log name for dispatch

* fix reopt test

* fix test_reopt.py

* update test_hybrid.py

* fix cost_calculator

* fix all tests

* Merge ino merge_H2

* update test_run_hopp_calc

* update test_results

* update test_result

Co-authored-by: dguittet <dguittet@nrel.gov>
Co-authored-by: Michael Rossol <18647211+MRossol@users.noreply.github.com>
Co-authored-by: WHamilt2 <william.hamilton@nrel.gov>
Co-authored-by: King <jennifer.king@nrel.gov>
Co-authored-by: William Hamilton <34353104+qualand@users.noreply.github.com>
Co-authored-by: Matthew Boyd <mr.matthew.boyd@gmail.com>
Co-authored-by: Jonathan Martin <94018654+jmartin4nrel@users.noreply.github.com>

* Update paths in run_reopt.py and h2_main.py

* Complete dev_merge -> feature/add_tests_h2_main and fix run issues. N.B. test_h2_main not passing (wrong lcoh)

* Rename H2 Analysis to H2_Analysis. NB test_h2_main.py still not passing

* merges in dev_merge changes including lifetime simulation adjustment

* test_h2_main.py running

* copy H2_Analysis into H2 Analysis

* rename folder

* clean up

* Add docstrings to hopp_for_h2.py. Removes H2 Analysis folder (H2_Analysis remains)

* Revert "Add docstrings to hopp_for_h2.py. Removes H2 Analysis folder (H2_Analysis remains)"

This reverts commit a3b2c87e5ccbdb9895c5eabf879f1b2b7c225d0a, reversing
changes made to c5b1adf396340e3a31efcf300289ca41e03800b3.

* fix merge

* revert merge conflicts

* delete unneeded import

* Updates merge conflicts in h2_main and hopp_for_h2

* Removes uneccessary analysis files and csv results

Co-authored-by: dguittet <dguittet@nrel.gov>
Co-authored-by: Michael Rossol <18647211+MRossol@users.noreply.github.com>
Co-authored-by: WHamilt2 <william.hamilton@nrel.gov>
Co-authored-by: King <jennifer.king@nrel.gov>
Co-authored-by: William Hamilton <34353104+qualand@users.noreply.github.com>
Co-authored-by: Matthew Boyd <mr.matthew.boyd@gmail.com>
Co-authored-by: Jonathan Martin <94018654+jmartin4nrel@users.noreply.github.com>
dguittet added a commit that referenced this pull request May 21, 2022
* Adds simulate_powerflow to power_source.py

* Resets power_flow_grid_model nodes at each timestep after breaking links or removing turbine powers

* Create H2 analysis branch

* Sets ATB pricing for wind and solar PV

* Set REopt force_download=True to avoid cached results

* Add scenario iteration

* Adds turbine hub height to resource download

* Fixed ptc switching

* Fixes hybrid_plant parameter setting

* Implements Cricitcal Load Factor for REopt

* Adds Blue Creek Analysis

* removes Blue Creek

* Final update, terminating branch

* Adds latest updates to h2_analysis and blue creek

* Plot updates for H2 Analysis

* Adds Colorado Powerflow Analysis

* Adds lots of enhancements to h2_analysis.py, adds viz_data_v2.py

* Latest H2 analysis update

* Added a simple battery dispatch

* Fixed bug for excess energy

* turned it into a function

* Changed the name so it is less confusing

* Remove redundant h2 viz file

* Adds h2_analysis_new.py, which enables scenario enumeration from H2 Baseline Future Scenarios.csv file

* Added simple dispatch to code and a skip reopt option

* Add IOWA and Southeast to analysis

* adds complete pickle files for IOWA and Southeast

* Customizes plot titles for Iowa and Southeast

* Update Iowa and Southeast cost projection files for 2020 to 2035

* Adds H2 Cost Model

* Adds H2 Cost Model

* Refactor: Add H2 Analysis and Powerflow Analysis dirs, clean up results, refactor h2_analysis_IOWA_H2A.py to h2_analysis_H2A.py

* Updates H2A model analysis

* Adds ColoradoPowerflowAnalysis_pandapower.py (AND: HOPP multi site analysis)

* Adds ColoradoPowerflowAnalysis_pandapower.py (AND HOPP multi location analysis)

* Adds ColoradoPowerflowAnalysis_pandapower.py (AND HOPP multi location analysis)

* Updates TU2k pandapower analysis

* Updates multi_location.py

* 2021 Paper Changes

* Updating h2_analysis code files and H2AModel.py

* Refactors h2_analysis_H2A

* Refactors H2 analysis code

* Fixes for HybridSim and dispatch code

* Fixes hopp_for_h2 inputs

* Adds tower height and rotor diameter passthrough to wind_source.py

* Adds fixed electrolyzer and storage sizes. Sets HOPP interconnection limit to electrolyzer size (for offgrid scenario)

* Add PEM LT H2 electrolyzer model

* Add sample script to run model

* Add model description

* update plot

* Tracks wind_source, custom_wind_floris, hybrid_simulation and site_info

* PEM electrolyzer and dispatch

* comment out print statements

* correct H2 run script dispatch

* optimization framework, H2 model adjustments

* optimize with simple H2 model

* Update equivalent circuit model
The model was initially keeping the input voltage constant for the entire el system regardless of how many el stacks were connected in the system. This commit multiplies the input voltage of one el stack by number of stacks in the system to reflect true voltage of el system

* Make merge of bayc/hopp easier and add capability to curtail excess power

* clean up code

* remove simple_h2 method and constant

* Changes from h2_simple model (deprecated) to h2_production_rate

* change power input to input dict and make el size a user input

* Sets up sane defaults for single scenario run. Renames h2_analysis_h2a_refactor to h2_main

* Fixes integration of PEM_electrolyzer_LT using in_dict and out_dict in run_h2_PEM

* Updates simple_dispatch model to include mw/mwh (duration)

* Updates simple_dispatch model to include mw/mwh (duration)

* commit to pull changes

* update battery charge and discharge

* Adds new development functionality for REopt. Off-grid and Electrolyzer

* GB optimizatino

* Fixes loads_kw setting in reopt post, and sets up better defaults for REopt optimization

* Fixes loads_kw setting in reopt post, and sets up better defaults for REopt optimization

* save GB optimization results

* GB optimization improvements

* example scenario file

* parameter sweep

* csv.writer needs file to be opened with newline='' for Windows compatibility, see: https://stackoverflow.com/questions/3191528

* Deactivating ReOpt and adding lcoe to requirements.txt

* Revert "Deactivating ReOpt and adding lcoe to requirements.txt"

This reverts commit 860e3c9.

* Adds new financial calculation framework

* Adds annual expense cashflow to H2A results

* Modify h2 PEM and H2A code to add input of project life and output of cashflows

* Adds user selected useful_life passthrough to H2A calcs

* Adds Annual Cashflows and Financial Summary Outputs. Fixes ptc setting error

* Allows debugger to step into modules

* Moves working directory to directory of file being run/debugged

* Bypass ReOpt to eliminate need for VPN

* Setup to debug from local changes

* Avoids ReOpt run

* Adds latest changes to detailed_fianancials

* removing vscode settings file

* removing vscode settings file

* Removes some extraneous print function calls in h2_main and REopt to tidy command line output

* Removes some extraneous print function calls in h2_main and REopt to tidy command line output

* Merge Attempt

* Update ci.yml

* Merge

* update tests

* fix cost_calculator

* set default dc_degradation

* set default log name for dispatch

* fix reopt test

* fix test_reopt.py

* update test_hybrid.py

* fix cost_calculator

* fix all tests

* Merge ino merge_H2

* update test_run_hopp_calc

* update test_results

* update test_result

* separate to simulate_financials

* separate to simulate_financials

* fix order in simulate

* fix om_variable & add comment

* fix simulate

* fix skip_financials option

* fix simulate_financials

* fx test

* add check for simulate_financials

* fix test_run_hopp_calc

* fix test_run_hopp_calc

* remove file

* fix test_all_hybrid_calcs

* use pathos for MP

* use pathos for MP

* add ability to turn off lifetime simulations

* delete reopt_dev.py

* rename H2 Analysis folder

* Feature/add tests h2 main (#24)

* Adds test_h2_main.py. Modifies h2_main and hopp_for_h2.py for better path compatibility when run from different dir

* Merge dev_merge from bayc into add_tests_h2_main (#2)

* fix if statement for weight_option checking

* update pysam version 2.2.2

* update requirements for new version 0.0.4

* update release notes for v 0.0.4

* update release to 0.0.5 by yanking 0.0.4

* Publish on release actions (#8)

* add conda packaging needs
add version file
update setup.py and README

* import version from package

* revert version get process

* fix version path

Co-authored-by: Darice L Guittet <dguittet@nrel.gov>

* Create ci.yml

* Update requirements.txt

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Battery dispatch (#10)

* open sourcing repo; all 5 examples running

* adding battery dispatch optimization and clustering code

These capabilities do not work in their current state.

* update latest open sourcing repo

* update gitignore to ignore log files

* merge in changes from master

* Revert deletion of battery dispatch scripts

* removed dynamic_voltage_model and main_dispatch

main_dispatch.py is outdated, dynamic_voltage_model.py is a toy model not required for dispatch.

* delete parameters folder

* restore deleted files

* delete accidentally duplicated files

* update to PySAM 2.2.0

* Adding integrated dispatch optimization model, a new battery class using statefulBattery model (storage.py), and a example file to run hybrid with dispatch.  Updated requirements to include Pyomo dependency.  Battery financial model has not be fully integrated.

* Adding normalized price data

* Add ElectricityPrices as Resource and start hybrid_npv.py as optimization example

* modify error messages on ElectricityPrices

* start creating Layout classes

* modify error messages on ElectricityPrices

* Move wind layout functions to WindLayout class; all tests passing

* Updates to dispatch integration

-Added battery Outputs class to store stateful and dispatch outputs
-Added plotting tools for viewing dispatch output
-updated battery surface area calculation (will update again when pySAM updates
-integrated gird prices from site to dispatch

* Update dispatch.py

removed made up price schedule

* Move solar layout functions to SolarLayout class; all tests passing

* Added number of look-ahead periods to dispatch class. Removed numpy dependence in dispatch class.  General clean up.

* Move grid prices from SiteInfo into all the financial models & update examples

* start adding HybridLayout

* added storage kw and kwh getter and setter

* add HybridLayout into HybridSimulation; change cost calculator; rename classes in PowerSources; add tests

* fix tests in hybrid_layout.py

* start flicker addition to HybridLayout

* make inputs and outputs of PySAM models class properties; need to check tests

* nearest flicker map loaded; all tests passing and examples working

* Add flicker loss calculation to hybrid_layout.py

* Update hybrid_npv.py example with layout plotting

* Adds storage cost to CostCalculator

* added simulation clustering to dispatch simulation method

Defaults for clustering have not been vetted!

* Adds storage_installed_cost to total_installed_cost

* changes storage_size to storage_size_mw in cost_calculator

* minor updates formatting

* Fix expected value for test_calculate_installed_costs_per_mw

* Updates expected value for test_calculate_installed_costs

* Add ATBLookup - atb_lookup.py function to look up ATB costs from 2018 - 2050. Modifies create_cost_calculator to accomodate

* Adds test_calculate_installed_costs_per_mw_atb to test ATB functionality

* Updates expected result for test_run_hopp_calc

* Added floris as an option for wind modeling

* Refactoring Dispatch Optimization model

- Split dispatch model by technology
- Combine Pyomo Block to create hybrid dispatch
- Added dispatch tests for each technology
- Added hybrid test with dispatch
- NEED to remove old dispatch full integration
- NEED to implement detailed battery dispatch
- NEED to re-implement clustering

* Adding Detailed battery dispatch

Detailed battery dispatch is not fully integrated. Detailed battery dispatch test will fail.  Working to get non-linear problem to solve with Mindtpy.

* Clean up interface for custom modules

* Convert wind_source.py to use "value" for accessing system model variables

* Rename `get_variable` fxn in PowerSource to `value` similar to that of component models

* Allow timestepping with FLORIS model

* annual_energy_kw to annual_energy

* cleaned up a couple thing before dispatch refactoring

* Refactored battery dispatch types into different classes

- built HybridDispatchBuilderSolver to build and solve dispatch problem
- moved HybridDispatch class which now:
     - links ports and builds arcs between technology dispatch models
     - builds objective function based on variables provided by other dispatch models
- created a Dispatch base class
- created a PowerStorageDispatch class which provides a simple battery dispatch and could be used to model other storage devices
- removed some out dated project files
- created directories for dispatch models

* handle project life in HybridSimulation.simulate

* fix solar layout; rename initialization fx in hybrid layout

* update lifetime input handling for simulation

* Add new optimization classes for OptimizationProblem and OptimizationDriver (base and HOPP)

* add lifetime degradation property; add DOF check in test_dispatch.py and only simulate for 1 year

* move module_specs to class var & add test for battery's simulate_with_dispatch

* change Constraint rule functions from class methods to local functions

* break out hybrid_dispatch_options.py and make Dispatch class instantiation based on RE type more generalized

* reduce number of functions in hybrid_dispatch.py & keep dictionary of variables

* minor re-org in hybrid_dispatch.py and add DOF test

* Rename "solar" objects to "pv" & fix up tests

* some missed conversion from 'solar' to 'pv'

* Added sizing design problem

Additionally,
 - Fixed 1-year simulate() dispatch error for available generation
- Fixed recursion bug when setting battery capacity property

* Added Battery Simple Heuristic Dispatch

- fixed "is" compare
- moved is_test to dispatch options
- added idaes_pse to requirements

* adding heuristic to sizing optimization problem

* updates based on comments

- refactored storage class to battery
- reduced the number of rounded digits between tech models and dispatch from 6 to 4 (To reduce the number of round-off warnings from setting dispatch initial SOC)
- added some comments to dispatch options
- reverted lifecycle rule to a class function so the linear voltage dispatch model can override this method
- refactored simple dispatch heuristic

* Added one cycle battery dispatch heuristic

* update merging of FLORIS module

* use dictionary for battery tech specs

* add floris to requirements.txt

* added floris to requirements

- removed a TODO in heuristic

* Updated pySAM and fixed dispatch test

- reduced assert window to the first 24 periods of dispatch solution
- relaxed assert tolerance

* Update test_dispatch.py

- Compare dispatch power to stateful battery model power only if battery is not on the SOC limits.

* Fix high temps in battery simulation

* update requirements.txt

* update requirements.txt

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* remove degrees_of_freedom tests

* comment out where mindtpy_test.py not running

* update test_run_hopp_calc.py

* fix shapely version in requirements.txt

* update test_layout.py

* less precision in test_run_hopp_calc.py

* less precision in test_layout.py.py

* less precision in test_layout.py.py

* add json for inputs for costs & PV

* fixed lifecycle warning

* checking if test on GitHub is configured correctly

* checking dispatch available generation

* fix broken dispatch tests by fixing Pyomo version

* Update ci.yml

* Fix financial calculations and allow CAPEX to be defined in input dictionary

* update example with battery

* Add hybrid_size_grid.py for parametric exploration

* add path

* minor edit to error reporting

* updates for pysam v2.2.3

* minor edits to hybrid_size_grid

* turn off print statement

* om_replacement_cost1 for PySAM v2.2.2

* clean up files before merging

* fix paths

* Clean up old files & examples

* Updated scaling in plot_tools

* Clean up old files & examples

Co-authored-by: WHamilt2 <william.hamilton@nrel.gov>
Co-authored-by: Aaron Barker <barker59@gmail.com>
Co-authored-by: King <jennifer.king@nrel.gov>
Co-authored-by: William Hamilton <34353104+qualand@users.noreply.github.com>

* Delete examples/ENGIE directory

* update requirements.txt

* Update requirements and readme for proper initial setup

* Detailed Financial Runs (#11)

* open sourcing repo; all 5 examples running

* adding battery dispatch optimization and clustering code

These capabilities do not work in their current state.

* update latest open sourcing repo

* update gitignore to ignore log files

* merge in changes from master

* Revert deletion of battery dispatch scripts

* removed dynamic_voltage_model and main_dispatch

main_dispatch.py is outdated, dynamic_voltage_model.py is a toy model not required for dispatch.

* delete parameters folder

* restore deleted files

* delete accidentally duplicated files

* update to PySAM 2.2.0

* Adding integrated dispatch optimization model, a new battery class using statefulBattery model (storage.py), and a example file to run hybrid with dispatch.  Updated requirements to include Pyomo dependency.  Battery financial model has not be fully integrated.

* Adding normalized price data

* Add ElectricityPrices as Resource and start hybrid_npv.py as optimization example

* modify error messages on ElectricityPrices

* start creating Layout classes

* modify error messages on ElectricityPrices

* Move wind layout functions to WindLayout class; all tests passing

* Updates to dispatch integration

-Added battery Outputs class to store stateful and dispatch outputs
-Added plotting tools for viewing dispatch output
-updated battery surface area calculation (will update again when pySAM updates
-integrated gird prices from site to dispatch

* Update dispatch.py

removed made up price schedule

* Move solar layout functions to SolarLayout class; all tests passing

* Added number of look-ahead periods to dispatch class. Removed numpy dependence in dispatch class.  General clean up.

* Move grid prices from SiteInfo into all the financial models & update examples

* start adding HybridLayout

* added storage kw and kwh getter and setter

* add HybridLayout into HybridSimulation; change cost calculator; rename classes in PowerSources; add tests

* fix tests in hybrid_layout.py

* start flicker addition to HybridLayout

* make inputs and outputs of PySAM models class properties; need to check tests

* nearest flicker map loaded; all tests passing and examples working

* Add flicker loss calculation to hybrid_layout.py

* Update hybrid_npv.py example with layout plotting

* Adds storage cost to CostCalculator

* added simulation clustering to dispatch simulation method

Defaults for clustering have not been vetted!

* Adds storage_installed_cost to total_installed_cost

* changes storage_size to storage_size_mw in cost_calculator

* minor updates formatting

* Fix expected value for test_calculate_installed_costs_per_mw

* Updates expected value for test_calculate_installed_costs

* Add ATBLookup - atb_lookup.py function to look up ATB costs from 2018 - 2050. Modifies create_cost_calculator to accomodate

* Adds test_calculate_installed_costs_per_mw_atb to test ATB functionality

* Updates expected result for test_run_hopp_calc

* Added floris as an option for wind modeling

* Refactoring Dispatch Optimization model

- Split dispatch model by technology
- Combine Pyomo Block to create hybrid dispatch
- Added dispatch tests for each technology
- Added hybrid test with dispatch
- NEED to remove old dispatch full integration
- NEED to implement detailed battery dispatch
- NEED to re-implement clustering

* Adding Detailed battery dispatch

Detailed battery dispatch is not fully integrated. Detailed battery dispatch test will fail.  Working to get non-linear problem to solve with Mindtpy.

* Clean up interface for custom modules

* Convert wind_source.py to use "value" for accessing system model variables

* Rename `get_variable` fxn in PowerSource to `value` similar to that of component models

* Allow timestepping with FLORIS model

* annual_energy_kw to annual_energy

* cleaned up a couple thing before dispatch refactoring

* Refactored battery dispatch types into different classes

- built HybridDispatchBuilderSolver to build and solve dispatch problem
- moved HybridDispatch class which now:
     - links ports and builds arcs between technology dispatch models
     - builds objective function based on variables provided by other dispatch models
- created a Dispatch base class
- created a PowerStorageDispatch class which provides a simple battery dispatch and could be used to model other storage devices
- removed some out dated project files
- created directories for dispatch models

* handle project life in HybridSimulation.simulate

* fix solar layout; rename initialization fx in hybrid layout

* update lifetime input handling for simulation

* Add new optimization classes for OptimizationProblem and OptimizationDriver (base and HOPP)

* add lifetime degradation property; add DOF check in test_dispatch.py and only simulate for 1 year

* move module_specs to class var & add test for battery's simulate_with_dispatch

* change Constraint rule functions from class methods to local functions

* break out hybrid_dispatch_options.py and make Dispatch class instantiation based on RE type more generalized

* reduce number of functions in hybrid_dispatch.py & keep dictionary of variables

* minor re-org in hybrid_dispatch.py and add DOF test

* Rename "solar" objects to "pv" & fix up tests

* some missed conversion from 'solar' to 'pv'

* Added sizing design problem

Additionally,
 - Fixed 1-year simulate() dispatch error for available generation
- Fixed recursion bug when setting battery capacity property

* Added Battery Simple Heuristic Dispatch

- fixed "is" compare
- moved is_test to dispatch options
- added idaes_pse to requirements

* adding heuristic to sizing optimization problem

* updates based on comments

- refactored storage class to battery
- reduced the number of rounded digits between tech models and dispatch from 6 to 4 (To reduce the number of round-off warnings from setting dispatch initial SOC)
- added some comments to dispatch options
- reverted lifecycle rule to a class function so the linear voltage dispatch model can override this method
- refactored simple dispatch heuristic

* Added one cycle battery dispatch heuristic

* update merging of FLORIS module

* use dictionary for battery tech specs

* add floris to requirements.txt

* added floris to requirements

- removed a TODO in heuristic

* Updated pySAM and fixed dispatch test

- reduced assert window to the first 24 periods of dispatch solution
- relaxed assert tolerance

* Update test_dispatch.py

- Compare dispatch power to stateful battery model power only if battery is not on the SOC limits.

* Fix high temps in battery simulation

* update requirements.txt

* update requirements.txt

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* remove degrees_of_freedom tests

* comment out where mindtpy_test.py not running

* update test_run_hopp_calc.py

* fix shapely version in requirements.txt

* update test_layout.py

* less precision in test_run_hopp_calc.py

* less precision in test_layout.py.py

* less precision in test_layout.py.py

* add json for inputs for costs & PV

* fixed lifecycle warning

* checking if test on GitHub is configured correctly

* checking dispatch available generation

* fix broken dispatch tests by fixing Pyomo version

* Update ci.yml

* Fix financial calculations and allow CAPEX to be defined in input dictionary

* update example with battery

* Add hybrid_size_grid.py for parametric exploration

* add path

* minor edit to error reporting

* updates for pysam v2.2.3

* minor edits to hybrid_size_grid

* turn off print statement

* om_replacement_cost1 for PySAM v2.2.2

* clean up files before merging

* fix paths

* Clean up old files & examples

* Updated scaling in plot_tools

* Clean up old files & examples

* add capacity payments

* remove setuptools_scm from requirements.txt

* fix tests

* add HOPP_examples to .gitignore

* update gitignore

* use absolute paths for examples

* update requirements.txt

* update financial model

* update analysis test results

* fix wind_resource.py to use PySAM converter

* add new financial outputs to hybrid simulation and update example

* fix typos

* Add grid charging to dispatch_options

* default construction financing cost multiplier to 0

* add more financial outputs

* add comments to financial outputs

* fix typo

* update test results

* update tests

* add new outputs for energy sales and purchases

* updates for hybrid simulation to be iterated with different sizes and layouts

* fix test_dispatch.py

* add time limit to dispatch solver

* Fix solar_resource data converter

* fix tests

* rename pv's degradation to dc_degradation

* allow assigning hybrid_plant inputs from dictionaries

* fix logging

* fix logging

* change exception to warning for hybrid_simulation's assign

* assign renamed to assign_fin_inputs and assign_tech_inputs

* minor edits to one_cycle_battery_dispatch_heuristic.py; test results show ~50% less energy revenue than optimized

* edit logging level for console reporting

* fix broken tests

* copy over replacements for battery to grid

* fix assign

* fix if battery statement

* add taxes to grid dispatch

* update test_run_hopp_calc.py expected results

* fix tests

* add financials test to test_hybrid.py

* fix test_reopt timeout reporting

* update pyomo requirement

* fix pv_layout when using Simple parameters

* reopt test fails but no error is returned, print warning

* update logging and error handling

* error handle when system_model has 0 capacity

* error handle when system_model has 0 capacity

* fix battery size = 0 while battery enabled

* add reporting to hybrid_simulation.py

* remove manual battery replacement in battery.py

* fix cf.hybrid calculation

* fix num iterations hybrid_npv.py

* pv_layout error catching

* fix broken tests

* fix pv_layout.py excess_buffer calculation

* modify error reporting for binary search fxns

* fix PV layout to use num_modules as design variable

* make hybrid, wind, and pv layout parameters size-agnostic

* replace exception of pv_layout failure with warning

* allow hybrid_size = 0

Co-authored-by: WHamilt2 <william.hamilton@nrel.gov>
Co-authored-by: Aaron Barker <barker59@gmail.com>
Co-authored-by: King <jennifer.king@nrel.gov>
Co-authored-by: William Hamilton <34353104+qualand@users.noreply.github.com>

* Improves verbosity of ValueError when getting developer key fails (#14)

* Increases verbosity of API value error in keys.py and provides better .env file guidance in Readme.md

* Adds set_nrel_key_dot_env() to site_info.py

* Fix setup.py (#15)

* fix files

* update README.md and keys.py

* Merge branch 'detail_example'

* removed glpk from requirements to fix install.py error

* update simulate_hybrid_wbattery_dispatch.py

* rename solar files in Docs to pv

* Readthedocs updates (#19)

* Update .readthedocs.yml

* add requirements-dev.txt

* update docs for flicker

* fix ReadTheDocs files

* fix _fix_dispatch_model_variables by adding (0, 1) bounds for soc

* Update ci.yml

* update expected_run_all_hybrid_calcs_result.csv

* Update ci.yml

* Update pysam (#17)

* update to pysam v 2.2.4

* fix some battery inputs for pysam v2.2.4

* fix om_expense outputs

* fix warning with log_name

* remove construction financing and add depreciation and debt

* fix test results

* update .gitignore

* fix battery financials for new version

* add battery replacement output

* remove taxes from grid_dispatch.py

* fix test results

* fix test results

* Update ci.yml

* fix test results

* fix test results

* fix test results

* modify solar PTC, add location from paper

* weight hybrid financials by production or cost ratio or evenly; add tax incentives output

* update tests

* fix tests

* add pv_charging_only to dispatch options for ITC qualification

* fix battery financial simulation to not run if 0 battery

* fix test results

* use power_sources for system_capacity_kw property

* rename solar files in Docs to pv

* add battery.rst

* update requirements-dev.txt

* update to pysam 3.0.0

* pvwattsv8 & O&M for battery

* O&M costs for hybrid with tests

* more tests for battery O&M variable cost

* production tax credits test

* fix tests

* fix accidental commit

* update test results

* Fixes csv.writer for Windows (#20)

* Fixes csv.writer for Windows: https://stackoverflow.com/questions/3191528

* Moving to vscode_debug branch

* Fix csv.writer for Windows compatibility

* Merge Attempt

* Update ci.yml

* Merge

* update tests

* fix cost_calculator

* set default dc_degradation

* set default log name for dispatch

* fix reopt test

* fix test_reopt.py

* update test_hybrid.py

* fix cost_calculator

* fix all tests

* Merge ino merge_H2

* update test_run_hopp_calc

* update test_results

* update test_result

Co-authored-by: dguittet <dguittet@nrel.gov>
Co-authored-by: Michael Rossol <18647211+MRossol@users.noreply.github.com>
Co-authored-by: WHamilt2 <william.hamilton@nrel.gov>
Co-authored-by: King <jennifer.king@nrel.gov>
Co-authored-by: William Hamilton <34353104+qualand@users.noreply.github.com>
Co-authored-by: Matthew Boyd <mr.matthew.boyd@gmail.com>
Co-authored-by: Jonathan Martin <94018654+jmartin4nrel@users.noreply.github.com>

* Update paths in run_reopt.py and h2_main.py

* Complete dev_merge -> feature/add_tests_h2_main and fix run issues. N.B. test_h2_main not passing (wrong lcoh)

* Rename H2 Analysis to H2_Analysis. NB test_h2_main.py still not passing

* merges in dev_merge changes including lifetime simulation adjustment

* test_h2_main.py running

* copy H2_Analysis into H2 Analysis

* rename folder

* clean up

* Add docstrings to hopp_for_h2.py. Removes H2 Analysis folder (H2_Analysis remains)

* Revert "Add docstrings to hopp_for_h2.py. Removes H2 Analysis folder (H2_Analysis remains)"

This reverts commit a3b2c87e5ccbdb9895c5eabf879f1b2b7c225d0a, reversing
changes made to c5b1adf396340e3a31efcf300289ca41e03800b3.

* fix merge

* revert merge conflicts

* delete unneeded import

* Updates merge conflicts in h2_main and hopp_for_h2

* Removes uneccessary analysis files and csv results

Co-authored-by: dguittet <dguittet@nrel.gov>
Co-authored-by: Michael Rossol <18647211+MRossol@users.noreply.github.com>
Co-authored-by: WHamilt2 <william.hamilton@nrel.gov>
Co-authored-by: King <jennifer.king@nrel.gov>
Co-authored-by: William Hamilton <34353104+qualand@users.noreply.github.com>
Co-authored-by: Matthew Boyd <mr.matthew.boyd@gmail.com>
Co-authored-by: Jonathan Martin <94018654+jmartin4nrel@users.noreply.github.com>

* delete Powerflow Analysis folder

* clean up files

* pull in test_hopp_for_h2.py

* delete tools/powerflow

* revert version upgrade of pysam

* Removes older LCOH calculation methods from h2_main and updates tests

* revert bos_lookup changes for now

* fix test_dispatch

* fix flicker tests

* update test_hopp_for_h2

* fix test_reopt

* fix test_hybrid_with_storage_dispatch

* update test_hybrid & test_dispatch

* update test

* fix battery financial calcs

* add resource files for test_h2_main

* update test_run_hopp_calc

* make tests use static weather files in repo

* relax tolerance test_hybrid_om_costs

* test_run_hopp_calc

* fix FLORIS custom_module

* fix resource files for test_layout

* change test_hybrid_layout

* fix typing

* Updates to integrate FLORIS v3 (#32)

* updating custom_wind_module for floris_v3

* Update requirements.txt

Co-authored-by: Darice L Guittet <darice.guittet@nrel.gov>

* fix custom_wind_module

* add error message to custom_module for incorrect floris version

* floris version error check

* Merge h2 csp (#31)

* fix some battery inputs for pysam v2.2.4

* fix om_expense outputs

* More clustering updates: Limiting price outliers, updating collection of csp results in arrays

* fix warning with log_name

* remove construction financing and add depreciation and debt

* fix test results

* Changing default inputs for storage incentive and time weighting factor

* Adding initial charge state heursitics to clustering

* Adding separate wind resource data streams for solar/wind technologies in clustering

* Integrating clustering into hybrid simulations

* Updating CSP performance models to use price from site

* Cleaning up unused functions in clustering

* Updating default battery initial state in clustering

* Reverting back to single performance/financial simulation for pv/wind

* Reverting back to single performance/financial simulation for grid

* added cbc solver

Linux and OSx need to conda-forge coincbc.
Windows need the executable for CBC (can be found on AMPL website).

* updated annual energy to kwh

Updated test values for troughs

* update to get_cp_htf

added is_tes for trough system with different TES and field fluids

* Updating 'daylight' hours in clustering to use a clearsky DNI cutoff instead of sunrise/sunset

* Removing clustering file output for debugging

* update csp dispatch cost parameters

* csv cache

added code to write cache file to csv files

* clean up result files

* clean up more result files

* Updated hybrid_outputs function to include save to file option

* Fixing minor bug in price profile used for csp

* Adding optional user-defined timeout limit for cbc solver

* Fixing bug in user-defined clustering weights

* set up ssc to run once at the beginning of simulation to get cycle efficiency tables and forecast thermal energy generation

- moved set_weather() call to csp_source class init to remove it being call for both tower and trough
- increased cbc time limit from 10 to 20 seconds to be consistent with GLPK
- updated test expected values
       - csp dispatch objectives change due to previous commit changing default objective cost parameters
       - trough outputs change due to updated ssc model's predictions on thermal energy generation for dispatch

* added back hybrid_outputs and rename updated function to hybrid_simulation_outputs

This was done due to hybrid_outputs is being used by test_run_hopp_calc.py and it would require a bit of work to use the updated function.

* added a solver_options input to dispatch options

* fixed poor default value for solver operations which causes test to fail

* update .gitignore

* fix battery financials for new version

* add battery replacement output

* fixing test_tower_with_dispatch_model test

- test was failing due to field optimization returning slightly different results on Linux compared to Windows
- removed unnecessary initialize_params tower specific method

* remove taxes from grid_dispatch.py

* fix test results

* fix test results

* adding fix to allow simulate to be called multiple times

* adding cbc solver for windows systems

* adding is_dispatch_targets boolean to trough defaults

* Update ci.yml

* fix test results

* Remove tower outputs from optimization problem output

* fix test results

* fix test results

* Updating csp initial states for simulations using clustering

* Adding initial charge state for battery with clustering

* modify solar PTC, add location from paper

* weight hybrid financials by production or cost ratio or evenly; add tax incentives output

* update tests

* fix tests

* add pv_charging_only to dispatch options for ITC qualification

* fix battery financial simulation to not run if 0 battery

* fix test results

* use power_sources for system_capacity_kw property

* rename solar files in Docs to pv

* add battery.rst

* updated dispatch models to not pass cost of generation through ports

This is done by directly calling specific model parameters in the building of the hybrid objective.

* Update ci.yml

* Update alt_dev docs

* Initialize new branch with basic running simulation

* Updating default weights for clustering for CSP, CSP-PV and CSP-PV-Battery cases

* Scaling heliostat size and startup/tracking power to capacity

* Adding optional tube size scaling with capacity in csp tower model

* Add capacity credit calculations for each submodel

* Add capacity payment calculation for entire hybrid system

* update caching and output

* adding tes tank heater and tank height scale

-heater power is scaled linearly based on defaults
-tank height is scale to maintain constant aspect ratio (h/d) of the active tank space which does not include min tank level

* updated capacity credit to work for both trough and tower

- hacked PV system_capacity_kw to represent AC power and not DC power

* fixed tests

* added sim option to calculate capacity credit with and without available storage

* added capacity hour array to site info class

* updates to CSP PV case study

set up capacity payments
set up variables to sample across

* update driver exception handling

* Remove cache_file references

* Add gurobi option for dispatch solver

* jupyter stubs

* Update run_alt.py

* updates to capacity payment script

- update to 'hybrid_simulation_outputs()' for capacity credit
- moved simulate() and calc_capacity_credit_precent() up in power_source

* fixed capacity credit calculation

- warning caused by dividing a length of zero

* Update simple_CSP_PV_simulate.py

* fixing boolean for using storage in capacity credit calculation

* Add opt_problem options

* bug fixes

* capacity credit based on gross power

-fixed system_pre_curtailment_kwac in power source that ended up being 8760*project_life*project_life

* updated bool for capacity credit

* Update simple_CSP_PV_simulate.py

* fixed hybrid simulation output function to include hybrid outputs

-fixed grid capacity_factoer_curtailment_ac property

* server changes to case study sript

* Add candidate to cache entry

* Added BCR breakdown printout

* updated grid capacity credit to use interconnect limit for capacity payments

* Minor updates to capacity credit calculations

* added tower receiver cost scale based on thermal rating

* added tes_capacity property

* fixed bug with calculation of capacity-based O&M

- caused by setting grid system_capcity_kw to interconnect limit
- updated hybrid capacity credit to be compatible with hybrid capacity and not interconnect limit. updates after simulate for reporting

* added 2030 SETO targets

* More capacity payment updates to fix CSP vs hybrid inconsistencies

* Fixing bugs in battery financials created by last commit

* updated simulate script, capacity payment amount, and SETO targets for tower and receiver ref. cost.

* updated tests

* updated financial parameters and SETO targets

* fixing battery replacement cost inputs

-required to set batt_computed_bank_capacity within simulate_financials() for the battery

* setting battery power based on cycle power

* reformulation of grid dispatch model

- Reformulated grid dispatch model to allow for both generation and load transmission limits
- Removed constraints used to calculate terms in the objective (now calculating directly in the objective)
- Updated sales and purchases property calls to do the calculation when getting values

* added desired schedule option to dispatch model

System can only dispatch during a desired schedule provided by the user within SiteInfo

* fixed battery dispatch maximum power

-updated battery lifecycle cost based on SAM values
-updated capacity_price property
-updated dispatch tests based on new battery lifecycle cost

* post analysis updates

* updating dispatch default solver to cbc

* adding a dispatch test for setting a desired schedule for the system

-added a check on the schedule has to be less than the transmission limit

* updating grid dispatch model

- this updated formulation enables faster solution times  with the open-source solvers compared to the replaced formulation

* adding csp, pv, battery dispatch plotting tool

this should be integrated more closely with hybrid simulation class

* adding tower and trough to RTD

* fixed tests

* Update parallel optimize convention

* updated csp dispatch model

-added constraint on TES for periods when the cycle is operating and the receiver is starting up to ensure SSC doesn't 'trip' due to insufficient TES inventory
-added constraint to cycle thermal during periods of cycle start-up to derate cycle power during periods of start-up. This is to disincentivize cycle starting up during periods of high value.

* started xpress solver for HOPP

- waiting on license for testing

* fixing tests

* Update locations.py

* updates to battery dispatch

-added lifecycle cost to objective function
-reduced default round-trip efficiency in dispatch model
-reduced default lifecycle cost based on SAM output

* Xpress solver is working with HOPP

-Requires Xpress install based on: https://github.nrel.gov/dkrishna/fico-xpress
-Requires Xpress Python bindings:
pip install "xpress<8.13"

* fixed CSP-only and hybrid model to align

-set constuction financing costs to zero (consistent with other technologies
-set hybrid capacity based on CSP cycle net

* Update hybrid_dispatch_builder_solver.py

* added Xpress persistent solver interface

This interface provides a small improve compared to the 'xpress' interface.

* fixed CSP curtailment issue

* minor changes to CSP-PV example script

* removed tower receiver cost per kWt

This does not work type of cost scaling does not work with SolarPILOT's optimization.

* updated write_cache to allow partial functions

for problem setup, simulation setup, and evaluate objective.

* updated solar resource to allow for relative humidity

* Commented out dispatchable power constraint

Future work: generalize a method to pass in constraints and call them during optimization iterations

* added minimize operating cost objective

used for with a desired schedule is provided

* added some outputs for desired schedule analysis

* fixing LCOE reporting units

* added desired schedule to result of optimization problem

* adding a method to set CSP dispatch objective costs

* fixed missed load calculation

added npv_annual_costs to result outputs

* added missed load and schedule curtailment to outputs

* fixed annual costs outputs

* update desired schedule dispatch

incentivized battery charging and TES charging to always charge if possible to meet schedule

* making lifecycle cost mutable

This value can now be changed between hybrid simulation initialization and simulation.

* updated dispatch plotting to test desired schedule

* Patching trough model dispatch

SSC trough model will sometimes hang when setting pc thermal max to the target value

* updated daotk ssc library

- this fixes the trough case where SSC will hang
- Need to update libraries for other OS

* Reporting missed load and schedule curtailed as percentage

* Updated code documentation

- Removed unnecessary tower and trough default files
- Trough model now calculates installed cost based on SSC inputs, rather than default file
- Added a default dispatch factors files in grid resource files

* updated tests

* Delete mindtpy_test.py

Test was not useful and not needed

* fixed path for default electricity prices file

* Updated electricity test prices path for tests

* Update test_hybrid.py

* update release notes

* update to plotting tool and CSP-PV example

* Update version.py

* added CBC solver to package data

* Fixing calculations with clustering to work with recent commits, and to fill in annual data arrays needed for capacity credit calculations

* Update csp_pv_battery_plot.py

* update requirements-dev.txt

* update requirements-dev.txt

* dlib comment out from requirements.txt

* update requirements-dev.txt

* update requirements-dev.txt

* fix indenting

* fixing documentation warnings

* adding launch.json to gitignore list

* added site info documentation

* added site info attributes to docstring

* updated calc_capacity_credit_percent to use class attrs

* updated hybrid_simulation

-annual_energy_kw to kwh
-moved tower and battery initialization

* added no_solar to site to skip solar resource download

similar to no_wind

* added nominalized grid pricing files

* updated default grid prices to singleowner default

* updated hybrid simulation

cleaned up code due to merge
removed repeated financial model code

* updated battery dispatch costs

these should be accessible and mutable.
previously, these were linked to variable cost which the default value changed in pySAM 3.0.0

* updated dispatch tests

-PV generation changed slightly due to pySAM 3
-Battery dispatch results changed due to operating cost change
-Removed 'grid' as input to HybridSimulation
-ppa_price added to some test because default prices are now relative (normalized)

* clean up of dispatch builder and solver

-removed most of duplicate code

* Update test_csp.py

- update due to default grid prices in HOPP changing to the default singleowner normalized schedule.

* cleaning up system model set up

-moved tech specific setup to an overload function called "setup_performance_model" within power_source this is required for the CSP and battery models .
-removed zero testing when technology is not within the hybrid system

* cleaned up hybrid simulation

- added methods documentation
- created a function for grid simulation
- moved dispatch if statement into simulate_power of the dispatch builder solver class
- removed duplicated code in simulate functions

* Merge changes from merge_H2

* Add clustering tests and fix small clustering bug

* Update test_hybrid.py

removed 'grid' in technologies dictionary

* updating CSP tests to used fixed weather file

updated weather files used by H2 tests to include pressure and dew point to be CSP compatible

* updated hybrid tests

csp, om, and tax tests. test_wind_pv_with_storage_dispatch is still failing and requires a deeper dive

* removed duplicate simulate function in power source

* Update test_hybrid.py

Test values changed because of the following:
- PySAM update (pv and wind generation)
- Battery / Grid dispatch updates (battery generation)
- Default TOD factors changed (NPV, Rev)

* Fix wind resource parameter test

* renamed daggett_ca weather file

-removed daggett_ca from weather file to be consistent with API and enable resource_loader_files.py not to fail
-removed Rice data files to ensure resource_loader_files.py doesn't fail

* Update solar_resource.py

Changed pressure to an optional input. However, pressure is required for CSP models

* Updated H2 tests

Test values updated for the following reasons:
- PV model produces slightly different results when weather file contains pressure and dew point temperature
- Default TOD are different causing system revenue and NPV to change

* Fix wind file reader

* Add more clustering weights and divisions tests

* Fix equivalency warning

* Make test_annual_array_from_cluster_exemplars more robust

* Add clustering tests that compare to true values

* Add pysam-stubs to requirements file

* Merge branch merge_H2

* fix test_run_hopp_calc for modified solar resource file

* moved hopp_for_h2_test_results.csv

- test_all_hybrid_calcs was deleting result folder and expected results for test_hopp_for_h2
- set flicker_mismatch run_parallel to skip for now

* Adding back flicker mismatch tests

* Revert "Adding back flicker mismatch tests"

This reverts commit 4a7243a.

* adding data file for clustering tests

* Revert "fix test_run_hopp_calc for modified solar resource file"

This reverts commit f20930e.

* Update test_clustering.py

day_of_year attr not supported on python 3.6

* turn on test_single_turbine

* turn on test_single_turbine_multiple_angles

* test_flicker_mismatch

* skip flicker tests if win

* add reason to skipif

* update test_flicker_mismatch

Co-authored-by: jannamartinek <janna.martinek@nrel.gov>
Co-authored-by: WHamilt2 <william.hamilton@nrel.gov>
Co-authored-by: jlcox119 <50842233+jlcox119@users.noreply.github.com>
Co-authored-by: Matthew Boyd <mr.matthew.boyd@gmail.com>
Co-authored-by: William Hamilton <34353104+qualand@users.noreply.github.com>
Co-authored-by: Hamilton <WHamilt2@nrel.gov>

Co-authored-by: Aaron Barker <barker59@gmail.com>
Co-authored-by: King <jennifer.king@nrel.gov>
Co-authored-by: Bhaskar <parangat.bhaskar@nrel.gov>
Co-authored-by: PJ Stanley <astanley@nrel.gov>
Co-authored-by: PJ Stanley <stanley_andrewpj@yahoo.com>
Co-authored-by: jmartin4nrel <jonathan.martin@nrel.gov>
Co-authored-by: bayc <christopher.j.bay@gmail.com>
Co-authored-by: Michael Rossol <18647211+MRossol@users.noreply.github.com>
Co-authored-by: WHamilt2 <william.hamilton@nrel.gov>
Co-authored-by: William Hamilton <34353104+qualand@users.noreply.github.com>
Co-authored-by: Matthew Boyd <mr.matthew.boyd@gmail.com>
Co-authored-by: Jonathan Martin <94018654+jmartin4nrel@users.noreply.github.com>
Co-authored-by: jannamartinek <janna.martinek@nrel.gov>
Co-authored-by: jlcox119 <50842233+jlcox119@users.noreply.github.com>
Co-authored-by: Hamilton <WHamilt2@nrel.gov>
kbrunik added a commit that referenced this pull request Dec 8, 2022
Update feature/green_steel_ammonia branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hybrid Depreciation and Taxes Not Copied over
2 participants