Skip to content

DTOcean/dtocean-maintenance

Repository files navigation

appveyor codecov Codacy Badge release

DTOcean Operations and Maintenance Module

The DTOcean Operations and Maintenance Module calculates costs and energy losses incurred from failures and maintenance of the designs created by the dtocean-electrical and dtocean-moorings modules and the OECs during their operational lifetime. It produces detailed time-based maintenance plans, associated costs and energy outputs. Sub-system failures are modelled stochastically, producing multiple alternative "histories" of the array lifetime, which can then be analysed statistically.

See dtocean-app or dtocean-core to use this package within the DTOcean ecosystem.

* For python 2.7 only.

Installation

Installation and development of dtocean-electrical uses the Anaconda Distribution (Python 2.7)

Conda Package

To install:

$ conda install -c defaults -c conda-forge -c dataonlygreater dtocean-maintenance

Source Code

Conda can be used to install dependencies into a dedicated environment from the source code root directory:

$ conda create -n _dtocean_oandm python=2.7 pip

Activate the environment, then copy the .condrc file to store maintenance
channels:

$ conda activate _dtocean_oandm
$ copy .condarc %CONDA_PREFIX%

OR, if you're using Powershell:

$ conda activate _dtocean_oandm
$ copy .condarc $env:CONDA_PREFIX

Install polite, dtocean-economics dtocean-logistics, and dtocean-reliability into the environment. For example, if installing them from source:

$ cd \\path\\to\\polite
$ conda install --file requirements-conda-dev.txt
$ pip install -e .
$ cd \\path\\to\\dtocean-economics
$ conda install --file requirements-conda-dev.txt
$ pip install -e .
$ cd \\path\\to\\dtocean-logistics
$ conda install --file requirements-conda-dev.txt
$ pip install -e .
$ cd \\path\\to\\dtocean-reliability
$ conda install --file requirements-conda-dev.txt
$ pip install -e .

Finally, install dtocean-maintenance and its dependencies using conda and pip:

$ cd \\path\\to\\dtocean-maintenance
$ conda install --file requirements-conda-dev.txt
$ pip install -e .

To deactivate the conda environment:

$ conda deactivate

Tests

A test suite is provided with the source code that uses pytest.

If not already active, activate the conda environment set up in the Source Code section:

$ conda activate _dtocean_oandm

Install packages required for testing to the environment (one time only):

$ conda install mock pytest pytest-mock

Run the tests:

$ pytest tests

Uninstall

To uninstall the conda package:

$ conda remove dtocean-maintenance

To uninstall the source code and its conda environment:

$ conda remove --name _dtocean_oandm --all

Usage

Example scripts are available in the "examples" folder of the source code.

$ cd examples
$ python example.py

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

See this blog post for information regarding development of the DTOcean ecosystem.

Please make sure to update tests as appropriate.

Credits

This package was initially created as part of the EU DTOcean project by:

It is now maintained by Mathew Topper at Data Only Greater.

License

GPL-3.0