This is a fun ad-hoc solution to a simple controls problem I had.
I have an error term for a controller where the sample period has to be large, and the measurements are noisy. But I also have a a really high tolerance for error around the setpoint, and the purpose of the controller is to provide more consistent control and noise behavior within some constraints. As long as the temperature stays close to the setpoint and does not wander too far, I don't care how noisy the process is so long as the controller's behavior is flat. So I have an opportunity to replace the normal error measurement with something else.
Within a few degrees of the setpoint, we can curve the error, and we need to fit the curve so that it lines up with our normal linear error. Here is an explanation of the simple formula that accomplishes that.
I want to consider the mapping between real error (measurement - setpoint in our sign convention) and the curve we will construct. Above some threshold EB, the curve is a line. Below some threshold EA, we want the error to flatten completely and be pegged to zero. This will tell the system: if it's close enough, error deteriorates, and if it's very close, error is worthless.
My curve looks like κexp(αE). I need to find κ and α. I want to set it so I get a value of EB when error is EB, and 0 when error is EA. I can't do that, of course, because the curve is just an exponent. Do I need a more sophisticated mechanism? Well, maybe. But maybe not, if I can approximate with a simple one. I can choose a parameter EZ close enough to zero like 0.05. Introducing a step here does not seem to cause problems in practice, and I can choose the EZ value carefully so any discontinuity in controller behavior is much less than one degree---and less than my measurement noise---by considering the values of P, I, D terms.
So now I have a pair:

So:

Rewrite as:


Or, to simplify:

And this was my construction for the new error. This is a rudimentary approach that ended up working really well in practice. There's absolutely nothing new or groundbreaking about this, I just liked that such a barn-door solution can work so well for the right application. The fan will oscillate when there is a substantial thermal change, then come pretty rapidly to a level state, and then make small adjustments after that as necessary. It works really well. Why do I have such a high demand for consistent behavior? It's because the fan is going in my office! And the sound is way less distracting this way. 👍