Modeling and Sim Guide#

The Prognostics Python Package (ProgPy) includes tools for defining, building, using, and testing models for prognostics of engineering systems. It also provides a set of prognostics models for select components developed within this framework, suitable for use in prognostics applications for these components and can be used in conjunction with the state estimation and prediction features (see State Estimation and Prediction Guide) to perform research in prognostics methods.

Installing progpy#

The latest stable release of ProgPy is hosted on PyPi. For most users, this version will be adequate. To install via the command line, use the following command:

$ pip install progpy

Getting Started#

https://mybinder.org/badge_logo.svg

The best way to learn how to use progpy is through the tutorial. There are also a number of examples that show different aspects of the package, summarized and linked in the below sections

ProgPy Prognostic Model Format#

Prognostics models are the foundation of the prognostics process. They describe how a system or system-of-systems is expected to behave based on how it is used/loaded (i.e., input). Prognostic models typically come in one of 4 categories: knowledge-based, physics-based, data-driven, or some combination of those three (i.e., hybrid).

Inputs#

Prognostic model inputs are how a system is loaded. These are things that can be controlled, and affect how the system state evolves. The expected inputs for a model are defined by its inputs property. For example, a battery is loaded by applying a current, so the only input is i, the applied current. Inputs are also sometimes environmental conditions, such as ambient temperature or pressure.

Inputs are one of the inputs to the state transition model, described in States .

States#

ProgPy prognostic models are state-transition models. The internal state of the system at any time is represented by one or more (frequently hidden) state variables, represented by the custom type StateContainer. Each model has a discrete set of states, the keys of which are defined by the states property.

For example, the example ThrownObject model has two states, position (x) and velocity (v).

States are transitioned forward in time using the state transition equation.

\(x(t+dt) = f(t, x(t), u(t), dt, \Theta)\)

where \(x(t)\) is state at time \(t\), \(u(t)\) is input at time \(t\) , \(dt\) is the stepsize, and \(\Theta\) are the model parameters .

In a ProgPy model, this state transition can be represented one of two ways, either discrete or continuous, depending on the nature of state transition. In the case of continuous models, state transition behavior is defined by defining the first derivative, using the progpy.PrognosticsModel.dx() method. For discrete models, state transition behavior is defined using the progpy.PrognosticsModel.next_state() method. The continuous state transition behavior is recommended, because defining the first derivative enables some approaches that rely on that information.

_images/next_state.png _images/dx.png

Output (Measurements)#

The next important part of a prognostic model is the outputs. Outputs are measurable quantities of a system that are a function of system state. When applied in prognostics, generally the outputs are what is being measured or observed in some way. State estimators use the different between predicted and measured values of these outputs to estimate the system state.

Outputs are a function of only the system state (x) and parameters (\(\Theta\)), as described below. The expected outputs for a model are defined by its outputs property. The logic of calculating outputs from system state is provided by the user in the model progpy.PrognosticsModel.output() method.

_images/output.png

\(z(t) = f(x(t), \Theta)\)

Events#

Traditionally users may have heard the prognostic problem as estimating the Remaining Useful Life (RUL) of a system. ProgPy generalizes this concept with the concept of events. ProgPy Prognostic Models contain one or more events which can be predicted. Systems frequently have more than one failure mode, each of these modes can be represented by a separate event. For example, a valve model might have separate events for an internal leak and a leak at the input. Or a battery model might have events for insufficient capacity, thermal runaway, and low-voltage.

Additionally, events can be used to predict other events of interest beyond failure, such as special system states or warning thresholds. For example, the above battery model might also have an warning event for when battery capacity reaches 50% of the original capacity because of battery aging with use.

The expected events for a model are defined by its events property. The logic of events can be defined in two methods: progpy.PrognosticsModel.threshold_met() and progpy.PrognosticsModel.event_state().

Thresholds are the conditions under which an event occurs. The logic of the threshold is defined in the progpy.PrognosticsModel.threshold_met() method. This method returns boolean for each event specifying if the event has occured.

