Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@

import shutil
from datetime import datetime
from importlib.metadata import version as version_func
from pathlib import Path

# import pkg_resources
from sphinx.application import Sphinx

from dispatch import __version__ as version

DOCS_DIR = Path(__file__).parent.resolve()

# -- Path setup --------------------------------------------------------------
Expand All @@ -26,7 +25,8 @@
# importable path.

# The full version, including alpha/beta/rc tags
release = ".".join(version.split(".")[:2])
release = version_func("rmi.dispatch")
version = ".".join(release.split(".")[:2])

# -- Project information -----------------------------------------------------

Expand Down
12 changes: 12 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
Release Notes
=======================================================================================


.. _release-v0-4-0:

---------------------------------------------------------------------------------------
0.4.0 (2022-XX-XX)
---------------------------------------------------------------------------------------

What's New?
^^^^^^^^^^^
* Test for :func:`.dispatch_engine`.


.. _release-v0-3-0:

---------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools<64", "setuptools_scm"]
requires = ["setuptools<66", "setuptools_scm[toml]>=3.5.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
Expand Down
45 changes: 45 additions & 0 deletions tests/engine_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""Dispatch engine tests."""


import numpy as np

from dispatch.engine import dispatch_engine

NL = [
-500.0,
-250.0,
100.0,
400.0,
800.0,
1000.0,
1200.0,
800.0,
600.0,
-500.0,
-250.0,
100.0,
400.0,
800.0,
1000.0,
1200.0,
800.0,
600.0,
]
CAP = [500, 400, 300]


def test_engine():
"""Trivial test for the dispatch engine."""
re, es, sl, st = dispatch_engine(
net_load=np.array(NL),
hr_to_cost_idx=np.zeros(len(NL), dtype=int),
historical_dispatch=np.array([CAP] * len(NL)),
dispatchable_ramp_mw=np.array(CAP),
dispatchable_startup_cost=np.array([[1000.0], [1000.0], [100.0]]),
dispatchable_marginal_cost=np.array([[10.0], [20.0], [50.0]]),
storage_mw=np.array([400, 200]),
storage_hrs=np.array([4, 12]),
storage_eff=np.array((0.9, 0.9)),
storage_op_hour=np.array((0, 0)),
)
assert True