Você está na página 1de 73

Institutionen fr systemteknik

Department of Electrical Engineering


Examensarbete

Ship Power Estimation for Marine Vessels Based on System Identication

Examensarbete utfrt i Reglerteknik vid Tekniska hgskolan vid Linkpings universitet av Jonas Kllman LiTH-ISY-EX--12/4604--SE
Linkping 2012

Department of Electrical Engineering Linkpings universitet SE-581 83 Linkping, Sweden

Linkpings tekniska hgskola Linkpings universitet 581 83 Linkping

Ship Power Estimation for Marine Vessels Based on System Identication

Examensarbete utfrt i Reglerteknik vid Tekniska hgskolan vid Linkpings universitet av


Jonas Kllman LiTH-ISY-EX--12/4604--SE

Handledare:

Jonas Linder
isy, Linkpings universitet

Dr. Johan Sjberg


ABB Corporate Research

Examinator:

Dr. Martin Enqvist


isy, Linkpings universitet

Linkping, 15 juni 2012

Avdelning, Institution Division, Department Avdelningen fr reglerteknik Department of Electrical Engineering SE-581 83 Linkping Sprk Language Svenska/Swedish Engelska/English Rapporttyp Report category Licentiatavhandling Examensarbete C-uppsats D-uppsats vrig rapport ISBN ISRN

Datum Date

2012-06-15

LiTH-ISY-EX--12/4604--SE Serietitel och serienummer Title of series, numbering ISSN

URL fr elektronisk version


http://urn.kb.se/resolve?urn=urn:nbn:se:liu:diva-XXXXX

Titel Title

Skattning av eekt fr marina farkoster baserat p systemidentiering Ship Power Estimation for Marine Vessels Based on System Identication

Frfattare Author

Jonas Kllman

Sammanfattning Abstract Large marine vessels carry their loads all over the world. It can be a container ship carrying over 10 000 containers lled with foods, textiles and electronics or a bulk freighter carrying 400 000 tons of coal. Vessels usually have a ballast system that pumps water into ballast tanks to stabilize the vessel. The ballast system can be used to change the vessels trim and list angles. Trim and list are the ship equivalents of pitch and roll. By changing the trim angle the water resistance can be reduced and thus also the fuel consumption. Since the vessel is consuming a couple of hundred tons of fuel per day, a small reduction in fuel consumption can save a considerable amount of money, and it is good for the environment. In this thesis, the ships power consumption has been estimated using an articial neural network, which is a mathematical model based on data. The name refers to certain structural similarities with the neural synapse system in animals. The idea with neural networks has been to create brain-like systems. For applications such as learning to interpret sensor data, articial neural networks are an eective learning method. The goal is to estimate the ship power using a articial neural network and then use it to calculate the trim angle, to be able to save fuel. The data used in the articial neural network come from sensor systems mounted on a container ship sailing between Europe and Asia. The sensor data have been thoroughly preprocessed and this includes for example removing the parts when the ship is docked in harbour, data patching and synchronisation and outlier detection based on a Kalman lter. A physical model of a marine craft including wind, wave, hydrodynamic and hydrostatic eects, has also been introduced to help analyse the performance and behaviour of the articial neural network. The articial neural network developed in this thesis could successfully estimate the power consumption of the ship. Based on the developed networks it can be seen that the fuel consumption is reduced by trimming the ship by bow, i.e., the ship is angled so the bow is closer to the water line than the stern. The method introduced here could also be applied on other marine vessels, such as bulk freighters or tank ships.

Nyckelord Keywords

Articial neural network, Marine craft modelling, System identication, Optimal trim

Sammanfattning
Stora marina fartyg fraktar sina laster vrlden ver. Det kan vara ett containerfartyg med ver 10 000 containrar fyllda med mat, klder och elektronik eller ett bulkfartyg lastat med 400 000 ton kol. Fartygen har ofta ett ballastsystem som pumpar in vatten i tankar fr att stabilisera fatyget. Ballastsystemen kan ven anvndas fr att ndra tipp- och listvinkeln p fartyget. List r btens motsvarighet till ygplanets roll. Genom att ndra tippvinkeln kan man minska motstndet nr fartyget tar sig fram i vattnet, och drmed ven brnslefrbrukningen. Fartyget gr av med ett par hundra ton brnsle per dygn s en liten minskning i brnslefrbrukning kan spara stora summor pengar. Det r ven bra fr miljn. I det hr examensarbetet har fartygets eektfrbrukning skattats med hjlp av ett articiellt neuronnt, vilket r en matematisk modell baserad p data. Idn bakom neuronnten r att skapa hjrnliknande modeller. Fr tillmpningar s som att tolka sensordata r articiella neuronnt r en vldigt eektiv metod. Mlet r hr att skatta ett fartygs eekt med hjlp av ett articellt neuronnt och sedan anvnda det fr att rkna ut den optimala tippvinkeln, fr att kunna spara brnsle. Datan som har anvnts fr att ta fram neuronntet kommer frn ett containerfartyg som har en rutt mellan Europa och Asien. Sensordatan har blivit grundligt frltrerad och det inkluderar till exempel att ta bort delarna d fartyget benner sig i en hamn, att lappa ihop och synkronisera datan och att ta bort avvikande mtvrden med hjlp av ett kalmanlter. En fysikalisk modell av en marin farkost har introducerats fr att hjlpa till att analysera prestandan och beteendet hos det articiella neuronntet. Det articiella neuronnt som utvecklats i det hr examensarbetet kan skatta fartygets eektfrbrukning med hyfsad precision. Den optimala tippvinkeln har rknats ut med hjlp av de utvecklade neuronnten och man kan se att det r mest eektivt att kra med bten framtlutad. Den metod som har introducerats hr kan mycket vl tillmpas p andra fartyg s som bulk- eller tankfartyg.

iii

Abstract
Large marine vessels carry their loads all over the world. It can be a container ship carrying over 10 000 containers lled with foods, textiles and electronics or a bulk freighter carrying 400 000 tons of coal. Vessels usually have a ballast system that pumps water into ballast tanks to stabilize the vessel. The ballast system can be used to change the vessels trim and list angles. Trim and list are the ship equivalents of pitch and roll. By changing the trim angle the water resistance can be reduced and thus also the fuel consumption. Since the vessel is consuming a couple of hundred tons of fuel per day, a small reduction in fuel consumption can save a considerable amount of money, and it is good for the environment. In this thesis, the ships power consumption has been estimated using an articial neural network, which is a mathematical model based on data. The name refers to certain structural similarities with the neural synapse system in animals. The idea with neural networks has been to create brain-like systems. For applications such as learning to interpret sensor data, articial neural networks are an eective learning method. The goal is to estimate the ship power using a articial neural network and then use it to calculate the trim angle, to be able to save fuel. The data used in the articial neural network come from sensor systems mounted on a container ship sailing between Europe and Asia. The sensor data have been thoroughly preprocessed and this includes for example removing the parts when the ship is docked in harbour, data patching and synchronisation and outlier detection based on a Kalman lter. A physical model of a marine craft including wind, wave, hydrodynamic and hydrostatic eects, has also been introduced to help analyse the performance and behaviour of the articial neural network. The articial neural network developed in this thesis could successfully estimate the power consumption of the ship. Based on the developed networks it can be seen that the fuel consumption is reduced by trimming the ship by bow, i.e., the ship is angled so the bow is closer to the water line than the stern. The method introduced here could also be applied on other marine vessels, such as bulk freighters or tank ships.

Acknowledgments
This masters thesis is the nal part of my masters degree in Electrical Engineering at The Institute of Technology at Linkping University. It has been carried out at ABB Corporate Research in Vsters. I would like to thank Dr. Johan Sjberg, my supervisor at ABB, for his guidance and input during this thesis. I am very grateful for all the support and good ideas. Jonas Linder, my supervisor at Linkping University, has been a great help to me. He always took the time to answer my questions and to help me move forward if I was stuck. I really appreciate all the time and eort he has put in to help me. I want to express my gratitude to Dr. Martin Enqvist, my examiner, for his ideas and input throughout the thesis. I would also like to thank all my colleagues at ABB Corporate Research. It has been a pleasure working with them. Finally, I would like to thank my friends and family, and my parents especially, for always supporting me. Vsters, June 2012 Jonas Kllman

vii

Contents

1 Introduction 1.1 Background . 1.2 Purpose . . . . 1.3 Goals . . . . . 1.4 Limitations . . 1.5 Method . . . . 1.6 Thesis Outline

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

