Vous êtes sur la page 1sur 39

Offshore Simulator

Mathematical and Physical Modeling

Marcelo Zimbres B mzimbres@gmail.com


2
Contents

1 Propulsion 5
1.1 Thruster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1.1 Power . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1.2 Thrust . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.3 kt and kq input data . . . . . . . . . . . . . . . . . . . 7
1.1.4 Fixed Pitch Propellers (FPP) . . . . . . . . . . . . . . 8
1.1.5 Controllable Pitch Propellers (CPP) . . . . . . . . . . 9
1.1.6 Propeller dynamics. . . . . . . . . . . . . . . . . . . . . 9
1.1.7 Force and torque . . . . . . . . . . . . . . . . . . . . . 10
1.1.8 Thruster P3D configuration . . . . . . . . . . . . . . . 11
1.1.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.2 Rudder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.2.1 Thruster induced velocity . . . . . . . . . . . . . . . . 15
1.2.2 Thruster shadow effect . . . . . . . . . . . . . . . . . . 16
1.2.3 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.3 Dynamic Positioning . . . . . . . . . . . . . . . . . . . . . . . 16
1.3.1 Thrust Allocation . . . . . . . . . . . . . . . . . . . . . 17
1.3.2 Control . . . . . . . . . . . . . . . . . . . . . . . . . . 19

2 Vessel 21
2.1 Squat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.2 Coordinate transformations . . . . . . . . . . . . . . . . . . . 21
2.3 Wandering Ships . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.4 Tugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3 Line 25
3.1 The catenary equation . . . . . . . . . . . . . . . . . . . . . . 25
3.2 Force on the catenary end-points . . . . . . . . . . . . . . . . 27

3
4 CONTENTS

3.3 Step by step algorithm . . . . . . . . . . . . . . . . . . . . . . 28

4 Environment 31
4.1 Wind . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.1.1 Wind vector field . . . . . . . . . . . . . . . . . . . . . 31
4.1.2 Wind force . . . . . . . . . . . . . . . . . . . . . . . . 32
4.2 Wave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.2.1 Spreading . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.2.2 Forces . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.2.3 Input data . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.3 Current . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.3.1 Input data . . . . . . . . . . . . . . . . . . . . . . . . . 34

A Appendix 37
A.1 Mathematical review . . . . . . . . . . . . . . . . . . . . . . . 37
A.1.1 Linear interpolation . . . . . . . . . . . . . . . . . . . . 37
A.1.2 Bilinear interpolation . . . . . . . . . . . . . . . . . . . 37
A.1.3 Rotations . . . . . . . . . . . . . . . . . . . . . . . . . 38
A.1.4 Calculus of variations . . . . . . . . . . . . . . . . . . . 39
A.1.5 Newton Raphson . . . . . . . . . . . . . . . . . . . . . 39
Chapter 1

Propulsion

1.1 Thruster
In this document we make a detailed review of the latest develoments
made in the mathematical and physical model of thrusters used in the sim-
ulator. We also give a detailed description on how to configure a thruster
from a p3d file.

1.1.1 Power
The power demanded by the thruster is modeled by

2nQ
P = , (1.1)

where is the mechanical efficiency of the complete thruster, Q denotes the


hydrodynamic torque produced by the thruster at a given rotation n (given
in rotations per second) and is given by the formula

Q = |n|nD5 kq (J, p), (1.2)

where denotes the water density, kq = kq (J, p) is the torque coefficient and
p = pitch/D, where D is the thruster diameter.
The advance ratio J is defined as J(v, n) = v/nD, where v is the water
velocity incident in the thruster. To avoid numerical instabilities at n = 0,
we restrict the value of J in the range J [2, 2].

5
6 CHAPTER 1. PROPULSION

1.1.2 Thrust
The thrust T produced by the thruster is modeled according to the formula

T = |n|nD4 kt (J, p), (1.3)

where kt = kt (J, p) is the thrust coefficient.


Transversal velocity reduction. The thrust (1.3) generated by the thruster
is reduced as the component of the water velocity perpendicular to its axis
v increases, so that the effective value of the thrust is given by Te = f (v )T .
We impose the constraints on f , f (v ) = 0 if |v | > vm , where vm is
a threshold value. When v is in the interval 0 v vm we impose
f (0) = 1, f (vm ) = 0 and f (vm /2) = r. The simplest function satisfying
these constraints is the second order polynomial given by

0   if |v | > vm ,
f (v ) = |v | |v | (1.4)
1 1 2(1 2r) if 0 |v | vm .
vm vm
The values of vm and r used in (1.4) depends on the propeller, for example,
for tunnel propellers we noticed that vm = 3(m/s) and r = 3/4 are quite
good general values, whereas for azimuthal propellers higher values of vm are
used. The graphs on figure 1.1 show the function (1.4) for various values of
vm .
Thruster-Hull interaction. In order to account for the interaction between
the thruster jet stream and the hull, the effective thrust generated by the
thruster is given by

Te = h(, sign(T ))f (v )T, (1.5)

where is the azimuth angle (in the case of azimuthal thrusters). This
expression is general, and can also be used to model the interaction between
the main propeller and the hull, that gives a smaller thrust when in reverse
operation (negative thrust).
Behaviour of P T 2 . In the force allocation model used, it is assumed
that power and thrust obey equation

P = CT 2 + P0 . (1.6)
1.1. THRUSTER 7

Transversal velocity reduction

