Upon exiting the code below, this._P will always be set to this._MaxP for non-zero values of this._P. This doesn't make any sense.
this._e = this._Tref - actualTemperature; // Calculate the actual error
// Calculate the P
this._P = this._Kp * this._e;
if (this._P) { // <------------------------------ this will always be true for non-zero values of this._P
this._P = this._MaxP;
}
else if (this._P < (-1 * this._MaxP)) {
this._P = -1 * this._MaxP;
}
Upon exiting the code below, this._P will always be set to this._MaxP for non-zero values of this._P. This doesn't make any sense.
this._e = this._Tref - actualTemperature; // Calculate the actual error
// Calculate the P this._P = this._Kp * this._e;
if (this._P) { // <------------------------------ this will always be true for non-zero values of this._P this._P = this._MaxP; } else if (this._P < (-1 * this._MaxP)) { this._P = -1 * this._MaxP; }