# Towards a Digital Twin for Open-Frame Underwater Vehicles Using Evolutionary Algorithms
## 4 BlueROV2 Case
### Digital Twin Setup  
To test the desired autonomous behaviors for the inspection and maintenance of offshore structures using underwater vehicles without risking them or their equipment, a complete simulation environment was set up. This environment relied on the Gazebo [42] simulator with the Unmanned Underwater Vehicle Simulator (UUV Simulator) package [11] to simulate physical effects, such as the propellers, water currents, interactions with other objects, etc., but also included the control logic of the autopilot. This approach allowed the same code to be executed on both real and simulated vehicles and to even use them simultaneously and seamlessly to test coordination strategies. The mathematical modeling for the simulations was based on [PERSON]'s [43] equations. For  
Figure 2: BlueROV2 prepared for tests. this study, the Society of Naval Architects and Marine Engineers (SNAME) notation [44] was used, and a summary is shown in Table 1.  
For a six-degree-of-freedom underwater vehicle, the matrix form of the equations of motion could then be expressed using the following:  
\(M_{RB}\) as the rigid-body matrix. \(\dot{\
u}\) as the rate of change of the velocity \(\
u\) with respect to time. \(C_{RB}\) (\(\
u\)) as the rigid-body Coriolis and centripetal matrix induced by \(M_{RB}\) due to the rotation of the body frame about the north, east, down (NED) world frame. \(\
u\) as the vehicle velocity vector. \(M_{A}\) as the added mass matrix. \(\dot{v_{w}}\) as the rate of change of the velocity \(v_{w}\) with respect to time. \(C_{A}\) (\(v_{w}\)) as the added mass Coriolis and centripetal matrix induced by \(M_{A}\) due to the rotation of the body frame about the NED world frame. \(v_{w}\) as the relative velocity vector. \(\mathrm{D}(v_{w})\) as the damping matrix. \(\mathrm{g}(\eta)\) as the restoring forces vector. \(\tau\) as a vector with all the external forces and moments actuating in the vehicle. \[M_{RB}\dot{\
u}+C_{RB}(\
u)\
u+M_{A}\dot{v_{w}}+C_{A}(v_{w})v_{w}+\mathrm{D}(v _{w})v_{w}+\mathrm{g}(\eta)=\tau \tag{1}\]  
The relative velocity vector \(v_{w}\) can be calculated using the vehicle velocity \(v\) and the current velocities in the fluid around the vehicle \(v_{c}\) and thus be expressed as:  
\[v_{w}=\
u-v_{c} \tag{2}\]  
A series of common assumptions when modeling underwater vehicles [45] could then be applied to simplify the equations and reduce the number of coefficients to be estimated:  
* Assumption 1. The vehicle is assumed to be rigid, and 6 degrees of freedom (DOF) are considered. * Assumption 2. The ROV is assumed symmetric around the front-back, port-starboard, and the top-bottom axes. * Assumption 3. The body axes coincide with the main axes of inertia. * Assumption 4. The origin of the b-frame is located at the center of mass of the vehicle. * Assumption 5. The ocean current is modeled as a constant irrotational flow in the n-frame. Waves are neglected. * Assumption 6. The movements for each DOF are assumed to be decoupled as they are performed at low speeds (less than 1 m/s). \begin{table}
\begin{tabular}{c c c c} \hline  & **Position and Angles** & **Linear and Angular Velocities** & **Forces and Moments** \\ \hline Movements & NED-frame & B-frame & B-frame \\ \hline Surge & x & u & X \\ \hline Sway & y & v & Y \\ \hline Heave & z & w & Z \\ \hline Roll & \(\varphi\) & p & K \\ \hline Pitch & \(\theta\) & q & M \\ \hline Yaw & \(\psi\) & r & N \\ \hline \end{tabular}
\end{table} 
Table 1: SNAME notation for marine vessels. The matrix expressions are detailed and explained in [43], but the most important ones are also included in this text to ease the lecture and interpretation. For symmetrical underwater vehicles during low-speed movements and with the gravity center on a vertical line from the coordinate origin (CO), the rigid body matrix \(M_{RB}\) and the added mass matrix \(M_{A}\) could be expressed using the following:  
\(m\) as the mass of the vehicle in kg.