Virtual Testbed
Ship dynamics simulator for extreme conditions
Classes | Public Types | Public Member Functions | Friends | List of all members
vtb::core::Ship< T > Class Template Reference

Rigid ship with a mass and translational and angular velocity. More...

#include <ship.hh>

Classes

union  state_vector_type
 

Public Types

using scalar_type = T
 
using vec3 = blitz::TinyVector< T, 3 >
 
using hull_type = Hull< T >
 
using room_type = Compartment< T >
 
using room_array = Compartment_array< T >
 
using propulsor_type = Propulsor< T >
 
using mass_type = Mass< T >
 
using mass_array_type = Mass_array< T >
 
using matrix_type = blitz::TinyMatrix< T, 3, 3 >
 
using coordinate_system_type = vtb::geometry::Coordinate_system< T, 3 >
 
using quaternion_coordinate_system_type = vtb::geometry::Quaternion_coordinate_system< T >
 
using rotation_matrix_type = vtb::geometry::Rotation_matrix< T, 3 >
 
using basis_type = vtb::geometry::Basis< T, 3 >
 
using quaternion_type = vtb::geometry::Quaternion< T >
 
using variables_type = typename state_vector_type::variables_type
 

Public Member Functions

const vec3 & position (int i=0) const
 Get position or its time derivatives in Earth-fixed coordinate system. More...
 
void position (int i, const vec3 &rhs)
 Set position or its time derivatives in Earth-fixed coordinate system. More...
 
const vec3 & velocity () const
 Get velocity in Earth-fixed coordinate system.
 
void velocity (const vec3 &rhs)
 Set velocity in Earth-fixed coordinate system.
 
const vec3 & acceleration () const
 Acceleration in Earth-fixed coordinate system.
 
const vec3 & angular_displacement (int i=0) const
 Get angular position or its time derivatives in Earth-fixed coordinate system. More...
 
vec3 euler_angles () const
 Get Euler angles or their derivatives. More...
 
const quaternion_typequaternion () const
 Get rotation quaternion.
 
void euler_angles (const vec3 &rhs)
 Set Euler angles and rotation quaternion/matrix.
 
void quaternion (const quaternion_type &q)
 Set rotation quaternion and update rotation quaternion/matrix.
 
roll () const
 Counterclockwise rotation about \(x\)-axis in radians. More...
 
pitch () const
 Counterclockwise rotation about \(y\)-axis in radians. More...
 
yaw () const
 Counterclockwise rotation about \(z\)-axis in radians. More...
 
surge (int i=0) const
 \(x\) coordinate of the position. More...
 
sway (int i=0) const
 \(y\) coordinate of the position. More...
 
heave (int i=0) const
 \(z\) coordinate of the position. More...
 
const vec3 & angular_velocity () const
 Angular velocity in Earth-fixed coordinate system.
 
void angular_velocity (const vec3 &rhs)
 Set angular velocity in Earth-fixed coordinate system.
 
const vec3 & angular_acceleration () const
 Angular acceleration in Earth-fixed coordinate system.
 
const vec3 & angular_momentum () const
 Angular momentum.
 
void angular_momentum (const vec3 &rhs)
 Set angular momentum.
 
void state_vector (const state_vector_type &v, const state_vector_type &dv, T dt)
 Set ship position, orientation and velocities from a state vector. More...
 
void state_vector (const variables_type &v, const variables_type &dv, T dt)
 
state_vector_type state_vector () const
 Get state vector for ship motion equation. More...
 
void reset ()
 
const hull_typehull () const
 
void hull (hull_type &&rhs)
 
void hull (const hull_type &rhs)
 
void compartments (const room_array &rhs)
 
room_arraycompartments ()
 
const room_arraycompartments () const
 
const propulsor_typepropulsor () const
 
void propulsor (const propulsor_type &rhs)
 
scalar_type mass () const
 
flooded_mass () const
 Total mass of all fluid volumes inside compartments.
 
void mass (scalar_type rhs)
 
void displacement (scalar_type rhs)
 
scalar_type displacement () const
 
void draught (scalar_type rhs)
 
coordinate_system_type earth_fixed_coordinate_system () const
 
quaternion_coordinate_system_type body_fixed_coordinate_system () const
 
const rotation_matrix_typerotation_matrix () const
 
const rotation_matrix_typeinertia_matrix () const
 Inertia matrix in body-fixed coordinate system. More...
 
void dump (std::ostream &out) const
 

Friends

template<class X >
std::ostreamoperator<< (std::ostream &out, const Ship< X > &rhs)
 
template<class X >
bstreamoperator<< (bstream &out, const Ship< X > &rhs)
 
template<class X >
bstreamoperator>> (bstream &in, Ship< X > &rhs)
 

