## 2 Materials and Methods
### Formulation of Restriction Conditions  
Equation (12) should be repeated for all system restrictions, corresponding to all pantograph-catenary contacts. The number of restrictions will depend on the number of possible contacts. Thus, for the pantograph with one head mass, two possible contacts exist because the pantograph can interact with up to two catenaries when crossing the common contact zone.  
If the pantograph has two head masses, there will be four possible contacts, and if two pantographs are considered in the simulation, the restriction conditions must be repeated for the second pantograph. Thus, Equation (12) is a matrix equation whose number of rows corresponds to the number of restriction conditions and whose number of columns corresponds to the number of degrees of freedom.  
To simplify the model, we assume a single pantograph with a single head mass. Because there can be up to two contacts, the matrix of constraint conditions expressed for a moment \(t_{n}\) has the form:  
\[\varnothing_{n}=\left(\begin{array}{c}\varnothing_{1n}\\ \varnothing_{2n}\end{array}\right) \tag{13}\]  
where the row vector \(\varphi_{1n}\) represents the restriction conditions of contact element 1 on catenary 1, and \(\varphi_{2n}\) represents the restriction conditions of contact element 2 on catenary 2, according to Figure 5. In the formulation of Equation (13), the following cases are considered, as shown in Figure 6.  
1. The pantograph circulates through catenary 1 without reaching the common transition zone of the two catenaries, defined from the overlapping spans. In this case, interaction only exists with catenary 1 through contact element 1, and contact element 1 is activated and contact element 2 is deactivated.
2. The pantograph circulates through catenary 2, having exceeded the common transition zone. In this case, there will only be interaction with catenary 2 through contact element 2; thus, contact element 2 is activated and contact element 1 is deactivated.
3. The pantograph circulates in the common transition zone between the two catenaries. In this case, the pantograph interacts with the two catenaries, and the two contact elements are activated.  
In the first case, the vector \(\varphi_{1n}\) is calculated according to Equation (8), whereas the position of contact element 1, \((y_{3})_{n}\), is calculated according to Equation (10). Because contact element 2 is deactivated, the restriction condition \(\varphi_{2n}\) is formulated by requiring that the position of contact element 2, \((y_{4})_{n}\), and the position of the head mass, \((y_{2})_{n}\), at time \(t_{n}\), be coincident; that is:  
\[\left(y_{2}\right)_{n}-\left(y_{4}\right)_{n}=0 \tag{14}\]The second case is similar to the first, but with alternating conditions: \(\varphi_{1n}\) is obtained by imposing the condition that the position of contact element 1, \((y_{3})_{n}\), and the position of the head mass, \((y_{2})_{n}\), at instant \(t_{n}\) are coincident:  
\[\left(y_{2}\right)_{n}-\left(y_{3}\right)_{n}=0 \tag{15}\]  
Matrix \(\varphi_{2n}\) and the position of contact element 2, \((y_{4})_{n}\), are calculated with equations similar to Equations (8) and (10). Finally, it must be taken into account that, regardless of the catenary with which the interaction occurs, the contact force can be canceled out because of a take-off or can appear suddenly after a take-off when a new coupling occurs. These circumstances must be considered when integrating Equation (1), as explained in the following section.