equinor/TimeSeriesAnalysis

Handover GainSchedIdentify

Closed this issue · 1 comments

Summary

There is attempted to make a GainSchedIdentify extension in Model Expert and the unit tests are showing that

This is working:

  • The GainSchedThresholds are always inside of the [umin, umax] window.
  • The time constants are always positive.

This is not working:

  • The GainSchedThresholds are not always placed at a reasonable/correct place.
  • The time constants (T) are not always at the expected values (often being T = 0s).

Limitations of the solution:

  • The GainSchedIdentify function is assuming that the correct model is one of these models:
    - 1 gain and 1 time constant.
    - 2 gains and 2 time constants.

Pseudo code of the GainSchedIdentify

function GainSchedIdentify(dataSet, fittingSpecs=null){
     // 1 gain, 1 time constant
     1_gain_1_time_constant_model = UnitIdentifyLinear(dataSet);
     
     // 2 gains, 2 time constants
     2_gains_2_time_constants_models = []
     // reasonable_thresholds is uniformly distributed around the middle of the gain sched parameter in dataSet
     for reasonable_threshold in reasonable_thresholds: 
          fitting_specs_for_first_part = some_func1(reasonable_threshold);
          first_part_model = UnitIdentifyLinear(dataSet, fitting_specs_for_first_part)
          fitting_specs_for_second_part = some_func2(reasonable_threshold);
          second_part_model = UnitIdentifyLinear(dataSet, fitting_specs_for_second_part)
          2_gains_2_time_constants_models.append(combine(first_part_model , second_part_model)
     
     // Evaluate and return
     all_possible_models = 1_gain_1_time_constant_model + 2_gains_2_time_constants_models
     best_model = model_with_lowest_rms_between_measured_and_modeled_data(all_possible_models);
     return best_model;
}

Nice to know

  • To solve the problem around finding the correct thresholds it is suggested (by Steinar) to use information about the solution found by the UnitIdentify for 1 gain and 1 time constant. However, using the inbuild fitting evaluations in UnitIdentify, makes it hard to get reasonable linearization points (U0), which is the reason for why the reasonable_thresholds is hardcoded to be normally distributed. Having wrong (or none) U0 makes it harder for the UnitIdentify to find the correct gains and time constants.
  • UnitIdentifier also have a build-in fitting parameter which can be used to evaluate the fitting score of how good the identification was. However, this fitting score is not used to evaluate the identification because there where made a simple rms evaluation to verify that the function works as intended (less black box). One should consider to utilize the fitting calculations done in the UnitIdentifier to reduce running time.

I have gone over the code and merged into master.