Skip to content

Commit

Permalink
add docs for Hybrids
Browse files Browse the repository at this point in the history
  • Loading branch information
dguittet committed Mar 27, 2024
1 parent 98b7e91 commit eed4509
Show file tree
Hide file tree
Showing 24 changed files with 1,213 additions and 27 deletions.
7 changes: 7 additions & 0 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
Fix for horizontal stacking weirdness in the RTD theme with Python properties:
https://github.com/readthedocs/sphinx_rtd_theme/issues/1301
*/
.py.property {
display: block !important;
}
4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,7 @@
}

html_sidebars = { '**': [ 'about.html', 'navigation.html', 'searchbox.html' ]}

html_static_path = ['_static']

html_css_files = ["custom.css"]
104 changes: 104 additions & 0 deletions docs/hybrids.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
Hybrid Systems
==============

Hybrid Systems are simulated in PySAM using the :mod:`PySAM.Hybrids.HybridGenerator` and :mod:`PySAM.Hybrids.HybridSystem` classes.


:mod:`HybridGenerator<PySAM.Hybrids.HybridGenerator>` is the base class for all subsystem technologies (e.g. PV, wind, battery).
This class wraps the PySAM module for the subsystem technology (e.g. PVWattsv8 or Pvsamv1, Windpower, and Battery) to provide access for the input and output data.


:mod:`HybridSystem<PySAM.Hybrids.HybridSystem>` is the class that contains and organizes all the subsystem technologies and financial models for simulation.
The simulation is executed by :mod:`PySAM.Hybrid.Hybrid`.

.. toctree::
:maxdepth: 1

hybrids/HybridGenerator.rst
hybrids/HybridSystem.rst

Available technologies
--------------------------------

Currently only the following technologies are enabled for simulation as part of a hybrid system::

HybridSystem.pv = PVHybrid (PySAM.Pvsamv1)
HybridSystem.pvwatts = PVWattsHybrid (PySAM.Pvwattsv8)
HybridSystem.wind = WindHybrid (PySAM.Windpower)
HybridSystem.gensys = GenericSystemHybrid (PySAM.GenericSystem)
HybridSystem.battery = BatteryHybrid (PySAM.Battery)
HybridSystem.fuelcell = FuelCellHybrid (PySAM.Fuelcell)
HybridSystem._grid = PySAM.Grid
HybridSystem.singleowner = PySAM.Singleowner
HybridSystem.utilityrate5 = PySAM.Utilityrate5
HybridSystem.host_developer = PySAM.HostDeveloper

.. toctree::
:maxdepth: 1

hybrids/BatteryHybrid.rst
hybrids/FuelCellHybrid.rst
hybrids/GenericSystemHybrid.rst
hybrids/PVHybrid.rst
hybrids/PVWattsHybrid.rst
hybrids/WindHybrid.rst

Accessing and setting variables
--------------------------------

Each of the subsystem classes contains a PySAM module whose data can be accessed directly from the class.

For instance, for a hybrid system with PVWatts, Wind, Battery and SingleOwner, the input and output data can be accessed in the following ways::

import PySAM.Battery as Battery
import PySAM.Windpower as Windpower
import PySAM.Pvwattsv8 as Pvwattsv8

m = HybridSystem([Pvwattsv8, Windpower, Battery], 'singleowner')

# set directly
m.pvwatts.SolarResource.solar_resource_file = filename
m.wind.Resource.wind_resource_filename = wind_filename

# set using `value`
m.pv.value("solar_resource_file", filename)

# set using `assign`
resource_file_dict = {
"pvwattsv8": {"SolarResource": {"solar_resource_file": filename} },
"windpower": {"Resource": {"wind_resource_filename": wind_filename} }
}
m.assign(resource_file_dict)


Creating models
-----------------


Starting from GUI
~~~~~~~~~~~~~~~~~

Use the :ref:`SAM Code Generator <sam_code_generator>` to generate inputs via the "JSON for inputs" option.

Then load the inputs via :mod:`assign<PySAM.Hybrids.HybridSystem.HybridSystem.assign>`::

inputs_file = test_dir / "PVWatts Wind Battery Hybrid_Single Owner.json"
with open(inputs_file, "r") as f:
inputs = json.load(f)['input']

m = HybridSystem([Pvwattsv8, Windpower, Battery], 'singleowner')
m.new()
unassigned = m.assign(inputs)


Using defaults
~~~~~~~~~~~~~~~

Available default configurations are listed in the documentation for :mod:`default<PySAM.Hybrids.HybridSystem.HybridSystem.default>`

.. code:: python
import PySAM.Pvsamv1 as Pvsamv1
m = HybridSystem([Pvsamv1, Windpower, Battery], 'singleowner')
m.default("PhotovoltaicWindBatteryHybridSingleOwner")
160 changes: 160 additions & 0 deletions docs/hybrids/BatteryHybrid.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
.. _BatteryHybrid:

BatteryHybrid
=============

.. py:class:: PySAM.Hybrids.BatteryHybrid.BatteryHybrid()
Class that adds :mod:`PySAM.Battery.Battery` to :mod:`PySAM.Hybrids.HybridSystem.HybridSystem`

.. py:function:: new() -> BatteryHybrid
.. py:function:: default(config) -> BatteryHybrid
Load defaults for the configuration config. Available configurations:

"GenericPVWattsWindFuelCellBatteryHybridHostDeveloper"

