Simulator

Base Vessel

The Vessel class works as an abstract base class for all vessel models. All subclasses of Vessel inherits the mehtods of Vessel.

class mclsimpy.simulator.vessel.Vessel(dt, method, config_file, *args, dof=6, **kwargs)

Base class for simulator vessels.

RK4(x, Uc, beta_c, tau)

Runge-Kutta 4 integration method.

forward_euler(x, Uc, beta_c, tau)

Forward Euler integration method.

get_eta()

Get vessel pose eta.

Returns:

self._eta

Return type:

6 x 1 array.

get_nu()

Get vessel velocity nu.

Returns:

self._nu

Return type:

6 x 1 array.

get_x()

Get vessel state vector x.

Returns:

self._x

Return type:

DOF x 1 array.

integrate(Uc, beta_c, tau)

Integrate the state vector one forward, using the specified integration method.

Parameters:
  • Uc (float) – Current velocity

  • beta_c (float) – Current direction in NED frame [rad]

  • tau (array_like) – Sum of all loads corresponding to vessel DOF.

reset()

Reset state vector to zeroes.

set_eta(eta)

Set the pose of the vessel.

abstract classmethod x_dot(Uc, beta_c, tau)

Kinematic and kinetic equation of vessel. The method must be overwritten by inherting vessel classes. The method should return the result of f(x, u, ..). It should not modify any of the object attributes.

Parameters:
  • Uc (float) – Current velocity

  • beta_c (float) – Current direction in NED frame [rad]

  • tau (array_like) – Sum of all loads corresponding to vessel DOF.

Returns:

Time derivative of the state vector.

Return type:

array_like

Gunnerus

Simulation models for R/V Gunnerus.

RVG 3 DOF Manuevering Model

class mclsimpy.simulator.gunnerus.GunnerusManeuvering3DoF(dt, *args, method='Euler', config_file='parV_RVG3DOF.pkl', **kwargs)

3DOF Manuevering model for R/V Gunnerus. The model is based on maneuvering theory. Zero-Frequency model.

References

Fossen 20–. Handbook of marine craft hydrodynamics and motion control

RK4(x, Uc, beta_c, tau)

Runge-Kutta 4 integration method.

forward_euler(x, Uc, beta_c, tau)

Forward Euler integration method.

get_eta()

Get vessel pose eta.

Returns:

self._eta

Return type:

6 x 1 array.

get_nu()

Get vessel velocity nu.

Returns:

self._nu

Return type:

6 x 1 array.

get_x()

Get vessel state vector x.

Returns:

self._x

Return type:

DOF x 1 array.

integrate(Uc, beta_c, tau)

Integrate the state vector one forward, using the specified integration method.

Parameters:
  • Uc (float) – Current velocity

  • beta_c (float) – Current direction in NED frame [rad]

  • tau (array_like) – Sum of all loads corresponding to vessel DOF.

reset()

Reset state vector to zeroes.

set_eta(eta)

Set the pose of the vessel.

x_dot(x, U_c, beta_c, tau)

Kinematic and kinetic equation of vessel. The method must be overwritten by inherting vessel classes. The method should return the result of f(x, u, ..). It should not modify any of the object attributes.

Parameters:
  • Uc (float) – Current velocity

  • beta_c (float) – Current direction in NED frame [rad]

  • tau (array_like) – Sum of all loads corresponding to vessel DOF.

Returns:

Time derivative of the state vector.

Return type:

array_like

RVG 6 DOF DP Model

class mclsimpy.simulator.gunnerus.RVG_DP_6DOF(dt, method='Euler', config_file='vessel_2.json', dof=6)

6 Degree of Freedom simulation model of R/V Gunnerus.

The model is created simply by using Veres data (ShipX).

RK4(x, Uc, beta_c, tau)

Runge-Kutta 4 integration method.

forward_euler(x, Uc, beta_c, tau)

Forward Euler integration method.

get_eta()

Get vessel pose eta.

Returns:

self._eta

Return type:

6 x 1 array.

get_nu()

Get vessel velocity nu.

Returns:

self._nu

Return type:

6 x 1 array.

get_x()

Get vessel state vector x.

Returns:

self._x

Return type:

DOF x 1 array.

integrate(Uc, beta_c, tau)

Integrate the state vector one forward, using the specified integration method.

Parameters:
  • Uc (float) – Current velocity

  • beta_c (float) – Current direction in NED frame [rad]

  • tau (array_like) – Sum of all loads corresponding to vessel DOF.

reset()

Reset state vector to zeroes.

set_eta(eta)

Set the pose of the vessel.

set_hydrod_parameters(freq)

Set the hydrodynamic added mass and damping for a given frequency.

Parameters:

freq (array_like) – Frequency in rad/s. Can either be a single frequency, or multiple frequencies with dimension n = DOF.

Examples

Set a hydrodynamic parameters for one frequency

>>> dt = 0.01
>>> model = CSAD_DP_6DOF(dt)
>>> frequency = 2*np.pi
>>> model.set_hydrod_parameters(frequency)

