nasa / GSAP

Generic Software Architecture for Prognostics (GSAP)
Other
20 stars 6 forks source link

Added getModel() method #142

Closed teubert closed 1 year ago

teubert commented 3 years ago

getModel method provides access to the underlying model in the prognoser. This access is required to be able to calculate output parameters from state (which is returned in prediction).

auto stateSamples = eod_event.getSystemState()[0]; // Get current system state
std::vector<double> state;
for (auto sample : stateSamples) {
    state.push_back(sample[0]); // Take first sample (could be replaced with logic to get sample corresponding to median SOC
}
auto& model = ((ModelBasedPrognoser *) prognoser.get())->getModel();
auto z = model.outputEqn(now_s.count(), (PrognosticsModel::state_type) state);
std::cout << "\ttemp: " << z[model.indices.output.Tm] << "°C" << std::endl;