1 vm =2
vm =3
vm =4
0.8
vm =5
vm =6
0.6
f (v )

0.4

0.2

0 1 2 3 4 5 6
v (m/s)

Figure 1.1: Thruster reduce due to transversal water for various values of
vm .

If we work out equations (1.3) and (1.1), we see that for our model

2kq
C= 2
and P0 = 0. (1.7)
kt |n|D3

Even though equation (1.7) depends on n, in the cases we have at hand,


the graph C n is almost constant, except near n = 0 where it is not well
behaved. In the allocation of forces we use n = nmax to estimate C.

1.1.3 kt and kq input data

We use two ways of providing input data for kt and kq . For FPP the curves
kt and kq are provided as tables and linear interpolation is used to estimate
intermediate values. The tables have the form shown in table 1.1a.
For CPP we use polynomial interpolation to estimate the function kq and
8 CHAPTER 1. PROPULSION

Table 1.1: kt and kq input data.


(a) FPP (b) CPP
J kq kt ai bi ci di
-1.0 0.030 0.20 0 0 0.0000 0.0167
-0.5 0.050 0.34 0 1 -0.6000 0.0000
0.0 0.046 0.32 1 0 0.5981 0.0000
0.7 0.020 0.15 1 1 0.0000 -0.1000
1.0 0.000 0.00 2 0 0.0000 0.0344

kt . The following formulas are used


n
X
kq (J, p) = di J bi pai (1.8)
i=0
Xn
kt (J, p) = ci J bi pai . (1.9)
i=0

Where the data ai , bi , ci and di are read from a table displayed as shown in
table 1.1b.

1.1.4 Fixed Pitch Propellers (FPP)


We have seen that the power and thrust produced by a thruster depends
on two variables, its rotation and its pitch. Therefore controlling the force
produced by the thruster translates into controlling these two variables.
In the majority of cases, we have either controllable rotation or con-
trollable pitch. But usually for the main thruster both variables can be
controlled.
To mimic the real behaviour of a thruster, it is convenient to distinguish
between five variables related to the thruster rotation: nm , nd , nsp , nc , nl . We
describe each one of them in the following. nm is the maximum rotation that
the thruster can achieve (usually under special conditions). This rotation
is used as the reference, for example, if we are controlling the rotation in
the simulation by means of a joystick, that sends a value h in the interval
h [1, 1], them h = 1 corresponds to nm (currently we assume that the
minimum rotation is the negative of the maximum).
1.1. THRUSTER 9

The variable nd is defined as the demanded rotation. It is the rotation


demanded by the joystick, that is in the interval nd [nm , nm ]. Its value
is obtained from nd = hnm .
Under certain conditions, it can happen that the demanded rotation nd ,
demands more power than the thruster can produce and therefore its value
is not achievable. In this case we say that the thruster is saturated. This
fact motivates us to introduce the set point rotation denoted by nsp , that
is always achievable and never demands more power than the thruster can
produce. It is sometimes equal to and sometimes less than nd . We have an
algorithm that calculates nsp from each new value of nd .
Real thrusters however can not respond instantaneously and need some
time to go from their current rotation nc to nsp . The dynamic behaviour
that takes nc to nsp is governed by a first order dynamics (see next section),
for that we need to introduce nl , that is the rotation in the last step of the
simulation.
Our implementation supports also thrusters that do not have invertible
rotation i.e. negative rotation.

1.1.5 Controllable Pitch Propellers (CPP)


These thrusters have behaviour that is similar the FPP, except that in this
case we need only two variables to describe its behaviour: pm , pd and pc .
There is no need here to introduce a set point p since in the case of CPP
thrusters saturation is handled decreasing its rotation set point, therefore,
for CPP thrusters, pd can be always reached, but perhaps, at the cost of
having its rotation reduced (when saturation takes place).

1.1.6 Propeller dynamics.


Thruster rotation and pitch have a dynamic, that means that a given de-
manded rotation or pitch is not automatically reached. Additionally, we also
have dynamics in the thruster azimuth angle.
In this section we explain the mathematical law governing the dynamic
for each one of these variables.
Rotation dynamics is modeled according to a first order dynamics, so that
if n[k] is the rotation at step k, than we have

n[k] = An[k 1] + (1 A)nsp [k], (1.10)


10 CHAPTER 1. PROPULSION

where
1
A= , (1.11)
1 + 5t/tm

where nsp denotes the rotation set point as explained in the previous section,
t is the simulation time step and tm is the time to reach 99% of steady
rotation if nsp remains constant.
The pitch and angular variable obey a constant velocity dynamics, where
to go from step k to k + 1, we do

p[k + 1] = p[k] vp t, (1.12)

where vp is the actuation velocity, defined by the user. Formula (1.12) is also
used for the azimuthal angle alpha.

1.1.7 Force and torque


We saw that the thrust generated by the propeller depends on the water
velocity along its axis and transversal to it, therefore we make a very short
review here on how to calculate this velocities when we consider the propeller
bound into a ship. The first thing to note, is that the ship behaves as a
rigid body and as such it has six degrees of freedom, three related to its
translational motion and three related by its rotational motion. So denoting
its translational velocity by v s , the current velocity by v c and rotational
velocity by , the water velocity at position r relative to the ships center of
mass, is given by

vp = vs vc + r (1.13)

From this velocity we can calculate the water velocity incident in the
propeller i.e. along its axis and perpendicular to it. Denoting by vk and v
the radial and perpendicular component we have