"GenericPVWattsWindFuelCellBatteryHybridSingleOwner"

"PVWattsWindBatteryHybridHostDeveloper"

"PVWattsWindBatteryHybridSingleOwner"

"PVWattsWindFuelCellBatteryHybridHostDeveloper"

"PVWattsWindFuelCellBatteryHybridSingleOwner"

"PhotovoltaicWindBatteryHybridHostDeveloper"

"PhotovoltaicWindBatteryHybridSingleOwner"

.. py:function:: value(name, value=None) -> None | float | dict | sequence | str
Get or set by name a value in any of the variable groups.

.. py:function:: assign(input_dict) -> dict
Assign attributes from nested dictionary, except for Outputs::

nested_dict = { 'BatterySystem': { 'batt_ac_dc_efficiency': val, ...}, ...}

Returns list of variables that weren't assigned

.. py:function:: export() -> dict
Export attributes into nested dictionary

.. py:property:: total_installed_cost
Total installed cost for technology [$]

:type: float

.. py:property:: om_fixed
Fixed O&M annual amount [$/year]

:type: sequence

.. py:property:: om_fixed_escal
Fixed O&M escalation [%/year]

:type: float

.. py:property:: om_production
Production-based O&M amount [$/MWh]

:type: sequence

.. py:property:: om_production_escal
Production-based O&M escalation [%/year]

:type: float

.. py:property:: om_capacity
Capacity-based O&M amount [$/kWcap]

:type: sequence

.. py:property:: om_capacity_escal
Capacity-based O&M escalation [%/year]

:type: float

.. py:property:: degradation
Annual AC degradation [%]. If not provided, defaults to [0]

:type: sequence

.. py:class:: Simulation
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.Simulation`

.. py:class:: Lifetime
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.Lifetime`

.. py:class:: BatterySystem
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.BatterySystem`

.. py:class:: SystemOutput
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.SystemOutput`

.. py:class:: Load
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.Load`

.. py:class:: BatteryCell
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.BatteryCell`

.. py:class:: Inverter
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.Inverter`

.. py:class:: BatteryDispatch
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.BatteryDispatch`

.. py:class:: Losses
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.Losses`

.. py:class:: SystemCosts
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.SystemCosts`

.. py:class:: FuelCell
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.FuelCell`

.. py:class:: PriceSignal
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.PriceSignal`

.. py:class:: Revenue
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.Revenue`

.. py:class:: ElectricityRates
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.ElectricityRates`

.. py:class:: GridLimits
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.GridLimits`

.. py:class:: Outputs
See :mod:`PySAM.BatteryHybrid.BatteryHybrid.Outputs`

.. py:function:: Reopt_size_standalone_battery_post
106 changes: 106 additions & 0 deletions docs/hybrids/FuelCellHybrid.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
.. _FuelCellHybrid:

FuelCellHybrid
==============

.. py:class:: PySAM.Hybrids.FuelCellHybrid.FuelCellHybrid()
Class that adds :mod:`PySAM.FuelCell.FuelCell` to :mod:`PySAM.Hybrids.HybridSystem.HybridSystem`

.. py:function:: new() -> FuelCellHybrid
.. py:function:: default(config) -> FuelCellHybrid
Load defaults for the configuration config. Available configurations:

"GenericPVWattsWindFuelCellBatteryHybridHostDeveloper"

"GenericPVWattsWindFuelCellBatteryHybridSingleOwner"

"PVWattsWindFuelCellBatteryHybridHostDeveloper"

"PVWattsWindFuelCellBatteryHybridSingleOwner"

.. py:function:: value(name, value=None) -> None | float | dict | sequence | str
Get or set by name a value in any of the variable groups.

.. py:function:: assign(input_dict) -> dict
Assign attributes from nested dictionary, except for Outputs::

nested_dict = { 'FuelCell': { 'fuelcell_efficiency': val, ...}, ...}

Returns list of variables that weren't assigned

.. py:function:: export() -> dict
Export attributes into nested dictionary

.. py:property:: total_installed_cost
Total installed cost for technology [$]

:type: float

.. py:property:: om_fixed
Fixed O&M annual amount [$/year]

:type: sequence

.. py:property:: om_fixed_escal
Fixed O&M escalation [%/year]

:type: float

.. py:property:: om_production
Production-based O&M amount [$/MWh]

:type: sequence

.. py:property:: om_production_escal
Production-based O&M escalation [%/year]

:type: float

.. py:property:: om_capacity
Capacity-based O&M amount [$/kWcap]

:type: sequence

.. py:property:: om_capacity_escal
Capacity-based O&M escalation [%/year]

:type: float

.. py:property:: degradation
Annual AC degradation [%]. If not provided, defaults to [0]

:type: sequence

.. py:class:: Common
See :mod:`PySAM.FuelCellHybrid.FuelCellHybrid.Common`

.. py:class:: Lifetime
See :mod:`PySAM.FuelCellHybrid.FuelCellHybrid.Lifetime`

.. py:class:: Load
See :mod:`PySAM.FuelCellHybrid.FuelCellHybrid.Load`

.. py:class:: FuelCell
See :mod:`PySAM.FuelCellHybrid.FuelCellHybrid.FuelCell`

.. py:class:: Outputs
See :mod:`PySAM.FuelCellHybrid.FuelCellHybrid.Outputs`
Loading

0 comments on commit eed4509

Please sign in to comment.