Code Monkey home page Code Monkey logo

nasa / progpy Goto Github PK

View Code? Open in Web Editor NEW
53.0 5.0 7.0 25.75 MB

The NASA Prognostic Python Packages is a Python framework focused on defining and building models and algorit for prognostics (computation of remaining useful life) of engineering systems, and provides a set of models and algorithms for select components developed within this framework, suitable for use in prognostic applications.

Home Page: https://nasa.github.io/progpy/

License: Other

HTML 0.02% Jupyter Notebook 12.77% Python 87.21% CSS 0.01%
integrated-system-health-management modeling modeling-and-simulation prognostic-models prognostics prognostics-health-management simulation

progpy's Introduction

Prognostics Python Package (ProgPy)

CodeFactor GitHub License GitHub Releases Binder

The NASA Prognostic Package (ProgPy) is a python prognostics framework focused on building, using, and evaluating models and algorithms for prognostics (computation of remaining useful life) and health management of engineering systems, and provides a set of prognostics models for select components and prognostics algorithms developed within this framework, suitable for use in prognostics for these components. It also includes algorithms for state estimation and prediction, including uncertainty propagation.

ProgPy was the 2024 NASA Software of the Year!

ProgPy combines NASAs prog_models and prog_algs packages into a single python package, for simplicity and clarity.

Installation

pip3 install progpy

See documentation here

Repository Directory Structure

Here is the directory structure for the github repository

src/progpy/ - The prognostics python package
examples/ - Example Python scripts using progpy
tests/ - Tests for progpy
README.md - The readme (this file)
prog_model_template.py - Template for Prognostics Model
state_estimator_template.py - Template for State Estimators
predictor_template.py - Template for Predictor
tutorial.ipynb - Tutorial (Juypter Notebook)

Citing this repository

Use the following to cite this repository:

@misc{2023_nasa_progpy,
  | author    = {Christopher Teubert and Katelyn Jarvis Griffith and Matteo Corbetta and Chetan Kulkarni and Portia Banerjee and Matthew Daigle},
  | title     = {{ProgPy Python Prognostics Packages}},
  | month     = Oct,
  | year      = 2023,
  | version   = {1.6},
  | url       = {https://nasa.github.io/progpy}
  | doi       = {10.5281/ZENODO.8097013}
  | }

The corresponding reference should look like this:

C. Teubert, K. Jarvis Griffith, M. Corbetta, C. Kulkarni, P. Banerjee, M. Daigle, ProgPy Python Prognostics Packages, v1.6, Oct 2023. URL https://github.com/nasa/progpy.

Contributing Organizations

ProgPy was created by a partnership of multiple organizations, working together to build a set of high-quality prognostic tools for the wider PHM Community. We would like to give a big thank you for the ProgPy community, especially the following contributing organizations:

Acknowledgements

The structure and algorithms of this package are strongly inspired by the MATLAB Prognostics Model Library, MATLAB Prognostics Algorithm Library, and the MATLAB Prognostics Metrics Library. We would like to recognize Matthew Daigle and the rest of the team that contributed to the Prognostics Models, Algorithms, and Metrics Libraries for the contributions their work on the MATLAB library made to the design of progpy.

Notices

Copyright © 2021 United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All Rights Reserved.

Disclaimers

No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE. FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT "AS IS."

Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF RECIPIENT'S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS AGREEMENT.

progpy's People

Contributors

aqitya avatar ashwani132003 avatar kjjarvis avatar mstraut avatar teubert avatar wilswer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

progpy's Issues

FNN Model

Requirement Text
Add a basic feed forward neural network option, similar to the lstm

DoD

  • Implement feature
  • Add tests
  • update documentation
  • Add to change notes for next release

UT Predictor with no events

Describe the bug
For predictors, when setting events = [] should predict until time, ignoring events. This doesn't work for UT Predictor

To Reproduce
Steps to reproduce the behavior:

  1. Go to utpredictor example
  2. Set events = [] and horizon = 50
  3. Run

Sampling methods: Latin Hypercube

Requirement Text
Add the ability to sample using the Latin Hypercube sampling method in the UKF, MC, and general sampling

Suggested Solution
Add the ability to specify the sampling method in PF/MC sampling and in the UnweightedSamples sampling. Implement algorithms and put in utils sub package.

DoD

  • Implement feature
  • Add to example
  • Add tests
  • update documentation
  • Add to change notes for next release

Kalman predictor

Requirement Text
Create a new kalman filter based predictor that operates on linear models

DoD

  • Implement kalman predictor
  • Add to example
  • Add tests
  • Add to change notes for next release

CNN State Transition Model

Requirement Text
Create a CNN state transition model

DoD

  • implement
  • Add example
  • Add tests
  • Add to change notes for next release

Rework data storage to use Pandas

Requirement Text
Restructure storage of data from simulation (e.g., SimResult, *Container) to leverage Pandas as appropriate

Background Information
In nasa/prog_models#482 @mstraut investigated options for data storage. The result was a design decision to use Pandas. This was partially implemented in prog_models v1.5

DoD

  • Implement feature
  • Update examples
  • Update tutorial
  • Update tests (as needed)
  • update documentation
  • Add to change notes for next release

Multiple Output layers

Requirement Text
Allow the user to specify the number of Dense layers for each output of the LSTM.

Background Information
Additional dense layers could improve the ability to represent complex relationships between the common system state (output of LSTM) and the final output

Suggested Solution
Configuration argument

DoD

  • Implement feature
  • Add to example
  • Add tests
  • update documentation
  • Add to change notes for next release

Floating time step in flight simulation

Requirement Text
UAV model shall be able to simulate forward at any reasonable dt

Background Information
Right now the flight model requires that you use a set dt- that used to make the waypoints.

Suggested Solution
Interpolate if between points

DoD

  • Implement feature
  • Add to example
  • Add tests
  • update documentation for feature

__sizeof__

Requirement Text
Implement sizeof method for containers (e.g., prediction, UncertainData, and ToE Prediction Profile), state estimators, and predictors

Background Information
sizeof determines the amount of size an object takes

Suggested Solution
state estimator and predictors: size of object + size of parameters + size of model
containers- size of object + size of data

minimum test - make sure size of state est/pred is greater than size of parameters, and adding new parameter increases size. Then that adding a param to the model increases size
Similar to container, adding data increases size.

DoD

  • Implement feature
  • Add tests

Battery Model with Thermal Runaway

Requirement

Implement Thermal event for electrochemistry battery model

DoD

  • Implement event
  • Add documentation
  • Add tests
  • Add to release notes

Drop requirement that EnsembleModel have 2 models

Requirement Text
Ensemble model shall allow creation with one model

Background Information
in v1.5, EnsembleModel artificially rejected creation with <2 models

Suggested Solution
Remove check

Note
Suggestion from v1.5 release review

DoD

  • Implement feature
  • Add to tests

estimate_params: Warnings for unsupported keys to options.

Requirement Text
This feature should be able to return a Warning detailing option keys that do not not exist in the method's options.
The current optimize.show_options function currently either returns a String or prints out the String to the user. However, the current text that is being returned does not necessarily accomplish tasks such that it functions without any worrying

Background Information
The current optimize.show_options function currently either returns a String or prints out the String to the user. However, the current text that is being returned does not necessarily accomplish tasks such that it functions without worrying about future changes done to the documentation/functionality of optimize.show_options. As such, we are mandated to verify that the returned Warnings are working as intended, which is manual behavior that should be abstracted away.

Suggested Solution
Using Regex to parse returned text and return options in some data structure. However, does not accommodate future changes develop via SciPy's side, so this solution is only a temporary one.

Some other solutions may be to track changes done to the optimize.show_options website page, and whenever there are changes done, this will notify us to make changes. This however, still requires us to rework the parser. Furthermore, there could be some downtime between developing changes to the function and documenting updates to their website page.

Looking through the source code and/or the documentation may also provide some inspiration on solving the issue.

optimize.show_options documentation: https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.show_options.html

Source Code: https://github.com/scipy/scipy/blob/v1.10.1/scipy/optimize/_optimize.py#L3732-L3951

DoD
edit this to be a list of tasks that need to be completed

  • Implement feature
  • Add to example
  • Add testing to test_estimate_params.py
  • Update documentation
  • Add to change notes for next release

Battery Pack Model

Requirement

Create a new model that can represent a battery pack - i.e., multiple cells in some combination of series and parallel

Background

Current model is cell-level

DoD

  • Implement model
  • Add tests
  • Add example
  • Add documentation
  • Add to release notes

Direct model lstm

Requirement Text
Update lstm to support direct model (i.e., time_of_event)

Background Information
Currently lstm is just state transition

DoD

  • Implement feature
  • Add to example
  • Add tests
  • update documentation
  • Add to change notes for next release

Window State Container

Requirement Text
Provide a special container to support states containing a window of data and extra data

Background Information
Some models (e.g., LSTM) store a window of historical data as flattened state u_t, z_t, u_t-1, ...

Suggested Solution
Container with add_data(u) method and .extra property

DoD

  • Implement feature
  • Update LSTM
  • Add tests
  • update documentation
  • Add to change notes for next release

Methods for estimating noise parameters

Requirement

Implement guidance and/or methods for estimating process and sensor noise from data

Background

Process and sensor noise is very important for noise representation. There is currently no guidance on how to estimate this

@portia19 - this is related to a discussion we've been having on validation of prognostics models

DoD

  • Implement example demonstrating how to do this
  • Implement tools to help, as appropriate
  • Add tests (if new tools added)
  • Add to release notes (if new tools added)

Implement Logging Throughout

Requirement Text
Implement logging in progpy

Background Information
Right now it can be difficult to debug because of lack of logging. Some simple logging would help with this

Suggested Solution
Use logging package https://docs.python.org/3/library/logging.html. DONT LOG IN INNER LOOP OF SIMULATION, EXCEPT FOR ERROR CASES

DoD

  • Implement feature
  • Add to example
  • Add to tutorial
  • Add tests
  • update documentation
  • Add to change notes for next release

LSTM - Performance Metrics

Requirement Text
Lstm shall provide ability to learn performance metrics

Background Information
Lstm now does everything except pm

Suggested Solution
Same as output

DoD

  • Implement feature
  • Add to example
  • Add tests
  • update documentation

K-fold validation

Requirement Text
Implement k-fold validation

Background Information
See page 135 of deep learning with python

DoD

  • Implement
  • Add to example
  • Add to change notes for next release

Dispersion Metric in Ensemble Model

Requirement Text
Ensemble model should return a measurement of dispersion

Background Information
Ensemble model aggregates the results of the component models, but does not produce any measurement of the dispersion of the results from the models

Suggested Solution
Allow specification of "dispersion metrics" as parameter. Metrics will be calculated each time values are aggregated. The result is then saved as an attribute of the *Container (e.g., StateContainer, OutputContainer, etc.).

E.g.,
dispersion_metrics = {'std': np.std, 'custom1': some_custom_method}

Then
X = m.next_state(...)
Print(X.dispersion_metrics['std'])
Print(X.dispersion_metrics['custom1'])

Or just one metric
Dispersion = np.std

Then x.dispersion

Another thought:
It would be nice if it's only calculated when you need it (e.g., at save_pts). Maybe we save raw data as member, and calculate when saving

DoD

  • Implement feature
  • Add to example
  • Add tests
  • update documentation

Simplify future loading for data model

Requirement Text
Create functions, classes, or features to simplify future load for data model

Background Information
Currently very complicated.

DoD

  • Implement feature
  • Add to example
  • Add tests
  • update documentation
  • Add to change notes for next release

Get DataModels working with State Estimation

Get state estimation working with data models (e.g., LSTMStateTransitionModel)

DoD

  • Implement example
  • Make any changes required to get it working
  • Add documentation to help users
  • Add to release notes

Sort out direct model prog_algs compatability

Requirements

Explore methods for using time_of_event fin prediction

Potential Solutions

  • If no more save_pts, switch to time_of_event (to get final time, since no more states are required)

DoD

  • Implement feature
  • Add tests

Add support for lists in Param estimation

Currently parameter estimation only supports scalars- this issue is to add support for lists as well

D.o.D.

  • Parameter estimation works for lists too
  • feature is tested
  • Added to release notes

LSTM Model reduction

Requirement Text
Implement methods for reducing LSTM model size

Suggested Solution
.reduce method

DoD

  • Implement method
  • Add example
  • Add tests
  • Add to change notes for next release

Parallelize MC

Requirement Text
Update MC so that different samples can run concurrently

Background Information
Current MC operation is single-threaded. Ran into issues making it multithreaded in the past

DoD

  • Implement feature
  • update documentation
  • Add to change notes for next release

notes
https://www.computer.org/csdl/magazine/cs/2021/06/09658236/1zw1ldymkJW

Python doesn't always parallelize threads as you would expect

Piecewise - Pregenerate loads

Requirement Text
Pre-generate loads before Piecewise.call

Background Information
Right now InputContainers are build when call is called, this is unnecessary

Suggested Solution
Pregenerate in init

DoD

  • Implement feature

Battery - Ambient Correlation Factor

Add some sort of factor thats dependent on the batteries environment?

For example: If two batteries are being modeled, one is inclosed in a chamber the other exposed to space, the first battery's temperature would likely increase much more with the same loading than the one exposed to space (due to higher ambient temperature, or an ambient temperature highly correlated to the battery temperature).

This task is to add this affect to the model.

Perhaps some sort of ambient correlation factor (tCorr), such that

Tamb = (1.0-params['tCorr']) * params['x0']['Tb'] + params['tCorr'] * Tb
Tbdot = (voltage_eta*i/mC) + ((Tamb - Tb)/tau)

This way correlation of 0 would use the ambient temperature of space, 1 would use the temperature of the battery, and in between would use some proportion

GSAP Integration

Create interface for integrating models with C++ GSAP framework

Background

GSAP is a C++ framework for implementing prognostics applications. It follows a very similar format. Generally python is highly comparable with C++

D.o.D

  • Interface exists in GSAP that integrates a prog_models model into GSAP
  • Add to GSAP tests

Periodic Windows

Requirement Text
support historical window state where not every value is used in state (e.g., u_t, u_t-5, u_t-10)

Suggested Solution
Extend #22

DoD

  • Implement feature
  • Add to example for lstm
  • Add tests
  • update documentation
  • Add to change notes for next release

Final load in Piecewise loading

Requirement Text
Support the setting of a final (i.e., catch all) loading level for progpy.loading.Piecewise

Background Information
Currently this is done manually by setting a time of float('inf')

Suggested Solution
Allow load to be one longer than times to identify catch-all

DoD

  • Implement feature
  • Add to example
  • Add tests
  • update documentation

AutoPublish Release Candidate

We want to submit a rc version (ends in .rc#, e.g., .rc0) to PyPi, then test it for each commit to a release branch.

Suggestion - see pypi-version to get latest release version. If to left of rc in the package.version (or setup.py) is the same, then increment rc #, otherwise add rc0 to release number. We might have to move version # to a separate file to get this to work.

See Also: #48

Trajectory generation future work

Requirement Text
List of additional features to be developed to further improve the trajectory generation

DoD
Features to add/enhance:

  • Controllers - separate controllers into separate model and add other controller options
  • Add checks for unrealistic waypoint inputs
  • Update documentation with more detail on models involved
  • Add functionality to support any user-defined time step (currently must be constant)
  • Made model stateless - Model is not currently stateless, since state values are saved in the parameters (i.e. 'next_waypoint' in event_state). Edit to achieve stateless model

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.