_images/threshold_met.png

\(tm(t) = f(x(t), \Theta)\)

Event states are an estimate of the progress towards a threshold. Where thresholds are boolean, event states are a number between 0 and 1, where 0 means the event has occured, 1 means no progress towards the event. Event states are a generalization of State of Health (SOH) for systems with multiple events and non-failure events. The logic of the event states is defined in progpy.PrognosticsModel.event_state().

_images/event_state.png

\(es(t) = f(x(t), \Theta)\)

If threshold_met is not specified, threshold_met is defined as when event_state is 0. Alternately, if event_state is not defined, it will be 0 when threshold_met is True, otherwise 1. If a model has events, at least one of these methods must be defined

Parameters#

Parameters are used to configure the behavior of a model. For parameterized physics-based models, parameters are used to configure the general system to match the behavior of the specific system. For example, parameters of the general battery model can be used to configure the model to describe the behavior of a specific battery.

Models define a default_parameters property- the default parameters for that model. After construction, the parameters for a specific model can be accessed using the parameters property. For example, for a model m

>>> print(m.parameters)

Parameters can be set in model construction, using the parameters property after construction, or using Parameter Estimation feature (See Parameter Estimation). The first two are illustrated below:

>>> m = SomeModel(some_parameter=10.2, some_other_parameter=2.5)
>>> m.parameters['some_parameter'] = 11.2  # Overriding parameter

The specific parameters are very specific to the system being modeled. For example, a battery might have parameters for the capacity and internal resistance. When using provided models, see the documentation for that model for details on parameters supported.

Noise#

In practice, it is impossible to have absolute knowledge of future states due to uncertainties in the system. There is uncertainty in the estimates of the present state, future inputs, models, and prediction methods [Goebel2017]. This model-based prognostic approach incorporates this uncertainty in four forms: initial state uncertainty (\(x_0\)), process noise, measurement noise, and future loading noise.

See example below for details on how to configure proccess and measurement noise in ProgPy

Future Loading#

Future loading is an essential part of prediction and simulation. In order to simulate forward in time, you must have an estimate of how the system will be used (i.e., loaded) during the window of time that the system is simulated. Future load is essentially expected Inputs at future times.

Future loading is provided by the user either using the predifined loading classes in progpy.loading, or as a function of time and optional state. For example:

def future_load(t, x=None):
    # Calculate inputs
    return m.InputContainer({'input1': ...})

See example below for details on how to provide future loading information in ProgPy.

General Notes#

Users of ProgPy will need a model describing the behavior of the system of interest. Users will likely either use one of the models distribued with ProgPy (see Included Models), configuring it to their own system using parameter estimation (see examples.param_est), use a data-driven model class to learn system behavior from data, or build their own model (see Building New Models section, below).

Building New Models#

ProgPy provides a framework for building new models. Generally, models can be divided into three basis categories: physics-based models, data-driven models, and hybrid models. Additionally, models can rely on state-transition for prediction, or they can use what is called direct-prediction. These two categories are described below.

State-transition Models#

New physics-based models are constructed by subclassing progpy.PrognosticsModel as illustrated in the first example. To generate a new model, create a new class for your model that inherits from this class. Alternatively, you can copy the template prog_model_template.ProgModelTemplate, replacing the methods with logic defining your specific model. The analysis and simulation tools defined in progpy.PrognosticsModel will then work with your new model.

For simple linear models, users can choose to subclass the simpler progpy.LinearModel class, as illustrated in the second example. Some methods and algorithms only function on linear models.

Direct-prediction models#

Direct-prediction models are models that estimate time of event directly from the current state and future load, instead of being predicted through state transition. When models are pure direct-prediction models, future states cannot be predicted. See example below for more information.

Using Data#

Wether you’re using data-driven, physics-based, expert knowledge, or some hybrid approach, building and validating a model requires data. In the case of data-driven approaches, data is used to train and validate the model. In the case of physics-based, data is used to estimate parameters (see Parameter Estimation) and validate the model.