1 1 2 2 2 2 3

Theory and Method


. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 7 8 9 9 10 13 13 16 19 20 21 21 21 22 27 27 27 28

2 Modelling 2.1 Notation . . . . . . 2.2 Reference Frames . 2.3 Rigid-body Kinetics 2.4 Hydrostatics . . . . 2.5 Sea-keeping . . . .

3 Sensors 3.1 Available Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Preprocessing 4.1 Data Pruning . . . . . 4.2 Data Patching . . . . 4.3 Data Synchronisation 4.4 Outlier Detection . . 4.5 The CUSUM LS Filter

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

5 Artical Neural Network 5.1 Network Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.1 Multilayer Feed-forward Network . . . . . . . . . . . . . . . 5.1.2 Neuron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ix

CONTENTS

5.2 Training . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.1 Backpropagation . . . . . . . . . . . . . . . . . . . . . . . .

29 29

II

Results
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 35 36 38 40 42 44 44 45 46 47 51 57

6 Ship Power Estimation Based on ANN 6.1 The Data Set . . . . . . . . . . . . 6.2 Dierent ANNs . . . . . . . . . . 6.2.1 Network Performance . . . 6.3 Modied CUSUM Algorithm . . . 6.4 Optimal Trim . . . . . . . . . . . 6.5 Missing Signals . . . . . . . . . . 6.6 Summary . . . . . . . . . . . . . .

7 Conclusion 7.1 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A Fit and Error B Optimal Trim Bibliography

Introduction

This is the report for the masters thesis Ship Power Estimation for Marine Vessels based on System Identication. The masters thesis has been performed at ABB Corporate Research in Vsters.

1.1

Background

Large marine vessels carry their loads all over the world. It can be a container ship carrying over 10 000 containers lled with foods, textiles and electronics or a bulk freighter carrying 400 000 tons of coal. Vessels usually have a ballast system that pumps water into ballast tanks to stabilize the vessel. The ballast system can be used to change the vessels trim and list angles. Trim and list are the ship equivalents of pitch and roll. By changing the trim angle the water resistance can be reduced and thus also the fuel consumption. Since the vessel is consuming a couple of hundred tons of fuel per day, a small reduction in fuel consumption can save a considerable amount of money. Other resistances aecting the vessel are for example wind, wave and fouling (growth of algae and other marine life forms on the hull of the ship). It is hard to nd the optimal trim angle without some technical aid. By creating a mathematical model that describes how the dierent resistances aect the vessel, it is possible to estimate the increase in resistance caused by a non-optimal trim angle. The optimal setting can then be found based on sensor measurements and the ballast system can be used to eectuate the desired trim angle.
1

Introduction

1.2

Purpose

The purpose of this thesis is to nd the optimal trim angle using a model and sensor data.

1.3

Goals

The goal is to develop a model for a container ship that can be used to nd the optimal trim angle. The goal is also to evalutate the method of using an articial neural network as modelling strategy. The work can be split into the sub-goals: Develop a physical model of a vessel. The model should include wind, wave, hydrodynamic and hydrostatic eects. Preprocess the data from a container ship. Develop and evaluate an articial neural network using the sensor data. The articial neural network is a data-driven model.

1.4

Limitations

The vessel is assumed to have a constant course and speed. The vessel will only be modelled as a rigid body and assumed to be wall-sided, see Section 2.4. All measurement values are assumed to have been collected while the ship was stationary, i.e., with constant speed and heading. In reality the ship is rotating and there are accelerations involved that aect the measurements.

1.5

Method

To begin with, a theoretical study on marine craft modelling has been performed. This has been the foundation for the thesis and the physical modelling is one of the modelling strategies used. All data from the ship have been analysed to determine what sensor data are available and the characteristics of the sensor data. The data have been preprocessed before being used for system identication. It has also been necessary to calibrate the sensors, i.e., compensate for incorrect mounting. Finally, an articial neural network has been created based on the sensor data and used to nd the optimal trim angles.

1.6

Thesis Outline

1.6

Thesis Outline

The structure of this masters thesis is as follows. Chapter 2 covers the physical modelling and theory relating to marine vessels. In Chapter 3, all the sensors and available signals are introduced. Furthermore, Chapter 4 presents the methods used during the preprocessing of data. After that, articial neural networks are presented in Chapter 5. The resulting performance of the developed neural networks are presented in Chapter 6 together with a discussion. Finally, Chapter 7 contains a short summary and the conclusions drawn from the produced results. Some extra plots are included in Appendix A and B.

Part I

Theory and Method

Modelling

By creating a model based on physical relations and sensor data, a more realistic model than a black-box one can be produced. A model with the hydrodynamic, hydrostatic, wind, wave and propulsion forces can be developed. The power lost from bad trim and list angles is accounted for in the hydrodynamic, wind and wave forces. The hydrodynamics include all forces that come from the hydrodynamic pressure when the vessel is moving. The hydrostatic forces are caused by the interactions between gravity and the buoyancy force. This force tries to bring the ship back to its equilibrium, assuming it is stable (Fossen, 2011).

2.1

Notation

The marine craft is modelled with six degrees of freedom (DOFs). Therefore six independent coordinates are needed to determine the position and orientation. The rst three coordinates, and their time derivatives, correspond to the position and translational velocity along the x, y, and z axes while the last three coordinates and their time derivatives are used to describe orientation and rotational velocity. For marine craft, the six dierent components are denoted as surge, sway, heave, list, trim and yaw (Fossen, 2011). Table 2.1 and Figure 2.1 show the notation used to describe the motions of the vessel. Surge is the forward and backward movement, sway is the sideways movement and heave is the up and down movement of the vessel.
7

Modelling

DOF 1 2 3 4 5 6

Table 2.1: The notation for marine vessels. Linear and angular velocities motion, x direction (surge) u motion, y direction (sway) v motion, z direction (heave) w rotation, x axis (roll, list, heel) p rotation, y axis (pitch, trim) q rotation, z axis (yaw) r

Positions and Euler angles x y z

2.2

Reference Frames