vk = vp rp , (1.14)

where rp is a unit vector along the propeller axis. From that we take the
perpendicular component

v = |vp |2 vk2 (1.15)


1.1. THRUSTER 11

The torque it produces on the ship is given by

=rf (1.16)

Paddle effect. When a negative rotation or negative pitch is demanded from


the main thruster, a force in sway direction arises as the effect of transversal
water hitting the vessel stern. We have modeled this force by the equation
  k 3
v np
Fgui = K1 1 + , (1.17)
2K2 nmax pmax

where p is the thruster pitch.

1.1.8 Thruster P3D configuration


Here are the available tags to configure the thruster from a p3d file.

1) MAX PERP VEL: Specifies the transversal water velocity on the thruster
above which the generated thruster is always zero (see equation 1.4 and
the graphs in figure 1.1). It defaults to 3 m/s.

2) ALPHA PROP: Thruster angle in the range [180, 180], where 0 is aligned
with the vessel longitudinal axis and points bow. The tag is read only for
propeller for fixed thrusters (i.e. non-azimuthal).

3) POSITION TYPE: Specifies whether the thruster angle can be com-


manded or not (if it is azimuthal or not). Its value is one of AZIMUTE FREE
or FREE AZIMUTE. If this tag does not have one of the afore mentioned
values, the thruster angle will be set to the value of ALPHA PROP.

4) ROTATION: If provided sets the rotation value for CPP or maximum


rotation for FPP. If not given the thruster rotation is calculated for J = 0.
Expects rotations / minute.

5) P D: If provided sets the P/D value for FPP or maximum P/D, for CPP.

6) CONTROL TYPE: Informs if rotation or pitch (or both) can be com-


manded from the thruster. It is one of VARIABLE ROTATION, VARI-
ABLE PITCH or VARIABLE PITCH ROTATION. These tags determine
if a thruster is FPP or CPP. If rotation can be commanded its initial state
12 CHAPTER 1. PROPULSION

is set to 0, if it cannot, its value is set to the value of the tag ROTATION.
Similarly for P/D, if it can be commanded, its initial state is set to 0,
otherwise it is set to the value provided in P D.

7) INVERSION KEY: Informs if the thruster supports negative rotation. It


is one of YES or NO.

8) DIAMETER: Informs the thruster diameter. (m)

9) POT NOM: Informs thruster maximum nominal power. (kNm)

10) POT MAX: Informs thruster maximum nominal power. (kNm)

11) EFFIC: Informs thruster efficiency.

12) KRE: Accounts the effect given by equation 1.5 (i.e. when operating in
reverse ration).

13) TMAX TURN: Time for an azimuthal thruster perform a 360 revolution.
(s)

14) TIME TO FULL PITCH: Informs the time taken for a CPP to go from
P/D = 0 to its maximum value. (s)

15) TMAX THROTTLE: Time taken to go from 0 to maximum rotation. (s)

16) X PROP, Y PROP, Z PROP: Informs thruster position relative to the


vessel keel amidships. (m)

17) PROP POLY: Used to specify the thruster functions kt and kq for CPP.
For the mathematical formulation see section 1.1.3. The table must have
N > 2 rows and 4 columns ordered as shown in table 1.1b. For how to
input this tables in a p3d file see the example in the end of this section.

18) PROP TABLE: Use to specify the thruster functions kt and kq for non
CPP. For the mathematical formulation see section 1.1.3. The table must
have N > 2 rows and 3 columns ordered as shown in table 1.1a. For how
to input this tables in a p3d file see the example in the end of this section.

19) TABLE POLY: Allows a switch between PROP POLY and PROP TABLE.
Its values are one of PROP or TABLE. Note however that we do not ac-
cept the value TABLE for CPP.
1.1. THRUSTER 13

20) THRUSTER SHADOW PITCH: Value of P/D at which the thruster


shadow effect takes place as presented in section 1.2.2.

An example use of the tags described above for a FPP can be seem on
list 1.1.
14 CHAPTER 1. PROPULSION

1 PROP
2 {
3 ID = 0 ,
4 POSITION TYPE = AZIMUTE FIXED ,
5 CONTROL TYPE = VARIABLE ROTATION ,
6 X PROP = 127 ,
7 Y PROP = 0
8 Z PROP = 4 . 5 ,
9 ALPHA PROP = 0
10 ROTATION = 1 . 3 7 ,
11 DIAMETER = 8 . 3 ,
12 P D = 0.76 ,
13 POT MAX = 2 2 0 0 0 ,
14 EFFIC = 0 . 6 ,
15 INVERSION KEY = YES ,
16 TMAX THROTTLE = 5 5 ,
17 TABLE POLY = TABLE ,
18 KRE = 0 . 7 5 ,
19 PROP POLY = { { 0 , 0 , 0 . 0 0 0 0 , 0 . 0 1 6 7 }
20 , { 0 , 1 , 0.6000 , 0 . 0 0 0 0 }
21 , {1 , 0 , 0.5981 , 0.0000}
22 , { 1 , 1 , 0 . 0 0 0 0 , 0.1000}
23 , {2 , 0 , 0.0000 , 0.0344}
24 },
25 PROP TABLE = { { 1.0 , 0 . 0 3 0 , 0 . 2 0 }
26 , { 0.5 , 0 . 0 5 0 , 0 . 3 4 }
27 , { 0.0 , 0.046 , 0.32}
28 , { 0.7 , 0.020 , 0.15}
29 , { 1.0 , 0.000 , 0.00}
30 }
31 } ,

