Sie sind auf Seite 1von 182

Sea State Estimation in the Time Domain

Kálmán filtering applied to shipboard measurements,


including forward speed, for sea spectrum computation in
near-real-time
Master thesis

Michaela & Tobias Höfler


II
Sea State
Estimation in the
Time Domain
Kálmán filtering applied to shipboard measurements,
including forward speed, for sea spectrum computation in
near-real-time

Michaela & Tobias Höfler

Technical University of Denmark (DTU)


Royal Institute of Technology (KTH)

Supervised by Ulrik Dam Nielsen, Roberto Galeazzi, and Karl Garme

July 26, 2017 ¦


Master thesis: Sea State Estimation in the Time Domain

Impressum Statutory declaration


Authors Michaela Höfler We hereby declare that we have developed and
Tobias Höfler written the enclosed Master thesis in co-authorship
and completely by ourself, and have not used
Student no. s161809 (DTU)
sources or means without declaration in the text.
s161967
Any thoughts from others or literal quotations are
910921-T202 (KTH)
clearly marked. The Master thesis was not used in
890731-T578
the same or in a similar version to achieve an aca-
Study track Joint Nordic Master demic grading or is being published elsewhere.
in Maritime Engineering

Thesis title Sea state estimation


in the time domain Michaela Höfler Tobias Höfler
Realtids bølgeestimering
på basis af skibsrespons Copenhagen July 26, 2017

Thesis start February 1, 2017 Place Date

Thesis end August 01, 2017

E C TS 35 points per person

Institute Department of
Mechanical Engineering,
Section of Fluid Mechanics, Acknowledgements
Coastal and Maritime
Engineering We would like to express our deepest gratitude to
the persons who contributed to the success of this
University Technical University thesis; either by academic and/or social support.
of Denmark (DTU)

Supervisors Ulrik Dam Nielsen (DTU) In the former category, our thanks go out to Ul-
Roberto Galeazzi (DTU) rik Dam Nielsen for his guidance with sea state
Karl Garme (KTH) and time series modelling, to Roberto Galeazzi for
advise on stochastic processes and the Kálmán fil-
ter, to Karl Garme for keeping an eye on compli-
ance with the systems engineering method, and to
Jørgen Juncher Jensen for the hours of his leisure
time he spent explaining the implementation of the
closed-form transfer functions to us.
¦
In the latter category, we would like to express ap-
preciation to our friends and family, for distracting
us from work every now and then.

All (registered) trademarks, trading names On a final note, a special hat tip to those who read
and brand names are the property of their this document; be it proof-reading or professional
respective owners. interest.

IV Michaela & Tobias Höfler // July 26, 2017


Abstract

This thesis is derived from the need for reliable on-board decision support systems; the focus lies
on the fusion of motion sensor signals, which are already present on the majority of vessels, to
an estimation of the wave domain sea spectrum using the Kálmán filter. The procedure may
potentially be applied to supplement the data that are already gathered by wave-buoys in coastal
regions and can be a near real-time data source in remote waters.

With this intention, the required knowledge about ocean waves, and any vessel’s response to
the same, is presented before it comes to the practical application; so is the difference between
wave and encounter domain, as well as time and frequency domain, which are the basis for the
creation of “laboratory condition” input to the Kálmán filter. Since the theory behind the filter
itself is a very wide topic, the necessary background has been compressed to the features in use.
To allow judgment of the estimation quality, confidence intervals are introduced also.

The focus then switches to the practical application, starting with a set-up of the Kálmán filter
with respect to the chosen problem. Hereafter, the first test run with just the heave response
signal as input is conducted. It is succeeded by multiple motions considered at the same time,
in combination with tuning of the filter matrices to achieve better convergence of the estimate.
Having encountered numerical errors, a clean re-implementation is undertaken, in liaison with
enhancements in all parts of the code, with special focus on the spectral output post-processing.
As a final step, forward speed is included.

The efforts eventually led to a method which is capable of tracking the vessel motion signals,
as well as estimating the surface elevation for every speed and relative heading; it could easily
provide a prediction for the next few seconds. In addition to that, a spectral output directly in
the wave domain can be obtained. In any case of zero-speed and for beam sea including forward
speed, the output is quite reliable. Forward speed and frontal waves lead to slightly less good
estimates, while stern waves cannot be estimated in a useful manner yet. However, the filter is
capable of predicting and tracking the input from the sensor time series accurately, which also
reflects the quality of surface elevation estimation.

Keywords: Kálmán filter, shipboard motion measurement evaluation, forward speed, sea spec-
trum estimation in near real time, confidence intervals, spectrum mapping, closed-form transfer
functions, long-crested waves, time and frequency domain, wave and encounter domain

V
VI
Contents

I Theoretical background 1

1. Introduction 3
1.1. Scope of the thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.1. Importance of the topic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.2. What shall be achieved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2. Preceding publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3. Selected full-scale vessel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2. Wave and vessel motion theory 9


2.1. Properties of ocean waves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2. Time and frequency domain representations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.1. Properties of domain types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.2. Differences between parametrized sea spectrum representations . . . . . . 13
2.3. Data synthesis procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3.1. Closer-to-reality time series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4. Transfer functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.5. Speed dependent inter-domain mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.5.1. Applied wave to encounter domain mapping . . . . . . . . . . . . . . . . . . . . . . . . 33
2.5.2. Applied encounter to wave domain mapping . . . . . . . . . . . . . . . . . . . . . . . . 34
2.5.3. Singularities in mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

3. Kálmán filter theory 37


3.1. State and measurement vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.2. Output matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.3. Error covariance matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.4. Filter gain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.5. Noise covariance matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.6. State transition matrix & Projection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.7. Filter loop wrap-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

4. Confidence intervals 51

VII
Master thesis: Sea State Estimation in the Time Domain

II Practical Application 57

5. Applied Kálmán filter set-up 59

6. Just one input signal 65


6.1. A single wave frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
6.2. Arbitrarily many frequencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

7. Multiple input signals 69


7.1. Matrix extension to multiple inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
7.2. More accurate noise covariance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
7.3. Inaccurate sea spectrum estimates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
7.4. Automatic frequency content detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

8. A clean re-implementation 79
8.1. Time series import and export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
8.2. Avoiding sea spectrum singularities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

9. Forward speed inclusion 87


9.1. Changes in the time series generation process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
9.2. Changes regarding the Kálmán filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

III Conclusion 95

10. Discussion of results 97


10.1. Estimate evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
10.2. Long-term convergence test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
10.3. Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

11. Outlook 111


11.1. Re-implementation of the frequency filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
11.2. Short-crested waves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
11.3. Software optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

VIII Michaela & Tobias Höfler // July 26, 2017


IV Appendix 115
A. Sensor data sheet 117

B. Relevant Matlab code 121


B.1. Filter main file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
B.2. Matrix initialisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
B.3. Closed-form transfer functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
B.4. Time series generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
B.5. Frequency trust evaluator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
B.6. Wave to encounter domain mapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
B.7. Encounter to wave domain mapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

V Backmatter 153
List of Tables 155
List of Figures 157
Nomenclature 159
Index 165

IX
X
I
Theoretical
background
2
Introduction
1
As the starting point, this part will introduce the details of the thesis topic to the dear
reader. As might have already been seen in the table of contents, this part focuses on,
firstly, what this thesis is all about, why the work is of interest, and what the outcome
shall be. Secondly, background information on all used methods and fields of study shall be
given, so that in the following part of this thesis, which describes the practical application
of the theory to the chosen problem setting, the required knowledge is ready to be recalled.
But first things first; the following section will give an impression of what this thesis is
about.

1.1. Scope of the thesis


As the title already indicates, this thesis deals with the near-real-time estimation of sea
states in the time domain, as opposed to long-term averages for spectral representation at
a fixed position. The questions that follow might be: why is this important, which kind of
results shall be achieved and what are the methods used? Answers to these — and more
— questions are presented in the subsequent text.

1.1.1. Importance of the topic

To a significant extent, the world trade takes place on the water; it is estimated to be
more than 90% of the total trade volume [18, p.7]. At the same time, the transported
tonnage is growing from year to year. This calls for more, and larger vessels in the future.
Since they will be operated by less and less personal as automation increases, the need
for high-quality real-time navigation and weather data rises even further. Wind speed and
direction are relatively easy to measure, but what about the ocean waves? Their properties
are usually measured by wave buoys, but as the selected example in Figure 1.1 depicts,
there are not many wave buoys far away from the coast lines. On the contrary, there is the
type of “modern satellite-tracked surface drifting buoy (‘drifter’)” [32] which moves in remote
waters (cf. Figure 1.2), but they do not necessarily measure wave amplitudes, frequencies
and directions. For the sea states on the open oceans, the gaps are usually filled with
satellite images; these unfortunately do not provide real-time measurements. The situation

3
1 Introduction Master thesis: Sea State Estimation in the Time Domain

Fig. 1.1 Example of the coverage that wave buoys provide [28]. Most of them are close to the shore, only a few can
be found in open water.

Fig. 1.2 The above map shows the global positions of drifter buoys [32]. Interesting is the fact that these buoys cover
more remote waters than regular coastal wave buoys do; but unfortunately these “modern satellite-tracked surface
drifting buoys” [32] do only partially measure wave properties needed for the analysis in this thesis.

4 Michaela & Tobias Höfler // July 26, 2017


Scope of the thesis 1.1

could be improved a lot if the sensors on board of every ship could be utilized to record
and share sea state information in a global network. For the particular vessel, it would
provide decision support, for other vessels it might be useful as routing information. That
there are more than enough ships on the oceans is proven by Figure 1.3. But would any
vessel stop in the middle of its journey to keep the position for hours and record data, just
for the greater good? It is assumed not; thus, it is important that any developed procedure
for sea state estimation from sensor recordings takes forward speed into account.

1.1.2. What shall be achieved


For the reasons mentioned above, this work aims to provide a method of fusing multiple
sensor recordings — in this case the motions heave, roll and pitch as time series — using
the Kálmán filter, in order to gain information on the current sea surface elevation and
the sea state in spectral representation. With this method, one can obtain sea spectra
for e.g. a moving time window of 5 min, which is a much better decision support than
wave buoy data, which provide a long-term average that is cast into a sea spectrum for
which stationarity1 is assumed. The data for the filter will in the “real life” application be
provided in form of a continuous stream of sensor readings, sampled at discrete time steps.

Fig. 1.3 A snapshot of global vessel positions [10], based on so-called Automatic identification system (AIS) signals.
The green spots were received by terrestrial stations, the red ones by satellites. As can be seen, the global fleet covers
all parts of the ocean relevant for commercial shipping; thus, they could be of great assistance in data collection.

1
The term stationarity refers to the fact that the energy content of each carrier frequency in the sea state is assumed to be constant
— alias a fixed spectral density function. It does not imply that wave amplitudes cannot vary stochastically. The sea surface can
still be irregular.

5
1 Introduction Master thesis: Sea State Estimation in the Time Domain

The signal noise magnitude will be previously unknown and can be found via calibration
of the sensors with known motions, or via the data provided by the sensor manufacturer.
The data will then be processed on a standard-grade computer in “near real time”, with
e.g. a time window of the last five minutes, so that information are available on the bridge
of the vessel. Since for this thesis, no vessel with recording equipment is available, the
data will be prepared beforehand in “laboratory conditions”. How this is achieved will be
the subject on the subsequent pages, right after some theoretical background on the topic.

1.2. Preceding publications

There have been many researchers who have published in the fields of study at hand;
this includes Kálmán filtering, as well as sea state estimation — and both of them in
combination. This chapter shall give a brief overview, with focus on the papers that were
relevant for this thesis. More elaborate summaries can be found in the recent publications
of Pascoal et al. [34] and Nielsen [31], as well as in the historical recapitulation by
Grewal and Andrews [14].

In 1960, the Kálmán filter was introduced for the very first time, by the electrical engineer
and mathematician Rudolf Emil Kálmán. It was supposed to overcome the difficulties in
the application of the Wiener filter and other methods used before. For now it suffices to
say that the Kálmán filter eliminated the need for infinite memory by providing a recur-
sive process in which only the variables of the previous iteration were needed, instead of
saving all past variable states. From this time on, the filter was subject of a vast amount
of research papers, in as many different fields of study — mostly in aeronautics, where it
was used for the navigational instruments of the Apollo project [14]; only the application
for sea state estimation was marginally considered (the race to the moon seemed more
important).

In the early 1970’s, the estimation of sea spectra with respect to relative heading was
mainly addressed by Japanese researchers. The aim of e.g. Takekuma and Takahashi
[38] was to dig deeper into the change of ship response with varying wave direction,
while not focusing on the creation of directional sea spectra [34]. There was no usage
of the Kálmán filter yet, although at roughly the same time it had already been reviewed
thoroughly. For example by Fitzgerald [9], who published a quite mathematical paper in
which the divergence of the Kálmán filter was discussed. In the late 1970’s, one of the first
papers to combine the Kálmán filter with wave estimation in the time domain was “Dy-
namic positioning using Kalman filtering and optimal control theory” by Balchen et al. [1].

6 Michaela & Tobias Höfler // July 26, 2017


Preceding publications 1.2

Pascoal et al. [34] state that in the 1980’s the interest in “spectral estimation from ship
motions” seemed to have decayed. This might have been the case, but only for the spectral
representation. In fact, there have been the other early publications (from a present-
day perspective) in which the Kálmán filter was applied to wave filtering. Among other
researchers that focused on this subject, Fung and Grimble [12] published a dynamic
positioning method using a self-tuning version of the Kálmán filter to avoid the non-linear
extended Kálmán filter and make the procedure more robust.

In 1994, the report Wave Estimation through Ship Motion Measurement — featuring evaluation
of full-scale experiment recordings — by Hua and Palmquist [16] shines more light onto
the frequency domain estimation of sea states, but is not based on Kálmán filtering. At this
point, there was sea state estimation using Kálmán filtering based on surface elevation time
series, but not in the frequency domain; there it was done with other filtering algorithms.
The fusion of the procedures to the combination used in this thesis lay some years ahead.

The 21st century started with the very useful publication “Bayesian estimation of directional
wave spectra based on ship motions” by Iseki and Ohtsu [19], who continued research
on parametrized sea spectrum representations, but also were the first to closely examine
the “1-to-3 relationship between encounter frequency and wave frequency for certain conditions
in following sea” [31]. This phenomenon is known in physics as the Doppler shift (or
Doppler effect), which applies to all kinds of waves, not just water waves. This, and other
previous publications that feature spectral formulations, are the basis for the PhD thesis
“Estimation of directional wave spectra from measured ship responses” by Nielsen [29];
although not based on Kálmán filtering, a least squares algorithm is used for cross-spectral
density analysis, which relies on the cross-covariance of multiple time signals. The field
of study is shared by Pascoal et al. [34], from which can be learned that “in the early
21st century there was a renewed interest on estimation of the directional spectrum from ship
motions”, also including their own work “Kalman filtering of vessel motions for ocean wave
directional spectrum estimation” [33].

Contemporary publications take also forward speed into account. In his recent paper “A
concise account of techniques available for shipboard sea state estimation” Nielsen [31]
explains that “since then several studies with good results have been published for ships with
forward speed […]; all considering full-scale data of different vessels”. The thesis at hand is
aimed at aligning with these, while providing a wider theoretical introduction; especially,
because this work is no journal article, in which the results of years have to be condensed
to a few pages. The desired detailed insight into the methods used will be provided by the
following chapters.

7
1 Introduction Master thesis: Sea State Estimation in the Time Domain

1.3. Selected full-scale vessel


Before coming to the actual theory, the chosen example ship, which will be used for
calculations throughout this Master thesis, shall be presented. It was decided to use the
container vessel CMA CGM Rigoletto, which is a 9415 TEU container vessel built in 2006 at
Hyundai Heavy Industries [4]. A photo of the ship can be found in Figure 1.4. There are
several reasons for this decision, though the most important is that the ship participated in
the European Union project “Tools for ultra large container ships” (TULCS), what implies
that there is a lot of information about the ship available on the Internet. The used ship
data can be found in Table 1.1 and are either gathered from the Internet [4], calculated by
I-Ship or chosen (via educated estimation).

Fig. 1.4 A photo of the 9415 TEU con-


tainer vessel CMA CGM Rigoletto arriv-
ing at the port of Hamburg [11]. It is
a 9415 TEU container vessel built in 2006
at Hyundai Heavy Industries [4], which
participated in the European Union project
TULCS; therefore, a variety of information
about the ship are available on the Internet.

Tab. 1.1 The main dimensions of CMA CGM Rigoletto used. They are either gathered from the Internet [4], calculated
by I-Ship or chosen.

Main dimensions of CMA CGM Rigoletto


D i m e ns i o n S y m b ol Magnitude Unit Annotation

Overall length L 349.0 m


Moulded breadth Bm 42.8 m
Design draft T 14.5 m Chosen
Metacentric height GM 1.056 m Calculated by I-Ship
Displacement ∆s 143 226.64 t Calculated by I-Ship
Water plane area coefficient Cwp 0.820 − Calculated by I-Ship
Block coefficient Cb 0.673 − Calculated by I-Ship

8 Michaela & Tobias Höfler // July 26, 2017


Wave and vessel motion theory
2
This chapter shall give an overview of the theory which stands behind ocean waves and
a vessel’s response to them; these states may be described in the time domain and the
frequency domain. The overall aim of this chapter is to provide background knowledge of
the signals that on-board sensors can record, which provide the input to the Kálmán filter.

2.1. Properties of ocean waves


The here considered ocean waves develop due to wind blowing over calm water; all other
wave types like tsunamis and tidal waves are not of interest for ships. In order for small
ripples to become fully developed ocean waves, many stages need to be passed which
shall here not be further discussed. Instead it shall be referred to several publications and
books. However, an irregular ocean wave can be modeled with a very high accuracy by
many regular sinusoidal waves with particular characteristics. Those characteristics can be
found in Figure 2.1 and are the amplitude ζ̃ which is the height of the wave from calm
water level to either crest or trough and the wave length λ. Wave length in this context
stands for the length of the wave until it repeats itself. The so-called wave number k is
defined as k = 2π λ and describes the number of radians per unit distance [55]; in practice,
it means that if a wave has a wave number of k = π , it will complete half a cycle in one
meter, which makes the wave length λ = 2 m. These attributes of the wave number are
valid for all cases, but it should be mentioned that its relation to the angular frequency is
dependent on the water depth because the wave length λ decreases with decreasing water
depth h; this is summarized by the dispersion relation:

ω 2 = gk tanh (kh) 2.1

If one tries to solve the above equation for the wave number, it can directly be seen that
this is only possible in an iterative numeric procedure. The assumption of deep water
2
h → ∞ leads to tanh (kh) → 1, which gives k = ωg , which is easy to solve — the
deep water dispersion relation. Another important wave characteristic is the wave period
T , which is defined as the time that needs to pass until a wave repeats itself, observed
from a fixed local position; often the crest or trough is taken as reference point [30].

9
2 Wave and vessel motion theory Master thesis: Sea State Estimation in the Time Domain

Wave length λ

Wave amplitude ζ̃
Calm water sea surface level
ζ(tn )

t→∞

t0

Fig. 2.1 An illustration of the sea surface elevation, deviating from the dotted calm water level with the magnitude
ζ(t) being a time varying sinusoid with the extrema ±ζ̃ . The wave has a length between consecutive zero-upcrossings
of λ. In this example case, the wave is progressing from right to left with constant phase velocity Vph — that is
indicated by the time line, which shows that future values of ζ are located to the right of t0 with equidistant time
steps (cf. the sampling time Ts )

However, also other periods are used when it comes to irregular waves, for example the
zero-upcrossing or the zero-downcrossing period Tz ; they only differ in the definition of
the reference point. In case of the zero-upcrossing period, the reference points are in
between consecutive locations where the surface elevation equals the calm water level
(turning points of the surface) and the slope is positive; in the case of zero-downcrossing,
the slope is negative [35]. With the knowledge of the wave period, the angular frequency
ω can be calculated by ω = 2πT . The surface of one wave component can be mathematically
described by:
ζ(x,t) = ζ̃ sin (kx − ωt) 2.2

Despite this, ocean waves in real life are a stochastic process, what means, that they cannot
be modeled by one sinusoidal wave. However as already described, ocean waves can be
modeled very well by sinusoidal waves if this is done with many different sinusoidal wave
components with differing wave characteristics and a (in this case random) phase shift .
This leads to the mathematical formula of the irregular ocean surface as follows:

X
ζ(x,t) = ζ̃i sin (ki x − ωi t + i ) 2.3
i=1

This expression shows a sum from 1 to infinity, this is of course in real life not possible.
Though, it implies, that with increasing number of wave components the model converges
to the real ocean wave.

However, the model introduced above depicts the situation as a two-dimensional problem,
but can be expanded; it then describes what is called long-crested waves in three dimensions,
which are perfectly aligned over their width as can be seen on the left part of Figure 2.2.

10 Michaela & Tobias Höfler // July 26, 2017


Properties of ocean waves 2.1

Fig. 2.2 The above images depict the difference between long- and short-crested waves, seen from bird’s eye per-
spective. As can be seen, both states have been drawn to have the same global heading (indicated by the long dotted
line), although they differ in local headings (the short dotted lines). While the headings of long-crested waves are
parallel, the ones of short-crested waves are more randomized; they spread with the spreading factor f . In reality,
purely long-crested waves are seldom the case; more likely is short-crested sea with only little spreading.

This situation is very rarely seen on the real oceans due to influences from the coast, the
sea bed, as well as an overlap of different waves systems which have developed at different
places and are coming from different directions [30]. The wave situation on a real ocean is
often called short-crested sea, because the crests and troughs have a much shorter width
than the long-crested ones [30]. An illustrative example of a short-crested sea state can
be found on the right side of Figure 2.2, where the much shorter width can be seen, but
also the main traveling direction of the waves. The spreading factor f describes to which
extent the local headings deviate from the global heading. This does not mean, however,
that there is no clear main wave direction, often corresponding to the main wind direction,
because the waves considered are a result of the blowing wind, as already described.

11
2 Wave and vessel motion theory Master thesis: Sea State Estimation in the Time Domain

2.2. Time and frequency domain representations


As explained above, an ocean wave, consisting of many wave components, can be described
mathematically by its surface in the time domain. However, there are also other domains
usable for description. A very useful one is the frequency domain in which ocean waves
are described by their energy spectrum. An example of an energy spectrum can be found
in Figure 2.3, which — to aid with a visualization — shows a Bretschneider spectrum1 . The
spectral ordinate S(ωi ) at the frequency ωi is defined as

1 ζ̃i2
S(ωi ) = 2.4
2 ∆ωi

with the frequency band ∆ωi and the wave amplitude ζ̃i . This means, that ocean waves in
the time domain can be transferred into the frequency domain and vice versa. However it
should be noted, that due to the random phase shift  the transformation from frequency
to time domain allows an infinite amount of results, whereas the transformation from the
time domain into the frequency domain gives only one correct result. How this implies
the assumption of stationarity for the frequency domain will be discussed further in the
next part.

Bretschneider spectrum for Hs = 3 m and Tz = 7 s


Spectral density Sζ [m2 s/rad]

0.5

∆ω

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

Angular wave frequency ω [rad/s]

Fig. 2.3 An exemplary energy spectrum; here the Bretschneider spectrum for a significant wave height Hs = 3 m
and a zero-upcrossing period Tz = 7 s. The spectral density Sζ is plotted over the angular wave frequency ω and
describes the wave amplitude associated with every harmonic wave component in this sea state. As can be seen,
there are no long waves (low frequencies), only a few short waves (high frequencies) with small amplitudes, and the
majority in between. The area under the curve represents the 0th -order spectral moment m0 , in relation to the energy
in the entire sea state.

1
Further description of the Bretschneider spectrum can be found in subsection 2.2.2 from page 13 onward.

12 Michaela & Tobias Höfler // July 26, 2017


Time and frequency domain representations 2.2

2.2.1. Properties of domain types

The two domains have advantages and disadvantages, which will be examined closer. The
term “stationarity” has already been used and implies that the particular state (in this case
that of the ocean waves) do not change energy distribution and frequency components
with the passage of time for a certain time period. In case of sea states, an interval
length of 15 to 20 minutes for the time period is often taken under which stationarity
needs to be fulfilled. This is of course quite difficult to observe in real life and becomes
even more tricky when a ship is included which sails with speed through the waves.
Therefore, the stationarity assumption can be a disadvantage for calculations for example
in the frequency domain, due to the fact that stationarity is difficult to reach in real life
and a real-time calculation is not possible due to measurements of around 15 to 20 minutes.
On the other hand real-time calculations in the time domain are possible with only a few
seconds of measurement. However, the frequency representation of a sea state shows a
more generalized picture of the situation, whereas the time representation depicts only one
out of infinitely many possible configurations.

2.2.2. Differences between parametrized sea spectrum representations

For many applications, it is common to use a parametrized sea spectrum, based on wave
measurements, which has different parameters in order to tune it. Often used spectra are the
Pierson-Moskowitz spectrum, the Bretschneider spectrum and the JONSWAP spectrum [39].
There exist other parametrized sea spectrum representations, but only the mentioned three
will be further discussed and their assumptions considered here. However, all of the three
spectra can be called narrow-banded, what implies that the significant wave height Hs has
a correlation to the 0th -order spectral moment m0 (which is equivalent to the area under
the spectrum curve) given by the following equation [39].

Hs ≈ 4 m0 2.5

The Pierson-Moskowitz spectrum is under the assumption of fully developed seas, valid
for the Northern Atlantic Ocean, where the waves have been generated by local winds,
but with unlimited fetch [39]. Moreover, the spectrum assumes unidirectional sea and is
a so-called one parameter spectrum, because the significant wave height is the only input
parameter in order to change the spectrum. However, the assumptions can be difficult to
fulfill, in particular the requirement of a fully developed sea state [39]. The formula of the
sea spectrum is the following [39]:
2 !
8.1 g 2

g
SP M (ω) = 3 5 exp −0.032 2.6
10 ω Hs ω 2

13
2 Wave and vessel motion theory Master thesis: Sea State Estimation in the Time Domain

The Bretschneider spectrum — in comparison to the above — is a two parameter spectrum


and often referred to as IT TC or IT TC78 spectrum [30]. The two tuning parameters are the
significant wave height Hs and the zero-upcrossing period Tz . The Bretschneider spectrum
is able to depict developing, fully developed and decaying sea states, what makes it much
more flexible than the Pierson-Moskowitz spectrum [39]. Mathematically the Bretschneider
spectrum has the following form [30]:

Hs 2 2π 4 1 2π 4
     
a −b
SB(ω) = 5 exp with a= and b= 2.7
ω ω4 4π Tz π Tz

The JONSWAP spectrum is a three parameter spectrum, which takes in addition to the
Bretschneider spectrum also limited fetch into account, in particular the one of the North
Sea. The spectrum was created to incorporate the growth of waves over a limited fetch as
well as on shallow water [39]. The three parameters are the significant wave height Hs , the
zero-upcrossing period Tz (sometimes the modal period T0 = 1.41 Tz is used instead [20])
and a factor γ correlated to the angular frequency range. The formula has the following
form and relies on the Bretschneider spectrum ordinate expression SB(ω) [30]:

 2 !
−1 ωT0
SJ(ω) = 0.658 C SB(ω) with C = 3.3J and J = exp −1 2.8
2γ 2 2π

The spectrum peak intensifying factor γ is, as indicated beforehand, dependent on the
angular frequency ω : 
0.07 : ω ≤ 2π
T0
γ= 2.9
0.09 : ω > 2π
T0

It was, for several reasons, decided to use the Bretschneider spectrum throughout this
Master thesis. Firstly, the Bretschneider spectrum is able to depict developing and decaying
sea states as well as fully developed ones and is therefore very flexible. Secondly, the Bret-
schneider spectrum does not take shallow water into account as the JONSWAP spectrum
does, which aligns with the aim of this thesis to also cover the remote and deep waters
of the oceans.

14 Michaela & Tobias Höfler // July 26, 2017


Data synthesis procedure 2.3

2.3. Data synthesis procedure

It is very important to test a newly programmed code very thoroughly and be able to
verify the output of the code. This applies of course also to the code written during this
Master thesis project. A common approach of the verifying and testing stage is to use an
input which is completely known in order to be of full control of the whole process and to
compare the output of the program with the exact solution. This was done for this Master
thesis too, and the data development process as an input for the actual Kálmán filter shall
be briefly described in the following section. Even though that the input of the Kálmán
filter is a time series of the ship response, the wave situation or better the sea spectrum
around the ship, causing the ship response, shall be calculated by the written program. In
order to be able to compare the exact sea spectrum to the calculated one, the time series
of the ship response needs to be based on this sea spectrum and a transformation between
the frequency and the time domain needs to be done.

It was decided to use a Bretschneider spectrum with a significant wave height of Hs = 4 m


and a zero-crossing period of Tz = 10 s for the verification process. Reasons for this choice
of spectrum type have been already presented in subsection 2.2.2; the choice of wave prop-
erties is based on the fact that in the Atlantic Ocean — a region which also features remote
and non-coastal waters — this combination is among the upper midfield of recorded wave
height and periods, while at the same time being not infrequent. The full wave statistics

Fig. 2.4 A map of the global wave statistic zones, based on the publication by Hogben and Lumb [15] in 1967. For
each of the numbered zones, a wave statistics table (cf. Table 2.1) describes the probability to encounter the measured
combination of wave height and period in occurrences per thousand waves.

15
2 Wave and vessel motion theory Master thesis: Sea State Estimation in the Time Domain

record can be found in Table 2.1, the location of the zone is depicted in Figure 2.4. The
response of the ship, the response spectrum Sη in the frequency domain, can be calculated
by multiplying the sea spectrum Sζ with the squared amplitude of the transfer function
(often referred to as RAO for response amplitude operator) Sη = Sζ · RAO [30]. What a
transfer function is and which kind was used in this Master thesis will be explained in
section 2.4.

However, the response spectrum cannot be used as an input for the Kálmán filter, because
the filter can only process a time series of the ship response. Though, the response
spectrum can be transformed in a time series analogous to the described transformation
of a sea spectrum in a wave elevation time series in section 2.2. The response time series
consists of a sum of different response components where each component corresponds to
a wave component that causes this ship response at that particular frequency. This can
mathematically be written as

X
η(t) = η̃i sin (ωi t + i ) 2.10
i=1

with η̃i as the response amplitude at the particular angular frequency ωi and the random
phase shift i [30]. The response amplitude can be calculated by its relation to the spectral
ordinate of the response spectrum

1 η̃i2
Sη(ωi ) = 2.11
2 ∆ωi

where ∆ωi stands for the bandwidth around ωi , analogous to the bandwidth of the sea
spectrum in section 2.2. This time series can then be fed into the Kálmán filter to predict
the sea state which caused the input ship response. In Figure 2.5 the different stages of
the data synthesis process are shown. It starts with the leftmost diagram, the sea spectrum
Sζ , which can be used in combination with the transfer function’s amplitude, the so called

Tab. 2.1 An exemplary wave statis-


Wav e S tat i s t i c s Z o n e 2 5 : At l a n t i c O c e a n
tics table, containing the wave count
Hs Tz [s] in permille, as it was taken from
the file “marsden.sq” shipped with the
[m] 2.0 4.5 5.5 6.5 7.5 8.5 9.5 10.5 11.5 12.5 13.5
software I-Ship [5]. The file content is
0.5 0 5 20 27 15 5 1 0 0 0 0 based on the publication by Hogben
1.5 0 2 22 73 88 53 20 5 1 0 0 and Lumb [15]. The chosen example
2.5 0 0 8 46 89 82 44 16 4 1 0 features zone 25, a part of the Atlantic
3.5 0 0 2 18 48 59 41 19 6 2 0
Ocean (see Figure 2.4). As can be seen,
the for this thesis selected combination
4.5 0 0 1 6 19 29 25 14 5 2 1
of Hs = 4 m and Tz = 10 s is not the
5.5 0 0 0 2 6 12 12 8 3 1 0
most frequent, but also not infrequent.
6.5 0 0 0 0 2 4 5 4 2 1 0
7.5 0 0 0 0 1 2 2 2 1 0 0
8.5 0 0 0 0 0 1 1 1 1 0 0
9.5 0 0 0 0 0 0 1 0 0 0 0

16 Michaela & Tobias Höfler // July 26, 2017


Data synthesis procedure 2.3

Sea spectrum FRFs Response Spectra Time series

Sη [m2 s/rad]
FRFH [m/m]

Heave [m]
Sη [rad2 s/rad]
Sζ [m2 s/rad]

FRFR [rad/m]

Roll [rad]
Sη [rad2 s/rad]
FRFP [rad/m]

Pitch [rad]
ω [rad/s] ω [rad/s] ω [rad/s] Time t [s]

Fig. 2.5 The above illustration depicts an exemplary process from a sea spectrum to time series, via the corresponding
amplitude of the transfer functions (FRFs); the magnitude of the plots is of marginal importance here. The leftmost
plot shows the Bretschneider spectrum for a chosen significant wave height Hs = 3 m and zero-upcrossing period
Tz = 7 s. In the second column, there are the FRFs for heave FRFH , roll FRFR and pitch FRFP ; they are based on the
closed-form expressions presented in subsection “Transfer functions”, for a ship speed of V = 12 kts and a relative
heading of µ = 135°. The next column represents the resulting response spectra — the multiplication of the sea
spectrum with the amplitude of the transfer function squared — that indicate how the vessel reacts to every frequency
component of the sea state. From these, the corresponding time series can be set up by taking the amplitude at every
frequency in the sea state, multiplying it with a sinusoidal unit wave (with random phase shift), and then adding all
of them together.

Heave

η3 Roll Pitch
η4 η5
Yaw η6 η1 Surge η2(t) Sway

Fig. 2.6 The ship-fixed coordinate system is used as a reference for the measured ship motions. First of all, there
are three translatory degrees of freedom: surge (η1 ), sway (η2 ) and heave (η3 ); in addition, there are three rotatory
degrees of freedom: roll (η4 ), pitch (η5 ) and yaw (η6 ). Not all of them are needed in the course of this thesis —
nevertheless, the knowledge of them is crucial to understanding why some of them are more useful for the topic at
hand.

17
2 Wave and vessel motion theory Master thesis: Sea State Estimation in the Time Domain

frequency response function (FRF) drawn in red, to calculate the response spectrum Sη in
yellow. The response spectrum can then be transformed in a response time series in the
rightmost diagram. Moreover, it can be seen in Figure 2.5, that there are three different
FRFs plotted, which result in three different response spectra and three time series. This
is the case because a ship has six degrees of freedom, which are depicted in Figure 2.6.
Three degrees are translatory ones: surge (η1 ), sway (η2 ) and heave (η3 ); in addition, there
are three rotatory degrees of freedom: roll (η4 ), pitch (η5 ) and yaw (η6 ) [30]. However, not
all six degrees of freedom are strongly coupled, especially not for usual ship hulls, which
are symmetric around the centerline plane [35]. In any case, there is a strong correlation
between surge, sway and yaw, as well as between heave, roll and pitch [35]. Due to the
fact that the first coupled set of motions corresponds to the general sailing and maneu-
vering of the ship, they are not of interest for a sea state estimation. However, heave, roll
and pitch are motions which are induced by the incoming waves and not by operating the
ship. Therefore those three can be used to calculate the sea state, and as already seen in
Figure 2.5 every motion has its own transfer function as well its own response spectrum
and time series.

2.3.1. Closer-to-reality time series

The topic which will be presented now represents an alternative form of creating time
series. The version specified before has some shortcomings, which may be considered
advantages when seen from the “laboratory condition” point of view. What these are and
how they can be overcome shall be discussed in this section.

In the script Ship Operations - Engineering Analyses and Guidance Nielsen [30] states
that using the classic procedure (of slicing the sea spectrum with equidistant frequencies,
converting each spectral density to a wave amplitude and adding up the corresponding
elementary waves) “has a major flaw: the resulting synthesized time history repeats itself
[…]. Furthermore, the statistical characteristics of the time history will be unrealistic, since
there will be one maximum wave amplitude which will be repeated at every period TH and the
probability of the wave amplitude exceeding this value will be zero. Real ocean waves never repeat
themselves and there is a finite probability of greater wave amplitudes being exceeded” [30].
This is certainly true and should not be neglected when working with “classic” time series
as is done in the thesis at hand. The utilized time series are limited in length, so that
the mentioned repetition cannot occur; the time series length is based on the minimum
angular frequency included.

2π 2π 2π
ω=2πf = ⇔ Tz = ⇒ Tz max = 2.12
Tz ω ωmin

18 Michaela & Tobias Höfler // July 26, 2017


Data synthesis procedure 2.3

For a time series with a length of 20 min this means that ω = 5.235 987 756 × 10−3 rad is
the limit for repetition. Elementary waves above this threshold will repeat themselves, the
ones below will not complete a full cycle once. For the added up resulting time series, this
means that when the threshold value is the smallest discrete frequency used, and it has a
non-zero amplitude, the overall series will not repeat itself. For the creation of longer time
series this technique cannot be considered useful. So how can the problems identified be
overcome?

As a solution for the low-level irregularity is to “synthesise the time history using non-
equally spaced discrete frequencies. This may be done, e.g. by choosing the discrete frequencies
randomly” [30]. But still, this does not alter the fact that the statistical characteristics are
still unrealistic. The wave amplitudes are not Gaussian distributed when a finite amount
N of discrete frequencies is used, just when N → ∞; however, this is not practicable in
engineering applications [30]. Nielsen [30] proposes the following fix:

N
X
ζ(t,x) = ζ̃i [ Vi cos (ki x − ωi t) + Wi sin (ki x − ωi t) ] 2.13
i=1

The vectors V ~ = [V1 , . . . , VN ]T and W


~ = [W1 , . . . , WN ]T contain entries chosen randomly
from a standard normal distribution. In that way “the process will be Gaussian, independent
of the value of N ” [30]. But why is this the case? A short analysis of Equation 2.13 will
bring clarification. The overall response is composed of N harmonic waves, based on the
corresponding wave amplitude ζ̃i 1 . Unlike the procedures described before, it is multiplied
with both sine and cosine waves, which have independent standard normal distributed
amplification factors Vi and Wi . In that way, it is possible that the unit wave is amplified
to a magnitude larger than 1, but also reduced to one smaller than 1. This also influences
the phase shift of each wave component: for the case Vi = 0 the corresponding wave
is only based on sine and has thus extrema at n2 π , with n = 1, 2, . . .; the same applies
analogously to the cosine part, which has its extrema at nπ . If Vi 6= 0 and Wi 6= 0 at
the same time, the location of the extrema is located somewhere in between. A question
following might be: is the phase shift in this method standard normal distributed then?
They are not, as the entries of V ~ and W
~ are based on a standard normal distribution,
but are not sorted; in this way it is possible to avoid a situation where the most probable
magnitudes coincide more often than other combinations. As a consequence, the resulting
phase shift is randomly distributed.