ProgPy includes some example datasets. See ProgPy Datasets and the example below for details.

Note

To use the dataset feature, you must install the requests package.

Using provided models#

ProgPy includes a number of predefined models in the progpy.models module. These models are parameterized, so they can be configured to represent specific systems (see Parameter Estimation).

For details on the included models see Included Models. The examples below illustrate use of some of the models provided in the progpy.models module.

Simulation#

One of the most basic of functions using a model is simulation. Simulation is the process of predicting the evolution of system state with time, given a specific future load profile. Unlike full prognostics, simulation does not include uncertainty in the state and other product (e.g., output) representation. For a prognostics model, simulation is done using the progpy.PrognosticsModel.simulate_to() and progpy.PrognosticsModel.simulate_to_threshold() methods.

Use of simulation is described further in the following examples:

Parameter Estimation#

Parameter estimation is an important step in prognostics. Parameter estimation is used to tune a general model to match the behavior of a specific system. For example, parameters of the general battery model can be used to configure the model to describe the behavior of a specific battery.

Sometimes model parameters are directly measurable (e.g., dimensions of blades on rotor). For these parameters, estimating them is a simple act of direct measurement. For parameters that cannot be directly measured, they’re typically estimated using observed data.

Generally, parameter estimation is done by tuning the parameters of the model so that simulation best matches the behavior observed in some available data. In ProgPy, this is done using the progpy.PrognosticsModel.estimate_params() method. This method takes input and output data from one or more runs, and uses scipy.optimize.minimize function to estimate the parameters of the model.

>>> params_to_estimate = ['param1', 'param2']
>>> m.estimate_params([run1_data, run2_data], params_to_estimate, dt=0.01)

See the example below for more details

Note

Parameters are changes in-place, so the model on which estimate_params is called, is now tuned to match the data

Visualizing Results#

Results of a simulation can be visualized using the plot method. For example:

>>> results = m.simulate_to_threshold(...)
>>> results.outputs.plot()
>>> results.states.plot()

See progpy.sim_result.SimResult.plot() for more details on plotting capabilities

Combination Models#

There are two methods in progpy through which multiple models can be combined and used together: composite models and ensemble models, described below.

Composite models are used to represent the behavior of a system of interconnected systems. Each system is represented by its own model. These models are combined into a single composite model which behaves as a single model. When definiting the composite model the user provides a discription of any connections between the state or output of one model and the input of another. For example,

>>> m = CompositeModel(
>>>     models = [model1, model2],
>>>     connections = [
>>>         ('model1.state1', 'model2.input1'),
>>>         ('model2.state2', 'model1.input2')
>>>     ]
>>> )

For more information, see the example below:

Other Examples#

Tips#

  • If you’re only doing diagnostics without prognostics- just define a next_state equation with no change of state and don’t perform prediction. The state estimator can still be used to estimate if any of the events have occured.

  • Sudden event’s use a binary event state (1=healthy, 0=failed).

  • You can predict as many events as you would like, sometimes one event must happen before another, in this case the event occurance for event 1 can be a part of the equation for event 2 (‘event 2’: event_1 and [OTHER LOGIC]).

References#

Goebel2017

Kai Goebel, Matthew John Daigle, Abhinav Saxena, Indranil Roychoudhury, Shankar Sankararaman, and José R Celaya. Prognostics: The science of making predictions. 2017

Celaya2012

J Celaya, A Saxena, and K Goebel. Uncertainty representation and interpretation in model-based prognostics algorithms based on Kalman filter estimation. Annual Conference of the Prognostics and Health Management Society, 2012.

Sankararaman2011

S Sankararaman, Y Ling, C Shantz, and S Mahadevan. Uncertainty quantification in fatigue crack growth prognosis. International Journal of Prognostics and Health Management, vol. 2, no. 1, 2011.