Listing 1.1: Thruster configuration from a p3d file

1.1.9 Exercises
1) Assume that v is the precision we can estimate ships translational ve-
locity, c the precision we can estimate the current velocity, the precison
on the angular velocity and r the precison on the position of the propeller.
What precision do we have on the values of values of v|| and v ?
2) Assume that we can command the propeller rotation, pitch and angle with
precision n , p , repectivelly. Calculate how the estimated thrust, power
1.2. RUDDER 15

and toque, given by equations 1.1, 1.3 and 1.16 are affected. In other words,
what is the error in P and T and ? Use the results of exercise 1, for the
values of v|| and v .
3) Prove that the equations that govern propeller dynamics, cannot cause it
to be in and invalid state, that is, a state where its power is greater than its
configured maximum power.
4) In section 1.1.1 we said that currently we are limiting the values of J in
the interval [3, 3]. Use these values and the tolerance in rotation n and
pitch over diameter p to estimate the maximum and mnimum forces that
our thrust model allows? Is this a reasonable value? What acceleration do
these values produce in a ship with mass m?

1.2 Rudder
This section is dedicated to many important facts about our modeling of
rudders on the simulator.

1.2.1 Thruster induced velocity


The x component of the current velocity on the rudder can be divided in
two components. The first one is due to vessel motion. On the absence
of thrusters, this velocity is the negative of the vessel velocity (measured
on the vessel-fixed coordinate system). The second component is due to
the thruster, that pushes water on the rudder. If we denote by vx the x
component of the vessel velocity, the final water velocity vr incident in the
rudder is given by
(
vx if T 0,
vr = 2 2 1/2
(1.18)
vx + kr ((vx + 8T /D ) |vi |) otherwise,
where is the water density and D the thruster diameter. The constant kr
is given by
1
2kr = 1 + , (1.19)
1 + 0.15D/d
where d the distance between the rudder and the thruster. There is still one
effect that is not accounted by the formulas above. This is the subject of the
next section.
16 CHAPTER 1. PROPULSION

1.2.2 Thruster shadow effect


When we are dealing with a CPP thruster, and its P/D is close to zero, it
produces a shadow on the rudder, blocking the water that would reach the
rudder. We have modeled this effect by means of a function f (vx , p). The
value of this function multiplies the x component of the final current velocity
on the rudder as given by equation (1.18). This function is given by

1
if vx v0 or p p0 ,

0 if vx 0 and p 0,



f (vx , p) = vx /v0 if p < 0 and v0 < vx < 0, (1.20)

p/p0 if vx > 0 and 0 < p < p0





bi Bilinear interpolation.
An ilustration of this function can be seem on figure 1.2.

1.2.3 Exercises
1) Prove that the rudder shadow function given by equation (1.20) is con-
tinuous on its domain.

1.3 Dynamic Positioning


We divide the Dynamic Positioning (DP) in three parts that will be throughly
explained in the next subsections. For short, we divide it in three conceptual
parts. The first one is what we call the control. The control is responsible
for calculating the force that the vessels propulsion system must impose on
its propellers so that the vessel reach a certain set-point in surge, sway and
yaw.
The force and torque calculated by the control cannot be applied directly
to the vessels center of mass, it must be achieved by all its propellers working
cooperatively. The question that arises now is how much force shall be pro-
duced by each propeller to result in the force calculated by the control?. This
problem is handled by the force allocation algorithm.
The third and last part that the DP must address is, once we know the
force that a given propeller must impose how can we make it achieve it. There
are two ways of controlling the thrust a propeller produces, either controlling
its rotation or its pitch.
1.3. DYNAMIC POSITIONING 17

vx
O

Figure 1.2: The rudder shadow region function. On the red regions it has
value 1, on the blue region 0, on the yellow and green regions a value in
the range [0, 1] to avoid descontinuity. Finally in the orange region we use
bilinear interpolation to connect the four points.

1.3.1 Thrust Allocation


The thrust allocation logic calculates how much force should each thruster
produce, in order to achieve a desired force f and torque , with the con-
straint that we have to minimize energy consumption.
The equations we have to solve are
n
X
f= fi , (1.21)
i=0
n
X
= ri fi , (1.22)
i=0
18 CHAPTER 1. PROPULSION

where fi is the force of the ith propeller and ri its position relative to the
vessel center of mass.
Equations (1.21) and (1.22) can be significantly simplified if we take into
account that we are interested in controlling only translational motion in
surge and sway, and angular motion in Yaw.
As an example we work out the allocation problem for a ship with two
fixed and two azimuthal thrusters. The generalization for more thrusters is
straightforward and can be carried out by the reader if there is interest.
Using matrix notation, we denote the force and torque produced by an
azimuthal thruster as

fx fx 1 0  
fy = fy = 0 1 fx . (1.23)
fy ,
z yfx + xfy y x

For a fixed propeller we have



fx fx cos 
fy = fy = sin f , (1.24)
z yfx + xfy y sin + x cos

where is the thruster axis angle. For a main propeller for example, = 0 .
For a tunnel thruster = 90 .
With this notation we can cast equations (1.21) and (1.22) as

f1x
f1y
fx 1 0 c2 1 0 c4
f2 (, 1.25)