Set frequency for individual components

>>> freqs = [0., 0., 2*np.pi, 2*np.pi, 2*np.pi, 0.]
>>> model.set_hydrod_parameters(freqs)
x_dot(x, Uc, betac, tau)

Kinematic and kinetic equations.

Parameters:
  • x (array_like) – State vector with dimensions 12x1

  • Uc (float) – Current velocity in earth-fixed frame

  • betac (float) – Current direction in earth-fixed frame [rad]

  • tau (array_like) – External loads (e.g wind, thrusters, ice, etc). Must be a 6x1 vector.

Returns:

x_dot – The derivative of the state vector.

Return type:

array_like

CSAD

Simulation models for C/S Arctic Drillship.

CSAD 3DOF Maneuvering Model

class mclsimpy.simulator.csad.CSADMan3DOF(dt, *args, method='Euler', dof=3, config_file='vessel_json.json', **kwargs)

CSAD 3DOF Maneuvering model.

self._Mrb

Rigid body mass matrix

Type:

3 x 3 array

self._Ma

Added mass (infinte frequency)

Type:

3 x 3 array

self._M

Total mass

Type:

3 x 3 array

self._D

Linear potential damping

Type:

3 x 3 array

self._Bv

Viscous damping

Type:

3 x 3 array

RK4(x, Uc, beta_c, tau)

Runge-Kutta 4 integration method.

forward_euler(x, Uc, beta_c, tau)

Forward Euler integration method.

get_eta()

Get vessel pose eta.

Returns:

self._eta

Return type:

6 x 1 array.

get_nu()

Get vessel velocity nu.

Returns:

self._nu

Return type:

6 x 1 array.

get_x()

Get vessel state vector x.

Returns:

self._x

Return type:

DOF x 1 array.

integrate(Uc, beta_c, tau)

Integrate the state vector one forward, using the specified integration method.

Parameters:
  • Uc (float) – Current velocity

  • beta_c (float) – Current direction in NED frame [rad]

  • tau (array_like) – Sum of all loads corresponding to vessel DOF.

reset()

Reset state vector to zeroes.

set_eta(eta)

Set the pose of the vessel.

x_dot(x, Uc, betac, tau)

Kinematic and kinetic equation for 6DOF simulation model.

Parameters:
  • x (array_like) – State vector with dimensions 2*DOF

  • Uc (float) – Current velocity in earth-fixed frame

  • betac (float) – Current direction in earth-fixed frame [rad]

  • tau (array_like) – External loads (e.g wind, thrusters, ice, etc). Must correspond with numb. DOF.

Returns:

x_dot – The derivative of the state vector.

Return type:

array_like

CSAD 6DOF DP Model

class mclsimpy.simulator.csad.CSAD_DP_6DOF(dt, *args, method='Euler', config_file='vessel_json.json', dof=6, **kwargs)

6 DOF DP simulator model for CSAD.

Simulator model for DP and low-speed applications. Zero-speed is assumed.

No fluid memory effects are included yet.

RK4(x, Uc, beta_c, tau)

Runge-Kutta 4 integration method.

forward_euler(x, Uc, beta_c, tau)

Forward Euler integration method.

get_eta()

Get vessel pose eta.

Returns:

self._eta

Return type:

6 x 1 array.

get_nu()

Get vessel velocity nu.

Returns:

self._nu

Return type:

6 x 1 array.

get_x()

Get vessel state vector x.

Returns:

self._x

Return type:

DOF x 1 array.

integrate(Uc, beta_c, tau)

Integrate the state vector one forward, using the specified integration method.

Parameters:
  • Uc (float) – Current velocity

  • beta_c (float) – Current direction in NED frame [rad]

  • tau (array_like) – Sum of all loads corresponding to vessel DOF.

reset()

Reset state vector to zeroes.

set_eta(eta)

Set the pose of the vessel.

set_hydrod_parameters(freq)

Set the hydrodynamic added mass and damping for a given frequency.

Parameters:

freq (array_like) – Frequency in rad/s. Can either be a single frequency, or multiple frequencies with dimension n = DOF.

Examples

Set a hydrodynamic parameters for one frequency

>>> dt = 0.01
>>> model = CSAD_DP_6DOF(dt)
>>> frequency = 2*np.pi
>>> model.set_hydrod_parameters(frequency)

Set frequency for individual components

>>> freqs = [0., 0., 2*np.pi, 2*np.pi, 2*np.pi, 0.]
>>> model.set_hydrod_parameters(freqs)
x_dot(x, Uc, betac, tau)

Kinematic and kinetic equation for 6DOF simulation model.

Parameters:
  • x (array_like) – State vector with dimensions 12x1

  • Uc (float) – Current velocity in earth-fixed frame

  • betac (float) – Current direction in earth-fixed frame [rad]

  • tau (array_like) – External loads (e.g wind, thrusters, ice, etc). Must be a 6x1 vector.

Returns:

x_dot – The derivative of the state vector.

Return type:

array_like