# Understanding an adaptative single neuron PID controller

I only know the "vanilla" use of a Kalman filter and I am currently trying to understand an article available here (the algorithm is presented in the 6 first pages) :

In which the plant is controlled by a PID with some anti wind-up scheme, but the trick is that the three PID gains (i.e $$K_p$$, $$K_i$$ and $$K_d$$ ) are dynamically estimated via an extended Kalman filter in which the state is $$X = \begin{bmatrix}K_p \\ K_i \\K_d \end{bmatrix}$$, what is considered to be the innovation is $$e(k) = y_r(k)-y(k)$$.

But then the matrix $$H$$ is defined as $$H=\frac{\partial u}{\partial X}$$ in the paper while, as far as I know, looking at the Kalman filtering formulas depicted in the paper (for instance the innovation defined above), it should be $$H=\frac{\partial y}{\partial X}$$.

Variable used :

• $$u$$ : the command sent to the plant
• $$y$$ : the measured output of the plant
• $$y_r$$ : the setpoint
• $$K_p$$, $$K_i$$ and $$K_d$$ : the three PID gains

To me, a Kalman filter estimate is an equilibrium point (that minimizes variance) between the state that best explains the measurement and the state you predicted and therefore, the absence of a model allowing to evaluate the measurement from the state (i.e $$y_k = h(x_k)+noise$$) should be a major deal breaker for the use of a Kalman filter. but I guess I'm wrong looking at the results of this paper.

Even if I forget this "mathematical" concern I also don't get how it proceeds to make the control error converge towards 0.

• What does the "Anti-Windup" do? Jan 24 at 4:28
• When you send a new set point to your plant its rise might be restrained by actuator saturation. During this rise time error accumulates in the integrator that might necessitate large overshoots to finally "deflate". Their are various tricks that exist to prevent that. In this particular paper the integrator simply switches to integrating $e+u_{sat}-u_{unsat}$ when saturation is reached. With this scheme your integral increases when your actuator reaches its lower bound or increase when it reaches its higher bound. Jan 24 at 16:13

The paper algebra is correct, it is $$H$$ in terms of $$u$$ and not $$y$$.

This paper is as best, misleading, and has some serious mistakes, for the following reasons:

1. The EKF is applied over the neuron only, and not over the system under control. The key win of EKF is to reduce variance over known systems, as an extension of KF for nonlinear models. In here, EKF is used just for training, not for filtering and or estimation. This is acceptable, provided everybody understand this.

This reason is the key for questioning why you would wish to use EKF for training a controller.

1. A controller is not stochastic. Does not have $$w_k$$ ($$Q$$) and $$v_k$$ ($$R$$) noises. Lets assume that noise comes from the uncertainty of not knowing $$w_k$$. At best, we would explain $$Q$$. But $$R$$ has no reason at all to have a value.

2. The additional term $$\eta$$, as adaptative, has nothing to do with EKF. It is a custom modification, such as RLS which is another adaptive algorithm.

3. The results?. Anybody will defend their own results. Call the creators of the compared methods, and they will train their own methods to get the best. Not a big deal on that.

There are more remarks, but this is enough for making the point. There is no reason at all to prove why this application would converge, or be optimal or robust in any sense.

Proposed EKF

Standard EKF

Edit

This Paper EKF is applied on the Controller (!?) with input output $$e$$ and $$u$$, not on the Plant with input output $$u$$ and $$y$$ (which should be the way). For the Paper EKF, $$u$$ is an output (!?), so $$H={\partial h \over \partial x}$$ is a derivative over the nonlinear component of the neuron, since $$z=h(x)$$ (in the Standard EKF) $$\to u=h(\omega)$$ (in the paper "way of thinking").

Besides, the $$\eta$$ factor obfuscates even more the Paper EKF. The term instead of $$\eta K (y-y_r)$$ should be $$K (u-h(\omega))$$. Again, why there is an stochastic uncertainty assumption (i.e. a noise in $$u=h(\omega)+v$$) between $$u$$ and $$h(\omega)$$ is an out of comprehension mistake from the authors and editors in wherever that paper got published.

In doing this, the Paper EKF in a huge naive way assumes the plant (inverse) response, instead of a proper dynamical model $$G^{-1}(y-y_r)$$, is simply a variant scalar $$\eta$$. Too disappointing.

• First of all thank you very much for this extensive answer! However I still fail to see how this implementation this Kalman filter makes sense with $e(k)=y_r(k)-y(k)$. From my knowledge, in accordance with the paper model you perfectly described, the innovation should instead be in terms of $u(k)$, the command. As you wrote it, in the traditional EKF, we have $\textbf{H}_k = \frac{\partial h}{\partial \textbf{X}}\biggr\rvert_{\hat{\textbf{x}}_{k|k-1}}$. To me, it forces us to use $\textbf{z}_k-h(\hat{\textbf{x}}_{k|k-1})$ as an innovation. Jan 23 at 15:25
• Please check the edit Jan 24 at 3:13
• Thank you again for your valuable edit. If I understood what you said, they actually input $(u-h(w))$ as the innovation inside the filter under the hidden assumption that $(u-h(w) ) = \eta (y_r(k)-y(k))$. And for what I got they tuned this $\eta$ parameter as an hyperparameter that serves a gain for the plant model. Is that correct? Jan 24 at 15:58
• As inverse of the gain, yes. But under the assumption your plant is (time varying smooth) constant, then the overall objective of using an adaptive neuron is difficult to justify under robustness sense. Unless that $\eta$ factor is very well adapted to the operational point of the plant (?). Jan 25 at 21:57