fy = 0 1 s2 0 1 s4 f3x
z y1 x1 y2 c2 + x2 s2 y3 x3 y4 c4 + x4 s4
f3y
f4

where ci = cos i and si = sin i . Equation above has the general form
f = Bu and can be solved by the Moore-Penrose pseudoinverse

u = B T (BB T )1 f (1.26)

Before we proceed, we remember that we have the constraint the total


power consumption must be minimized, however solution (1.26), minimizes
the sum P 0 = f1x
2 2
+ f1y + f22 + f3x
2 2
+ f3y + f42 , which does not represent the
1.3. DYNAMIC POSITIONING 19

total power since in that case, each thruster contribute a different weight as
assumed in equation (1.6). These weights can be easily included in the least
squares method by scaling the vector u in the form

f1x 1/c1 c1 f1x
f1y 1/c1 c1 f1y

f2 1/c2 c2 f 2
=
c3 f3x . (1.27)

f3x 1/c3

f3y 1/c3 c3 f3y
f4 1/c4 c4 f 4

This equation has the form u = W 1 us . With this notation, we can write
(1.25) as f = BW 1 us . Its solution now reads

us = W 1 B T (BW 1 B T )1 f (1.28)

The weights in the matrix W can be either calculated automatically from


(1.7) or adjusted manually to improve allocation energy consumption, spe-
cially in the cases where the power does not follow the P T 2 .
If the nominal power of a propeller is occasionally exceeded, the differ-
ence between the total forces and moment required by the controller and
those delivered by the propeller system is calculated, and the difference is
reallocated among the non-saturated propellers.

1.3.2 Control
20 CHAPTER 1. PROPULSION
Chapter 2

Vessel

This section is dedicated to review the forces acting on the Vessel.

2.1 Squat
The Squat effect is a force that acts on a vessel when it navigates on shallow
waters. It is formulated as follows. Let D be the water depth, the vessel
weight, L the vessel length and Fr the Froude number. First we define the
vessel the vertical displacement sq and the Froude number Fr
Fr2
sq = 2.4 p , (2.1)
L2 1 Fr2

Vx
Fr = , (2.2)
gD
where g is the gravity acceleration. The squat force is defined by

F sq = LBsq g, (2.3)

where B is the vessel beam.

2.2 Coordinate transformations


We often have to transform between coordinate systems (cs) in the vessel.
Let us list the coordinate system we have to handle.

21
22 CHAPTER 2. VESSEL

A) The cs fixed on the Earth. Its origin is such that z = 0 is at sea level.
B) At rest relative to A and with the same orientation. Its origin is at the
vessel wamit center r BA . It has the same orientation as A.
C) Shares its origin with B, is at rest relative to B but is rotated by the
Euler angles (, , )BA .
D) Always coincident with C (shares origin and axis) but has translational
velocity v DC and angular velocity DC relative to C. This cs is fixed on the
vessel. Its x axis is aligned with the vessel longitudinal axis.
E) At rest relative to D and with the same orientation. Its position relative
to D is r ED .
F) Shares its origin and Z axis with E, but has a yaw angle. This is usually
a cs fixed on the propeller or rudder.
We want to answer the question: If we know there is current on the sea,
what is its value as seem on reference F?

2.3 Wandering Ships


We sometimes need a ship wandering on the simulation scenario, with almost
no external control. We want to input a direction and a velocity and have it
follow it without wave, wind and current interaction.
When the ship has the direction and velocity demanded by the instructor,
it will stay so until the instructor changes it. When these values are changed,
we use the following dynamics to evolve again to the inertial motion.
We have the initial state (vn , n ) and want to evolve to (vm , m ), where v
denotes the ship velocity at simulation step n and n the ship heading. To go
from vn to vm we use a uniformly accelerated motion, given by the equation
vn+1 = vn + at and the position is given by sn+1 = sn + vn t + a(t)2 /2.
The new position is always calculated along the ship longitudinal axis. The
acceleration a used depends on the ship length, we have

2
2.66 10 (m/s) or ((0 8) (m/s)/5min)
if l < 50m,
2
a = 1.33 10 (m/s) or ((0 8) (m/s)/10min) if 50 < l < 150m,(2.4)

8.89 103 (m/s) or ((0 15) (m/s)/10min) if l > 150m.

2.4. TUGS 23

