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
55 changes: 47 additions & 8 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.11", "3.12", "3.13"]
os:
- ubuntu-latest
- windows-latest
- macos-latest
python-version:
- "3.11"
- "3.12"
- "3.13"
- "3.14"

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
Expand All @@ -28,14 +35,46 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e ".[dev]"
shell: bash

- name: Test with pytest
- name: Run unit tests
run: |
pytest --cov=wombat --cov-report=xml
pytest --unit --cov=wombat --cov-report=lcov:./unit-coverage.lcov
shell: bash

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
- name: Upload test coverage
uses: coverallsapp/github-action@v2
if: contains(matrix.os, 'ubuntu') && contains(matrix.python-version, '3.14')
with:
github-token: ${{ secrets.COVERALLS_REPO_TOKEN }}
files: ./unit-coverage.lcov
flag-name: unit
parallel: true
fail-on-error: false

- name: Run regression tests
run: |
pytest --regression --cov=wombat --cov-report=lcov:./regression-coverage.lcov
shell: bash

- name: Upload test coverage
uses: coverallsapp/github-action@v2
if: contains(matrix.os, 'ubuntu') && contains(matrix.python-version, '3.14')
with:
github-token: ${{ secrets.COVERALLS_REPO_TOKEN }}
files: ./regression-coverage.lcov
flag-name: regression
parallel: true
fail-on-error: false
coverage-finish:
needs: build
if: always()
runs-on: ubuntu-latest
steps:
- name: Coveralls finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.COVERALLS_REPO_TOKEN }}
parallel-finished: true
fail-on-error: false
2 changes: 1 addition & 1 deletion .github/workflows/ci_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gh_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
pages: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: 3.13

Expand All @@ -28,7 +28,7 @@ jobs:
jupyter-book build docs

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@v5
with:
path: "docs/_build/html"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
id-token: write

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
id-token: write

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
Expand Down
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
- `by="turbine"` no longer includes the "windfarm" column for results
- `process_times` now uses a `MultiIndex` with a `subassembly` and `task` column.
- Improved cable, subassembly, and servicing equipment error handling to show which of
the cables, substations, turbines, or vessels produced the intialization error for
the cables, substations, turbines, or vessels produced the initialization error for
easier input debugging.
- Basic tests are now included for limited set of the `Metrics` class with a focus
cost summaries.
Expand Down Expand Up @@ -444,7 +444,7 @@ cables:
- `RepairRequest.prior_operating_level` has been added to allow 100% reduction factor failures to correctly and consistently restore the operating level of a subassembly following a repair.
- Replaces the `valid_reduction` attrs validator with `validate_0_1_inclusive` to reuse the logic in multiple places without duplicating checking methods.
- Adds a `replacement` flag for interruption methods, so that a failure or replacement comment can be added as a cause for `simpy.process.interrupt`. This update allows the failure and maintenance processes to check if an interruption should cause the process to exit completely. Additionally, the forced exit ensures that processes can't persist after a replacement event when a process is recreated, which was happening in isolated cases.
- Fixes a bug in `RepairManager.purge_subassemble_requests()` where the pending tows are cleared regardless of whether or not the focal subassembly is the cause of the tow, leading to a simulation failure.
- Fixes a bug in `RepairManager.purge_subassembly_requests()` where the pending tows are cleared regardless of whether or not the focal subassembly is the cause of the tow, leading to a simulation failure.
- Fixes a bug in `utilities/utilities.py:create_variable_from_string()` to operate in a way that is expected. The original method was removing all numerics, but only leading punctuation and numerics should be replaced, with any punctuation being replaced with an underscore.
- Adds additional inline comments for clarification on internal methods.
- Update README.md to be inline with current conda and Python standards.
Expand Down Expand Up @@ -531,13 +531,13 @@ cables:
### Features

