# Adaptive Hierarchical Sliding Mode Control for Double-Pendulum Gantry Crane Based on Neural Network
## 2 The Dynamic Modeling of a Crane's Double-Pendulum System  
The complexity of the kinematic analysis is attributable to various factors, including wind force and cable deformation, which interfere with the crane's actual working process. In order to facilitate analysis and calculation, the following assumptions are made for the crane's hoisting system:  
1. During crane operation, the motion of the crane trolley is ignored, and the crane's movement is simplified to only consider the motion of the hoisting trolley within a two-dimensional plane. 2. When studying the crane's single-pendulum model, the hook and load are considered as a single point mass, and the distance between the load and the center of mass of the hook is neglected. 3. When studying the crane's double-pendulum model, both the hook and the load are considered as uniformly distributed spherical masses, with the hook as point mass 1 and the load as point mass 2. 4. During crane operation, the deformation of the hoisting rope and the mass of the rope are neglected. 5. The friction between the hook and the load, as well as air resistance and wind force, are not considered. Through these simplifying assumptions, we can transform the complex crane single-pendulum system and double-pendulum system into a more idealized dynamic model, facilitating subsequent numerical analysis and control strategy design. The double-pendulum model of the crane system takes into account the distance between the center of mass of the hook and the center of mass of the load, no longer treating the hook and the load as a single point mass. The physical model of the crane double pendulum is shown in Figure 1.  
In Figure 1, M represents the mass of the trolley. \(m_{1}\) and \(m_{2}\) represent the masses of the hook and the load, respectively. \(\theta_{1}\) is the angle of the pendulum length \(l_{1}\) relative to the vertical direction, and \(\theta_{2}\) is the angle between the hook and the load relative to the vertical direction. The ratio of the pendulum lengths is defined as \(l_{1}\):\(l_{2}\). Similarly, an xoy coordinate system is established, with the direction of the trolley's motion along the positive \(x\)-axis. The plane of the trolley's motion is taken as the zero potential energy surface, and the positive direction of the load lifting is along the positive \(y\)-axis. The relevant data are shown in Table 1.  
The equations of motion for this system are derived using the Lagrange method [20; 21]. The complete derivation, which involves the calculation of kinetic energy, potential energy, and the Lagrangian operator, is detailed in Appendix A at the end of this paper. The final dynamic equations derived can be written in the following matrix form (neglecting the external resistance acting on the system):  
\[M(q)\ddot{q}+C(q,\dot{q})\dot{q}+G(q)=F \tag{1}\]  
In the equations, \(M(q)\) is the symmetric positive definite mass matrix, \(C(q,\dot{q})\) is the damping element matrix, \(G(q)\) is the gravitational vector, \(F=[u,0,0]^{T}\) is the control input for the crane system, and \(u\) is the control force applied to the hoisting trolley, which is given in the following form:  
\[M= \begin{bmatrix}M+m_{1}+m_{2}&(m_{1}+m_{2})l_{1}\cos\theta_{1}&m_{2}l_{2}\cos \theta_{2}\\ (m_{1}+m_{2})l_{1}\cos\theta_{1}&(m_{1}+m_{2})l_{1}^{2}&m_{2}l_{1}l_{2}\cos( \theta_{1}-\theta_{2})\\ m_{2}l_{2}\cos\theta_{2}&m_{2}l_{1}l_{2}\cos(\theta_{1}-\theta_{2})&m_{2}{l_{ 2}}^{2}\end{bmatrix}  \tag{2}\]  
\[C= \begin{bmatrix}(m_{1}+m_{2})\left(2l_{1}\;\dot{x}\dot{\theta}_{1}\;cos\theta _{1}-l_{1}\;\theta_{1}^{2}\;sin\theta_{1}\;)-m_{2}\;l_{2}\;\dot{\theta}_{2}^{ 2}\;sin\theta_{2}\;+f\dot{x}\\ (m_{1}+m_{2})\left(2l_{1}\;\dot{\theta}_{1}\;-m_{2}\;l_{1}\;l_{2}\;\dot{\theta }_{2}^{2}\;sin(\theta_{1}\;-\theta_{2}\;)\right.\\ \left.m_{2}\left(2l_{1}\;l_{2}\;\dot{\theta}_{1}\;\dot{\theta}_{2}\;cos(\theta _{1}\;-\theta_{2})-l_{1}\;\dot{\theta}_{1}^{2}\;sin(\theta_{1}-\theta_{2}\;) \right)\right.\end{bmatrix}  \tag{3}\]  
\[G=