(On 16 of March 2015 we agreed that the acceleration value is


twice as big when it has a negative sign) To define the evolution of the
heading n we first define the water depth by H, the ship draft by D and
the quantities
(
4L(0.1158v + 0.04167) if H/D > 4,
Dt = (2.5)
L(0.7143H/D + 6.857)(0.1198v + 0.04167) if 1.1 < H/D < 4,

where L is the ship length. The first condition is for deep water and the
second for shallow. When the ship is evolving its state from (vn , n )
(vm , m ) we consider that its current heading is perpendicular to the line
segment that connects the ship to the center of a circle with diameter Dt and
impose that n+1 is also perpendicular to the new line segment that connects
the new ship position to the center of that circle. Therefore, each time we
calculate the next velocity we have also to correct the heading by the angle
= tan1 (2S/Dt ), where the sign depends on the new direction being
clockwise or counter-clockwise.

2.4 Tugs
Tugs on the simulator are instantiated with the TUGCR nmea command
(see the iospec SMH4.txt file). The configuration of tugs on the p3d file is
made as follows
1 MODEL
2 {
3 ...
4 TUG
5 {
6 ID = 1 ,
7 PROP { . . . },
8 PROP { . . . },
9 ...
10 }
11 }

Listing 2.1: Tug configuration from a p3d file


The tag PROP is the same one used for vessels (see 1.1.8). Controlable
azimuth angle is enabled for all thrusters passed in the p3d file. Usually tugs
have only one propeller, however the implementation supports as many as
24 CHAPTER 2. VESSEL

desired. The force generated by the tug is passed to the on-ship by means of
nmea commands (S5XFS).
The total force is calculated as the sum of all forces produced by the
individual thrusters. The orientation of the thrusters is not accounted for,
only the total intensity is used to calculate the final force this tug produces.
The direction of the force passed to the on-ship is directed along the line that
connects both ships.
Chapter 3

Line

3.1 The catenary equation


To simulate ships that are connect to each other we use a simple model based
on static hanging cables. The function that describes such cables are called
catenary. The find out the shape assumed by such a cable we can use the
minimum action principle. Since in this case we are handling a static cable,
its kinetical energy T is zero, therefore all we have to do is to minimize its
potential energy U . In the following we assume that the cable is inelastic.
The potential energy of an element with mass dm in the cable is given
by dU = gydm, where g is the gravity acceleration and y the height of the
mass element. We can also write dU as

dU (x) = gydm (3.1)


= gyds (3.2)
p
= gy dx2 + dy 2 (3.3)
p
= gy 1 + (dy/dx)2 dx (3.4)
p
= gy 1 + y 0 2 dx (3.5)
p
where is the cable linear density and ds = 1 + y 0 2 dx is the differential
arc length. The total potential energy of the cable can therefore be written
as
Z b p
U (x) = g y 1 + y 0 2 dx (3.6)
a

25
26 CHAPTER 3. LINE

All we have to do now is to find the function y(x) that minimizes


R a U (x)
subject to the constraint that the cable has fixed length l = b ds. To
handle this constraint we can use Lagrange multipliers. To final form of the
lagrangean we have to solve is
p
L = g(y + ) 1 + y 0 2 , (3.7)

where is the Lagrange multiplier. We see that equation (3.7) has no de-
pendency on x, therefore a constant of motion immediately follows from the
Euler-Lagrange equation. We have

y+
c= p (3.8)
1 + y02
or
Z
dy
x= p , (3.9)
((y )/c)2 1

whose general solution is given by


 
x x0
y(x) = + c cosh . (3.10)
c

Equation (3.10) is the general form of the catenary equation. To find the
constants , x0 and c we have to impose appropriate boundary conditions,
the subject of the next section. Before that however, let us find the equation
that gives the length of the catenary
Z bp
l = 1 + y 0 2 dx
a
Z bq
= 1 + sinh2 ((x x0 )/c)dx
a
Z b
= cosh ((x x0 )/c)dx
a
b

= c sinh ((x x0 )/c) (3.11)


a
3.2. FORCE ON THE CATENARY END-POINTS 27

3.2 Force on the catenary end-points


In the simulation, all we have are the fairlead positions P1 and P2 where the
lines are attached and the line length l. With that information we must be
able to find the constants , x0 and c in equation (3.10). Say that the fairlead
position of one vessel is at r a = (xa , ya , za ) and the other at r b = (xb , yb , zb ).
With that information we can pcalculate the distance (projected on the sea
surface) between them d = x2 + y 2 and their height difference h =
zb za .
Once d and h are known we can simplify the calculations by saying r a is
the origin of the coordinate system where the catenary will be defined. In
0 0
this new coordinate system we have r a = (0, 0, 0). Substituting r a in (3.10),
we can get rid of and the new catenary equation reads
 
y(x) x0 x x0
= cosh + cosh . (3.12)
c c c
0
Now, using the boundary condition r b = (d, h) on equations (3.11) and (3.12),
we get
 
h x0 d x0
= cosh + cosh , (3.13)
c c c
 
l x0 d x0
= + sinh + sinh . (3.14)
c c c
From these relations we can show that the following equation holds
(h + c cosh(x0 /c))2 (l c sinh(x0 /c))2 = c2 . (3.15)
If we denote = h + c cosh(x0 /c) and = l c sinh(x0 /c), then equations
2 2 = c2 and ( h)2 ( l)2 = c2 hold. Since there are two equations
we can find and in terms of c, l and h. We have the following equation
for
c2 h2 h2 l2
l + 2 =0 (3.16)
h l2 4
With solution
r
4c2
2 = l h 1 + 2 , (3.17)
l h2
r
4c2
2 = h l 1 + 2 . (3.18)
l h2
28 CHAPTER 3. LINE

Where the solution of is obtained by noting that the equation for and
are invariant under a swap of h and l and change c ic. To write the final
form of the catenary equation we note by the first derivative test in equation
(3.12) that x0 is an extremum point and when c > 0 this point is a minimum.
We also have the condition |h| < l. The final form of the catenary equation
is therefore
r  
h l 4c2 x x0
y(x) = 1+ 2 + c cosh . (3.19)
2 2 l h2 c
We also have
x0 h lp
c cosh = + 1 + 4c2 /(l2 h2 ), (3.20)
c 2 2
x0 l hp
c sinh = + 1 + 4c2 /(l2 h2 ), (3.21)
c 2 2
To find the constant c we have to find the zero of equation (3.13). To calculate
the forces on the catenary endpoints we have the to calculate the angles a
and b defined by y 0 (0) = tan a and y 0 (d) = tan b . We have
0
y (x) = sinh((x x0 )/c). (3.22)

3.3 Step by step algorithm


Let us see a step by step algorithm of how to calculate the forces applied on
the catenary endpoints. Let us denote r a = (xa , ya , za ) and r b = (xb , yb , zb )
the points where the cable endpoints are tied. The distance be d projected
on the sea surface between r a and r b and difference in height between them
is
p
d = x2 + y 2 (3.23)
h = zb za , (3.24)
where x = xb xa and y = yb ya . The catenary equation is given by
y(x) = c cosh(x0 /c) + c cosh((x x0 )/c), (3.25)
The constant c can be found by finding the c such that the function below
is zero i.e. f (c) = 0
r  
h l 4c2 d x0 (c)
f (c) = + 1+ 2 c cosh . (3.26)
2 2 l h2 c
3.3. STEP BY STEP ALGORITHM 29

The angles of the tangent lines on r a and r b are

tan a = sinh x0 /c, (3.27)


tan b = sinh(d x0 )/c. (3.28)

Now let us find the force vector f a acting on r a and f b acting on r b . We


first denote the cable weight by 2w. Then we have

f a = w(cos a cot a , sin a cot a , 1), (3.29)


f b = w(cos b cot b , sin b cot a , 1), (3.30)

where

tan a = uy /ux , (3.31)


tan b = vy /vx , (3.32)

where u and v are unit vectors given by


ra rb
u = , (3.33)
||r a r b ||
v = u. (3.34)

The force vectors above are written in the global coordinate system. (Warning:
Pay attention the the signs when calculating a and b ).
30 CHAPTER 3. LINE
Chapter 4

Environment

4.1 Wind
This section is dedicated to show details of how we model the wind vector
field and what force it causes on the vessel.

4.1.1 Wind vector field


The general form of the wind vector filed is given by

~v (x, y, z, t) = vx (x, y, z, t)x + vy (x, y, z, t)y + vz (x, y, z, t)z (4.1)

However, for the purpose of simplifying the simulation of the vessel we make
two important simplifications, namely

1. The velocity along the z axis does not cause any measurable effect on
the ship motion, therefore we use vz = 0 on (4.1).

2. We assume the field ~v has a constant direction given by an angle and


varies only with the time t.

With the simplifications (1) and (2) we can cast (4.1) as

~v (t) = v(t)(cos x + sin y). (4.2)

Since the velocity is time-dependent, a convenient way to work with it is by


working with its spectrum, therefore the ideal way of representing is by its

31
32 CHAPTER 4. ENVIRONMENT

discrete fourier expansion. The most general form of such an expansion is


n
X
~v (t) = a0 + ai cos(i t + (i )), (4.3)
i=1

where ai is the amplitude of the ith frequency, i is the ith circular frequency
and (i ) its phase.
Since we work with the energy contained in the signal for a given fre-
quency i we denote
1 2
a = S(i )i , (4.4)
2 i
We have therefore
n
X p
v(t) = a0 + 2S(i )i cos(i t + (i )). (4.5)
i=1

The choise of i and i is made as follows. We first choose the band limit
of the signal i.e. the frequency such that S(i ) = 0 if i > max . Once we
have max we choose n frequencies randomly in the interval [0, max ]. The
phases (i ) are also chosen randomly, in the interval [0, 2].
Lets see the models we use for S(i ). API. This spectrum is given by
the formula  5/3
238.73i
S(i ) = 4.2806 1 + v0 . (4.6)
v0

4.1.2 Wind force

4.2 Wave
This section is dedicated to the mathematical theory used to model waves in
TPN.

4.2.1 Spreading
The general form of the sea energy spectrum is a function that depends on
the direction we observe and on its frequency . Experiments show that di-
rectional characteristics are indenpendent of frequency and vice versa. That
4.2. WAVE 33

means the general form of the wave spectrum can be written as S(, ) =
D()S(), where D() is called wave spreading. To ensure that the spread-
ing
R does not change the wave energy we impose the normalization condition
D()d = 1.
Santos basin. The most used spreading function for the Santos basin is
given by
 
2s
D() = C(s) cos , for ( ) . (4.7)
2
where
(s + 1)
C(s) = (4.8)
2 (s + 1/2)
The parameter s calculated for the Santos basin is given by

s = 20.3952 tanh(0.128Tp 1.88) + 0.3058Hs1.582 + 24. (4.9)

4.2.2 Forces
We consider four kinds of forces acting on a ship due to waves, namely first
order, mean drift, slow drift and wave drift damp. In the following we will use
S() to denote the sea energy spectrum, with being the circular frequency.
Lets talk about each one of forces.
Mean drift. The mean drift force and torque for a wave with frequency
incident with angle is given by fi (, ) = S()Qi (, ), when i = roll or
pitch f is a force and when i = yaw f is the torque around the z axis. The
function Qi (, ) is the quadratic transfer function.
R To calculate the total
mean drift force we have to integrate fi () = 0 fi (, ).
Wave Drift Damp. The formulation of the wave drift damp is more com-
plex than the other forces.

4.2.3 Input data


In the new release of the offshore simulator we provide support for changing
the wave direction and height for arbitrary regions in the simulation grid.
In the previous version, the height and direction provided in the configura-
tion file was used in all the grid, but in some cases we need to change this
34 CHAPTER 4. ENVIRONMENT

behaviour. For example, in regions where the pier arm protects the region
where ships are loading and unloading or for example when there is a plat-
form between the ship and the incident wave. We this effect as the shadow
effect.
Input data for the shadow region is provided in the following form in the
.p3d input file
1 SHADOW WAVE POSITION X = { 3 , 1 0 , 1 3 } ,
2
3 SHADOW WAVE POSITION Y = { 3 , 1 0 , 1 3 } ,
4
5 SHADOW WAVE INTENSITY = { { 0 . 2 , 0 . 7 }
6 , {0.3 , 0.5} } ,
7
8 SHADOW WAVE INTENSITY = { { 1 . 2 , 1 . 3 }
9 , {1.4 , 1.5} } ,
10
11 These t a g s come i n s i d e t h e node
12 FORCE FIELD

The meaning of the example data used can be seem in figure 4.1. For
example, in the region colored in red the new intensity and angle used are
0.2 and 1.2. In the green region 0.7 and 1.3.

4.3 Current
The reasons that leads us to provide support for wave shadow regions, are
also valid for the current. Therefore, changing the current intensity and
direction for a grid region is also supported.

4.3.1 Input data


The way we provide input data to the current shadow regions, is very similar
to way we did for wave shadow regions, the tags in the .p3d file are
1 SHADOW CURRENT POSITION X = { . . . } ,
2
3 SHADOW CURRENT POSITION Y = { . . . } ,
4
5 SHADOW CURRENT VELOCITY X = { { . . . }
4.3. CURRENT 35

x
O

Figure 4.1: Example of shadow region. The grid is pictured in blue and the
shadow regions in red, green, yellow and brown.

6 , {...} },
7
8 SHADOW CURRENT VELOCITY Y = { { . . . }
9 , {...} },
10
11 These t a g s come i n s i d e t h e node
12 VELOCITY FIELD
36 CHAPTER 4. ENVIRONMENT
Appendix A

Appendix

A.1 Mathematical review


This section is dedicated to review some of the mathematical background
used to implement the simulator.

A.1.1 Linear interpolation


Linear interpolation is used in many places in the code, so we make a
very short review here.
Suppose we have a one dimensional data provide in the form (x[i], y[i])
with 0 i < n, where n is the total number of pairs (x, y) and want to
estimate y for a x whose value is in the range x[i] x x[i + 1]. The linear
interpolation uses a straight line to connect x[i] and x[i + 1].
For the given value of x we have then:

y[i + 1] y[i]
y= (x x[i]) + y[i], (A.1)
x[i + 1] x[i]

where i is the greatest i such that x[i] < x. In our implementation, if x < x[0]
or x > x[n 1], y[0] or y[n 1] is returned respectively.

A.1.2 Bilinear interpolation


We also have a demand to interpolate two dimentional functions f (x, y). The
bilinear interpolation used in the simulator is an extension of the linear used

37
38 APPENDIX A. APPENDIX

for one dimensional functions. We define it as follows. Suppose we have


two dimentional data in the form (x[i], y[i], z[i]), where i N and want to
estimate the value of z(x, y) for x[i] x x[i + 1] and y[i] x y[i + 1].
We first interpolate in the x direction to obtain z(x, y[i]) and then in the y
direction to obtain z(x, y).

A.1.3 Rotations
In simulations of rigid bodies we often make coordinate transformations to
change the representation of vectors from one system to another. This pro-
cedure involves rotations, which is the subject of the current section.
We adopt the following conventions, rotations are performed counter-
clockwise, in a right-handed system by pre-multiplication (matrix first). The
sequence of rotations is performed in the following order yaw, pitch and roll,
which will be denoted by XYZ. We will ue the angle for roll, for pitch
and for yaw. The matrices that accomplish this rotations are given by

1 0 0
X() = 0 cos sin , (A.2)
0 sin cos


cos 0 sin
Y () = 0 1 0 , (A.3)
sin 0 cos

cos sin 0
Z() = sin cos 0 . (A.4)
0 0 1

These matrices perform an active rotation, that means the resulting vec-
tor has its components expressed in the same coordinate it was expressed
before, but now it is rotated by the respective angle (active view). We can
also interpret the resulting vector as the same vector but expressed in a
coordinate systems that is rotated by the negative of the passed angle.
Another important property of the matrices above is that their inverse
are obtained by passing the negative angle, for example X 1 () = X() =
X T (). A rotation by the three Euler angles in the convention XYZ is given
A.1. MATHEMATICAL REVIEW 39

by R(, , ) = X()Y ()Z()


cos cos cos sin sin
sin sin cos + cos sin sin sin sin + cos cos sin cos .
cos sin cos + sin sin cos sin sin + sin cos cos cos
(A.5)
We see that

R1 (, , ) = [X()Y ()Z()]1
= Z 1 ()Y 1 ()X 1 ()
= Z()Y ()X()
= Z T ()Y T ()X T ()
= [X()Y ()Z()]T
= RT (, , ). (A.6)

Let us make a review. Say we have a coordinate system (C) whose ori-
entation with respect to (B) is given by the Euler angles (, , ) in the
XYZ convention and the vector ~vA expressed in (B). To obtain ~vC we do
~vC = R(, , )~vA . On the other hand, if we have ~vC and want to
obtain ~vB we do ~vB = RT (, , )~vC

A.1.4 Calculus of variations


A.1.5 Newton Raphson