PID auto tune unit test
This commit is contained in:
parent
dcdbd433ab
commit
dd2f17a332
|
@ -1,6 +1,6 @@
|
|||
// auto-generated from.\controllers/algo/rusefi_enums.h
|
||||
// by enum2string.jar tool
|
||||
// on Wed Nov 21 21:47:19 EST 2018
|
||||
// on Thu Nov 22 18:48:26 EST 2018
|
||||
// see also gen_config_and_enums.bat
|
||||
|
||||
|
||||
|
@ -946,3 +946,31 @@ case TCHARGE_MODE_RPM_TPS:
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
const char *getPidAutoTune_Peak(PidAutoTune_Peak value){
|
||||
switch(value) {
|
||||
case MAXIMUM:
|
||||
return "MAXIMUM";
|
||||
case NOT_A_PEAK:
|
||||
return "NOT_A_PEAK";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
const char *getPidAutoTune_AutoTunerState(PidAutoTune_AutoTunerState value){
|
||||
switch(value) {
|
||||
case AUTOTUNER_OFF:
|
||||
return "AUTOTUNER_OFF";
|
||||
case CONVERGED:
|
||||
return "CONVERGED";
|
||||
case FAILED:
|
||||
return "FAILED";
|
||||
case RELAY_STEP_DOWN:
|
||||
return "RELAY_STEP_DOWN";
|
||||
case RELAY_STEP_UP:
|
||||
return "RELAY_STEP_UP";
|
||||
case STEADY_STATE_AFTER_STEP_UP:
|
||||
return "STEADY_STATE_AFTER_STEP_UP";
|
||||
case STEADY_STATE_AT_BASELINE:
|
||||
return "STEADY_STATE_AT_BASELINE";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// auto-generated from.\controllers/algo/rusefi_enums.h
|
||||
// by enum2string.jar tool
|
||||
// on Wed Nov 21 20:48:18 EST 2018
|
||||
// on Thu Nov 22 18:48:26 EST 2018
|
||||
// see also gen_config_and_enums.bat
|
||||
|
||||
|
||||
|
@ -43,4 +43,6 @@ const char *getChamber_style_e(chamber_style_e value);
|
|||
const char *getCan_nbc_e(can_nbc_e value);
|
||||
const char *getHip_state_e(hip_state_e value);
|
||||
const char *getTChargeMode_e(tChargeMode_e value);
|
||||
const char *getPidAutoTune_Peak(PidAutoTune_Peak value);
|
||||
const char *getPidAutoTune_AutoTunerState(PidAutoTune_AutoTunerState value);
|
||||
#endif /*_A_H_HEADER_ */
|
||||
|
|
|
@ -950,4 +950,23 @@ typedef enum {
|
|||
Force_4bytes_size_tChargeMode_e = ENUM_32_BITS,
|
||||
} tChargeMode_e;
|
||||
|
||||
// peak type
|
||||
typedef enum {
|
||||
MINIMUM = -1,
|
||||
NOT_A_PEAK = 0,
|
||||
MAXIMUM = 1
|
||||
} PidAutoTune_Peak;
|
||||
|
||||
// auto tuner state
|
||||
typedef enum {
|
||||
AUTOTUNER_OFF = 0,
|
||||
STEADY_STATE_AT_BASELINE = 1,
|
||||
STEADY_STATE_AFTER_STEP_UP = 2,
|
||||
RELAY_STEP_UP = 4,
|
||||
RELAY_STEP_DOWN = 8,
|
||||
CONVERGED = 16,
|
||||
FAILED = 128
|
||||
} PidAutoTune_AutoTunerState;
|
||||
|
||||
|
||||
#endif /* RUSEFI_ENUMS_H_ */
|
||||
|
|
|
@ -94,17 +94,17 @@ double PID_AutoTune::calculatePhaseLag(double inducedAmplitude)
|
|||
}
|
||||
}
|
||||
|
||||
void PID_AutoTune::setState(AutoTunerState state) {
|
||||
void PID_AutoTune::setState(PidAutoTune_AutoTunerState state) {
|
||||
this->state = state;
|
||||
#if EFI_UNIT_TEST
|
||||
printf("setState %d\r\n", state);
|
||||
printf("setState %s\r\n", getPidAutoTune_AutoTunerState(state));
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
}
|
||||
|
||||
void PID_AutoTune::setPeakType(Peak peakType) {
|
||||
void PID_AutoTune::setPeakType(PidAutoTune_Peak peakType) {
|
||||
this->peakType = peakType;
|
||||
#if EFI_UNIT_TEST
|
||||
printf("peakType %d\r\n", peakType);
|
||||
printf("peakType %s\r\n", getPidAutoTune_Peak(peakType));
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
}
|
||||
|
||||
|
|
|
@ -95,26 +95,6 @@ public:
|
|||
NO_OVERSHOOT_PID
|
||||
};
|
||||
|
||||
// peak type
|
||||
enum Peak
|
||||
{
|
||||
MINIMUM = -1,
|
||||
NOT_A_PEAK = 0,
|
||||
MAXIMUM = 1
|
||||
};
|
||||
|
||||
// auto tuner state
|
||||
enum AutoTunerState
|
||||
{
|
||||
AUTOTUNER_OFF = 0,
|
||||
STEADY_STATE_AT_BASELINE = 1,
|
||||
STEADY_STATE_AFTER_STEP_UP = 2,
|
||||
RELAY_STEP_UP = 4,
|
||||
RELAY_STEP_DOWN = 8,
|
||||
CONVERGED = 16,
|
||||
FAILED = 128
|
||||
};
|
||||
|
||||
// tuning rule divisor
|
||||
enum
|
||||
{
|
||||
|
@ -162,8 +142,8 @@ public:
|
|||
unsigned long sampleTime;
|
||||
byte nLookBack;
|
||||
|
||||
void setState(AutoTunerState state);
|
||||
void setPeakType(Peak peakType);
|
||||
void setState(PidAutoTune_AutoTunerState state);
|
||||
void setPeakType(PidAutoTune_Peak peakType);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -177,9 +157,9 @@ private:
|
|||
double noiseBand;
|
||||
byte controlType; // * selects autotune algorithm
|
||||
|
||||
enum AutoTunerState state; // * state of autotuner finite state machine
|
||||
PidAutoTune_AutoTunerState state; // * state of autotuner finite state machine
|
||||
unsigned long lastTime;
|
||||
enum Peak peakType;
|
||||
PidAutoTune_Peak peakType;
|
||||
unsigned long lastPeakTime[STEPCOUNT]; // * peak time, most recent in array element 0
|
||||
double lastPeaks[STEPCOUNT]; // * peak value, most recent in array element 0
|
||||
double lastInputs[101]; // * process values, most recent in array element 0
|
||||
|
|
Loading…
Reference in New Issue