## 2 Mathematical Modelling
### Dynamics
The flexible links are modeled as a lumped model consisting of a rigid body with an additional spring and a damper at each joint, representing the links' flexibility, to compensate for the links flexibility in the two bending directions [47]. Axial flexibility is ignored as the fabric layer prevents the flexible link from stretching, and any stretching is very small and has no significant effect on the link. The weight is assumed to be at the center of mass of each link. The kinetic energy is the summation of each link the kinetic energy (K). While the potential energy is the summation of the potential energy (P). For the kinetic energy, it can be declared in terms of the angular velocities and the inertia matrices of each link, meanwhile the potential energy is only a function of the gravitational constant and the center of mass height of the individual links [48]. The general form of kinetic energy is shown in (10), where \(I_{i}\) is the second moment of inertia of the \(i\)th link at the center of mass, \(J_{vi}\) is the linear velocity of the \(i\)th link, \(J_{vi}\) is the angular velocity of the \(i\)th link, \(R_{i}\) is the rotational matrix from the link \(i\) frame to the base frame, \(m_{i}\) is the mass of the \(i\)th link, \(l_{i}\) is the length of the \(i\)th link, \((X_{i}Y_{i},Z_{i})\) is the position of the center of mass from the \(i-1\) to the \(i\)th link, \(k_{if}\) are the stiffness coefficients of the flexible \(i\)th link, and \(c_{if}\) is the damping coefficient of the \(i\)th link. Let \(S_{i}=\sin(q_{i})\), \(C_{i}=\cos(q_{i})\), \(S_{ij}=\sin(q_{i}+\dot{q}_{j})\), and \(C_{ij}=\cos(q_{i}+\dot{q}_{j})\). \[ \begin{array}{ll}k&=\dfrac{1}{2}\ \dot{q}^{2}\ \sum\limits_{i=1}^{n}\ \left[\ m_{i}J_{vi}(q)^{T}J_{vi}(q)\ +\ l_{ai}(q)^{T}R_{i}(q)I_{i}R_{i}(q)^{T}J_{ai}(q)\right]\dot{q}\\ &=\dfrac{1}{2}\dot{q}^{T}D(q)\dot{q}\end{array}  \tag{13}\]  
From Equation (13), we obtain the following:  
\[ \begin{array}{ll}k&=\dot{q}_{1}^{2}(m_{1}X_{1}^{2}+m_{1}Z_{3}^{2}+I_{1 yy}) /2+I_{3 zz}\big{(}\dot{q}_{2}+\dot{q}_{3}\big{)}^{2}/2+I_{2 zz}\dot{q}_{2}^{2}/ \\ &+(m_{2}(\big{(}\dot{q}_{2}Y_{2}-\dot{q}_{1}Z_{5}\big{)}^{2}+\big{(}\dot{q}_{ 2}l_{2}+\dot{q}_{2}X_{2}-\dot{q}_{1}Z_{5}\big{)}^{2}\\ &+\dot{q}_{1}^{2}(l_{2}C_{2}+X_{2}C_{2})-Y_{2}S_{2})^{2}+m_{3}(X_{3}(\dot{q}_{ 2}+\dot{q}_{3})+\dot{q}_{2}l_{3}+\dot{q}_{3}l_{3}+\dot{q}_{2}l_{2}C_{3}\\ &-\dot{q}_{1}Z_{3}S_{23})^{2})/2+m_{3}(\dot{q}_{2}l_{5}S_{3}-Y_{3}(\dot{q}_{2}+ \dot{q}_{3})+\dot{q}_{1}Z_{3}C_{23})^{2}/2\\ &+m_{3}q_{1}^{2}(l_{3}C_{23}+X_{3}C_{23}+l_{2}C_{2})^{2}/2+m_{3}q_{1}^{2}(l_{ 3}C_{23}+X_{3}C_{23}\\ &+l_{2}C_{2})^{2}/2+\big{(}I_{3 yy}\dot{q}_{1}^{2}C_{23}\big{)}^{2})/2+(I_{2 yy} \dot{q}_{1}^{2}C_{2}^{2})/2+(I_{2 xx}\dot{q}_{1}^{2}\dot{S}_{2}^{2})/2\end{array}  \tag{14}\]  
Figure 2: (**a**) Link 2 assembly using SOLIDWORKS; (**b**) sectional view of the VSL. The potential energy depends on the gravitational terms and the spring terms. \[ \begin{array}{ll}P&=g(m_{2}(l_{1}+Z_{2}+l_{2}S_{2})+m_{1}(l_{1}+z_{3})+m_{3}(l_ {1}+Z_{3}\\ &+l_{3}S_{23}+l_{2}S_{2})+\frac{1}{2}k_{1}l_{1}q_{1}^{2}+\frac{1}{2}k_{2}q_{2}^ {2}+\frac{1}{2}k_{3}q_{3}^{2}\end{array}  \tag{15}\]  
The Lagrangian is formulated as the subtraction of the system's kinetic energy from its potential energy, and it is expressed as a function of the generalized coordinates and their corresponding velocities [48]. \[L=K-P \tag{16}\]  
This equation is used for the equations of motion derivation for the system and involves taking the of the Lagrangian's partial derivatives regarding the generalized coordinates and velocities [3]. D is the Rayleigh dissipation function in this model it represents the damping.