n , y n , z n )T is earth-xed The North-East-Down (NED) coordinate system {n } = (x with origin on in earths centre. The coordinate system is assumed to be an inertial frame, i.e., without any Coriolis eect due to earths rotation (Fossen, 2011). It is common to dene some body-xed reference points. Their location depends on how the ship is loaded and the shape of the hull. 2.1 Denition (Centre of Gravity). The centre of gravity (CG) is dened as the centre of gravity for the ship. It will change during the journey when fuel is consumed and water is pumped in to the ballast tanks. 2.2 Denition (Centre of Origin). The centre of origin (CO) is dened as the centre of origin for the body-xed coordinate system. 2.3 Denition (Centre of Buoyancy). The centre of buoyancy (CB) is dened as the centre of gravity for the volume of displaced water. In other words, the centre of gravity for a body of water shaped like the part of the vessel that is below the waterline. 2.4 Denition (Centre of Flotation). The centre of otation (CF) is the centroid of the water plane area in calm water. The marine craft will roll and pitch around this point. b , y b , z b )T is a moving coordinate system The body-xed reference frame {b } = (x xed to the vessel. It can simplify the equations of motion to place the origin CO in a strategic place, for example in the centre of gravity CG (Fossen, 2011). It should be noted that the location of CG changes, e.g., when the ship is changing the water in the ballast tanks and consuming fuel. It might therefore be benecial to place CO at a xed position. Figure 2.1 shows the motions in six degrees of freedom in the body-xed reference frame. All equations are expressed in the body-xed reference frame {b } unless otherwise stated.

2.3

Rigid-body Kinetics

Sway
b y

Trim

List
b x

Yaw

Surge
b z

Heave

Figure 2.1: Ships motion in six degrees of freedom. s , y s , z s )T is xed to the ships equilibThe sea-keeping reference frame {s } = (x rium state. Hence, in the absence of wave excitation, the {s }-frame origin coincides with the location of the {b }-frame origin.

2.3

Rigid-body Kinetics

When deriving the marine craft equations of motions, the ship is assumed to be rigid, i.e., the hull shape will not change even if a force acts upon it. The rigidbody kinetics for a general system can be expressed as + C RB = RB M RB (2.1)

where M RB is the rigid-body inertia matrix, C RB is the rigid-body Coriolis and centripetal matrix due to the rotation of {b } about the inertial frame {n }, = [u, v, w, p, q, r]T is the generalized velocity vector expressed in {b } and RB is a generalized vector of forces and moments expressed in {b }.

2.4

Hydrostatics

The hydrostatic forces and moments are restoring forces due to gravity and buoyancy that act to keep the ship in equilibrium. These forces and moments are

10

Modelling

proportional to the displacement volume (Perez, 2005). The chosen load condition or weight distribution will determine the heave, roll and pitch periods of a marine craft (see Fossen (2011), p. 71-74). Static stability considerations due to restoring forces are usually referred to as metacentric stability in the hydrostatic literature. A metacentric stable vessel will resist inclinations away from its steady-state or equilibrium points in heave, roll and pitch. A vessel is stable if its metacentre is above CG. If the metacentre is much higher than CG, the stability margin and robustness is large. It will however be very uncomfortable for the passengers on-board. The restoring forces will depend on the vessels metacentric height, see Figure 2.3, the location of the CG and CB, as well as the shape and size of the water plane (Fossen, 2011). If the ships walls are vertical to the water plane when the ship is oating upright, the structure is said to be wall-sided (Journe and Massie, 2001). The calculation of the metacentre is easy in this special case. The modelling has been done with six degrees of freedom. The metacentre N is the intersection of the lines through the vertical buoyant forces at zero list angle, see Figure 2.2, and at list angle , see Figure 2.3. The position of the metacentre depends on the new position of the CB, and thus the shape of the emerged body and near the bodys water plane. Figure 2.3 shows how a line goes through the CB, in the direction given by the buoyancy force, for both the case with the list angle zero and angle (Journe and Massie, 2001).

CF

Water line Gravity

CB Buoyancy force

Figure 2.2: The vessel with zero list angle. The vertical dashed line from CB has the same direction as the buoyancy force.

2.5

Sea-keeping

Fossen (2011) mentions sea-keeping and describes it as the study of the motion of marine craft at constant course and speed when there is wave excitation. This includes the trivial case of zero speed. In sea-keeping analysis, a dissipative force known as uid memory eects, , is introduced. The equations of motion for a marine craft from Fossen (2011) can be written as = J ( ) (2.2)

2.5

Sea-keeping

11

CF

Water line Gravity

CB Buoyancy force

CB Old buoyancy force

Figure 2.3: The vessel with list angle . A new vertical dashed line from the new centre of buoyancy in the direction of the buoyancy force is added. The metacentre N is the intersection between the two lines in the buoyancy direction, old and new.

and r + C A r + D r + + G + g0 = + wind + wave (2.3) + C RB + M A M RB where is the positions and Euler angles and is the linear and angular velocities, see Table 2.1. The hydrodynamic added mass M A is a virtual mass. It is added because an accelerating or decelerating body must move a volume of water as it passes through it, since they can not occupy the same space. The Coriolis and centripetal matrix C A is due to the rotation of {b } about the sea-keeping frame {s }. The damping force D consists of damping forces, such as linear viscous damping and linear potential damping, see Fossen (2011, p.122-127). G + g0 is the restoring and ballast forces. The uid memory eect represents the energy transfer from the motion of the ship into the water in terms of radiated waves (Perez and Fossen, 2011). The dierent forces can be divided into categories according to Table 2.2. Table 2.2: The dierent forces divided into categories. + C RB + M A r + CA r Inertia forces: M RB Damping forces: Dr + Restoring forces: G + g0 Propulsion forces: Wind and wave forces: wind + wave

M A , C A and can be computed using hydrodynamic programs and potential theory. It is assumed that the uid is inviscid (no viscosity), the ow is irrotational and the water incompressible. Winds will aect the ship resistance dierently depending on which direction they come from. The ship will have a reduced speed if it is sailing in a head wind

12

Modelling

and there will be a rolling moment if there is a side wind. Waves will cause an added resistance of the ship due to extra ship motions and bow reections. Wind and waves can cause a lot of problems for the ship. Ship motions and sea loads can reduce the speed signicantly both voluntary and involuntary. The voluntary speed reduction is when the ship master reduces the speed due to large accelerations of water on deck. Involuntary speed reductions are the result of added resistances due to waves and wind and change in the propeller eciency due to waves (Faltinsen, 1990).
Fouling

Fouling is algae, barnacles and other marine life forms that grow on the wetted surface of the hull. It increases the friction between the water and the hull, and thus also the fuel consumption. The fouling increases over time and can become a large part of the total resistance if the ship has sailed for a long time without hull maintenance. For the rst three years, the fouling resistance increases linearly. After that the increase is exponential (Aas-Hansen, 2010).

Sensors

The sensor data that have been available in this project come from a large container ship sailing between Asia and Europe. Most of the sensors are installed by the manufacturer and therefore there is no available information about the sensors, such as model or manufacturer. This chapter describes the available sensors on the ship.

3.1

Available Signals

This section will list all available signals and a short description of them.
Draught

Draught (m ) is the depth of the ship, from keel to water line. The draught is measured by pressure sensors both in forward dfwd and aft daft . See Figure 3.1 for the placement of the sensors.
Draught radar

The draught radar measures the distance in metres from the railing down to the water line. There is one sensor on each side, starboard dsb and port dport , of the ship.
Trim and List

The trim angle (degrees ) is the equivalent of pitch for an air-plane. The trim is measured by a separate sensor but can also be calculated from = arcsin dfwd daft 180 Lt
13

(3.1)

14

Sensors

where Lt is the distance between the sensors in metres. The trim is measured with positive value when the ship is trimmed by bow, meaning the bow is pointing downwards. An illustration can be seen in Figure 3.1. The trim can be changed by controlling the water in the ballast tanks. By changing the trim it is possible to decrease the fuel consumption, but also to increase the manoeuvrability.

daft Lt Draught sensors

dfwd

Waterline Trim

Figure 3.1: Illustration showing how draught and trim are dened. In the same way as trim, the list angle (degrees ) is the equivalent of roll for an airplane. The list is measured by the same sensor as the trim but can also be calculated from dport dsb 180 = arctan (3.2) Ll where Ll is the distance between the sensors in metres and dport and dsb are the draught radar measurements. Similar to the trim it is possible to change the list using the ballast tanks. However the main objective with changing the list is to correct an unevenly loaded ship.
RPM

RPM is the revolutions per minute for the main engine. RPM is strongly correlated to shaft power since the propeller is directly connected to the engine, see Figure 3.2. During constant speed the correlation is close to one.
Shaft power

The shaft power (kW ) is the power delivered to the propulsion shaft. The shaft power is directly related to the fuel consumption and will therefore be the output of the neural network model.
GPS data

A GPS device is installed on the ship and the ships position is stored in the geographic coordinates, longitude and latitude.

3.1

Available Signals

15

RPM

Value

Time Shaft power

Value

Time

Figure 3.2: RPM and shaft power measurement for a period of six days.
Speed over ground

Speed over ground (SOG) is the velocity relative to the ground. It is measured in b -axis) and transversal (along the y b -axis) knots for both longitudinal- (along the x velocity.
Speed through water

Speed through water (STW) is the velocity relative to the water. It is measured in b -axis) and transversal (along the y b -axis) knots for both longitudinal- (along the x velocity. In dierence to SOG, STW depends on water currents.
Water depth

The water depth is measured in metres and is important because of the hydrodynamic phenomenon called the squat eect. The squat eect occurs when the ship is travelling in shallow water, which creates a hydrodynamic pressure around the hull (Hrting, Laupichler and Reinking, 2009). This pressure increases the ships resistance while travelling through water and thus also the fuel consumption.
Rudder angle

The rudder (degrees ) must sometimes have a constant non-zero angle to keep the ship on a straight course. This is to compensate for external forces such as

16 currents and wind.


Wind

Sensors

The sensor systems measure relative wind speed (kn ) in longitudinal (along the b -axis) and transversal (along the y b -axis) direction. x

3.2

Calibration

There is a high probability that the sensor that measures the trim and list angles is incorrectly mounted and needs to be corrected. The sensor calculates the trim and list angles by measuring the direction of the normalised gravitational acceln , in relation to its own coordinate system {sensor } = (x sensor , y sensor , eration g = z sensor )T . If the sensor is correctly mounted, {sensor } will coincide with {b }, see z Section 2.2, independent of the ship rotation. If the ship is upright, both {sensor } and {b } will coincide with {n }. Since {n } is an inertial reference frame, its z-axis will always correspond to the gravitational acceleration. The transformations between the coordinate systems are dened as 0 n = 0 g=z (3.3a) 1 ab = Rb n (ship , ship , 0)g asensor = Rsensor (, , )ab = Rsensor (, , )Rb n (ship , ship , 0)g b b (3.3b) (3.3c)

where ab is the normalized gravitational acceleration expressed in {b } and asensor is the normalized gravitational acceleration expressed in {sensor }. The angles (ship , ship , 0) dene the rotation of the ship. The sensor is rotated by (, , ) relative to the ship. The rotation matrix is dened as cc sc + css (, , ) = Rsensor b ss + ccs sc cc + sss cs + ssc s cs cc

(3.4)

where (, , ) is the rotation angles for the sensor and c = cos , s = sin , etc. The sensor is assumed to have been rotated by the matrix Rsensor (, , ) and b it is this matrix that is sought. The ship rotation (ship , ship ) can be expressed by the rotation matrix Rb n (ship , ship , 0) with the yaw angle = 0. The rotation b matrix Rn (ship , ship , 0) is equal to Rsensor (, , ) but with dierent angles. b The draught sensors can be used to calculate the true trim and list angles but they are not reliable when the ship is moving, since there are a lot of pressure variations around the hull then. By taking data from the end of a harbour section, and assuming that the trim and list angles calculated from the draught sensors are correct, it is possible to estimate the rotation of the sensor in three degrees of freedom.

3.2

Calibration

17

The ship rotation can be calculated based on the measurements from the draught sensors and from the fact that yaw has no impact on these measurements. No matter how much the ship is rotating around the z-axis of {n }, the depth of the sensors will not change. Given the measurements, the ship rotation matrix can be found by using the MATLAB optimisation function fminsearch. It will nd the trim and list angles that minimize the dierence between the calculated and measured angles,
ship ,ship

min

calculated data calculated data

(3.5)

subject to ab = Rb n (ship , ship , 0)g calculated = atan2(ab,x , ab,z ) calculated = atan2(ab,y , ab,z ) (3.6) (3.7) (3.8)

where (, )calculated is the calculated value of the trim and list angles and (, )data is the trim and list angles obtained from the draught measurements using (3.1) and (3.2). The operation atan2 is the four quadrants inverse tangent. The reason for the minus signs in (3.7) is that the sensor and {b } have dierent denitions for the positive rotation. The next step is to calculate the rotation matrix Rsensor (, , ). Since the trim b and list sensor does not measure yaw angle it is necessary to use several data points to get an accurate estimate of Rsensor (, , ). By using Rb n (ship , ship , 0), b ab can be calculated according to (3.3b) for each data point. By once again solving an optimisation problem
m ,,

min

i =1

calculated,i data,i data,i calculated,i

(3.9)

subject to asensor = Rsensor (, , )Rb n (ship , ship , 0)g b calculated = atan2(asensor,x , asensor,z ) calculated = atan2(asensor,y , asensor,z ) (3.10) (3.11) (3.12)

)data comes from the trim and where m is the number of measurements and (, list sensor, the rotation of the sensor (, , ) is found.

Preprocessing

4
(4.1a) (4.1b)

In order to be able to use the data, it is important that it does not contain false or irrelevant information. This means that all data must be preprocessed. Irrelevant sections must be removed, missing data points restored, time series synchronised and outliers removed. This chapter describes everything that has been done to the data series to achieve a more accurate and organised data set. For parts of the preprocessing, a Kalman lter has been used. A Kalman lter estimates the states of a linear state space model (Gustafsson, 2010). All sensors are non-uniformly sampled and data is stored in a database. The data used for the neural network is the average value for each minute, so there is one sample for each minute. Algorithm 4.1: The Kalman lter The Kalman lter estimates the states for the linear state space model xk +1 = Fk xk + Gu,k uk + Gv,k vk , yk = Hk xk + Dk uk + ek , Cov (vk ) = Qk , Cov (ek ) = Rk .

where ek and vk are white noise, yk is a vector containing all measurement values and x is a vector containing the states. The model parameters include Fk , Gu,k , Hk , Dk . The state estimates are computed by iterating: 1. Measurement update
T T k |k = x k |k 1 + Pk |k 1 Hk k |k 1 Dk uk ) x (Hk Pk |k 1 Hk + Rk )1 (yk Hk x T T Pk |k = Pk |k 1 Pk |k 1 Hk (Hk Pk |k 1 Hk + R k ) 1 H k P k | k 1

19

20

Preprocessing

where Pk |k is the state covariance matrix given measurements up to time k . A lower covariance indicates a better estimate of x. 2. Time update k +1|k = Fk x k |k + Gu,k uk x
T T Pk +1|k = Fk Pk |k Fk + Gv,k Qk Gv,k

where xk +1|k is the predicted value of x at time k + 1 given y values up to time k . In practice, the process noise covariance Qk and the measurement noise covariance Rk are design variables. The relation between them denes whether the measurement value or the model is more reliable. In the scalar case and if Q << R, the model is considered more reliable than the measurement values. If Q >> R, the model is considered less reliable than the measurement values.

Here, it is assumed that all measurements are independent of each other, which means that one Kalman lter can be implemented for each sensor. The Kalman lter implemented to help with the preprocessing has the model parameters Fk = Hk = Gv,k = 1 Gu,k = Dk = 0 With these model parameters, the state x is assumed to be constant with a process noise v and y is equal to the sum of the state x and measurement noise e. Since there is no input, both Gu,k and Dk is chosen as zero. The design parameters Q and R are chosen dierently for all sensors but in general, Q > R since the measurements are trusted more than the simple model. Since one Kalman lter is implemented for each sensor, both Step 1 and 2 in Algorithm 4.1 are scalar operations.

4.1

Data Pruning

The interesting data sections are when the ship is stationary, i.e., sailing at a fairly constant speed. This means that the parts when the ship is in harbour are removed. The same applies for the start and end of a journey. The harbour sections are identied by checking when the GPS data is constant for a period of over 3 hours. These sections are considered harbour sections and are removed. However, they are used for the calibration of the sensors. The start and end of a journey are removed by sorting out the sections where the RPM and speed are stable. These two operations will generate several sections of data.

4.2

Data Patching

21

4.2

Data Patching

In some of the data series, there is a sensor measurement missing. A sample, which is all measurement values at time t , cannot be used for the articial neural network unless there is a measurement value from each sensor. There are two ways of solving this. That sample can be removed for all sensors, and thus throwing away correct data. The other option is to estimate the missing value. Since there is not so much data available, the latter method has been chosen. The measurement value is estimated by using the Kalman lter, i.e., the measurement value is set to the estimated x value of the Kalman lter. The Kalman lter should give a rather accurate estimate of the correct value in most cases.

4.3

Data Synchronisation

To avoid having data series where the measurement from one sensor is missing, the data series are synchronised. This is done by removing all data points where one or more sensor measurements are missing. Since the data was previously patched, this can only occur in the beginning or end of a section. This should be done for each section 1. Find the starting point and end point for all sensors. 2. Find the latest starting point and the earliest end point. 3. Remove all samples before the latest starting point. 4. Remove all samples after the earliest end point.

4.4

Outlier Detection

It is important to detect outliers in the data set. This has been done using a test of the two hypotheses of inliers and outliers based on the Kalman lter. The outlier test is based on a normalized residual k = (Pk |k 1 + Rk )1/ 2 (yk x k |k 1 ) N (0, 1) (4.2)

which is Gaussian distributed in case of a linear Gaussian model and if all measurements are inliers. Since the measurements are independent, the outlier test for each sensor can be done using the test statistic
i i i k |k 1 )T (Pk |k 1 + Rk )1 (yk k |k 1 ) 2 (ni T ( yk ) = (yk x x y)

(4.3)

where ni y is the number of sensor measurements, which in this case is one. A measurement is considered an outlier if
i 2 i T ( yk ) > ( ny )

(4.4)

22

Preprocessing

2 (ni ) is the 2 where is the probability for which an inlier is rejected and y distribution for ni y degrees of freedom (Gustafsson, 2000). When a measurement k |k 1 , i.e., no measurement update is done. is considered an outlier, it is set to x

Figure 4.1 and 4.2 illustrate how the outliers are removed in the shaft power measurements. The algorithm works well and Figure 4.1 shows how the most obvious outliers are removed. Figure 4.2 is zoomed in and shows how an outlier is corrected.
x 10
4

Measured shaft power

6 Shaft power

0 Time 6 Shaft power x 10


4

Shaft power with outliers removed

3 Time

Figure 4.1: Above: shaft power before the outliers have been removed. Below: shaft power once the outliers have been removed.

4.5

The CUSUM LS Filter

Since the neural network model is stationary it cannot handle accelerations. This means that only sections with a constant velocity can be considered. An adaptive CUSUM lter has been used to sort out such sections. CUSUM LS stands for CUmulative SUM Least Squares. The CUSUM lter will give an alarm when the measurement exceeds a specied threshold. The adaptive CUSUM lter is able to reset and can therefore be used to detect several stationary sections with dierent values (Gustafsson, 2000). Some modications to the

4.5

The CUSUM LS Filter

23

5 4.5 4 3.5 Shaft power 3 2.5 2 1.5 1 0.5

x 10

Shaft power with and without outliers removed

Time

Figure 4.2: The gure shows shaft power before and after the outliers are removed. The circles are the original measurements and the crosses are the corrected measurements. This is a zoomed in part of Figure 4.1. original algorithm, Algorithm 3.3 in Gustafsson (2000), have been done and the modied algorithm is as follows Algorithm 4.2: The CUSUM LS lter estimated constant level. The error The measurement value at time t is yt and st is the measurement deviation from the estimate. The test statistic gt increase if the error is larger than the drift and give an alarm if than the threshold h. = yt 0 st = yt gt gt Alarm if gt
(1) (1) (i ) gt (i )

will

is larger

= max(gt 1 + st , 0) = max(gt 1 st , 0)
(2)

(1)

(2)

> h or gt

(2)

>h

Design parameters: , h. After an alarm, reset gt = 0, gt = 0 and t0 = t . The new estimated constant will be equal to the y -value at the alarm time, yt . level 0
(1) (2)

24

Preprocessing

The sample at time t as well as the 30 samples previous to the alarm will be removed. This is because the whole section when the velocity is changing should be removed. The dierence between the two algorithms is how the estimated constant level is is dened as the mean value of the sensor dened. In the original algorithm, values from t0 to t . If the error is constantly larger than the drift, i.e., the speed is changing to a new constant level, the test statistic will grow for each iteration until it is larger than the threshold h and give an alarm. The change in speed occurred some time before the alarm and that is why the 30 previous samples are removed. The (1) (2) test statistic gt detects increases in speed and gt detects decreases in speed. Figure 4.3 shows how the test statistic grows as the speed is changing. The dashed line in the lower plot is the threshold, but the test statistic is never reset in this example. As can be seen the test statistic will not give an alarm until t = 5.7, even though the speed starts to change at t > 5.
Speed

Value 0

6 Time Test statistic g1


t

10

12

Value 0

6 Time

10

12

estimate. Below: Figure 4.3: Above: Speed data. The dashed line is the The test statistic. It is slowly increasing while the speed measurement is . The dashed line is the threshold. The vertical dotted line deviating from is the time of alarm.
Modications of the CUSUM LS lter

is the mean value of the sensor values from t0 to t . In the original algorithm, However, this does not yield a good result since if there is an alarm in the middle of a step in the velocity, the new level will be in the middle of that step, between

4.5

The CUSUM LS Filter

25

is chosen as the mean value, the remainder of the step the two constant levels. If might not be big enough to generate an error right away. Thus, that undesired is chosen as the sensors value sample will be part of a stationary section. If at t0 it will give an alarm in the next few samples because of gt becoming larger and thus that section will be removed. An illustration since it deviates from can be seen in Figure 4.4.
Original CUSUM

Value

Time Modified CUSUM

Value

Time

Figure 4.4: Above: data from original CUSUM lter. The circled part is the undesired part received with the original CUSUM lter. Below: data from modied CUSUM lter. As explained earlier, the algorithm will give an alarm when the test statistic is above the threshold. This will happen some time after the actual change in speed, depending on how steep the increase is. If it gives an alarm while the speed is changing (5 < t < 6 in the upper plot of Figure 4.3) and the modied algorithm will be set to the current measurement value. The is used, the new estimate test statistic will keep growing since the error will always be higher than the estimate. Eventually it will give an error and that part will be removed, see the lower plot in Figure 4.4. The dierence between the two estimated constant levels keeps changing in the can is depicted in Figure 4.5. The upper plot shows how original algorithm. In the lower plot, is held constant at the same value as the measurement when the previous alarm was triggered. If the original algorithm is used, the estimate will be the mean value of all measurement values from the time of the last alarm up to the current time. This will cause the error to decrease with time and eventually disappear until the speed is changing again.

26

Preprocessing

Original Algorithm

Value 0

6 Time Modified Algorithm

10

12

Value 0

6 Time

10

12

for both plots. Figure 4.5: The dashed line is the estimated constant level Above: estimated constant level is changing as time progresses in the orig is held constant until next alarm in the modied inal algorithm. Below: algorithm.

Artical Neural Network

An articial neural network (ANN), also called neural network, is a mathematical model based on data. The name refers to certain structural similarities with the neural synapse system in animals (Ljung, 1999). The idea with neural networks has been to create a brain-like system. For applications such as interpretation of sensor data, ANN is an eective learning method (Mitchell, 1997, p.81).

5.1

Network Structure

A neural network is built out of an interconnected set of articial neurons, where each neuron takes a number of inputs and produces a single output (Mitchell, 1997). The network has a number of inputs and outputs.

5.1.1

Multilayer Feed-forward Network

The multilayer feed-forward network has a layered structure. Each layer contains a number of neurons that receive their inputs from the previous layer and feed their output to the next layer. There are no connections between the neurons within a layer. No processing takes place in the input layer, it merely feeds the inputs to all neurons in the next layer. This is not the case for the output layer. The number of neurons in the output layer is decided by the number of outputs for the network. The output from each neuron in the output layer is one of the outputs of the network. In principle, with many basis functions, one hidden layer is sucient for modelling most practically reasonable systems (Ljung, 1999, p.154). Figure 5.1 shows an illustration of a multilayer feed-forward network. Each circle represents an articial neuron. This network has two hidden layers with four neurons in each layer.
27

28

Artical Neural Network

Hidden layer 1 Input 1

Hidden layer 2

Output Input 2 Input 3

Figure 5.1: A multilayer feed-forward network consisting of two hidden layers with four neurons in each layer.

5.1.2

Neuron

A neuron is one type of unit used in ANNs. Each neuron has several inputs from the previous layer, either network inputs or outputs from other neurons. Each input has an associated weight which determines the eect of the incoming value (Rumelhart, Widrow and Lehr, 1994). The neuron can be divided in to two parts, where the rst part is a sum over all inputs with a bias y=
i

wi xi +

(5.1)

where xi is the input value and wi is the weight for each input i. The second part is the sigmoid function 1 (y ) = (5.2) 1 + e y where (y ) is the output from the neuron. The sigmoid function maps a very large input domain to a small range of outputs. Because of this, it is often referred to as the squashing function. Its derivative is easily expressed in terms of its output, d (y ) = (y )(1 (y )) dy (5.3)

Figure 5.2 shows an illustration of the neuron structure.

5.2

Training

29

x1 x2 . . xn wn w1

(y)

Figure 5.2: Illustration of the neuron structure. All weighted inputs are summed with a bias and passed through a limiting function.

5.2

Training

The network can be trained using sensor data. By training the network it will become more accurate than if it is not trained. During training, the input weights are changed to increase the network performance. The performance of the network will depend on how much data is used to train the network and how the spread of the data is. The model is, at most, valid for the data within the range of the training set D . It is of course optimal to have an innite amount of data ranging over all possible values. When the network is trained, the weights are changed to generate a better t. This is done by using the backpropagation algorithm. The performance is measured by the sum of squared errors, which is dened as 1 E= (tkd kd (y ))2 (5.4) 2
d D k outputs

where outputs is the set of output neurons in the network, and tkd and kd (y ) are the measured and predicted values associated with output neurons k and training example d . A training example consists of all sensor measurements at time t .

5.2.1

Backpropagation

The backpropagation algorithm trains a multilayer network by changing the inputs weights, given that the network has a xed set of neurons and interconnections. It attempts to minimize the squared error between network output values and measured values. The backpropagation algorithm according to Mitchell (1997) is described below for a network with one hidden layer. Algorithm 5.1: Backpropagation algorithm ), where x t is the vector of network Each training example is a pair of the form (x, input values, and t is the vector of target network output values. is the learning rate, nin is the number of network inputs, nhidden is the number of neurons in the hidden layer, and nout the number of output neurons.

30

Artical Neural Network

The input from neuron i into neuron j is denoted xji , and the weight from neuron i to neuron j denoted wji . The error term k is associated with output neuron k = 1, 2, ..., nout or hidden neuron k = nout + 1, nout + 2, ..., nout + nhidden . Create a feed-forward network with nin inputs, nhidden hidden neurons, and nout output neurons. Initialize all network weights to small random numbers. Until the termination condition is met ) in the training set t For each (x, Propagate the input forward through the network: to the network and compute the output u (y ) 1. Input the instance x of every neuron in the network. Propagate the errors backward through the network: 2. For each network output neuron k, calculate its error term k k k (y )(1 k (y ))(tk k (y )) 3. For each hidden neuron h, calculate its error term k k h (y )(1 h (y ))
k outputs

(5.5)

wkh k

(5.6)

4. Update each network weight wji wji wji + wji where wji = k xji (5.8) (5.7)

As can be seen in Algorithm 5.1 the algorithm begins by creating a network with the desired number of neurons and hidden layers. All weights are initialized to small random values. It will then repeatedly iterate over all training examples. It will run each training example through the network and calculate the error. The gradient with respect to the error is computed and all weights are updated. This step is iterated, using the same training example several times, until the network performs well enough. Too many iterations can lead to over-tting, i.e., the model can learn the noise (Mitchell, 1997). As training goes on, the network performance will improve since it is picking up more relevant features of the data. This behaviour is unwanted since the model will be applied on data-sets with dierent noise realisations. Therefore, it is best to select a network estimate that yields a relatively large performance increase compared to the previous model, see the dark (blue) bars in Figure 5.3. The same thing applies when the number of neurons is increased (Ljung, 1999).

5.2

Training

31

Model error

Model

Figure 5.3: The model error is decreasing as the model complexity/training is increased. The dark (blue) coloured models are the best choices. The light (green) models either have a large model error or are over-t.

Part II

Results

33

Ship Power Estimation Based on ANN

It turns out that the shaft power can be predicted by an articial neural network that has been created based on the theory presented in Chapter 5. The sensor data described in Chapter 3 have been used and the data have been preprocessed according to the description in Chapter 4. Several dierent networks have been created by varying the choice of inputs as well as the number of neurons. All networks have been developed with one hidden layer (see Section 5.1.1) and shaft power as the only output. The data set is divided into training, validation and testing data. The training set is used to train the network, i.e., this is the data that is used to estimate the weights, see Section 5.2. The error in the validation set is monitored during training and the training will end when the error is small enough. The testing set is not used during training at all. It is used to get an independent performance measure for the dierent networks.

6.1

The Data Set

As mentioned earlier, the data set comes from a container ship sailing between Asia and Europe. It is over 300 metres long and 50 metres wide and can carry over 10 000 containers at the same time. It is a very modern ship made to sail at speeds over 20 knots. All signals mentioned in Chapter 3 were measured and are listed in Table 6.1. Data was gathered from the beginning of January to the middle of April 2012. There were periods when several or all sensors were turned o or otherwise not working. These data sections were removed before the preprocessing. The data sections when the ship was in harbour were removed, along with the start and
35

36

Ship Power Estimation Based on ANN

Table 6.1: A list of all available inputs with a short description of them. Input Description Depth Water depth List List angle of the ship Trim Trim angle of the ship RPM RPM of main engine Rudder Rudder angle Speed over ground Speed over ground, both longitudinal and transversal Speed through water Speed through water, both longitudinal and transversal Wind speed Wind speed Wind direction Wind direction Mean draught Mean of forward and aft draught measurements

end of each journey. The data was patched and synchronised, though there were very few measurements missing. Some of the measurement series contained a lot of outliers so an outlier detection algorithm was implemented for all data series. A CUSUM LS lter was implemented to sort out the data section when the ship was sailing with a constant speed. After the preprocessing, the data set was divided into two parts, a training set and a testing set. The training set was divided into training data and validation data with the ratio 75/25. The training set consists of 35 000 samples and the testing set 12 511 samples. The training set is used for the training of the network and after the training is nished, its performance on the testing set will be calculated. It is the performance on the testing set that will be used to compare dierent models. The performance is measured by the mean squared error (MSE), where the squared error is calculated according to (5.4). This chapter presents the performance of the developed articial neural networks. The training set contains data equal to roughly 24 days and the testing set close to nine days. This means that out of three and a half months of data, one month was used in the ANN. The rest of the data was removed before and during the preprocessing. Almost a month was removed due to sensors being turned o or not working. The second largest part that was removed was when the ship was in harbour.

6.2

Different ANNs

The ANNs have been developed with two dierent choices of inputs. One was a network with all available inputs, see Figure 6.1. Several of the inputs are strongly correlated. If two inputs are strongly correlated, it will not be possible to tell which of the inputs are causing the change in the output. The contribution to the output will therefore be split between them. This means that it should be possible to remove some of the inputs while still being able to estimate the shaft

6.2

Dierent ANNs

37

Depth List Trim RPM Rudder SOG long. SOG trans. STW long. STW trans. Wind speed Wind direction Mean draught

ANN_f(k)

Shaft power

Figure 6.1: ANN with all available inputs. The output is the shaft power and k is the number of neurons.

power. The contribution from the removed input will be handled by the correlated input instead. There are three groups of inputs that are strongly correlated: Rudder, SOG transversal and STW transversal List and Wind RPM, SOG longitudinal and STW longitudinal Here, rudder and SOG transversal have been removed to cope with the correlation in the rst group. Furthermore, list has been removed since it is correlated to crosswinds which can be identied from wind data. RPM and SOG longitudinal have been removed as well. To get some information about currents, STW longitudinal - SOG longitudinal was added as well, yielding the network in Figure 6.2. If an input is removed, the developed model will no longer consider the removed input to aect the output, which in this case is the shaft power.
Depth Trim STW long. - SOG long. STW long. STW trans. Wind speed Wind direction Mean draught

ANN_r(k)

Shaft power

Figure 6.2: ANN with a reduced number of inputs and k is the number of neurons.

38

Ship Power Estimation Based on ANN

At rst, several networks were developed with all available inputs to see which number of neurons would be ideal. If too few are used, the model will not be able to capture all relevant features but it will be over-t if too many neurons are used, see Section 5.2.1. Figure 6.3 shows the performance for all developed models with all available inputs. At rst, the error decreases as the number of neurons increases. After a while, at eight neurons, the error starts to increase which is probably because the model is over-tted, i.e., that it is learning the noise. Hence, ve neurons should be the best option, while eight neurons gives the best performance.
x 10
6

18 16 14 12 10 8 6 4 2 0

Error

10 15 Number of neurons

20

25

Figure 6.3: The MSE for dierent number of neurons. At rst the error decreases, but once it reaches eight neurons is starts to increase, most likely due to over-t. The test has been done on the testing set. The same plot was generated for the network with a reduced number of inputs, see Figure 6.4. In this plot the best option seems to be ve neurons, while six neurons gives the best performance.

6.2.1

Network Performance

This section will present the performance for some of the more interesting networks created. The networks with all available inputs and a reduced number of inputs are denoted ANN_f(k) and ANN_r(k) respectively, where k is the number of neurons. Table 6.2 shows the performance for the networks. The performance is evaluated using the MSE and is calculated on the testing set, i.e., the network has never seen this data set before. The MSE is calculated for each part and is measured in (kW )2 . The last column is the error size in percent of mean shaft power for the

6.2

Dierent ANNs

39
7

x 10

4 Error 3 2 1 0 1

3 4 5 6 7 8 9 10 15 Number of neurons

20

Figure 6.4: The MSE for dierent number of neurons. At rst the error decreases, but once it reaches six neurons is starts to increase, most likely due to over-t. The test has been done on the testing set. whole data set and is calculated according to Error % of mean shaft power = MSE mean shaft power

where the mean shaft power is the mean value of the shaft power measurements for the whole test set. Table 6.2: Network performance for the ANNs. Network MSE (kW )2 Error % of mean shaft power ANN_f(10) 353 877 3.631 ANN_f(8) 195 861 2.701 ANN_f(5) 209 844 2.800 ANN_r(7) 2 125 632 8.899 ANN_r(6) 890 327 5.759 ANN_r(5) 1 835 262 8.268 The performance for the networks with all available inputs is much better than the performance for the networks with a reduced number of inputs. This could be because some inputs that aect the output have been removed. Figure 6.5 shows how the estimated shaft power ts to the measured shaft power in the test set, for ANN_f(8). The thick grey (green) line depicts the measured value and the black (blue) line is the estimated shaft power, which essentially follows the measured output. The error is shown below. See Appendix A for t

40

Ship Power Estimation Based on ANN

and error plots for the remaining networks.


x 10
4

2.5

Measured Estimated Error

2 Shaft power (kW)

1.5

0.5

0.5

2000

4000

6000 8000 Samples

10000

12000

14000

Figure 6.5: Fit and error plot for ANN_f(8). The two upper lines are estimated and measured shaft power. The lower is the error, i.e., the dierence between them. The shaft power has been estimated for the testing set. By visual inspection of Figure 6.5 and the gures in Appendix A it can be seen that all neural networks developed with all available inputs can estimate the shaft power with reasonable accuracy. Figure 6.6 shows the same plot for ANN_r(6). This network is not as good at estimating the shaft power in the testing set as the networks with all available inputs. This is probably because it has fewer inputs, and therefore less information to work with. However, it does show the power of ANN and data-driven modelling by still being able to follow the measured output. The testing set consists of ve sections and that is why the estimated and measured shaft power appear to have some drastic changes.

6.3

Modied CUSUM Algorithm

To nd out whether it was motivated to modify the original CUSUM algorithm, i.e., whether the networks were better at predicting the shaft power when the data was preprocessed with the modied algorithm, a network was estimated from data preprocessed with the original CUSUM. This network has eight neurons and all available inputs. In Table 6.3, it can be seen that the network with the modied CUSUM algorithm can estimate the shaft power for the testing set much better than the network based on data that have been preprocessed with

6.3

Modied CUSUM Algorithm

41

x 10

2.5

Measured Estimated Error

2 Shaft power (kW)

1.5

0.5

0.5

2000

4000

6000 8000 Samples

10000

12000

14000

Figure 6.6: Fit and error plot for ANN_r(6). The two upper lines are estimated and measured shaft power. The lower is the error, i.e., the dierence between them. The shaft power has been estimated for the testing set. the original CUSUM algorithm. The dierence between original and the modied algorithm is how the estimated constant level is dened. The two estimated constant levels are depicted in Figure 4.5. For the original algorithm it keeps changing and for the modied it is kept constant. Here, it is assumed that all samples have been collected when the ship is stationary and there are no acceleration measurements. Hence, if there is a sample when the acceleration is non-zero, it will be harder to predict the shaft power in that sample since the acceleration will aect the shaft power, see Chapter 2. The modied CUSUM algorithm is better than the original CUSUM algorithm at sorting out the sections with constant speed, which is why it performs better, see Figure 4.4. Table 6.3: Network performance for the ANN with the modied and original CUSUM algorithm. The network has all available inputs and eight neurons in the hidden layer. Data MSE (kW )2 Error % of mean shaft power Original CUSUM algorithm 420 338 3.957 Modied a CUSUM algorithm 195 861 2.701 Figure 6.7 shows how the shaft power is predicted. If the gure is compared to Figure 6.5 it can be seen that the ANN estimated from data preprocessed with

42

Ship Power Estimation Based on ANN

the modied algorithm performs better, especially at the end. Since the CUSUM algorithm is used to sort out which samples are included in the data set, the training and testing set will be dierent for the two networks. The data set for the network estimated from data preprocessed with the original algorithm will be a few hundred samples longer.
x 10
4

2.5

Measured Estimated Error

2 Shaft power (kW)

1.5

0.5

0.5

2000

4000

6000 8000 Samples

10000

12000

14000

Figure 6.7: Fit and error plot for the network with eight neurons and all available inputs. The original CUSUM algorithm has been used instead of the modied algorithm. The two upper lines are estimated and measured shaft power. The lower is the error, i.e., the dierence between them. The shaft power has been estimated for the testing set.

6.4

Optimal Trim

As mentioned in Section 3.1, changing the trim can reduce the fuel consumption which has a large commercial value. Hence, it would be useful to be able to use the model to compute the optimal trim. By using the removed harbour parts (see Section 4.1) the testing set is divided into ve sections. Using the model, the total power consumption is calculated for each trim angle within the data range, for each section. The calculations are done using a developed network and measured data, the testing set. The total power consumption is the mean of the predicted shaft power, i.e., the model output, for the testing set. Measured data is used for all inputs except for the trim angle. The trim angle is varied from -2 to 3 with a step size at 0.1, yielding 51 dierent total power consumptions. The total power consumption is calculated under the assumption that the trim angle is constant during the whole section. A plot of the total power consumption for each trim

6.4

Optimal Trim

43

angle for ANN_f(5) can be seen in Figure 6.8. The same plot for the remaining networks can be seen in Appendix B.

3.9 Total power 3.8 3.7

x 10

Section 1

3.6 2 x 10
4

0 2 Trim angle Section 2 3.7 Total power 3.65 3.6

2.45 Total power 2.4 2.35 2.3

x 10

Section 3

2.25 2 x 10
4

0 2 Trim angle Section 4 Total power

3.55 2 x 10
4

0 2 Trim angle Section 5

4.44 Total power 4.42 4.4

4 3.95 3.9

4.38 2

0 2 Trim angle

3.85 2

0 2 Trim angle

Figure 6.8: Total power consumption for each section and each trim angle. The calculations were done for ANN_f(5).

For most developed networks it is possible to nd an optimal trim angle within the data range for all sections. All of these optimal trim angles are larger than zero, i.e., trim by bow. The networks where an optimal trim angle could not be found within the data range, indicate that trim by bow is more ecient. This is consistent with reports from ship captains.

44

Ship Power Estimation Based on ANN

6.5

Missing Signals

Not all eects considered in Chapter 2 were available in the measurements. Therefore, it is not possible to have them as an input to the ANN. In reality though, they will aect the shaft power. One of the larger eects missing is waves. The waves will cause the ship to heave as well as increase the resistance with bow reections. Waves have great impact on the behaviour of the ship and are most likely one of the largest sources of error. It would be desired to have for example, the wave height and frequency as an input to the ANN. Fouling is another resistance that there is no data on. According to Aas-Hansen (2010) the fouling can become a large part of the total resistance. The data was gathered during a period of several months so depending on when the ship had its last hull maintenance, fouling could a be a large source of error.

6.6

Summary

The ANNs developed from sensor data collected from a container ship could estimate the shaft power with reasonable accuracy. The networks with all available outputs performed best, and ANN_f(8) had the best performance. The optimal trim setting seems to be trim by bow.

Conclusion

In this thesis the use of articial neural networks for modelling of a container vessel has been investigated. The neural network has been developed based on sensor data. The model has been evaluated based on how well it can estimate the output, shaft power, and whether is was possible to calculate the optimal trim angle. The articial neural networks can estimate the shaft power with good precision, see Figure 6.5. The network with all available inputs, see Figure 6.1, had the best performance with eight neurons in its hidden layer. This was also the best of all networks developed, see Table 6.2. Six neurons gave the best performance for the network with a reduced number of inputs. The networks with all available inputs have a signicantly better performance than the networks with a reduced number of inputs. In Section 4.5, it was shown that the modied CUSUM algorithm is better at sorting out sections with constant speed than the original algorithm. Later on, in Section 6.3 it was shown that this modication leads to a better performance than if the original CUSUM algorithm would have been used. The optimal trim angle can be estimated by calculating the total power consumption for each trim angle, see Section 6.4. The optimal trim angle is in the interval [1, 2] degrees for most data sections and networks. Some networks do not have an optimal trim angle within the data range, but merely indicate that trim by bow is more ecient. This is consistent with reports from ship captains. ANNs are good at estimating the shaft power, but require several months of data for network training. A deciency with this data-driven modelling is that it will not be able to capture the fact that the vessel is changing during the course of
45

46

Conclusion

time. The fouling will for example get worse until a hull maintenance is performed and the water resistance will decrease.

7.1

Future Work

There are several ways to improve the model. One way would be to get more data. More measurements, like wave data, could be introduced to try and capture more features of the true system. A physical model with a non-rigid structure can be developed. This model should be better than the ANN at capturing all correlations between the inputs. A model for waves and fouling could also be implemented.

Fit and Error

This appendix shows the t and error plot for the networks that was not presented in Chapter 6. The shaft power is estimated for the testing set. Figure A.1 depicts how the shaft power is predicted for the network with ten neurons and all available inputs. From the test that was done to nd out how many neurons would be appropriate, see Section 6.2, it is known that there is a risk that this network is over-tted to training data. This could be why it has a worse performance than the network with eight neurons. The network in Figure A.2 has ve neurons and all available inputs and performs slightly worse than the network with eight neurons. This network is not over-tted and has a better performance than the network with ten neurons. The networks with a reduced number of inputs performs signicantly worse compared to the networks with all available inputs, which can be seen in Figure A.3 and A.4. Figure 6.5 and 6.6 are the best performing networks for the networks with all available inputs and a reduced number of inputs respectively.

47

48

Fit and Error

x 10

2.5

Measured Estimated Error

2 Shaft power (kW)

1.5

0.5

0.5

2000

4000

6000 8000 Samples

10000

12000

14000

Figure A.1: Fit and error plot for ANN_f(10). The two upper lines are estimated and measured shaft power. The lower is the error, i.e., the dierence between them.

x 10

2.5

Measured Estimated Error

2 Shaft power (kW)

1.5

0.5

0.5

2000

4000

6000 8000 Samples

10000

12000

14000

Figure A.2: Fit and error plot for ANN_f(5). The two upper lines are estimated and measured shaft power. The lower is the error, i.e., the dierence between them.

49

x 10

2.5

Measured Estimated Error

2 Shaft power (kW)

1.5

0.5

0.5

2000

4000

6000 8000 Samples

10000

12000

14000

Figure A.3: Fit and error plot for ANN_r(7). The two upper lines are estimated and measured shaft power. The lower is the error, i.e., the dierence between them.

x 10

2.5

Measured Estimated Error

2 Shaft power (kW)

1.5

0.5

0.5

2000

4000

6000 8000 Samples

10000

12000

14000

Figure A.4: Fit and error plot for ANN_r(6). The two upper lines are estimated and measured shaft power. The lower is the error, i.e., the dierence between them.

Optimal Trim

The total power consumption for each section of the data set has be calculated for each trim angle within the data range. The calculations was done of the testing set. The optimal trim angle for each section is then the angle that gives the lowest power consumption. An optimal trim angle within the data range could be found for the networks with ve and ten neurons and all available inputs and with seven and ve neurons and a reduced number of inputs, see Figure 6.8, B.1, B.3 and B.5 respectively. The networks with eight neurons and all available inputs and with six neurons and a reduced number of inputs only indicate that trim by bow is more ecient, see Figure B.2 and B.4.

51

52

Optimal Trim

4.2 Total power 4 3.8

x 10

Section 1

3.6 2 x 10
4

0 2 Trim angle Section 2 3.75 Total power 3.7 3.65 3.6

2.34 Total power 2.32 2.3 2.28

x 10

Section 3

2.26 2 x 10
4

0 2 Trim angle Section 4 Total power

3.55 2 x 10
4

0 2 Trim angle Section 5

4.7 Total power 4.6 4.5 4.4

4.05 4 3.95 3.9

4.3 2

0 2 Trim angle

3.85 2

0 2 Trim angle

Figure B.1: Total power consumption for each section and each trim angle. The calculations were done for ANN_f(10).

53

4 Total power 3.9 3.8 3.7

x 10

Section 1

3.6 2 x 10
4

0 2 Trim angle Section 2 3.8 Total power 3.7 3.6 3.5

2.35 Total power 2.3 2.25 2.2

x 10

Section 3

2.15 2 x 10
4

0 2 Trim angle Section 4 Total power

3.4 2 x 10
4

0 2 Trim angle Section 5

4.5 Total power 4.4 4.3

4 3.9 3.8

4.2 2

0 Trim angle

3.7 2

0 Trim angle

Figure B.2: Total power consumption for each section and each trim angle. The calculations were done for ANN_f(8)

54

Optimal Trim

5 Total power 4.5 4

x 10

Section 1

3.5 2 x 10
4

0 2 Trim angle Section 2 4.5 Total power 4 3.5

5 Total power 4 3

x 10

Section 3

2 2 x 10
4

0 2 Trim angle Section 4 Total power

3 2 x 10
4

0 2 Trim angle Section 5

5.5 Total power 5 4.5

5 4.5 4

4 2

0 Trim angle

3.5 2

0 Trim angle

Figure B.3: Total power consumption for each section and each trim angle. The calculations were done for ANN_r(7)

55

6 Total power 5 4

x 10

Section 1

3 2 x 10
4

0 2 Trim angle Section 2 5 Total power 4 3

4 Total power 3.5 3 2.5

x 10

Section 3

2 2 x 10
4

0 2 Trim angle Section 4 Total power

2 2 x 10
4

0 2 Trim angle Section 5

6 Total power 5 4

6 5 4

3 2

0 Trim angle

3 2

0 Trim angle

Figure B.4: Total power consumption for each section and each trim angle. The calculations were done for ANN_r(6)

56

Optimal Trim

5 Total power 4.5 4

x 10

Section 1

3.5 2 x 10
4

0 2 Trim angle Section 2 5 Total power 4.5 4

3.5 Total power 3 2.5

x 10

Section 3

2 2 x 10
4

0 2 Trim angle Section 4

3.5 2 x 10
4

0 2 Trim angle Section 5

5.5 Total power 5 4.5

6 Total power 0 Trim angle 2 5 4

4 2

3 2

0 Trim angle

Figure B.5: Total power consumption for each section and each trim angle. The calculations were done for ANN_r(5)

Bibliography

Aas-Hansen, M. (2010). Monitoring of hull condition of ships, Masters thesis, Norwegian University of Science and Technology. Trondheim, Norway. Faltinsen, O. M. (1990). Sea Loads on Ships and Oshore Structures, Cambridge University Press, Cambridge, UK. Fossen, T. I. (2011). Handbook of Marine Craft Hydrodynamics and Motion Control, John Wiley & Sons Ltd., Chichester, UK. Gustafsson, F. (2000). Adaptive Filtering and Change Detection, John Wiley and Sons Ltd, Chichester, UK. Gustafsson, F. (2010). Statistical Sensor Fusion, Studentlitteratur, Lund, Sweden. Hrting, A., Laupichler, A. and Reinking, J. (2009). Considerations on the squat of unevenly trimmed ships, Ocean Engineering 36(2): 193201. Journe, J. and Massie, W. (2001). Oshore Hydromechanics, Delft University of Technology, Delft, The Netherlands. Ljung, L. (1999). System Identication: Theory for the User, Prentice Hall, Upper Saddle River, USA. Mitchell, T. M. (1997). Machine Learning, McGraw-Hill, New York, USA. Perez, T. (2005). Ship Motion Control, Springer, London, UK. Perez, T. and Fossen, T. I. (2011). Practical aspects of frequency-domain identication of dynamic models of marine structures from hydrodynamic data, Ocean Engineering 38(2-3): 426435. Rumelhart, D., Widrow, B. and Lehr, M. (1994). The basic ideas of neural networks, Communications of the ACM 37(3): 8792.

57

58

Bibliography

Upphovsrtt
Detta dokument hlls tillgngligt p Internet eller dess framtida ersttare under 25 r frn publiceringsdatum under frutsttning att inga extraordinra omstndigheter uppstr. Tillgng till dokumentet innebr tillstnd fr var och en att lsa, ladda ner, skriva ut enstaka kopior fr enskilt bruk och att anvnda det ofrndrat fr ickekommersiell forskning och fr undervisning. verfring av upphovsrtten vid en senare tidpunkt kan inte upphva detta tillstnd. All annan anvndning av dokumentet krver upphovsmannens medgivande. Fr att garantera ktheten, skerheten och tillgngligheten nns det lsningar av teknisk och administrativ art. Upphovsmannens ideella rtt innefattar rtt att bli nmnd som upphovsman i den omfattning som god sed krver vid anvndning av dokumentet p ovan beskrivna stt samt skydd mot att dokumentet ndras eller presenteras i sdan form eller i sdant sammanhang som r krnkande fr upphovsmannens litterra eller konstnrliga anseende eller egenart. Fr ytterligare information om Linkping University Electronic Press se frlagets hemsida http://www.ep.liu.se/

Copyright
The publishers will keep this document online on the Internet or its possible replacement for a period of 25 years from the date of publication barring exceptional circumstances. The online availability of the document implies a permanent permission for anyone to read, to download, to print out single copies for his/her own use and to use it unchanged for any non-commercial research and educational purpose. Subsequent transfers of copyright cannot revoke this permission. All other uses of the document are conditional on the consent of the copyright owner. The publisher has taken technical and administrative measures to assure authenticity, security and accessibility. According to intellectual property law the author has the right to be mentioned when his/her work is accessed as described above and to be protected against infringement. For additional information about the Linkping University Electronic Press and its procedures for publication and for assurance of document integrity, please refer to its www home page: http://www.ep.liu.se/ Jonas Kllman