Skip to content

Commit a49a73b

Browse files
authored
Merge pull request #113 from nasa/release/v1.1
Release v1.1
2 parents 3a2bcbf + 93ef7f6 commit a49a73b

File tree

93 files changed

+9989
-1514
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+9989
-1514
lines changed

.github/workflows/python-package.yml

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: [3.6, 3.7, 3.8]
17+
python-version: [3.6, 3.7, 3.8, 3.9]
1818

1919
steps:
2020
- uses: actions/checkout@v2
@@ -48,7 +48,7 @@ jobs:
4848
runs-on: ubuntu-latest
4949
strategy:
5050
matrix:
51-
python-version: [3.6, 3.7, 3.8]
51+
python-version: [3.6, 3.7, 3.8, 3.9]
5252
steps:
5353
- uses: actions/checkout@v2
5454
- name: Set up Python ${{ matrix.python-version }}
@@ -61,3 +61,59 @@ jobs:
6161
python -m pip install -e .
6262
- name: Run tests
6363
run: python -m tests
64+
test_prog_algs_released:
65+
runs-on: ubuntu-latest
66+
strategy:
67+
matrix:
68+
python-version: [3.6, 3.7, 3.8]
69+
steps:
70+
- uses: actions/checkout@v2
71+
- name: Set up Python ${{ matrix.python-version }}
72+
uses: actions/setup-python@v2
73+
with:
74+
python-version: ${{ matrix.python-version }}
75+
- name: Install dependencies
76+
run: |
77+
python -m pip install --upgrade pip
78+
python -m pip install -e .
79+
- name: Clone prog_algs
80+
uses: actions/checkout@v2
81+
with:
82+
repository: nasa/prog_algs
83+
ref: refs/heads/master
84+
path: prog_algs
85+
- name: Install prog_algs
86+
run: |
87+
python -m pip install -e ./prog_algs
88+
- name: Run tests
89+
run: |
90+
cd prog_algs
91+
python -m tests
92+
test_prog_algs_dev:
93+
runs-on: ubuntu-latest
94+
strategy:
95+
matrix:
96+
python-version: [3.6, 3.7, 3.8]
97+
steps:
98+
- uses: actions/checkout@v2
99+
- name: Set up Python ${{ matrix.python-version }}
100+
uses: actions/setup-python@v2
101+
with:
102+
python-version: ${{ matrix.python-version }}
103+
- name: Install dependencies
104+
run: |
105+
python -m pip install --upgrade pip
106+
python -m pip install -e .
107+
- name: Clone prog_algs
108+
uses: actions/checkout@v2
109+
with:
110+
repository: nasa/prog_algs
111+
ref: refs/heads/dev
112+
path: prog_algs
113+
- name: Install prog_algs
114+
run: |
115+
python -m pip install -e ./prog_algs
116+
- name: Run tests
117+
run: |
118+
cd prog_algs
119+
python -m tests

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,5 @@ cython_debug/
9898
.pypirc
9999

