PID logging: p term #4337
This commit is contained in:
parent
575a0b3d5d
commit
4c4f494904
|
@ -240,6 +240,7 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 0
|
||||||
int8_t[4 iterate] autoscale vvtTargets;;"deg",1, 0, 0, 0, 0
|
int8_t[4 iterate] autoscale vvtTargets;;"deg",1, 0, 0, 0, 0
|
||||||
uint16_t turboSpeed;@@GAUGE_NAME_TURBO_SPEED@@;"hz",1, 0, 0, 0, 0
|
uint16_t turboSpeed;@@GAUGE_NAME_TURBO_SPEED@@;"hz",1, 0, 0, 0, 0
|
||||||
|
|
||||||
|
! fun fact: we have a separate pid_state.txt file for a bit of a different structure huh?
|
||||||
struct pid_status_s
|
struct pid_status_s
|
||||||
float autoscale pTerm;;"", 1, 0, -50000, 50000, 2
|
float autoscale pTerm;;"", 1, 0, -50000, 50000, 2
|
||||||
int16_t autoscale iTerm;;"", 0.01, 0, -327, 327, 2
|
int16_t autoscale iTerm;;"", 0.01, 0, -327, 327, 2
|
||||||
|
|
|
@ -137,7 +137,8 @@ void Pid::postState(TunerStudioOutputChannels *tsOutputChannels) const {
|
||||||
|
|
||||||
void Pid::postState(pid_status_s& pidStatus) const {
|
void Pid::postState(pid_status_s& pidStatus) const {
|
||||||
pidStatus.output = output;
|
pidStatus.output = output;
|
||||||
pidStatus.error = getPrevError();
|
pidStatus.error = previousError;
|
||||||
|
pidStatus.pTerm = parameters == nullptr ? 0 : parameters->pFactor * previousError;
|
||||||
pidStatus.iTerm = iTerm;
|
pidStatus.iTerm = iTerm;
|
||||||
pidStatus.dTerm = dTerm;
|
pidStatus.dTerm = dTerm;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
float iTermMin = -1000000.0;
|
float iTermMin = -1000000.0;
|
||||||
float iTermMax = 1000000.0;
|
float iTermMax = 1000000.0;
|
||||||
protected:
|
protected:
|
||||||
pid_s *parameters;
|
pid_s *parameters = nullptr;
|
||||||
virtual void updateITerm(float value);
|
virtual void updateITerm(float value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
struct_no_prefix pid_state_s
|
struct_no_prefix pid_state_s
|
||||||
float pTerm;
|
|
||||||
float iTerm;
|
float iTerm;
|
||||||
float dTerm;we are remembering this only for debugging purposes
|
float dTerm;we are remembering this only for debugging purposes
|
||||||
float target;only used for logging
|
float target;only used for logging
|
||||||
|
|
Loading…
Reference in New Issue