Last updated on Sep 04, 2024.

netsse.simul.ship_resp.simul_ship_resp#

netsse.simul.ship_resp.simul_ship_resp(S2D, freq_wave, betas_wave, U=0, RespStr='Waves', max_threads=0, freq_TRF=[0], betas_TRF=0, TRF_amps=0, TRF_phases=0, NoTs=10, fs=10, T=30 * 60, Nomega=500, AddNoise=False, snr=20)#

Generates several time histories of the waves encountered by a ship and, optionally, the wave-induced vessel motion responses (heave, roll, pitch).

A 2D wave spectrum must be given as input. If ship response is to be simulated too, then the wave-to-motion transfer functions of the vessel must also be provided.

Parameters:
  • S2D (array_like of shape (Nf_wave,Nmu)) – 2-D wave spectrum characterizing the sea state [m^2.s.s/rad].

  • freq_wave (array_like of shape (Nf_wave,)) – Vector of wave frequencies [Hz] in which the wave spectrum is expressed.

  • betas_wave (array_like of shape (Nmu,)) –

    Vector of the relative wave headings [deg] for the wave spectrum.

    Note

    The relative wave headings are defined as: 0 deg: following sea; 90 deg: beam waves from port side; 180 deg: head sea; 270 deg: beam waves from starboard side.

  • U (float, default 0) – Vessel speed [m/s].

  • RespStr ({'Waves','Motions'}, optional) – Use 'Motions' if vessel motions in waves are also to be simulated (in addition to the waves). Otherwise, use 'Waves' and only the wave surface elevation will be simulated. The default is 'Waves'.

  • max_threads (int, default 0) –

    Indicates to maximum number of threads to be used to parallelize the execution.

    Attention

    A large value for max_threads should only be used if the program is run on a high-performance computer. The code execution risks crashing otherwise.

  • freq_TRF (array_like of shape (Nf_TRF,), default [0,]) – Vector of wave frequencies [Hz] in which the transfer functions are expressed.

  • betas_TRF (array_like of shape (Nbeta,), default 0) – Vector of the relative wave headings [deg] indicating the direction of propagation of the energy (relative to vessel heading) for the transfer functions.

  • TRF_amps (array_like of shape (Nf_TRF, Nbeta, 3), optional) – The amplitude of the transfer functions for heave, roll, and pitch, respectively. The default is 0.

  • TRF_phases (array_like of shape (Nf_TRF, Nbeta), optional) – The phase of the transfer functions for heave, roll, and pitch, respectively. The default is 0.

  • NoTs (int, default 10) – Number of time series to be generated.

  • fs (float, default 10) – Sampling frequency [Hz] for the generated time histories.

  • T (float, optional) – Duration [s] of the time histories. The default is 30*60 = 1800 s.

  • Nomega (int, default 500) – Number of wave components used for each direction to generate the time histories.

  • AddNoise (bool, default False) – A boolean that indicates whether random noise (Gaussian white noise) is added to be added the motion time histories.

  • snr (float, default 20) – The signal-to-noise ratio to be used for addition of noise.

Returns:

  • time (array_like of shape (T*fs,).) – Vector of time [s].

  • wavet (array_like of shape (NoTs,T*fs).) – Wave elevation [m] time series.

  • heavet, rollt, pitcht (array_like of shape (NoTs,T*fs).) – Heave, roll and pitch time series.

    Note

    heavet, rollt, pitcht are returned if and only if RespStr = 'Motions'

See also

sum_components

Performs the summation of the sine components to simulate in the time domain the encountered wave elevation or the wave-induced responses on a ship.

Example

>>> # Wave simulations
>>> time, wavet =
...     simul_ship_resp(S2D,freq_wave,betas_wave,U,'Waves',0,NoTs=10,fs=10,T=30*60,
...                     Nomega=500,AddNoise=True,snr=20)
>>> # Motion simulations
>>> time, wavet, heavet, rollt, pitcht =
...     simul_ship_resp(S2D,freq_wave,betas_wave,U,'Motions',0,freq_TRF,betas_TRF,
...                     TRF_amps,TRF_phases,NoTs,fs,T,Nomega,AddNoise=True,snr=20)