Detailed Description

template<class T>
class vtb::core::Ship< T >

Rigid ship with a mass and translational and angular velocity.

Date
2018-07-18
Author
Ivan Gankevich

Definition at line 186 of file core/ship.hh.

Member Function Documentation

◆ angular_displacement()

template<class T>
const vec3& vtb::core::Ship< T >::angular_displacement ( int  i = 0) const
inline

Get angular position or its time derivatives in Earth-fixed coordinate system.

Parameters
iderivative order (0 means no derivative).

Definition at line 272 of file core/ship.hh.

Referenced by vtb::core::Ship< T >::angular_acceleration(), and vtb::core::Ship< T >::angular_velocity().

◆ euler_angles()

template<class T>
vec3 vtb::core::Ship< T >::euler_angles ( ) const
inline

Get Euler angles or their derivatives.

Parameters
iderivative order (0 means no derivative).

Definition at line 278 of file core/ship.hh.

Referenced by vtb::core::Ship< T >::pitch(), vtb::core::Ship< T >::roll(), and vtb::core::Ship< T >::yaw().

◆ heave()

template<class T>
T vtb::core::Ship< T >::heave ( int  i = 0) const
inline

\(z\) coordinate of the position.

Parameters
iderivative order (0 means no derivative).

Definition at line 311 of file core/ship.hh.

◆ inertia_matrix()

template<class T>
const rotation_matrix_type& vtb::core::Ship< T >::inertia_matrix ( ) const
inline

Inertia matrix in body-fixed coordinate system.

Inertia matrix \(\mathcal{I}\) is calculated from inertia tensor \(I\) as follows:

\[ \mathcal{I} = \begin{array}{ccc} I_x & -I_{xy} & -I_{xz} \\ -I_{yx} & -I_y & -I_{yz} \\ -I_{zx} & -I_{zy} & -I_z \end{array}. \]

Definition at line 418 of file core/ship.hh.

◆ pitch()

template<class T>
T vtb::core::Ship< T >::pitch ( ) const
inline

Counterclockwise rotation about \(y\)-axis in radians.

Parameters
iderivative order (0 means no derivative).

Definition at line 295 of file core/ship.hh.

References vtb::core::Ship< T >::euler_angles().

◆ position() [1/2]

template<class T>
const vec3& vtb::core::Ship< T >::position ( int  i = 0) const
inline

Get position or its time derivatives in Earth-fixed coordinate system.

Parameters
iderivative order (0 means no derivative).

Definition at line 253 of file core/ship.hh.

Referenced by vtb::core::Ship< T >::acceleration(), vtb::core::Gerstner_solver_openmp< T >::generate_field(), and vtb::core::Ship< T >::velocity().

◆ position() [2/2]

template<class T>
void vtb::core::Ship< T >::position ( int  i,
const vec3 &  rhs 
)
inline

Set position or its time derivatives in Earth-fixed coordinate system.

Parameters
iderivative order (0 means no derivative).

Definition at line 257 of file core/ship.hh.

◆ roll()

template<class T>
T vtb::core::Ship< T >::roll ( ) const
inline

Counterclockwise rotation about \(x\)-axis in radians.

Parameters
iderivative order (0 means no derivative).

Definition at line 291 of file core/ship.hh.

References vtb::core::Ship< T >::euler_angles().

◆ state_vector() [1/2]

template<class T >
void vtb::core::Ship< T >::state_vector ( const state_vector_type v,
const state_vector_type dv,
dt 
)

Set ship position, orientation and velocities from a state vector.

Date
2018-07-19
Author
Ivan Gankevich

Definition at line 73 of file core/ship.cc.

◆ state_vector() [2/2]

template<class T >
auto vtb::core::Ship< T >::state_vector ( ) const

Get state vector for ship motion equation.

Date
2018-07-31
Author
Ivan Gankevich

Definition at line 62 of file core/ship.cc.

◆ surge()

template<class T>
T vtb::core::Ship< T >::surge ( int  i = 0) const
inline

\(x\) coordinate of the position.

Parameters
iderivative order (0 means no derivative).

Definition at line 303 of file core/ship.hh.

◆ sway()

template<class T>
T vtb::core::Ship< T >::sway ( int  i = 0) const
inline

\(y\) coordinate of the position.

Parameters
iderivative order (0 means no derivative).

Definition at line 307 of file core/ship.hh.

◆ yaw()

template<class T>
T vtb::core::Ship< T >::yaw ( ) const
inline

Counterclockwise rotation about \(z\)-axis in radians.

Parameters
iderivative order (0 means no derivative).

Definition at line 299 of file core/ship.hh.

References vtb::core::Ship< T >::euler_angles().