1
In Equation 2.13 the underlying harmonic waves are created using the phase “ki x − ωi t”. k represents the wave number, which
describes the number of radians per unit distance, with which the wave propagates. It is a function of the angular frequency and
the phase velocity of the wave component: k = ω/Vph. x is a spatial coordinate parallel to the direction of wave propagation in
this context. As can be seen, the phase indicates that the harmonic waves move in positive x-direction (left to right in the classic
coordinate system), because as time grows, x has to grow as well to track the state of the surface elevation.

19
2 Wave and vessel motion theory Master thesis: Sea State Estimation in the Time Domain

The Gaussian character of the method — though not extending to the phase shift — can
be evaluated best when the spectral representation of the final series is considered. Since
every amplitude ζ̃i is scaled by two random numbers in the range of 0 . . . 1, the corre-
sponding spectral density will also deviate from the smooth Bretschneider spectrum on
which ζ̃ was originally based on. Hence, the resulting spectrum will be bumpy. If this
experiment is repeated multiple times and the spectra are averaged, the trend will be the
initial Bretschneider spectrum, however.

To get to the implementation of the proposed fixes, the essential code snippets shall be
presented. The first step is to specify how many frequencies should be used, as well as
the minimum and maximum interval boundary.
In the next step, this interval is populated with randomly distributed discrete steps. For
that purpose, N − 2 non-normal distributed random numbers are obtained; together with
the interval boundaries, the specified amount of frequencies will be met. Since the random
numbers might not be located in the desired interval, they are normalized with the largest
random number in the set and then scaled to match the needs — in Matlab the imple-
mentation rand for random numbers with equal probability (uniform distribution) yields
magnitudes between 0 and 1, which eliminates the need for normalization that might arise
when other programming languages are used.

rng('shuffle ') ;% Shuffle the random number generator


F = rand (1,N−2) ;% Get random numbers , without min and max
%F = F./ max(F) ;% Normalize them with the upper freq. limit
dF = (MaxF−MinF)/(N−1) ;% Roughly calculate the mean step length
F = MinF + F∗(MaxF−MinF−dF);% Scale them to the specified range
F = sort ([MinF ,F,MaxF ]) ;% Add the points at the specified boundaries

Being in possession of a “fuzzy” discretization of angular frequencies now, the standard


normal distributed vectors need to be generated.

V = randn (Freq.nFreqs ,1);


W = randn (Freq.nFreqs ,1);

The above snippet creates vectors of the dimension mN ×1, which may directly be used
for the time series generation as was described above. As a result, it can be said that the
created time series will feature a more irregular sea state than the method of choice in this
thesis does. But why is it still used then, when the method presented here is much closer
to reality? It is not because there is a flaw in this new method, but the random deviations

20 Michaela & Tobias Höfler // July 26, 2017


Transfer functions 2.4

in spectral amplitudes make errors in the Kálmán filter harder to spot; fluctuations in the
spectrum estimate can in this way not be assigned to the filter directly, they could also
have been caused during time series generation. For future continuation of this project, a
utilization of a method closer to reality is encouraged.

2.4. Transfer functions

Transfer functions are a common way to describe a ship’s behavior to a wave exciting
the ship with respect to the degree of freedom [30]. Ship transfer functions are complex,
which implies that they consist of an amplitude and a phase. The amplitude function is
often called frequency response function (FRF) and this abbreviation is widely used in
this Master thesis. The term response amplitude operator (RAO) is also often used in this
context and the thesis, but RAO refers to the FRF squared [20]. A lot of literature has
been written about transfer functions and it is a wide topic, but here only a very short
introduction and some basic assumptions are given, because everything else would be out
of the scope of this thesis. Instead, the main focus is set on the kind of transfer functions
used. A basic assumption behind transfer functions as well as the general data synthesis
process is linearity of the relation between the waves and the ship motion, but also that
potential flow applies [35]. There are more assumptions taken, which will not be discussed
further. As already stated, a transfer function describes a ship’s behavior in response to
an exciting wave, therefore they can, in general, be achieved by solving the equation of
motion with respect to the degrees of freedom considered [30]. The equation of motion in
matrix-vector representation has the following form

(I + A) ~η¨ + B~η˙ + C~η = Fex 2.14

with I the mass moment of inertia matrix, A the hydrodynamic added mass matrix, B the
hydrodynamic damping coefficient matrix, C the hydrostatic coefficient matrix and Fex the
excitation force/moment depending on the corresponding degree of freedom [35]. A further
description of the equation of motion as well as the coefficients shall not be given here,
instead it shall be referred to various textbooks and publications like Sea loads on ships
and offshore structures by Faltinsen [7] and Load and global response of ships by Jensen
[20]. However, there are different ways to solve the equation of motion and to achieve a
transfer function. The common ones are strip theory [36], model tests and closed-form ex-
pressions [21], though there exist more ways, which will not be further described here. For
this Master thesis, it was decided to use the closed-form expressions by Jensen et al. [21],
because they are very flexible regarding heading, speed and frequency range. Moreover,
the closed-form transfer functions are quite rapidly implemented into a program code, do
not need much computational power and can be adjusted to different ships very easily.

21
2 Wave and vessel motion theory Master thesis: Sea State Estimation in the Time Domain

However, before the closed-form transfer functions will be explained, the general shape
of the heave, roll and pitch FRF shall be described. In case of the heave FRF, as can be
seen in Figure 2.5, the amplitude of the transfer function reaches the value one when the
frequency approaches zero. The explanation is that for small frequencies the ship reaches
its hydrostatic equilibrium condition in heave. Moreover it can be seen, that the amplitude
approaches zero when the frequency approaches its maximum considered value. That can
be explained with the ship’s inertia, which is the reason why the ship reacts with delay
to an incoming wave. For high frequencies the ship width is much larger than the wave
length, what leads to multiple crests and troughs acting on the ship at the same time. As
a result the ship nearly does not move in heave, because the ship inertia does not allow
such a fast reaction of the ship to the incoming waves and the crests and troughs cancel
each other more or less out. The overall shape of the heave FRF has the two described
limits and sometimes a peak value in between, which can be higher than 1. The general
shape of the pitch and the roll FRFs look quite similar to each other, which can also be
observed in Figure 2.5. When the frequency approaches zero the amplitude reaches zero
as well and the same applies for the upper limit of the frequency. In between those limits,
one can find one or sometimes more peak values, but all values of the FRF are positive.

In the following part, the used equations for the transfer functions will be briefly presented
as well as some implementation problems discussed. The transfer functions are of high
importance, because they are used for the data synthesis procedure, but they are also used
for the Kálmán filter, as will be further explained in chapter 3. The closed-form transfer
functions are based on a semi-analytical approach and only valid for mono-hull ships [21];
the following equations have been taken from “Estimation of ship motions using closed-
form expressions” by Jensen et al. [21]. The heave frequency response function FRFH (ω)
and the pitch frequency response function FRFP (ω) can be calculated based on the ship’s
main dimensions, cf. ship length L, ship breadth Bm and ship draft T , as well as by

FRFH (ω) = φ FH 2.15


FRFP (ω) = φ FP 2.16

with the forcing functions FH and FP and the sectional damping approximation D as
presented below.

 
2 ke L
FH = κβ sin 2.17
ke L 2

    
24 ke L ke L ke L
FP = κβ sin − cos 2.18
(ke L)2 L 2 2 2

22 Michaela & Tobias Höfler // July 26, 2017


Transfer functions 2.4

ωe 2 Bm ωe 2 T
   
D = 2 sin exp − 2.19
2g g

To solve Equation 2.15, the factor φ is still needed:


s −1
2
D2

φ =  (1 − 2 k T α2 )2 +  2.20
k Bm α 2

The following is also needed:


s 2
D2

2
β= (1 − k T ) + 2.21
k Bm α 3

The effective wave number and the frequency of encounter can be calculated in the usual
way, by
ke = |k cos (µ)| and ωe = ω − kV cos (µ) 2.22

The parameter α is defined as



α = 1 − Fn kL cos (µ) 2.23

with the Froude number being Fn = √V , and the approximation of the Smith correction
gL
factor
κ = exp (−kT ) 2.24

In general V stands for the ship speed with the unit ms , k represents the wave number,
µ is the ship’s relative heading and g the gravitational constant, which is here taken as
g = 9.81 ms2
. Some remarks shall be made regarding the presented equations as well as the
implementation. In the original paper by Jensen et al. [21], there is a small typographical
error in Equation 2.24 for the Smith correction factor κ, which was already corrected in
the shown equation — originally ke was printed, although k would be correct. Regarding
the implementation it should be noted that for a heading of µ = 90° the effective wave
number becomes zero, which does not allow calculation of the forcing functions FH and
FP . Therefore, the effective wave number has to be set manually to a very small number,
in this case ke = 10−3 , for a heading of µ = 90°. In addition, it can happen that for some
frequencies the FRF becomes negative. However, a negative FRF is not possible and this
negativity needs to be corrected by taking the absolute value. The same applies for the
encounter frequency ωe , which can become negative especially when speed is included (this
will be further explained in section 2.5, “Speed dependent inter-domain mapping”, from
page 28 onwards). Therefore, in all cases the absolute value of the encounter frequency is
taken in order to overcome this problem: ωe = |ω − kV cos (µ)|.

23
2 Wave and vessel motion theory Master thesis: Sea State Estimation in the Time Domain

Additionally, the phase shift of the response is needed, because the Kálmán filter takes the
real and the imaginary part of the transfer function into account. As described so far, the
FRF is only the amplitude of the transfer function, and in order to get the complex transfer
function also the phase shift is needed. This cannot be found in the paper “Estimation
of ship motions using closed-form expressions” [21], but it is stated that heave and pitch
have a phase shift of 90° between each other [21]. However, there is a second paper (by
Mansour et al. [25]) that describes the phase shift of the transfer functions. In this paper,
the phase is split up into two parts: the phase of the excitation force/moment f and the
phase between the excitation force/moment and the motion response w [25]. The complete
phase shift can be taken as the summation of the two components. This was done here
for heave with the following equations [25]:
 
1 − kT
f = arccos 2.25
β
w = arccos 1 − 2 k T α2 φ 2.26
 

Furthermore, the phase shift of the pitch transfer function is the heave phase shift plus 90°.
The roll transfer function is based on another model as the transfer functions for heave
and pitch, thus the ship’s hull is modeled by two prismatic beams [21]. Even though that
the draft T is the same for both beams, the breadth Bm0 and Bm1 , as well as the cross
sectional areas A0 and A1 , differ [21]. Another parameter is used in order to determine
the length of each beam, which is δr that gives the length of the beam with the zero index,
δr L. This implies that the other beam has the length (1 − δr ) L. A recommendation by the
authors is to take Bm0 as the original breadth of the ship and the length parameter δr as
δr = 0.7. This was done for this Master thesis, which allows to calculate the ratio of the
beam breadth γr by using the water plane area coefficient Cwp in the following way [21]:

Bm1 Cwp − δr
γr = = 2.27
Bm0 1 − δr

The next step is to calculate the cross sectional areas by taking the same block coefficient
for the model and the real ship, which leads to:

Cb Bm0 T
A0 = and A1 = γr A0 2.28
δr + γr (1 − δr )

This model can be used to calculate the actual amplitude of the transfer function for roll
FRFR in the following way:

|M |
FRFR (ω) = h i2 0.5 2.29
Tn 2 2 2

−ωe 2 2π + 1 C44 + ωe 2 B44

24 Michaela & Tobias Höfler // July 26, 2017


Transfer functions 2.4

This equation contains the natural roll period Tn , which can be estimated from the IMO
Resulution A.685(17) - Weather criterion for fishing vessels of 24 metres in length and over [17],
as Mansour, Jensen, and Olsen state. The resolution gives the equation for the rolling
period stated hereafter.

2Cn Bm
Tn = √ 2.30
GM

GM is the initial metacentric height of the vessel. It represents the distance between the
center of gravity and the metacenter. The latter is the intersection point of the line of
action of the buoyancy force and the centerline of the vessel. In the initial, or upright,
condition, it is calculated for small virtual roll angles. The constant Cn can be calculated
for ships with L ≥ 45 m by the expression:

Bm L
Cn = 0.373 + 0.023 − 0.043 2.31
T 100

The restoring moment coefficient C44 can be calculated by C44 = g∆s GM , where ∆s
stands for the displacement of the ship. The total hydrodynamic restoring coefficient B44
can be calculated by
B44 = Lb44,0 δr + κ̃2 (1 − δr ) 2.32
 

where b44,0 means the hydrodynamic restoring coefficient for the beam with the index
zero. This coefficient as well as the one for the beam with index one can be calculated by
the following formula considering the applying breadth and cross sectional area of each
beam: r
2g
ρABm 2 a exp bωe −1.3 ωe d 2.33

b44 =
Bm

The variables a, b and d are actually functions which account for the fitting that was done
to achieve the expression for the hydrodynamic restoring coefficient. By this it is meant
that in the paper two sets of function formulas are given for different BTm ratios. In a
personal consultation, Jørgen Juncher Jensen recommended to use the functions for the
range of 3 ≤ BTm ≤ 6 even if this ratio does not apply for the ship considered, which leads
to the subsequent expressions.

Bm
a = 0.256 − 0.286 2.34
T
Bm
b = −0.11 − 2.55 2.35
T
Bm
d = 0.033 − 1.419 2.36
T

25
2 Wave and vessel motion theory Master thesis: Sea State Estimation in the Time Domain

The ratio of the sectional damping κ̃ can then be calculated by:


s
b44,1
κ̃ = 2.37
b44,0

Only the amplitude of the rolling moment |M | is left to be calculated, which can be done
by using:
r
ρg 2 2 p
|M | = |sin (µ)| b44,0 · . . .
ω ke
 2 2.38
sin (0.5δr Lke ) + κ̃2 sin2 (0.5 (1 − δr ) Lke ) + . . .
2κ̃ sin (0.5δr Lke ) sin (0.5 (1 − δr ) Lke ) cos (0.5Lke )]0.5

However, as described for the heave and the pitch transfer functions, the outcome of these
calculations is only the amplitude of the transfer function which gives no information
regarding the phase. The phase of the roll transfer function is also described in the
publication of Mansour et al. [25] and consists of two parts: the phase angle between the
wave and the excitation moment m as well as the phase between the excitation moment
and the motion ϕ . The phase can be achieved by adding up the two components, which
are presented below, starting with the phase between wave and moment.

Γ1 cos (0.5kL cos (µ)) − Γ2 sin (0.5kL cos (µ))


cos (m ) = 2.39

Γ2 cos (0.5kL cos (µ)) + Γ1 sin (0.5kL cos (µ))
sin (m ) = 2.40

The phase between moment and response is given in the following form:
h i
Tn 2
−ωe 2

2π + 1 C44
cos (ϕ ) = h i2 0.5 2.41
Tn 2 2 2

−ωe 2 2π +1 C44 + ωe 2 B44
−ωe B44
sin (ϕ ) = h i2 0.5 2.42
Tn 2 2 + ω 2B2

−ωe 2 2π + 1 C 44 e 44

In order to solve these equations, a few more parameters are needed. The variables Γ1 and
Γ2 are the result of
p
Γ1 = b44,0 [sin (δr kL cos (µ)) + . . .
2.43
2κ̃ cos (0.5 (1 + δr ) kL cos (µ)) sin (0.5 (1 − δr ) kL cos (µ))]

26 Michaela & Tobias Höfler // July 26, 2017


Transfer functions 2.4

and
p
Γ2 = b44,0 [(cos (δr kL cos (µ)) − 1) + . . .
2.44
2κ̃ sin (0.5 (1 + δr ) kL cos (µ)) sin (0.5 (δr − 1) kL cos (µ))]

The only missing variable is now M̃ , which in the original paper is also denoted |M |
ambigously. After the consultation of the paper’s co-author, Jørgen Juncher Jensen at
DTU, this misunderstanding could be clarified and the following adaptions elaborated. The
considered moment M̃ can be calculated based on Γ1 and Γ2 by:
q
M̃ = Γ1 2 + Γ2 2 2.45

In the end, this moment is not needed at all for the evaluation of the phase shift. When
solving the cosine and sine terms for m and ϕ separately for the phase shift, it turns
out that for each variable a different solution is obtained; although, forming the sum
cos2 + sin2 = 1 succeeds. The best solution, that has been found during the consultation,
sin
is to transfrom both terms for the phase shifts to tan = cos :

Γ2 cos (0.5kL cos (µ)) + Γ1 sin (0.5kL cos (µ))


tan (m ) = 2.46
Γ1 cos (0.5kL cos (µ)) − Γ2 sin (0.5kL cos (µ))
−ωe B44
tan (ϕ ) = h 2 i 2.47
−ωe 2 T2πn + 1 C44

In the Matlab implementation, the function atan2(Y,X) is advised to be used; the or-
dinary inverse tangent atan(Y/X) cannot handle divisions by zero and in the case of -X
in combination with -Y, the negative signs will be canceled out in the fraction, resulting
in the wrong phase shift. In comparison, atan2(-Y,-X) can handle the signs correctly,
due to the fact the arguments X and Y are provided separately and the signs are evaluated
before the division is formed. In that way, atan2 covers all four quadrants of the unit
circle, while atan only covers half of it.

In addition it should be noted here, that it is essential for the implementation not to use
an exact heading of µ = 90°. This would end with division by zero in some formulas;
therefore, in a case like that the heading is set to µ = 90.000 01°.

27
2 Wave and vessel motion theory Master thesis: Sea State Estimation in the Time Domain

2.5. Speed dependent inter-domain mapping


Since the Kálmán filter requires time series as an input — as has been mentioned and
their creation described before — and these reside in the encounter domain (because the
on-board motion sensors are only capable of recording the vessel’s response to the sea
state, not the cause of the motion), this section will deal with the transformation between
domains. If the vessel keeps its position, there is no difference between wave domain and
encounter domain, due to the fact the frequency with which the waves hit the ship is
exactly that of the wave. If the vessel velocity is taken into account, the behavior changes
(as Figure 2.7 illustrates).

Considering the crucial case: when the waves approach from the aft (following sea) that
effect may be explained most easily. If the speed of the vessel V is larger than the phase
velocity Vph of the wave1 , an observer standing on the ship would see them arriving from
the front, while an observer outside the vessel would testify that they move in the opposite
direction. In the case when the wave overtakes the ship, both observers would agree on
the direction of the waves (from the aft), but disagree on their speed. A third case is, that
vessel and wave are at almost equal speeds, so that there is little relative velocity; this
is a very dangerous condition, in which parametric rolling can occur. However, this is a
different topic.

Fig. 2.7 Illustration of the encounter frequency speed dependence for following sea: in the left case, the vessel is
faster than the waves, in the right case the waves overtake the vessel. For an observer on the ship, the waves approach
from the front in the left case and from the aft in the right case.

1
The phase velocity of the wave is the speed with which crest and through move; in contrast to this, the group velocity stands for
the velocity with which the energy of the wave pack proceeds. The relation between both is depth dependent. However, in an
irregular/random sea state there are infinitely many elementary harmonic waves, each having its own frequency and phase velocity.

28 Michaela & Tobias Höfler // July 26, 2017


Speed dependent inter-domain mapping 2.5

Beam sea

Quartering sea Bow sea

Following sea Head sea

Quartering sea Bow sea

Beam sea

Fig. 2.8 The relative heading angle µ, between wave and vessel heading, is defined as 0° for waves in the same
direction as the vessel (following sea), and 180° for waves approaching the vessel against its direction of travel (head
sea); it is counted clockwise, as seen from the bird’s eye perspective. In this order, there are also quartering sea, beam
sea and bow sea, in between the ones named earlier. Since the vessel is symmetric, the names are also valid for their
mirrored counterpart.

The above case was seen as crucial, because e.g. with waves coming in from the side
(beam sea) the forward speed of the vessel has no influence on the frequency of encounter.
In the case of head sea (waves from the front), any magnitude of forward speed (except
moving backwards) can only increase the frequency of encounter. Before the mathematical
representation of the described effects come up for discussion, it is deemed necessary to
state that the symbol µ stands for the relative heading angle in this section; it has nothing
to do with the mean or average value as used later in chapter 4, “Confidence intervals”.
Figure 2.8 gives an impression of how the relative heading angle µ is applied here: from
0° for following sea, it is counted positive clockwise, passing beam sea from the port side
at 90°, at 180° the waves are coming in from the front, at 270° from the starboard side, and
360° equals 0°.

The now following formula has already been used in the closed-form expression part (cf.
Equation 2.22), because there speed and heading are also important for the vessel’s response
to the sea state. Nevertheless, it shall be stated again to bring it back to mind before the
subsequent transformation.

29
2 Wave and vessel motion theory Master thesis: Sea State Estimation in the Time Domain

V
ωe = ω − ω 2 cos (µ) 2.48
g
As is obvious, the expression maps from ω to ωe , ergo from wave domain to encounter
domain. From the motion signals one obtains a result in the latter, but wishes to know
about the former — in the fashion ω = f(ωe ) . For zero speed, the solution is simply ω = ωe ,
but for forward speed influence the above formula needs to be turned inside out:

ψ
z }| {
V
⇒ − cos (µ) ω 2 + ω − ωe = 0
g
1 1
⇒ ω2 − ψ ω + ψ ωe = 0

By using the solving mechanism for (reduced) quadratic equations [51] the following
expression was created: p
1 ± 1 − 4ψωe
ω= 2.49

Due to the fact that any number, if squared, shares the same positive result with its nega-
√ √
tive facsimile, each positive number has two square roots: “ a, which is positive, and − a,

which is negative. Together, these two roots are denoted ± a […]. Although the principal square
root of a positive number is only one of its two square roots, the designation ‘the square root’ is
often used to refer to the principal square root” [52]. Applying this to the above expression,
is the reason for the sign “±” in the solution to the quadratic equation.

Having obtained this, it is necessary to consider what happens when the square root in
the subtractive solution is larger than one. The wave frequencies would become negative,
which is physically implausible. For this reason, Iseki and Ohtsu [19], being “the first […]
to strictly consider the Doppler shift, implying a 1-to-3 relationship between encounter frequency
and wave frequency for certain conditions in following sea” [31], have identified three solutions:
the known ones, valid in the area where the wave frequency is mapped to a positive value,
plus the absolute value of the otherwise negative wave frequency.
p
1− 1 − 4ψωe
ωs1 = 2.50

p
1 + 1 − 4ψωe
ωs2 = 2.51

p
1 + 1 + 4ψωe
ωs3 = 2.52

Their visual appearance has been illustrated in a parametrized manner in Figure 2.9, with
additional information relevant for the subsequent discussion. Figure 2.10 however, aims at
providing an overview of discrete cases that occur at all combinations of V = 0, 10, 20 kts

30 Michaela & Tobias Höfler // July 26, 2017


Speed dependent inter-domain mapping 2.5

and µ = 0°, 45°, 90°, 135°, 180°. The cases of 1-to-1 and 1-to-3 mapping can clearly be
distinguished, the latter limited to following sea including forward speed (please see upper
right corner). However, transforming discrete frequency ranges back and forth is not suf-
ficient if the aim is to obtain a sea spectrum in the opposite domain; the spectral density
has to be considered as well. The overall requirement is energy conservation:

Z∞ Z∞
Sζ(ω) ∂ω = Sζ(ωe ) ∂ωe 2.53
0 0

In the case of 1-to-1 mapping, the subsequent expressions might be conducted; the dif-
ferential ∂ω
∂ω can easily be obtained from Equation 2.48.
e

! ∂ωe ∂ωe
Sζ(ω) ∂ω = Sζ(ωe ) ∂ωe ⇒ Sζ(ω) = Sζ(ωe ) · and Sζ(ωe ) = Sζ(ω) ÷
∂ω ∂ω

Sζ(ω)

A1 A2 A3 ω
ωe
ω1 ω2 ω3
p p
1− 1−4ψωe 1+ 1+4ψωe
ω= 2ψ ω= 2ψ
p
1+ 1−4ψωe
ω= 2ψ
1

Ae ωe
1
ψ √
1 1+ 2
Sζ(ωe ) 2ψ 2ψ ω

Fig. 2.9 The above curves represent an example case of mapping between wave and encounter domain in following
sea, where there is no 1-to-1 relation between ω and ωe . The topmost spectrum is located in the wave domain, while
the leftmost spectrum stands for the same sea state, but as encountered from the vessel’s point of view. The curve
in the remaining plot is the reason why the leftmost spectrum was rotated by 90°: it depicts the mapping between
ω and ωe , thus the axes of the plots were aligned to ones of the same type. The figure and the formulas are based
on the publication by Iseki and Ohtsu [19], with the difference that the factor ψ = Vg cos (µ) is based on angular
frequencies in radians per second instead of Hertz — the original publication includes a factor of 2π in ψ . In the
example, it can be seen that the three areas A1,2,3 , corresponding to the wave frequencies ω1,2,3 with interval width
∆ω , are all projected onto the same range of encounter frequencies. This leads to an increase in spectral density in
that boundary. In this direction mapping is easy, but in the other direction, a split ratio for area spreading is needed.

31
2 Wave and vessel motion theory Master thesis: Sea State Estimation in the Time Domain

If 1-to-3 mapping is assumed, then going from wave domain to encounter domain means
adding up the energy carried by the three wave frequencies that project to the same
encounter frequency. This is fairly straightforward in theory, when the areas A1,2,3 —
above the wave frequencies ω1,2,3 , with ∆ω1,2,3 — are added and then converted to a
spectral density with ∆ωe [31]:

Ae = A1 + A2 + A3
= Sζ(ω1 ) ∆ω1 + Sζ(ω2 ) ∆ω2 + Sζ(ω3 ) ∆ω3 2.54
= Sζ(ωe ) ∆ωe

0 kts at 0° 10 kts at 0° 20 kts at 0°


4 4 4
ω e [rad/s]

3 3 3
2 2 2
1 1 1
0 0 0
0 2 4 0 2 4 0 2 4
0 kts at 45° 10 kts at 45° 20 kts at 45°
4 4 4
ω e [rad/s]

3 3 3
2 2 2
1 1 1
0 0 0
0 2 4 0 2 4 0 2 4
0 kts at 90° 10 kts at 90° 20 kts at 90°
4 4 4
ω e [rad/s]

3 3 3
2 2 2
1 1 1
0 0 0
0 2 4 0 2 4 0 2 4
0 kts at 135° 10 kts at 135° 20 kts at 135°
4 4 4
ω e [rad/s]

3 3 3
2 2 2
1 1 1
0 0 0
0 2 4 0 2 4 0 2 4
0 kts at 180° 10 kts at 180° 20 kts at 180°
4 4 4
ω e [rad/s]

3 3 3
2 2 2
1 1 1
0 0 0
0 2 4 0 2 4 0 2 4

ω [rad/s] ω [rad/s] ω [rad/s]

Fig. 2.10 The depicted plots show visualizations of ωe = ω − ω 2 Vg cos (µ) for all combinations of V = 0, 10, 20 kts
and µ = 0°, 45°, 90°, 135°, 180°. For the left column (without speed) the mapping is always 1-to-1, as well as for
the central row, when the wave approaches from 90° relative heading. In the other cases, the ships velocity clearly
influences the frequency mapping. When the waves approach from the front there is still 1-to-1 mapping, but high
wave frequencies are transformed to even higher encounter frequencies.

32 Michaela & Tobias Höfler // July 26, 2017


Speed dependent inter-domain mapping 2.5

2.5.1. Applied wave to encounter domain mapping


One might think that using the above formula is child’s play, nevertheless it should be
noted that in numerical implementations ∆ωe is unknown before mapping. Also, depending
on the chosen discrete frequency range, not all encounter frequencies which in theory have
three corresponding wave frequencies will be mapped onto, because of numerical round-off
errors. To overcome this complication, the following procedure has been devised:

1 The first step is to apply Equation 2.48 onto a the chosen frequency vector ω
~ to
obtain ω
~ e.

2 Sort the encounter frequencies in ascending order and map ω ~ e back to ω


~ s1 , ω
~ s2 and
~ s3 ; in this way the missing wave frequencies for 1-to-3 mapping are found. This
ω
is most convenient in matrix notation, because it eases exact assignment between
domains:
 
ω1 ωe,1 ωs1,1 ωs2,1 ωs3,1
 ω2 ωe,2 ωs1,2 ωs2,2 ωs3,2 
h i  
ω
~ ω
~e ω
~ s1 ω
~ s2 ω
~ s3 =
 .. .. .. .. .. 
 . . . . . 

ωn ωe,n ωs1,n ωs2,n ωs3,n

3 Extract all re-mapped wave frequencies, remove negative results, sort the vector in
ascending order, and use it to interpolate the spectral density of the original spectrum
onto the extended frequency grid.

4 For all entries of the new dense wave frequency range, calculate ∆ω and the corre-
sponding area beneath the spectrum for each strip width.

5 When the above step is finished, run a for-loop for all encounter frequencies ω
~ e.
The loop contains these steps:
2 For the current encounter frequency, find all three wave frequencies.
~ e.
2 Sum up the corresponding areas to A

6 The remaining action, converting the area to a spectral density for every interval is
Ae
straightforward: Sζ(ωe ) = ∆ω e

33
2 Wave and vessel motion theory Master thesis: Sea State Estimation in the Time Domain

2.5.2. Applied encounter to wave domain mapping


The other way around, going from the encounter domain to the wave domain with 1-to-3
mapping, requires similar tricks. The case is based on splitting up the area which has
been added up in the previous case. But which split ratio should be chosen? There is
no analytical solution for this, just approximations. The most natural method seems to be
to use a generic spectrum formulation as they have been presented in subsection 2.2.2,
“Differences between parametrized sea spectrum representations”, to create a split ratio
based on the spectral densities at the three particular frequencies [31]. For this purpose,
the procedure given below has proven useful:

1 Set up a matrix that collects the projected wave frequencies ω


~ s1 , ω
~ s2 and ω
~ s3 , next
to the encounter frequencies ω~ e that were put in.

2 Eliminate all negative entries, as they have already been covered artificially in ω
~ s3 .
Afterwards, merge the wave frequencies, sort them in ascending order, and remove
duplicates.

3 Use the sorted wave frequencies to create generic spectral densities based on the best
estimate of Hs and Tz that can be obtained from the encounter domain spectrum.

4 For all encounter frequencies in ω


~ e , take the following steps:
2 Calculate the current ∆ωe , then the corresponding Ae .
2 Identify the three wave frequencies that correspond to the current encounter
frequency. Then, for all of them, do the following:
2 Calculate the area in the wave domain by using the generic spectral density
at that frequency, divided by the sum of the spectral densities at all three
corresponding frequencies: Ai = Ae P SS1,2,3
i

2 Store these areas in another matrix, next to the corresponding wave fre-
quency, because they will require sorting before spectral density calculation.

5 Sort the area and wave frequency matrix in ascending order with respect to the wave
frequencies.
A
6 For all area-frequency couples, calculate ∆ω and hereafter Sζ(ω) = ∆ω .

34 Michaela & Tobias Höfler // July 26, 2017


Speed dependent inter-domain mapping 2.5

Application of the latter procedure, for mapping from encounter to wave domain, on the
example case illustrated in Figure 2.10 yields the spectra depicted in Figure 2.11; all of
them feature a Bretschneider spectrum with Hs = 3 m and Tz = 7 s as a generic encounter
spectrum colored in blue. The mapping to the wave domain is represented by the red wave
spectrum. As before, it is not surprising that for zero speed, mapping is not necessary;
wave and encounter spectrum are identical. The same applies for all speeds at a relative
heading of 90° and its symmetrical counterpart 270°, where forward speed is orthogonal
to the waves phase velocity and thus ineffective. For all other combinations, a difference
between spectra is observable. Waves from the front will result in a frequency of encounter
that is always larger than the wave frequency, which represents shortened waves from the
vessel’s point of view. For waves from the aft, the waves seem longer (which is expressed
by larger frequencies), which is the case up to the point where the ship starts surfing the
wave; when its velocity exceeds the phase velocity of the wave, the waves-from-the-front
case starts to apply here as well.

2.5.3. Singularities in mapping


Looking closer at Figure 2.11, a strange phenomenon can be recognized in following and
quartering sea with medium speed: at e.g. 10 kts and 45° relative heading, the wave spec-
trum (that was mapped back from a generic Bretschneider spectrum as encounter spectrum)
has two peaks. In the plot above, at 10 kts and 0° relative heading, the same phenomenon
presents itself. This is not the first case in which it is observed; Journée and Massie
[22] published similar findings in their work Offshore Hydromechanics before. Figure 2.12
depicts the case as published therein [22, Fig. 8.14]. The effects of following waves, cre-
ated under the influence of moderate wind speed, at a vessel velocity of 16 kts is shown.
The plot is drawn as a function of the encounter frequency ωe — it can be seen that in
the low-frequency region, there is a 1-to-3 relation between ωe and the spectral density,
depending on to which ω is mapped to. In addition, there is an asymptotic regime around
g
ωe = 4V in which the spectral density tends to approach ±∞. The mentioned authors
indicate that “this type of distortion takes place whenever the waves have a velocity component
in the same sense as the ship speed — whenever the waves approach from any direction aft of
‘beam seas’. This spectrum will be hard to work with! When waves are approaching from any
direction forward of ‘beam seas’ encounter frequencies only become higher than the absolute
frequencies; no special problems are encountered” [22, p. 8-30].

Even with the procedures devised above, this problem could not be worked around. There-
fore, the suggested method is to obtain measured or estimated wave spectra directly
wherever possible, because mapping to the encounter domain does not have this problem.

35
2 Wave and vessel motion theory Master thesis: Sea State Estimation in the Time Domain

0 kts at 0° 10 kts at 0° 20 kts at 0°


S [m2 *s/rad]

Se
S

0 kts at 45° 10 kts at 45° 20 kts at 45°


S [m2 *s/rad]

0 kts at 90° 10 kts at 90° 20 kts at 90°


S [m2 *s/rad]

0 kts at 135° 10 kts at 135° 20 kts at 135°


S [m2 *s/rad]

0 kts at 180° 10 kts at 180° 20 kts at 180°


S [m2 *s/rad]

ω [rad/s] ω [rad/s] ω [rad/s]

Fig. 2.11 The figure above shows the mapping from an exemplary generic Bretschneider spectrum with Hs = 3 m
and Tz = 7 s as the encounter spectrum (blue plots) to wave spectra (red plots) at all combinations of forward speed
V = 0, 10, 20 kts and relative heading µ = 0°, 45°, 90°, 135°, 180°. The same trends as in Figure 2.10 may be observed.
For zero speed, wave and encounter spectra are identical, as well as for all speeds at beam sea (90° and 270°). In the
remaining cases, the spectra differ: With waves from the front (lower right corner) the wave length always seems
smaller from the vessel’s point of view, while with waves from the aft (upper right corner) they seem longer when the
vessel is slower (projected onto the waves direction of propagation) than the wave; When the critical point of equal
speed — also called surfing — is overcome, then the same behavior as for frontal waves applies.

Fig. 2.12 This plot is a re-


2 production of Figure 8.14, pub-
BF=6
Spectral density Sζ [m2 s/rad]

lished in Offshore Hydromechan-


Following waves ics by Journée and Massie [22].
1 V=16kn g Therein they show multiple spec-
ω< tral density graphs over ωe , as a
ω > Vg 2V
function of the ω that this corre-
0
sponds to; in the low-frequency re-
g
ωe = 4V
gion, there is a 1-to-3 relation be-
−1
tween ωe and the spectral density.
g
<ω< g In addition, there is an asymptotic
2V V g
regime around ωe = 4V in which
−2 the spectral density tends to ap-
0 0.1 0.2 0.3 0.4 0.5 proach ±∞.
Angular wave frequency ωe [rad/s]

36 Michaela & Tobias Höfler // July 26, 2017


Kálmán filter theory
3
Before Rudolf Emil Kálmán published “A New Approach to Linear Filtering and Prediction
Problems” [23] in 1960 (six years after his Master thesis [14]), there had been other filtering
algorithms already in use; the ones on which Kálmán’s work was predominantly based
were “optimal estimation methods developed by Norbert Wiener and Andrei N. Kolmogorov in
the 1940’s”, as Grewal and Andrews [14] express in their historical summary. These
had been procedures for frequency domain estimations using power spectral densities, in
order to “characterize statistical properties with random processes involved” [14]. Kálmán and
his fellow researcher Richard S. Bucy1 , with whom he was working at the Research In-
stiute for Advanced Studies (RIAS) in Baltimore, re-established these procedures in the
time domain “using a generalized state-space form of a linear differential equation” [14]. The
term “state-space form” refers to a mathematical/physical model, frequently used in control
engineering, that models an arbitrary system using the building blocks of input (and/or
control variables), output and state variables, mostly in form of vectors and matrices. In
the Kálmán filter, the state variables are updated at every time step using measurements,
and are then projected onto the next time instance. In this way, the filtering algorithm
is capable of recognizing how far its prediction was off and adjusts the filter gain so that
the next prediction will be more accurate — in this way it will also react to abrupt system
changes by applying a very high gain.

It should be noted though, that the Kálmán filter relies only on one past time step, and
does thus not expand its memory consumption over time — it is recursive. This is one
of the advantages over the Wiener filter. Another advantage is that it uses vector mod-
eling, which allows implementation of multiple inputs and outputs in a relatively simple
manner [3]. As time steps are an important part of the Kálmán filter and also for the
sensor readings intended to be used, this thesis project only applies the discrete time
filter, not the continuous time Kálmán-Bucy filter version. In discrete time models, time
propagates in finite length intervals ∆T (in signal processing it may also be called the
sampling time Ts ) at which signal amplitude data are provided; in the continuous ver-

1
Most of the time, the filter algorithm is only named after Kálmán, leaving Bucy out. But this refers only to the discrete time version
(as used in the course of this thesis) published in 1960; for continuous time applications, published one year later, it is called the
Kálmán-Bucy filter [14].

37
3 Kálmán filter theory Master thesis: Sea State Estimation in the Time Domain

sion, as ∆T → 0, the amount of computational operations per second of signal would


become infinite. Thus, the state-space model for the continuous time version cannot be the
same as for the discrete one. How the continuous version works is not the topic of this
thesis, but the discrete version is. Hence, the subsequent paragraphs will lay the focus on it.

Figure 3.1 depicts the Kálmán filter loop in its basic form; in a manner less like a flow
chart, but more illustrative, the working principle of the Kálmán filter has been published
by Faragher [8]. Since the overall properties of the filter have been discussed in the
text above, the next step is now to take a more thorough look at its matrix and vector
components (which are quite entangled with each other).

3.1. State and measurement vector

In the thesis at hand, the state vector is denoted with x and it contains all the state
variables [ x1 , . . . , xn ]T that are needed to describe the system’s status. Since the “true”
state of a system is never known to the filter algorithm, it works on estimates which
will be indicated by x̂. The initial guess with which the system starts is given by x̂− 0,
where the superscript “-” indicates that this estimate is only a prediction and has not been
checked against an actual measurement of the system’s state. As time progresses, the initial

Initial estimate x̂−


0

Compute the filter gain Kk Measurement zk

Project ahead: Update the estimate:


k →k+1 x̂k = fx̂− ,z 
k k

Update error covariance Pk Estimated state x̂k

Fig. 3.1 The Kálmán filter loop in a generalised illustration. The initial state and its uncertainty is used to estimate
an initial filter gain, or blending factor, which in the next step is used to combine the measurement with the initial
estimate, so that an updated estimate of the state is obtained. Hereafter, the uncertainty of the estimate — the error
covariance matrix — is updated as well. The only remaining step is to proceed to the next time step, so that the loop
starts over again. This also includes predicting what the next estimate and its uncertainty will be, before fusion with
another sensor reading. [3, cf. Figure 5.8]

38 Michaela & Tobias Höfler // July 26, 2017


Output matrices 3.2

subscript “0” is swapped with the temporal index k 1 , that represents the current time by
use of multiples of the sampling time: t = k · Ts . The state vector then has the appearance
x̂−
k after prediction and x̂k after measurement update. Sensor readings are provided in the
measurement vector zk at each time step. Depending on how many sensors are used and
how the state variables are set up to describe the system’s status, x and z do not have to
be of the same size; they are both column matrices though. Both presented vectors are
needed to fuse them into a renewed estimate [3, Eqn. 5.5.8]:


z }|k { 
x̂k = x̂k + Kk zk − Oz k x̂−

3.1
| {z k }
ezk

Here, the factor K is the blending factor [3] and Oz is one of the output matrices. The
latter transforms an a-priori state estimate to an measurement estimate ẑ, which is then
compared to the conducted noisy sensor reading z. The difference is the measurement
error ez . How much this error influences the a-priori estimate is what the blending factor,
or filter gain, K regulates in order to achieve a useful data fusion; these variables will be
further discussed later.

3.2. Output matrices


These matrices are responsible for the transformation from the state-space to any desired
output that can be formed from the content of the state vector. Of current interest are
especially the estimated surface elevation ζ̂ (t) , the estimated sea spectrum Ŝ (t,ω) and the
estimated next measurement ẑk (based on x̂−k from the prediction step of the last iteration),
which will be compared to zk to judge the quality of estimation. The desired outputs can
be achieved by multiplying the state vector — in linear or non-linear fashion2 — with the
corresponding output matrix.

ẑk = Oz k x̂k 3.2


ζ̂ k = Oζ k x̂k 3.3
Ŝk = OS k x̂2k 3.4

The size of these matrices depends on the size of the state vector, as well on the size of
the output. In all presented cases, the matrices will be composed of as many columns as
the state vector has elements. The number of rows in each output is variable: ẑ will have

1
The time index k should not be confused with the wave number k.
2
Why the squared version of the state vector is needed for the sea spectrum estimation, will be explained in detail in chapter 5
“Applied Kálmán filter set-up” from page 59 onwards.

39
3 Kálmán filter theory Master thesis: Sea State Estimation in the Time Domain

as many rows as sensors are included, Oζ will be a row-vector because the output shall
be scalar, and since Ŝ will be a vector containing all frequency components, the output
matrix will have as many rows as frequencies are part of the state vector.

Another important fact is that the output matrices can be time dependent — they need
to be refreshed at every time step. For example, the wave elevation is a function of
time, composed of summed sine and cosine terms, which depend on ω and the current
position on the timeline. The content of these (and other) matrices depends on the case of
application; in this thesis, it will be discussed in chapter 5, “Applied Kálmán filter set-up”,
starting from page 59.

3.3. Error covariance matrix

This matrix is an essential part of the filtering procedure, due to the fact that it contains
the magnitude of the error between the real and the estimated state for every time step [3,
Eqn. 5.5.9]:
P = E (x − x̂) (x − x̂)T with x − x̂ = ex 3.5
 

It is based on the so called expected value (see Digression 1 for additional information).
In the presented form, the result will be a matrix, containing the expected value of all
combinations of state variable errors multiplied with each other; the so called covariance
CoV xi , xj = σi,j . The main diagonal of P contains thus the expected value of the


state variable errors multiplied with themselves; this is the variance Var xi , which is


also symbolised as σi2 and can be transformed to the standard deviation σi by taking the
square-root of it; note: the standard deviation σi should not be confused with the covariance
between two processes σi,j . The former carries the unit of measurement as the process
itself, the latter, although they share the symbol σ , the units of both processes multiplied!
Based on the above, the error covariance matrix has the shape presented hereafter.
 
σ12 σ1,2 · · · σ1,n
σ22 · · · σ2,n 
 
P :=  3.6

.. .. 
. . 
 

sym. σn2

Since the real state x (on which the content of P is partially based) will always be unknown,
the error covariance matrix cannot be calculated from scratch. An initial estimate P0 will
instead be modified with every time step. To achieve a formula to do this, the physics
behind the real sensor readings should be modeled [3, Eqn. 5.5.2]:

zk = Oz k xk + vk 3.7

40 Michaela & Tobias Höfler // July 26, 2017


Error covariance matrix 3.3

The true but unknown state vector x is included again. The sensor noise vector v adds the
noise to this model, since only the mapping of the true state into the measurement domain
would not depict real life measurement. The magnitude of v is not explicitly known; it is
contained in z, which can be obtained from the sensor data stream directly.
Inserting the above model into Equation 3.1 yields [3, cf. Eqn. 5.5.10f]:

x̂k = x̂− −
k + Kk Oz k xk + vk − Oz k x̂k


= x̂− −
k + Kk Oz k xk + Kk vk − Kk Oz k x̂k
3.8
= x̂− −
k − Kk Oz k x̂k + Kk Oz k xk + Kk vk
= (I − Kk Oz k ) x̂−
k + Kk Oz k xk + Kk vk

With this, a new version of the estimation error vector can be formulated [3, cf. Eqn. 5.5.10f]:

exk = xk − x̂k
= xk − (I − Kk Oz k ) x̂−
k − Kk Oz k xk − Kk vk
3.9
= (I − Kk Oz k ) xk − x̂−k − Kk vk


= ( I − Kk O z k ) e −
xk − Kk vk

Digression: the Expected Value

The expected value is the long-term average of a random variable, and is “also known as the
expectation, mathematical expectation, EV, average, mean value, mean, or first moment” [45]. In
terms of e.g. probability density functions, as the Gaussian distribution is, the expected value is
the location of the highest probability, the variance σ 2 the measure of howfar the samples are
scattered around it. The expected value is represented by the operator E . . . and in the discrete
case is a weighted average of all samples (cf. [3, 45]):
Pn
xi pi
E x = Pi=1
 
n
i=1 pi

The probability for each value xi to occur  is pi . The


 properties
  of the expected value operator,
relevant to this work, are the linearity E E E y in terms of addition, and E cx =
  
x + y = x +
c E x with E c = c, where x and y are two random variables, which may be statistically
   

dependent, and c is a constant. Utilizing these properties, the variance and the co-variance can
be expressed as:

Var x = E x − E x x − E x
      
CoV x, y = E x − E x y − E y
      

= E xx − E x E x
     
= E xy − E x E y
     
 2
= E x2 − E x
 

If x and y are independent of each other (uncorrelated), the result is that CoV x, y = 0.


Digr. 1 The meaning and properties of the expected value operator E . . . , condensed with respect to relevance for
 

this thesis. Application of these properties yields expressions for the variance and the covariance.

41
3 Kálmán filter theory Master thesis: Sea State Estimation in the Time Domain

Inserting this into Equation 3.5, and applying the properties of transposing presented in
Digression 2, is the next step in the derivation of a useful formulation [3, cf. Eqn. 5.5.10f]:

Pk = E exk eTxk
 
T 
= E {I − Kk Oz k } e− xk − Kk vk { I − Kk O z k } e −
xk − Kk vk
 

= E {I − Kk Oz k } e−
 −T T T
xk − Kk vk exk {I − Kk Oz k } − {Kk vk }
3.10
 

= E {I − Kk Oz k } e− −T T − T
xk exk {I − Kk Oz k } − {I − Kk Oz k } exk {Kk vk } . . .


− Kk vk e− T T T
xk {I − Kk Oz k } + Kk vk vk Kk
T


The expression is still a bit too long to be convenient and can be made more compact by
utilizing the properties of the expected value operator. It turns out that the identity matrix
I, the filter gain K and the output matrix Oz are constants for each time step; they can
be factored out due to the linearity of the expected value operator. Thus, the expression
can be modified to the form [3, cf. Eqn. 5.5.10f]:

Pk = {I − Kk Oz k } E e− −T T
xk exk {I − Kk Oz k } . . .
 

− {I − Kk Oz k } E e− T
 T
xk vk Kk . . .

3.11
− Kk E vk e− T T
xk {I − Kk Oz k } . . .
 

+ Kk E vk vTk KTk
 

Looking at the expected values present in the above equation, the observations as follow
can be made [3, p. 215].

E e− e −T
= P− −
k : The a-priori error covariance matrix, based on x̂k
 
 xk xk
E e− vT = 0 : The variables are independent of each other

 xk −kT 
E vk exk = 0 : The variables are independent of each other
E vk vTk = Rk : The sensor noise covariance matrix
 

This leads to a formula with which the filter can update the error covariance matrix with
the recent measurement data [3, Eqn. 5.5.11]:

Pk = {I − Kk Oz k } P− T T
k {I − Kk Oz k } + Kk Rk Kk 3.12

The noise covariance matrix R is among the variables that will be explained in the following
paragraphs. Before this however, the filter gain should be introduced, because it can be
used for a shorter version of the above formula, based on optimal gain.

42 Michaela & Tobias Höfler // July 26, 2017


Filter gain 3.4

Digression: rules of Transposing

Transposition of a matrix A yields a matrix AT with the same main diagonal, but otherwise
mirrored content; the number of rows is now the number of columns and vice versa: Aij = ATji .
Thus, if the dimension of A was mr×mc , the one of AT is mc×mr . For this reason, the unchanged
main diagonal also means that the trace remains unaltered! In addition to this, there are some
useful properties to transposition operator (cf. [54]):
T
(A + B) = AT + BT
T
(AB) = BT AT
T
(cA) = cAT

For square matrices, there are some special properties. If a matrix is square and symmetric, then
A = AT . Other special properties for orthogonal or complex matrices shall be omitted here, since
they are not relevant for this thesis.

Digr. 2 The rules of transposing; at least these relevant for the thesis at hand. Most important is that transposition
does not alter the trace of a matrix, and that for square symmetric matrices the transposed version is equal to the
original.

3.4. Filter gain

As already addressed briefly beforehand, K is the blending factor or filter gain. It is


applied in the step when the a-priori state vector is merged with the error ez between
the conducted measurement z and its estimate ẑ, which itself is the product of the mea-
surement output matrix Oz and the a-priori state (cf. Equation 3.1). The filter gain is the
control variable of the filter to tune the data fusion; it should be applied in a way that the
updated estimate fits best to the estimated real state. But how can optimal gain be achieved?

To compress the story: all trails lead to a minimization problem. A gain K is needed
that reduces the uncertainty as much as possible. As mentioned earlier, the uncertainty
is stored in the error covariance matrix P in form of the (co)variances (cf. Equation 3.6)
— thus the search for an expression for K that reduces the trace of the error covariance
matrix has topmost priority. But why the trace? It works as a least squares error method,
reducing the overall error of the system instead of focusing on a single state variable only.
Hence, if tr(P) is as small as it can be, the Kálmán filter output is less questionable and
the filtering optimal.

The first step in this encounter is to expand the general, conveniently sized form of P, as
given in Equation 3.12, to a longer form [3, Eqn. 5.5.15]:

Pk = P− − − T T − T
 T
k − Kk Oz k Pk − Pk Oz k Kk + Kk Oz k Pk Oz k + Rk Kk 3.13

43
3 Kálmán filter theory Master thesis: Sea State Estimation in the Time Domain

In the next step, the trace of the above expression is to be formed. To this effect, the
properties of the trace for square matrices [26, 53] may be taken advantage of:

tr(A + B) = tr(A) + tr(B) : Linearity


∂ tr(A) = tr(∂ A)
tr(AT ) = tr(A) : Transposing possible
tr(AT B) = tr(BAT )
tr(ABC) = tr(BCA) : Cyclic permutation allowed

The trace operator is linear in a way that the trace of the sum of two matrices is equal to the
sum of the trace of every matrix. If a differential operator is applied to the trace of a matrix,
it can also be applied to the matrix before taking the trace; it does not alter the result.
Neither does transposing square matrices within the trace operator, because transposing
has no influence on the main diagonal of the transposed matrix (cf. Digression 2 again).
In addition to that, cyclic permutation within the trace is also allowed for square matrices;
for non-square matrices some more conditions need to be met. With this knowledge in
mind, the trace of the error covariance matrix reads

tr(Pk ) = tr P− − − T T − T
 T
k − Kk Oz k Pk − Pk Oz k Kk + Kk Oz k Pk Oz k + Rk Kk
= tr P− − − T T − T
 T
k − tr Kk Oz k Pk − tr Pk Oz k Kk + tr Kk Oz k Pk Oz k + Rk Kk
  
| {z }
= tr Kk Oz k Pk = tr Kk Oz k Pk due to symmetry P−
−T − −T
k = Pk
3.14


= tr P− − T − T
k − 2 tr Kk Oz k Pk + tr Kk Kk Oz k Pk Oz k + Rk
  
| {z }
Applied cyclic permutation to KTk

As stated initially, the differentiation of the error covariance matrix trace with respect to
K is advised. But what dimension will the output of that operation have? tr(P) is a
scalar value, while K is a matrix of the dimension mx ×mz 1 — this is because it is the
connection between state vector and measurements. The result of the differentiation will
hence be of the same dimension as K, as the following example case of a scalar-by-matrix
differentiation [6, 26, 47, 48] demonstrates:
 
∂A ∂A
∂B11 ··· ∂B1n
∂A ∂A  . .. .. 
=  = . .
∂B
  . . 
B11 · · · B1n

∂A ∂A
 . .. ..  ···
∂ . .
∂Bn1 ∂Bnn
 . . 

Bn1 · · · Bnn

1
The dimensions of state vector and measurement vector are mx ×1 and mz ×1. For the derivation of the size of the filter gain,
please insert these dimensions into e.g. Equation 3.1 on page 39. The result will be that Kz has to have the same dimsension as x

44 Michaela & Tobias Höfler // July 26, 2017


Filter gain 3.4

Applying this operation onto Equation 3.14 yields the following, for now unrefined and
unsolved, expression:

∂ tr P− ∂ tr Kk Oz k P− ∂ tr KTk Kk Oz k P−
k Oz k + Rk
T
  
∂ tr(Pk ) k k 3.15
= −2 +
∂K ∂K ∂K ∂K

From this point on, another property of the trace in combination with matrix calculus is
utilized: differential forms ( ∂∂yX ) can — under certain conditions — be “massaged” [26] into
canonical forms (∂y = . . .), and in reverse [6, 26]. The applicable case for the task at hand
is the following one.
∂y
∂y = tr(A∂ X) ⇔ =A 3.16
∂X

This indicates that if such patterns can be found in ∂ tr(P) — employing also the linearity
of the differential operator in combination with the trace, not forgetting the chain rule —
the above connection allows for a solution that does not include the trace operator. In
terms of the present formulation, the aim is to factor out ∂ K, so that a generic term C
can be the solution of the differentiation.

∂ tr(P)
∂ tr(P) = tr(C∂ K) ⇔ =C
∂K

To get closer to the point, the solution is presented in the equations below; the upper
version is as published by Brown and Hwang [3, Eqn. 5.5.16], the lower version is
rearranged [40] and resembles the formula for the error covariance matrix a great deal.

∂ (tr(Pk )) T
= −2 Oz k P− + 2Kk Oz k P− Oz Tk + Rk 3.17

∂ Kk k k

= −2 {I − Kk Oz k } P− T
k O z k + 2 Kk R k 3.18

Since the overall aim was to minimize the least-square error, the above differential needs
to equal zero. The solution for the optimal gain K [3, Eqn. 5.5.17] is now represented by:
−1
Kk = P− T − T
k Oz k Oz k P k Oz k + Rk 3.19

As can be seen directly, the expression in the round brackets will result in a matrix, which
has to be inverted. For a matrix to be invertible, it has to be square and may not have a
determinant equal to zero, which establishes conditions for the dimension and content of
P− and R. To come to a conclusion: inserting the optimal gain into the error covariance
matrix equation yields a shorter version [3, Eqn. 5.5.22] that is only valid for optimal gain,
but will also work with non-optimal starting gain K0 and error covariance P− 0.

Pk = {I − Kk Oz k } P−
k 3.20

45
3 Kálmán filter theory Master thesis: Sea State Estimation in the Time Domain

3.5. Noise covariance matrices


As indicated before the discourse about the filter gain, the noise covariance matrices shall
be examined in a closer fashion now.

The previously mentioned measurement noise covariance matrix R is an indicator of the


in-built variance σz2 with which the sensors perceive the motions of the vessel. Despite
the fact that smartphone inertial sensors have improved a lot in recent years and live
up to “the comparison to the gold standard, an industrial robotic arm with an actual standard
use inertial motion unit in clinical measurement, an Xsens product”, as Mourcou et al. [27]
state, it was assumed that most vessels do not rely on smartphone sensors; for merchant
vessels this is nearly always the case, for pleasure craft not as often. Because of this, a
commercially available compromise between smartphones and high-tech sensors has been
chosen. The sensors of the series Ekinox-A by SBG Systems [37] provide measurements
with a root-mean-square error (RMSE) of 2.3 cm for heave, 0.032° for pitch and 0.028° for
roll motions, based on a time window of 15 min during the testing session1 . The RMSE is
equal to the standard deviation σ , if the input signal has a zero-mean:

RMSE = σz ⇔ σz2 = RMSE2 3.21

It should be noted however, that the units of the RMSE have to be converted to the units
used by the Kálmán filter before usage. When conveying these variances to the actual
matrix R, please recall that it needs to be a square matrix. Moreover, its dimension has to
be mz ×mz , as is indicated by the subsequent equation.

P K R KT
z }| { z }| { z }| { z }| {
mx ×mx = . . . + mx ×mz · mz ×mz · mz ×mx

As a summary, it can be fixed that R will only have entries on the main diagonal, since
it is assumed that the signals are independent of each other and thus not correlated:
 2 
σ z1 0 · · · 0
 0 σz22 · · · 0
 
R= 3.22

 .. .. .. .. 
 . . . .


0 0 · · · σz2n

Where the sensor noise could be deduced from a specified data sheet, the process noise
covariance matrix Q is not so easy to fill. But first of all: what does this matrix, which
has not emerged in any presented equation before, have to do with the Kálmán filter?
It has the same function as R, but instead of informing the filter about the quality of
1
Cf. Appendix A

46 Michaela & Tobias Höfler // July 26, 2017


State transition matrix & Projection 3.6

the input signals, it reports the quality of the mathematical model for estimation with
which the filter is equipped — one could say it is the filter’s self-esteem matrix. Both
qualities are essential; a good estimator is worthless without good input, and the latter is
useless without the former. The entries of R are more or less given, but the mathematical
model does not have a data sheet. For that reason, Q is one of the tuning knobs for filter
performance. As to its loom, the process noise covariance matrix is only in the projection
step, when the a-priori estimates of P and x for the next time steps are formed; how this
is done, will follow in a later section (cf. section 3.6).

Now to the under-the-hood properties of Q: it has the same dimension as P and, in the
course of this thesis, has only entries on the main diagonal, for the same reasons as stated
for R. There are examples of filter set-ups in which the state variables are not independent
of each other. Here, the matrix looks like this:
 2 
σx1 0 · · · 0
 0 σx22 · · · 0
 
Q= 3.23

 .. .. .. .. 
 . . . .


0 0 · · · σx2n

The residual question is how to choose the magnitude of the entries σx2i . Basically this
depends on what each state variable represents; therefore, the question cannot be answered
here. There are some influences on the choice though, that may be presented: large values
in the process noise combined with small sensor noise results in fast adaption of the filter
to external changes, while the other way around the estimates will be quite smooth [2]
— equal noise magnitudes will result in balanced filter performance. Of course, the actual
performance depends on the details of the implementation.

3.6. State transition matrix & Projection

Everything that has been put forward with respect to the Kálmán filter so far was based
on the same time step k . This alone cannot be useful, since the intention is to use the
filter recursively as time progresses. Hence, a state transition from k → k + 1 is needed.
This task is fulfilled by using the state transition matrix F. Applied to the state vector after
it has been updated with a measurement, an a-priori estimate for the next time instance
is obtained [3, Eqn. 5.2.1 and 5.5.23]:

x̂−
k+1 = Fx̂k + Gu 3.24

47
3 Kálmán filter theory Master thesis: Sea State Estimation in the Time Domain

As can be seen, there are also terms for the control input vector u and the control input
model matrix G. These have been neglected in the work at hand, because the filter set-up
does not require them. Nevertheless, they are presented in the above equation for the sake
of providing a bigger picture.

During the sections dealing with the other matrices of the filter, the dimensions of the
matrices came up for discussion — as it will now. The above equation clearly indicates
that F has the dimensions mx ×mx and is thus square. Its entries describe the influence
of each state variable on itself and all other ones between two consecutive time steps. If
they are independent of each other the state transition matrix will be equal to the identity
matrix I [13]. But from the above equation still more can be learned: inserting it into the
expected value expression of the error covariance in a fashion that was used before can
yield an expression for Pk+1 . For this to work, an expression for the real state x needs to
be established, as it was for z in Equation 3.7 (see page 40).

xk+1 = Fxk + wk 3.25

Please recall that the above expression does not feature the estimate by the Kálmán filter,
but the unknown real state. The process noise vector w is used to include the randomness
of the process into the filter model [3, Eqn. 5.5.1], in the same way as it was done for the
filter input. Having this in mind, the predicted error covariance matrix of the next time
step can be transformed as follows below.

T 
P− −
k+1 = E xk+1 − x̂k+1 xk+1 − x̂k+1

 
T 
= E Fxk + wk − Fx̂k Fxk + wk − Fx̂k
 
T 
= E F xk − x̂k + wk F xk − x̂k + wk
   
T
= E F xk − x̂k + wk xk − x̂k FT + wTk
   
3.26
= E Fexk eTxk FT + wk wTk + wk eTxk FT + Fexk wTk
 

= E Fexk eTxk FT + E wk wTk + E wk eTxk FT + E Fexk wTk


       

= F E exk eTxk FT + E wk wTk


   

= FPk FT + Q

In the same way as it has been done for Pk in Equation 3.10, the a-priori error covariance
matrix for the next time step is now known. The expected value expressions for the mixed
terms including w and ex are canceled out, due to the fact that the mentioned variables
are uncorrelated.

48 Michaela & Tobias Höfler // July 26, 2017


Filter loop wrap-up 3.7

3.7. Filter loop wrap-up


Finally, now that all filter steps and components have been presented in the preceding
paragraphs; the remaining action is now to summarize the steps of one loop, as they are
presented in Figure 3.2. The first step is the calculation of the filter gain K from the initial
estimates x̂− − − −
0 and P0 , or the projections x̂k and Pk from the last to the current time
instance. For this purpose, the expression for optimal gain is used, so that in a later step,
the optimal error covariance update may also be performed. In the next step, the filter
gain is used to enrich the recent estimate of the state vector x̂− k with the difference of
real and predicted measurement. This yields an updated estimate x̂k for the current time
step, which can be used for post-processing, e.g. forming any output that may be mapped
from the selected state variables. The update of the error covariance matrix Pk from P− k
is the subsequent action; this update can be performed in the long general expression,
or the optimized short version. At last, the projection over the next sampling interval is
conducted and the loop starts anew.

Initial estimate x̂− −


0 and P0

Compute the filter gain:


−1 Measurement zk
Kk = P− −
k Oz k Oz k Pk Oz k + Rk
T T

Project ahead:
Update the estimate: 
x̂−
k+1 = Fx̂k
− x̂k = x̂− −
k + Kk zk − Oz k x̂k
Pk+1 = FPk FT + Q

Update the error covariance estimate:


Estimated state x̂k
Pk = {I − Kk Oz k } P− T
k { I − Kk O z k } + Kk R k Kk
T

ζ̂ k = Oζ k x̂k
Sea surface estimation

Ŝk = OS k x̂2k
Sea spectrum estimation

Fig. 3.2 A detailed summary of the Kálmán filter loop. In contrast to Figure 3.1, each step is annotated with the
corresponding formulas. For the update of the error covariance matrix, the optimal form is stated (in black), as well
as the long form (additional parts shaded in gray). Their properties are described in the section “Filter loop wrap-up”,
starting on page 49. Additionally, the outputs in form of the sea surface elevation and the sea spectrum estimation
have been added. They are explained in section 3.2 from page 39 onwards. As previously, the figure based on the one
published by Brown and Hwang [3, cf. Figure 5.8]

49
50
Confidence intervals
4
Up to this point, the “uncertainties” of the filter — condensed in the matrices P, Q and R
— have been mentioned multiple times. What has been left out, is how they can be put to
good use outside of the filter. In a realistic scenario, where the procedure might be used
as a decision support system on the bridge of a vessel, the reliability of the filter output
should also be known to the crew. For this purpose, the variance σ 2 stored in the er-
ror covariance matrix plays a major role; but how can it be translated to visual information?

The solution resides in the area below the Gaussian probability distribution curve. From
the mean value at the peak outwards to both sides, the further one goes, the more sample
cases are covered within the boundary. The first step is to take a look at the probability
density function (PDF) of the normal distribution φ(x|µ,σ2 ) [49], which gives the curve its
shape (see the left plot in Figure 4.1). It represents the probability that a sample has the
exact value x, when the overall process has the mean value µ = E x 1 and the variance
 

σ2: !
1 (x − µ)2
φ(x|µ,σ2 ) = √ exp − 4.1
2πσ 2 2σ 2

Integrating this function yields the cumulative distribution function (CDF), which basically
describes how large the probability is that a sample has a value x equal to or lower than
the threshold X [44]:

ZX
Pr x ≤ X = Φ(X|µ,σ2 ) = 4.2
 
φ(x̃|µ,σ2 ) dx̃
−∞

As can be seen, the integration has not been evaluated here. This is because “these integrals
cannot be expressed in terms of elementary functions, and are often said to be special functions.
However, many numerical approximations are known” [42]. From these approximations, tables
have been created from which the corresponding result can be read. With this in mind,
the probability that a sample lies within a certain boundary — expressed in n standard
deviations around the mean value — can be stated in the form below [42].

1
Please note that the symbol µ is the mean value in the present topic, but it is also used for the relative heading angle in other places.

51
4 Confidence intervals Master thesis: Sea State Estimation in the Time Domain


Upper boundary Lower boundary 0.682 689

 for n = 1
z }| { z }| { 
Pr µ − nσ ≤ X ≤ µ + nσ = Φ(µ+nσ) − Φ(µ−nσ) ≈ 0.954 499 4.3
 
for n = 2


0.997 300

for n = 3

The presented set of numbers for n = 1, 2, 3 standard deviations from the mean value is
known as the so called “68–95–99.7 rule” [42]. The usefulness is founded on the fact that
with a confidence of 95% the calculated so called confidence interval (CI) of ±2σ covers
the “true” value of the process [43, cf. section “Misunderstandings”]. It is thus a valuable
measure of estimation quality; if the experiment was repeated with varying sampling 100
times, in about 95 of them the mean value would fall into the interval, in five of them
not [43]. Hence, the more narrow the confidence interval is, the better the Kálmán filter
output. The choice of the bandwidth of a confidence interval is too wide a subject to fully
consider here:

“In the empirical sciences the so-called three-sigma rule of thumb expresses a con-
ventional heuristic that ‘nearly all’ values are taken to lie within three standard
deviations of the mean, i.e. that it is empirically useful to treat 99.7% probability
as ‘near certainty’. The usefulness of this heuristic of course depends significantly
on the question under consideration, and there are other conventions, e.g. in the
social sciences a result may be considered ‘significant’ if its confidence level is of
the order of a two-sigma effect (95%), while in particle physics, there is a conven-
tion of a five-sigma effect (99.99994% confidence) being required to qualify as a
‘discovery’.” [42]
In this thesis, it has been chosen to consider the 95% confidence interval as sufficient; the
width of the interval can easily be changed in the settings of the developed Matlab code.
During the thesis work, it has also been learned that the percentage of e.g. 95% in this
case indicates that the interval covers as much a percentage of past and future samples of
the corresponding process. It is not the probability for a sample to fall into this boundary;
either the sample value is inside or outside, never partially in!

Now that the theoretical background of the confidence intervals has been studied, the
application to the state variables and the filter output remains. In terms of the confidence
intervals for the state vectors, the calculation is very straightforward:
q
x̂CI
k
±
= x̂ k ± 2σk = x̂k ± 2 diag(Pk ) 4.4

For the surface elevation estimate that the filter provides, the entries of P do not apply
directly. They represent E ex eTx , but E eζ eTζ is needed. In the section “Output matrices”,
   

52 Michaela & Tobias Höfler // July 26, 2017


the mapping from state vector to surface elevation output has already been presented; hence
it is known that ζ̂ k = Oζ k x̂k . From this, the desired expected value can be rewritten.

T 
E eζk eTζk = E ζk − ζ̂ k ζk − ζ̂ k
   
T 
= E Oζ k xk − Oζ k x̂k Oζ k xk − Oζ k x̂k
 
T
= E Oζ k xk − x̂k xk − x̂k Oζ Tk
  
4.5
= E Oζ k exk eTxk Oζ Tk
 

= Oζ k E exk eTxk Oζ Tk
 

= Oζ k Pk Oζ Tk

With this knowledge, the surface elevation estimate confidence intervals may be expressed
by the following equation, leading to a visual appearance as depicted in Figure 4.2.

CI±
q 
ζ̂ k = ζ̂ k ± 2 diag Oζ k Pk Oζ Tk 4.6

In the case of the signal estimation ẑ = Oz x̂ the process applies analogously, simply by
switching Oζ with Oz . For the sea spectrum confidence intervals, some artifice is needed,
because it is not possible to obtain σS2 directly from the state variables — at least for the
problem set-up dealt with in this thesis. To explain the necessary “trick”, the calculation of
the spectral density of the sea state Sζ(ω) needs to be anticipated in form of the following
expression.

Probability density function (PDF) Cumulative distribution function (CDF)


1
σ 2 increasing

σ 2 increasing

0.5

0
µ x µ X x

Fig. 4.1 The probability density function (PDF) is depicted on the left and the cumulative distribution function
(CDF) on the right. Both of them for the Gaussian or normal distribution, with the mean value µ and the variance
σ 2 . The PDF represents the probability that a sample has a value of x, whereas the CDF (the integral of the PDF
from −∞ to the threshold X ) stands for the probability that a sample is smaller or equal to X . It is illustrated that,
for growing variance, the PDF becomes wider; the samples are scattered further afar from the mean value.

53
4 Confidence intervals Master thesis: Sea State Estimation in the Time Domain

1 1
x̂22i−1 + x̂22i 4.7

Sζ(ωi ) =
2 ∆ωi

The detailed derivation can be found in chapter 5, “Applied Kálmán filter set-up”, from
page 59 onwards. Despite the above formula falling from the sky for now, it may be said
that the spectrum is composed of spectral densities at discrete frequencies ωi and that for
every frequency there are two state variables, representing the cosine and sine part of the
wave. The indices “2i − 1” and “2i” allocate the state variables x̂1 and x̂2 to ω1 , x̂3 and
x̂4 to ω2 , and so on; in that way, the state vector x̂ can be accessed more easily.

T 
Applying the same strategy as before, trying to solve E eS eS T = E S − Ŝ S − Ŝ ,
   

yields mixed quadratic terms which cannot be reduced to a simple expression based on P.
Thus, the propagation of uncertainty [50] is the most useful aid. It relates the uncertainty
of a process to the uncertainties of the processes on which it is based. In the case at hand,
the spectral density features a non-linear combination of the known processes x̂2i−1 and
x̂2i , by which an analytical solution for σS2 is made impossible. An approximation can be
found by using the Taylor series expansion. Any analytic function f = f(x1 ,x2 ) may be
approximated by:
∂f ∂f
f ≈ f0 + x1 + x2 4.8
∂x1 ∂x2

Estimated wave elevation, surrounded by a 95% confidence interval


Wave elevation estimate ζ̂ [m]

Time [s]

Fig. 4.2 This exemplary plot illustrates how the confidence interval surrounds the wave elevation estimate ζ̂ at every
time step. The chosen bandwidth corresponds to µ + 2σ , which indicated that from 100 repetitions of the experiment
with altered sampling, 95 of them will yield a mean value that falls within this interval, and 5 will not.

54 Michaela & Tobias Höfler // July 26, 2017


For the variance of the process f this holds the outcome

∂f 2 2 ∂f 2 2

σf2 ≈ σ + σ + 2 ∂f ∂f σx 4.9
∂x1 x1 ∂x2 x2 ∂x1 ∂x2 12

with σf20 = 0 because f0 is a constant [50]. In the case at hand, with f = Sζ(ωi ) , the
differentials read:
∂Sζ(ωi ) x̂2i−1 ∂Sζ(ωi ) x̂2i
= and =
∂x̂2i−1 ∆ωi ∂x̂2i ∆ωi
They lead to the assembled expression:

∂Sζ(ωi ) 2 2 ∂Sζ(ωi ) 2 2

∂S ∂S
σS2 i ≈ σ2i−1 +
σ2i + 2 ζ(ωi ) ζ(ωi ) σ2i−1,2i
∂x̂2i−1 ∂x̂2i ∂x̂2i−1 ∂x̂2i
2 2
x̂2i−1 2
σ2i−1 + x̂2i σ2i x̂2i−1 x̂2i 4.10
2
= +2 σ2i−1,2i
∆ωi ∆ωi ∆ωi ∆ωi
1
x̂22i−1 σ2i−1
2
+ x̂22i σ2i
2

= 2 + 2 x̂2i−1 x̂2i σ2i−1,2i
∆ωi

To verify that the above expression does not contain obvious errors, one can compare
the units of measurement. The state variables stand for the wave amplitude components
and are thus measured in m, their standard deviation σi has the same unit per definition,

Estimated encounter spectrum, surrounded by a 95% confidence interval


Spectral density S [m2 s/rad]

Angular frequency ω [rad/s]

Fig. 4.3 An estimate of a sea spectrum in the encounter domain. It is based on the latest state variables of the
simulation and is surrounded by a 95% confidence interval. At each frequency, the confidence interval width is
based on the in-phase and quadrature state variable components variance, each scaled with their respective state
variable magnitude squared, and the covariance between the components, linearly scaled with both magnitudes.
The mathematical expression is presented in Equation 4.10. The result is, that in areas with large state variable
magnitude (and thus large estimated spectral density), the spectrum uncertainty interval is wide, despite the fact that
the uncertainty of the respective states might be among the lowest.

55
4 Confidence intervals Master thesis: Sea State Estimation in the Time Domain

which makes the unit of their variance σi2 m2 . The covariance σij has the units of both
underlying processed multiplied, which results in m2 as well. With the unit of the angular
m 4 s2
frequency being rads , the unit of σS is rad2 ; hence, the corresponding standard deviation
2
2
is measured in mrads , which is exactly the unit of the spectral density. Therefore, the above
formula may be considered appropriate.

However, a peculiar behavior of the spectrum variance, as stated in Equation 4.10, bears
comment. The variance of the spectrum increases automatically in areas with a larger
spectral density — or more specifically in areas with larger state variables, even though
the variance at that point might be smaller than in other areas. This has to do with the
mathematical formulation of the variance in this case, because the spectrum variance scales
with state variable size. Therefore, the multiplication of a large state variable squared with
a small variance can end up in a bigger spectral uncertainty than the multiplication of
a small state variable squared with a large variance. In addition to that, the three parts
the spectrum variance consists of are added up which increases the before explained effect
even more. This can result in wide confidence intervals in the region of the sea spectrum
peak as can be seen in Figure 4.3, even though the variance of the state variables in this
point are very small and the estimate very accurate.

With this newly gained variance, the spectrum confidence interval can be formed in the
following way:
CI±
Sζ(ω i)
= Sζ(ωi ) ± 2σS2 i 4.11

It should be noted though that for high enough uncertainty, the lower confidence interval
boundary may be negative. Since a sea state may not contain negative energy, the bound-
aries below zero should be cut off in practice. An exemplary result of the above method
is depicted in the previously presented Figure 4.3.

56 Michaela & Tobias Höfler // July 26, 2017


II
Practical Application
Master thesis: Sea State Estimation in the Time Domain

After the first part, which dealt mainly with introduction of theory and methodology, the
following part presents the practical application of the discussed material. Due to the
fact that this is a Master thesis and learning is of high importance, the chapter will give
an overview over the achieved main steps in the process of the Master thesis and will
not only present the final result. It is presented in the order in which it was worked
out. In addition, the problems and difficulties during the process shall be addressed and
discussed with the hope that this could be helpful for other students working in this field
or continuing this study.

In the subsequent chapters, first of all the Kálmán filter set-up used shall be explained. The
meaning of the state variables will play a major role, as well as the output matrices for
the measurement domain Oz , for the surface elevation Oζ , and the sea spectrum OS . The
complex-valued transfer function will also discussed regarding its influence on the content
of Oz . Subsequently, Q and R will be presented with discrete content; the latter based on
the sensor noise covariance. The remaining matrices K and F are set up as well, before
coming to the starting values for x̂−0 and P0 .

The succeeding chapters will show how the approach to the topic was made and how the
theory of the Kálmán filter can be applied to the specific topic of sea state analysis in
practice; stepwise. In the first step, the implementation was done for only one frequency
and later extended for a specified amount of frequencies. However, only one motion — the
heave motion — was taken into consideration. Hereafter, the code was extended to deal
with roll and pitch motions in addition to the heave motion. Another extension featured
also forward speed inclusion.

All of the above can be read in detail on the subsequent pages; please excuse the fact that
not all minor steps of the learning process are presented. A lot of testing was involved,
however, not all changes were useful, thus these parts will be skipped. Nevertheless, some
exemplary plots and results are shown to illustrate the discussed topics, despite the fact
that the final results are reported in chapter 10, “Discussion of results”, from page 97
onwards.

58 Michaela & Tobias Höfler // July 26, 2017


5
Applied Kálmán filter set-up

The set-up, that was used in the course of this thesis, is based on the script Sea State
Estimation: Problem Set-up by Galeazzi [13]. Herein, a state-space expression for the
“wave elevation of a long-crested irregular sea under the assumption of zero forward speed” is
formulated. In the style of Equation 2.2, this is expressed as the sum of N harmonic wave
time series, each with a wave amplitude ζ̃i and a random phase shift i :

N
X
ζ(t) = ζ̃i cos (ωi t + i ) 5.1
i=1

Each of the elementary harmonic building blocks, here a cosine with phase shift, is com-
posed of in-phase and quadrature components. These expressions are taken from electrical
engineering and represent the fact that “a sinusoid with angle modulation can be decomposed
into […], two amplitude-modulated sinusoids that are offset in phase by one-quarter cycle” [46].
The below equation is the mathematical counterpart to this quote [13, 46]:

Quadrature
In−phase
z }| { z  }|
π
{
cos (ωt + ) = cos () cos (ωt) + cos  + sin (ωt) 5.2
2

A harmonic wave with unit amplitude and a phase shift  has been split up into two
carrier waves without phase shift, but with altered amplitude; the amplitude modification
factors cos () and cos  + π2 are orthogonal to each other, which is also where the name


“quadrature” is derived from. But the details of their naming are not the topic here.

Regarding the amplitude modification factors including the overall wave amplitude, it is a
wise choice to pick these as the state variables, because in that way the Kálmán filter does
not need to handle the unknown phase shifts and local wave amplitudes separately:

x2i−1 2i x
N
X z }| { z }| π {
ζ̃i cos (i ) cos (ωi t) + ζ̃i cos i + sin (ωi t) 5.3

ζ(t) =
2
i=1

59
5 Applied Kálmán filter set-up Master thesis: Sea State Estimation in the Time Domain

Another benefit is that the spectral density can easily be calculated at every time step, as
has already been anticipated in Equation 4.7 on page 54:

1 1
x̂22i−1 + x̂22i

Sζ(ωi ) =
2 ∆ωi

With this state variable set-up, there are twice as many state variables as frequencies in the
filter, which makes the dimension of the state vector 2mω ×1. From the above equations,
the content of the output matrices Oζ and OS can also be deduced. The former needs to
be renewed at every time instance t, as it reads
h i
Oζ = cos (ω1 t) sin (ω1 t) · · · cos (ωn t) sin (ωn t) 5.4

The latter is constant and depends only on the chosen filter frequencies:

1 1
 
2∆ω1 2∆ω1 0 0 ··· 0 0
1 1
0 0 ··· 0 0
 
2∆ω2 2∆ω2
OS =  5.5
 
.. .. .. .. .. .. .. 
. . . . . . .
 
 
1 1
0 0 0 0 ··· 2∆ωn 2∆ωn

where ∆ωi = 12 ωmin(n,i+1) − ωmax(1,i−1) 1 . The dimensions of the above matrices are


1×2mω and mω ×2mω . Instead of using these matrices, a for-loop may also be used.

Regarding the measurement vector z, which has to have the dimension mz × 1, it can
be said that it has to be updated at every time step, so that it contains the most recent
sensor readings. From Equation 3.1, which is presented again below, it is known that
the measurement output matrix Oz has to transform a state estimate into a measurement
estimate, thus it must have the dimension mz ×mx = mz ×2mω .

x̂k = x̂− −
k + Kk zk − Oz k x̂k


Its content depends heavily on the set-up of the filter; in the case at hand, it describes
the sensor readings for arbitrary combinations of motions — for instance heave, roll and
pitch (cf. Figure 2.6) — as a reaction to sea surface elevation described by current state
variables. This reaction is modeled by multiplying each elementary harmonic wave with the
corresponding transfer function at its frequency. In the problem formulation by Galeazzi
[13], the transfer function TFi is complex-valued; it has a real part Re TFi and an


imaginary part Im TFi :




TFi = Re TFi + i Im TFi 5.6


 

1
This formulation of the frequency interval assures that in numerical procedures no vector entry index smaller than 1 or bigger than
the overall number of frequencies n is used. For the first and last frequency, this means that their intervals are only half the distance
to the neighbor, whereas for all other frequencies the interval width is the sum of half the distance on both sides.

60 Michaela & Tobias Höfler // July 26, 2017


Please note that the index “i” represents the observed motion, whereas “i” is the imaginary

unit with i = −1. The advantage of the complex-valued transfer function is, that it also
stores the phase shift between wave and motion, not only the motion magnitude. With
this knowledge, each motion measurement can be written as [13]:

cf. ζ̂ j(t) in complex notation



X z }| {
ẑi(t) = Re TFi(ωj ) (x̂2j−1 + ix̂2j ) (cos (ωj t) + i sin (ωj t))
j=1
nω 
5.7
X 
Re TFi(ωj ) cos (ωj t) − Im TFi(ωj ) sin (ωj t) x̂2j−1
 
=
j=1

X  
Im TFi(ωj ) cos (ωj t) + Re TFi(ωj ) sin (ωj t) x̂2j
 

j=1

As can be seen, the signals are all real valued because the on-board sensors are not able
to record the phase shift between wave and vessel motion. Being derived from the wave
surface elevation, a similar technique in transferring the expression to matrix form can be
applied, which yields:

Oz i,2j−1 = Re TFi(ωj ) cos (ωj t) − Im TFi(ωj ) sin (ωj t)


 
5.8
Oz i,2j = − Im TFi(ωj ) cos (ωj t) − Re TFi(ωj ) sin (ωj t)
 

Please excuse the fact that this matrix cannot be presented in more illustrative matrix form;
it would be too large for the page. In the course of this Master thesis, forward speed has
been introduced to the matrix Oz , which will be discussed in detail in section 9.2, starting
on page 90. The changes lead to the following form:

Oz i,2j−1 = Re TFi(ωj →ωej ) cos ωej t − Im TFi(ωj →ωej ) sin ωej t


   
5.9
Oz i,2j = − Im TFi(ωj →ωej ) cos ωej t − Re TFi(ωj →ωej ) sin ωej t
   

This version may also be used for zero speed, because wave and encounter frequencies
coincide in this case.

Going back to Equation 3.1 again, it can be seen that K has not been set up yet. This
is a very straightforward endeavor: one does not need to initialise it, it can be calculated
from the initial estimate x̂− −
0 and P0 — please see Figure 3.2 on page 49 for a filter loop
overview. For this to work, the output matrix Oz and the sensor noise covariance matrix
R are needed; the former is already available, the latter can be built up using the standard
deviation or variance of the sensor noise; these can be achieved from the manufacturer’s
data sheet or sensor calibration by recording a known state, leveling the signal down to
zero-mean and then extracting σ and σ 2 . In the present case, the data sheet option was

61
5 Applied Kálmán filter set-up Master thesis: Sea State Estimation in the Time Domain

used; the sheet is attached to this thesis in Appendix A. The relevant root-mean-square
errors (RMSE) are listed in Table 5.1 and represent the standard deviation σ directly, because
heave, roll and pitch have zero-mean. They need to be converted to the units of the filter
however, as has been done in the last row of Table 5.1. This makes the measurement noise
covariance matrix R look like:
 
σz21 0 0 ··· 0
σz22 0
 
 ··· 0 
.. .. 
 
R= . .  5.10

 

 σz2n−1 0  
sym. σz2n

The dimension of this matrix is derived from a term in the filter gain expression:

Ozk kP− Oz T R
z }| { z }| { z }|k { z }|k {
mz ×mx · mx ×mx · mx ×mz =
ˆ mz ×mz

The model noise covariance matrix Q looks the same, just in the dimension mx ×mx and
with the variances σx2i that describe how reliable each state variable is. These are arbitrary
values and can be used to tune the filter. One should keep an eye on the fact, that the
state variables describe wave amplitudes here, so large process/model noise σx2i means that
waves of an amplitude of e.g. 1 m might be below the noise threshold.

The last matrix that is missing for the filter loop to run is the state transition matrix F,
which is needed to project from one time instance to another: x̂− k+1 = Fx̂k . Since this
matrix in fact maps from the updated estimate at k to the a-priori estimate at k + 1, F
can be chosen to be the identity matrix here. This corresponds well to the fact that the
state variables are not time dependent; that is outsourced to the output matrices. Hence,
in between time steps no change is required. This might be different in the case when
x represents e.g. geographical positions, which are speed (and thus time) dependent and
due to that change between discrete steps. In such a case, F should add the approximate
change in location in between steps to the last estimate. Because this is clearly not the
case here, it can be stated that the state transition is represented by the identity matrix:

Tab. 5.1 These root-mean-square errors


Accuracy
are a measure for the sensor accuracy. They
Heave Roll Pitch correspond to the sensors noise standard de-
viation σ directly, due to the fact that all
RMSE 0.0028° 0.0032° 2.3 cm motions have a mean value of zero. The er-
4.887 × 10−5 rad 5.585 × 10−5 rad 0.023 m rors were obtained during a fifteen minutes
test session (please see Appendix A for fur-
ther details).

62 Michaela & Tobias Höfler // July 26, 2017


F = I. It has the dimension mx ×mx . Now, the Kálmán filter is good to go — except that
the initial values for x̂−
0 and P0 have not been chosen. Experiments have shown that for
the purpose of this thesis, the starting points presented below are useful.

x̂− ~
0 =0 and P0 = 103 · I 5.11

The very large initial values in the error covariance matrix are a sign to the filter that the
starting point is very inaccurate and that it should be corrected as fast as possible. Should
it be the case that the Kálmán filter is restarted during operation, the most recent state
and error covariance may be used as initial guess to speed up convergence.

From this point on, nothing opposes running the filter in a fashion as already introduced
in Figure 3.2. It should be noted though, that in the course of the thesis, the content of
the matrices mentioned above was changed as the process was developed; the above state
is the latest version.

63
64
Just one input signal
6
It is always wise to start from the easiest possible point in the first step, and increase
the difficulty when the first step works and is validated. This was done here as well and
therefore, the starting point was to take only one frequency into account. This means, that
the ship experiences a single sinusoidal wave and the Kálmán filter shall predict this wave
as accurately as possible; this is what section 6.1, “A single wave frequency”, will deal
with. How this can be extended for multiple frequencies will be addressed in section 6.2,
“Arbitrarily many frequencies”.

6.1. A single wave frequency


As described in section 2.1, “Properties of ocean waves”, a sea state can be expressed
in the time domain by its surface elevation. The most simple case is a single harmonic
(long-crested) wave; a sinusoid with a wave amplitude ζ̃ , its corresponding angular wave
frequency ω and the phase shift .

In this style, a simple case has been devised as a starting point for the practical part of
the thesis. The beginner-grade “laboratory condition” set-up features just one input signal,
which has been chosen to be heave, based on a harmonic wave. From a previous study
project, an I-Ship strip theory calculation for CMA CGM Rigoletto was available; from this,
the particular wave frequency ω = 0.4184 rad s (Tz ≈ 15 s) and the corresponding transfer
function amplitude 0.1867 and phase −20.24° were chosen1 . Since no forward speed is
included yet, the wave frequency equals the encounter frequency and the heave sensor
time series of η(t) = 3 m · cos 0.4184 rad
s · t can be composed. The response amplitude


η̃ = 3 m was chosen arbitrarily. The time series in the numerical implementation had
a length of 30 s, at a sampling time of Ts = 0.1 s (which corresponds to the sampling
frequency of fs = 10 Hz). Onto this clean signal, a normal-distributed random noise with
η̃
the maximum of 10 has been added. The matrices of the Kálmán filter have been set up
manually in a very basic manner.

1
The phase shift was needed to make the transfer function a complex number, because the measurement output matrix Oz extracts the
needed information from complex numbers. In addition to that, the closed-form transfer functions that were used in the subsequent
versions will yield complex-valued results as well.

65
6 Just one input signal Master thesis: Sea State Estimation in the Time Domain

" # " # " #


0 10 0 10 0 h i
x̂−
0 = P0 = Q= R = 1000
0 0 10 0 10
The magnitude of the matrix entries have been chosen quite randomly, except the state
vector, which has been set to represent the calm water level; this has been done with
respect to the fact that in a “real” scenario there might not be any data to rely on before
switching on the filter. In the progress of the thesis, the state vector was kept in that
style, while the magnitudes of the other entries varied by a great deal.

With the presented set-up, the Kálmán filter predicts the next measurement quite accurately
after some seconds of convergence. This can be seen in Figure 6.1, where the “clean” and
the noisy heave signal are plotted over time, next to the prediction by the filter. During the
first 10 s, the filter does not predict correctly, but becomes more accurate. Unfortunately,
confidence intervals had initially been added several versions later, so that the uncertainty
of the filter cannot be visualized here. Another result of this experiment is the realization
that it would have been wise to start from a wave elevation time series for response signal
creation, because the filter outputs the surface estimate as well, but there was nothing to
compare it to1 .

Despite the shortcomings in feature-richness, this initial version of the Kálmán filter made
do with 42 lines of code, including plot commands and not counting comments.

Heave Input vs. Predicted Heave


4
Clean
2
Noisy
Predicted
Heave [m]

−2

−4
0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Time [s]

Fig. 6.1 The above plot shows the clean heave response signal, as well as the noisy version with normal-distributed
random noise with a maximum of 1/10 of the signal amplitude. As can be seen, the Kálmán filter needs the first
10 s for convergence, then the predicted next measurement fits the actual one quite accurately. The chosen response
amplitude η̃ has been chosen to be 3 m, at a frequency of ω = 0.4184 rad s
, which corresponds to a zero-upcrossing
period of Tz ≈ 15 s.

1
The surface elevation estimate is similar in behavior to the predicted signal in Figure 6.1. With the chosen response amplitude and
the FRF at the chosen frequency, the wave amplitude can be calculated to be ζ̃ = η̃/ FRFH = 3/0.1867 ≈ 16.07 m. The probability
that waves of this height, with a zero-upcrossing period of approximately 15 s, occur is quite low; even in the North Atlantic (cf.
Table 2.1).

66 Michaela & Tobias Höfler // July 26, 2017


Arbitrarily many frequencies 6.2

6.2. Arbitrarily many frequencies

The next step in the evolution of this procedure has been a code which scales the filter
matrices and the state vector automatically, based on the number of specified frequencies.
As before, there is only one input signal, thus R (please remember: mz × mz ) will not
change its size yet. Another steady fact is that the heave amplitude for the input signal is
chosen arbitrarily:

Omega = [ 1, 1.50 , 3.5 ];% [rad/s]


HeaveAmpl = [ 1, 0.75 , 0.5 ];% [m]

From these frequencies and amplitudes the time series is generated by the sum of harmonic
waves, with no phase shift between them — the series length is still 30 s, but this time
with Ts = 0.01 s, or fs = 100 Hz. The magnitude of the noise was doubled to 15 of the
1
largest amplitude in the amplitude vector, instead of 10 . Since the cosine was used for
time series generation, the result was a signal with a very large amplitude at t = 0 and
smaller ones in between repetitions (cf. Figure 6.2) — this was certainly not the smartest
choice and has been changed in the course of the following versions. The magnitude of
the entries in Q, R and P0 have been altered as well:

x = zeros ( numel (Omega)∗2 ,1);


% ... creates a vector of size "2∗ n_omega x 1" (here 6x1)
%−−−−−−−−−−
I = eye( numel (x));% ... creates an identity matrix (here 6x6)
%−−−−−−−−−−
F = I;% ... state transition = identity matrix
P = 100∗I;
Q = 100∗I;
R = 100 ;

Compared to the version before, Q and P0 are ten times larger, while R is ten times smaller
(the magnitudes were still guessed). The larger initial error covariance tells the filter to
move away from the initial state variables as soon as possible, speeding up convergence.
As can be seen in Figure 6.2, the prediction grasps the input signal with only little lag;
this looks quite favorable. Nevertheless, the uncertainty of the states should be taken into
account here. Figure 6.3 shows the root-mean-square error of the error covariance matrix

67
6 Just one input signal Master thesis: Sea State Estimation in the Time Domain

P over time1 . It is striking that the RMSE converges, but to a much higher value than
it started with. As stated by Brown and Hwang [3], this behavior indicates that either
P0 was set-up too small, or Q and R were chosen too large. In the course of subsequent
versions, the latter turned out to be the case.

Heave Input vs. Predicted Heave

2 Clean
Noisy
Predicted
Heave [m]

−2

0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Time [s]

Fig. 6.2 The above time series depicts the clean heave signal, the one including normal-distributed random noise
with the maximum of 1/5 of the largest amplitude of the harmonic waves that were used for signal creation. The
third curve is the estimate that the Kálmán filter provides for the next measurement. As can be seen, the filter locks
onto the signal quite rapidly; this is due to the increased magnitude of the entries in the error covariance matrix.

Root Mean Square Error


400

300
RMSE [-]

200

100

0
0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Time [s]

Fig. 6.3 The root-mean-square error of estimated states over time. The initial magnitude was way below the “limit”
it approaches — still, the RMSE is converging. The limit to which it converges is influenced by the magnitude of the
noise covariance matrices Q and R though, whose entries have been quite large in this experiment.

1
The RMSE of the error covariance matrix P is the chosen available, but not the only, method for convergence checking. It ispeasy to
implement though and gives a good first impression of the uncertainty magnitude. It can be evaluated by using: RMSE = tr(P).
In that way, the result is practically a standard deviation and has the same unit as its corresponding process.

68 Michaela & Tobias Höfler // July 26, 2017


Multiple input signals
7
From the last status of the code to the one which will be described in this chapter, there
has been some progress; the test runs and experiments it took to get there do not seem
to be worth reporting in detail, but they should not go unnoticed either.

Beforehand, the time series were based on arbitrary amplitudes, now they are based on a
generic Bretschneider spectrum and feature a random phase shift between single harmonics1 .
Moreover, the spectrum estimate can be plotted now. The first approach was to feed the
surface elevation estimate time series into the dat2spec function of the Wafo toolbox for
Matlab. This function “estimates one-sided spectral density from data” [41], but the results
depend heavily on the length of the input time series and the applied smoothing factor;
it turned out to be not very useful for future unknown in- or output. For this reason,
the method already described in chapter 5, “Applied Kálmán filter set-up”, was used; it
is based on the state variables directly2 . In addition to that, the number of frequencies
has been increased, as well as the length of the time series (which is now 5 minutes
long); the former are still the same in the filter and the time series generation. This
tribute to “lab conditions” aids the debugging of the filter; in later versions the frequency
amount and ranges were specified independently. Another “project” that was worked on
in parallel to the ones described above, was the creation of a function that delivers the
closed-form transfer functions initially proposed by Jensen et al. [21], later brought to
completeness by Mansour et al. [25]. In the former publication heave, roll and pitch
magnitudes were featured, but no phase shift. This was the topic of the latter publication.
With the beginning of the inclusion of multiple input signals, the closed-form transfer
functions were also ready for use and have been utilized ever since. To come back to
the essentials: in the subsequent sections, the major evolution steps undertaken in this
code version shall be presented. These are multiple input signals, as the chapter title
already points out, improving accuracy of the noise covariance matrices, and an attempt
at automatic detection of useful frequencies without prior knowledge of the sea state.

1
Please note that the phase shift of each harmonic wave should not be normal-distributed if picked randomly. All phase angles are
equally probable — and can thus be chosen as a uniform distribution.
2
The method has already been anticipated in the theory section; more precisely in chapter 4, “Confidence intervals”, Equation 4.7.

69
7 Multiple input signals Master thesis: Sea State Estimation in the Time Domain

7.1. Matrix extension to multiple inputs

If more than one motion signal is considered, the matrices R and Oz need to be extended.
The state vector x̂ remains unchanged, because it is only based on the amount of included
frequencies; this also implies that Q, P, Oζ and OS do not change size as well, due to the
fact that they are all based on the size of x̂. The signal noise error covariance matrix R is
a square matrix with the dimension of the number of input signals, as already indicated
in chapter 5. Hence, when now including e.g. heave, roll and pitch in this order, it will
be a 3×3 matrix with the corresponding sensor noise variances on the main diagonal:
 2 
σH 0 0
R= 0 2
σR 0
 

0 0 σP2

Another effect was identified concerning the measurement output matrix Oz . With the
dimension mz ×mx = mz ×2mω it is clearly influenced by the amount of included signals;
hence, it will gain new rows (as can be seen in Equation 5.8 on page 61). The rows are
composed in the same way, with the same frequencies, but with altered transfer functions,
corresponding to the motion the row stands for.

7.2. More accurate noise covariance

In addition to the change in size of R, it has also altered its contents. The corresponding
variances are no longer estimated (by qualified guessing), but are now based on the sensor
noise standard deviations presented in Table 5.1 on page 62. Based on their dimensions,
also the magnitude for the process noise covariance on the main diagonal of Q has been
reconsidered. It is now much smaller; at the same time the starting values for P0 have
been raised, so that the initial estimate is considered very inaccurate by the filter.

SensorNoiseSTD .Heave = 23 ∗(1/1000) ;% [mm] to [m]


SensorNoiseSTD .Roll = 0.028 ∗( pi /180);% [deg] to [rad]
SensorNoiseSTD .Pitch = 0.032 ∗( pi /180);% [deg] to [rad]
ProcessNoiseSTD = 1e−3 ;
%−−−−−−−−−−
x = zeros ( numel (Omega)∗2 ,1); I = eye( numel (x)); F = I;
P = 1e3∗I; Q = I.∗ ProcessNoiseSTD ^2; R = diag( SensorVariance );

This leads to much better convergence than was achieved before. In Figure 7.1 the plots
depict the magnitude of the RMSE — the square root of tr(P) — over the simulation

70 Michaela & Tobias Höfler // July 26, 2017


Inaccurate sea spectrum estimates 7.3

duration. The left plot is based on the configuration with estimated sensor and process
noise magnitude, whereas the right plot represents the configuration with the above set-up
presented in the code excerpt. As can be seen, the inaccurate guess led to no convergence;
the starting point of P = 100 · I was much too small, the noise covariances far too high. In
the standard deviation-based version, the large entries in P caused a quick backing away
from the initial guess. The smaller entries in Q and R allow for convergence. It should
be noted though, that in both cases the predictions of the Kálmán filter were accurate: it
only wasn’t very confident about the result in the estimated set-up.

7.3. Inaccurate sea spectrum estimates


Despite the fact that the improved noise covariance has made the filter converge, there
were still some flaws in the code. They became obvious in the form of inaccurate sea spec-
trum estimates. Figure 7.2 is an example of one of these outputs; it represents an estimate
of the underlying Bretschneider spectrum for Hs = 4 m and Tz = 18 s at following sea
without forward speed. It has been used as foundation for time series generation. Since the
vessel is keeping its position, wave domain and encounter domain are identical. The used
sets of frequencies for generation and estimation coincide, which makes the result even
stranger because the “laboratory conditions” have not been left yet. The shown example is

Root Mean Square Error Root Mean Square Error


1,500 1,500

1,000 1,000

500 500

0 0
0 200 400 600 800 1,000 1,200 0 200 400 600 800 1,000 1,200

Time [s] Time [s]

Fig. 7.1 The above plots show the magnitude of the root-mean-square error (RMSE) over the simulation time. In
both versions the duration of the time series was 20 min or 1200 s. The left plot shows a non-converging set-up with
estimated high noise covariances and a small error covariance P0 , whereas for the right plot the noise covariances
were based on given sensor noise standard deviations and accordingly chosen process noise. Also, the initial error
covariance was raised to a very high magnitude; this indicates an initial state from which should be backed away
as soon as possible. As can be seen, the change yielded success: the right plot shows convergence, but it requires a
certain length of the time series.

71
7 Multiple input signals Master thesis: Sea State Estimation in the Time Domain

only one of many cases — the random phase shifts in the time series generation allow for
infinitely many different bad results. Here, in the low-frequency region (with significant
original spectral density) the filter underestimates, whereas in the high-frequency region
with almost no energy content it overestimates. In other cases, the now underestimated
region was way overestimated, with a very oscillating shape.

A particular source of error could not be determined. The current code version was checked
and reconsidered multiple times. After consultation of the thesis supervisors, a possible
guilty party was identified in the selected filter frequencies; it was suspected that the
equidistance in ω~ f ilter causes some trouble. To avoid this, the frequency discretization
should be fuzzy, but limited to useful magnitudes in its boundaries. How this can be
achieved? The following section will shine a light on it.

Estimated Sea Spectrum

6 Original Sea Spectrum


Sea Spectrum Estimate
Spectral density S [m2 s/rad]

0
0.2 0.4 0.6 0.8 1 1.2 1.4

Angular frequency ω [rad/s]

Fig. 7.2 As is immediately visible, the above sea spectrum output does not fit the Bretschneider spectrum on which
the time series generation is based at all. This was certainly not the intention, but an error must have slipped into the
code at some point. The above spectrum was created using the same set of frequencies in the time series generation
and the Kálmán filter, with Hs = 4 m and Tz = 18 s at following sea without forward speed. This effect could only
be observed when the amount of used frequencies exceeded a certain threshold; how high this was depended heavily
on the used sensor signals and the time series length. Below the threshold, the fit was much better.

72 Michaela & Tobias Höfler // July 26, 2017


Automatic frequency content detection 7.4

7.4. Automatic frequency content detection


To conquer the challenge of finding the most useful frequencies for the Kálmán filter, two
sources of information need to be evaluated: the power spectrum of any of the input time
series in order to eliminate frequencies which do not carry energy, and the closed-form
transfer functions to find out which frequencies are influential.

The power spectrum of each signal can be obtained using Fast Fourier transform (FFT),
which converts it from the time domain to the frequency domain. Such a procedure has
been implemented manually and the results compared to in-built functions, here pwelch
and the aforementioned dat2spec function from the Wafo toolbox. It turned out that
the manual implementation — which was quite basic in feature richness, to be honest —
provided a very spiky spectrum with no smoothing at all, whereas dat2spec smoothed
most (when set to automatic detection). The pwelch output provided a middle ground
between both. In the end it was decided to utilize dat2spec because of the capability
to tune smoothing to the needed level1 . To identify frequency intervals that carry more
energy than the noise, a power spectral density (PSD) threshold is needed:

FFT .( Signals {s}). Threshold = SensorNoiseSTD .( Signals {s}) ^2;

A special property of the white noise, which is assumed the sensor noise is composed of,
is that “the power spectrum P of a random vector w can be defined as the expected value of the
squared modulus of each coefficient of its Fourier transform W , that is, Pi = E |Wi |2 . Under
 

that definition, a Gaussian white noise vector will have a perfectly flat power spectrum, with
Pi = σ 2 for all i” [56]. Thus, the sensor noise variance corresponds to the missing PSD
directly; due to zero-mean of each response time series, their standard deviation equals the
root-mean-square errors from the manufacturer’s data-sheet. As a summary, the following
relation can be stated as valid for all response time series with zero-mean and white noise:

2
PSDnoise = σnoise = RMSE2 7.1

The next step is now to find all frequency intervals with PSDs above the threshold, which
is more or less child’s play. These are then used as starting point for checking of the
closed-form FRFs. For this purpose, another set of thresholds is needed; one for each
motion FRF. Choosing them by qualified guessing has proven useful — respect should

1
A lot of experiments have been conducted to find the optimal setting, but it turned out that this depended on the used input time
series quite much. No optimal global level could be found. The method of using dat2spec with automatic smoothing level detection
has still been kept, because the possibility to switch to the other presented FFT methods afterwards remains open nevertheless.

73
7 Multiple input signals Master thesis: Sea State Estimation in the Time Domain

be paid to the magnitude of the vessel’s response though, because a ship as long as the
selected example vessel CMA CGM Rigoletto does not pitch as much as it rolls and heaves.

RAOthreshold .Heave = 0.05; % [ m/m]


RAOthreshold .Pitch = 0.01; % [rad/m]
RAOthreshold .Roll = 0.01; % [rad/m]
%−−−−−−−−−−
OmegaSteplength = 1e−2;% [rad/s]

In the code above, no desired number of frequencies has been given but a minimum ∆ω .
The total amount of frequencies will be among the outputs of the automatic frequency
detection function.

To illustrate the process described, an exemplary case of 0 kts at 135° has been set-up;
Figure 7.3 shows the FFT- and FRF-based identification of frequency intervals. In all FFT
plots, all frequencies in time series carry more energy than the noise. In the case of the
FRF magnitudes, heave has a wide range of responses above the threshold, roll only very
little and pitch not a single frequency. This result is listed in a more detailed manner in
the subsequent Matlab command line log.

TIME SERIES FREQS. Heave : 1 useful interval (s)


> 0.000 − 0.920 [rad/s]
Pitch : 1 useful interval (s)
> 0.107 − 0.874 [rad/s]
Roll : 1 useful interval (s)
> 0.000 − 1.012 [rad/s]

RAO FREQS. Heave : 4 useful interval (s)


> 0.005 − 0.335 [rad/s]
> 0.360 − 0.480 [rad/s]
> 0.525 − 0.670 [rad/s]
> 0.765 − 0.790 [rad/s]
Pitch : 0 useful interval (s)
Roll : 1 useful interval (s)
> 0.255 − 0.270 [rad/s]

All in all, the scanner function proposed 65 frequencies in this example, from which some
were considered more trustworthy than others; the actual trustworthiness was distributed
linearly, with a maximum of 1 at the frequency of the highest FRF peak (heave in this
case), down to 0 at the outermost interval boundaries. Figure 7.4 visualizes this — the

74 Michaela & Tobias Höfler // July 26, 2017


Automatic frequency content detection 7.4

FFT- and FRF-based frequency selection - Heave

0.2
PSD

0.1

1
FRF

0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

FFT- and FRF-based frequency selection - Roll


·10−4

1
PSD

0.5

0.15

0.1
FRF

5 · 10−2

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

FFT- and FRF-based frequency selection - Pitch


·10−5

6
PSD

0
·10−2
1
FRF

0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Angular frequency ω [rad/s]

Fig. 7.3 The frequency identification is based onto two factors: the range of power spectral density (obtained from
the time series FFT) above the noise power level, and the FRF magnitudes in that range. The useful intervals are
marked in purple, the thresholds by a gray background. In every case, all frequencies in the time series supply enough
information. So do almost all in the FRF for the heave case. Roll also features a sufficient energy content for almost
all frequencies in the time series, but only very few which also have a FRF magnitude above the threshold. For pitch,
unfortunately not a single one exceeds the FRF threshold. Two conclusions might be drawn: the threshold has been
chosen too high, or the vessel does not really pitch in this example sea state.

75
7 Multiple input signals Master thesis: Sea State Estimation in the Time Domain

distribution is heavily based on the identified intervals for heave, because that response and
its FRF are dominant in the chosen setting. As is obvious, the spacing is still equidistant,
as was in all previous versions and has been identified as a possible source of error. The
results achieved have improved nevertheless.

The estimated sea spectrum, depicted in Figure 7.5, exhibits a closer fit to the frequency
range of the underlying Bretschneider spectrum than it did before. The RMSE was fully
converged after half of the time series length (20 min). The improved convergence is due
to the fact that the entries on the main diagonal of the model noise covariance matrix Q
were scaled with the corresponding trust, so that the higher the trust, the lower the matrix
1 2
entry; the minimum was 10 σxi , the maximum σx2i . In addition to that, the high-frequency
region — which was wildly guessed before, even though the original sea spectrum did not
feature any energy there — was excluded automatically. A drawback remains: the excessive
peaks at particular frequencies could not be removed; one could say that compared to the
spectrum output presented a few pages back, the singular behavior has increased while
focusing on narrower spots. As a possible solution, logarithmic distribution was used with
dense regions around the peak frequencies, becoming thinner in the distance.

Unfortunately, the named problems could not be solved by this as well. The presence of the
singularities could not be prevented, neither could their magnitude be reduced significantly.
As another disadvantage of the automatic scanner, regardless of how the frequencies are
distributed within the intervals, is that the selected frequency sets are only valid in the
current state. If the vessel changes heading and/or speed, other frequencies could be useful.
The upshot is, that limiting frequencies with the approach reported above might work in
“laboratory conditions”, but could prove not useful in reality. Taking a wide range of
frequencies and letting the filter be uncertain about some is preferred in this scenario, es-
pecially because bad states can always be excluded in post-processing. Adapting Q during
run-time is still possible, but has not been done in the course of this thesis.

As a consequence, the faults in the code could not be found, which left no other option
than starting over from scratch.

76 Michaela & Tobias Höfler // July 26, 2017


Automatic frequency content detection 7.4

Frequency discretisation
1

0.8
Trust in that frequency

0.6

0.4

0.2

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8

Angular frequency ω [rad/s]

Fig. 7.4 The above plot shows the discretization of the identified useful frequencies, as well as the trust that is put
into them. The intervals are mostly based on the results for heave, because this signal is dominant in the example case
at hand; the FRF is usable in large portions. The trust has been dealt linearly between peak frequency and outermost
boundaries.

Estimated Sea Spectrum

14 Original Sea Spectrum


Sea Spectrum Estimate
12
Spectral density S [m2 s/rad]

10

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Angular frequency ω [rad/s]

Fig. 7.5 This sea spectrum estimate is the output of a filter run based on automatically selected frequency ranges,
based on the energy distribution in the carrier frequencies of the input time series and their FRF magnitudes. In
comparison to the estimates presented before, the troublesome and more or less randomly populated high-frequency
region has been left out. As a compensation, there are now larger singularities, however focused on fewer points.
77
78
A clean re-implementation
8
After working on the program code for several weeks, the problems described in sec-
tion 7.3, “Inaccurate sea spectrum estimates”, could not be found and solved. Therefore, it
was decided to start the code again from scratch, but this time with much more knowledge
of the topic. In addition to that, it was decided to add feature after feature and to check
each in order to be able to find the mistake of the previous code. The evolution of the new
program code, as well as big changes compared to the previous code, will be described in
the following paragraphs.

It was decided to use a large amount of frequencies for the time series generation as
well as for the actual Kálmán filter. Reasons for this choice will be further explained in
section 8.1, “Time series import and export”. The tests for the code have been mostly done
with an amount of frequencies of approximately 300. However, it was decided to go back
to an equidistant spacing of the frequencies for the time series as well as for the Kálmán
filter. This was done because there was no obvious advantage of taking non-equidistant
spacing. Also with going back to equidistant spacing, it was decided to skip the automatic
identification of useful frequencies at this point. This means that the frequencies for the
time series as well as for the Kálmán filter need to be specified by the user. There are two
different possibilities: the first is to use the same frequencies for the time series as for the
Kálmán filter estimation, which can be called “laboratory conditions” due to the fact that it
can never be realized in a real life setting. However, this condition can be used for several
testing cases of the filter, because in so doing the estimation is quite correct without any
post processing and potential problems can be identified much faster and simpler. The
second possibility is to use a different set of frequencies for the time series and the Kálmán
filter, which of course represents the reality out on the ocean to a much greater extent,
but has the disadvantage of greater complexity as well.

An example of the difference between taking the same set of frequencies for the time
series generation and the Kálmán filter can be found in Figure 8.1. The plot on the left
side shows the estimated sea spectrum for zero speed, a heading of 135° and with ap-
proximately 300 frequencies. To be able to judge the accuracy of the estimate the original
sea spectrum is depicted in shaded blue in the background. The same applies for the

79
8 A clean re-implementation Master thesis: Sea State Estimation in the Time Domain

ω
~ series = ω
~ f ilter ~ series 6= ω
ω ~ f ilter
6 6
Spectral density S [m2 s/rad]

Spectral density S [m2 s/rad]


4 4

2 2

0 0
0 0.5 1 1.5 0 0.5 1 1.5

Angular frequency ω [rad/s] Angular frequency ω [rad/s]

Fig. 8.1 The two plots show the estimated sea spectrum by the blue line and the original spectrum is presented
in light blue. Both plots represent the result of an estimate for zero speed, a heading of 135° and approximately
300 frequencies. The set of frequencies for the left plot has been the same for the time series generation and for the
Kálmán filter. In case of the right plot, a different set of frequencies was used and no post processing applied.

ω
~ series = ω
~ f ilter ~ series 6= ω
ω ~ f ilter
2.5 2.5
Spectral moment m0 [m2 ]

Spectral moment m0 [m2 ]

2 2

1.5 1.5

1 1

0.5 0.5

0 0
1,180 1,185 1,190 1,195 1,200 1,180 1,185 1,190 1,195 1,200

Time [s] Time [s]

Fig. 8.2 The two plots present the 0th -order spectral moment (the area under the sea spectrum curve) over time, where
the gray line stands for the original sea spectrum and the blue line for the estimated sea spectrum by the Kálmán
filter. The plots correspond to the sea spectra shown in Figure 8.1 for zero speed, a heading of 135° and approximately
300 frequencies. However, the same set of frequencies for the time series generation and for the Kálmán filter was
used for the plot on the left side and a different set for the plot on the right side. It can be seen, that even though
different sets of frequencies were used, the 0th -order spectral moment is approximately the same.

80 Michaela & Tobias Höfler // July 26, 2017


Time series import and export 8.1

plot on the right side in Figure 8.1, which presents the estimated sea spectrum for the
same setting, but with a different set of frequencies for the time series generation and the
Kálmán filter. It shall be noted here, that the depicted result is without any post processing.

An obvious change between frequency set-ups is that in the case of inequality between
generation and estimation there are a lot more fluctuations; their imaginary trend lines
equal the original Bretschneider spectrum regardless of which set of frequencies is used.
For both cases, it can be seen in Figure 8.2 that the 0th -order spectral moment m0 is
approximately the same, although they are both roughly 40 % off. This is due to the fact
that in the “high-frequency area” above 1 rad
s peaks occur in a spiky manner; this will be
adressed in section 8.2, “Avoiding sea spectrum singularities”.

Another important remark is that, in comparison to former versions of the code, the en-
tries for the matrices Q and R are not based on the trust system as implemented in the
automatic identification of useful frequencies any more, instead the sensor and process
noise standard deviations are used again in an unbiased manner.

A big change in the code is the import and export of the time series, which will be further
described in the next section.

8.1. Time series import and export


In the previous code, the time series was generated by the corresponding function each
time the main code was executed. This was changed in the present version due to several
reasons. First of all, the time series generation takes computational time, of course not
as much as the actual Kálmán filter estimation does, but to some degree. Therefore, the
change leads to a more time efficient code. Additionally, every time series is different,
due to the fact that the calculation is based on a random phase shift  as described in
section 2.3, “Data synthesis procedure”, and there exist infinitely many time series. This
implies that the code cannot be tested with the same time series and varying Kálmán
filter settings, which is of course a crucial part of the work in order to test and verify
the code. Due to these reasons, it was decided to generate the time series individually
and uncoupled from the actual Kálmán filter calculations. This means that the time series
generation function is executed and the output of this function is exported and saved to a
text file. However, the time series is generated in the same way as described in section 2.3
and simply imported in the actual Kálmán filter code. The advantage is that this mirrors
a real-life situation on a ship much more, where only the time series of the sensors are
available for the Kálmán filter and nothing else.

81
8 A clean re-implementation Master thesis: Sea State Estimation in the Time Domain

An exemplary excerpt from a text file with an exported time series can be seen below,
where the information is stored column-wise. The time is stored in the first column, the
heave motion with noise in the second and the heave motion without noise in the third
column (only needed for plotting reasons; it could never be recorded by an sensor). The
pitch and roll motion is stored in the same manner with and without noise in column four
to seven.

# EXPORT DATE : 2017−05−15 16:54

# DESCRIPTION
# This time series is based on a Bretschneider sea spectrum

# ADDITIONAL INFORMATION
# Duration .. [s] : +1.2000000000 e+03
# Hs ........ [m] : +4.0000000000 e+00
# Tz ........ [s] : +1.0000000000 e+01
# U ....... [kts] : +0.0000000000 e+00
# Head .... [deg] : +4.5000000000 e+01

# DATA
# Time , Heave , RealHeave , ...
+0.0000000000 e+00 , −1.9581064555e−02 , −1.2935738225e−02 , ...
+1.0000000000e−01 , −1.6487146097e−02 , −1.2193295275e−02 , ...
+2.0000000000e−01 , −2.3323767321e−02 , −1.1357848276e−02 , ...
+3.0000000000e−01 , −5.2234410043e−03 , −1.0438660809e−02 , ...
[...]
+1.2000000000 e+03 , +3.2177725760e−01 , +2.9259776130e−01 , ...

A high priority regarding the time series was given to the fact that the time series should
not repeat itself and should consist of as many frequencies as possible. This is because
real ocean waves are a stochastic process which are modeled here by a finite amount
of sinusoidal waves, as described in section 2.1, “Properties of ocean waves”. Though
sinusoidal waves will repeat themselves after a certain amount of time, what a stochastic
process would never do. In order to have a model, which is as close as possible to the real
problem, the measurement time (the length of the time series) needs to be limited. This
was done here by using the property of harmonic waves, which says that the maximum
measurement time so that there is no repetition needs to be smaller than Tmax ≤ ω2π min
with
ωmin as the smallest frequency used.

82 Michaela & Tobias Höfler // July 26, 2017


Avoiding sea spectrum singularities 8.2

8.2. Avoiding sea spectrum singularities


As another astonishing result of this code version, the presence of “singularities” in the sea
spectrum estimate Ŝ can be named. Figure 8.3 illustrates such a case: for some angular
frequencies larger than 1 rad
s there are peaks in the spectral density, emerging like spikes
in an otherwise near-zero zone. This behavior could — despite intensive research — not
be ascribed to a single reason; however, the source could be narrowed down to a few
influential factors1 .

The first factor is that the closed-form transfer functions have certain frequencies at which
the FRF magnitude is zero (cf. Figure 7.3 on page 75). At these frequencies, the Kálmán
filter does not receive valuable information. With a normalized response amplitude η/ζ → 0
the surface elevation may be as high as one can imagine, and it would not make a difference
for a vessel’s reaction. Thus, the state variables corresponding to these frequencies can

Sea spectrum estimate, based on the latest simulation step


20
Spectral density S [m2 s/rad]

15

10

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4

Angular frequency ω [rad/s]

Fig. 8.3 The above sea spectrum is an estimate provided by the Kálmán filter. At angular frequencies above 1 rad s
one can see that at particular spots spiky peaks emerge from the otherwise flat spectral density. These “singularities”
are most likely caused by near-zero FRFs at these locations. Using multiple input signals reduced the risk of these
peaks emerging, because where one FRF approaches zero, another contains information. At points of zero FRF, the
filter may select an arbitrary surface elevation — it has no influence on the vessels response. These arbitrary surface
elevations are directly depicted by the state variables. Thus, using the state variables at these locations for spectrum
estimation may cause the indicated behavior. A possible work-around is to ignore these state variables in the spectrum
generation process.

1
At first, a global aid was tested. The state variables of the last n time steps were averaged, “smeared” so to say, in each step so
that high-frequency oscillations were removed. It seemed like an appropriate solution in the beginning, but turned out to have an
enormous negative influence on the filter outputs, as well as on the convergence. When n was chosen small enough to not cause a
lot of trouble, the aid that this solution provided was gone as well. Therefore this interference with the Kálmán filter loop is thus
not recommended; if “smearing” is desired, it should be applied to the output of the filter, not to the state vector.

83
8 A clean re-implementation Master thesis: Sea State Estimation in the Time Domain

have arbitrary values; it won’t matter to the filter. The described behavior can be watered
down by using multiple input signals; then another FRF is non-zero where the other one
is zero. The success of this technique depends heavily on speed and relative heading, as
they influence the transfer functions quite a lot.

Another factor was identified to be the convergence of the state variables. During simu-
lation, there might be some states at the troublesome frequencies which have not reached
a useful magnitude yet; this behavior is depicted in Figure 8.4, where two state variable
couples represent a converged and an unconverged case from the last 100 s of the same
filter run. The former case features a much narrower confidence interval and smaller state
variable amplitude than the latter case. An aid might be to grant them some more time
to converge, or not to include these in the sea spectrum estimate output. In that way,
these frequencies may be skipped in the spectrum; how to identify these frequencies is
not trivial. In the thesis at hand, a new function has been introduced for this purpose — a
“Trust Test”, which tells if the calculated state vectors are useful/converged or not. This can
be reliably checked by using the standard deviation σxi of the latest time step of the state
vectors. Though, the state variables need to be checked pairwise, because always two state
variables correspond to one frequency. It was decided to use two different criteria: the
first criterion is that the standard deviation of the last time step divided by the maximum
standard deviation needs to be smaller than 0.02. This implies the claim of a converged
state variable. The second criterion is that the standard deviation of the last time step is
smaller than 1.5 times of the average of all standard deviations in the last time step over
all state variables. This will ensure that the state variables are all reliable enough, so that
only state variables fulfilling the two criteria are used for the estimated spectrum.

84 Michaela & Tobias Höfler // July 26, 2017


Avoiding sea spectrum singularities 8.2

ω = 1.285 rad/s

20

10

−10

−20

1,100 1,120 1,140 1,160 1,180 1,200

ω = 1.32 rad/s

20

10

−10

−20

1,100 1,120 1,140 1,160 1,180 1,200

Time [s]

Fig. 8.4 The above plots show two excerpted state variable couples (out of 300) for different wave frequencies,
with the in-phase component x2i−1 in red and the quadrature component x2i in blue; they are surrounded by their
corresponding confidence intervals shaded gray. Both plots show only the last seconds of the simulation, so that the
parts with very large initial uncertainty are already excluded. The uppermost plot represents ω = 1.285 rad s
, which
converged much better than the lowermost plot for ω = 1.32 rad s
— the confidence intervals are much narrower and
the magnitude of the state variables do not oscillate as much. The unconverged version might need some more time
to converge, but it could also be the case that at this particular frequency the FRFs are all rather small (or there is
another factor why the filter does not receive information above the noise threshold), which leads to no influence of
this state on surface elevation. Thus, the Kálmán filter may choose more or less arbitrary numbers at this frequency;
its uncertainty can clearly be observed.

85
86
Forward speed inclusion
9
After fixing, improving and refining the program code as described in chapter 8, “A clean
re-implementation”, the next consecutive step was of course to include forward speed. This
inclusion is of high importance, because as described in “Scope of the thesis” the program
code at hand can only be useful for ships and their crews if it can be used in parallel to
the usual operations. For patently obvious reasons, the ship cannot be stopped in order to
measure the wave spectrum without speed and then start traveling again.

Including speed is not trivially tough, because the ship and waves can either propagate in
the same direction, in different directions, or there is no influence of speed, as it is for
a heading of 90°. All cases need to be taken into account, and it is important to work
consistently in one domain or do domain mapping correctly as described in section 2.5,
“Speed dependent inter-domain mapping”. In addition, speed influences all three major
parts of the program code: the transfer functions, the time series generation and the actual
Kálmán filter. This will be discussed in the following paragraphs; it will be started with
the transfer functions. One of the reasons for taking closed-form transfer functions is, that
they are easily adjustable for various frequencies and for various speeds. Therefore, the
stated expressions in section 2.4, “Transfer functions”, already include speed as far as one
is specified. In the used formulation of the transfer functions, speed is denoted with the
variable V . This leads directly to the time series generation where the transfer function
with the considered speed is used for the time series.

9.1. Changes in the time series generation process


A better understanding of the time series generation, as well as the different ways of doing
the generation (even though that not all of them are actually implemented), shall be given
by Figure 9.1. In the figure, it can be seen that it needs to be differentiated between the
wave domain (left column) and the encounter domain (right column) as well as between
the frequency domain (upper part) and the time domain (lower part). The two plots on the
uppermost level, drawn in blue, show the sea spectrum, the initial Bretschneider spectrum;
on the left side in the wave domain with the corresponding wave frequencies ω and on
the right side with the associated encounter frequencies ωe in the encounter domain. The

87
9 Forward speed inclusion Master thesis: Sea State Estimation in the Time Domain

Wave domain Encounter domain


Frequency domain

Sea spectrum
Sζ(ω) Sζ(ωe )

ω ωe
Frequency Response Function (FRF)
η Heave
ζ Roll

Pitch

ω and ωe
Response spectrum
Sη(ω) Sη(ωe )

ω ωe
N q N q
2Sη(ωi ) ∆ωi cos(ωi t+δi ) 2Sη(ωe,i ) ∆ωe,i cos(ωe,i t+δi )
P P
η(t) = η(t) =
i=1 i=1
Time domain

Response time series


η(t) η(t)
t t

The above time series represents the response This time series is based on the encounter fre-
of the vessel as a function of the wave fre- quencies and thus is valid for all speeds, as
quency. This is only valid for zero-speed, well as no speed. Therefore, it is the represen-
when ω = ωe ; as is the case for wave buoys. tation of choice for this thesis.

Fig. 9.1 The above figure aims at providing an overview of the implemented time series generation procedure. The
calculation can be done in the wave domain (left half of the figure) based on wave frequencies ω or in the encounter
domain (right half of the figure) based on encounter frequencies ωe . In addition to that, it can be mapped between
the two domains as indicated by the black arrows between the sea spectra as well as between the response spectra.
The mapping from wave to encounter domain is unique, whereas the mapping from encounter to wave domain is not,
as indicated by the dashed arrows. Depending in which domain the response spectrum is, the time series will be too.
However, time series based on response spectra in the wave domain, represent a special case. They are only valid for
zero-speed, when ω = ωe ; this is due to the fact that on-shore and on-board observers will always see the vessel move
with the encounter frequency. Time series based on response spectra in the encounter domain, in comparison, are
valid for all speeds. Based on the encounter frequency, they express the motion as on-board sensors would record them
and are therefore the means of choice. The time series including speed for the Master thesis at hand are calculated
by using a sea spectra in the wave domain which is then mapped to the encounter domain. The encounter domain
sea spectrum is then multiplied with the squared FRF, which results in a response spectrum. This response spectrum
is used to calculate the time series as described in section 2.3 and is used as input for the Kálmán filter.

88 Michaela & Tobias Höfler // July 26, 2017


Changes in the time series generation process 9.1

spectra can be transferred between the two domains, as the black arrows between them
indicate. The mapping from wave domain to encounter domain is unique, whereas the
mapping from encounter to wave domain is not, because of the 1-to-3 mapping problem
stated in section 2.5. This is indicated by the dashed arrow, which shall depict that going
in this direction is in theory easy, but in practice not trivial.

The next step in the time series generation process is to multiply the wave spectrum with
the squared FRF, with respect to the corresponding motion. It is important to use the FRF
with the specified speed and heading. As indicated by Figure 9.1 in the second uppermost
row, and depicted in red, the FRF can be used either in the wave or the encounter domain;
the magnitude does not change. However, their corresponding basis, the wave frequencies
or the encounter frequencies need to match with the chosen domain. The multiplication
of the wave spectrum with the squared FRF results in the response spectrum, which can
be found in the second lowermost row in Figure 9.1; it is depicted in yellow. The black
arrows between the two response spectra again indicate the possibility of mapping between
the two domains. The response spectra can be transferred into time series based either on
wave frequencies or encounter frequencies as explained in section 2.3. This results in time
series in the time domain in the lowermost row of Figure 9.1, colored in purple. However,
it should be noted, that there is also another way of generating the time series without
actually calculating the complete response spectrum directly. The calculations can also be
done by only using the amplitudes of the wave spectrum and the FRF, as is given below.

ζ̃
nω zq }|i {
X
η(t) = FRFi 2 Sζ ∆ωi cos (ωi t)
i=1
nω q
9.1
X
= 2 FRFi 2 Sζ ∆ωi cos (ωi t)
i=1
Xnω
p
= 2 Sη ∆ωi cos (ωi t)
i=1
| {z }
η̃i

For this Master thesis, it was decided to calculate the time series based on response spectra
and not over the amplitudes. Both methods are equivalent, but calculating also the response
spectra makes it possibile to compare and check the relation between sea spectrum and
response spectrum visually and to find potential mistakes there.

Depending on which domain (wave or encounter domain) was used for the time series
generation, the time series have different properties. This means that time series in the
wave domain represent a special case. They are only valid for zero-speed, when ω = ωe ;
this is due to the fact that on-shore and on-board observers will always see the vessel

89
9 Forward speed inclusion Master thesis: Sea State Estimation in the Time Domain

move with the encounter frequency. In comparison to that, time series calculated from the
encounter domain method are valid for all speeds. Based on the encounter frequency, they
express the motion as on-board sensors would record them and are therefore the means of
choice. Consequently, time series based on response spectra in the encounter domain are
the correct choice here. More precisely, the time series generation (including speed) starts
from a sea spectrum in the wave domain, which will be mapped in the encounter domain.
This sea spectrum in the encounter domain is starting point for the actual time series
calculation, that results in a time series based on a response spectrum in the encounter
domain1 .

9.2. Changes regarding the Kálmán filter


The Kálmán filter itself is able to process a time series whether there is forward speed
included or not. However, the output of the Kálmán filter differs depending on its input.
Figure 9.2 shall give an overview of possible in- and outputs of the Kálmán filter. Three
inputs are necessary for the filter to work correctly: the time series, a set of frequencies
the filter uses to predict and transfer functions. Attention needs to be paid that the transfer
functions are based on the same frequencies as the one the Kálmán filter uses. However,
either wave or encounter frequencies can be used for the calculation; only the domain type
of the estimation result will vary according to the used frequency type. Wave frequencies
will result in a sea spectrum estimate in the wave domain and encounter frequencies in an
output in the encounter domain. The black arrows in Figure 9.2 indicate, that a mapping
between the two sea spectrum estimates is possible, but the dashed arrow implies that
mapping from encounter to wave domain is not unique.

Time series of both domain types can be used for the Kálmán filter, but in the thesis at
hand only time series based on the encounter domain are used as a sensor on-board would
measure. Moreover is the main interest on comparing the sea spectrum estimate in the
wave domain to the original one which was used to generate the time series. Accordingly,
it was decided to use wave frequencies and the corresponding transfer functions for the
Kálmán filter calculations. An advantage is that no mapping between encounter and wave
domain is necessary as post-processing then.

But before the very desirable output of a directly estimated, first-hand wave domain sea
spectrum can be received, there is another necessary modification to the Kálmán filter.
Assuming the case that the filter is set-up to use wave frequencies for estimation, but the

1
Please note that for the multiplication of sea spectrum and FRF, the latter needs to be FRF(ωe ) . The closed-form representation
presented in this thesis takes ω as input, transforms to ωe internally for calculation, and outputs the FRF magnitude in a vector
sorted according to the input ω
~ . Thus, when a transfer function for a spectrum in the encounter domain is required, the FRF function
output needs to be sorted to match the spectrums ascending ω~e abscissa.

90 Michaela & Tobias Höfler // July 26, 2017


Changes regarding the Kálmán filter 9.2

input time series is build up with encounter frequencies, the measurement output matrix Oz
needs altering. As is known from before, it is multiplied with the ω -based state variables
to build the estimated response at each time step. In the original formulation for Oz (cf.
Equation 5.8 on page 61), this response time series is composed of sinusoids oscillating
with ω , which is no problem for zero-speed. Replacing the oscillation frequency with ωe
is a very good start.
Time domain

Input time series, based on ω Input time series, based on ωe


η(t) η(t)
t t

Requirement Requirement
Transfer function Transfer function
implementation with implementation with
ω as basis, which is ωe as basis.
the case for the
closed-form version
in this thesis.
The Kálmán filter

ω as filter frequencies ωe as filter frequencies

Sea spectrum estimate


Freq. domain

Ŝζ(ω) Ŝζ(ωe )

ω ωe
Wave domain Encounter domain

Fig. 9.2 The above figure provides an overview of possible in- and outputs of the Kálmán filter. In general, the
Kálmán filter can process any kind of time series as input whether the time series is based on the wave or encounter
domain. Another input for the filter are the frequencies and the transfer functions, which can also be either in the
wave or encounter domain. Hereby attention needs to be paid, that the input frequencies (so the frequencies used
to estimate the sea spectrum) are the same as used for the transfer functions. As the figure illustrates, the Kálmán
filter can handle any kind of combination of time series and frequencies in the two domains. However, the output the
filter produces differ regarding the domain. If wave frequencies are used, the output is a sea spectrum estimate in the
wave domain and if encounter frequencies are used the result is a sea spectrum estimate in the encounter domain.
The two estimated spectra can be transferred via mapping into each other as the black arrows indicate. The dashed
arrow implies that mapping is possible, but not unique as it is from wave to encounter domain. For this thesis at
hand, it was decided to use time series based on encounter frequencies as sensors on-board a ship would measure.
Hence, frequencies and transfer functions based on wave frequencies are used for the Kálmán filter estimate in order
to end up with a sea spectrum in the wave domain which can then be compared to the original one.

91
9 Forward speed inclusion Master thesis: Sea State Estimation in the Time Domain

Oz i,2j−1 = Re TFi(ωj ) cos ωej t − Im TFi(ωj ) sin ωej t


   
9.2
Oz i,2j = − Im TFi(ωj ) cos ωej t − Re TFi(ωj ) sin ωej t
   

Consequently, the transfer function has also to be set up to provide output corresponding
to the order of vector ω
~ as it is used by the Kálmán filter, from which the (potentially
unsorted) ω~e has been created. The reason is that caution needs to be exercised that
the correct entry in the transfer function vector scales the correct harmonic response
component. In the thesis at hand, this involves no extra effort in the code because the
implementation of the closed-form transfer functions is already based on ωe , although it
takes ω as input:

Oz i,2j−1 = Re TFi(ωj →ωej ) cos ωej t − Im TFi(ωj →ωej ) sin ωej t


   
9.3
Oz i,2j = − Im TFi(ωj →ωej ) cos ωej t − Re TFi(ωj →ωej ) sin ωej t
   

This equation was developed into a piece of code, which has no problem with the frequency
sorting, as is described in the subsequent text.

Signals = {'Heave ','Pitch ','Roll '};


OmegaE = abs(Omega − Omega .^2/9.81∗ Speed_kts ∗1852/3600∗ cosd( Heading ));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
for s = 1: nSignals ;
CurrentTF = TF.( Signals {s});
for i = 1: nOmega ;
H(s ,2∗i−1:2∗i) = [...
real( CurrentTF (i))∗cos( OmegaE (i)∗t) ...
− imag( CurrentTF (i))∗sin( OmegaE (i)∗t) , ...
−(real( CurrentTF (i))∗sin( OmegaE (i)∗t) ...
+ imag( CurrentTF (i))∗cos( OmegaE (i)∗t)) ...
];
end;
end;

The filter frequency vector, which is sorted in ascending order, is the basis for an en-
counter frequency vector, which, due to possible 1-to-3 mapping, can be unsorted. It is not
sorted afterwards, because the same transformation takes place in the closed-form transfer
function. This leads to an alignment between transfer function and encounter frequency
vector, as desired. In the code snipped above, there are some more points that are deemed
necessary to be addressed. Firstly, the matrix Oz is called H there, as Brown and Hwang
[3] do — the name in the code has just not been changed, as it has for the report to achieve

92 Michaela & Tobias Höfler // July 26, 2017


Changes regarding the Kálmán filter 9.2

consistent naming. Secondly, the refreshment of the matrix is wrapped into two for-loops:
the outer one for each included motion (heave, roll, pitch) determines the row in H, the
inner one the column(s) — there are two entries per filter frequency. Thirdly, and finally,
there is the command that fetches the CurrentTF in the outer loop. The complex-valued
transfer functions for the specified filter frequencies are computed beforehand and stored in
the structured array TF; it has fields whose names correspond to the name of the motion,
which is listed in the cell array of character vectors Signals. The upshot is that in this
way any disagreement caused by swapping ω with ωe can be circumvented.

Since this chapter is about the latest version of the code, please pardon the fact that the
actual results of this version are not shown here. They have been moved to chapter 10,
“Discussion of results”, at the beginning of the next part, only a few pages ahead. It
seemed more fitting to dissect the final results there in greater detail.

93
94
III
Conclusion
96
Discussion of results
10
The topic of this chapter is the presentation of the results that were achieved with the most
recent version of the Matlab code developed. For this purpose, a generic Bretschneider
spectrum with the parameters Hs = 4 m and Tz = 10 s has been chosen as a basis; the
wave frequencies chosen were ω ~ = [ 0.005 , 0.010 , 0.015 , . . . , 1.5 ] rad
s . From this, time
series were created for all combinations of the vessel’s velocity V = 0, 20 kts and the
relative heading angle µ = 0°, 45°, 90°, 135°, 180°1 ; to do so, the sea spectrum was mapped to
the encounter domain and then transformed to a response spectrum via the corresponding
FRF. Based on these response spectra, the time series were created to a predefined length,
with a sampling time of Ts = 0.1 s, corresponding to a sampling frequency of fs = 10 Hz.

10.1. Estimate evaluation


For a start, the time series length was set to 1250 s (20 min and 50 s). The reason for this is
the fact that repetition should be avoided. From the end of section 8.1, “Time series import
and export”, it is known that Tmax ≤ ω2π min
. In the case at hand, the following results:

2π rad
Tmax ≤ ≈ 1256.637 s > 1250 s 10.1
0.005 rad
s

Feeding the time series into the Kálmán filter, which is based on the same wave frequencies
as the Bretschneider spectrum, results in the plots that will be discussed in the subsequent
text.

Figure 10.1 depicts the estimated sea spectra for all combinations. Please note that the
ordinates of these plots are not the same; due to some very unlikely estimates in following
sea, the y-axes had to be scaled accordingly. Looking at the left column, the zero-speed
case, it can be seen that below approximately 1 rad
s all estimated spectra match the original
Bretschneider spectrum quite well. Above the threshold, only the beam sea case is accurate;
the more one deviates to head sea or following sea, the worse the estimate becomes in the

1
Please see the plots of 1-to-1 and 1-to-3 mapping in section 2.5, “Speed dependent inter-domain mapping”, for comparison. These
were created for almost the same combinations of velocity and relative heading, except that they feature one more speed (10 kts).
These plots may aid interpretation of the results to follow.

97
10 Discussion of results Master thesis: Sea State Estimation in the Time Domain

0 kts at 0° 20 kts at 0°
10 800

8
600
6
400
4
200
2

0 0
0 0.5 1 1.5 0 0.5 1 1.5

0 kts at 45° 20 kts at 45°


10 800

8
600
6
400
4
200
2

0 0
0 0.5 1 1.5 0 0.5 1 1.5
Spectral density S [m2 s/rad]

0 kts at 90° 20 kts at 90°


10 10

8 8

6 6

4 4

2 2

0 0
0 0.5 1 1.5 0 0.5 1 1.5

0 kts at 135° 20 kts at 135°


10 10

8 8

6 6

4 4

2 2

0 0
0 0.5 1 1.5 0 0.5 1 1.5

0 kts at 180° 20 kts at 180°


10 10

8 8

6 6

4 4

2 2

0 0
0 0.5 1 1.5 0 0.5 1 1.5

Angular frequency ω [rad/s] Angular frequency ω [rad/s]

Fig. 10.1 The plots above show the estimated sea spectra for all combinations of the vessel’s velocity V = 0, 20 kts
and the relative heading angle µ = 0°, 45°, 90°, 135°, 180°. As before, the original Bretschneider spectrum is shaded
blue, the actual estimate is the solid blue line, its 95% confidence interval is shaded gray. Please note that not all
y-axes are equally scaled; some sea states produced very extreme amplitudes. In the case of zero speed, all spectra
match the Bretschneider spectrum quite well, except for frequencies above 1 rad s
. These are only matched in the case
of beam sea. In the case of included forward speed, beam sea fits as well, head sea and bow sea only below 1 rad s
. In
following sea and quartering sea, the estimates are totally off; however, none of the results have been post-processed
yet.

98 Michaela & Tobias Höfler // July 26, 2017


Estimate evaluation 10.1

0 kts at 0° 20 kts at 0°
200

20
150

100
92.548
10
6.160
50

0 0
1,160 1,180 1,200 1,220 1,240 1,160 1,180 1,200 1,220 1,240

0 kts at 45° 20 kts at 45°


4 200

3 150
101.291
2 100
1.328
1 50

0 0
1,160 1,180 1,200 1,220 1,240 1,160 1,180 1,200 1,220 1,240

0 kts at 90° 20 kts at 90°


Spectral moment m0 [m2 ]

4 4

3 3

2 2

0.991 0.992
1 1

0 0
1,160 1,180 1,200 1,220 1,240 1,160 1,180 1,200 1,220 1,240

0 kts at 135° 20 kts at 135°


4 4

3 3 2.588
2 2
1.248
1 1

0 0
1,160 1,180 1,200 1,220 1,240 1,160 1,180 1,200 1,220 1,240

0 kts at 180° 20 kts at 180°

20 20 18.332

10
6.639 10

0 0
1,160 1,180 1,200 1,220 1,240 1,160 1,180 1,200 1,220 1,240

Time [s] Time [s]

Fig. 10.2 The plots above show the spectral moment m0 over the last 100 s of the simulation time for all combinations
of the vessel’s velocity V = 0, 20 kts and the relative heading angle µ = 0°, 45°, 90°, 135°, 180°. m0 is based on the
spectrum estimates, as shown in Figure 10.1, with the spectral moment of the Bretschneider spectrum being 0.9903 m2 ,
drawn as a gray line. As for the sea spectrum figure, the y-axes do not all have the same scale. For the case without
speed, beam sea fits best, quartering sea and bow sea a little less, head sea and following sea are off by factor of around
8. Considering forward speed, beam sea is still perfect, bow sea is not correct anymore, head sea is 20 times too large,
and quartering sea and following sea are extremely wrong; however, none of the results have been post-processed yet.

99
10 Discussion of results Master thesis: Sea State Estimation in the Time Domain

higher frequency region. In the case of forward speed, in the right column of Figure 10.1,
the same spiky behavior in the high-frequency region can be observed. However, beam
sea fits perfectly again, bow sea and head sea is as good as without speed, but the result
of quartering sea and following sea is off the scale. However, the results presented in
Figure 10.1 have not been post-processed. As the spectral densities grow, the confidence
interval widens quadratically, as Equation 4.10 on page 55 already indicated. This is clearly
a disadvantage of the method devised for the sea spectrum propagation of uncertainty.

The same trend as for the spectral densities in Figure 10.1 can be seen in their corre-
sponding spectral moments m0 for the last 100 s of the simulation time, as is depicted in
Figure 10.2. Without any forward speed, the beam sea spectrum area fits perfectly to the
spectral moment of the Bretschneider spectrum, which is 0.9903 m2 . Rotating 45° in both
directions from the transverse results in little added area; going to head sea and following
sea completely results in an area at least 6 times as big as for beam sea. Considering speed,
the area of the beam sea spectrum is unchanged — which is no surprise, due to ω = ωe
in this case regardless of forward speed. The result in case of bow sea is approximately
2.6 times larger than the original area. Proceeding to head sea, the area grows even more,
ending at roughly 20 times larger than it should be. In case of anything below 90°, the
areas are far off and do not seem to converge properly. The reason for the added areas in
case of zero-speed and with speed for the headings head sea and bow sea are the singular
deviations in the spectrum above 1 rad s ; these contribute to the area also, because for the
m0 calculations no post-processing was used for the estimated sea spectra.

A possible solution for the spikiness in the high-frequency region has been found in the
trust-based post-processing of the sea spectrum estimates, as has been described in sec-
tion 8.2, “Avoiding sea spectrum singularities”. After application to the sea spectra presented
initially, the questionable state variables have been omitted in the spectrum creation; this
yielded the sea spectra in Figure 10.3. Still, 90° does not show any troubles regardless of
speed; not a single state had to be excluded. Taking a look at the relative headings above
90°, the spectra look usable in the region below 1 rad s ; above this virtual threshold the
“spectral noise” could be reduced to a magnitude that at least allows plotting the spectra
without missing out any part. The same applies to the cases for the relative headings below
90°. Without forward speed, the spectra seem ok; of course some additional smoothing as
post-processing could enhance the results even further, but it has been neglected here to
present the unveiled output of the “trust check”. The result for head sea and bow sea with
speed shows a more spiky behavior, also in the peak region of the spectrum, than the result
without speed. Despite that, the results for head sea and bow sea with speed can be called
sufficient even though they could benefit by additional post-processing. The same applies
for following sea and quartering sea without speed. The situation is different, however,

100 Michaela & Tobias Höfler // July 26, 2017


Estimate evaluation 10.1

0 kts at 0° 20 kts at 0°
4 4

3 3

2 2

1 1

0 0
0 0.5 1 1.5 0 0.5 1 1.5

0 kts at 45° 20 kts at 45°


4 4

3 3

2 2

1 1

0 0
0 0.5 1 1.5 0 0.5 1 1.5
Spectral density S [m2 s/rad]

0 kts at 90° 20 kts at 90°


4 4

3 3

2 2

1 1

0 0
0 0.5 1 1.5 0 0.5 1 1.5

0 kts at 135° 20 kts at 135°


4 4

3 3

2 2

1 1

0 0
0 0.5 1 1.5 0 0.5 1 1.5

0 kts at 180° 20 kts at 180°


4 4

3 3

2 2

1 1

0 0
0 0.5 1 1.5 0 0.5 1 1.5

Angular frequency ω [rad/s] Angular frequency ω [rad/s]

Fig. 10.3 This figure contains plots of the spectrum estimation, which have been stripped of “untrustworthy”
frequencies. It is based on the spectra presented in Figure 10.1. Again, all combinations of the vessel’s velocity
V = 0, 20 kts and the relative heading angle µ = 0°, 45°, 90°, 135°, 180° are considered. Unlike the previous spectra,
these are not accompanied by a confidence interval; this was deemed unnecessary to show once more, because the
exclusion of certain frequencies does not alter the uncertainty. It can be seen, that for the transverse direction (90°)
the spectra have not been altered. In the forward directions, bow sea and head sea, the spectra are ok since the high-
frequency region has been relieved of the most extreme spectral densities. In case of quartering sea and following sea
the spectra are more or less useless, because all frequencies in which the original Bretschneider spectrum contained
relevant magnitudes have been eliminated from the estimate.

101
10 Discussion of results Master thesis: Sea State Estimation in the Time Domain

with forward speed: these spectra have been eliminated almost completely. Only a few
states passed the test for following sea, and especially those which belong to the noisy
parts. All frequencies below approximately 1.25 rad
s have been stripped off. The estimated
spectrum for 45° and 20 kts is completely empty, except two or three frequencies close to
0 rad
s . As is obvious, even this post-processing could not salvage these spectral estimates.
This becomes evident also when looking at the comparison of the spectral moments m0 in
Table 10.1.

The question is now: What causes these errors in the spectral density? As can be recalled,
the spectral density is calculated in the following way1 :

1 1
x̂22i−1 + x̂22i

Sζ(ωi ) =
2 ∆ωi

The equation indicates that extreme values can be either a consequence of large state
variables, or very small ∆ωi . The latter observation can be invalidated quickly: the filter
is (in this set-up) always working with equidistantly spaced frequencies, which makes ∆ωi
a constant. Although the filter is working with unsorted encounter frequencies in terms
of response estimation, these are not used for spectral density calculation. The initial
observation seems more promising as a source of error: it should be checked whether all
states have converged and if they feature extreme values as well.

Figure 10.4 illustrates the root-mean-square error of the error covariance matrix P over
p
the course of the simulation time; RMSE = tr(P) as may be recalled. As can be seen,
all cases have converged eventually, except for 20 kts at 0° and 45°. For zero-speed, the
convergence was finished at roughly 1200 s in any case; the same applies to 90° with speed.

Tab. 10.1 The table to the left lists the exam-


Late s t s p e c t r a l m o m en t c o m pa r i s o n
ined combinations of velocity V and relative
Direct T r u s t- b a s e d heading µ with respect to the spectral moment
m0 of the direct sea spectrum estimate and the
V µ Abs. Rel. Abs. Rel.
“trust filtered” one. The listed values correspond
0 kts 0° 6.160 m2 +522 % 1.573 m2 +59 % to the latest time step in the simulation and are
0 kts 45° 1.328 m2 +34 % 1.057 m2 +7 % also presented with a percentage of difference to
0 kts 90° 0.991 m2 0% 0.991 m2 0% the underlying Bretschneider spectrum spectral
0 kts 135° 1.248 m2 +26 % 1.070 m2 +8 %
moment of 0.9903 m2 .
0 kts 180° 6.639 m2 +570 % 1.380 m2 +39 %

20 kts 0° 92.548 m2 +9245 % 2.050 m2 +107 %


20 kts 45° 101.291 m2 +10 128 % 0.0005 m2 -99.5 %
20 kts 90° 0.992 m2 0% 0.992 m2 0%
20 kts 135° 2.588 m2 +158 % 1.277 m2 +29 %
20 kts 180° 18.332 m2 +1751 % 1.649 m2 +67 %

1
Cf. previously presented Equation 4.7 on page 54

102 Michaela & Tobias Höfler // July 26, 2017


Estimate evaluation 10.1

0 kts at 0° 20 kts at 0°
800 800

600 600

400 400 501.450

200 200
5.230
0 0
0 200 400 600 800 1,000 1,200 0 200 400 600 800 1,000 1,200

0 kts at 45° 20 kts at 45°


800 800

600 600

400 400
531.737

200 200
2.470
0 0
0 200 400 600 800 1,000 1,200 0 200 400 600 800 1,000 1,200

0 kts at 90° 20 kts at 90°


800 800

600 600
RMSE [-]

400 400

200 200

1.907 1.907
0 0
0 200 400 600 800 1,000 1,200 0 200 400 600 800 1,000 1,200

0 kts at 135° 20 kts at 135°


800 800

600 600

400 400

200 200

2.466 2.611
0 0
0 200 400 600 800 1,000 1,200 0 200 400 600 800 1,000 1,200

0 kts at 180° 20 kts at 180°


800 800

600 600

400 400

200 200
5.230 7.165
0 0
0 200 400 600 800 1,000 1,200 0 200 400 600 800 1,000 1,200

Time [s] Time [s]

Fig. 10.4 Time series for all combinations of the vessel’s velocity V = 0, 20 kts and the relative heading angle
µp= 0°, 45°, 90°, 135°, 180° were evaluated in the Kálmán filter. The above plots show the root-mean-square error
( tr(P)) of the error covariance matrix P, with the number indicating the final magnitude. All calculations have
converged, except the cases of 0° and 45° at 20 kts. This resembles the observations of the sea spectrum estimation
quality illustrated in Figure 10.1.

103
10 Discussion of results Master thesis: Sea State Estimation in the Time Domain

The cases with frontal waves and speed converge even faster. Thus, insufficient time for
convergence cannot be the cause for the noisy spectral density above 1 rad s . It may have
to do with the fact that the selection of ω
~ provides too many frequency “building blocks”
for the Kálmán filter. Usually, in terms of vessel motion, the high-frequency part contains
only noise; this makes a limitation to lower frequencies useful. The above results are all
based on the same sea state. Changing this yielded other virtual thresholds for a useful
cut-off frequency, which indicates that it is sea state dependent; so far no suitable method
for threshold detection could be devised. The automatic frequency detector, as has been
presented in section 7.3, “Inaccurate sea spectrum estimates”, might be a useful start; it
will be discussed in section 11.1 starting on page 111.

10.2. Long-term convergence test

Since for following sea and quartering sea the filter could not finish convergence in the
given simulation time, a test with a much longer time series seemed useful; it is known
though, that the new time series length of 7200 s (120 min) exceeds the no-repetition length
by far. In addition to that, the assumption of stationarity regarding sea states could never
hold in real life, where 30 min is commonly taken as a maximum, but in the “laboratory
conditions” used here it will. As test conditions for the convergence of the filter these
shortcomings can be tolerated.

Figure 10.5 combines the results for this test, by showing the unchanged spectrum esti-
mate, the trust-filtered one, and the root-mean-square error. As before, there are severely
singular peaks in the estimated spectrum, which can be removed partially by kicking out
the unconverged, maladaptive state variables. The post-processed spectrum does not look
useful anyhow, because the wave frequencies around the location of the Bretschneider
spectrum peak are among the excluded ones. The conclusion that these spectra are not
the best result is aided by the plot of the root-mean-square error, which shows that even
after 2 hours, the convergence is still not finished, and the RMSE is far above the level of
the other test cases — and probably will never reach it.

Recalling Equation 2.54 (Sζ(ωe ) ∆ωe = 3i=1 Sζ(ωi ) ∆ωi ) is a useful starting point for drawing
P

a conclusion from the above observations, because even setting the Kálmán filter up to work
with encounter frequencies (which required changes in the closed-form transfer function
implementation) did not result in usable sea spectra for following sea.
The Kálmán filter features an internal mapping from wave to encounter domain in the
matrix Oz when forward speed is considered. In the case of frontal waves at sufficient
speed, there is only 1-to-1 mapping, while in cases of little speed with waves approaching

104 Michaela & Tobias Höfler // July 26, 2017


Long-term convergence test 10.2

Long-term test, at 20 kts and 0°


200
Spectral density S [m2 s/rad]

150

100

50

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4

Angular frequency ω [rad/s]

10
Spectral density S [m2 s/rad]

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4

Angular frequency ω [rad/s]

800

600
RMSE [-]

400

200

145.105
0
0 1,000 2,000 3,000 4,000 5,000 6,000 7,000

Time [s]

Fig. 10.5 This figure is part of the results for the long-term convergence test, with a time series length of 7200 s
and at 20 kts and 0°. The uppermost plot depicts the estimated sea spectrum with its 95% confidence interval, while
the plot below shows the same spectrum after trust-based post-processing. Even after the long simulation time, both
do not fit very well to the underlying Bretschneider spectrum. The lowermost plot depicts the root-mean-square error
over the simulation time; even at the last step, it has a magnitude far above the ones shown in Figure 10.4 and not
converged. Hence, it is no wonder that the spectral estimates are not useful.

105
10 Discussion of results Master thesis: Sea State Estimation in the Time Domain

from the aft the region of 1-to-3 mapping can be significant1 . But what does the above
formula have to do with this? It represents the energy regrouping from up to three wave
frequencies to a single encounter frequencies. When the matrix Oz is multiplied with the
states x̂ it creates a response amplitude at the current time step by adding up multiple
elementary responses. Basically, it creates a sum of amplitudes, whereas the above formula
is a sum of areas — the unit of the integral over (a slice of) the spectrum with respect to
ω is m2 . Hence, it should be compared whether the sums are compatible.

Inserting the generic formulation for the spectral density S(ωi ) = 12 ζ̃i2 ∆ω
1
i
, based on the
wave amplitude, into the sum above yields the below expressions.

1 2 1 1 1 1 1 1 1
ζ̃ ∆ωe = ζ̃12 ∆ω1 + ζ̃12 ∆ω2 + ζ̃12 ∆ω2 10.2
2 e ∆ωe 2 ∆ω1 2 ∆ω1 2 ∆ω1
1 2 1 2 1 2 1 2
⇒ ζ̃ = ζ̃1 + ζ̃2 + ζ̃3 10.3
2 e q2 2 2
⇒ ζ̃e = ζ̃12 + ζ̃22 + ζ̃32 10.4

It should not be forgotten that the above equation, although featuring only amplitudes, still
represents a slice of the encounter spectrum in the frequency domain; therefore, it does
not take the phase shift into account. In any case, from the encounter spectrum, the next
step is to transform to the response spectrum with the corresponding transfer function for
the motion with index “i”2 :

Sη̃i (ωe ) = FRFi 2 Sζ̃i (ωe ) 10.5


q
⇒ FRFi(ωe ) ζ̃e = FRFi(ωe ) ζ̃12 + ζ̃22 + ζ̃32 10.6
q
⇒ η̃ = FRFi(ωe ) ζ̃12 + ζ̃22 + ζ̃32 10.7

In contrast to the root-mean-square method in which the response amplitude is created in


the above equation, the application of the measurement output matrix Oz provides a plain
sum of amplitudes, which on the other hand takes phase shifts into account. Due to a lack
of time, the (in-)equality of the expressions cannot be examined in a closer fashion in this
thesis; nevertheless it has been identified as a promising topic for future review.

A positive fact is that the motion signal prediction of the Kálmán filter works perfectly
regardless of how bad the convergence of the RMSE or the spectrum output is. Figure 10.6
illustrates the first minute of the signals heave, roll and pitch during this long-term test.

1
Cf. the plots in Figure 2.10 on page 32
2
Please note the fact that the response amplitude η̃ has no index “e” for the encounter domain, as ζ̃e had before multiplication with
the frequency response function. The index has been dropped due to the fact that there is never a response in the wave domain; the
vessel always responds to the encountered waves! An exception is the case of zero-speed, when ω = ωe .

106 Michaela & Tobias Höfler // July 26, 2017


Long-term convergence test 10.2

Heave at 20 kts and 0°

0.4

0.2
Heave [m]

−0.2

−0.4

0 5 10 15 20 25 30 35 40 45 50 55 60

Roll at 20 kts and 0°


·10−2
1

0.5
Roll [deg]

−0.5

−1
0 5 10 15 20 25 30 35 40 45 50 55 60

Pitch at 20 kts and 0°


·10−3

2
Pitch [deg]

−2

−4

0 5 10 15 20 25 30 35 40 45 50 55 60

Time [s]

Fig. 10.6 The plots above are a part of the long-term convergence test, with a time series length of 7200 s and at
20 kts and 0°; only the first minute is presented for reasons explained hereafter. As can be seen, for all three motions,
the prediction of the Kálmán filter fits the noisy signal right from the start. The uncertainty is also very small, as
can be concluded from the narrow 95% confidence intervals. Therefore, only the first seconds are relevant because the
filter did not lose track of the signal afterwards. That in the case of roll the signal and the prediction are close to
zero is a consequence of the fact that when the long-crested waves approach from the aft, there will be no roll motion
(theoretically, parametric rolling might still occur, but that is a different topic).

107
10 Discussion of results Master thesis: Sea State Estimation in the Time Domain

It is clearly the case that the filter was able to adapt to the given time series very quickly.
Due to this, the rest of the motion estimation has been skipped in the plot; the Kálmán
filter did not lose track of it.

All in all, the results are satisfying, as they present a way of estimating sea states from
recorded vessel motions directly in the wave domain, eliminating the need for mapping.

10.3. Remarks
In this section, some additional remarks to the overall presented results shall be made.
These concern details of the Kálmán filter implementation, the quality of the written code,
as well as the transfer functions used.

Starting with the error covariance matrix P, Brown and Hwang [3] indicate that in some
cases a lack of convergence is caused by round-off error in this matrix. These can be avoided
by using “high precision”, having as few time steps as possible between sensor reading
updates, and as a last resort forcing P to be symmetric or using only the upper/lower
triangle. Furthermore, they state that as long as P is positive definite, the filter will upon
disturbance always return to a stable state [3, ch. 6]. In the first attempts of creating
a working Kálmán filter, these troubles were encountered and the suggested aids tested;
they work, but consume additional computational power. Especially forcing P to symme-
try by overwriting the lower triangle with the entries of the transposed upper triangle
in each time step slows the process down a lot. It should only be done when the need arises.

Speaking of which, the computational power that was available for this thesis was on an
average level: a laptop with 4 × 2 GHz and a desktop computer with 4 × 3.1 GHz. On the
latter, the long-term test with a time series length of two hours and three included motions
took 1 h:26 min wall time1 , or 2 h:53 min CPU time2 , excluding the plotting. That indicates,
that with an off-the-shelf computer, real-time processing of the sensor signals is possible,
as well as the near-real-time creation of sea spectra of e.g. the most recent minutes.
A note on the Matlab code: it has not been optimized for efficiency yet. It contains
many for-loops, which could partially be parallelized; the Kálmán filter loop is limited to
a strict order and can thus not be computed in parallel, but the transfer functions and
updated filter matrices within each time step could be.

This leads to the next topic for the remarks, the transfer functions themselves. In the
thesis at hand, the closed-form expressions have been used because they are versatile and

1
The so called “wall time” is named that way because it is measured with the clock hanging on the physical wall.
2
The CPU time was measured in the main Matlab file with the in-built command cputime.

108 Michaela & Tobias Höfler // July 26, 2017


Remarks 10.3

Vessel ≈ Rigid structure


for short waves with small amplitudes

Wave energy → Kinetic energy


Unused wave energy
Reflected energy

Fig. 10.7 The above illustration schematically shows that some of the energy that the wave carries is reflected
by the vessel, another part passes by, and a third part is absorbed and transformed into kinetic energy. As can be
understood, the reflected amount depends on the length and magnitude of the incoming wave. For long low waves
(cf. swell), there is not much reflection because the dimensions of the vessel are negligible compared to the ones
of the wave; short medium-sized waves may be reflected to a larger degree. Medium-length large waves might be
transformed into a large amount of kinetic energy and capsize the vessel (cf. toy boats in the bathtub). In any case,
the reflected wave modifies the incoming one’s properties. This is repeated over and over again, which leads to very
non-linear interactions. For all of the above reasons, it can be stated that the ship acts as a filter itself; the ship-board
measurements can thus not represent the entirely true sea state, but the one from the ship’s perspective.

fast, thus perfect in “laboratory conditions”. On a real ship however, it is advised to use a
set of high resolution pre-computed transfer functions because they are more accurate; the
needed cases include all combinations of e.g. draft1 , trim, speed, relative heading. During
run-time, the filter would then have to fetch the correct FRF and phase shift from inter-
polation inside this multi-dimensional data array.

This section shall be concluded by a last note on the estimation of sea spectra from vessel
motions. Figure 10.7 illustrates that not the total energy contained in the waves is actually
transfered to the vessel. For short waves with small amplitudes, the ship may be considered
a rigid structure which reflects parts of the wave. Other parts pass the vessel by. As a
consequence, the wave energy is transferred to the vessel only partially, but it is this
energy that is transformed into kinetic energy expressed by e.g. heave, roll and pitch,
which sensors can then record. Hence, drawing conclusions from the motions onto the
“real” wave can never result in a perfect solution, but a very useful one may be achieved.

1
The draft is closely related to the displacement and may vary depending on the loading and ballast condition, as well as due to the
water temperature and density. How large the change of draft is depends on the ship’s form, as well as on the operational area.

109
110
11
Outlook

In this chapter, a perspective on possible future extensions of this thesis work shall be
given. This includes reasons and hints for the re-implementation of the automatic frequency
scanner, why short-crested sea is an important topic to consider next, and the optimization
of the code due to the computational power multiple wave directions at once require.

11.1. Re-implementation of the frequency filter

First things first, an automatic detection of useful frequencies could aid the output in a way
that would eliminate the need for trust-based post-processing. An output of such a function
has already been presented in Listing 7.4 on page 74, where the exemplary case was 0 kts
at 135°. The identified frequency range was roughly 0.005…0.9 rad s , which corresponds quite
rad
well to the virtual threshold of 1 s identified in “Discussion of results”. Not using the
high-frequencies would probably eliminate the oscillations of the state variables also, as
they are shown in Figure 8.4 on page 85.
In any case, the implementation of such a function would have to be able to adapt to
changes in heading and speed. The one presented in this thesis is only run once before
the filter set-up; it also had the whole time series available for spectral analysis. In a real
life scenario, such a function would need to find its input in the last minutes of sensor
recordings, and in certain intervals re-apply the useful frequency range. This in turn means
updating all Kálmán filter matrices during run-time; this can be done only when the last
states and uncertainties are saved with their corresponding frequency, and then inserted
as initial guesses at the corresponding spots in x̂− 0 and P0 for the frequency range.

11.2. Short-crested waves

Speaking of real-life implementations, one fact should not be forgotten: there is no such
thing as long-crested waves on the oceans; it is just valid as an assumption under certain
conditions, or used in towing tanks and other experimental facilities. In open waters, there
are too many influential factors like wind, changing water depths, currents and shore lines
for a wave to remain long-crested. In the end, the waves spread and travel in multiple

111
11 Outlook Master thesis: Sea State Estimation in the Time Domain

directions, which makes them short-crested1 . In fact, the spectral density of such a sea state
cannot be represented in 2D anymore; it is now a function of ω and µ, best represented
in a 3D polar plot.
It is deemed useful for follow-up studies to present the major necessary changes to the
Kálmán filter2 . Under the assumption that the aim is to add a second wave direction, the
number of entries in x̂ needs to be doubled, when the same frequencies shall be used.
Since for each relative heading ωe differs, this vector will also double in size. With x̂ the
matrices F and I scale as well (they now have four times as many entries!). The output
matrix for the surface elevation should now produce an estimate for each direction, a
vector like ~ζ = Oζ x̂. Because the first half of x̂ applies only to the first heading, and the
second half to the second heading, the matrices have to be padded with zeros:
" # " #
Oζ µ1 ~0 OS µ 1 ~0
Oζ µ = and OS µ = 11.1
~0 Oζ µ2 ~0 OS µ2

As can be seen, the same also applies to the output matrix for the spectral estimate, with
the difference that the result of OS x̂ will still be a vector, but with double as many entires
(like x̂). For Oz the method is different, because the output of Oz x̂ has to maintain its
size, because the number of sensors does not change. Hence:
h i
Oz µ = Oz µ1 Oz µ2 11.2

In that way, all headings contribute to the response of the vessel. As a second consequence,
it should be noted that one cannot simply run the same unaltered code twice for two
headings — they would not coincide in influencing the response estimation.
Since z keeps its size R does as well, it even keeps its content. Q depends on the size
of x̂ and has to be scaled. K transforms from measurement to state and will thus keep
its number of columns, but double in the number of rows. P grows in both dimensions.
Both matrices do not need manual modification, as they come naturally when the other
matrices and the initial estimates are formatted correctly.

11.3. Software optimization


As the number of headings considered in parallel grows, so does matrix size, and thus
computational operations per time step does also. This might hamper the real-time pro-
cessing of sensor recordings on an off-the shelf computer like the ones used for this thesis.
Most of the above matrices are sparsely populated, a lot of entries are zero. In addition

1
Please see Figure 2.2 on page 11 for an illustration.
2
Please note: The changes to the filter mentioned here have not been tested. They only represent an opinion how the aim could be
achieved.

112 Michaela & Tobias Höfler // July 26, 2017


Software optimization 11.3

to that, a lot of multiplication, transposition and even inversion takes place at every time
step. Thus, finding ways to handle these operations more efficiently could be a great benefit.

The operation with multiple matrices at once may be accelerated using the graphics pro-
cessing unit (GPU) instead of the CPU. In the case of the latter, e.g. an element-wise mul-
tiplication of matrices is executed step by step, whereas the former can use pre-compiled
operations on each element, which accelerates computation [24]. In Matlab, any matrix
may be moved to the GPU with the command gpuArray, and operations performed with
arrayfun.

In addition to that, the storage of large sparse matrices can consume a lot of memory.
The Matlab command sparse is able to store sparsely populated matrices in a very
compressed way, by saving only row and column index together with the actual value,
omitting all zero entries.


113
114
IV
Appendix
116
A
Sensor data sheet

On the following pages, the data sheets corresponding to the chosen exemplary motion
sensor Ekinox-A, by SBG Systems [37], can be found. The manufacturer holds all
copyrights.

117
Ekinox Test Results

MARINE
TEST
ENVIRONMENT

Ekinox Series

PRODUCT
Ekinox-A
ON TEST Motion Sensor

TEST CONDITIONS
TESTED PRODUCTS The test session simulated a
Ekinox-A Motion Sensor complete 6 degrees of freedom (DOF).
The hexapod reproduced various sea
TESTED PERFORMANCE
conditions while providing accurate
Heave, Roll, and Pitch
reference data. A wide range of heave
PLACE frequencies and amplitudes have
Brest (France) at the IFREMER been initiated as well as periods in
Institute the range of 5 to 12 s.
MOUNTING ON THE
The test included eight sessions of
CONDITIONS HEXAPOD
Sea conditions simulated on a five minutes tests and an additional
Hexapod fifteen minutes test to check longer All tested sensors were mecha-
operation periods. nically strapped on the Hexapod
platform which provides accurate
6 degrees of freedom.

FULL REPORT : Send an email to Special thanks to IFREMER Institute Precision alignment ensured a
contact@sbg-systems.com to receive the and Mr. Pierre Merriaux (IRSEEM and 0.1° alignment accuracy on roll
complete version of this test. ESIGELEC) who conducted this perfor- and pitch angles.
mance test.
TEST RESULTS

Overall Results
ACCURACY ROLL, PITCH HEAVE
A 0.03° RMS accuracy is obtained in The 5 cm or 5% specification is also
Roll Pitch Heave
roll/pitch angles. This performance reached with a comfortable margin,
RMS 0.028 0.032 2.3 level gives a good confidence in with less than 2 cm RMS error. Auto-
Error
reaching the specified 0.05° accuracy matic heave period computation
RMS errors above represent the mean under more challenging environments ensures that the Ekinox heave filter is
error obtained during the whole such as rough sea state or vibrating always correctly tuned.
fifteen minutes test session. environments.

Detailed Results
The Hexapod accuracy is much higher than the Ekinox-A. HEAVE
It has been used as a reference for this test. 0.25

0.2

Hexapod Ekinox-A 0.15

0.1

0.05

PITCH
Heave (m)

-0.05
V1.0 – September – All rights reserved © 2013 SBG Systems
-0.1

-0.15

-0.2

-0.25

100 200 300 400 500 600 700 800 900


time (s)

Heave Performance can be further improved with GPS


ROLL Aiding. The whole test was performed in “Vertical Gyro” mode,
where only a vertical reference is used to stabilize the attitude. In
case of harsh environments, a GPS aiding can be used to improve
orientation and heave accuracy, even during long term turns or
accelerations, and high amplitude swell conditions.

SBG Systems EMEA (Headquarters) SBG Systems North America


Phone: +33 1 80 88 45 00 Phone: +1 (773) 754 3272
www.sbg-systems.com E-mail: contact@sbg-systems.com  E-mail: contact.usa@sbg-systems.com
120
Relevant Matlab code
B
In this chapter of the appendix, the most important .m-files of the script collection for this
thesis can be found. The directory tree presented below gives an overview of the structure
of this bundle. Files appended to this report are indicated by a reference to their starting
page. Please excuse the fact that not all files can be listed; apart from the sheer length,
there are also functions taken from the Internet for which the respective authors hold
the copyright — e.g. a program for the export of Matlab figures to the .tikz format.
These are located in the folder “Third-party scripts”. The folder “Plot” contains a variety
of outsourced scripts for plotting the outcome of the filter procedure; as they are of very
marginal interest, they have been omitted as well.

Thesis Matlab Bundle


Global Scripts
ClosedFormTFs.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . cf. page 134
FuzzyFreqs.m
Plot, contains out-sourced plotting commands
SaveFigures.m
SetFavoriteDefaults.m
Spectrum Mapping
EncSpec2WaveSpec.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . cf. page 148
WaveSpec2EncSpec.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . cf. page 145
TableLineGenerator.m
Third-party scripts, for e.g. figure export to the .tikz format
Time Series Ex- and Import
TimeSeriesExport.m
TimeSeriesImport.m
Kalman Filter
Matrices.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . cf. page 132
SeaStateKalmanFilter.m, Filter Main File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . cf. page 122
TrustTest.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . cf. page 143
Output
Time Series Generation
Time Series - 1250.00 sec - Hs 4.00 m - Tz 10.00 s - U 20.00 kts - Head 0.00 deg.series
TimeSeriesGenerator.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . cf. page 139

121
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

B.1. Filter main file

Listing B.1 The below file is the main file of the filtering procedure devised in this thesis. From this script, all
other files are called except the time series generation script. However, it should be noted that plotting and saving
commands at the end of the main file have been omitted here, as they do not provide added value to the report.

% Main File
clear all; close all; clc;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Define what the output format is. The actual output will be stored
5 % in the folder " Output ", one level up.
Export . CommandLine2File = false;
Export . Figures2File = false;
Export . Save2tikz = false;% Only used when Figures2File = true!
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
10 % Adding additional scripts in sub−folders .
% " genpath " adds all sub−folders to the search path!
addpath ( genpath ('../ Global Scripts '));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Get the name of the folder containing the main file. It will
15 % double as the identifier for output files .
Export . ScriptFolder = strsplit ( mfilename ('fullpath '),filesep );
Export . ScriptFolder = Export . ScriptFolder {end−1};
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
[Export ,Colors ,Figures , Taskseparator ] = ...
20 SetFavoriteDefaults (Export , Export . ScriptFolder ,'Landscape ');
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
fprintf ([ 'Welcome to\ nKALMAN FILTERING OF VESSEL MOTIONS FOR SPECTRUM
ESTIMATION \n\ nThis script collection is part of the Master
Thesis \n"Sea State Estimation in the Time Domain "\ nby Michaela and
Tobias Hoefler in 2017.\ n\n']);
fprintf ([ 'You are running the latest version (2017−07−15)\n']);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
25 % Start the timers
Timer.Clock.Start = tic;
Timer.CPU.Start = cputime ;

% /////////////////////////////////////////////////////////////////////////
30 % PRE−PROCESSING & SIGNAL GENERATION
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Taskseparator ('TEST CASE SET−UP');
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% For which heading and speed shall the calculation be performed ?
35 Speed = 20;% [ knots ]
Heading = 0;% [ degree ]
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

122 Michaela & Tobias Höfler // July 26, 2017


Filter main file B.1

% Which wave frequencies do you assume the wave to have?


Omega = 0.005:0.005:1.5; % [rad/s]
40 nOmega = numel (Omega);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Create a vector for the frequency of encounter , based on the
% wave frequencies . This vector might be unsorted , depending
% on if 1−to−3 mapping occurs .
45 OmegaE = abs(Omega − (Omega .^2) /9.81∗ Speed ∗1852/3600∗ cosd( Heading ));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Please determine which signals and the corresponding transfer functions
% shall be used in the analysis .
Signals = {'Heave ','Pitch ','Roll '};% 'Heave ','Pitch ','Roll '
50 nSignals = numel ( Signals );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Please specify the standard deviations of the sensor noise .
% This will be used to set up the measurement noise covariance matrix R.
%−−−−−−−−−−−−−−−−−−−−−−−−
55 % SBG Systems − Ekinox A
SensorNoiseSTD .Heave = 23 ∗(1/1000) ;% [mm] to [m]
SensorNoiseSTD .Roll = 0.028 ∗( pi /180);% [deg] to [rad]
SensorNoiseSTD .Pitch = 0.032 ∗( pi /180);% [deg] to [rad]
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
60 % Please specify which process STD you would like to control the process
% noise covariance matrix Q.
% Some useful rules regarding the magnitude of the matrices
% Q > R : Dynamic filter , reacts fast , not very smooth
% Q < R : Smooth filter , takes longer to adapt to changes
65 % Q = R : Trade−off between the above
% In general , a very large R means that the sensors are totally
% unreliable , a large Q means and unreliable mathematical model .
ProcessNoiseSTD = 1e−3;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
70 % Please specify which confidence intervals (CI) you would like to see.
% Type the number of your choice !
% 1 : 68.0% likelihood that the observations are covered by this interval
% 2 : 95.0% −"−
% 3 : 99.7% −"−
75 CI. Factor = 2;
%−−−−−−−−−−−
% The next step is used only to provide text for e.g. the plot legends .
% It is not crucial to the function of the overall procedure .
switch CI. Factor %
80 case 1; CI. Percentage = 68.0;
case 2; CI. Percentage = 95.0;
case 3; CI. Percentage = 99.7;
end%
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
85

123
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

% Display the above settings in the command line interface .


fprintf ([ horzcat (...
sprintf ('%−20s','VESSEL STATUS ') ,...
sprintf ('%20s','Speed : ') ,...
90 sprintf ('%5.1f',Speed),' [kts ]\n' ,...
sprintf ('%40s','Rel. Heading : ') ,...
sprintf ('%5.1f',Heading ),' [deg ]\n' ,...
'\n' ,...
sprintf ('%−20s','SENSOR NOISE STDs ') ,...
95 sprintf ('%20s','Heave : ') ,...
sprintf ('%6.3f',SensorNoiseSTD .Heave ∗1000) ,' [mm]\n' ,...
sprintf ('%40s','Roll : ') ,...
sprintf ('%6.3f',SensorNoiseSTD .Roll /( pi /180)),' [deg ]\n' ,...
sprintf ('%40s','Pitch : ') ,...
100 sprintf ('%6.3f',SensorNoiseSTD .Pitch /( pi /180)),' [deg ]\n' ,...
sprintf ('%40s','Used sensors : ') ,...
sprintf ('%s, ',Signals {:}) ,'\b\b\n' ,...
'\n' ,...
sprintf ('%−20s','FILTER AND OUTPUT ') ,...
105 sprintf ('%20s','Model Noise STD : ') ,...
sprintf ('%8.3f',ProcessNoiseSTD ),'\n' ,...
sprintf ('%40s','Confidence Interval : ') ,...
sprintf ('%8.3f',CI. Percentage ),' [%%]\ n'...
)]);
110

% /////////////////////////////////////////////////////////////////////////
%% TIME SERIES SET−UP
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Taskseparator ('TIME SERIES SELECTION ');
115 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Import a time series file. The first empty argument is a file path , the
% second one the file name; just for the case that the file is known
% beforehand . If left blank , the function will create a dialog box.
[ TimeSeries .T ,...
120 TimeSeries .X ,...
TimeSeries .Legend ,...
TimeSeries . Description ,...
TimeSeries . Header ] = TimeSeriesImport ('../ Time Series Generation ' ,[]);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
125 % Get the time stamps from the time series .
Data.Time = TimeSeries .T';
nTimeSteps = numel (Data.Time);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Display the important properties of the time series .
130 %−−−−−−−−−−
fprintf ([ horzcat (...
sprintf ('%−20s','SERIES PROPERTIES ') ,...
sprintf ('%20s','Start time : ') ,...

124 Michaela & Tobias Höfler // July 26, 2017


Filter main file B.1

sprintf ('%−s',duration (0,0, Data.Time (1))),' [hrs:min:sec ]\n' ,...


135 sprintf ('%40s','End time : ') ,...
sprintf ('%−s',duration (0,0, Data.Time(end))),' [hrs:min:sec ]\n' ,...
sprintf ('%40s','Duration : ') ,...
sprintf ('%−s',duration (0,0, Data.Time(end)−Data.Time (1))),'
[hrs:min:sec ]\n' ,...
'\n' ,...
140 sprintf ('%40s','Number of samples : ') ,...
sprintf ('%−8.0f (%−.0f steps )',nTimeSteps ,nTimeSteps −1),'\n' ,...
sprintf ('%40s','Sampling time : ') ,...
sprintf ('%8.4f',diff(Data.Time (1:2))),' [sec ]\n', ...
sprintf ('%40s','Sampling freq. : ') ,...
145 sprintf ('%8.4f' ,1/ diff(Data.Time (1:2))),' [Hz ]\n\n' ...
)]);%
%−−−−−−−−−−
for i = 1: numel ( TimeSeries . Legend );
%−−−−−−−−−−
150 if i==1;
fprintf ( sprintf ('%40s','Imported signals : '));
else;
fprintf ( sprintf ('%40s',' '));
end;
155 %−−−−−−−−−−
fprintf ( sprintf ('%−s\n',TimeSeries . Legend {i}));
%−−−−−−−−−−
end; clearvars i;
%−−−−−−−−−−
160 for i = 1: size( TimeSeries .Header ,1);
%−−−−−−−−−−
if i==1;
fprintf ([ horzcat (...
sprintf ('%−20s','\ nADDITIONAL INFO ') ,...
165 sprintf ('%19s : ',TimeSeries . Header {i ,1}) ...
)]);
else;
fprintf ( sprintf ('%37s : ',TimeSeries . Header {i ,1}));
end;
170 %−−−−−−−−−−
fprintf ( sprintf ('%+.10 e %−s\n' ,...
TimeSeries . Header {i ,3} ,...
TimeSeries . Header {i ,2} ...
));
175 %−−−−−−−−−−
end; clearvars i;
%−−−−−−−−−−
if ~ isempty ( TimeSeries . Description )%
%−−−−−−−−−−
180 fprintf ( sprintf ('%s','\ nDESCRIPTION \n'));

125
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

%−−−−−−−−−−
TimeSeries . DescriptionWrapped = ...
linewrap ( TimeSeries . Description , Export . CLIwidth );
%−−−−−−−−−−
185 for i = 1: numel ( TimeSeries . DescriptionWrapped );
disp ([ sprintf ('%s',TimeSeries . DescriptionWrapped {i})]);
end; clearvars i;
end;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
190 % Save the content below the title in the first row of the data section ;
it will be stored with its title in the structured array "Data ".
for i = 1: numel ( TimeSeries . Legend );
Data .( TimeSeries . Legend {i}) = TimeSeries .X(:,i);
end;
clearvars i TimeSeries .T TimeSeries .X;
195 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Create a sea spectrum for reasons of comparison . It will not be used in
% the filter .
%−−−−−−−−−−
GenericSeaState .Hs = 4;
200 GenericSeaState .Tz = 10;
%−−−−−−−−−−
GenericSeaState .w = Omega;
GenericSeaState .S = ...
( GenericSeaState .Hs ^2/(4∗ pi)∗((2∗ pi)/ GenericSeaState .Tz)^4) ...
205 ./( Omega .^5) ...
.∗ exp(−(1/pi ∗((2∗ pi)/ GenericSeaState .Tz)^4) ./( Omega .^4));
%−−−−−−−−−−
GenericSeaState .m0 = trapz (Omega , GenericSeaState .S);

210 % /////////////////////////////////////////////////////////////////////////
%% REMAINING PRE−PROCESSING
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Taskseparator ('MATRIX INITIALIZATION ');
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
215 [x,F,Q,R,P,I] = Matrices (nOmega ,Signals , SensorNoiseSTD , ProcessNoiseSTD );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
fprintf ([ horzcat (...
sprintf ('%40s','Matrices : ') ,...
sprintf ('%−8s ','Check !'),'\n' ,...
220 sprintf ('%40s','Initial estimates : ') ,...
sprintf ('%−8s ','Check !'),'\n' ...
)]);%
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Taskseparator ('TF FETCHING ');
225 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
[TF] = ClosedFormTFs (Omega ,Speed , Heading );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

126 Michaela & Tobias Höfler // July 26, 2017


Filter main file B.1

fprintf ([ horzcat (...


sprintf ('%40s','Complex−valued transfer functions : ') ,...
230 sprintf ('%−8s ','Check !'),'\n' ...
)]);%

% /////////////////////////////////////////////////////////////////////////
%% FILTERING
235 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Taskseparator ('FILTERING ');
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Set up the initial values for the text progress bar.
Progress . ReverseString = '';
240 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Shut off the logging to a text file. It will be turned on again after
% the filtering . Else , all progress texts would be logged as well.
diary off;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
245 % Create an empty matrix for the sensor readings . The filter will take the
% latest sensor reading from it , as time progresses .
Measurement = [];
for s = 1: numel ( Signals ); Measurement = [ Measurement , Data .( Signals {s})];
end; clearvars s;
250 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Start the actual filtering process .
for j = 1: nTimeSteps ;

% ================================================================
255 % ENTER PRIOR ESTIMATE & COVARIANCE ; SET RUNTIME LOOP VARIABLES
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Get the current time stamp "t", set up an empty mapping matrix
% "Oz" (from state to response ), as well as an empty mapping
% vector " Ozeta " ( state to surface ).
260 t = Data.Time(j);
Oz = [];
Ozeta = [];
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% For all signals , grab the corresponding TF and go through
265 % all frequencies to ...
for s = 1: numel ( Signals ); CurrentTF = TF.( Signals {s});
for i = 1: nOmega ;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Populate the " state vector to measurement " matrix Oz.
270 Oz(s ,2∗i−1:2∗i) = [...
real( CurrentTF (i))∗cos( OmegaE (i)∗t) ...
− imag( CurrentTF (i))∗sin( OmegaE (i)∗t) , ...
−(real( CurrentTF (i))∗sin( OmegaE (i)∗t) ...
+ imag( CurrentTF (i))∗cos( OmegaE (i)∗t)) ...
275 ];

127
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Set up an operator to transform the state variables
% to a surface elevation estimation . This does not depend
% on the signal being processed at the moment , thus it is
280 % sufficient to execute the command only at the first one.
if s==1;
Ozeta = [Ozeta , cos(Omega(i)∗t), sin(Omega(i)∗t)];
end;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
285 % When the loop is finished , fetch the sensor recordings
% for this time step.
end; CurrentMeasurement = Measurement (j ,:) ';
end;
clearvars i s CurrentTF ;
290

% ================================================================
% COMPUTE THE FILTER GAIN
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
K = P∗Oz '∗( Oz∗P∗Oz '+ R)^(−1);
295

% ================================================================
% UPDATE THE ESTIMATE WITH A NEW MEASUREMENT
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Update the estimate with the latest measurement
300 x = x + K∗( CurrentMeasurement−Oz∗x);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Calculate the root mean square error (RMSE) of the
% state vector covariance matrix P.
Data.RMSE(j) = sqrt( trace (P));
305

% ================================================================
% COMPUTE ERROR COVARIANCE FOR UPDATED ESTIMATE
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% The optimal form , which only applies if the Kalman gain is
310 % calculated in the following way: K = P∗Oz '∗( Oz∗P∗Oz '+ R)^(−1)
% It is not as stable as the form below , but faster ; this can
% sometimes lead to un−symmetry in the P matrix . Be careful !
%P = (I − K∗Oz)∗P;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
315 % The so called " Joseph form", which applies in general ; it is
% more robust , but also takes much more computational steps ,
% and is thus slower .
P = (I − K∗Oz)∗P∗(I − K∗Oz)' + K∗R∗K';

320

128 Michaela & Tobias Höfler // July 26, 2017


Filter main file B.1

% ================================================================
325 % EXTRACT ALL DATA THAT YOU NEED FROM THE CURRENT STATE
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Save the updated state vector .
Data.X(:,j) = x;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
330 % Save the updated standard deviations of P's main diagonal .
Data.STD (:,j) = sqrt(diag(P));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Obtain a surface elevation estimate from the current state .
Data.Surf(j) = Ozeta∗x;
335 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Calculate the upper and lower confidence interval boundaries
% for the state variables .
%−−−−−−−−−−
Data. X_CIup (:,j) = Data.X(:,j) + CI. Factor ∗Data.STD (:,j);
340 Data. X_CIlo (:,j) = Data.X(:,j) − CI. Factor ∗Data.STD (:,j);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Obtain a surface elevation estimate from the current state .
Data.Surf(j) = Ozeta∗Data.X(:,j);
Data. Surf_STD (j) = sqrt(Ozeta∗P∗Ozeta ');
345 Data. Surf_CIup (j) = Data.Surf(j) + CI. Factor ∗Data. Surf_STD (:,j);
Data. Surf_CIlo (j) = Data.Surf(j) − CI. Factor ∗Data. Surf_STD (:,j);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Get a sea spectrum for the current state . This requires looping
% through all included frequencies , since the spectrum is in the
350 % frequency domain (the state vector bridges the gap from time to
% freq. domain , since for every time step there is a new state
% vector , which contains elements as a function of omega ).
for i = 1: nOmega ;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
355 % The " strip width " deltaOmega depends on the
% neighboring two frequencies , which do not all
% exist at the margins .
deltaOmega = 0.5∗( Omega(min(nOmega ,i+1)) ...
−Omega(max (1,i−1)) );
360 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Data.Spec(i,j) = 0.5∗(x(2∗i−1)^2+x(2∗i)^2)/ deltaOmega ;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Calculate the standard deviation for the spectral
% estimate , at the current frequency .
365 Data. SpecSTD (i,j) = sqrt (...
(1/ deltaOmega ^2) ∗...
( x(2∗i−1)^2∗P(2∗i−1,2∗i−1)...
+ x(2∗i)^2∗P(2∗i ,2∗i) ...
+ 2∗x(2∗i−1)∗x(2∗i)∗P(2∗i−1,2∗i) ...
370 ) ...
);

129
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Wrap the confidence interval around it.
%−−−−−−−−−−
375 Data. Spec_CIup (i,j) = Data.Spec(i,j)...
+ CI. Factor ∗Data. SpecSTD (i,j);
%−−−−−−−−−−
Data. Spec_CIlo (i,j) = Data.Spec(i,j) ...
− CI. Factor ∗ Data. SpecSTD (i,j);
380 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
end;
clearvars i deltaOmega ;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Since the lower CI boundary of the spectrum can be negative
385 % here , but never in practice : Set all negative entries to zero!
Data. Spec_CIlo (find(Data. Spec_CIlo (:,j) <0),j) = 0;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Calculate the area beneath the spectrum curve , so that the
% energies can be plotted over time. There is no sense in
390 % plotting all spectra in one figure ...
m0_Spectrum (j) = trapz (Omega ,Data.Spec (:,j));

% ================================================================
% PROJECT AHEAD
395 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Predict the next covariance matrix .
P = F∗P∗F' + Q;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Save important parameters of the prediction .
400 % These can be compared to the next measurement .
Data. SignalPrediction (:,j) = Oz∗Data.X(:,j);
Data. SignalPrediction_STD (:,j) = sqrt(diag(Oz∗P∗Oz '));
%−−−−−
Data. SignalPrediction_CIup (:,j) = Data. SignalPrediction (:,j) ...
405 +CI. Factor ∗Data. SignalPrediction_STD (:,j);
%−−−−−
Data. SignalPrediction_CIlo (:,j) = Data. SignalPrediction (:,j) ...
−CI. Factor ∗Data. SignalPrediction_STD (:,j);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
410 % Predict the next state .
x = F∗x;

% ================================================================
%% PRINT PROGRESS
415 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Progress . CurrentMessage = sprintf (...
'%39s %3.1f perc.' ,...
'Time series processed :' ,...
100∗j/ nTimeSteps );

130 Michaela & Tobias Höfler // July 26, 2017


Filter main file B.1

420 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
fprintf ([ Progress . ReverseString , Progress . CurrentMessage ]);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Progress . ReverseString = repmat (...
sprintf ('\b') ,1, length ( Progress . CurrentMessage ) );
425 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

end;
clearvars j t Ozeta Progress ;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
430 disp ([ ' ']);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
if Export . CommandLine2File ; diary ( Export . Filenames .Text); end;

% /////////////////////////////////////////////////////////////////////////
435 %% CHECKING OF THE TRUSTWORTHINESS OF THE STATE VECTOR
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Taskseparator ('CHECKING TRUST OF STATE VARIABLES ');
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
[ TimeSeries .T ,~ ,~] = TrustTest (Data);
440

% /////////////////////////////////////////////////////////////////////////
%% EVALUATE THE SIMULATION TIME
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Taskseparator ('ADDITIONAL INFORMATION ');
445 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Evaluate the elapsed time.
Timer.Clock. Elapsed = toc(Timer.Clock.Start);
Timer.CPU. Elapsed = cputime−Timer.CPU.Start;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
450 fprintf ([...
sprintf ('%−20s','ELAPSED TIME ') ,...
sprintf ('%20s','Wall : ') ,...
sprintf ('%−s',duration (0,0, Timer.Clock. Elapsed )),' [hrs:min:sec ]\n' ,...
sprintf ('%40s','CPU : ') ,...
455 sprintf ('%−s',duration (0,0, Timer.CPU. Elapsed )),' [hrs:min:sec ]\n' ...
]); clearvars Timer;

% /////////////////////////////////////////////////////////////////////////
%% PLOTTING & SAVING
460 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% [...]

%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% EOF

131
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

B.2. Matrix initialisation

Listing B.2 This file is called by the main file to set up the matrices and initial estimates for the filter. In the
current status, it could have been included in the main file; on the other hand, the modular set-up allows eays
configuration for future versions, e.g. automatic reconfiguration of the matrices during run-time.

function [x,F,Q,R,P,I] = ...


Matrices (nOmega ,Signals , SensorNoiseSTD , ProcessNoiseSTD );

% /////////////////////////////////////////////////////////////////////////
5 %% PREREQUISITES
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Count the number of signals that shall be included .
nSignals = numel ( Signals );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
10 % For every signal , add its noise standard deviation to the vector that
% will be later transformed into the matrix R.
for i=1: nSignals ;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
SensorVariance (i) = ( SensorNoiseSTD .( Signals {i})).^2;
15 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
end; clearvars i;

% /////////////////////////////////////////////////////////////////////////
%% MATRIX SETUP
20 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% For every frequency , the state vector has two components .
% All of them are set to zero in the very beginning .
x = zeros ( nOmega ∗2 ,1);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
25 % The state transition matrix F is equal to the identity matrix , because
% it is assumed that the two state variables x1 and x2 do not change
% between consecutive time steps . They are not directly time dependent .
F = eye( numel (x));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
30 % The measurement noise covariance matrix R depicts how accurate the
% sensors are. Each element on the diagonal corresponds to the
% respective sensor 's variance , which equals the squared
% root−mean−square error RMSE ^2.
R = diag( SensorVariance );
35 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% The process noise covariance matrix Q is set to the process noise
% variance (STD ^2) on the initial main diagonal ; it is assumed that
% the state variables do not influence each other , thus off−diagonal
% terms are zero!
40 Q = eye( numel (x)).∗ ProcessNoiseSTD ^2;

132 Michaela & Tobias Höfler // July 26, 2017


Matrix initialisation B.2

%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Some useful rules regarding the magnitude of the matrices
% Q > R : Dynamic filter , reacts fast , not very smooth
% Q < R : Smooth filter , takes longer to adapt to changes
45 % Q = R : Trade−off between the above
% In general , a very large R means that the sensors are totally
% unreliable , a large Q means and unreliable mathematical model .
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% The state variable (" error ") covariance matrix P.
50 P = 1e3∗eye( numel (x));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% The identity matrix . It will be used e.g. for computation of the error
% covariance matrix for the updated estimate .
I = eye( numel (x));
55 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% EOF

133
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

B.3. Closed-form transfer functions

Listing B.3 The implementation of the closed-form transfer functions below is called from the main file of the
filter, as well as from the time series generation script. The theory has already been presented in section 2.4, “Transfer
functions”. A remarkable fact is that it takes ω ~ as input, transforms it to ω
~ e on which the calulated magnitudes and
phases are based. Thus, the output is sorted according to ω ~ and not to ω~ e!

function [TF] = ClosedFormTFs (Omega ,Speed , Heading );

% /////////////////////////////////////////////////////////////////////////
%% PREREQUISITES
5 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Convert the vessels velocity from knots to m/s.
Speed = Speed ∗ 1852/3600; % [m/s]
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Constant .Rho = 1.025; % [t/m^3] Water density
10 Constant .g = 9.81; % [m/s^2] Gravitational constant
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Ship.L = 349;% [m] Ship length
Ship.B = 42.8; % [m] Ship breadth
Ship.T = 14.5; % [m] Ship draft
15 Ship.KG = 19;% [m] Chosen ; transv . distance from keel to CoG
Ship.KM = 20.056; % [m] Transverse distance from keel to metacentrum
Ship.GM = Ship.KM − Ship.KG;% [m] Transv . dist. from CoG to metacentrum
Ship.CWP = 0.82; % [−] Water plane coefficient
Ship.CB = 0.673; % [−] Block coefficient
20 Ship. Displacement = 143226.64; % [t] Ship displacement
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Calculation of the natural Roll period [s], cf. IMO A .685(17)
% for vessels with L >= 45m
C = 0.373 + 0.023∗ Ship.B/Ship.T − 0.043∗ Ship.L/100;
25 Ship.TN = (2∗C∗Ship.B)/( sqrt(Ship.GM));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Fn = Speed/sqrt( Constant .g∗Ship.L);% [−] Froude number

% /////////////////////////////////////////////////////////////////////////
30 %% GENERATION OF THE TRANSFER FUNCTIONS
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
for i = 1: length (Omega);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Calculate the wave number corresponding
35 % to the current frequency .
k = (Omega(i)^2)/ Constant .g;

134 Michaela & Tobias Höfler // July 26, 2017


Closed-form transfer functions B.3

40 % ////////////////////////////////////////////////////////////////
% HEAVE & PITCH
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Should the heading be exactly 90°, the effective wave number
% will be zero; this leads to singularities in the code.
45 % Hence , the effective wave number will be set to a very small
% number instead .
if Heading ==90; ke = 10^(−3);
else ke = abs(k∗cosd( Heading ));
end;
50 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Calculate the frequency of encounter . Mind the absolute value !
OmegaE = abs(Omega(i) − k∗Speed∗cosd( Heading ));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
TF. OmegaE (i) = OmegaE ;
55 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Sectional damping approximation .
A = 2∗ sin( OmegaE ^2∗ Ship.B/(2∗ Constant .g)) ...
∗exp( OmegaE ^2∗ Ship.T/ Constant .g);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
60 % Approximation of the Smith correction factor .
kappa = exp(−k∗Ship.T);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% The following variable is the factor between omega and omega_e .
alpha = 1 − Fn∗sqrt(k∗Ship.L)∗cosd( Heading );
65 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
f = sqrt((1−k∗Ship.T)^2 + (A^2/(k∗Ship.B∗alpha ^3))^2);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Forcing function for heave .
F = kappa∗f∗2/( ke∗Ship.L)∗sin(ke∗Ship.L/2);
70 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Forcing function for pitch .
G = kappa∗f ∗24/(( ke∗Ship.L)^2∗ Ship.L)∗( sin(ke∗Ship.L/2) ...
− ke∗Ship.L/2 ∗cos(ke∗Ship.L/2));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
75 eta = sqrt( (1−2∗k∗Ship.T∗alpha ^2 )^2 ...
+ (A^2/(k∗Ship.B∗alpha ^2))^2 )^(−1);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Set up the actual FRF magnitude , the phase follows later .
HeaveFRF (i) = eta∗F;
80 PitchFRF (i) = eta∗G;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Calculate the phase shifts from wave to force .
HeavePhase_force (i) = acos((1−k∗Ship.T)/f);
PitchPhase_force (i) = HeavePhase_force (i) + pi /2;
85 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

135
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

% Calculate the phase shifts from force to motion .


HeavePhase_w (i) = acos((1−2∗k∗Ship.T∗alpha ^2)∗eta);
90 PitchPhase_w (i) = HeavePhase_w (i) + pi /2;

% ////////////////////////////////////////////////////////////////
% ROLL
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
95 % The following factor has been chosen . It describes the fraction
% of the vessels length behind the end of the bow.
delta = 0.7;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Restoring moment coefficient .
100 C44 = Constant .g∗Ship. Displacement ∗Ship.GM;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Ratio of the beam breadth .
gamma = (Ship.CWP − delta)/(1 − delta);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
105 % From the above ratio and the vessel 's breadth , the breadth of
% the box which is assumed to replace the bow can be calculated .
B0 = Ship.B;
B1 = gamma∗B0;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
110 % In the same way , the cross−sectional areas can be obtained .
A0 = (Ship.CB∗B0∗Ship.T)/( delta + gamma∗ (1−delta));
A1 = gamma∗A0;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% The variables a, b and d are actually functions which account
115 % for the fitting that was done to achieve the expression for the
% hydrodynamic restoring coefficient . The index 0 stands for the
% mid−ship section , the 1 for the assumed box−shaped bow.
%−−−−−−−−−−
a0 = 0.256∗ B0/Ship.T − 0.286;
120 a1 = 0.256∗ B1/Ship.T − 0.286;
%−−−−−−−−−−
b0 = −0.11∗ B0/Ship.T − 2.55;
b1 = −0.11∗ B1/Ship.T − 2.55;
%−−−−−−−−−−
125 d0 = 0.033∗ B0/Ship.T − 1.419;
d1 = 0.033∗ B1/Ship.T − 1.419;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Hydrodynamic restoring coefficient at mid−ship and bow.
b440 = sqrt ((2∗ Constant .g)/B0) ...
130 ∗ Constant .Rho∗A0∗B0 ^2∗ a0 ...
∗exp(b0∗ OmegaE^(−1.3))∗ OmegaE ^d0;
%−−−−−−−−−−
b441 = sqrt ((2∗ Constant .g)/B1) ...
∗ Constant .Rho∗A1∗B1 ^2∗ a1 ...
135 ∗exp(b1∗ OmegaE^(−1.3))∗ OmegaE ^d1;

136 Michaela & Tobias Höfler // July 26, 2017


Closed-form transfer functions B.3

%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Ratio of the sectional damping .
kappaRoll = sqrt(b441/b440);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
140 % The total hydrodynamic restoring coefficient .
B44 = Ship.L∗b440 ∗( delta+ kappaRoll^2∗(1−delta));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% The amplitude of the rolling moment .
M = abs(sind( Heading )) ...
145 ∗sqrt (( Constant .Rho∗ Constant .g^2) /( Omega(i))) ...
∗(2/ ke)∗sqrt(b440) ...
∗( sin (0.5∗ delta∗Ship.L∗ke)^2 ...
+ kappaRoll ^2∗ sin(0.5∗(1−delta)∗Ship.L∗ke)^2 ...
+ 2∗ kappaRoll ∗sin (0.5∗ delta∗Ship.L∗ke) ...
150 ∗sin(0.5∗(1−delta)∗Ship.L∗ke)∗cos (0.5∗ Ship.L∗ke) ...
) ^(1/2) ;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Roll FRF magnitude .
RollFRF (i) = M/(...
155 (−OmegaE ^2∗( Ship.TN /(2∗ pi))^2 +1) ^2 ...
∗C44 ^2+ OmegaE ^2∗ B44 ^2 ...
) ^(1/2) ;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% For headings of exactly 90° the code is troublesome .
160 % Thus , the heading is changed a fraction , so that this can
% be worked around .
if Heading ==90;
Heading = 90.00001;
end;
165 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
E = sqrt(b440)∗(...
sin(delta∗k∗Ship.L∗cosd( Heading ))...
+ 2∗ kappaRoll ∗cos (0.5∗(1+ delta)∗k∗Ship.L∗cosd( Heading ))...
∗sin(0.5∗(1−delta)∗k∗Ship.L∗cosd( Heading )));
170 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
H = sqrt(b440)∗(...
(cos(delta∗k∗Ship.L∗cosd( Heading ))−1)...
+ 2∗ kappaRoll ∗sin (0.5∗(1+ delta)∗k∗Ship.L∗cosd( Heading ))...
∗sin (0.5∗( delta−1)∗k∗Ship.L∗cosd( Heading )));
175 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% MPhase = sqrt(E^2+H^2);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Roll phase between wave and moment .
RollPhase_moment (i) = atan2 (...
180 H∗cos (0.5∗k∗Ship.L∗cosd( Heading ))...
+ E∗sin (0.5∗k∗Ship.L∗cosd( Heading )) ,...
E∗cos (0.5∗k∗Ship.L∗cosd( Heading ))...
− H∗sin (0.5∗k∗Ship.L∗cosd( Heading )));

137
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
185 % Phase shift between moment and motion .
RollPhase_phi (i) = atan2 (...
−(OmegaE ∗B44) ,...
((−OmegaE ^2∗( Ship.TN /(2∗ pi))^2+1)∗C44));
end;
190

% /////////////////////////////////////////////////////////////////////////
%% POST−PROCESSING
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Sum up the phase shifts from wave to force and force to motion .
195 HeavePhase_total = HeavePhase_w + HeavePhase_force ;
PitchPhase_total = PitchPhase_w + PitchPhase_force ;
RollPhase_total = RollPhase_phi + RollPhase_moment ;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% " Unwrap " all phase angles above 360 deg.
200 HeavePhase_total = mod( HeavePhase_total ,2∗ pi);
PitchPhase_total = mod( PitchPhase_total ,2∗ pi);
RollPhase_total = mod( RollPhase_total ,2∗ pi);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Making the TFs complex valued .
205 HeaveTF = abs( HeaveFRF ).∗( cos( HeavePhase_total )+1i∗sin( HeavePhase_total ));
PitchTF = abs( PitchFRF ).∗( cos( PitchPhase_total )+1i∗sin( PitchPhase_total ));
RollTF = abs( RollFRF ).∗( cos( RollPhase_total )+1i∗sin( RollPhase_total ));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Set all "not a number " values to zero.
210 HeaveTF (find( isnan ( HeaveTF ))) = 0;
PitchTF (find( isnan ( PitchTF ))) = 0;
RollTF (find( isnan ( RollTF ))) = 0;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Save the complex valued transfer functions in a structured array .
215 TF.Heave = HeaveTF ;
TF.Pitch = PitchTF ;
TF.Roll = RollTF ;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% EOF

138 Michaela & Tobias Höfler // July 26, 2017


Time series generator B.4

B.4. Time series generator

Listing B.4 With this script, the time series for the filter are created. At first, a Bretschneider spectrum is created
on the basis of the specified ω
~ , whereafter it is mapped to the encounter domain — this yields a sorted vector ω ~ e.
In the next step, the corresponding transfer functions are calculated, based on ω~ , and then re-arranged to match the
sorted ω
~ e . From the encounter domain spectrum and the transfer functions response spectra are created, from which
the actual time series are formed. The noise magnitude for each signal is determined by the root-mean-square error
from the sensor data sheet. In this file as well, the plotting part has been omitted due to only little relevance.

clc; close all; clear all


% /////////////////////////////////////////////////////////////////////////
% PREREQUISITES
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
5 % Adding additional scripts in sub−folders .
% " genpath " adds all sub−folders to the search path!
addpath ( genpath ('../ Global Scripts '));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% How many transfer functions and which shall be included ?
10 Signals = {'Heave ','Pitch ','Roll '};% 'Heave ','Pitch ','Roll '
nSignals = numel ( Signals );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Please specify the significant wave height Hs and the zero−crossing
% period Tz for the assumed sea state .
15 Hs = 4;% [m]
Tz = 10;% [s]
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% For which heading and speed shall the calculation be performed ?
Speed = 20;% [ knots ]
20 Heading = 0;% [ degree ]
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Please describe the sea state in text form.
Description = ['This line of text describes the sea state !'];
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
25 % Add a header with additional information to the time series file.
%−−−−−
% If you wish to omit this , leave it blank .
% Header = {};
%−−−−−
30 % Else , add information in format below .
Header = {...
'Hs ','[m]',Hs ;...
'Tz ','[sec]',Tz ;...
'Speed ','[kts]',Speed ;...
35 'Heading ','[deg]',Heading ...
};
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

139
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

% Please define the range of frequencies in the signal here. They may
% differ from the ones that the filter uses. In reality , you would not
40 % know ( beforehand ) exactly which frequencies the signal includes either .
Omega = 0.005:0.005:1.5;
% Omega (1) = 1e−4;
nOmega = numel (Omega);
% Attention : You should not include 0 as a frequency !
45 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Please set up a time span , including the step length , that you
% wish to obtain a time series in.
Data.Time= 0:0.1:1250; % [s]
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
50 % Check if the specified angular frequencies are observable in the
% chosen time series length .
OmegaMin = 2∗ pi/( Data.Time(end)−Data.Time (1));
%−−−−−−−−−−−−−−−−−−−−−−−−
if ~ isempty (find(Omega < OmegaMin ))
55 warning ( horzcat ('Attention please ! You have chosen frequencies
that cannot complete a full cycle within the specified time series
length . The minimum " observable " frequency is ',sprintf ('%e rad/s.
',OmegaMin ),'The following frequencies are " unobservable ":
',sprintf ('%e ',Omega(find(Omega < OmegaMin ))),'rad/s.'));
end
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Please specify the standard deviations of the sensor noise .
% This will be used to set up the measurement noise covariance matrix R.
60 %−−−−−−−−−−−−−−−−−−−−−−−−
% SBG Systems − Ekinox A
SensorNoiseSTD .Heave = 23 ∗(1/1000) ;% [mm] to [m]
SensorNoiseSTD .Roll = 0.028 ∗( pi /180);% [deg] to [rad]
SensorNoiseSTD .Pitch = 0.032 ∗( pi /180);% [deg] to [rad]
65

% /////////////////////////////////////////////////////////////////////////
% RESPONSE SPECTRUM GENERATION
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% The Bretschneider /ISSC sea spectrum expression .
70 SeaSpectrum = (Hs ^2/(4∗ pi)∗((2∗ pi)/Tz)^4) ./( Omega .^5) ...
.∗ exp(−(1/pi ∗((2∗ pi)/Tz)^4) ./( Omega .^4));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Mapping from Wave spectrum to Encounter spectrum .
[S_e ,w_e ,m_0] = WaveSpec2EncSpec ( SeaSpectrum ,Omega ,Speed , Heading );
75 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Fetch the transfer functions from another script .
[TF] = ClosedFormTFs (Omega ,Speed , Heading );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Sort the TFs to an order that matches the sorted vector "w_e"
80 % that the script " WaveSpec2EncSpec " puts out.
%−−−−−−−−−−−

140 Michaela & Tobias Höfler // July 26, 2017


Time series generator B.4

[TF.OmegaE ,I] = sort(TF. OmegaE );


%−−−−−−−−−−−
TF.Heave = TF.Heave(I);
85 TF.Roll = TF.Roll(I);
TF.Pitch = TF.Pitch(I);
%−−−−−−−−−−−
clearvars I;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
90 % Calculate the response spectra , based on the corresponding
% transfer functions . The phase shifts remain unchanged !
for s = 1: nSignals ;
ResponseSpectrum .( Signals {s}) = S_e .∗ abs(TF.( Signals {s})).^2;
Data .( horzcat ('Real ',Signals {s})) = zeros (size(Data.Time));
95 end;

% /////////////////////////////////////////////////////////////////////////
% TIME SERIES GENERATION
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
100 % Shuffle the random number generator seeds
rng('shuffle ');
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Generate a vector with random phase shift between all frequency
% components . This should not be a problem , since the spectrum does not
105 % contain information of how the frequency components are shifted
% against each other . The only important thing is that the phase shift
% between the motion time series is correct !
delta = rand (1, nOmega );
delta = delta ./ max(delta);
110 delta = delta .∗(2∗ pi);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% For all wave frequencies , get the corresponding response amplitude and
% add up the time series .
for s = 1: nSignals ;
115 for i = 1: nOmega ;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% In the case of the first and last wave frequency , they do not
% have neighbors on both sides ; thus , the interval deltaOmega
% is reduced to only one side.
120 deltaOmega = 0.5∗( w_e(min(i+1, nOmega )) − w_e(max(i−1,1)) );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
MotionTF = TF.( Signals {s});
MotionSpectrum = ResponseSpectrum .( Signals {s});
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
125 % The phase shift can be taken directly from the TF , the
% amplitude is calculated from the spectral density :
% S = 0.5∗A^2/ deltaOmega
Phase = angle ( MotionTF (i));
Amplitude = sqrt (2∗ MotionSpectrum (i)∗ deltaOmega );

141
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

130 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Add the current time series to the already existing ones ,
% so that in the end only one series per motion exists .
Data .( horzcat ('Real ',Signals {s})) = ...
Data .( horzcat ('Real ',Signals {s})) + ...
135 Amplitude .∗ cos(w_e(i).∗ Data.Time+ Phase + delta(i));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Add standard normal distributed random noise to the signal .
Data .( Signals {s}) = ...
Data .( horzcat ('Real ',Signals {s})) + ...
140 normrnd (0, SensorNoiseSTD .( Signals {s}),size(Data.Time));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
end;
end;

145 % /////////////////////////////////////////////////////////////////////////
%% PLOTTING
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% [...]

150 % /////////////////////////////////////////////////////////////////////////
%% EXPORTING
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
X = [];
Legend = {};
155 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Fname = horzcat (...
'Time Series ' ,...
sprintf (' − %.2f sec ',Data.Time(end)−Data.Time (1)) ,...
sprintf (' − Hs %.2f m',Hs) ,...
160 sprintf (' − Tz %.2f s',Tz) ,...
sprintf (' − U %.2f kts ',Speed) ,...
sprintf (' − Head %.2f deg ',Heading ), ...
'. series ' ...
);
165 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
for s = 1: nSignals ;
X = [X, Data .( Signals {s}) ', Data .( horzcat ('Real ',Signals {s})) '];
Legend {end +1} = Signals {s};
Legend {end +1} = horzcat ('Real ',Signals {s});
170 end;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
TimeSeriesExport (Data.Time ',X,Legend , Description ,Header ,[], Fname);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% EOF

142 Michaela & Tobias Höfler // July 26, 2017


Frequency trust evaluator B.5

B.5. Frequency trust evaluator

Listing B.5 The code below is utilized to identify frequencies for which the state variables converged successfully.
The devised procedure is explained in section 8.2, “Avoiding sea spectrum singularities”, starting on page 83. Basically,
it is evaluated if the uncertainty around each state is below 2% of its overall max, and if it is below 150% of the
average uncertainty across all states.

function [TrustIndex ,...


Criterion_ReducedMax ,...
Criterion_Similarity ] = TrustTest (Data);

5 % /////////////////////////////////////////////////////////////////////////
%% PREREQUISITES
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Create an empty vector in which the indices of " trustworthy " frequencies
% will be stored .
10 TrustIndex = [];
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Obtain the average of the latest " uncertainty ", here represented by the
% square root of the main diagonal of P, alias the standard deviation
% (STD) of each state variable . This will be used to check which states
15 % deviate from their neighbors very much.
Average = sum(Data.STD (:, end))/ numel (Data.STD (:, end));

% /////////////////////////////////////////////////////////////////////////
%% EVALUATION
20 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% For all entries of the STD vector at the latest time step , do ...
for i = 1: numel (Data.STD (:, end));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Set both criteria to " false ". In the following lines they
25 % receive the opportunity to be set to "true ".
Criterion_ReducedMax (i) = 0;
Criterion_Similarity (i) = 0;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Check whether the last time step magnitude of this state 's STD
30 % has reduced to 2% of its all−time maximum .
if Data.STD(i,end)/max(Data.STD(i ,:)) < 0.02;
Criterion_ReducedMax (i) = 1;
end;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
35 % Now check if the current state 's STD does not exceed 150% of
% the average between all states ; tested at the latest time step.
if Data.STD(i,end) < 1.5∗ Average ;
Criterion_Similarity (i) = 1;
end;

143
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

40 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Now check if both criteria are passed . "mod(i ,2) == 0" toggles
% the check only for even indices , which correspond to the second
% state of each couple .
if mod(i ,2) == 0 && ...
45 Criterion_ReducedMax (i) == 1 && ...
Criterion_Similarity (i) == 1;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% If the "even" state has passed , check the "odd" one as
% well. Only then , the frequency may be considered
50 % trustworthy .
if Criterion_ReducedMax (i−1) == 1 && ...
Criterion_Similarity (i−1) == 1;
TrustIndex = [TrustIndex ,i/2];
end;
55 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
end;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
end;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
60 % EOF

144 Michaela & Tobias Höfler // July 26, 2017


Wave to encounter domain mapper B.6

B.6. Wave to encounter domain mapper

Listing B.6 This function transforms a wave spectrum to an encounter domain spectrum, in the way that was
presented in subsection 2.5.1, “Applied wave to encounter domain mapping”, from page 33 onwards.

function [S_e ,w_e ,m_0] = ...


WaveSpec2EncSpec ( SpectralDensity ,Omega ,Speed , Heading );
% INPUT
% SpectralDensity : Wave spectrum spectral density
5 % Omega ..........: Wave spectrum frequencies
% Speed ..........: Vessel speed in knots
% H ..............: Relative heading in degree
%
% OUTPUT
10 % S_e : Spectral density of the encounter frequency domain spectrum
% w_e : Encounter frequencies
% m_0 : Area of the spectrum

% /////////////////////////////////////////////////////////////////////////
15 % PREREQUISITES
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Set up the gravitational acceleration .
g = 9.81; % [m/s^2]
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
20 U_kts = Speed;% [kts]
U_mps = U_kts ∗(1852/3600) ;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
H = Heading ;% [deg]
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
25 % Create the row vector for the wave frequencies .
w(:) = Omega;% [rad/s]
% Attention : You should not include 0 as a frequency !
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Nw = numel (w);
30 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
S(:) = SpectralDensity ;

% /////////////////////////////////////////////////////////////////////////
% PREPARATION OF TRANSFORMATION
35 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Set up the factor "facA ".
facA = U_mps/g∗cosd(H);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Prevent "NaN "/" Inf" by making facA non−zero.
40 if facA == 0; facA = 1e−10; end%
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

145
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

% Map all w onto their corresponding w_e.


w_e = abs( w − (w.^2) .∗ facA );
% Attention : The absolute value is used due to the fact that in
45 % following sea w_e can become negative . But the spectrum
% does not take the direction into account ,
% just energy content .
Nw_e = numel (w_e);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
50 % Sort the encounter frequencies in ascending order .
w_e = sort(w_e);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Map w_e back to w, in order to find out which w is missing .
MapMatrix = [...
55 w ' ,...
w_e ' ,...
1/(2∗ facA).∗(1−sqrt(1−4.∗facA .∗ w_e)) ',...% Low−Segm.
1/(2∗ facA).∗(1+ sqrt(1−4.∗facA .∗ w_e)) ',...% Mid−Segm.
1/(2∗ facA).∗(1+ sqrt (1+4.∗ facA .∗ w_e))' ...% High−Segm.
60 ];
clearvars facA;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Set all complex results to a custom marker .
% There will be no phase shift .
65 MapMatrix (find(imag( MapMatrix )~=0)) = −1;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Set all negative results to a custom marker .
% The waves will not start to move backwards !
MapMatrix (find(MapMatrix <0)) = −1;
70 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Extract and sort all mapped wave frequencies .
w_interp = MapMatrix (: ,3: end);
w_interp = w_interp (w_interp >0);% This makes the matrix a vector !
w_interp = sortrows ( w_interp );
75 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Since now all w_e and w are known , the given wave spectrum can be
% interpolated , so that the spectral densities can be obtained at the
% newly gained w.
S_interp = interp1 (w,S, w_interp );
80 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Set all "NaN" to zero. This can happen if a frequency is lower than
% the lowest value in the initial w range .
S_interp ( isnan ( S_interp )) = 0;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
85

146 Michaela & Tobias Höfler // July 26, 2017


Wave to encounter domain mapper B.6

90 % Calculate the corresponding areas above each strip of the


% interpolated spectrum .
for i=1: numel ( w_interp );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
dw = 0.5∗( w_interp (min( numel ( w_interp ),i+1)) ...
95 − w_interp (max (1,i−1)) );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
A_interp (i) = S_interp (i)∗dw;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
end;
100 clearvars i dw;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Add up the corresponding areas to the encounter domain spectrum .
for i=1: numel (w_e)%
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
105 % Fetch the current set of mapped frequencies .
EncFreq = w_e(i);
WaveFreqs = MapMatrix (i ,3: end);
WaveFreqs = WaveFreqs (WaveFreqs >0);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
110 % Find the locations of the current wave frequencies in the.
% interpolated vector
[~, FreqsIdx ] = ismember (WaveFreqs , w_interp );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Sum up all areas of the spectrum that map onto the current w_e.
115 A_e(i) = sum( A_interp ( FreqsIdx ));
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
dw_e = 0.5∗( w_e(min(Nw_e ,i+1)) ...
− w_e(max (1,i−1)) );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
120 S_e(i) = A_e(i)/dw_e;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
end;
clearvars i EncFreq WaveFreqs FreqsIdx dw_e A_e;

125 % /////////////////////////////////////////////////////////////////////////
% POSTPROCESSING
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Calculate the area/ energy in the whole spectrum .
m_0 = trapz (w_e ,S_e);
130 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% EOF

147
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

B.7. Encounter to wave domain mapper

Listing B.7 This piece of code transforms back from an encounter domain spectrum to the wave domain. Attention:
The mapping is not unique! This has been described in detail in subsection 2.5.2, “Applied encounter to wave domain
mapping”, from page 34 onwards.

function [S,w,m_0] = ...


EncSpec2WaveSpec ( SpectralDensity ,OmegaE ,Speed ,Heading ,Hs ,Tz);
% INPUT
% SpectralDensity : Encounter spectrum spectral density
5 % OmegaE .........: Encounter spectrum frequencies
% Speed ..........: Vessel speed in knots
% H ..............: Relative heading in degree
% As a basis for the spectrum split ratio :
% Hs .............: Estimated Hs for the ISSC spectrum
10 % Tz .............: Estimated Tz for the ISSC spectrum
%
% OUTPUT
% S ..: Spectral density of the wave frequency domain spectrum
% w ..: Wave frequencies
15 % m_0 : Area of the spectrum

% /////////////////////////////////////////////////////////////////////////
% PREREQUISITES
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
20 % Set up the gravitational acceleration .
g = 9.81; % [m/s^2]
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
U_kts = Speed;% [kts]
U_mps = U_kts ∗(1852/3600) ;
25 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
H = Heading ;% [deg]
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Create the row vector for the encounter frequencies .
w_e = OmegaE (:);% [rad/s]
30 % Attention : You should not include 0 as a frequency !
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Nw_e = numel (w_e);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
S_e = SpectralDensity (:);
35

% /////////////////////////////////////////////////////////////////////////
% PREPARATION OF TRANSFORMATION
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Set up the factor "facA ".
40 facA = U_mps/g∗cosd(H);

148 Michaela & Tobias Höfler // July 26, 2017


Encounter to wave domain mapper B.7

%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Prevent "NaN "/" Inf" by making "facA" non−zero.
if facA == 0; facA = 1e−10; end%
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
45 % Set up a matrix that collects the projected wave frequencies , next
% to the encounter frequencies that were put in.
MapMatrix = [...
w_e ,...
1/(2∗ facA).∗(1−sqrt(1−4.∗facA .∗ w_e)) ,...% Low−Segm.
50 1/(2∗ facA).∗(1+ sqrt(1−4.∗facA .∗ w_e)) ,...% Mid−Segm.
1/(2∗ facA).∗(1+ sqrt (1+4.∗ facA .∗ w_e)) ...% High−Segm.
];
clearvars facA;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
55 % Set all complex results to a custom marker .
% There will be no phase shift .
MapMatrix (find(imag( MapMatrix )~=0)) = −1;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Set all negative results to a custom marker .
60 % The waves will not start to move backwards !
MapMatrix (find(MapMatrix <0)) = −1;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Set all enormous markers to the custom marker .
MapMatrix (find(MapMatrix >1e3)) = −1;
65 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Create a sea spectrum for the projected omegas .
Spectrum_ISSC = @(omega)...
(Hs ^2/(4∗ pi)∗((2∗ pi)/Tz)^4) ./( omega .^5) ...
.∗ exp(−(1/pi ∗((2∗ pi)/Tz)^4) ./( omega .^4));
70

% /////////////////////////////////////////////////////////////////////////
% TRANSFORMATION
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
AreaMap = [];
75 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
for i = 1: Nw_e;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Calculate dw_e for the current encounter frequency .
dw_e = 0.5∗( w_e(min(Nw_e ,i+1)) ...
80 − w_e(max (1,i−1)) );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Calculate the area/ energy at the current encounter frequency .
A_e = S_e(i)∗dw_e;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
85 % Fetch all mapped wave frequencies for this encounter frequency .
w_mapped = MapMatrix (i ,2: end);
w_mapped = w_mapped (w_mapped >0);
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

149
B Relevant Matlab code Master thesis: Sea State Estimation in the Time Domain

A_denom = sum( Spectrum_ISSC ( w_mapped ));


90 % Attention : Might be zero , depending on the input frequencies !
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
for j = 1: numel ( w_mapped );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
A_nom = A_e∗ Spectrum_ISSC ( w_mapped (j));
95 % Attention : Might be zero as well!
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
A = A_nom/ A_denom ;
% Since the above can be zero , this can be "NaN "!
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
100 % Remove any "NaN"s. At these positions , the area
% would be zero anyway .
if isnan (A); A = 0; end%
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Save the current area next to its wave frequency . The
105 % resulting matrix may have more rows than the encounter
% frequencies have entries , due to " multijectivity ".
AreaMap = [...
AreaMap ;...
w_mapped (j) ,...
110 A ];
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
end;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
end;
115 %−−−−−−−−−−−−−−−−−−−−−−−−
clearvars i j w_mapped dw_e A_e A_nom A_denom ;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Sort the frequency−area−matrix by the frequency column .
AreaMap = sortrows (AreaMap ,1);
120 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Split up the above matrix , for convenience .
w = AreaMap (: ,1); Nw = numel (w);
Areas = AreaMap (: ,2);
%−−−−−−−−−−−−−−−−−−−−−−−−
125 clearvars AreaMap ;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
for i = 1:Nw;
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Calculate the strip width dw.
130 dw = 0.5∗( w(min(Nw ,i+1)) ...
− w(max (1,i−1)) );
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Obtain the spectral density at the current frequency .
S(i) = Areas(i)/dw;
135 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
end;

150 Michaela & Tobias Höfler // July 26, 2017


Encounter to wave domain mapper B.7

%−−−−−−−−−−−−−−−−−−−−−−−−
clearvars i Nw Areas;

140 % /////////////////////////////////////////////////////////////////////////
% POSTPROCESSING
%−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% Calculate the area/ energy in the whole spectrum .
m_0 = trapz (w,S);
145 %−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
% EOF

151
152
V
Backmatter
154
List of Tables

1.1. Main dimensions of CMA CGM Rigoletto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.1. Wave statistics for the Atlantic Ocean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

5.1. Sensor root-mean square errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

10.1. Comparison of spectral moments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

155
156
List of Figures

1.1. Wave buoy coverage example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4


1.2. Global drifter buoy location map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3. Global vessel location snapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4. Photo of the example vessel CMA CGM Rigoletto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.1. Depiction of the sea surface and the relevant metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10


2.2. Illustration of long- and short-crested ocean waves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3. Bretschneider spectrum example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.4. Global wave statistic zone map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.5. Exemplary process from sea spectrum, over FRF, to time series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.6. Ship-fixed coordinate system declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.7. Encounter frequency speed dependence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.8. Definition of the relative heading angle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.9. Forward speed mapping illustration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.10. Forward speed frequency mapping curve examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.11. Exemplary spectrum mapping between wave and encounter domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.12. Encounter to wave domain mapping singularity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

3.1. The filter loop in general . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38


3.2. The Kálmán filter loop in a detailed flow chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

4.1. PDF and CDF of the Gaussian distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53


4.2. Wave elevation estimate with confidence intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.3. Sea spectrum estimate with confidence intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

6.1. Signal vs. estimate — Single frequency filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66


6.2. Signal vs. estimate — Multiple frequency filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.3. Root-mean-square error — Multiple frequency filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

7.1. Comparison of RMSE with different noise covariances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71


7.2. One of the worst spectrum estimates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
7.3. Identification of useful frequencies for all motions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
7.4. Automatic frequency and trust distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.5. Spectrum estimate based on automatic frequency detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

8.1. Sea spectrum estimate comparison for different frequency sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80


8.2. 0th -order spectral moment comparison for different frequency sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
8.3. Sea spectrum estimate with singularities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
8.4. Exemplary excerpt of state vector time series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

9.1. Time series generation overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88


9.2. Kálmán filter input and output overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

10.1. Presentation of results for estimated sea spectra at various headings and speed . . . . . . . . . . . . . . . . . . 98
10.2. Presentation of results for the spectral moment m0 at various headings and speed . . . . . . . . . . . . . . . 99

157
List of Figures Master thesis: Sea State Estimation in the Time Domain

10.3. Presentation of results for post-processed estimated sea spectra at various headings and speed . . . . 101
10.4. Presentation of results for the root-mean-square error at various headings and speed . . . . . . . . . . . . 103
10.5. Presentation of spectra and root-mean-square error for the long-term convergence test . . . . . . . . . . 105
10.6. Presentation of the first minute of motion prediction for the long-term convergence test . . . . . . . . . 107
10.7. Schematic of wave reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

158 Michaela & Tobias Höfler // July 26, 2017


Nomenclature
Shortforms

DoF . . . . . . . . . . . . . . . . Degree of Freedom

DT U . . . . . . . . . . . . . . . Technical University of Denmark, Danmarks Tekniske Universitet

F FT . . . . . . . . . . . . . . . . Fast Fourier Transform

K TH . . . . . . . . . . . . . . . Royal Institute of Technology, Kungliga Tekniska högskolan

P SD . . . . . . . . . . . . . . . Power spectral density

AI S . . . . . . . . . . . . . . . . Automatic identification system

C DF . . . . . . . . . . . . . . . Cumulative distribution function

C I . . . . . . . . . . . . . . . . . Confidence interval

C P U . . . . . . . . . . . . . . . Central processing unit

F R F . . . . . . . . . . . . . . . . Frequency Response Function

GP U . . . . . . . . . . . . . . . Graphics processing unit

I T TC . . . . . . . . . . . . . . International Towing Tank Conference

P DF . . . . . . . . . . . . . . . Probability density function

RAO . . . . . . . . . . . . . . . Response Amplitude Operator

RI AS . . . . . . . . . . . . . . Research Instiute for Advanced Studies

RM SE . . . . . . . . . . . . . . Root mean square error

T ULC S . . . . . . . . . . . . Tools for ultra large container ships

Formula symbols

α . . . . . . . . . . . . . . . . . . Closed-form expression parameter, which e.g. transforms ω to ωe . [−]

β . . . . . . . . . . . . . . . . . . Closed-form expression parameter, as part of the forcing functions. In the original paper
called f [21]. [−]

δr . . . . . . . . . . . . . . . . . . Closed-form expression length splitting parameter, which is applied to the ship length to
generate a vessel roll model. [−]

∆s . . . . . . . . . . . . . . . . . Displacement of the vessel. [t]

ϕ . . . . . . . . . . . . . . . . . . Phase shift of the closed-form transfer function between the exciting moment and the
vessel motion for the roll case. [rad]

f . . . . . . . . . . . . . . . . . . Phase shift of the closed-form transfer functions between the wave and the exciting
force/moment for the heave and pitch case. [rad]

159
List of Figures Master thesis: Sea State Estimation in the Time Domain

m . . . . . . . . . . . . . . . . . Phase shift of the closed-form transfer function between the wave and the exciting mo-
ment for the roll case. [rad]

w . . . . . . . . . . . . . . . . . Phase shift of the closed-form transfer functions between the exciting force/moment and
the vessel motion for the heave and pitch case. [rad]

 . . . . . . . . . . . . . . . . . . . A phase shift between wave components, or the wave and the vessel motion. [rad]

η . . . . . . . . . . . . . . . . . . . Response of the vessel, at a particular frequency, from a particular wave direction. It is


the current value of the oscillation, at time t. [m or °]

Γ1 . . . . . . . . . . . . . . . . . Closed-form expression parameter, used to calculate the roll phase shift. In the original
paper called E [25]. [−]

Γ2 . . . . . . . . . . . . . . . . . Closed-form expression parameter, used to calculate the roll phase shift. In the original
paper called H [25]. [−]

γr . . . . . . . . . . . . . . . . . . Closed-form expression breadth ratio, for the vessel roll model. [−]

γ . . . . . . . . . . . . . . . . . . Spectrum peak intensifying factor, especially used in the JONSWAP sea spectrum. [−]

κ . . . . . . . . . . . . . . . . . . Approximation for the Smith correction factor for the closed-form transfer functions. [−]

λ . . . . . . . . . . . . . . . . . . The length of one wave, measured between crests, troughs, or zero-upcrossings. [m]

A . . . . . . . . . . . . . . . . . . The added mass matrix of the equation of motion for a vessel in waves. It includes the
hydrodynamic added mass. [entry dependent]

B . . . . . . . . . . . . . . . . . . The damping matrix of the equation of motion for a vessel in waves. [entry dependent]

C . . . . . . . . . . . . . . . . . . The hydrostatic coefficient matrix of the equation of motion for a vessel in waves. [entry dependent]

Fex . . . . . . . . . . . . . . . . . The excitation force/moment vector describes the external forces and moments that act
upon the system and excite it. [entry dependent]

F . . . . . . . . . . . . . . . . . . . State transition matrix F, which describes how the state vector x changes when time
increases, e.g. from time step k to k + 1. [entry dependent]

G . . . . . . . . . . . . . . . . . . Control input model matrix G, which describes how the state vector x changes between
time steps, due to control inputs. [entry dependent]

I . . . . . . . . . . . . . . . . . . . The identity matrix. It is composed of only zeros, except for the ones on the main
diagonal. [−]

I . . . . . . . . . . . . . . . . . . . The inertia matrix of the equation of motion for a vessel in waves. It includes the vessels
mass and inertia terms. [entry dependent]

K . . . . . . . . . . . . . . . . . . Filter gain, or blending factor. It describes how much of the difference between real and
estimated measurement should be added to x̂− k to obtain x̂k . [entry dependent]

Oi . . . . . . . . . . . . . . . . . The output matrix maps from the state space to the desired output. It can e.g. map the state
variables to a sea surface representation, to a spectral estimation, or to the measurement
domain. [entry dependent]

P . . . . . . . . . . . . . . . . . . The contents of this matrix are the covariances of the errors between all combinations of
state variables. [entry dependent]

Q . . . . . . . . . . . . . . . . . . The model/process noise covariance matrix describes how large the trust of the system is
into every state variable. It has the same magnitude as P. [entry dependent]

160 Michaela & Tobias Höfler // July 26, 2017


List of Figures

R . . . . . . . . . . . . . . . . . . The sensor/measurement noise covariance matrix indicates how accurate the readings
are. It can be assumed to be fixed, since the used measuring equipment has a cer-
tain in-built root-mean-square error, that is commonly specified in the sensor data-
sheet. [entry dependent]

u . . . . . . . . . . . . . . . . . . Control input vector u = [u1 , . . . , un ]. [entry dependent]

v . . . . . . . . . . . . . . . . . . . This vector contains the white sensor noise. It is part of the conducted sensor reading;
its magnitude at each time step is not known explicitly. It is used to describe the physical
model behind the measurement. [−]

w . . . . . . . . . . . . . . . . . . This vector contains the process noise. It is only relevant for derivation of projection
formulas of the filter, but nevertheless it is relevant. Basically, it represents the noise in
the mathematical model with which the real state is approximated. [−]

x . . . . . . . . . . . . . . . . . . . State vector x = [x1 , . . . , xn ], which describes the state of the system. [entry dependent]

z . . . . . . . . . . . . . . . . . . . It contains the measurements from the sensors that are used to update the estimated state
vector. [entry dependent]

µ . . . . . . . . . . . . . . . . . . The relative heading between the incoming wave and the heading of the vessel. It starts
at 0° for waves in the same direction as the vessel (following sea), and 180° for waves
approaching the vessel against its direction of travel (head sea); it is counted clockwise,
as seen from the bird’s eye perspective. [°]

ωe . . . . . . . . . . . . . . . . . The encounter frequency is the angular frequency at which a vessel “feels” the waves
coming, although they have the true wave frequency ω for an external observer. Without
forward speed, ωe = ω . rad
 
s

ω . . . . . . . . . . . . . . . . . . The angular frequency with which the wave (component) oscillates. rad
 
s

GM . . . . . . . . . . . . . . . . Metacentric height. It represents the distance between the center of gravity and the
metacenter. The latter is the intersection point of the line of action of the buoyancy force
and the centerline of the vessel. [m]

FH . . . . . . . . . . . . . . . . . . Forcing function for the heave case closed-form transfer function. In the original paper
called F [21]. [−]

FP . . . . . . . . . . . . . . . . . . Forcing function for the pitch case closed-form transfer function. In the original paper
called G [21]. [−]

Fn . . . . . . . . . . . . . . . . . The Froude number is a dimensionless representative of how large the inertia forces of
the vessel are compared to the gravitational ones. [−]

FRFH . . . . . . . . . . . . . . . Frequency response function for heave. It represents with which heave amplitude the
ship reacts to a unit wave of a specific frequency. m
 
m

FRFP . . . . . . . . . . . . . . . Frequency response function for pitch. It represents with which pitch amplitude the ship
reacts to a unit wave of a specific frequency. rad
 
m

FRFR . . . . . . . . . . . . . . . Frequency response function for roll. It represents with which roll amplitude the ship
reacts to a unit wave of a specific frequency. rad
 
m
m
TFH . . . . . . . . . . . . . . . . Complex-valued transfer function for heave. m

TFP . . . . . . . . . . . . . . . . Complex-valued transfer function for pitch. rad


 
m
 rad 
TFR . . . . . . . . . . . . . . . . Complex-valued transfer function for roll. m

161
List of Figures Master thesis: Sea State Estimation in the Time Domain

φ . . . . . . . . . . . . . . . . . . Closed-form expression parameter, which transforms the forcing functions to the corre-
sponding transfer function. In the original paper called η [21]. [−]
t t
ρ . . . . . . . . . . . . . . . . . . . Water density. Common assumptions are ρ = 1.025 m3
for salty sea water, and ρ = 1 m3
h i
for fresh water. mkg3

σ 2 . . . . . . . . . . . . . . . . . Variance of a process. It is related to the standard deviation σ . [variable]

σ . . . . . . . . . . . . . . . . . . Standard deviation of a process. It is related to the variance σ 2 . [variable]

η̃ . . . . . . . . . . . . . . . . . . . Response amplitude of the vessel, at a particular frequency, from a particular wave direc-
tion. It is the maximum value of the oscillation, not a function of time. [m or °]

κ̃ . . . . . . . . . . . . . . . . . . Sectional damping ratio for the closed-form roll transfer functions. [−]

ζ̃ . . . . . . . . . . . . . . . . . . . Wave amplitude, as measured vertically between calm water level and either crest or
trough of a wave. For irregular waves, it varies in time; for harmonic signals its magnitude
is fixed. [m]

M̃ . . . . . . . . . . . . . . . . . Closed-form expression parameter, comparable to rolling moment amplitude, but not


identical. [−]

ζ . . . . . . . . . . . . . . . . . . . Wave elevation, as deviating from the calm water level as a function of time. Positive
upwards. [m]

A . . . . . . . . . . . . . . . . . . Cross sectional area of the vessel. The magnitude of this variable depends on the observed
frame. m2
 

Bm . . . . . . . . . . . . . . . . Moulded breadth of the vessel. [m]

B . . . . . . . . . . . . . . . . . . An entry of the damping coefficient matrix, depending on the considered degree of free-
dom, of the equation of motion for a vessel in waves. [variable]

Cn . . . . . . . . . . . . . . . . . The coefficient used to calculate the natural roll period; it is based on the vessel’s main
dimensions. [−]

Cb . . . . . . . . . . . . . . . . . Block coefficient, as calculated by dividing the actual submerged volume by its bounding
box volume. [−]

Cwp . . . . . . . . . . . . . . . . Water plane area coefficient, as calculated by dividing the actual water plane area by its
bounding box area. [−]

C . . . . . . . . . . . . . . . . . . An entry of the hydrostatic coefficient matrix, depending on the considered degree of


freedom, of the equation of motion for a vessel in waves. [variable]

D . . . . . . . . . . . . . . . . . . Sectional damping approximation for the closed-form transfer functions. In the original
paper called A [21]. [−]

ei . . . . . . . . . . . . . . . . . . Error, in the form of a simple difference between two states. [variable]

fs . . . . . . . . . . . . . . . . . . Sampling frequency. fs = 1
Ts
[Hz]

f . . . . . . . . . . . . . . . . . . The spreading factor is an indicator of how large the maximum deviation in heading angle
is between the short-crested waves and their global heading. [−]
h i
g . . . . . . . . . . . . . . . . . . . Gravitational acceleration. sm2

Hs . . . . . . . . . . . . . . . . . The significant wave height, or in other words the average of the highest third of all
considered waves; thus, it is often symbolized by H̄1/3 . [m]

162 Michaela & Tobias Höfler // July 26, 2017


List of Figures

h . . . . . . . . . . . . . . . . . . The water depth, measured from the calm water level to the sea bed. [m]

ke . . . . . . . . . . . . . . . . . . The effective wave number describes, as the wave number, the number of radians per
unit distance, with which the wave propagates, but in this case for the encounter fre-
quency. m1
 

k . . . . . . . . . . . . . . . . . . . The wave number describes the number of radians per unit distance, with which the wave
propagates. m1
 

k . . . . . . . . . . . . . . . . . . . Time step subscript that represents the current time by use of multiples of the sampling
time: t = k · Ts . [−]

L . . . . . . . . . . . . . . . . . . Overall length of the vessel. [m]

m0 . . . . . . . . . . . . . . . . . 0th order spectral moment of the spectral density S(ω) . It is computed by integrating S
over ω ; hence, it represents the area/energy underneath the spectrum curve. m2
 

M . . . . . . . . . . . . . . . . . Closed-form expression rolling moment amplitude. [−]

N . . . . . . . . . . . . . . . . . . Symbol for an arbitrary number, often the upper index limit of sums. [−]

S . . . . . . . . . . . . . . . . . . Spectral ordinate/density of e.g. an energy spectrum of a sea state. In this thesis, it is


most
h ofteni used as a function of the encounter frequency ωe , or the true wave frequency
2
ω . mrads

Tn . . . . . . . . . . . . . . . . . The natural roll period of the vessel. [s]

Ts . . . . . . . . . . . . . . . . . Sampling time between two consecutive measurements, or time steps. [s]

Tz . . . . . . . . . . . . . . . . . Time span between two consecutive zero-crossings of the wave surface elevation, mea-
sured between roots with positive (upcrossing) or negative (downcrossing) slope. [s]

T . . . . . . . . . . . . . . . . . . Draft of the vessel. [m]

Vph . . . . . . . . . . . . . . . . . The phase velocity of the wave; it is the speed with which the crests at the sea surface
travel. ms
 

V . . . . . . . . . . . . . . . . . . The vessel velocity. ms


 

X . . . . . . . . . . . . . . . . . . The threshold value for a set of samples, e.g. the evaluation of statistical data. [variable]

x . . . . . . . . . . . . . . . . . . The state variable x is part of the state vector x = [x1 , . . . , xn ]. [set − updependent]

x . . . . . . . . . . . . . . . . . . The value of a sample in e.g. the evaluation of statistical data. [variable]

163
164
Index
A F
Added mass matrix A . . . . . . . . . . . . . . . . . . . . . . 23 FFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79–81
Filter gain K 43, 45, 46, 48–51, 55, 64, 66, 67, 118
B Following sea . . . . 30, 31, 33, 77, 78, 103–108, 110
Forcing function FH . . . . . . . . . . . . . . . . . . . . . 24, 25
Beam sea . . . . . . . . . . . . . . . . . . . . . . 31, 39, 103–106
Forcing function FP . . . . . . . . . . . . . . . . . . . . . 24, 25
Block coefficient . . . . . . . . . . . . . . . . . . . . . . . . . 8, 26
Forward speed . 4, 7, 31–33, 38, 39, 64, 65, 67, 71,
Bow sea . . . . . . . . . . . . . . . . . . . . . . . . . . 31, 104–107
77, 78, 93, 96, 104–106, 110
Breadth ratio γr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Frequency domain 7, 11, 14, 15, 18, 41, 79, 93, 112
Bretschneider spectrum 14–17, 19, 22, 38, 39, 75,
Frequency of encounter 25–29, 32–36, 38, 39, 67,
77, 78, 82, 87, 93, 103–108, 110, 111, 145
93–99, 106, 110, 112, 118
C Frequency Response Function (FRF) . . . . . 18–20,
23–26, 72, 79–83, 89–91, 94–96, 103, 115
Central processing unit (CPU) . . . . . . . . . 114, 119 Froude number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Closed-form expression parameter α . . . . . 25, 26
Closed-form expression parameter β . . . . . 24–26 G
Closed-form expression parameter Γ1 . . . . 28, 29
Graphics processing unit (GPU) . . . . . . . . . . . . 119
Closed-form expression parameter Γ2 . . . . 28, 29
Gravitational acceleration . . . . . 11, 15, 25, 27, 28,
Closed-form expression parameter M̃ . . . . 28, 29
32–34, 38, 39
Closed-form expression parameter φ . . . . . 24–26
CMA CGM Rigoletto . . . . . . . . . . . . . . . . . . 8, 71, 80 H
Confidence interval . . . 58–60, 62, 72, 90, 91, 104,
106, 107, 111, 113 Head sea . . . . . . . . . . . . . . . . . . . . . . . . . . 31, 103–107
Control input model matrix G . . . . . . . . . . . . . . 53 Heave . 4, 19, 20, 24, 26, 28, 51, 64, 66, 68, 71–76,
Control input vector u . . . . . . . . . . . . . . . . . . . . . . 53 80–83, 88, 99, 112, 113, 115
Covariance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44, 45 Heave frequency response function FRFH 19, 24,
Cross sectional area . . . . . . . . . . . . . . . . . . . . . 26, 27 72
Cumulative distribution function . . . . . . . . . 57, 58 Hydrostatic coefficient C . . . . . . . . . . . . . . . . 27–29
Hydrostatic coefficient matrix C . . . . . . . . . . . . . 23
D
I
Damping coefficient B . . . . . . . . . . . . . . . . . . 27–29
Damping matrix B . . . . . . . . . . . . . . . . . . . . . . . . . 23 I-Ship . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8, 9, 18, 71
Displacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8, 27 Identity matrix I 45, 46, 50, 51, 53, 55, 68, 69, 77,
118
E Inertia matrix I . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
ITTC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Effective wave number . . . . . . . . . . . . . . . 24, 25, 28
Encounter domain 30, 32–34, 37, 38, 62, 77, 93–97 J
Error e . . . . . . . . . . . . . . . . 43, 44, 46, 48, 54, 59, 60
Error covariance matrix P . . . . . 42, 44, 46, 48–55, JONSWAP spectrum . . . . . . . . . . . . . . . . . . . . . 15, 16
57–60, 64, 67–69, 72–74, 76, 77, 108, 109, K
114, 117, 118
Excitation force/moment vector Fex . . . . . . . . . 23 Kálmán filter . . . . . . . . . . 4, 6, 7, 11, 17, 18, 23, 24,
Expected value . . . . . 44–46, 53, 54, 57, 59, 60, 79 26, 30, 41, 42, 48, 51–53, 55, 58, 64, 65, 68,

165
Index Master thesis: Sea State Estimation in the Time Domain

69, 71, 72, 74, 77–79, 85–87, 89, 91, 93, 94, Response . . . . . . . . . . . . . . . . . . . . . 18–20, 71, 89, 95
96–98, 103, 109, 110, 112–114, 117, 118 Response amplitude . . . . . . . . . . 18, 71, 72, 95, 112
Kálmán-Bucy filter . . . . . . . . . . . . . . . . . . . . . . . . . 41 Response amplitude operator (RAO) . . . . . 18, 23
Response spectrum . . . . . . 18, 20, 94–96, 103, 112
L Response vector ~ η . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Length splitting parameter δr . . . . . . . . . . . . 26–29 Roll 4, 19, 20, 24, 26–28, 51, 64, 66, 68, 75, 76, 80,
Long-crested waves . . . . . . 12, 13, 65, 71, 113, 117 81, 88, 99, 112, 113, 115
Roll frequency response function FRFR . . . 19, 27
M Rolling moment amplitude M . . . . . . . . . . . 27–29
Root-mean-square error RMSE 51, 68, 73, 74, 76,
Matlab . . . . . . 22, 29, 58, 75, 80, 103, 114, 119, 127
77, 79, 82, 108, 110, 112
Matrix/Vector dimension m 22, 48, 49, 51, 53, 66,
68, 73, 76 S
Measurement output matrix Oz 43–46, 48–51, 55,
59, 64, 66–68, 71, 76, 96–98, 110, 112, 118 Sample value x . . . . . . . . . . . . . . . . . . . . . . . . . 57, 59
Measurement vector z . . 42–45, 48, 49, 53, 55, 59, Sampling frequency . . . . . . . . . . . . . . . . . 71, 73, 103
66, 118 Sampling time . . . . . . . . . . . . 12, 42, 43, 71, 73, 103
Metacentric height . . . . . . . . . . . . . . . . . . . . . . . 8, 27 Sea spectrum . . . . . . . . . . . . 4, 7, 15, 17–20, 33, 43,
55, 59, 62, 64, 77, 78, 82, 83, 85, 86, 89, 90,
N 93–97, 103, 105, 106, 109, 111
Natural roll period Tn . . . . . . . . . . . . . . . . . . . 27–29 Sea spectrum output matrix OS 43, 55, 64, 66, 76,
Natural roll period coefficient Cn . . . . . . . . . . . 27 118
Sea state . . . . . . . . 3, 4, 6, 7, 13–16, 18–20, 30, 115
P Sea surface output matrix Oζ . 43, 44, 55, 59, 64,
66, 76, 118
Phase shift . . . . . . . . . . . . . . . . 12, 14, 18, 65, 71, 87
Sectional damping approximation D . . . . . 24, 25
Phase shift ϕ . . . . . . . . . . . . . . . . . . . . . . . . . . 28, 29
Sectional damping ratio κ̃ . . . . . . . . . . . . . . . 27–29
Phase shift f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Sensor noise cov. matrix R 46–52, 55, 57, 64, 67,
Phase shift m . . . . . . . . . . . . . . . . . . . . . . . . . . 28, 29
68, 72–74, 76, 77, 87, 118
Phase shift w . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Sensor noise vector v . . . . . . . . . . . . . . . . . . . 44–46
Phase velocity . . . . . . . . . . . . . . . . . . . . . . . 12, 21, 30
Ship’s moulded breadth . . . . . . . . . . . . . . . 8, 24–28
Pierson-Moskowitz spectrum . . . . . . . . . . . . 15, 16
Short-crested waves . . . . . . . . . . . . . . . 13, 117, 118
Pitch . . 4, 19, 20, 24, 26, 28, 51, 64, 66, 68, 75, 76,
Significant wave height 14–19, 37–39, 77, 78, 103
80, 81, 88, 99, 112, 113, 115
Smith correction factor κ . . . . . . . . . . . . . . . . 24, 25
Pitch frequency response function FRFP . . 19, 24
Spectral density . . . . 14–16, 18, 33–37, 43, 44, 55,
Probability density function . . . . . . . . . . . . . . . . . 57
60–62, 66, 89, 95, 108, 110, 112
Probability of observation, Gaussian distribution
Spectral moment . . . . 14, 15, 86, 87, 105, 106, 108
57, 58
Spectrum peak intensifying factor γ . . . . . . . . . 16
Process noise cov. matrix Q 52, 54, 55, 57, 64, 68,
Spreading factor . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
72–74, 76, 77, 82, 87, 118
Standard deviation . . . . . 44, 51, 58, 61, 67, 68, 90
Process noise vector w . . . . . . . . . . . . . . . . . . 53, 54
State transition matrix F . . . . . 53–55, 64, 68, 118
PSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79, 81
State variable 41–44, 48, 52, 53, 55, 58–62, 64–68,
Q 73, 75, 89–91, 97, 108, 110, 117
State vector . . . . . 42–46, 48, 49, 52–55, 58–60, 64,
Quartering sea . . . . . . . . . . . . . . . . 31, 104–107, 110 66–69, 72, 73, 76, 89, 90, 112, 117, 118
R State-space . . . . . . . . . . . . . . . . . . . . . . . . . . 41–43, 65
Surface elevation . . 4, 7, 12, 21, 43, 55, 59, 64, 66,
Relative heading . . . . 19, 25, 26, 28, 29, 31–34, 39, 67, 71, 72, 75, 89, 91, 118
103–105, 107–109, 118 Surge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19, 20

166 Michaela & Tobias Höfler // July 26, 2017


Index

Sway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19, 20

T
Threshold value X . . . . . . . . . . . . . . . . . . . . . . 57, 59
Time domain 3, 7, 11, 14, 15, 17, 41, 71, 79, 93, 95
True wave frequency . . . . . . 11, 12, 14–16, 18, 20,
21, 24–28, 32–35, 37–39, 43, 44, 60–62, 66,
67, 71, 72, 78, 80, 88, 91, 93–99, 103, 106,
108, 110, 112, 118
TULCS project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

V
Variance . 44, 45, 51, 52, 57, 59–62, 67, 68, 76, 79,
82
Vessel draft . . . . . . . . . . . . . . . . . . . . . . . . . . 8, 24–28
Vessel length . . . . . . . . . . . . . . . . . . . . . . . . . 8, 24–29
Vessel velocity V . . . 19, 25, 26, 30, 32–34, 39, 93,
103–105, 107–109

W
Wafo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75, 79
Water density . . . . . . . . . . . . . . . . . . . . . . . . . . 27, 28
Water depths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Water plane area coefficient . . . . . . . . . . . . . . 8, 26
Wave amplitude . 11, 12, 14, 21, 22, 65, 71, 72, 95,
112
Wave domain . . . . . . . 30, 32–34, 37, 38, 77, 93–97
Wave elevation . . . . . 12, 21, 33–37, 43, 55, 59–62,
65–67, 89, 95, 108, 110, 118
Wave length . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11, 12
Wave number . . . . . . . . . . 11, 21, 25, 26, 28, 29, 43
Wiener filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6, 41

Y
Yaw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19, 20

Z
Zero-downcrossing period . . . . . . . . . . . . . . . . . . 12
Zero-upcrossing period 12, 14, 16–20, 37–39, 71,
72, 77, 78, 103

167
168
Bibliography
[1] Jens G. Balchen et al. “Dynamic positioning using Kalman filtering and optimal control theory”. In:
IFAC/IFIP symposium on automation in offshore oil field operation. Vol. 183. Bergen, Norway: Elsevier/North-
Holland Pub. Co., 1976, p. 186. isbn: 978-0-7204-0516-3. (Visited on 03/17/2017) (cit. on p. 6).
[2] Paul Balzer. Das Kalman Filter einfach erklärt [Teil 2] — Filterdesign: Wie wähle ich Q und R? Motorblog.
May 11, 2013. url: http://www.cbcity.de/das-kalman-filter-einfach-erklaert-teil-2 (visited on 04/30/2017)
(cit. on p. 47).
[3] Robert Grover Brown and Patrick Y. C. Hwang. Introduction to Random Signals and Applied Kalman
Filtering — With Matlab exercises and solutions. Third edition. John Wiley & Sons, Inc., 1997. isbn: 0-
471-12839-2 (cit. on pp. 37–43, 45, 47–49, 68, 92, 108).
[4] CMA CGM. CMA CGM Rigoletto — Vessel Information. CMA CGM Vessel Fleet. url: https://www.cma-
cgm.com/the-group/activities/shipping/vessel/9299654/cma-cgm-rigoletto (visited on 03/19/2017) (cit. on
p. 8).
[5] Department of Mechanical Engineering, Section Maritime Engineering, DTU. I-Ship. Ver-
sion 2006A. 2006. url: http : / / www . mek . dtu . dk / english / Sections / FVM / Software / Iship (visited on
09/20/2016) (cit. on p. 16).
[6] John C. Duchi. Properties of the Trace and Matrix Derivatives. url: http://web.stanford.edu/~jduchi/
projects/matrix_prop.pdf (visited on 04/27/2017) (cit. on pp. 44, 45).
[7] Odd Magnus Faltinsen. Sea loads on ships and offshore structures. Cambridge Ocean Technology Series.
London: Cambridge University Press, Sept. 23, 1998. 328 pp. isbn: 0-521-45870-6. url: http://findit.dtu.
dk/en/catalog/2304900645 (visited on 10/10/2016) (cit. on p. 21).
[8] Ramsey Faragher. “Understanding the Basis of the Kalman Filter Via a Simple and Intuitive Derivation
[Lecture Notes]”. In: IEEE Signal Processing Magazine 29.5 (Sept. 2012), pp. 128–132. issn: 1053-5888. doi:
10.1109/MSP.2012.2203621 (cit. on p. 38).
[9] Robert J. Fitzgerald. “Divergence of the Kalman filter”. In: IEEE Transactions on Automatic Control
16.6 (Dec. 1971), pp. 736–747. issn: 0018-9286. doi: 10.1109/TAC.1971.1099836 (cit. on p. 6).
[10] Fleetmon.com. Fleetmon.com Global Vessel Coverage. Fleetmon.com. url: https://www.fleetmon.com/
global-vessel-coverage/ (visited on 03/08/2017) (cit. on p. 5).
[11] Fleetmon.com user Grasbrook. CMA CGM Rigoletto arriving at the port of Hamburg. Sept. 4, 2008.
url: https://img4.fleetmon.com/originals/cma-cgm-rigoletto_9299654_58555.jpg (visited on 03/19/2017)
(cit. on p. 8).
[12] P. Fung and M. Grimble. “Dynamic ship positioning using a self-tuning Kalman filter”. In: IEEE Trans-
actions on Automatic Control 28.3 (1983), pp. 339–350. issn: 0018-9286. doi: 10.1109/TAC.1983.1103226
(cit. on p. 7).
[13] Roberto Galeazzi. Sea State Estimation: Problem Set-up. Mar. 5, 2015 (cit. on pp. 48, 59–61).
[14] M. S. Grewal and A. P. Andrews. “Applications of Kalman Filtering in Aerospace 1960 to the Present
[Historical Perspectives]”. In: IEEE Control Systems 30.3 (June 2010), pp. 69–78. issn: 1066-033X. doi:
10.1109/MCS.2010.936465 (cit. on pp. 6, 37).
[15] N. Hogben and F. E. Lumb. A statistical survey of wave characteristics estimated visually from Voluntary
Observing Ships sailing along the shipping routes of the world. Her Majesty’s Stationery Office (HMSO),
1967. 263 pp. url: http://findit.dtu.dk/en/catalog/2304960531 (visited on 09/27/2016) (cit. on pp. 15, 16).

169
Bibliography Master thesis: Sea State Estimation in the Time Domain

[16] Jianbo Hua and Mikael Palmquist. Wave Estimation through Ship Motion Measurement. 94/36-SE. ISBN
992-029967-7. Stockholm: Naval Architecture, Dept. of Vehicle Engineering, Royal Institute of Technology,
1994, p. 50. (Visited on 03/05/2017) (cit. on p. 7).
[17] International Maritime Organization (IMO). IMO Resulution A.685(17) - Weather criterion for
fishing vessels of 24 metres in length and over. Nov. 1991. url: http://www.imo.org/blast/blastDataHelper.
asp?data_id=22508&filename=A685(17).pdf (visited on 03/08/2017) (cit. on p. 25).
[18] International Maritime Organization (IMO). International Shipping Facts and Figures – Infor-
mation Resources on Trade, Safety, Security, Environment. Mar. 6, 2012. url: http : / / www . imo . org / en /
KnowledgeCentre/ShipsAndShippingFactsAndFigures/TheRoleandImportanceofInternationalShipping/Documents/
International%20Shipping%20-%20Facts%20and%20Figures.pdf (visited on 03/12/2017) (cit. on p. 3).
[19] Toshio Iseki and Kohei Ohtsu. “Bayesian estimation of directional wave spectra based on ship mo-
tions”. In: Control Engineering Practice 8.2 (2000), pp. 215–219. issn: 0967-0661. doi: http://dx.doi.org/10.
1016/S0967-0661(99)00156-2. url: http://www.sciencedirect.com/science/article/pii/S0967066199001562
(cit. on pp. 7, 30, 31).
[20] Jørgen Juncher Jensen. Load and global response of ships. 1st ed. Vol. 4. Elsevier ocean engineering
book series. Amsterdam ; New York: Elsevier Ltd., 2001. 352 pp. isbn: 978-0-08-043953-2. url: http :
//store.elsevier.com/Load-and-Global-Response-of-Ships/J_J-Jensen/isbn-9780080535562/ (visited on
12/04/2016) (cit. on pp. 14, 21).
[21] Jørgen Juncher Jensen et al. “Estimation of ship motions using closed-form expressions”. In: Ocean
Engineering 31 (2004), pp. 61–85. doi: 10.1016/S0029-8018(03)00108-2. (Visited on 10/31/2016) (cit. on
pp. 21–24, 69, 159, 161, 162).
[22] J.M.J. Journée and W.W. Massie. Offshore Hydromechanics. Delft: Delft University of Technology, Jan.
2001. 570 pp. url: http: // www. itk. ntnu.no/fag/gnc/papers/OffshoreHydromechanics.pdf (visited on
05/17/2017) (cit. on pp. 35, 36).
[23] Rudolf Emil Kálmán. “A New Approach to Linear Filtering and Prediction Problems”. In: Transactions
of the ASME — Journal of Basic Engineering 82 (Series D) (1960). 10.1.1.132.6976, pp. 35–45 (cit. on p. 37).
[24] Joss Knight. Parallel matrix operations on GPU using arrayfun: why is it slower than looping, and/or is
there a better method for coding this? MATLAB Answers. Sept. 3, 2016. url: https://www.mathworks.
com/matlabcentral/answers/303822-parallel-matrix-operations-on-gpu-using-arrayfun-why-is-it-slower-
than-looping-and-or-is-there-a-b (visited on 07/22/2017) (cit. on p. 113).
[25] Alaa E. Mansour et al. “Fast Evaluation of the Reliability of Container Securing Arrangements”. In:
Proceedings of PRADS 2004. 9th International Symposium on Practical Design of Ships and Other Floating
Structures. Seehafen Verlag, 2004, pp. 577–585 (cit. on pp. 24–26, 69, 160).
[26] Thomas P. Minka. Old and New Matrix Algebra Useful for Statistics. (1997; revised 12/00). Dec. 28, 2008.
url: https://tminka.github.io/papers/matrix/ (visited on 04/27/2017) (cit. on pp. 44, 45).
[27] Quentin Mourcou et al. “Performance Evaluation of Smartphone Inertial Sensors Measurement for
Range of Motion”. In: Sensors 15.9 (2015), pp. 23168–23187. issn: 1424-8220. doi: 10.3390/s150923168.
url: http://www.mdpi.com/1424-8220/15/9/23168 (cit. on p. 46).
[28] National Centers for Environmental Information. Map of Buoy Locations. NOAA Marine En-
vironmental Buoy Database. url: https://www.nodc.noaa.gov/BUOY/ (visited on 03/08/2017) (cit. on
p. 4).
[29] Ulrik Dam Nielsen. “Estimation of directional wave spectra from measured ship responses”. ISBN 87-
89502-51-5. PhD thesis. Kongens Lyngby: Technical University of Denmark (DTU), May 2005. 262 pp. url:
http://findit.dtu.dk/en/catalog/2185758667 (visited on 03/17/2017) (cit. on p. 7).

170 Michaela & Tobias Höfler // July 26, 2017


Bibliography

[30] Ulrik Dam Nielsen. Ship Operations - Engineering Analyses and Guidance. Jan. 2010. (Visited on 09/10/2016)
(cit. on pp. 9, 11, 14, 16, 18, 19, 21).
[31] Ulrik Dam Nielsen. “A concise account of techniques available for shipboard sea state estimation”. In:
Ocean Engineering 129 (2017), pp. 352–362. issn: 0029-8018. doi: http://dx.doi.org/10.1016/j.oceaneng.
2016.11.035. url: http://www.sciencedirect.com/science/article/pii/S0029801816305388 (cit. on pp. 6, 7, 30,
32, 34).
[32] NOAA AOML Physical Oceanography Division. The Global Drifter Program. The Global Drifter
Program. 2010. url: http://www.aoml.noaa.gov/phod/dac/gdp_drifter.php (visited on 07/11/2017) (cit. on
pp. 3, 4).
[33] Ricardo Pascoal and C. Guedes Soares. “Kalman filtering of vessel motions for ocean wave directional
spectrum estimation”. In: Ocean Engineering 36.6 (2009), pp. 477–488. issn: 0029-8018. doi: http://dx.
doi . org / 10 . 1016 / j . oceaneng . 2009 . 01 . 013. url: http : / / www . sciencedirect . com / science / article / pii /
S0029801809000183 (cit. on p. 7).
[34] Ricardo Pascoal et al. “Estimation of directional sea spectra from ship motions in sea trials”. In: Ocean
Engineering 132 (2017), pp. 126–137. issn: 0029-8018. doi: http://dx.doi.org/10.1016/j.oceaneng.2017.01.020.
url: http://www.sciencedirect.com/science/article/pii/S0029801817300288 (cit. on pp. 6, 7).
[35] Anders Rosén. Introduction to Seakeeping. 2011 (cit. on pp. 10, 18, 21).
[36] Nils Salvesen et al. “Ship motions and sea loads”. In: Annual Meeting of the Society of Naval Archtects
and Marine Engineers. New York: The Society of Naval Archtects and Marine Engineers, Nov. 1970. url:
http://www.sname.org/HigherLogic/System/DownloadDocumentFile.ashx?DocumentFileKey=e0353e0d-
1472-411c-a8ea-be71742b0b7f (visited on 03/18/2017) (cit. on p. 21).
[37] SBG Systems. Ekinox-A Motion Sensor Test Results. 2013. url: https : / / www . sbg - systems . com / docs /
Ekinox_Test_Marine.pdf (visited on 04/29/2017) (cit. on pp. 46, 117).
[38] K. Takekuma and T. Takahashi. “On the evaluation of sea spectra based on the measured ship motions”.
In: Transactions of the West-Japan Society of Naval Architects 45 (1973), pp. 51–57. issn: 0389911X. url:
http://ci.nii.ac.jp/naid/40017969087/en/ (cit. on p. 6).
[39] Alexandra H. Techet. Design Principles for Ocean Vehicles (13.42) - Course Literature. 2005. url: https:
//ocw.mit.edu/courses/mechanical-engineering/2-22-design-principles-for-ocean-vehicles-13-42-spring-
2005/ (visited on 03/05/2017) (cit. on pp. 13, 14).
[40] User BB_ML. Kalman Filter Derivation. math.stackexchange.com. Published: Mathematics Stack Ex-
change. Jan. 1, 2016. url: https://math.stackexchange.com/q/1595848 (visited on 04/28/2017) (cit. on
p. 45).
[41] WAFO-Group. WAFO - A Matlab Toolbox for Analysis of Random Waves and Loads - A Tutorial. Lund,
Sweden: Math. Stat., Center for Math. Sci., Lund Univ., 2011 (cit. on p. 69).
[42] Wikipedia. 68–95–99.7 rule. Wikipedia, the free encyclopedia. url: https://en.wikipedia.org/wiki/68%
E2%80%9395%E2%80%9399.7_rule (visited on 05/13/2017) (cit. on pp. 51, 52).
[43] Wikipedia. Confidence Intervals. Wikipedia, the free encyclopedia. url: https://en.wikipedia.org/wiki/
Confidence_interval (visited on 05/21/2017) (cit. on p. 52).
[44] Wikipedia. Cumulative distribution function. Wikipedia, the free encyclopedia. url: https://en.wikipedia.
org/wiki/Cumulative_distribution_function (visited on 05/13/2017) (cit. on p. 51).
[45] Wikipedia. Expected value. Wikipedia, the free encyclopedia. url: https : / / en . wikipedia . org / wiki /
Expected_value (visited on 04/05/2017) (cit. on p. 41).

171
Bibliography Master thesis: Sea State Estimation in the Time Domain

[46] Wikipedia. In-phase and quadrature components. Wikipedia, the free encyclopedia. url: https : / / en .
wikipedia.org/wiki/In-phase_and_quadrature_components (visited on 06/01/2017) (cit. on p. 59).
[47] Wikipedia. Matrix calculus – Derivatives with Matrices. Wikipedia, the free encyclopedia. url: https:
//en.wikipedia.org/wiki/Matrix_calculus (visited on 04/28/2017) (cit. on p. 44).
[48] Wikipedia. Matrix calculus – Scalar-by-matrix Identities. Wikipedia, the free encyclopedia. url: https:
//en.wikipedia.org/wiki/Matrix_calculus (visited on 04/28/2017) (cit. on p. 44).
[49] Wikipedia. Normal distribution. Wikipedia, the free encyclopedia. url: https://en.wikipedia.org/wiki/
Normal_distribution (visited on 05/13/2017) (cit. on p. 51).
[50] Wikipedia. Propagation of uncertainty. Wikipedia, the free encyclopedia. url: https://en.wikipedia.org/
wiki/Propagation_of_uncertainty (visited on 05/25/2017) (cit. on pp. 54, 55).
[51] Wikipedia. Quadratic equation. Wikipedia, the free encyclopedia. url: https://en.wikipedia.org/wiki/
Quadratic_equation (visited on 05/16/2017) (cit. on p. 30).
[52] Wikipedia. Square root. Wikipedia, the free encyclopedia. url: https://en.wikipedia.org/wiki/Square_root
(visited on 05/16/2017) (cit. on p. 30).
[53] Wikipedia. Trace (Linear Algebra). Wikipedia, the free encyclopedia. url: https://en.wikipedia.org/wiki/
Trace_(linear_algebra) (visited on 04/25/2017) (cit. on p. 44).
[54] Wikipedia. Transpose. Wikipedia, the free encyclopedia. url: https://en.wikipedia.org/wiki/Transposed
(visited on 04/05/2017) (cit. on p. 43).
[55] Wikipedia. Wavenumber. Wikipedia, the free encyclopedia. url: https : / / en . wikipedia . org / wiki /
Wavenumber (visited on 03/13/2017) (cit. on p. 9).
[56] Wikipedia. White Noise. Wikipedia, the free encyclopedia. url: https://en.wikipedia.org/wiki/White_
noise (visited on 07/01/2017) (cit. on p. 73).

172 Michaela & Tobias Höfler // July 26, 2017

Das könnte Ihnen auch gefallen