- Adds a `non_stop_shift` attribute to `ServiceEquipmentData`, `UnscheduledServiceEquipmentData`, `ScheduledServiceEquipmentData`, and `PortConfig` that is set in the post-initialization hook or through `DateLimitsMixin._set_environment_shift()` to ensure it is updated appropriately. Additionally, all checks for a 24 hour shift now check for the `non_stop_shift` attribute.
- `Metrics.emissions()` has been added to the list of available metrics to calculate the emissions from idling at port or sea, tranisiting, and maneuvering. Co-authored by and inspired by analysis work from @hemezz.
- `Metrics.emissions()` has been added to the list of available metrics to calculate the emissions from idling at port or sea, transiting, and maneuvering. Co-authored by and inspired by analysis work from @hemezz.
- `Simulation` now accepts a `random_seed` or `random_generator` variable to seed the random number generators for Weibull failure timeouts and wait timing between event completions. Setting the `random_seed` to the same value from one simulation to the next will net the same results between different simulations, whereas the `random_generator` can be used to use the same generator for a batch of simulations.

### General

- All `assert` statements are now only called when type checking is performed
- Replaces all `.get(lamda x: x == request)` with a 10x faster `.get(lambda x: x is request)` to more efficiently filter out the desired event to be removed from the repair manager and port repair management.
- Replaces all `.get(lambda x: x == request)` with a 10x faster `.get(lambda x: x is request)` to more efficiently filter out the desired event to be removed from the repair manager and port repair management.
- `WombatEnvironment.weather` is now a Polars DataFrame to improve efficiency and indexing bottlenecks introduced in Pandas 2.0.
- All subassembly cable files are read in once, and stored in a dictionary to provide a modest speed up for the simulation initialization.

Expand All @@ -553,7 +553,7 @@ cables:
- Features:
- Weather data now has the ability to contain more than just the required "windspeed" and "waveheight" columns. This will allow for easier expansion of the weather model in the future, and increase compatibility with other NLR techno economic modeling frameworks.
- Bug fixes:
- Maintenance and failure simulation process interruptions were occuring prior to starting the process timing, and causing simulation failures.
- Maintenance and failure simulation process interruptions were occurring prior to starting the process timing, and causing simulation failures.
- Duplicated parameters were being processed in `WombatEnvironment.log_action` stemming from improper handling of varying parameters in some of the more complex control flow logic in *in situ* repairs.
- Another edge case of negative delays during crew transfers where there is insufficient time remaining in the shift after account for weather, so the method was called recursively, but not exiting the original loop.
- `Port` management of *in situ* and tow-to-port capable tugboats wasn't properly accounting for tugboats of varying capabilities, and assuming all tugboats could do both. The vessel management and repair processing were out of sync causing duplicated turbine servicing/towing.
Expand Down Expand Up @@ -697,7 +697,7 @@ In v0.6, due to a series of bug fixes, logic improvements, and feature additions
- `wombat.core.environment.WombatEnvironment.cleanup_log_files` will only try to delete files that actually
exist to avoid unexpected simulation failures at the last step.
- `wombat.core.environment.WombatEnvironment.date_ix` accepts `datetime.datetime` and `datetime.date` inputs to
avoid unnecesary errors or manipulations in a simulation.
avoid unnecessary errors or manipulations in a simulation.
- `wombat.core.environment.WombatEnvironment.log_action` now only accepts numeric inputs for
`system_ol` and `part_ol`.
- `wombat.core.environment.WombatEnvironment.weather_forecast` now rounds the starting time down to
Expand Down Expand Up @@ -760,7 +760,7 @@ In v0.6, due to a series of bug fixes, logic improvements, and feature additions
- `wombat.core.service_equipment.ServiceEquipment.register_repair_with_subassembly` correctly
retrieves the cable information for upstream cables to be reset.

