Skip to content

Commit

Permalink
Merge pull request #305 from bayc/feature/refactor_hopp_solver
Browse files Browse the repository at this point in the history
Refactor hopp solver
  • Loading branch information
bayc committed Apr 22, 2024
2 parents 3fe5d2b + b63c22c commit 55b39dd
Show file tree
Hide file tree
Showing 43 changed files with 4,369 additions and 1,769 deletions.
50 changes: 50 additions & 0 deletions docs/hopp/simulation/technologies/dispatch.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.. _Dispatch:

Dispatch Strategies
===================

These are the dispatch strategies that may be used for a standard HOPP simulation. Dispatch
settings can be defined through :class:`.HybridDispatchOptions`.

Storage Dispatch
----------------

.. toctree::
:maxdepth: 1

dispatch/power_storage/simple_battery_dispatch.rst
dispatch/power_storage/simple_battery_dispatch_heuristic.rst
dispatch/power_storage/heuristic_load_following_dispatch.rst
dispatch/power_storage/linear_voltage_convex_battery_dispatch.rst
dispatch/power_storage/linear_voltage_nonconvex_battery_dispatch.rst
dispatch/power_storage/one_cycle_battery_dispatch_heuristic.rst

The above dispatch classes inherit from the :py:class:`.PowerStorageDispatch` class.

.. toctree::
:maxdepth: 1

dispatch/power_storage/power_storage_dispatch.rst

Technology Dispatch
-------------------

Dispatch classes are made for each technology where their specific components of the objectives,
their parameters, and other technology specific dispatch properties are defined.

.. toctree::
:maxdepth: 1

dispatch/power_sources/pv_dispatch.rst
dispatch/power_sources/wind_dispatch.rst
dispatch/power_sources/wave_dispatch.rst
dispatch/power_sources/trough_dispatch.rst
dispatch/power_sources/tower_dispatch.rst
dispatch/power_sources/csp_dispatch.rst

The above technology classes inherit from the :py:class:`.PowerSourceDispatch` class.

.. toctree::
:maxdepth: 1

dispatch/power_sources/power_source_dispatch.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _CSPDispatch:


CSP Dispatch
============

.. toctree::

.. autoclass:: hopp.simulation.technologies.dispatch.power_sources.csp_dispatch.CspDispatch
:members:
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
:orphan:

.. _PowerSourceDispatch:


PowerSourceDispatch: Abstract Class
===================================

Base dispatch class for power source models
Power Source Dispatch
=====================

.. toctree::


.. autoclass:: hopp.simulation.technologies.dispatch.power_sources.power_source_dispatch.PowerSourceDispatch
:members:
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _PVDispatch:


PV Dispatch
===========

.. toctree::

.. autoclass:: hopp.simulation.technologies.dispatch.power_sources.pv_dispatch.PvDispatch
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _TowerDispatch:


Tower Dispatch
==============

.. toctree::

.. autoclass:: hopp.simulation.technologies.dispatch.power_sources.tower_dispatch.TowerDispatch
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _TroughDispatch:


Trough Dispatch
===============

.. toctree::

.. autoclass:: hopp.simulation.technologies.dispatch.power_sources.trough_dispatch.TroughDispatch
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _WaveDispatch:


Wave Dispatch
=============

.. toctree::

.. autoclass:: hopp.simulation.technologies.dispatch.power_sources.wave_dispatch.WaveDispatch
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _WindDispatch:


Wind Dispatch
=============

.. toctree::

.. autoclass:: hopp.simulation.technologies.dispatch.power_sources.wind_dispatch.WindDispatch
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _HeuristicLoadFollowingDispatch:


Heuristic Load Following Dispatch
=================================

.. toctree::

.. autoclass:: hopp.simulation.technologies.dispatch.power_storage.heuristic_load_following_dispatch.HeuristicLoadFollowingDispatch
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _ConvexLinearVoltageBatteryDispatch:


Convex Linear Voltage Battery Dispatch
======================================

.. toctree::

.. autoclass:: hopp.simulation.technologies.dispatch.power_storage.linear_voltage_convex_battery_dispatch.ConvexLinearVoltageBatteryDispatch
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _NonConvexLinearVoltageBatteryDispatch:


Non-Convex Linear Voltage Battery Dispatch
==========================================

.. toctree::

.. autoclass:: hopp.simulation.technologies.dispatch.power_storage.linear_voltage_nonconvex_battery_dispatch.NonConvexLinearVoltageBatteryDispatch
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _OneCycleBatteryDispatchHeuristic:


One Cycle Battery Dispatch Heuristic
====================================

.. toctree::

