# An Anti-Swing Closed-Loop Control Strategy for Overhead Cranes
## 3 Controller Design and Analysis  
A dual-loop feedback control system was proposed to realize the swing attenuation of the payload. The swing angle and displacement were measured in real time and were used as a feedback into the model predictive controller (MPC), as illustrated in the block diagram of the proposed control system in Figure 3. The MPC method was adopted to find future control input changes to reduce errors caused by the load swings. The desired swing angle with reference trajectories was also the input of the controller. A disturbance predictor was used to estimate the real-time value of the equivalent input disturbance \(\sigma_{e}\).  
(1) Estimation of Equivalent Input Disturbances  
\[\dot{\hat{z}}=A\hat{z}+Bu_{f}+L(y-C\hat{z}) \tag{7}\]  
Figure 3: The block diagram of the proposed closed-loop control system.  
\(L\) is the observer gain. Define \(\Delta z=\hat{z}-z\), \(\sigma=B\sigma_{e}\), we have  
\[\hat{z}=A\hat{z}+Bu+B\sigma_{e}+(\Delta\hat{z}-A\Delta z) \tag{8}\]  
Suppose there exists a \(\Delta\sigma\) satisfying  
\[\Delta\hat{z}-A\Delta z=B\Delta\sigma \tag{9}\]  
Combine (8) and (9):  
\[\hat{z}=A\hat{z}+B(u_{f}+\hat{\sigma}_{e}) \tag{10}\]  
where \(\hat{\sigma}_{e}=\sigma_{e}+\Delta\sigma\), combine (8) with (10):  
\[B(u+\hat{\sigma}_{e}-u_{f})=L(y-C\hat{z}) \tag{11}\]  
At the same time on both sides, multiply by \(B^{\rm T}\):  
\[\hat{\sigma}_{e}=B^{+}L(y-C\hat{z})+u-u_{f} \tag{12}\]  
Take the value of \(\hat{\sigma}_{e}\) as the predicted value of the equivalent input disturbance \(\sigma_{e}\), where \(B^{+}=\left(B^{\rm T}B\right)^{-1}B^{\rm T}\). In addition, in order to ensure the accuracy of the equivalent input disturbance prediction, we introduced a low-pass filter \(F(s)\) to adjust the predicted frequency segment:  
\[F(s)=\frac{1}{T\rm s+1} \tag{13}\]  
where \(T\) is a time constant.  
(2) Control Algorithm  
The sampling period was selected as \(T_{m}\), and the linear part system can be discretized as follows:  
\[\left\{\begin{array}{l}z_{m}(k+1)=A_{p}z_{m}(k)+B_{p}u(k)\\ y(k)=C_{p}z_{m}(k)\end{array}\right.,C_{p}=I_{4\times 4} \tag{14}\]  
where \(z_{m}(k)\) and \(y(k)\) denote the system state and the output at time \(k\), respectively, and \(A_{p}{\in}\)R\({}^{4\times 4}\), \(B_{p}{\in}\)R\({}^{4\times 1}\) represent the discrete system parameter matrices. I\({}_{4\times 4}{\in}\)R\({}^{4\times 4}\) is the \(4\times 4\) identity matrix, which can be calculated as  
\[A_{P}=\exp(AT_{m}),B_{P}=A^{-1}\ (A_{P}-I_{4\times 4})B\]  
where \(\exp(*)\) represents the natural exponential function. Next, we proposed a proper MPC formula to control this discrete system (14).  
For the crane system, our purpose was to transport the payload to the desired position without residual oscillation, with the desired transportation distance defined as \(x_{d}\), while the target of the output vector \(y(k)\) was defined as  
\[y_{f}=\left[\begin{array}{cccc}x_{d}&0&0&0\end{array}\right]^{\rm T}\]  
To calculate the optimal input, a cost function is defined as  
\[J(k_{i})=\left\|w_{p}(k_{i})-y(k_{i})\ \right\|_{Q}^{2}+\left\|\Delta u(k_{i}) \right\|_{R}^{2} \tag{15}\]  
where \(Q\), \(R\) are the error weight matrix and control weight matrix, respectively, and \(w_{P}(k_{i})\) is the reference output value, which are defined as \[w_{P}(k_{i})=\left[\begin{array}{cccc}w(k_{i}+1)&w(k_{i}+2)&\cdots&w(k_{i}+P) \end{array}\right]^{\mathrm{T}}\] \[Q=diag(\begin{array}{cccc}q_{1}&\cdots&q_{P}\end{array})\] \[R=diag(\begin{array}{cccc}r_{1}&\cdots&r_{P}\end{array})\]  
At each sampling time, the trolley needs to track a proper trajectory to reach the target position. The reference trajectory with the soften factor is designed as follows:  
\[r(\bullet)=w_{p}(k)=f(y(k-1),y_{f}) \tag{16}\]