- `wombat.core.post_processor.Metrics.service_equipment_utilization` has a new methodolgy that uses the
- `wombat.core.post_processor.Metrics.service_equipment_utilization` has a new methodology that uses the
actual number of days in operation instead of a backwards computation that consistently and
accurately accounts for the days where the servicing equipment is in operation. Additionally, the
filtering is updated to match the filter for total days, which also improves accuracy of results.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
[![DOI 10.2172/1894867](https://img.shields.io/badge/DOI-10.2172%2F1894867-brightgreen?link=https://doi.org/10.2172/1894867)](https://www.osti.gov/biblio/1894867)
[![PyPI version](https://badge.fury.io/py/wombat.svg)](https://badge.fury.io/py/wombat)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/wombat)
[![codecov](https://codecov.io/gh/NLRWindSystems/WOMBAT/branch/main/graph/badge.svg?token=SK9M10BZXY)](https://codecov.io/gh/NLRWindSystems/WOMBAT)
[![Coverage Status](https://coveralls.io/repos/github/NLRWindSystems/WOMBAT/badge.svg?branch=main)](https://coveralls.io/github/NLRWindSystems/WOMBAT?branch=main)
[![Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/NLRWindSystems/WOMBAT/main?filepath=examples)
[![Jupyter Book](https://jupyterbook.org/badge.svg)](https://nlrwindsystems.github.io/WOMBAT)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/WISDEM/WOMBAT/main?filepath=examples)
[![Jupyter Book Badge](https://raw.githubusercontent.com/jupyter-book/jupyter-book/next/docs/media/images/badge.svg)](nlrwindsystems.github.io/WOMBAT)

[![Pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
Expand Down
2 changes: 1 addition & 1 deletion docs/API/types.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(types)=
# Conifgurations (Data Classes)
# Configurations (Data Classes)

The WOMBAT architecture relies heavily on a base set of data classes to process most of
the model's inputs. This enables a rigid, yet robust data model to properly define a
Expand Down
96 changes: 50 additions & 46 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,16 @@ Now, run the build command as follows.
jupyter-book build docs
```

Before a release, the updated example Jupyter Notebooks should be copied from the built
documentation to the examples folder as follows, then committed to the current branch.

```bash
cp docs/_build/jupyter_execute/examples/*.ipynb
```

## Testing

All code should be paired with a corresponding unit, regression, or integration test written with
All code should be paired with a corresponding unit, regression, or integration tests written with
the pytest framework.

To run the tests you can use any of the following commands, depending on your needs.
Expand Down Expand Up @@ -245,54 +252,51 @@ All changes must be documented appropriately in CHANGELOG.md in the [Unreleased]

## Release Process

This section is a reference for WOMBAT's maintainers to keep processes largely consistent
over time, regardless of who the core developers are.

1. Rerun tests
2. Rebuild the documentation locally
1. Recreate the example notebooks

```bash
jupytext --to notebook docs/examples/how_to.md docs/examples/metrics_demonstration.md docs/examples/strategy_demonstration.md
```

2. Move the notebooks to the examples folder

```bash
mv docs/examples/*.ipynb examples
```
### Standard

3. Bump version number and metadata in `WOMBAT/__init__.py`
4. Bump version numbers of any dependencies in `setup.py`. Be sure to separate to keep dependencies
separated by what they are required for (see the `project.optional-dependencies` section of
`pyproject.toml`)
5. Update the changelog at `WOMBAT/CHANGELOG.md`, changing the "UNRELEASED" section to the new
version and the release date (e.g. "[2.3 - 2022-01-18]").
6. Make a pull request into develop with these updates, and be sure to follow the guide in
[Pull Requests](contributing:pull-request).
Most contributions will be into the `dev` branch, and once the threshold for a release has been
met the following steps should be taken to create a new release

7. Merge develop into main through the git command line
1. On `dev`, bump the version appropriately, see the
[semantic versioning guidelines](https://semver.org/) for details.
- Semantic Versioning follows a MAJOR.MINOR.PATCH versioning pattern, and new functionality
should get a minor release, and fixes/minor updates should get a patch release.
2. Update the `## Unreleased` title to the new version and release date.
3. Open a pull request from `develop` into `main`.
4. When all CI tests pass, and the PR has been approved, merge the PR into main.
5. Pull the latest changes from GitHub into the local copy of the main branch.
6. Tag the latest commit to match the version bump in step 1 (replace "v1.2.3" in all instances
below), and push it to the repository.

```bash
git checkout main
git merge develop
git push
```

- Tag the new release version:

```bash
git tag -a v1.2.3 -m "Tag message for v1.2.3"
```bash
git tag -a v1.2.3 -m "v1.2.3 release"
git push origin v1.2.3
```

The above process will trigger the `.github/workflows/python-publish-test.yml` GitHub Action
that builds the package and pushes it to Test PyPI. If this is successful, you can move to the
next step, otherwise the errors from the action should be addressed, and the tag should be
deleted, then recreated after the fix is published.

- Deploying a Package to PyPi
- The repository is equipped with a GitHub Action to build and publish new versions to PyPI. A
maintainer can invoke this workflow by creating a new release on GitHub that corresponds to the
created tag in the previous step.
- The action is defined in `.github/workflows/python-publish.yml`.
7. Check that the
[Test PyPI GitHub Action](https://github.com/NLRWindSystems/WOMBAT/actions/workflows/python-publish-test.yml)
has run successfully.
1. If the action failed, identify and fix the issue, then
2. delete the local and remote tag using the following (replace "v1.2.3" in all instances just like
in step 6):

```bash
git tag -d v1.2.3
git push --delete origin v1.2.3
```

3. Start back at step 1.
8. When the Test PyPI Action has successfully run,
[create a new release](https://github.com/NLRWindSystems/WOMBAT/releases/new) using the tag created in
step 6.

### Patches

Any pull requests directly into the main branch that alter the WOMBAT model (excludes anything
in `docs/`, or outside of `wombat/` and `tests/`), should be sure to follow the instructions
below:

1. All CI tests pass and the patch version has been bumped according to the
[semantic versioning guidelines](https://semver.org/).
2. Follow steps 2 through 8 above.
3. Merge the NLR main branch back into the `dev` branch and push the changes.
2 changes: 1 addition & 1 deletion docs/examples/default_data_demonstration.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ kernelspec:
In this example, we'll show what each of the reference plants look like and what results they yield when simulated.

```{important}
The land-based data are expiremental, and should only be used as a starting point for
The land-based data are experimental, and should only be used as a starting point for
developing a more robust simulation. Please see the
[default data section of the user guide for further details](index.md#default-data)
```
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/examples_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DOE. The results are displayed in

## Ongoing Analysis Work & Default Data Results Demonstration

### `COWER_om_worflow.ipynb`
### `COWER_om_workflow.ipynb`

This workflow example demonstrates the new (as of v0.13) default offshore wind data sets and the
O&M portion of the NLR Cost of Wind Energy Review (COWER) analysis. The underlying data and example
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/how_to.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ later input reviews:
- subassembly is all "vestas_v90.yaml", but having to input the turbine subassembly model
means that multiple turbine types can be used on a windfarm.
- This same logic applies to the upstream_cable so that multiple cable types can be
used as appopriate.
used as appropriate.
```

<div style="overflow-y:auto;overflow-x:auto">
Expand Down Expand Up @@ -416,13 +416,13 @@ frequent manual reset. For a thorough definition, please read the API
documentation of the [Maintenance](types:maintenance:scheduled) and
[Failure](types:maintenance:unscheduled) data classes. Note that the yaml definition below
specifies that maintenance tasks are in a bulleted list format and that failure
defintions require a dictionary-style input with keys to match the severity level of a
definitions require a dictionary-style input with keys to match the severity level of a
given failure. For more details on the complete subassembly definition, please visit the
[Subassembly API documentation](types:windfarm:subassembly).

```{important}
As of v0.10, failure configurations (`failures`) require a list-based definition. To
convert older cable, subastation, and turbine configuration failues, use the
convert older cable, substation, and turbine configuration failures, use the
library function `convert_failure_data` as shown in the
[helpers API documentation](importing-and-converting-from-old-versions).
```
Expand Down Expand Up @@ -659,7 +659,7 @@ will know where to go for these pointers when the simulation is initialized so t
is constructed and validated correctly.

```{note}
As of veraion 0.10, all non-CSV file inputs can be difined in a single configuration
As of version 0.10, all non-CSV file inputs can be difined in a single configuration
file. Please see [the configuration API details](simulation-api:config) for details.
```

Expand Down
Loading
Loading