Skip to content

Commit

Permalink
updates tolerances and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
samgdotson committed Nov 1, 2022
1 parent 47a05dd commit 1f02a9e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.2.1] - 2022-11-01
### Fixed
- Fixes a bug where storage constraints were not initialized in the `DispatchModel`.
- Fixes the tolerances in the testing suite so that the tests pass.
Previously, a single test was failing due to (-1e-9 == 0 ± 1e-12).
This should pass, since 1e-9 is still close to zero.

## [0.2.0] - 2022-10-31
### Added
- Adds the following Technology subclasses
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Samuel Dotson'

# The full version, including alpha/beta/rc tags
release = '0.2.0'
release = '0.2.1'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z"
_version_major = 0
_version_minor = 2
_version_micro = 0 # use '' for first of series, number for 1 and above
_version_micro = 1 # use '' for first of series, number for 1 and above
# _version_extra = 'dev'
_version_extra = '' # Uncomment this for full releases

Expand Down
14 changes: 7 additions & 7 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ def test_dispatch_model_solve_case1(technology_set_1, net_demand):
[t.variable_cost for t in technology_set_1]).min()
expected_result = cheapest_tech * net_demand.sum()

assert model.objective == pytest.approx(expected_result, TOL)
assert model.objective == pytest.approx(expected_result, abs=TOL)
assert model.results['Nuclear'].sum(
) == pytest.approx(net_demand.sum(), TOL)
assert model.results['NaturalGas'].sum() == pytest.approx(0.0, TOL)
assert model.results['NaturalGas'].sum() == pytest.approx(0.0, abs=TOL)


def test_dispatch_model_solve_case2(technology_set_2, net_demand):
Expand All @@ -226,7 +226,7 @@ def test_dispatch_model_solve_case2(technology_set_2, net_demand):
expected_natgas = net_demand - expected_nuclear
expected_result = (expected_nuclear * nuclear.variable_cost
+ expected_natgas * natgas.variable_cost).sum()
assert model.objective == pytest.approx(expected_result, TOL)
assert model.objective == pytest.approx(expected_result, abs=TOL)


def test_dispatch_model_solve_case3(technology_set_3, net_demand):
Expand All @@ -244,9 +244,9 @@ def test_dispatch_model_solve_case3(technology_set_3, net_demand):
min_power_delta = ((model.results.Nuclear.diff())
/ nuclear.capacity.to_value()).min()
assert max_power_delta == pytest.approx(
nuclear.ramp_up_rate.to_value(), TOL)
nuclear.ramp_up_rate.to_value(), abs=TOL)
assert min_power_delta == pytest.approx(
-nuclear.ramp_down_rate.to_value(), TOL)
-nuclear.ramp_down_rate.to_value(), abs=TOL)


def test_dispatch_model_solve_case4(technology_set_4, net_demand):
Expand All @@ -263,5 +263,5 @@ def test_dispatch_model_solve_case4(technology_set_4, net_demand):
'Battery_charge']].sum().sum()
binary_charging = np.dot(model.results.Battery,
model.results.Battery_charge)
assert (total_gen - net_demand.sum()) == pytest.approx(0, TOL)
assert binary_charging == pytest.approx(0, TOL)
assert (total_gen - net_demand.sum()) == pytest.approx(0, abs=TOL)
assert binary_charging == pytest.approx(0, abs=TOL)

0 comments on commit 1f02a9e

Please sign in to comment.