nasa / progpy

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.
https://nasa.github.io/progpy/
Other
52 stars 7 forks source link

Including effect of inputs vector in the output of a model #141

Closed WardLT closed 1 month ago

WardLT commented 2 months ago

Requirement Text I would like to include a model where the control vector has an influence on the measured outputs, but the interface to PrognosticsModel only includes the state as input.

Background Information I'm implementing a single-resistor (R_int) equivalent circuit model.

Suggested Solution Add u to the inputs of PrognosticModel.output, update the use of the model in the various StateEstimator classes.

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

teubert commented 1 month ago

Hello @WardLT

Thanks for your suggestion. Sorry for the delay - I was on paternity leave until this week.

You're describing a pretty common case that we've run into with many of our models. The recommended solution for this is to include your control input in the state vector. This is referred internally as a "pass-through input".

There's a few reasons for this:

  1. We made a design decision early on that the state of the system (used to derive outputs, event states, threshold met, etc.) be completely described by the state vector to simplify and clean model design
  2. Many of the tools we've built rely on this assumption.

I've looked through our public models and cant find an example of passthrough inputs, but it's present in a few of the nasa-internal models.

It would look something like this:

class MyModel:
    def next_state(self, x, u, dt):
        ... # Logic of model
        next_x['some_input'] = u['some_input'] # passthrough input

    def output(self, x):
        # use x['some_input']

Is this an adequate solution to your problem? Let me know if this doesn't solve it and we can talk more about your proposed solution.

WardLT commented 1 month ago

First, congrats!

Second, passthrough inputs makes sense and I don't forsee it becoming a problem. I'll go ahead and close my PR then find out if I can make this work with our models.