## 4 Controller Design
### Variable Gain I-Controller Design  
The goal of adding an I-part to the controller is to facilitate disturbance rejection by integrating the reference error over time and scaling it by using a gain. In a constant gain I-controller, the gain is tuned to and fixed at a value dependent on the controlled plant. It is simple, easy to implement and does not necessarily require the plant model for correct design and unlike a proportional controller, it allows for complete error compensation in a step response. The problem with using a constant gain I-controller is as follows. The feed-forward controller can immediately supply a rough estimate for input pressures, but  
Figure 16: Output from algorithm 1 vs. Interpolation. Figure 14: Calculated input pressures and approximated surface for bellow 1. Figure 15: Surface approximation for \(P_{qgr}=3.6\):0.6:15 [bar] for bellows 1.  
it is never clear before the movement ends how good this estimation is. Therefore, if the estimate is optimal, a constant gain I-controller would cause an overshoot, requiring the controller to be slow. On the other hand, if the estimation is sub-optimal, an aggressive constant gain I-controller is needed to quickly compensate for the error. This contradiction in requirements can be solved by applying a variable gain I-controller, with the gain dependent on the error, see Equation (12)  
\[u(t)=K_{i}\Big{(}e(t)\Big{)}\int_{0}^{t}e(t)\,dt \tag{12}\]  
where \(K_{i}\Big{(}e(t)\Big{)}\) is the controller gain, \(e(t)\) is the tilt error, \(t\) is time and \(u(t)\) is the controller output. The idea behind the error-dependent controller gain is to keep the integral action small at the beginning of the movement, before it is clear how good the feed-forward action is, and increase it as the module posture reaches the desired posture. This decreases overshoot while increasing error elimination speed. The relationship between I-controller gain and tilt error can be described by different types of smooth monotonic functions, like linear, exponential etc. For this controller, as a proof of concept a linear relationship was chosen, see Equation (13). \[K_{i}=ae_{t}(t)+b \tag{13}\]  
\[e_{t}(t)=\sqrt{e_{x}^{2}(t)+e_{y}^{2}(t)} \tag{14}\]  
where \(e_{t}(t)\) is the tilt error, \(e_{x}(t)\) is the tilt error about the \(x\)-axis and \(e_{y}(t)\) is the tilt error about the \(y\)-axis. Parameters \(a\) and \(b\) were calculated from experimental data, where \(K_{i}=350\) was found to work well for small total error values below \(1^{\circ}\) and \(K_{i}=75\) was found to not cause significant overshoot at error values above \(5^{\circ}\). This relationship is described by Equation (15) and can be seen in Figure 17  
\[K_{i}=-68.75e_{t}+418.75 \tag{15}\]  
The comparison between the performance of a constant gain I-controller and our variable gain controller in combination with our feed-forward controller is depicted in Figure 18. One can see, that in Figure 18a,b a gain of 350 results in a significant overshoot, but for small changes in tilt and a large residual error after feed-forward controller action, like in Figure 18c, the controller is fast and has acceptable overshoot. On the other hand, a gain of 75 has no overshoot in any case but is slow and has the best performance if the residual error from feed-forward controller action is small, like in Figure 18b. The  
Figure 17: Tilt error in dependence on I-controller gain. performance of both fixed gain controllers in Figure 18c is not satisfactory. Our variable gain controller performs satisfactory in all cases. As mentioned above, for our controller, we have chosen a linear relationship to govern the variable gain. A linear relationship is simple, is easy to tune and should result in predictable behaviour of the module. Nevertheless, other types of functions like exponential, polynomial or even logarithmic can also be applied and could result in better controller performance than with a linear equation.