## 3 Modelling and Control
### Approaching Flow Stage (AFS)
This is important to note, because the selection of \(h_{q}\) has to be always minimal (close to the smoothing length \(h\) of SPH), specially at low pouring volumes. This rationale of the AFS needs to be developed in a mathematical model such that the kinematics can be useful for slosh control. One approach used to find this model is to resolve the boundary condition equations from the velocity potential of the flow [28]. This will lead to a nonlinear and continuous formulation of the slosh that will demand a high computational cost even for a single degree of freedom of robotic kinematics. Besides being nonphysical, if it is only considered the free surface as a function of \(\theta\), its velocity and acceleration functions would lead to a high, non-linear equation to be eventually solved with the control. Instead of this, a linear model is preferred, as is applied in different modelling schemes [13; 28; 29] and that has proven equivalency for small oscillation amplitudes. This model describes the slosh in a free surface as a finite number of oscillators using poorly damped, second order pendulums with less energy dissipation. Each pendulum describes each oscillation component within the slosh. In our case, this model fits well since it only needs to find the velocity of the fundamental slosh component when SIM is used in AFS. In the graph of [30] (pp. 134-135), it is clear how the fundamental component contributes to more than the 80% of the total slosh energy, so processing the rest of the slosh components should not add a significant magnitude to the slosh velocity. Further details on this model can be found in [29]. The pendulum model does not consider flow viscosity; that plays a minor role in free surface oscillation, but it has shown to be an accurate model [29; 30]. In addition, its predictions match the SPH simulation of the present work. Figure 5 diagram describes this model, where \(L_{0}\), \(m_{0}\) and \(I_{0}\) describe the height, the mass and moment of inertia of the rigid model; \(L_{m}\), \(l_{n}\), \(m_{n}\) and \(\theta_{n}\) are the height, the pendulum distance, the mass and the angle of the \(n\)th pendular component--\(n=I\) being the fundamental pendular component. Figure 5: Pendulum model of the slosh, including \(n\)th oscillations of the free surface. Notice that \(\theta\) is the tilting angle of the vessel while \(\theta_{n}\) values are the rotation angles of the slosh components represented by \(n\) pendulums. \(g\) is the gravity force and \(A\) the liquid depth. \(I_{0}\) is the moment of inertia of the liquid volume; however, by solving [PERSON]'s equation for lateral (\(x\)) and rotational (\(\theta\)) excitations, [PERSON] in [29], ends having a slosh equation that is independent of \(I_{0}\) for rectangular and cylindrical vessels. Equation (8) shows the slosh equation of this linear model coming from this reference. \[\sum\
olimits_{n=1}^{\infty}m_{n}l_{n}\bigg{[}\Big{(}\frac{A}{2}-L_{n}-l_{n} \Big{)}\ddot{\theta}+l_{n}\ddot{\theta_{n}}+\ddot{x}\bigg{]}+\sum\
olimits_{n =1}^{\infty}m_{n}gl_{n}(\theta+\theta_{n})=0. \tag{8}\]  
Notice that Equation (8) will give a linear relationship between \(\theta\) and \(\theta_{n}\). This linearity is typically achieved by approaching the sine function of \(\theta\) of the native pendulum equation to the single variable of \(\theta\) when the angular displacements are small. Additionally, notice that Equation (8) lacks angular velocity \(\dot{\theta}_{n}\), meaning that it corresponds to an undamped time response of the slosh. If our interest is only the fundamental oscillation of the slosh and no lateral excitation will be needed (\(\ddot{x}=0\)), making \(n=1\), the slosh Equation (8) yields,  
\[-l_{1}\ddot{\theta}_{1}-g\theta_{1}=\bigg{(}\frac{A}{2}-L_{1}-l_{1}\bigg{)} \ddot{\theta}+g\theta. \tag{9}\]  
From Equation (9) and using [29], if the pendulum of interest is at \(n=1\), the distances \(L_{n}\) and \(l_{n}\), needed to complete the time response are calculated with Equations (10) and (11).