100100
ex.pickle
101+
102+
.vscode/

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,52 @@
11
# Prognostics Model Python Package
2+
[![CodeFactor](https://www.codefactor.io/repository/github/nasa/prog_models/badge)](https://www.codefactor.io/repository/github/nasa/prog_models)
3+
[![GitHub License](https://img.shields.io/badge/License-NOSA-green)](https://github.com/nasa/prog_models/blob/master/license.pdf)
4+
[![GitHub Releases](https://img.shields.io/github/release/nasa/prog_models.svg)](https://github.com/nasa/prog_models/releases)
25

3-
The NASA Prognostic Model Package is a python modeling framework focused on defining and building models for prognostics (computation of remaining useful life) of engineering systems, and provides a set of prognostics models for select components developed within this framework, suitable for use in prognostics applications for these components.
6+
The NASA Prognostic Model Package is a Python framework focused on defining and building models for prognostics (computation of remaining useful life) of engineering systems, and provides a set of prognostics models for select components developed within this framework, suitable for use in prognostics applications for these components.
47

58
This is designed to be used with the [Prognostics Algorithms Package](https://github.com/nasa/prog_algs).
69

710
## Installation
811
`pip3 install prog_models`
912

10-
## Documentation
13+
## [Documentation](https://nasa.github.io/prog_models/)
1114
See documentation [here](https://nasa.github.io/prog_models/)
1215

1316
## Repository Directory Structure
1417
Here is the directory structure for the github repository
1518

16-
`prog_models/` - The prognostics model python package<br />
19+
`src/prog_models/` - The prognostics model python package<br />
1720
&nbsp;&nbsp; |-`models/` - Example models<br />
1821
&nbsp;&nbsp; |-`prognostics_model.py` - Physics-based model superclass of degraded system behavior<br />
22+
&nbsp;&nbsp; |-`sim_result.py` - Class for storing the result of a simulation (used by `prognostics_model`)<br />
1923
&nbsp;&nbsp; |-`visualize.py` - Visualization tools<br />
2024
`docs/` - Project documentation<br />
2125
`sphinx_config/` - Configuration for automatic documentation generation<br />
22-
`examples/` - Example python scripts using prog_models<br />
26+
`examples/` - Example Python scripts using prog_models<br />
2327
`tests/` - Tests for prog_models<br />
2428
`README.md` - The readme (this file)<br />
25-
`requirements.txt` - python library dependiencies required to be met to use this package. Install using `pip install -r requirements.txt`<br />
26-
`prog_model_template.py` - Template for Prognsotics Model<br />
29+
`requirements.txt` - Python library dependiencies required to be met to use this package<br />
30+
`prog_model_template.py` - Template for Prognostics Model<br />
2731
`tutorial.ipynb` - Tutorial (Juypter Notebook)
2832

2933
## Citing this repository
3034
Use the following to cite this repository:
3135

3236
```
33-
@misc{2020_nasa_prog_models,
37+
@misc{2021_nasa_prog_models,
3438
author = {Christopher Teubert and Matteo Corbetta and Chetan Kulkarni and Matthew Daigle},
3539
title = {Prognostics Models Python Package},
36-
month = Apr,
40+
month = Aug,
3741
year = 2021,
38-
version = {1.0},
42+
version = {1.1},
3943
url = {https://github.com/nasa/prog_models}
4044
}
4145
```
4246

4347
The corresponding reference should look like this:
4448

45-
C. Teubert, M. Corbetta, C. Kulkarni, and M. Daigle, Prognostics Models Python Package, v1.0, Apr. 2021. URL https://github.com/nasa/prog_models.
49+
C. Teubert, M. Corbetta, C. Kulkarni, and M. Daigle, Prognostics Models Python Package, v1.1, Aug. 2021. URL https://github.com/nasa/prog_models.
4650

4751
## Acknowledgements
4852
The structure and algorithms of this package are strongly inspired by the [MATLAB Prognostics Model Library](https://github.com/nasa/PrognosticsModelLibrary). We would like to recognize Matthew Daigle and the rest of the team that contributed to the Prognostics Model Library for the contributions their work on the MATLAB library made to the design of prog_models

docs/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 675d177859b081b6bf3ea4f747cee0da
3+
config: 81423af7536daf0ca9477dc217470ab8
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/.doctrees/dev_guide.doctree

26.8 KB
Binary file not shown.

docs/.doctrees/environment.pickle

25.5 KB
Binary file not shown.

docs/.doctrees/exceptions.doctree

535 Bytes
Binary file not shown.
44.3 KB
Binary file not shown.

docs/.doctrees/index.doctree

112 Bytes
Binary file not shown.

docs/.doctrees/models.doctree

630 KB
Binary file not shown.
14.7 KB
Binary file not shown.

docs/.doctrees/visualize.doctree

97.4 KB
Binary file not shown.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright © 2021 United States Government as represented by the Administrator of the
2+
# National Aeronautics and Space Administration. All Rights Reserved.
3+
4+
"""
5+
Example of a battery being simulated for a set period of time and then till threshold is met. Run using the command `python -m examples.sim_battery_eol`
6+
"""
7+
8+
from prog_models.models import BatteryElectroChem as Battery
9+
10+
def run_example():
11+
# Step 1: Create a model object
12+
batt = Battery()
13+
14+
# Step 2: Define future loading function
15+
# Here we're using a function designed to charge until 0.95,
16+
# then discharge until 0.05
17+
load = 1
18+
19+
def future_loading(t, x=None):
20+
nonlocal load
21+
22+
# Rule for loading after initialization
23+
if x is not None:
24+
# Current event state in the form {'EOD': <(0, 1)>, 'InsufficientCapacity': <(0, 1)>}
25+
event_state = batt.event_state(x)
26+
if event_state["EOD"] > 0.95:
27+
load = 1 # Discharge
28+
elif event_state["EOD"] < 0.05:
29+
load = -1 # Charge
30+
# Rule for loading at initialization
31+
return {'i': load}
32+
33+
# Simulate to EOL Threshold
34+
print('\n\n------------------------------------------------')
35+
print('Simulating to threshold\n\n')
36+
options = {
37+
'save_freq': 1000, # Frequency at which results are saved
38+
'dt': 2, # Timestep
39+
'threshold_keys': ['InsufficientCapacity'], # Simulate to InsufficientCapacity
40+
'print': True
41+
}
42+
(times, inputs, states, outputs, event_states) = batt.simulate_to_threshold(future_loading, {'t': 18.95, 'v': 4.183}, **options)
43+
44+
# This allows the module to be executed directly
45+
if __name__ == '__main__':
46+
run_example()

docs/_downloads/1e173741004c18e2e2f97234d3eb4521/sensitivity.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# Copyright © 2021 United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All Rights Reserved.
1+
# Copyright © 2021 United States Government as represented by the Administrator of the
2+
# National Aeronautics and Space Administration. All Rights Reserved.
3+
24
"""
3-
Example performing a sensitivity analysis on a new model. Can be run using the following command `python -m examples.sensitivity_example`
5+
Example of a sensitivity analysis on a new model. Run using the command `python -m examples.sensitivity`
46
"""
57

68
# Deriv prog model was selected because the model can be described as x' = x + dx*dt
7-
from prog_models import PrognosticsModel
89
from .new_model import ThrownObject
910
import numpy as np
1011

0 commit comments

Comments
 (0)