.. autoclass:: hopp.simulation.technologies.dispatch.power_storage.one_cycle_battery_dispatch_heuristic.OneCycleBatteryDispatchHeuristic
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _PowerStorageDispatch:


Power Storage Dispatch
======================

.. toctree::

.. autoclass:: hopp.simulation.technologies.dispatch.power_storage.power_storage_dispatch.PowerStorageDispatch
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _SimpleBatteryDispatch:


Simple Battery Dispatch
=======================

.. toctree::

.. autoclass:: hopp.simulation.technologies.dispatch.power_storage.simple_battery_dispatch.SimpleBatteryDispatch
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. _SimpleBatteryDispatchHeuristic:


Simple Battery Dispatch Heuristic
=================================

.. toctree::

.. autoclass:: hopp.simulation.technologies.dispatch.power_storage.simple_battery_dispatch_heuristic.SimpleBatteryDispatchHeuristic
:members:
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Welcome to HOPP's documentation!
hopp/simulation/hopp_interface.rst
hopp/simulation/technologies/sites/site_info.rst
hopp/simulation/technologies/technologies.rst

hopp/simulation/technologies/dispatch.rst

.. toctree::
:maxdepth: 1
Expand Down
28 changes: 21 additions & 7 deletions hopp/simulation/technologies/dispatch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
from hopp.simulation.technologies.dispatch.power_sources.pv_dispatch import PvDispatch
from hopp.simulation.technologies.dispatch.power_sources.wind_dispatch import WindDispatch
from hopp.simulation.technologies.dispatch.power_sources.wind_dispatch import (
WindDispatch,
)
from hopp.simulation.technologies.dispatch.power_sources.csp_dispatch import CspDispatch
from hopp.simulation.technologies.dispatch.power_sources.trough_dispatch import TroughDispatch
from hopp.simulation.technologies.dispatch.power_sources.tower_dispatch import TowerDispatch
from hopp.simulation.technologies.dispatch.power_sources.wave_dispatch import WaveDispatch
from hopp.simulation.technologies.dispatch.power_sources.trough_dispatch import (
TroughDispatch,
)
from hopp.simulation.technologies.dispatch.power_sources.tower_dispatch import (
TowerDispatch,
)
from hopp.simulation.technologies.dispatch.power_sources.wave_dispatch import (
WaveDispatch,
)

from hopp.simulation.technologies.dispatch.grid_dispatch import GridDispatch
from hopp.simulation.technologies.dispatch.hybrid_dispatch_options import HybridDispatchOptions
from hopp.simulation.technologies.dispatch.hybrid_dispatch_options import (
HybridDispatchOptions,
)
from hopp.simulation.technologies.dispatch.hybrid_dispatch import HybridDispatch
from hopp.simulation.technologies.dispatch.dispatch_problem_state import DispatchProblemState
from hopp.simulation.technologies.dispatch.power_storage.simple_battery_dispatch import SimpleBatteryDispatch
from hopp.simulation.technologies.dispatch.dispatch_problem_state import (
DispatchProblemState,
)
from hopp.simulation.technologies.dispatch.power_storage.simple_battery_dispatch import (
SimpleBatteryDispatch,
)
34 changes: 22 additions & 12 deletions hopp/simulation/technologies/dispatch/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@
try:
u.USD
except AttributeError:
u.load_definitions_from_strings(['USD = [currency]', 'lifecycle = [energy] / [energy]'])
u.load_definitions_from_strings(
["USD = [currency]", "lifecycle = [energy] / [energy]"]
)


class Dispatch:
"""
""" """

"""
def __init__(self,
pyomo_model: pyomo.ConcreteModel,
index_set: pyomo.Set,
system_model,
financial_model,
block_set_name: str = 'dispatch'):
def __init__(
self,
pyomo_model: pyomo.ConcreteModel,
index_set: pyomo.Set,
system_model,
financial_model,
block_set_name: str = "dispatch",
):

self.block_set_name = block_set_name
self.round_digits = int(4)
Expand All @@ -29,13 +33,19 @@ def __init__(self,

@staticmethod
def dispatch_block_rule(block, t):
raise NotImplemented("This function must be overridden for specific dispatch model")
raise NotImplemented(
"This function must be overridden for specific dispatch model"
)

def initialize_parameters(self):
raise NotImplemented("This function must be overridden for specific dispatch model")
raise NotImplemented(
"This function must be overridden for specific dispatch model"
)

def update_time_series_parameters(self, start_time: int):
raise NotImplemented("This function must be overridden for specific dispatch model")
raise NotImplemented(
"This function must be overridden for specific dispatch model"
)

@staticmethod
def _check_efficiency_value(efficiency):
Expand Down

0 comments on commit 55b39dd

Please sign in to comment.