Simulation and Control of Submarines: Erik Lind Magnus Meijer

Download as pdf or txt
Download as pdf or txt
You are on page 1of 89

Simulation and Control of

Submarines

Erik Lind
Magnus Meijer

Department of Automatic Control


MSc Thesis
ISRN LUTFD2/TFRT--5954--SE
ISSN 0280-5316

Department of Automatic Control


Lund University
Box 118
SE-221 00 LUND
Sweden

© 2014 by Erik Lind & Magnus Meijer. All rights reserved.


Printed in Sweden by Media-Tryck
Lund 2014
Abstract
When designing control systems for real applications, it is important to first do test-
ing in a simulated environment, to ensure adequate performance. This is especially
important when designing control systems for applications that have high operation
costs, e.g., submarines, since late errors in the development can be extremely costly.
Saab develops steering systems for submarines. Prior to this thesis, testing for
those have been performed in an open-loop environment, where only static test cases
could be examined. Saab therefore identified the need to implement a dynamic test
simulator, which could react to the different signals from the steering system, i.e.,
act as a real submarine.
In this thesis, such a simulator was developed. It consists of two parts, a physical
model of a submarine, and a control system for motion control. As for the physical
submarine model, it can be approximated from mechanical data of a submarine that
the user provide, such as dimensions and weight. The second options is for the user
to explicitly supply the simulator with hydrodynamic coefficients.
The control system was derived to control a model of a demo submarine. Saab
is also involved in submarine navigation systems and saw the need to, in the future,
also have the possibility to test those products. A navigation system assumes an
autopilot exists, hence, an autopilot control system was developed.
In the end, the control system consisted of a two-level cascade controller of
mixed LQG- and PID-control, along with a Kalman estimator for estimating un-
known states.
The results were overall satisfactory. The performance of the control system is
well within usual customer specifications and the main problems in this thesis lay
in getting a proper model.

3
Sammandrag
När styrsystem utvecklas för dyra applicationer, är det ofta viktigt att först uföra
simulerade modelltester för att tidigt hitta fel och testa prestanda. På en ubåt är
detta extra viktigt, eftersom fel som uppstår sent i utvecklingen kan bli väldigt kost-
samma.
Saab utvecklar styrsystem till ubåtar. Innan detta examensarbete utfördes alla
tester på dessa produkter i en statisk miljö, där en användare kunde skicka in
insignaler till styrsystemet och studera utsignalerna från detta. Men användaren var
själv tvungen att ändra på alla insignalerna för att studera ett annat fall. Saab såg
därför behovet av en dynamisk simulator som kunde reagera på utsignalerna från
styrsystemet, det vill säga, replikera en riktig ubåt.
I det här examensarbetet utvecklades en sådan simulator. Den består av två delar,
en fysikalisk modell av en ubåt och en autopilot för att styra dess rörelser. För den
fysikaliska modellen finns möjligheten att få en approximerad modell av en ubåt
utifrån fysiska mått. Den andra möjligheten är att användaren förser simulatorn med
alla hydrodynamiska koefficienter.
Autopiloten utvecklades att styra en demoubåt. Saab är också involverade i navi-
gationssystem till ubåtar, och såg därför behovet av att i framtiden också kunna testa
sådana produkter. Ett navigationssystem antar att det finns något som styr ubåtens
rörelser, därför utvecklades också en autopilot.
Till slut bestod autopiloten av en kaskadregleringsdesign, där både LQG- och
PID-reglering används, tillsammans med en Kalmanestimator för att skatta de
okända tillstånden.
Resultaten var överlag goda. Prestandan på styrsystemet låg väl inom normala
kundkrav, och de största problemen låg i att få fram en god modell.

4
Acknowledgements
The authors would like to offer our deepest gratitude to Saab Group for the oppor-
tunity to perform this thesis, and to get a valuable insight in engineering industry.
Naturally, we would also like to thank Hans Bohlin at Saab who worked out the idea
behind this master thesis, and has also been our supervisor at Saab. He has been a
great mentor and has provided valuable help and assistance throughout this thesis.
Bo Carlsson assisted us with the implementation in C, this thesis would not have
reached its final form without him.
We would also like to thank Mats Nordin and Lennart Bossér at FOI for the in-
vitation to Stockholm. The meeting was very rewarding. Saab Underwater Systems
also provided us with valuable tips and guidance, for which we are grateful for.
Finally, we would like to thank all the other nice people at Saab Support and
Services for a pleasant time at Saab.

Erik Lind & Magnus Meijer


27/6 2014 Malmslätt, Linköping

5
Contents

List of Figures 9
List of Tables 11
1. Introduction 15
1.1 Submarines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.2 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.3 Thesis concepts . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.4 Scope of Master thesis . . . . . . . . . . . . . . . . . . . . . . . 21
1.5 Individual contribution . . . . . . . . . . . . . . . . . . . . . . 24
1.6 Thesis Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2. Method 26
2.1 Coordinate System notation . . . . . . . . . . . . . . . . . . . . 26
2.2 Simulator development . . . . . . . . . . . . . . . . . . . . . . 26
2.3 Schedulers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3. Theory 29
3.1 Hydrodynamics . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.2 6 degrees of freedom dynamics . . . . . . . . . . . . . . . . . . 35
3.3 Control designs . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4. Development 39
4.1 Modelling of a submarine . . . . . . . . . . . . . . . . . . . . . 39
4.2 Generic submarine model . . . . . . . . . . . . . . . . . . . . . 46
4.3 Submarine demo model . . . . . . . . . . . . . . . . . . . . . . 50
4.4 Control design . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5. Results 65
5.1 Time constants and saturations . . . . . . . . . . . . . . . . . . 65
5.2 Final controller . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.3 Simulation plots . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6. Discussion 78
6.1 Hydrodynamic Coefficients discussion . . . . . . . . . . . . . . 78
6.2 Linearised state space model . . . . . . . . . . . . . . . . . . . 80

7
Contents

6.3 Controller issues . . . . . . . . . . . . . . . . . . . . . . . . . . 80


6.4 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Bibliography 85
A. Appendix 87
A.1 Kt and Kq interpolation polynomials . . . . . . . . . . . . . . . 87

8
List of Figures

1.1 Submarine steering system. . . . . . . . . . . . . . . . . . . . . . . . 16


1.2 Submarine sledge and elevator movements. . . . . . . . . . . . . . . 18
1.3 Roll pitch and yaw definitions. . . . . . . . . . . . . . . . . . . . . . 18
1.4 × and + rudder configuration. . . . . . . . . . . . . . . . . . . . . . 19
1.5 Simulator system block diagram overview. . . . . . . . . . . . . . . . 23
1.6 Tuned down simulator block diagram. . . . . . . . . . . . . . . . . . 25

2.1 Coordinate system rotation definition. . . . . . . . . . . . . . . . . . 27


2.2 Test rig communication overview, with a SASS. . . . . . . . . . . . . 27
2.3 Test rig communication overview, with navigation system. . . . . . . 28

3.1 Buoyancy and gravity force. . . . . . . . . . . . . . . . . . . . . . . 29


3.2 Turbulent and laminar flow. . . . . . . . . . . . . . . . . . . . . . . . 30
3.3 Flow past an airfoil. . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.4 Rudder forces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.5 PID tracking implementation. . . . . . . . . . . . . . . . . . . . . . . 37

4.1 Reference frame velocity notation. . . . . . . . . . . . . . . . . . . . 40


4.2 Rudder angles in three dimensions. . . . . . . . . . . . . . . . . . . . 47
4.3 Kt (J) and Kq (J) relation. . . . . . . . . . . . . . . . . . . . . . . . . 49
4.4 Submarine demo model. . . . . . . . . . . . . . . . . . . . . . . . . 50
4.5 Submarine simulator IOs. . . . . . . . . . . . . . . . . . . . . . . . . 52
4.6 Simulator system IOs. . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.7 r, φ , θ controller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.8 Inner loop controller structure. . . . . . . . . . . . . . . . . . . . . . 54
4.9 Integrator signs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.10 Heave controller in parallel with the inner controller. . . . . . . . . . 57
4.11 Control signal saturation example . . . . . . . . . . . . . . . . . . . 58
4.12 Control error saturation. . . . . . . . . . . . . . . . . . . . . . . . . . 58
4.13 Step response with control error saturation. . . . . . . . . . . . . . . 59

9
List of Figures

4.14 Velocity regions, the shaded part is the hysteresis. . . . . . . . . . . . 59


4.15 Inner and outer loop control. . . . . . . . . . . . . . . . . . . . . . . 60
4.16 Integrator controller bandwidth. . . . . . . . . . . . . . . . . . . . . 61
4.17 Outer loop heading controller structure. . . . . . . . . . . . . . . . . 61
4.18 Outer loop depth control structure. . . . . . . . . . . . . . . . . . . . 62
4.19 Outer loop controller structure. . . . . . . . . . . . . . . . . . . . . . 64

5.1 Test case one, Heading. . . . . . . . . . . . . . . . . . . . . . . . . . 71


5.2 Test case one, Depth. . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.3 Test case one, Pitch. . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
5.4 Test case one, Control Efforts. . . . . . . . . . . . . . . . . . . . . . 72
5.5 Test case two, Velocity. . . . . . . . . . . . . . . . . . . . . . . . . . 73
5.6 Test case two, Depth. . . . . . . . . . . . . . . . . . . . . . . . . . . 73
5.7 Test case two, Pitch. . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
5.8 Test case two, Control Efforts. . . . . . . . . . . . . . . . . . . . . . 74
5.9 Test case three, Velocity. . . . . . . . . . . . . . . . . . . . . . . . . 75
5.10 Test case three, Heading. . . . . . . . . . . . . . . . . . . . . . . . . 75
5.11 Test case three, Position in the xy-plane. . . . . . . . . . . . . . . . . 76
5.12 Test case three, Control Efforts. . . . . . . . . . . . . . . . . . . . . . 76
5.13 Test case three, roll. . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.14 RPS of the rotor vs. velocity. . . . . . . . . . . . . . . . . . . . . . . 77

6.1 Linear model in the high velocity region. . . . . . . . . . . . . . . . . 81


6.2 Rudder and submarine attitude animation. . . . . . . . . . . . . . . . 84

10
List of Tables

0.1 List of variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12


0.2 List of subscripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
0.3 List of coordinate systems . . . . . . . . . . . . . . . . . . . . . . . 14
0.4 List of abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.1 Vector notation for six degrees of freedom . . . . . . . . . . . . . . . 36

4.1 Main data of the demo submarine. . . . . . . . . . . . . . . . . . . . 51


4.2 Controller features in the regions. . . . . . . . . . . . . . . . . . . . 59

5.1 State FB weights. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65


5.2 State FF weights and conditions. . . . . . . . . . . . . . . . . . . . . 66
5.3 Outer loop controller saturations. . . . . . . . . . . . . . . . . . . . . 67
5.4 Switching conditions for the outer loop controller. . . . . . . . . . . . 68

6.1 Hydrodynamic coefficients, Measured vs. Calculated. . . . . . . . . . 78

11
Denominations

Table 0.1: List of variables

symbol explanation unit


δ hydroplane mechanical angle rad
δh water inflow angle rad
δe δ − δh , effective rudder angle rad
n rotor RPS /s
τ torque Nm
ρ water density kg/m3
F force N
a acceleration m/s2
x position m
v velocity m/s
ω angular velocity rad/s
xG = (xG , yG , zG ) center of gravity m
xB = (xB , yB , zB ) center of buoyancy m
OA origin of coordinate system A -
φ submarine roll rad
θ submarine pitch rad
ψ submarine yaw rad
u velocity submarine x direction m/s
v velocity submarine y direction m/s
w velocity submarine z direction m/s
p angular velocity about submarine x axis rad/s
q angular velocity about submarine y axis rad/s
r angular velocity about submarine z axis rad/s
X force component in submarine x direction N
Y force component in submarine y direction N
Z force component in submarine z direction N
K torque about the submarine x axis Nm

12
List of Tables

M torque about the submarine y axis Nm


N torque about the submarine z axis Nm
W gravity force N
B buoyancy force N
ν1 (u, v, w) m/s
ν2 (p, q, r) rad/s
m submarine mass kg
L submarine length m
I submarine moment of inertia matrix kg m2
Ix submarine moment of inertia about the x axis kg m2
Iy submarine moment of inertia about the y axis kg m2
Iz submarine moment of inertia about the z axis kg m2
Ixy cross product, moment of inertia kg m2
Izx cross product, moment of inertia kg m2
Iyz cross product, moment of inertia kg m2
M mass matrix kg
Cd drag coefficient -
Cl lift coefficient -
h(x) local height at position x m
b(x) local width at position x m
xHPk rudder k position m
vrk , Vrk local water velocity at rudder k m/s
vrek , Vrek projected water velocity at rudder k m/s
Lru rudder lift force N
Dru rudder drag force N
Λ rudder aspect ratio -
Nk rudder k midline vector -
L state feedback gain -
Lr state feedforward gain -
Kt rotor force coefficient -
Kq rotor torque coefficient -
Dp rotor diameter m
J advance ratio -

13
List of Tables

subscript explanation
hs hydrostatic
hd hydrodynamic
p propulsion
c control
l lift
d drag

Table 0.2: List of subscripts

subscript/superscript explanation acronym


TG gravity G
B buoyancy B
W water W
R reference REF
L earth LL
HPk hydroplane k HPk

Table 0.3: List of coordinate systems

Abbreviation Explanation
RPS Revolutions Per Second
RPM Revolutions Per Minute
INS Inertial Navigation System
HP hydroplane(s)
DOF Degrees Of Freedom
SASS Submarine Steering System
FF Feed Forward
FB Feedback
LQG Linear Quadratic Gaussian
CFD Computational Fluid Dynamics
CAD Computer Aided Design
TCL Tool Command Language

Table 0.4: List of abbreviations

14
1
Introduction

1.1 Submarines
Concepts of Military Submarines
Modern submarines are one of the most complex types of machines that exists today,
only beaten by space shuttles. Submarines, i.e., underwater vehicles, come in many
shapes, depending on if they are intended for underwater research, maintenance, or
military purposes. This thesis will deal with the latter.
The historical intentions of military submarine are attacking enemy surface
ships or other submarines. Today they also serve as portable missile launchers and
their subtle nature, makes them suitable for surveillance and reconnaissance mis-
sions. Submarine are also used for deployment of special forces in enemy territory
and other covert operations. All these advantages make submarines very popular for
the world’s military powers.
To properly serve these purposes, submarines naturally come with a number of
desired features:

• Long operation endurance Submarines should be able to operate close to


enemy borders, possibly far from own territory. Hence, long endurance is a
very desirable feature since resupplying, e.g., from surfaced ships, could draw
attention.

• Long submerged endurance The advantage with submarines over other mil-
itary vessels, is the possibility to operate in stealth under water. Long under-
water endurance is therefore a must. This have been an issue historically due
to the crew’s and combustion engines’ need for oxygen.

• Low signature A submerged submarine can not be spotted by traditional


means, e.g., radars. The historical way of finding submarines is instead by
the sound they produce underwater, hence low noise levels are desired.

15
Chapter 1. Introduction

Figure 1.1: Submarine steering system.

Submarine steering system


Figure 1.1 shows a simplified structure of a submarine steering system and how
it is integrated with other parts. Dashed lines are not signals, but rather physical
feedbacks. The operator can chose between an autopilot, or manual steering. In the
latter he/she could for example use a joystick/wheel to give references to the servo
controller. To steer, the operator naturally needs the values from the different sensors
displayed in some fashion (operator interface).
The navigation system is a device for high end navigation. A position could for
example be given to the navigation system and it should generate a desired heading
to reach the destination. Traditionally, the navigation system is a human navigator
with a compass and sea charts.
The FEC (front end computer) handles the interface between the sensors and the
operator displays. The servo loop serves as an inner loop to the actuators, improving
the outer interface by allowing, i.e., rudder angles and propeller RPM1 requests.

Steering actuators
In order to manoeuvre a submarine, a number of different steering actuators are
needed. For a a surface going vessel, i.e., a boat, these could include the rudder and
the propeller. A submarine typically also has additional steering actuators, some
which will now be presented.
Sail The sail is not an actuator itself but will here be presented for future reference.
The typical submarine hull consist of, in addition to the main hull, a so called tower
1 Revolutions per minute

16
1.1 Submarines

or sail. This serves as a centerboard that increases the submarines stability when
manoeuvring through water. It is also the place for a number of masts and periscopes
and usually also has a hatch for the crew.
Propeller A submarine is propelled forward by a propeller in the stern. For a sub-
merged submarine, it is powered by a nuclear reactor in nuclear submarines or by a
sterling engine, as in the Swedish submarines. The design of the propeller itself is
quite complex and not seldom classified.
Bow propeller This is a propeller at the bow which creates a transverse propulsion
and is used for docking at quay (this propeller will be excluded in this thesis).
Hydroplanes Water vehicles are steered with the means of rudders, submarines
are no exception. The difference between submarines and surfaced vessels is that
they have additional degrees of freedom (DOF). Traditional surface going ships
include three means of control freedom, to steer (two DOF) and forward propul-
sion (one DOF). A submarine needs the ability steer in a upward/downward motion
which adds additional two DOF. Most rudder configurations will also add roll as a
control DOF.
All the different rudders and fins on submarines share the name hydroplane. A
typical modern submarine includes 6 different hydroplanes, four in the stern and
two at the bow or on the sail. When changing or keeping depth, this thesis will refer
to two modes, the sledge and the elevator. The sledge mode is common in large
depth changing manoeuvres and at higher speeds, while at lower speeds or in depth
keeping situations, the elevator is preferred. They are both illustrated in Figure 1.2.
There is also a tendency that in a middle velocity region, a combination of sledge
and elevator manoeuvres are used.
When the hydroplanes are placed on the tower instead of at the bow, they can
more or less alone be used to elevate the submarine. As they are located closer to
the midship, i.e., closer to the center of the ship, the submarine will not suffer from
the same kind of pitching movement as it would if the hydroplanes were placed at
the bow. See Figure 1.3 for roll, pitch, and yaw definitions.
The stern hydroplanes are used as rudders and pitching fins. The classic configu-
ration has been to place them as a + (Figure 1.4), with the lower vertical hydroplane
slightly smaller to allow the submarine to move closer to the seabed. However, this
will lead to a decreased manoeuvrability when surfaced. Another downside to the +
configuration is that if one hydroplane has malfunctioned, the submarine will face
considerable decreased manoeuvre performance in the direction the hydroplane was
meant to work in. And in the case that two fins malfunction, there is the risk to com-
pletely lose manoeuvrability in a certain direction.
Another stern hydroplane configuration that is becoming popular on modern
submarines is the ×- configuration (Figure 1.4). With this configuration every aft
fin will create both horizontal and vertical force, which means they can all work
together to create a yawing or pitching moment. It is then possible to manoeuvre

17
Chapter 1. Introduction

Figure 1.2: Submarine sledge and elevator movements.

Figure 1.3: Roll pitch and yaw definitions.

well, even if two hydroplanes are out of service. And since they can all work to-
gether, they can be made smaller, which will decrease the drag force when moving
forward. They will also be angled, which means the submarine can move closer
to the seabed or quay without the hydroplanes getting in the way. The downside,
however, is when in, for example, a yawing motion, one hydroplane will also cre-
ate a pitching force that has to be cancelled by another hydroplane, which in turn
will create unnecessary drag. Manoeuvring will also be more complex, i.e., it is less
straight forward how to slant the hydroplanes to create the desired motion.
Tanks A submarine typically include four different types of water tanks:

• Ballast tanks

• Compensation tanks

• Trim tanks

18
1.1 Submarines

Figure 1.4: × and + rudder configuration.

• Balance tanks

The purpose of the ballast tanks is to make the submarine float or sink. These are
typically huge and have just two modes, filled or empty. The compensation tanks are
used to trim the weight so that the submerged submarine is weightless, i.e., hovers
in the water. The trim tanks are basically one tank at the bow, and another in the
stern, connected with a tube and a pump. Pumping water from one tank to another,
moves the center of gravity, and can thus be used to make the submarine balanced
in the water. The balance tanks are the same as the trim tanks, with the difference
that they are instead used to achieve balance port relative starboard, rather then bow
relative stern.

Sensors
Submerged submarines in northern waters have no means to with human eyes spot
its surroundings due to the shallow water, even if a window would exist on the
submarine which is rarely the case. A submarine must therefore include numerous
sensors in order for an operator/autopilot to figure out what is going on. These
sensors typically include:

• Log

• Depth sensor

• INS2

• GPS

• Water density sensor

Together, they measure:

• Attitude The current roll, pitch and heading, measured by the INS.

• Attitude rate Measure the current angular velocities of the magnitudes above.
Also measured by the INS.
2 Inertial navigation system

19
Chapter 1. Introduction

• World position Current longitude, latitude position, and the depth. The first
two could be from a GPS system or from an INS. The GPS position is natu-
rally more exact, but when submerged, the GPS will not be able to connect
to satellites, hence, an INS is necessary. The depth is measured with, e.g., a
pressure depth sensor.

• World velocities The velocities of the magnitudes above.

• Log velocities The current speed forward. Traditionally measured by log pro-
pellers/impellers, but modern submarines uses, e.g., pressure or acoustic logs.

• Current actuator state Naturally, it should possible to measure the current


hydroplane angles and rotor RPM. In case of a, e.g., hydroplane malfunction,
the operator or autopilot should notice if the hydroplane angle is not what it
is set to be.

• Water density This is a vital measurement for the tank control, especially the
compensation tank.

Manoeuvre a submarine
Historically, submerged submarine manoeuvring was performed by an officer giving
commands to an operator, which angles to slant the different hydroplanes3 . Modern
techniques allows more sophisticated ways of manoeuvring. An operator, can today
simply use a joystick to angle the hydroplanes. The joystick could more or less be
directly connected to the hydroplanes, e.g., in the case of × rudder configuration,
there is preferably a transformation between joystick movements and hydroplane
angles to counter for the non straightforward nature of × rudder configuration ma-
noeuvring.
Today’s knowledge also allows for well performing autopilots. In this case, ref-
erences could (and will, later in this thesis) be the desired depth, heading, and in
some cases pitch.

1.2 Background
Submarine Steering System SASS
Saab develops steering systems for submarines. These steering systems typically
includes autopilot computers, console for operator display, and control devices, in-
terfacing to several steering actuators and steering and navigation sensors. Saab
steering systems are currently used by submarines in Sweden, Australia, Norway,
and Singapore. Saab is also involved in navigation system development.
3 The reliability of this fact is the historical accuracy of the German film Das Boot from 1981.

20
1.3 Thesis concepts

1.3 Thesis concepts


TCL
TCL4 is a very powerful but easy to learn dynamic programming language, suitable
for a very wide range of uses, including web and desktop applications, networking,
administration, testing and many more. Open source and business-friendly, TCL is
a mature yet evolving language that is truly cross platform, easily deployed and
highly extensible [Tool Command Language].

Matlab
The reader is assumed to have Matlab knowledge and experience, hence the pro-
gram will not be extensively discussed here. In short, Matlab is a software devel-
oped by Mathworks, extensively used in the academic world and in industry to do
mathematical calculations and simulations. [Matlab]

Simulink
Simulink is an extension to Matlab. It is a graphical programming tool often used
to simulate dynamic systems and interconnection of multiple such. Matlab and
Simulink were extensively used in the development of this thesis. [Simulink]

1.4 Scope of Master thesis

Purpose of the thesis


Submarines are generally very expensive in operation. As for a steering system, fault
detection and controller autopilot tuning should therefore preferably be performed
in advance, as far ahead of any real testing on-board as possible.
Prior to this thesis, the only means Saab have had for testing the steering sys-
tem, before installation and on board test runs, were to simulate certain static cases
with limited capability of verifying dynamic characteristics. The main part of the
dynamic testing and verification had to be postponed to the end of the product de-
velopment, when the system is installed in the submarine. In order to expand the
means of testing, Saab therefore wanted to develop a simulator system, where hard-
ware could be tested early in the production stage, thus minimizing the sea tests.
The purpose of this thesis is therefore to implement a submarine simulator, and
thus make it possible to perform as much testing and tuning of new products as
possible prior to target system implementation. This can be used for evaluating new
hardware, tuning of autopilots or investigating how different sensor errors will affect
performance.
4 Tool Command Language

21
Chapter 1. Introduction

Thesis tasks and objectives


For a new product, it could be desirable to test the navigation system independently
of the product’s autopilot, hence the ability to test on an, already functional, autopi-
lot should exist. Therefore, the simulator should consist of two separate parts, one
submarine model and an autopilot to control the submarines movements.
From this point, the model simulator itself will be referred to as the submarine
simulator. The autopilot part will be referred to as the control system or autopilot
and them combined, submarine simulator together with the control system, as the
simulator system. The submarine model will be the analytical model itself.
Submarine model The submarine model should naturally correspond to an actual
full scale submarine as well as possible. It should include most of the hydrodynamic
effects from the surrounding water and should at least include the rotor and the
hydroplanes as actuators. All hydroplanes shall have the possibility to be controlled
individually, except for the bow/tower hydroplanes5 .
When an external autopilot shall be tested on the submarine simulator, it should
provide desired values for the mechanical angles of the hydroplanes, and perhaps
the rotor RPM. Future work could include additional means to actuate the submarine
simulator, this will be discussed later.
Submarine simulator The submarine simulator is the computer implementation
of the submarine model. Naturally the simulation shall not be overly inefficient.
Autopilot The autopilot should include three different regions for different veloc-
ities and each region will be controlled differently. In the low velocity region, depth
control shall solely be using elevator motion. In the high velocity region, depth
control shall instead be performed in sledge mode, and the bow/tower hydroplanes
shall be used at a minimum, or not at all. Depth changing in the region in between,
shall be a combination of the two modes. The overall control performance shall be
satisfying, i.e.,

• Reference tracking, no stationary errors.

• No extensive overshoots. A typical submarine performance requirement is an


overshoot of maximum a few meters when changing depth.

• The measured signals shall be according to the listed sensors in section 1.1,
i.e., the controller should not need internal values in the submarine simulator.

In the case of navigation system testing, references in submarine heading, depth and
pitch will be given. The submarine autopilot should hence answer to references in
those three.
5 Which is often the case in real submarines

22
1.4 Scope of Master thesis

Figure 1.5: Simulator system block diagram overview.

Test rig implementation The simulator system must be compatible with an exist-
ing Saab test rig, and will therefore be implemented in C on a Linux platform. It
should be able to run with the existing SASS product or another external device. To
emulate the autopilot as an external device, it will be implemented separately from
the submarine simulator.
Both the submarine simulator and the control system will run in real time, but
asynchronous since they will run independently, and possibly on different Linux
systems. The submarine simulator will be updated with 20Hz and control system
with 4Hz6 . The emphasis of this thesis should, however, be on modelling and control
design.

Simulator Block diagram


Figure 1.5 shows the idea behind the simulator system as presented by Saab at the
start of the thesis. This proved to be, at this stage of the simulator development, a to
complex description, and had to be simplified.

6 Which has been the case in the SASS

23
Chapter 1. Introduction

Delimitation
The following delimitations will be assumed:

• Completely submerged submarine.

• The submarine will be in an infinitely large ocean to avoid near surface and
near bottom effects.

• No wave effects or irregular currents.

• Ideal sensors, i.e., measured value equals true value.

• Limited speed range, 4-16 knots.

• Incompressible hull.

• No tank systems (water pumping) will be modeled.

With these delimitation, Figure 1.5 could be simplified to Figure 1.6. The control
part has been separated from the simulator itself, communication between them is
now through the data and control layer. The sea current in Figure 1.6 is limited
to constant currents that will only affect position/velocity relative earth. Also the
sensor models have been removed as well as the submarine water tank actuators.
The servo controllers for the hydroplanes and the propulsion will not be modeled as
control loops, but rather dynamics systems with unity gain.

1.5 Individual contribution


The the physical modelling and the model implementation in Simulink was per-
formed by Erik Lind. Magnus Meijer was responsible for porting the model into C
code and, hence, the model and controller interaction in the C environment. Magnus
also worked together with a consult as Saab to interface the thesis implementation
with the existing program structure in the test rig. The controller was designed by
Erik, but the dimensioning and weighting was performed by Magnus.
The introduction, development, and method chapters were written by Erik. Mag-
nus wrote the theory, result, and discussion chapters.

1.6 Thesis Outline


This report consists of five Chapters, and can be summarized as follows:
Method In Chapter 2, the methods and the coordinate system notations and struc-
tures used, will be presented. This Chapter will also explain how the model was
implemented in Matlab and ported to the target language C.

24
1.6 Thesis Outline

Figure 1.6: Tuned down simulator block diagram.

Theory Chapter 3 consists of theory and background of hydrodynamics and some


hydrodynamic modeling. After this, equations for a six degrees of freedom dynamic
body will be derived and, finally, a short collection of control designs and strategies
will be presented.
Development Firstly, Chapter 4 will explain how the known hydrodynamic rela-
tions were applied to submarines, and how a model for a generic submarine model
can be derived. This is followed by an introduction to a demo submarine, Finally,
Chapter 4 will consist of the complete control system derivation.
Results / Simulation Chapter 5 presents the final model and autopilot, as well as
plots from different simulated manoeuvres.
Discussion / Summary Chapter 6 consists of a discussion of the submarine model
and control system performance. The controller itself is also analyzed, with possible
oscillation and other issues. At last, ideas for future work is presented.

25
2
Method

2.1 Coordinate System notation


This thesis will deal with numerous different coordinate systems. In this section, the
sub- and superscript notation will be shortly described.
Positions, velocities and acceleration in (x,y,z) are denoted x,v, and a respec-
tively. For increased clarity what a vector describes and in what coordinate system
it is currently expressed, sub- and superscripts will be added. Generally, vectors will
be written:
xABC (2.1)
where x is a vector, in this case a position vector. It could also be a velocity or
acceleration vector. A is always a coordinate system abbreviation while B and C are
points or coordinate systems (in such case the point will be the coordinate system
origin). Equation (2.1) will thus describe the vector from point B to C expressed in
the coordinate system A. For example, let A and B be two coordinate systems, xBAB is
then the position of OB relative OA expressed in the coordinates of B. And similarly,
aBAB is the acceleration of OB relative OA expressed in the coordinates of B, which
can also be expressed as −aBBA , etc.
As for angle vectors (φ , θ , ψ) (roll, pitch, yaw), they are defined as the rotation
between two coordinate systems. Figure 2.1 describes the rotation of the blue frame
with respect to the black frame. The rotations are defined in the order: yaw, pitch,
and roll.

2.2 Simulator development

Matlab/ Simulink
The submarine simulator and the control system will both be implemented and
tested in Matlab/Simulink due to the many advantages these software provides for
this kind of task. The Simulink implementation will then be ported to C code, which
is already supported. Read more about porting Simulink models to C code below.

26
2.2 Simulator development

Figure 2.1: Coordinate system rotation definition, defined in the order: yaw, pitch,
roll.

Figure 2.2: Test rig communication overview, with a SASS.

The controller and model simulator will not be updated simultaneously (20Hz
vs 4Hz). Since Simulink does not support different step lengths in the same model,
the dynamic parts of the controller were chosen to be implemented in discrete time
to simplify the simulation in Simulink.

Communication
The idea of the final implementation structure in the test rig is illustrated in Figure
2.2. All the parts are connected through a data layer. The test operator will commu-
nicate with the submarine simulator with telnet through TCL.
If the test system is a navigation system, the test rig setup should look more
like in Figure 2.3. The SASS has been replaced by a navigation system, and an au-
topilot has been connected. The test operator will communicate with the submarine
simulator and autopilot in the same fashion as above. Communication between the
autopilot and submarine simulator will be through TCP.

Code generation
Simulink features code generation for models, which produces C code that exactly
represents the model simulation. If the model has inputs and outputs, they will ap-
pear as C structs in the generated code. There is also a feature to save the simulation
output as a .mat file, which will be used to log data.

27
Chapter 2. Method

Figure 2.3: Test rig communication overview, with navigation system.

Code generation does not support variable step size simulations, but since there
is a well defined update frequency, this will not be a problem. In the C code, the
Simulink code generation produces a function one_step(), which takes the model
inputs, iterates a time step, and updates the model outputs. A main() function is also
produced by the code generation, that initializes the model and creates a for-loop
that calls one_step() as many times as necessary for the simulation time. This is
not something that will be used in this thesis, instead the one_step() method will be
used by a scheduler that will guarantee that the model is updated with 20Hz, hence,
the simulation will be in real time.
Code for the submarine simulator and the control system will be generated sim-
ilarly, but with different time steps, 0.05s and 0.25s respectively. A separate sched-
uler for the autopilot will update the controller with 4Hz.
The two schedulers will not be synchronized, the submarine simulator and con-
trol system will operate asynchronously. But as the simulator system should corre-
spond to a real submarine, this is actually preferred.

2.3 Schedulers
As described in Section 2.2, the simulator system will feature two schedulers for the
submarine simulator and controller system. Their workflow is presented in Figure
??. Since the submarine scheduler will update more frequently than the controller
scheduler, it will call subo nestep()eveni f noTCPconnectionisestablished.

28
3
Theory

3.1 Hydrodynamics

Hydrodynamics is the study of liquids in motion. A body traveling through a fluid


will be exerted to a number of forces and moments, which is a result due to the
physical characteristics of the liquid medium. In this section some of the different
effects will be discussed and shortly explained in general, i.e., not explicitly for
submarines.

Hydrostatics
Archimedes’ principle states that a submerged body will experience a lifting force
equal to the gravitational force of the displaced water. This force will act through the
center of buoyancy [Fossen, 1994], which is the center of gravity of the displaced
water, hence, this force is usually referred to as the buoyancy force. The gravity
and buoyancy force will always be opposite in direction, which will cause the body
to strive towards balance, i.e., when the center of buoyancy is vertically aligned
with the center of gravity (Figure 3.1). The magnitudinal difference between the two
forces will determine if the body will sink or float.

Figure 3.1: Buoyancy and gravity force.

29
Chapter 3. Theory

Figure 3.2: Turbulent and laminar flow.

Hydrodynamic Damping
A body traveling through a fluid will experience a drag force parallel to the incom-
ing flow, known as hydrodynamic damping. This force is a result from numerous
effects and are divided differently throughout literature and previous work. This
thesis will divide the forces according to [Fossen, 1994] and [Fossen, 2011].
Pressure Drag Pressure drag is the force normally thought of as drag. As a body
travels through water, it has to suppress liquid at the front in order to move forward.
This is largely dependent on the shape of the body, a more streamlined body will
experience less pressure drag.
A common way to interpret this is to view it as a pressure difference. At the
front, where fluid is displaced to make room for the body, there will be an increased
pressure. At the aft, the fluid will be replaced into the space the body left behind, the
pressure instead will be lower. This pressure difference will induce a force, similar
to a airplane wing or sail lifting forces. A less streamlined aft will also create tur-
bulence which will further decrease the pressure at the aft and thus further increase
the drag force.
Friction Drag Friction drag arises from friction between the body and the sur-
rounding fluid. When a body travels through water, it will accelerate the fluid clos-
est to its surface. This flow can be seen as parallel layers of fluid with friction in
between. This will cause the different layers to have different velocities, decreasing
with the distance from the body, as seen in Figure 3.2.
The flow may be laminar or turbulent, or a combination of the both. Laminar
flow is when there is no disruption between the parallel layers flowing past the body.
This occurs at low velocities and gives rise to very low friction and noise. As the
velocity increases the different layers of fluid overturns and causes turbulence, see
Figure 3.2. This is very energy consuming, and causes high friction and noise.
Wave Damping Wave damping is the resistance experienced by the body when
advancing through waves on the surface. This effect is the most important damping
contributor in rough seas, due to the fact that the forces from the waves are pro-
portional to the square of the wave height [Fossen, 2011]. This effect is neglected
in this thesis due to the delimitation presented in Section 1.4, i.e., the body will be

30
3.1 Hydrodynamics

completely submerged at a great depth, and therefore not affected by surface waves.
Potential Damping Potential damping refers to the energy loss when a body is
forced to oscillate up and down with the surface waves. Due to the same reasons as
for wave damping, this effects is not taken into account in this thesis.

Drag coefficient
The effects of drag, at a certain velocity, is usually described by a non-dimensional
drag coefficient, defined as:
−F
Cd = 1 2
(3.1)
2 ·ρ ·A·u
where F is the drag force, ρ is the density of the fluid, A is the area shown to the
flow and u the velocity of the body. For certain applications it is more common to
normalize with the area of the submerged hull, referred to as the wetted surface. In
a velocity interval, the drag coefficient is only marginally changing and Equation
(3.1) can instead be used to calculate the resistance for a given velocity:
1
F = −Cd · · ρ · A · u2 (3.2)
2
Reynolds number Reynolds number is the relation between the inertial- and the
viscous forces of a fluid. It is defined in open sea situations as [Fossen, 2011]:
uD
Rn = (3.3)
ν
where D is the characteristic length of body, u is the velocity and ν is the kinematic
viscosity coefficient of the fluid. A high Reynold’s number means the flow is mainly
turbulent, while a lower generally corresponds to a more laminar flow.
Lift When an object is traveling through a medium, it will experience lift forces
perpendicular to the incoming flow. This effect is caused by pressure changes be-
tween the top and bottom surfaces. The classical example is an airfoil traveling
through air, see Figure 3.3. When the air is deflected it will have to travel around
the airfoil. Since the air above the wing will have to travel further than the air be-
low, the pressure will decrease on the top surface, and create a lift force on the
airfoil.
The lift generated is highly dependent on the angle of attack, i.e. the angle of the
velocity vector of the incoming flow. A perfectly symmetrical airfoil will produce no
lift if the angle of attack is zero, but if it is tilted, there will be a pressure difference
and a lift force is generated.
All bodies moving through a medium will experience this effect. The hydroplanes
can be compared with airfoils and will produce a great amount of lift when actuated.
When manoeuvring the submarine, the incoming flow will change, and thus the
submarine tower and hull will also generate lift forces.

31
Chapter 3. Theory

Figure 3.3: Flow past an airfoil.

Added mass When a body travels through water, the hull friction will accelerate
the water closest to the hull, creating a layer of moving water. The closest layer will
in turn accelerate the next layer of water and so on. Hence, there will be an region
of moving water around the body.
When the body accelerates, it will also have to accelerate the water closest to
the hull. When it turns, it will have to turn the water that is traveling with the body.
This effect is called the added mass effect since the body will appear heavier than it
is. This will effect both the apparent mass and inertia of the body.
The added mass effect does also affect bodies moving through the air, but since
the mass of the accelerated air is often negligible compared to the body mass, this
is rarely accounted for. The accelerated water, however, does have a considerable
mass and will have to be taken into account when modelling bodies in water.
It is difficult to calculate how large this effect will be, since it heavily depends
on the shape and roughness of the submarine, it is therefore usually analyzed with
experiments.

Control Surfaces
To be able to control the attitude of a submarine, several control surfaces are used
as described in Section 1.1.
Hydrodynamic Forces A hydroplane will both experience a drag force opposite
to the direction of the incoming flow, and a lift force perpendicular to it. [Toxopeus,
2011] proposes a way to calculate the drag and lift forces, Dru and Lru , see Figure
3.4,
1
Lru = · ρ ·Vr2 · AR ·Cl · cos δe · sin δe (3.4)
2
1
Dru = · ρ ·Vr2 · AR ·Cd · sin2 δe (3.5)
2
where Vr is the velocity of the inflowing water, AR is the area of the rudder, Cl is
the lift coefficient, δe is the so called effective rudder angle, and Cd is the drag
coefficient. [Toxopeus, 2011] defines two angles, the hydrodynamic rudder angle,
δh and the effective rudder angle δe . δh is the angle between the ship longitudinal
axis and the incoming flow, the effective rudder angle δe is the angle between the
mechanical rudder angle δ and δh , see Equation (3.6). As the name suggests, δe is

32
3.1 Hydrodynamics

Figure 3.4: Rudder forces according to [Toxopeus, 2011]. Note that Dru is opposite
the direction of the incoming flow, and that Lru is perpendicular to it

the rudder angle for which a force is generated, i.e., when δe is zero, no force is
created.
δe = δ − δh (3.6)
v
In equation (3.6), δh = arctan( vxy ) where vy and vx are the x and y components of
the water velocity at the rudder. This translates to the body longitudinal and lateral
forces and yaw moment:

Fx = −Dru · cos δh − Lru · sin δh (3.7)

Fy = Lru · cos δh − Dru · sin δh (3.8)


τ = x × (Fx , Fy , 0) (3.9)
where x is the position of the rudder. The rudder drag and lift coefficients are usu-
ally experimentally determined, but [Toxopeus, 2011] refers to previously derived
empiric formulas for calculating them.

6.13 · Λ
Cl = (3.10)
2.25 + Λ

Cl2
Cd = (3.11)
π ·Λ
where Cl is the lift coefficient, Cd the drag coefficient, and Λ the so called rudder
aspect ratio, Λ = length
area .

33
Chapter 3. Theory

Flow Straightening When a submarine is moving, the water flow vortex along the
hull will alter the water flow at the rudders. [Toxopeus, 2011] suggests a method
to compensate for this phenomena by adding a flow straightening coefficient for
the hydrodynamic rudder angle δh , i.e., decreasing it. This will be neglected in this
thesis.
Flow straightening is enhanced by the propeller, greatly so when it is placed in
front of the rudders. Although, for modern submarines, propellers are most often
placed behind the hydroplanes, in order to decrease noisy turbulence around the
rudders.

Propulsion
The propeller converts rotational motion into forward/backward thrust. To calcu-
late the thrust Fp and torque τ p , [Toxopeus, 2011] and [Watt, 2007] among others,
suggests calculating dimensionless thrust and torque coefficients which only depend
on the advance ratio J:
Fp
Kt (J) = 2 4 (3.12)
ρn D p
τp
Kq (J) = (3.13)
ρn2 D5p
vp
J= (3.14)
nD p
where Fp is the force exerted by the propeller, τ p is the torque generated, n is the
RPS1 , D p is the diameter of the propeller, and v p is the velocity of the incoming flow.
The functions Kt (J) and Kq (J) are determined by water tests or advanced computer
calculations, when the propeller is operating at different advance ratios. Equation
(3.12) and (3.13) can then be used for determining the thrust and torque.

Fp = Kt · ρn2 D4p (3.15)

τ p = Kq · ρn2 D5p (3.16)


The propeller on a submarine is operating in a wake from the hull which reduces
the average inflow to the propeller. This is usually corrected with a one-dimensional
correction factor wT : [Toxopeus, 2011]:

v p = (1 − wT ) · u (3.17)

where wT if the so called Taylor wake fraction, and u the forward velocity of the
submarine. Since the propeller accelerates water backwards, it generates a nega-
tive pressure on the hull upstream from its position. This will increase the drag force
1 Revolutions Per Second

34
3.2 6 degrees of freedom dynamics

on the hull, negating some of the propeller thrust. This can be corrected with an-
other constant, also suggested by [Toxopeus, 2011], known as the thrust deduction
fraction t:
Fres = (1 − t) · Fp (3.18)
To determine wT and t, model experiments must be performed on the hull alone
to determine the wake fraction, as well as the hull with the propeller attached to
determine the thrust deduction factor.
Cavitation Cavitation is caused when forces acting on a liquid forms small cav-
ities or bubbles. This is usually a result of rapid pressure changes, for example
around a propeller. If the small cavities implode, they will generate an intense
shockwave. This is an undesired behaviour since repeated implosions are noisy and
causes heavy wear on materials.

3.2 6 degrees of freedom dynamics


A rigid body’s movement and position in a three dimensional space can uniquely
be described using six states. Its position can be determined with Cartesian (x, y, z)
coordinates, and its turn by three angles (φ ,θ ,ψ) (which are the rotations around
the x-,y- and z- axes respectively). These six coordinates result in a system with six
degrees of freedom. In this section the dynamics of such a system will be derived.
Consider a space-fixed coordinate system W and a body-fixed frame REF with
the origins OW and OR respectively. Let aG be the acceleration and xG the position
of the the center of mass. Let v be the velocity and ω the angular velocity of OR
expressed in the body-fixed coordinates REF. The acceleration aG is given by the
Newton-Euler equations from classic mechanics: [Fossen and Fjellstad, 1995]
∂v
aG = + ω × v + ω̇ × xG + ω × (ω × xG ) (3.19)
∂t
In order to simplify the readability of Equation (3.19) the standard vector notation
was circumvented and will instead be presented in Table 3.1.
With forces (Fx , Fy , Fz )i acting on the origin OR , the movement of the body will
be:
∑ (Fx , Fy , Fz )i = maG (3.20)
where m is the mass.
Angular momentums τ i around OR results in the movements:

∑ τ i = Jω̇ + ω × Jω + xG × aG (3.21)

where J is the moment of inertia matrix. Equations (3.19) and (3.21) will be com-
bined, i.e., substitute aG from (3.19) in (3.21), to create the angular acceleration.

35
Chapter 3. Theory

xG xRRG
aG aRRG
v R
vW R
ω ωWR
R

Table 3.1: The vectors in Section 3.2 written with the standard notation

3.3 Control designs


In this Section a very short summary of a few different control designs used in this
thesis are discussed. For more information, see [Glad and Ljung, 2003].

PID
The PID-controller is the most common type of feedback controller throughout in-
dustry. It consists of three parts, the proportional part P, the integral part I, and
the derivative part D. The controller tries to minimize the control error, that is, the
difference between a desired setpoint and the measured output of the process. The
PID-controller output u(t) is defined as2 .
Z t
d
u(t) = K p · e(t) + Ki · e(τ)dτ + Kd · e(t) (3.22)
0 dt
where K p , Ki and Kd are the tunable gain parameters for the proportional, integral
respective the derivative parts and e(t) = r(t) − y(t), is the control error.
PID Tracking Switching between multiple PIDs in a controller system is not un-
common. The different controllers are most certainly dimensioned differently, hence,
the control signal will suffer a step at the time of the switch. In order to avoid be-
haviour like this, it is possible to implement PID tracking, where the non active con-
trollers follow the output of the active one. PID tracking is implemented in Simulink
as in Figure 3.5

State Feedback
A system on standard state space form is written as in Equation 3.23.

ẋ = Ax + Bu
(3.23)
y = Cx + Du

When controlling a system on state space form, a popular control method is the
so called state feedback control, where the control signal u is the state vector x
multiplied by a feedback gain matrix L. This allows the control engineer to place
2 This is the most basic of PID controller definitions, other variants do exist

36
3.3 Control designs

Figure 3.5: PID tracking implementation.

the closed loop poles freely in the s-plane3 . This is desirable since the poles greatly
influence the response of a system.
The poles of an open loop system are given by the roots of characteristic equa-
tion |sI − A| = 0. With state feedback, the control signal u takes the form u = −Lx,
the system in Equation (3.23) can then be written as:

ẋ = (A − BL)x
(3.24)
y = (C − DL)x

The new characteristic equation

det(sI − (A − BL)) (3.25)

The new characteristic equation takes the form in Equation (3.24), where L is cho-
sen to place the poles at the desired locations.

Observer
When using state feedback controllers for system control, all the states have to be
known. This is often not the case, since rarely all are measured. Some states might
not even have a direct physical interpretation, which complicates measuring further.
A state feedback controller therefore has to be complemented with an observer. An
observer estimates the unknown states4 from the input to the system and the known
(measured) output signals, and feeds them to the controller (Equation (3.26)).

x̂˙ = Ax̂ + Bu + K(y − Cx̂)


(3.26)
u = −Lx̂
3 If the system is controllable.
4 This is possible if the system is observable.

37
Chapter 3. Theory

where x̂ is the observed state vector and K the observer gain matrix, which will be
dimensioned to create the desired observer dynamics. A common way of doing this is
by letting the observer gain matrix be a Kalman filter, which is an optimal observer
with respect to measurement noise and process disturbances5 . As the name suggests,
the Kalman filter is not only an observer, but a filter, that prevents measurement
noise to be fed back into the system.

Optimal control - LQG


A method of dimensioning the state feedback control of a system, is by using Linear
Quadratic Gaussian control theory. The idea of LQG is to minimize a quadratic cost
function, which will yield an optimized controller with respect to certain weights on
the controlled variables and control efforts:
Z
min(||e||2Q + ||u||2R ) = min eT (t)Qe(t) + uT (t)Ru(t)dt (3.27)

where Q and R are the weight matrices for the error e(t) and control signal u(t).
These are used to weigh the control effort against the control error, i.e., how to
penalize the different control errors, and the different control signals.
To determine the optimal controller, the system is written on the general state
space form used in [Glad and Ljung, 2003]:

ẋ = Ax + Bu + Nv1
z = Mx (3.28)
y = Cu + v2

where v1 is a white Gaussian disturbance vector and z are the controlled variables.
v2 is the measurement noise, also of white Gaussian characteristic.
h R R iConsider the
v1
system above, where [ v2 ] are stochastic noise with intensity RT1 R122 . The sought
12
feedback, uFB = −Lx̂ will minimize the expression [Glad and Ljung, 2003]:

||z||2Q + ||u||2R (3.29)

The feedforward control part uFF = Lr r will be dimensioned to ensure that the
closed loop gain is identity:

M(BL − A)B · Lr = I (3.30)

The observer gain matrix K will create the perfect trade off between the system
model and the measured output.

5 The Kalman filter assumes white Gaussian noise and disturbances.

38
4
Development

4.1 Modelling of a submarine


The dynamics of a body with six degrees of freedom where presented in Section 3.2.
This Section will apply those equations to a submarine submerged in water and try
to model the external forces Fi = (Fx , Fy , Fy , τx , τy , τz )i which are hydro-static and
hydro-dynamic forces and torques, as well as propulsion and hydroplane forces and
moments.

Coordinate Systems and notation


The following coordinate systems will be extensively used:

Name abbr.1 subs.2 explanation x,y,z corresponds to


Lon/lat LL L Earth fixed longitude, latitude,
depth
Water W W Water fixed north, east, down
Reference REF R Body fixed in the bow, starboard, down
center of buoyancy
Center of gravity G G - bow, starboard,
down
R = (x , y , z )
xRG G G G

Earth frame A position in LL is given by (longitude, latitude, depth), which will


be denoted by (x, y, z)L .

Water frame The (x, y, z)W axes corresponds to (north, east, down)-directions. The
origin of W moves with the water currents which means that the relation between W
and LL is a simple translation in the (x, y)L - plane that varies with time.

1 abbreviation
2 subscripts

39
Chapter 4. Development

Figure 4.1: Reference frame velocity notation.

Reference frame The REF frame is submarine-fixed and the origin is placed in the
center of buoyancy. This is preferable since the center of buoyancy rarely changes
while the center of gravity depend on load and the condition of the different tanks. As
for the REF coordinate system, the axes will be denoted (x, y, z)R and the velocities
according to the standard convention used in literature3 (u, v, w), i.e. (ẋ, ẏ, ż)WR , and
R
(p, q, r) for the angular velocities, see Figure 4.1. For the forces and moments, F =
R = (X,Y, Z, K, M, N) will be used, as is also the standard.
(Fx , Fy , Fy , τx , τy , τz )W R
The relation between (p, q, r) and (φ̇ , θ̇ , ψ̇) are:

φ̇ = p + q sin φ tan θ + r cos φ tan θ


θ̇ = q cos φ − r sin φ (4.1)
sin φ cos φ
ψ̇ = q +r
cos θ cos θ

Submarine six degrees of freedom


The W and REF frames in Section 3.2 will indeed be the water and body frames.
With this notation, Equation (3.20) and (3.21) correspond to:

m(u̇ − vr + wq − xG (q2 + r2 ) + yG (pq − ṙ) + zG (pr + q̇)) = ∑ Xi (4.2a)

m(v̇ − wp + ur − yG (r2 + p2 ) + zG (qr − ṗ) + xG (qp + ṙ)) = ∑ Yi (4.2b)

m(ẇ − uq + vp − zG (p2 + q2 ) + xG (rp − q̇) + yG (rq + ṗ)) = ∑ Zi (4.2c)

Ix ṗ + (Iz − Iy )qr − (ṙ + pq)Izx + (r2 − q2 )Iyz + (pr − q̇)Ixy = ∑ Ki (4.2d)

Iy q̇ + (Ix − Iz )rp − ( ṗ + qr)Ixy + (p2 − r2 )Izx + (qp − ṙ)Iyz = ∑ Mi (4.2e)

Iz ṙ + (Iy − Ix )pq − (q̇ + rp)Iyz + (q2 − p2 )Ixy + (rq − ṗ)Izx = ∑ Ni (4.2f)


3 defined by SNAME (1950)

40
4.1 Modelling of a submarine

The Equations (4.2) are nonlinear and quite complex, neither do they explicitly
state expressions for (u̇, v̇, ẇ, ṗ, q̇, ṙ). However, Equations (4.2) are linear in sense of
(u̇, v̇, ẇ, ṗ, q̇, ṙ) and can thus be solved by a matrix inversion. Modeling a submarine
is now divided into modeling the different forces and moments in the 6 directions.

External Forces
The effects and forces from Section 3.1 are summarized as:

∑ Fi = FHS + FHD + FP + FC (4.3)


where FHS are the hydrostatic forces and moments, i.e., gravity and buoyancy
forces, FHD are the hydrodynamic forces from added mass and inertia, drag and
cross flow, FP are the propulsion forces, and FC are forces from the control sur-
faces, i.e., the different hydroplanes. The forces and moments are now collected in
the Equations (4.4).

∑ Xi = XHS + XHD + XP + XC (4.4a)


∑ Yi = YHS +YHD +YC (4.4b)
∑ Zi = ZHS + ZHD + ZC (4.4c)
∑ Ki = KHS + KHD + KP + KC (4.4d)
∑ Mi = MHS + MHD + MC (4.4e)
∑ Ni = NHS + NHD + NC (4.4f)
This is a common way of interpreting and dividing forces acting on a submarine
in papers and literature. The extra terms in the xR - direction and rotation about
the xR - axis are due to the propulsion and induced torque from the propeller. This
assumes that, that the rotor is perfectly aligned with the center of buoyancy xRRB in
the (y, z)R - plane which is rarely true. More accurate would be to also introduce a
pitch moment due to rotor propulsion, however, this lever arm would probably be
small and therefore, this effect is therefore not accounted for.

Hydrostatic forces
For a 6 DOF body, the hydrostatic forces in Section 3.1 are calculated as: [Feldman,
1979].
   
XHS −(W − B) sin θ
 YHS  
   (W − B) cos θ sin φ 

 ZHS  
= (W − B) cos θ cos φ 

 KHS  (yGW − yB ) cos θ cos φ − (zGW − zB B) cos θ sin φ 
 (4.5)
   
MHS   −(xGW − xB B) cos θ cos φ − (zGW − zB B) sin θ 
NHS (xGW − xB B) cos θ sin φ − (yGW − yB B) sin θ
where W is the gravity force and B is the buoyancy force.

41
Chapter 4. Development

Hydrodynamic derivatives
Hydrodynamics is a very complex phenomena and physically very hard to model.
Most of the formulas derived are empirical and they should thus be used with cer-
tain care. Many authors deal with the subject of hydrodynamics by replacing FHD
with a coefficient based model, with terms like Xu|u| u|u|, cross terms like Xuy uy and
derivative terms like Xu̇ u̇ or Xq̇ q̇. For example. the forces in xR - direction could look
something like this: [Ridley et al., 2003]

∑ Xi =XHS + XP + XC + Xu|u| u|u| + Xu̇ u̇ + Xuv uv + Xvw vw + Xv|v| v|v|+ (4.6)


Xvr vr + Xw|w| v|w| + Xwq wq + Xqq qq + Xrr rr

The equations for (X,Y, Z, K, M, N)i differ slightly throughout previous works. Xu|u|
and Xv|v| describes how movement in X- and Y- direction creates a longitudinal
force, which will be relative to the signs of u and v. Xu̇ is the induced force in xR -
direction due to acceleration. Xuv describes a force along xR due to combined u and
v movement. Similarly, Xvw models how a combined movement in v and w creates
a force in xR - direction etc. The terms including an absolute value of a velocity is
interpreted as a drag term, since they are quadratic and relative to the direction. The
derivative subscript terms, e.g., Xu̇ , try to model the apparent increased mass due
to water acceleration around the hull, as described in Section 3.1. The cross terms,
e.g., Xuv , are forces from combined movements in different directions which arise
due to the accelerated water around the hull. The sum of the different terms can
be seen as a Taylor expansion and the coefficients are often called hydrodynamic
derivatives, i.e.:
∂X
Xu̇ = (4.7)
∂ u̇
Because of this, one could of course model a submarine with a Taylor expansion
of higher order. However, this is unusual in previous works in this subject in order
to avoid unwanted behaviour to far from the operating point, i.e., outside some
interval of validity. The reader will probably notice that the Taylor expansion in
Equation (4.6) does not include all the possible combinations of (u, v, w, p, q, r), this
is because some are considered zero, or at least small, which will be shown.
The added mass terms add additional u̇, v̇, ..., ṙ terms to Equation (4.2), which
are collected into the symmetric added mass matrix [Fossen, 2011]:
  
Xu̇ Xv̇ Xẇ X ṗ Xq̇ Xṙ u̇
 Yu̇ Yv̇ Yẇ Yṗ Yq̇ Yṙ   v̇ 
  
 Zu̇ Zv̇ Zẇ Z ṗ Zq̇ Zṙ 
 ẇ + ...
 
FHD = 
 Ku̇ (4.8)
 Kv̇ Kẇ K ṗ Kq̇ Kṙ  

 ṗ 

Mu̇ Mv̇ Mẇ M ṗ Mq̇ Mṙ   q̇ 
Nu̇ Nv̇ Nẇ N ṗ Nq̇ Nṙ ṙ

42
4.1 Modelling of a submarine

Rearranging Equation (4.2) with only derivative terms on the left hand side yields:
  
m 0 0 0 mzG −myG u̇
 0
 m 0 −mz G 0 mx G   v̇ 
  
 0 0 m my G −mx G 0   ẇ 
   = ...
 (4.9)
 0
 −mz G my G Ix −I xy −I zx   
  ṗ 
 mzG 0 −mxG −Ixy Iy −Iyz   q̇ 
−myG mxG 0 −Izx −Iyz Iz ṙ

Moving the added mass term in Equation (4.8) to the left hand side and combining
with Equation (4.9) gives:
 
m − Xu̇ −Xv̇ −Xẇ −X ṗ mzG − Xq̇ −myG − Xṙ
 −Yu̇ m −Yv̇ −Yẇ −mzG −Yṗ −Yq̇ mxG −Yṙ 
 
 −Zu̇ −Zv̇ m − Zẇ myG − Z ṗ −mxG − Zq̇ −Zṙ 
 
 −Ku̇ −mzG − Kv̇ myG − Kẇ Ix − K ṗ −Ixy − Kq̇ −Izx − Kṙ 
 
 mzG − Mu̇ −Mv̇ −mxG − Mẇ −Ixy − M ṗ Iy − Mq̇ −Iyz − Mṙ 
−myG − Nu̇ mxG − Nv̇ −Nẇ −Izx − N ṗ −Iyz − Nq̇ Iz − Nṙ
(4.10)
which is the so called mass matrix, which will be denoted M. Since the submarine
accelerates water around its hull, the apparent mass will increase which means
that at least the diagonal elements of Equation (4.8) should be negative, in order to
increase the diagonal elements in Equation (4.10).
Due to hull symmetry, many of these added mass coefficients are zero. For sub-
marines, it is common to assume symmetry about the xz- plane which leads to the
following terms being zero, some of these due to symmetry in the added mass matrix
[Watt, 2007]

Xv̇ , X ṗ , Xṙ ,Yu̇ ,Yẇ ,Yq̇ , Zẇ , Z ṗ , Zq̇ , Ku̇ , Kẇ , Kq̇ , Mv̇ , Mq̇ , Mṙ , Nu̇ , Nẇ , Nq̇ = 0 (4.11)

Determine hydrodynamic coefficients


Model testing A common method of determining hydrodynamics coefficients is to
experiment on a small replica of the vessel in a laboratory pool. This method can be
considered to be the most accurate since there are no assumptions or simplifications
involved. The coefficients derived for the model will then be scaled to fit a full scale.
These coefficients may be accurate for the model, but some accuracy is lost due to
nonlinearity in the equations, and non scaling water viscosity [Larsson and Raven,
2010]. During the testing, the model is forced into certain manoeuvres and the
forces on the hull are measured [Åström and Källström, 1976].
Real testing Another alternative is to derive the coefficient through actual full
scale testing, as previously done in [Åström and Källström, 1976], where the coef-
ficients for a freighter and a tanker where derived through actual testing. An issue
with this is the cost, especially for submarines where the operating costs are huge.

43
Chapter 4. Development

As also pointed out by [Åström and Källström, 1976], for a full identification to be
possible, information about the motion in all the possible degrees of freedom is nec-
essary. For a surface going vessel this means you need to measure, u, v, and r, and
for a submarine with 6 DOF you need to measure all the six movements u, v, r, p, w,
and r for a proper system identification.
Computational fluid dynamics (CFD) Computational fluid dynamics, is the
generic name for software used to simulate fluid motion and force on submerged
or partly submerged bodies. They have not yet been fully accepted in the scientific
community and pool testing is still preferred when designing hulls. However, with
increased computational capacity in the every day computer, CFD softwares are
becoming more and more popular in prediction of ship motion. This can be seen by
the numerous reports in the last years where authors simulate ship motion or derive
the hydrodynamic coefficients through a CFD software, .e.g., [Toxopeus, 2011].
Prediction formulas Despite the lack of manageable analytic theory in the subject
of hydrodynamics, there do exist some partly analytic, partly empirical, formulas in
predicting added mass terms for submarines.

Ship manoeuvring forces


One of the difficulties with hydrodynamic modelling, is to model hydrodynamic
forces when turning, i.e., drifting. Hydrodynamics coefficients in steady state are
somewhat constant but when the state change, the water flow around the hull
changes direction and with that the hydrodynamic derivatives. As for the hull drag,
a simple way of tackle this is to divide the flow into components and let the drag
force in the different directions act on the water’s relative inflow speed. That is, the
drag force in yR is a function of the sway v and the yaw r, and correspondingly,
the force in the xR - direction is a function of the surge u. The problem with this
method is that the inflowing water sees a different shape and effective area in case
of a drift, which means that the drag coefficients do in a way change with the angle
of drift. A submarine will also be exerted to lift forces due to hull bound vortexes
which is described in Section 3.1. Even more complex, typically for 6 degrees of
freedom systems, is combined movement, e.g., a pitching movement while yawing.
In the case of submarines, these motions will be handled separately as suggested by
[Fossen, 2011], that is, the model will not explicitly account for combined yaw and
pitch movements.
[Feldman, 1979] proposes a way to model hull drag by applying strip theory,
i.e., split the hull in multiple sections and then, the drag force on a section will be a
function of the local velocity. For example the integral term in the YHD - expression
with w = 0: Z
ρ
− Cd h(x)(v + r · x)|v + r · x|dx (4.12)
2 L

where h(x) is the local hull height and L is the hull length. Correspondingly, the

44
4.1 Modelling of a submarine

yaw moment due to a turning motion will be:


Z
ρ
− Cd x · h(x)(v + r · x)|v + r · x|dx (4.13)
2 L

Hydrodynamics in literature
[Feldman, 1979] provides a complete notation and collection of the David W. Taylor
naval ship research and development center standard equations of motion for sub-
marines. These equations are widely quoted and referred to in submarine modelling
papers and is, according to FOI4 , still the standard way of modelling underwater
vehicles with six degrees of freedom. In addition to the hydrodynamic derivative
terms, Feldman includes integral terms to model drag while turning and flow vortex
lift effects. These equations will be extensively used in this thesis.
[Humphreys and Watkinson, 1978] provides analytical expressions for approxi-
mating added mass terms. This is done by collecting work from [Lamb, 1932] and
approximating the bare hull of a submarine as an ellipsoid. In addition, the paper
includes semi-empirical added mass and inertia effects due to the flow around the
hydroplanes. Finally, the validity and problems with the formulas are discussed.
[Ridley et al., 2003] uses a simplified version of Feldman’s standard equations
to simulate a torpedo. The coefficients are derived through physical model testing
in a pool. From Feldman’s equations the integral terms due to turning drag and
hull vortexes are excluded. This is instead modeled by letting the force always be
directed opposite to the inflow of the water with a drag coefficient that increases
quadratically with the angle of attack and drift. The drag force is then divided into
components in the different directions and will serve as drag when the model is
turning, i.e., drifting.
[Watt, 2007] uses a CFD software to derive the hydrodynamic derivatives for a
submarine computer model. However, he uses a distinct way of calculating the drag
where coefficients are functions of the sway and heave drifts, e.g., the drag in xR -
direction: p
XD = Xuvw (u, v, w) · ( u2 + v2 + w2 )2 (4.14)
This is a way to model the change of flow around the hull while manoeuvring.
[Toxopeus, 2011] simulates a number of surface vessels with the hydrodynamic
forces and moments computed through a CFD software, unlike the more common
way of a coefficient based prediction. He finds that this is a more accurate approach
in simulating water going vessels.
[Fossen, 2011] and [Fossen, 1994] are extensive works that collects a great deal
of the current knowledge in the subject of hydrodynamics. The author compiles a
number of different models that have been used in predicting ship motion through
water over the years and refer to [Humphreys and Watkinson, 1978] for discussion
and prediction of submarine hydrodynamic derivatives.
4 Totalförsvarets forskningsinstitut, (Swedish defence research agency)

45
Chapter 4. Development

4.2 Generic submarine model


In this Section a model for a generic submarine will be derived. The equations in
[Feldman, 1979] will serve as a template. The hydrodynamic added mass terms will
be approximated according to [Humphreys and Watkinson, 1978].
As for the rudders, the equations proposed by [Toxopeus, 2011] will be used and
modified for three dimensions and for the rotor propulsion and torque, the model in
[Watt, 2007] will be used.

Hydrodynamic derivatives
The hydrodynamic derivatives will be calculated by approximating the submarine
as an ellipsoid. The hydroplanes are seen as flat plates as suggested by [Humphreys
and Watkinson, 1978]. The added mass effect from the sail will be calculated by
approximating the sail as a huge hydroplane.

Cross flow drag


The cross flow drag was modelled according to [Feldman, 1979].

Z q
ρ
Y : − Cd h(x)v(x) (w(x)2 + v(x)2 )dx (4.15a)
2
ZL q
ρ
Z : − Cd b(x)w(x) (w(x)2 + v(x)2 )dx (4.15b)
2
ZL q
ρ
M : − Cd x · b(x)w(x) (w(x)2 + v(x)2 )dx (4.15c)
2
ZL q
ρ
N : − Cd x · h(x)v(x) (w(x)2 + v(x)2 )dx (4.15d)
2 L

where b(x) and h(x) are the local width and heigh at x. w(x) and v(x) are the local
velocities at x:

v(x) = v + r · x
(4.16)
w(x) = w + q · x

Cd in (4.15) is the cross flow drag coefficient. For accurate prediction, Cd will have
to be specified separately for each Equation in (4.15). Since the hull has different
shape over the body, and the local velocities are different over the hull according to
Equation (4.16), an even more accurate prediction will be to also let Cd be a function
of the position x and the local velocity.
When specifying a submarine model, the functions h(x) and b(x) will have to
be provided. When not specified, the model will use the value Cd = 1.19 for all
equations in Equation (4.15) as suggested by [Hickey, 1990].

46
4.2 Generic submarine model

Figure 4.2: Rudder angles in three dimensions.

Control surfaces
[Toxopeus, 2011] presents formulas for rudder forces and moments for a surface
going vessel. These equations, modified to fit three dimensions, will be presented
in this section. As described in Section 3.1, the formulas need the hydrodynamic
rudder angle δh .
The water velocity vector at a rudder at the position xr (w/o hull and rotor ef-
fects) is calculated in Equation (4.17).

vr = −(ν 1 + ν 2 × xr ) (4.17)

ν1 = (u, v, w)
(4.18)
ν2 = (p, q, r)
This velocity will be projected on a plane orthogonal to the rudder, with normal N,
see Figure 4.2.
NN|
Vre = (I − | )Vr 5 (4.19)
N N
Note that Vr and vr is the same vector, only that Vr is the vector expressed as a
column matrix. δh will be the angle between Vre and [−1 0 0]| . The drag and lift
forces Dru and Lru , are calculated according to Section 3.1. The direction for Dru
will be the same as Vr . Lru will work in the direction N×Vr .

47
Chapter 4. Development

Each hydroplane will have a specific direction in which it operates, i.e., a normal
rudder could have the direction (0, 1, 0) and a horizontal hydroplane could have
the direction of operation
√ √(0, 0, 1). As for an × configuration, the force directions
could be (0, ±1/ 2, ±1/ 2). Apart from that, the user will have to specify the
hydroplane positions xhp1−6 , the hydroplane area and the lift and drag coefficients
Cl and Cd . With this data, the lift and drag forces and moments for each hydroplane
are calculated.
An issue with the equations presented by [Toxopeus, 2011], is that they do not
deal with cross flow and coupled motion in 3 dimensions. For a + rudder config-
uration and no combined pitch/yaw motion, this would not be a problem. But for
× rudder configurations, the rudders will experience coupled motion even when
combined pitch/yaw motion is avoided.

Tower drag and lift


An attempt to model the tower lift and drag was done by using the same equations
as for the hydroplanes, applied to the tower dimension and position. It is difficult to
study the validity of this method. The only validation performed, was to study the
directions of the forces, but not the magnitude. This suggest that this approximation
should not be used in a simulation before this method is verified. This will not be
further discussed.

Propeller propulsion and force


Equations for forces and torques created by the propeller, were presented in Section
3.1, where XP and KP depend on the coefficients Kt and Kq , which in turn are func-
tions of the advance ration J. These two coefficients depend heavily on the shape
of the propeller and have to be derived through actual testing or CFD calculations,
which is outside the scope of this thesis. As for the generic model, the user has
to specify how Kt and Kq are functions of J. However, the model will provide a
suggested relation according to previous works.
[Watt, 2007] presents two eighth-order polynomial interpolations for Kt and Kq
as functions of the advance ratio J, derived through CFD calculations. Other rela-
tions have been derived, e.g., by [Toxopeus, 2011], but [Watt, 2007] also deals with
the subject of submarines, hence, this was chosen. The coefficients Kt and Kq as
functions of the RPS n at two different speeds are plotted in Figure 4.3. The in-
terpolating polynomials can be found in Appendix A.1. The reader will probably
notice the RPS n in the denominator for the advance ratio, this function is there-
fore not valid for close to zero RPS. At some points, Kt and Kq are negative, which
mean that the force/torque from the propeller is negative, which of course is not
at all impossible, since slow RPS at high velocities could produce more drag than
propulsion.

48
4.2 Generic submarine model

(a) Kt , u fixed. (b) Kq , u fixed.

(c) Kt , n fixed. (d) Kq , n fixed.

Figure 4.3: Kt (J) and Kq (J) relation.

Hydroplane dynamics
The submarine model is manoeuvred by slanting the hydroplanes, i.e., specifying
mechanical angles δk . However, positioning the hydroplanes are control problems
themselves. An accurate dynamic model description for the different hydroplanes
is outside the scope of this thesis, although it could be desirable to include some
hydroplane dynamics.
For the generic model, the positioning of the hydroplanes is approximated by a
simple first order system where it is possible for the user to specify a time constant
for each control surface.

1
δk = δre f k (4.20)
s/Tk + 1

49
Chapter 4. Development

Figure 4.4: Submarine demo model.

Rotor dynamics
Similarly to the hydroplanes, the rotor dynamics is approximated by a simple first
order system with a user defined time constant.

1
n= nre f (4.21)
s/T + 1

4.3 Submarine demo model

During the literature study for this thesis, the authors came into contact with FOI.
They confirmed the difficulties in modelling water crafts but provided a full model
of a demo submarine derived through CFD calculations of a CAD model of a sub-
marine (Figure 4.4). The mathematical model was according to Feldman’s equa-
tions. Table 4.1 shows the mechanical data for the demo submarine. The complete
set of hydrodynamic coefficients can be found Section 6.1, and compared with the
coefficient derived from mechanical data according to the approximation method
by [Humphreys and Watkinson, 1978].
General features of the demo model Some general features of the demo subma-
rine are presented in the list below.
6 Relative the aft of the submarine, expressed a as positive oriented orthonormal coordinate system
(x, y, z) with z- axis upwards.

50
4.4 Control design

unit data
surfaced mass [kg] 1942.3 ·103
submerged mass [kg] 1942.3 ·103
Ix [kg·m2 ] 1.3 ·107
Iy " 43.7·107
Iz " 43.2·107
Ixy " -99·103
Izx " -7478·103
Iyz " -56·103
L (length) [m] 6.23
max height [m] 11.9
max with [m] 6.20
rotor diameter [m] 3.40
aft HP area [m2 ] 6.08
tower HP area [m2 ] 3.41
xG 6 [m] (32.61, 0.000, −0.067)
xB [m] (32.61, 0.000, 0.136)

Table 4.1: Main data of the demo submarine.

• The submarine has tower hydroplanes instead of bow hydroplanes.


• The submarine has × aft rudder configuration.
• No propulsion was modeled by FOI, instead the method described in Section
4.2 will be used.
• Rudder forces have a linear relation to the rudder angles, except for drag
in xR direction which will have a quadratic relation, according to Feldman’s
equations.
• Rudder forces have a quadratic relation to the forward speed u, as is also
according to Feldman’s equation.
The aft hydroplanes are numbered as: 1- upper starboard, 2- lower starboard, 3-
lower port, and 4- upper port. The mechanical rudder angles are oriented such that
a positive rudder angle results in a positive roll moment.

4.4 Control design


The submarine demo model was chosen to be the final model for which an autopilot
were designed.
This section does not present numbers or controller parameters, but rather a
thorough explanation of the controller design.

51
Chapter 4. Development

Model IOs
The control signals to the submarine at the current state7 are the requested hy-
droplane positions and rotor RMS. The outputs are the signals measured by the
INS and the control efforts, i.e. actual hydroplane positions and rotor RMS, see
Figure 4.5. The possibility to view the true states of the process will also exist for
validation purposes.

Figure 4.5: Submarine simulator IOs.

Controller task
With the controller requirements from Section 1.4, the final system should take the
form as in Figure 4.6. Since there are no requirements for velocity control, this
will not be included in this thesis, i.e., the control system’s means to actuate the
submarine will be through the hydroplanes.

Figure 4.6: Simulator system IOs.

Controller hierarchy
The submarine has a number of different modes, but not all are required to follow a
reference. When linearized, the system was chosen to have the states x̄ in Equation
4.22.
x̄ = [φ θ δ1 δ2 δ3 δ4 δ5 δ6 u v w p q r]| (4.22)
7 Future work could include including the condition of the different tanks as control signals.

52
4.4 Control design

Figure 4.7: r, φ , θ controller.

Depth and heading are not included in the state vector. They do however have a
dynamic relation to the state vector. With zero roll (φ = 0), the change in depth can
be expressed as ż = w − u · sin(θ ). In a sledge mode depth changing manoeuvre, w is
not accounted for, and for small θ the equation falls down to a first order integrator
at a certain speed (u constant):
ż = u · θ (4.23)

As for the elevator depth changing manoeuvre, the pitch will stay zero and the
relation becomes instead:
ż = w (4.24)

With zero roll and pitch, the change in yaw will also be of first order integrator
characteristics, ψ̇ = r. The natural choice for a controller structure would then be
to, at first, stabilize and control φ , θ , and r (Figure 4.7). With this, controlling the
depth and yaw becomes a simple task.

Inner controller
The inner loop r, φ , θ -controller was chosen to be of LQ8 state feedback character-
istic. An integrator for each controlled mode was added to remove stationary errors
caused by simulated stationary disturbances and model inaccuracies due to the lin-
earization. The system on state space form becomes, with the notation in 3.3, as in
Equation (4.25).
x̄˙ = Ax̄ + Bδ re f
 
0 0 0 ··· 0 1 (4.25)
z = Mx̄ = 1 0 0 · · · 0 0 x̄
0 1 0 ··· 0 0
In order to allow state feedback, an observer had to be added since only the INS
and control effort signals can be measured. The final inner loop control structure
can be found in Figure 4.8.
8 Linear Quadratic Control, i.e., linear system with quadratic criteria

53
Chapter 4. Development

Figure 4.8: Inner loop controller structure.

State feedback The state feedback gain L was calculated with the Matlab com-
mand lqry(sys, Q, R, N), which computes the optimal state feedback controller of
system sys with the weight function, see Section 3.3:
J = z| Q z + δ |re f R δ re f + z| N δ re f (4.26)
State feed forward The feed forward gain Lr is given by Equation 3.3
[M(BL − A)B] · Lr = I3×3 (4.27)
M(BL−A)B has the size 3×6, and Lr the size 6×3. Equation (4.27) is therefore an
underdetermined system of equations, i.e., we have a total of 18 unknown variables
but only 9 equations. This was expected, since there are more than one way to
operate the hydroplanes to create a certain movement. In addition to this, a change
in roll reference will probably never occur. This means that the second column in
Lr is of no interest. The second row of M(BL − A)B and the second column of Lr
are therefore removed, and form Γ and L̂r .
Γ · L̂r = I2×2 (4.28)
The result is a system of equations with 12 unknown variables but only 4 equations.
This meant that it was possible to add more constraints on the solution. To begin
with, there is no need for the bow/tower hydroplanes to answer to a reference change
in r, which means L̂r5,1 = L̂r6,1 = 0. The bow/tower HPs are also often connected,
i.e., L̂r6,2 = L̂r5,2 . Equation (4.28) becomes:
 
L̂r1,1 L̂r1,2
L̂r2,1 L̂r2,2 
   
L̂r3,1 L̂r3,2  1 0
Γ·
= 0 1
 (4.29)
L̂r4,1 L̂r4,2 
 0 L̂r5,2 
0 L̂r5,2

54
4.4 Control design

Equation (4.29) is still an underdetermined system of equations. Consider instead


the optimization problem of solving (4.29) with the least possible control effort. The
h i δ at a reference change relate to the values in Lr . With L̂r = [L̂r1 L̂r2 ],
HP angles
X = L̂L̂r 1 is defined.
r2
min X| HX
X
(4.30)
s.t. Γ · L̂r = I2×2
With H in Equation (4.30) it is possible to weigh certain HPs, to create the desired
reference tracking control. It is also possible to add additional constraints to the
problem (4.30), e.g., if one hydroplane has malfunctioned it is possible to add this
as a constraint to the optimization problem.
Observer The state feedback controller requires the state vector
x̄ = [φ θ δ1 δ2 δ3 δ4 δ5 δ6 u v w p q r]| . From Section 1.1 the measured states could
include y = [φ θ δ1 δ2 δ3 δ4 δ5 δ6 u p q r]| . However, as for u, the observer would
naturally believe that u is constantly decreasing due to the rotor RPS is not included
as a model actuator. This would probably result in a stationary error in the log ve-
locity u. To counter this, a new system model was derived for the observer where the
rotor RPS was included as a system actuator together with the hydroplane angles.
To simplify the observer, the actual hydroplane angles and rotor RPS served as the
input signals since they were all measurable. This resulted in the state space system
in Equation (4.31) for the observer with the states x̄0 = [φ θ u v w p q r], and system
matrices A0 , B0 , and C0 .
 
δ
x̄˙ 0 = A0 x̄0 + B0
n
  (4.31)
I 03×2 03×3 0
y0 = 3×3 x̄
03×3 03×2 I3×3

with:
|
x̄ = y01 y02 δ| y03 · · · y08

(4.32)
A Kalman filter was used to estimate the states in Equation (4.31). Assume that
model disturbances and measurement noise η 1 and η 2 act on the system (4.31) as
x̄˙ 0 = . . . + Nη 1 and y0 = . . . + η 2 . η 1 was chosen to be external force and torques.
Hence, N ≈ M−1 . If it is necessary to account for model inaccuracies due to lin-
earization of a nonlinear model in the Kalman filter, it too has to be included in the
correlation matrix for η1 .
Integrators The integrators simply continuously integrate the control errors in
r, φ , and θ . These are added to the controller output after being multiplied by tun-
ing constants. According to the hydroplane orientation in Section 4.3, the integrators
will be added to the HP angles as in Figure 4.9.

55
Chapter 4. Development

Figure 4.9: Integrator signs.

Heave controller
The inner control loop does not include elevator mode control since it only allow ref-
erences in r, φ , and θ . Another controller was added parallel to the inner controller
for this purpose, named the heave controller, see Figure 4.10. In an elevator mode
manoeuvre, this controller use the tower HP to heave the submarine, i.e., change
the depth. Meanwhile, the pitch reference is kept zero and the inner controller will
work to keep the submarine at zero pitch.
Controller type The heave controller was chosen to be of PID type with control
signal saturation and integrator anti-windup. To improve performance, a second or-
der prefilter F(s) was added to smooth out reference steps.
5
F(s) = (4.33)
s2 + 20s + 5

Reference saturation A linear system with a linear controller acting on different


reference changes will scale the controller effort linear with the reference changes.
That is, let u(t) be the initial controller output from a reference change r(t). If the
reference change is scaled by a constant C, i.e., r2 (t) = C · r(t), the control effort
will be u2 (t) = C · u(t).
For a submarine, as for many other practical control problems, it is not possible
to always linearly scale the controller effort with the reference change, due to actu-
ator saturations9 . With anti-windup properly implemented on the controller I part,
this does not have to be a problem. But the submarine autopilot should be able to
answer to a wide range of reference changes, e.g., a depth change of a few meters
to perhaps 200m, both which should be performed in a similar manoeuvre.
9 In the case of submarines, the hydroplanes angles have a mechanical limit.

56
4.4 Control design

Figure 4.10: Heave controller in parallel with the inner controller.

Assume a submarine in an elevator depth changing mode. In the case of a huge


reference change, the P part in a PID controller would immediately saturate the
tower hydroplanes. Compare this to a lower reference change, low enough for the
P part to not saturate the hydroplanes. Perhaps the integrator part will saturate the
hydroplanes after some time, but in either case, the responses will initially look
different.
In Figure 4.11, a system is simulated with with two different reference steps.
The saturation on the control effort is 1. As can be seen, the control effort with the
larger step is immediately saturated while for the smaller, it is saturated only after
some time. This effect will show up when changing submarine depth in an elevating
fashion. In order to make the two step responses look more alike, a saturation on
the control error was added for the depth. The PID was tuned for a certain step
response, e.g., 10m, and then the control error was saturated to not make larger
steps then that, i.e., ±10m, see Figure 4.12. Two different step responses will now
look somewhat alike, apart from that that the big reference step (blue line in Figure
4.11) will raise further than the small step (red), before flattening out. This will
make depth changing look something like in Figure 4.13.

Gain scheduling
According to the controller task in Section 1.4, the controller was chosen to include
three different modes for different regions of velocity (Figure 4.14), with borders 6
and 13 knots. To avoid back and forth switching close to a border, a hysteresis on
0.3 m/s was added. Controller options are found in Table 4.2.
Three different controllers were derived, one for each velocity region. Since the
submarine has quadratic dynamics, the controllers were designed at the velocities
3, 6 and 8 m/s, i.e., in the upper half of the regions. Due of the quadratic behaviour,

57
Chapter 4. Development

Figure 4.11: Simulated output from the same control system with different reference
step. Blue: large step, red: smaller step

Figure 4.12: Control error saturation.

the dynamic mean in each region should be at a velocity closer to the upper end of
each region.

Integrators To achieve bumpless control, the integrators had to include tracking


(see Section 3.3), i.e., the non-active integrators will follow the output of the active
one.

Observers In order to allow different observers for the three different regions, it is
possible to individually activate and deactivate the observers. The switching should
be performed with minimal bump, hence, the output from the last active observer
serves as an initial state to the activated one.

58
4.4 Control design

Figure 4.13: Step response with control error saturation.

Figure 4.14: Velocity regions, the shaded part is the hysteresis.

region 1 2 3
tower HP on on off
depth k. mode elevator mode elevator mode sledge mode
depth c. mode " sledge mode "

Table 4.2: Controller features in the regions.

State FF and FB The submarine was numerically linearized at the three different
velocities (3, 6, and 8m/s). State FB gains were derived with different weighting
matrices.
As for the lower region, the tower HP are used to elevate the submarine in depth
changing and depth keeping manoeuvres which are not explicitly accounted for
in the state FF and FB. The tower HP were hence greatly weighted in order to

59
Chapter 4. Development

minimize interference between the controllers, i.e., the FB should not use the tower
HP to control the pitch since they are extensively used by the heave controller. As
for the state FF in the low velocity region, the tower HP angle = 0 was a condition
to the optimisation.
The medium velocity region features a combined elevator and sledge depth
changing mode. Depth changing manoeuvres are performed in sledge mode, while
depth keeping are performed in elevator mode. Here the tower HP are weighted less
compared to the low and high velocity regions.
In the high velocity region, again, the tower hydroplanes are heavily weighted
even though they are not used by another parallel controller. This is to satisfy the
controller task in Section 1.4. To keep the tower HP mechanical angle zero was a
condition to the FF optimization, as in the lower region.
Since the state FB and FF gains are different in the regions, the controller will
suffer a slight bump at the moment of the switch.

Outer loop

Figure 4.15: Inner and outer loop control.

The outer loop controller will be the interface between depth, pitch, and head-
ing references from the operator, and yaw rate, pitch, and roll references to the inner
loop controller. It is integrated in the control system as shown in Figure 4.15. The
outer controller will see the inner loop, as simple first order integrators K/s as ex-
plained in Section 4.4. First order integrator control, can be achieved by simple P
controller. However, the inner loop can only be seen as first order integrators below
its bandwidth ωB . This gives us a fundamental limitation on the speed of the closed
outer loop, i.e., P · K << ωB (Figure 4.16).
Heading control Figure 4.17 shows the structure for the outer loop heading con-
troller. It is of simple P characteristic with a saturation to avoid huge r reference
signals. The saturation is dynamic, i.e., different in each velocity region, higher
speeds allow higher yaw rate r.

60
4.4 Control design

(a) Integration system with P controller.

(b) Closed loop bode diagram.

Figure 4.16: Integrator controller bandwidth.

Figure 4.17: Outer loop heading controller structure.

The heading measurement from the INS is in the interval 0 − 360◦ . Such a non-
linearity will cause control problems. Assume that the current heading is 10◦ and
a new reference is given to 350◦ . The favourable choice of turning, is of course to
steer port 20◦ , but the controller will steer the submarine the other way. Instead, if
the new reference should be −10◦ , the submarine will turn to port, but will not stop
at 350◦ . The heading from the INS will therefore be unwrapped from the interval
[0, 360) and instead ∈ R. This means that if the submarine has started facing north,
spun around two turns to end up facing north again, this unwrapped heading will be
720◦ . With this, in the example above, the reference signal can indeed be -10◦ and
the submarine heading will end at 350◦ (unwrapped heading will be -10◦ ).
It is now a simple task to perform different turning manoeuvres, e.g., if the
submarine should make the shortest turn, longest turn, make the turn port/starboard,
etc. Assume that the current unwrapped heading is 730◦ (INS heading is 10◦ ) and
a new heading reference is given to face east (wrapped heading ref 90◦ ). If the
submarine should take the closest path, the new unwrapped heading reference will

61
Chapter 4. Development

Figure 4.18: Outer loop depth control structure.

be 720◦ + 90◦ = 810◦ . To make the submarine take the longer way the reference
should be set to 720◦ − 270◦ = 450◦ etc.
Depth control The depth controller (Figure 4.18) will provide a pitch reference
to the inner loop in the high velocity region and, while in depth changing mode, in
the medium velocity region. While in depth keeping mode (medium velocity region)
and in the low velocity region, the heave controller will control the depth, hence, the
pitch reference to the inner controller, will be the external pitch reference from the
operator (at most times zero). The selection input block in Figure 4.18 will choose if
the operator pitch reference shall be passed to the inner loop, or the pitch reference
from the outer loop depth controller, in the latter case the heave controller should
not operate. This selection will also be a part of the outer loop controller. A control
signal saturation is added to avoid huge pitch references to be passed to the inner
loop controller.
Controller enabling and resetting The outer loop controller is a more sophis-
ticated controller than the inner loop controller. It does more logical decisions,
e.g., determines the current velocity region and switches between depth keep-
ing/changing mode. To accomplish this, it needs the possibility to turn off the heave
controller. The inner loop and heave controller therefore need to support more util-
ities in form of switching (between regions) and integrator enabling/disabling and
reset. To simplify, all integrators/PIDs are reset when disabled.
• All the integrator are disabled (and reset) during a corresponding manoeuvre,
i.e., the pitch integrator is disabled during a sledge depth changing motion
and the yaw rate integrator is disabled when initiating a heading change. The
roll reference is always zero, hence the roll integrator will not be disabled due
to a reference change.
• All integrators are disabled when the corresponding control effort is higher
than a certain threshold, e.g., 90% of the maximum control effort.

62
4.4 Control design

• The heave PID is disabled when in:


1. sledge mode in the medium region
2. high velocity region

Outer loop controller structure Figure 4.19 shows the complete structure for the
outer loop. The different part will be summarized in the list below.

• determine velocity region. This block simply determines which is the current
velocity region according to Figure 4.14.
• determine manoeuvring. If a new reference larger than a certain threshold has
been given, this block sets manoeuvring to true. Observe, manoeuvring is a
vector with two elements for heading and depth respectively. manoeuvring is
set to false when nearing the reference.
• determine mode. This block determines if the submarine currently should
move in a sledge or elevating fashion. Naturally, it needs the region and if
the submarine is in a manoeuvre.
When in the low velocity region, as seen in Table 4.2, the submarine controller
will always stay in elevator mode.
In the medium velocity region, the submarine will be in elevator mode when
manoeuvre is false and switch to sledge mode, when manoeuvre turns true.
In the high velocity region, sledge mode is always chosen.
• P controllers. This block contains the P controllers for depth and heading.
• controller enable/ disable. This block turns on/off the heave PID and the inner
loop controller integrators.

63
Chapter 4. Development

64
Figure 4.19: Outer loop controller structure.
5
Results

5.1 Time constants and saturations


This is a collection of the time constants and submarine actuator saturations, that
was used in the submarine simulator.
• Time constants for all the hydroplane was chosen to 3s.
• Time constant for the rotor was chosen to 6s.
• Hydroplane angle saturation was chosen to ±30◦ .
• Rotor RPS was saturated to [0.6, 2.4]/s to fit the velocity interval 4- 16 knots.

5.2 Final controller


Inner loop controller
State FB The state feedback gain was calculated with the weights for the different
regions as presented in Table 5.1.
State FF Table 5.2 displays the weights and conditions used to calculate the feed-
forward gain Lr in the three regions, see Section 4.4 for information how this was
calculated.

region 1 2 3
h 5000 0
i h 1000 0
i h 1000 0
i
Q 0 10 0 0 10 0 0 10 0
0 0 10 0 0 10 0 0 10
 0.1 0 0 0 0 0   0.1 0 0 0 0 0   0.1 0 0 0 0 0 
0 0.1 0 0 0 0 0 0.1 0 0 0 0 0 0.1 0 0 0 0
R  0 0 0.1 0 0 0   0 0 0.1 0 0 0   0 0 0.1 0 0 0 
0 0 0 0.1 0 0 0 0 0 0.1 0 0 0 0 0 0.1 0 0
0 0 0 0 1.0 0 0 0 0 0 1.0 0 0 0 0 0 10 0
0 0 0 0 0 1.0 0 0 0 0 0 1.0 0 0 0 0 0 10

Table 5.1: State FB weights.

65
Chapter 5. Results

region 1 2 3
tower HP does respond
off off
conditions to reference in θ
1 0 0 0 0 0 0 0 0 0 0 0

0 1 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 0 0 
0 0 0 1 0 0 0 0 0 0 0 0 
0 0 0 0 − 0 0 0 0 0 0 0 
H
0 0 0 0 0 − 0 0 0 0 0 0  " "
0 0 0 0 0 0 1 0 0 0 0 0 
0 0 0 0 0 0 0 1 0 0 0 0 
0 0 0 0 0 0 0 0 1 0 0 0 

0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 50 0
0 0 0 0 0 0 0 0 0 0 0 50

Table 5.2: State FF weights and conditions.

Integrators The numerical values will not be presented, see Section 4.4 for infor-
mation about the integrators. The integrators were implemented in discrete time as
mentioned in Section 2.2.
Observer The observer was also implemented in discrete time by sampling the lin-
earized model. The observer gains were then calculated with white noise intensities
presented in Equation (5.1).

104 0 0 0 0 0
 
4
|  0 10 04 0 0 0 
E(η 1 · η 1 ) =  0 0 100 1006 00 00 
 0 0

0 0 0 0 106 0
6
 0−130 0 0 0 10  (5.1)
10 0 0 0 0 0
−13
 0 10 0 0 0 0 
E(η 2 · η |2 ) =  0 0 10−11 0 0 0 
 0 0 0 10−12 0 0 
0 0 0 0 10−12 0
0 0 0 0 0 10−12

Heave controller
Again, the authors see no point in presenting the numerical values of the PID con-
troller. As for the control error saturation, it was chosen to ±5m. The output from
the PID saturated at ±20◦ . Also the heave controller was a discrete controller.

Outer loop controller


Saturations As mentioned in Section 4.4 the P controllers for references in r and
θ to the inner loop were saturated to avoid huge reference signals. The final results
from these are presented in Table 5.3.
Switching To summarize, the conditions for the different outputs from the block
in Figure 4.19 are presented in Table 5.4.

66
5.3 Simulation plots

section 1 2 3
r ±0.6◦ /s ±1.2◦ /s ±3◦ /s
θ ±15◦ ±15◦ ±15◦

Table 5.3: Outer loop controller saturations.

5.3 Simulation plots


In this Section, a number of plots from different simulated manoeuvres will be pre-
sented to verify that the control system works as intended. Three different test ma-
noeuvres will be presented along with some of the most interesting plots.
When control efforts are plotted, they are normalized to be a percentage of the
maximum control effort, i.e., fit in the interval [−1, 1]. For example, the roll effort
is 1 if all the rudder are saturated to maximum positive angle, see rudder orientation
for the demo submarine in Section 4.3.

Test Case One


The first manoeuvre will be testing reference changes in heading and depth. This
test will be performed in the middle velocity region, around 6 m/s. The first change
in reference will be a change in heading, 90◦ starboard followed by 90◦ port. After
stabilizing, a reference change in depth will be performed, starting at a depth of
100m. First the submarine will dive to 120m, and then ascend to 80m. The results
of the simulation are presented in Figures 5.1-5.4.
Heading Change As seen in Figure 5.1, a heading change of 90◦ takes approxi-
mately 120 seconds in the current mode. This might not seem very fast, but as seen
in Figure 5.4, the yaw effort is relatively low, which means that a faster turn is pos-
sible. It can also be seen in Figure 5.3 that the submarine will pitch slightly positive
when initiating the turn. Real submarines do also have a tendency to lower their afts
when turning1 . Figure 5.4 proves that the control system compensates for this.
Depth Change Figure 5.2 displays the depth. During the veer (0-500s), the depth
alters slightly, which of course is an effect of the pitching motion. As seen in the
figure, a change of reference in depth of 20m as well as 40m takes approximately the
same time. According to Table 5.3, the pitch reference from the outer controller is
saturated at ±15◦ . The P part is for the current controller set to 0.3, which gives the
references to the inner loop controller: 0.3 · 20 = 6◦ , 0.3 · 40 = 12◦ . Hence the pitch
reference will not be saturated and the controlled system should follow somewhat
linear behaviour, i.e., double reference change = double control signal (Figure 5.4)
but the same rise time.
It should also be pointed out that the depth change is in sledge mode, since the
reference changes was greater than the threshold (Table 5.4). During the turn, the
1 The authors learned this fact from a co-worker at SAAB who have attended SASS product testings

67
68
region 1 2 3
Chapter 5. Results

region according to Figure 4.14 " "

true at reference change > 1◦ ,


false when
manoeuvring rre f " "
heading error < 1m
and r < 0.02rad/s

turns off at a reference


turns off at a reference change > 3m
manoeuvring θre f - change > 3.5m, turns on when
turns on when depth error < 3m
depth error < 3m and θ < 1◦
sledge mode if manoeuvre,
sledge/ elevator mode elevator mode sledge mode
else elevator mode
heave ctrl enabler on !manoeuvre off

integrator enable for r !manoeuvre & ctrl effort r < 0.9 " "

integrator enable for φ ctrl effort φ < 0.9 " "

integrator enable for θ ctrl effort θ < 0.9 !manoeuvre & ctrl effort θ < 0.9 !manoeuvre & ctrl effort θ < 0.9

Table 5.4: Switching conditions for the outer loop controller.


5.3 Simulation plots

controller is in depth keeping, i.e., elevator mode, which is seen in Figure 5.4 where
the heave controller is compensating the depth error during the turn.

Test Case Two


In this simulation the submarine will accelerate through all three velocity regions
while given a reference change in depth. This will show how the control system
handles the transfer between the different controllers. The results can be seen in
Figures 5.5-5.8.

Depth change A reference change is ordered at T = 100s, at the same time the
rotor RMS is increased and starts accelerating the submarine, see Figure 5.5. The
velocity region changes are marked with red rings, and occurs according to Figure
4.14 around 6 and 13 knots, or approximately 3.2 and 7 m/s.
Figure 5.7 displays the pitch, which in the first region is kept low. Figure 5.8
shows that the bow plane heave effort is large, meaning that the submarine changes
depth in an elevating fashion, as ordered by the outer controller.
In the second region, depth changing should be performed in a sledge fash-
ion (Table 4.2), meaning that it should pitch to change depth. This is confirmed in
Figure 5.7, where the submarine starts to pitch after the region change. Figure 5.8
shows how the aft and the tower hydroplanes work together to pitch the submarine.
Worth pointing out is the acceleration of the depth change when entering the second
region, i.e. changing from elevator mode to sledge mode. Depth changing seems to
be slower in elevator mode.
In the top speed region depth should, according to Table 4.2, only be controlled
by the stern hydroplanes. This means that the control effort from the bow planes
should be zero, which can clearly be seen in Figure 5.8.
During the moments of the switches, bumps in the control efforts are distin-
guishable, i.e., an effect from the gain scheduling explained in Section 4.4. This is
an undesirable behaviour, but fortunately, a manoeuvre like this is probably rare.

Test Case Three


Test case three will be similar to the previous one, except that the submarine will
turn two full laps while accelerating, instead of diving. This will illustrate how the
heading controller performs in the different regions. The results are shown in Fig-
ures 5.9-5.12.

Heading change As in the previous test case, the changes of regions are marked
with red circles in the figures. According to Figures 5.9 and 5.10, the max speed at
the final RPS of the propeller is apparently around 7.5 m/s when turning and 9 m/s
when traveling straight.
Figure 5.11 contains an xy position graph relative to the initial position. Figure
5.12 shows the control efforts and Figure 5.10, shows the heading.

69
Chapter 5. Results

As for the control effort in Figure 5.12, the controller is more aggressive in the
high speed region than in the low and medium speed regions. This is preferred since
often when travelling at slow speed, the submarine should produce minimal noise.
In Figure 5.10, a noticeable increase in heading derivative takes place at the
change between the low and medium velocity region, even though the control effort
is about the same. According to Section 4.3 the forces from the hydroplanes depend
on the velocity u squared, it is therefore expected that the submarine will turn faster
at higher speeds.
It is worth pointing out that the roll and pitch efforts increase in magnitude as the
speed gets higher. This is noted especially for the roll effort, where it is more than
50% of maximum control effort during T= 400-600s. Figure 5.13 displays zero roll.
The controller is apparently compensating for huge hydrodynamic forces acting to
roll the submarine. The turn is to starboard, and the roll effort says the rudders want
to roll the submarine anti-clockwise seen from behind. Thus, the forces acting on
the submarine during the turn seems to tend to roll the submarine inwards.

Rotor
This is just a brief Section of how the rotor RPS translates to the submarine velocity.
As seen in Figure 5.14, the relation seems to be linear, or at least affine.

70
5.3 Simulation plots

Figure 5.1: Test case one, Heading.

Figure 5.2: Test case one, Depth.

71
Chapter 5. Results

Figure 5.3: Test case one, Pitch.

Figure 5.4: Test case one, Control Efforts.

72
5.3 Simulation plots

Figure 5.5: Test case two, Velocity.

Figure 5.6: Test case two, Depth.

73
Chapter 5. Results

Figure 5.7: Test case two, Pitch.

Figure 5.8: Test case two, Control Efforts.

74
5.3 Simulation plots

Figure 5.9: Test case three, Velocity.

Figure 5.10: Test case three, Heading.

75
Chapter 5. Results

Figure 5.11: Test case three, Position in the xy-plane.

Figure 5.12: Test case three, Control Efforts.

76
5.3 Simulation plots

Figure 5.13: Test case three, roll.

Figure 5.14: RPS of the rotor vs. velocity.

77
6
Discussion

6.1 Hydrodynamic Coefficients discussion


Hydrodynamic coefficients can be analytically approximated with empirical formu-
las according to [Humphreys and Watkinson, 1978]. This method was applied to
the demo submarine received from FOI, and the results were compared with FOIs
hydrodynamic coefficients. They are both presented and compared in Table 6.1.
Some coefficients differ by up to 450%, however, it can be discussed how important
accuracy is for these coefficients.
[Humphreys and Watkinson, 1978] claims that there are 15 coefficients that are
more important than others. In Table 6.1, the error percentages between the ap-
proximated and received coefficients are calculated and presented in the right most
column. Some of the coefficients with the highest error percentage are not among
the 15 most important coefficients, however, the results are still differ by large val-
ues. This inaccuracy is probably the reason why this method is not commonly used,
since model tests or advanced CFD calculations are much more accurate.

Table 6.1: Hydrodynamic coefficients, Measured vs. Calculated.

Coefficient FOI Measured Calculated Difference (%) Humphrey difference (%)


Xu̇ −5.8503 · 104 −3.8999 · 104 33.33 11.5
Xu|u| −2.1638 · 103 −1.0567 · 104 -388.35 -
Xvv 2.2024 · 104 - - -
Xvr 1.9609 · 106 2.057 · 106 -4.9 8.0
Xww 7.2193 · 103 - - -
Xwq −1.4999 · 106 −1.8898 · 106 -26 0.1
X pr 3.7801 · 106 1.0718 · 106 71.65 -
Xqq 6.0774 · 106 −3.6633 · 105 106.03 -
Xrr 8.5083 · 106 1.7035 · 106 79.98 -
Yv̇ −2.1199 · 106 −2.0570 · 106 2.97 8.0
Y ṗ −3.7801 · 106 −1.0718 · 106 71.65 -
Yṙ −1.2619 · 107 −1.7035 · 106 86.50 -
Yv|v| −1.2348 · 105 - - -

78
6.1 Hydrodynamic Coefficients discussion

Yuv −1.1988 · 105 - - -


Yup −1.5497 · 105 - - -
Yur 1.0018 · 105 −3.8999 · 104 138.93 -
Ywp 1.6215 · 106 1.8898 · 106 -16.55 0.1
Y pq 1.5436 · 106 3.6633 · 105 76.27 -
Zẇ −1.6215 · 106 −1.8898 · 106 -16.55 0.1
Zq̇ −1.5436 · 106 −3.6633 · 105 76.27 65.0
Zuw −4.6835 · 104 - - -
Zuq −4.8830 · 105 3.8999 · 104 107.99 -
Zvp −2.1199 · 106 −2.0570 · 106 2.97 8.1
Z pp - −1.0718 · 106 - -
Z pr - −1.7035 · 106 - -
Zww 6.5568 · 103 - - -
Kv̇ −3.7801 · 106 −1.0718 · 106 71.65 44.0
K ṗ −1.3637 · 107 −7.1006 · 106 47.93 93.0
Kṙ −2.7968 · 107 −1.4349 · 107 48.69 -
Kv|v| −8.8960 · 105 - - -
Kuv −4.3689 · 105 - - -
Kup −5.0448 · 106 - - -
Kur −5.6544 · 106 - - -
Kvw - 1.6722 · 106 - -
Kvq - −2.0698 · 106 - -
Kwp 3.7801 · 106 1.0719 · 106 71.64 -
Kwr - 2.0698 · 106 - -
Kqr −7.5 · 107 −3.33 · 107 55.6 -
Mẇ −4.2177 · 106 −3.6633 · 105 91.31 64.0
Mq̇ −3.9850 · 108 −3.6229 · 108 9.09 10.0
Mw|w| -4.4401·105 - - -
Muw 5.4147 · 105 5.5523 · 105 -2.54 -
Muq −2.3875 · 107 1.8898 · 106 107.92 -
Mvp - 1.7035 · 106 - -
Mvr - −1.0718 · 106 - -
M pp - 1.4349 · 107 - -
M pr 4.5986 · 108 3.8849 · 108 15.52 11.4
Mrr - 1.4349 · 107 - -
Nv̇ 4.8619 · 105 −1.7035 · 106 450.38 -
N ṗ −2.7968 · 107 −1.4349 · 107 48.69 -
Nṙ −4.7351 · 108 −3.9559 · 108 16.46 10.7
Nv|v| 9.7812 · 105 - - -
Nuv −2.2747 · 106 −2.0180 · 106 11.29 -
Nup −1.6776 · 106 −1.0718 · 106 36.11 -
Nur −3.4493 · 107 −1.7035 · 106 95.06 -
Nvq - 1.0718 · 106 - -
Nwp - −3.6633 · 105 - -
N pq −3.8486 · 108 −3.5519 · 108 7.71 10.7

79
Chapter 6. Discussion

Nqr - 1.4349 · 107 - -

6.2 Linearised state space model


A total of three linear state space system were derived in this thesis. A short discus-
sion of the third model, i.e., the high velocity region, is presented here. The model
itself is presented in Figure 6.1. Some parts of the state space system is what can
be expected. The hydroplanes follow a first order characteristics with time constant
T = 3. The system was linearised with no roll/pitch, hence φ and θ are the integrals
of p and q. As for the u characteristics, rudder angles δ1 , δ2 , δ5 and δ6 give a pos-
itive addition to u̇. This appear as strange at a first glance, and the Coriolis effect
from the six degrees of freedom dynamics is most likely the source of this.
How rudder angles influence the acceleration, e.g., ṙ, differs between the rud-
ders. This does also seem strange and is most likely also caused by the Coriolis
effect.

6.3 Controller issues


The control system contains numerous numbers of nonlinearities in forms of satu-
rations and logical switches, especially in the outer loop. Nonlinearities in the loop
can be a source of possible oscillations. These can be difficult to locate, but in this
section a few possible origins for oscillations and other controller problems will be
discussed.

Sledge mode depth control


Depth control in sledge mode is performed by a P controller in cascade with an inner
loop state feedback/feedforward controller with an integrated I part. The I part is
disabled at the moment of a reference change and reenabled when the control error
is less than 3m and the pitch is less then 1◦ , see Table 5.4. The reason to include
an I part is to remove stationary errors, but a stationary error greater than 3 meters
from the reference point will not enable the I part, hence, continue to exist.
Since the pitch has to be less then 1◦ to enable the I part, this could be a source
of oscillations around a reference depth.
These effects have at this point not yet shown up. Either do they not exist at all,
or perhaps only appear at special cases. Introducing disturbances could perhaps also
make these effects show up.

Course control
Analogous with the sledge depth control, the course control could experience the
same problems, although, has not at this point.

80
6.3 Controller issues

Figure 6.1: Linear model in the high velocity region.

81
Chapter 6. Discussion

Overly complicated controller


The final control structure can feel a bit overambitious. The controller could have
been simplified by adding PID controllers in the r,φ and θ directions. This would
remove the state FF, FB and the observer part and turn the I parts controller into
PIDs. Hopefully, however, this would result in a poorer performing controller but
with increased simplification.
An LQ controller relies on the state space model to be relatively accurate. If the
controller presented in this thesis would be implemented in a real submarine and
turn out to be inadequate, tuning it, is not straightforward since it requires tuning
of the model itself. A PID however, is simpler to tune on spot. The PIDs in the
submarine could, e.g., be based on a PID design derived in the lab, and then tuned
by changing the P, I, and D gains1 .

6.4 Future Work


This master thesis is only the start of a project that could be developed much further.
This means that there are lots of room for future work and improvements.

Model
Sensor Models Measured values from sensors always come with an uncertainty.
Adding noise to measured signals in the submarine simulator, is a step closer to test
how the controller will perform in an actual vessel.
On a submarine, some sensor errors will differ depending on where the sensor
is placed. For example, the velocity sensor is often a pressure sensor placed on the
submarine hull. If the flow around the hull is turbulent, this could cause large noise
levels to the log.
The water pressure due to the suppressed water by the submarine bow can also
change over the hull. Multiple pressure sensors placed at different locations are
therefor often used. The measured log velocity is then a function of measured values
from each sensor.
In Section 3.1, the added mass effect was explained, i.e., the water closest to the
hull travels with the submarine, hence, increasing the apparent mass. This could be
another source of a velocity log sensor inaccuracy. The sensor could measure the
submarine’s velocity relative the water closest to the hull, which is lower then the
velocity relative the unaffected water, further away from the hull.
Currently, the measured depth is the depth of the submarine-fixed frame’s origin.
It can be discussed if this is the actual depth of the submarine. Perhaps the subma-
rine’s depth is the part of the submarine, that is deepest, which could be preferred
when manoeuvring close to the seabed.
1 There are more complex PID designs than the one presented in this thesis. A more complex PID
design could include additional tuning parameters.

82
6.4 Future Work

Tank System A submarine includes a number of different tanks which are used to
control whether to sink or float, as well as the attitude of the submarine. Adding the
tanks as possible actuators is a step closer to a perfect submarine simulator.
A simple way to model the effects from the tanks, is the possibility to affect the
position of the center of gravity, and the weight of the submarine. A more accurate
model of the tank system, could be to model the pump dynamics as well as the flow
characteristics in the tanks and tubes.
Additional Hydrodynamic Effects There are more hydrodynamic effects that
need to be taken into account for a complete simulator system. Among them are
different effects that occur near the surface or near the bottom.
At the moment, it is only possible to specify a linear current in a specific di-
rection in the simulation. It might be useful, to also be able to simulate irregular
currents and turbulence, to see how the controller handles these conditions, since it
is closer to the reality.
Simulating Alarms An important duty of the SASS, is error detection and alarm
presentation. This indicates to the helmsman if anything has malfunctioned on the
submarine, for example a hydroplane angle fault or pump malfunction. It would
therefore be useful to be able to simulate these alarms, and present them to the user
of the simulator system. These errors should also be sent to the autopilot, if, for
example, a hydroplane is not responding, the autopilot should take this into account
when steering the submarine.

Implementation
The focus of the thesis have been mostly on physical modelling and controller de-
sign, and less on the program for target system, i.e., the test rig. This means that
there is a lot of room for improvement here, especially within usability.
User Interface The test rig has a software version of a hardware console in a
submarine. The original goal was to implement the simulator system with the in-
terface, but due to the unexpected complexity of hydrodynamic modelling, this was
postponed as a future project.
At the moment, the simulator system is communicated with through the terminal
in Linux. A sensor value or a new reference, has to be explicitly requested by a
terminal command. This is not a user friendly setup, which is the reason why the
simulator system needs to be implemented with the test rig user interface in order
to properly benefit from the submarine simulator.
In a far future, it might also be desirable to implement compatibility with exist-
ing hardware from a submarine, to be able to train personnel on land.
Animation A simple animation of the submarine attitude and hydroplane position
was developed in Simulink. A picture of the animations can be found in Figure 6.2.
At the moment, the animations are only available when simulating the submarine in
Simulink, and not when running the simulator on the target system, hence, a desired

83
Chapter 6. Discussion

Figure 6.2: Rudder and submarine attitude animation.

feature could be to implement a TCP communication with the animations and the
submarine simulator.

84
Bibliography

ActiveState. Tool command language. URL: http :/ /www . tcl. tk/ (visited on
07/08/2014).
Åström, K. J. and C. G. Källström (1976). Identification of ship steering Dynamics.
Tech. rep.
Feldman (1979). DTNSRDC Revised standard submarine equations of motion.
Tech. rep. Carderock Division of the Naval Surface Warfare Center, Maryland,
USA.
Fossen, T. (2011). Marine Craft Hydrodynamics and Motion Control. John Wiley
Sons Ltd.
Fossen, T. I. (1994). Guidance and Control of Ocean Vehicles. John Wiley Sons
Ltd.
Fossen, T. I. and O.-E. Fjellstad (1995). Nonlinear Modeling of Marine Vehicles
in 6 Degrees of Freedom. Tech. rep. The Norwegian Institude of Technology,
Trondheim, Norway.
Glad, T. and L. Ljung (2003). Reglerteori. Studentlitteratur AB Lund.
Hickey, R. I. (1990). Submarine motion simulation including zero forward speed
and propeller race effects. Tech. rep. MIT, Department of Ocean Engineering,
Massachusetts, USA.
Humphreys and Watkinson (1978). Prediction of acceleration hydrodynamic coef-
ficients for underwater vehicles from geometric parameters. Tech. rep. Naval
Coastal System Laboratory, Florida, USA.
Lamb, S. H. (1932). Hydrodynamics. University Press, New York, USA.
Larsson, L. and H. Raven (2010). Ship resistance and flow. The society of Naval
Architects and Marine Engineers.
Mathworks. Matlab. URL: http : / / www . mathworks . se / products / matlab/
(visited on 07/08/2014).
Mathworks. Simulink. URL: http://www.mathworks.se/products/simulink/
(visited on 07/08/2014).

85
Bibliography

Ridley, P., J. Fontan, and P. Corke (2003). Submarine Dynamic Modeling. Tech. rep.
Queensland University of Technology, Queensland, Australia.
Toxopeus (2011). Practical application of viscous-flow calculations for the simu-
lation of manoeuvring ships. PhD thesis. Maritime Reasearch Institute Nether-
lands.
Watt (2007). Modelling and Simulating Unsteady Six Degrees-of-Freedom Subma-
rine Rising Maneuvers. Tech. rep. Defence Research and Development Canada,
Atlantic, Canada.

86
A
Appendix

A.1 Kt and Kq interpolation polynomials


Equations for KT and KQ :

KT (J) =0.410758 − 0.115654J − 0.107836J 2 + 0.0713369J 3


− 0.00620451J 4 − 0.0127538J 5 + 0.00487893J 6 (A.1)
7 8
− 0.000678484J + 0.0000333463J

KQ (J) =0.0690631 − 0.0249658J − 0.00623472J 2


+ 0.00171807J 3 + 0.00579169J 4 − 0.00559630J 5 (A.2)
+ 0.00178950J 6 − 0.000246886J 7 + 0.0000126029J 8

87
Document name
Lund University
MASTER´S THESIS
Department of Automatic Control Date of issue
Box 118 September 2014
SE-221 00 Lund Sweden Document Number
ISRN LUTFD2/TFRT--5954--SE
Author(s) Supervisor
Erik Lind Hans Bohlin, Saab
Karl-Erik Årzén, Dept. of Automatic Control, Lund
Magnus Meijer University, Sweden (examiner)
Sponsoring organization

Title and subtitle


Simulation and Control of Submarines

Abstract

When designing control systems for real applications, it is important to first do testing in a simulated
environment, to ensure adequate performance. This is especially important when designing control
systems for applications that have high operation costs, e.g., submarines, since late errors in the
development can be extremely costly.
Saab develops steering systems for submarines. Prior to this thesis, testing for those have been
performed in an open-loop environment, where only static test cases could be examined. Saab
therefore identified the need to implement a dynamic test simulator, which could react to the different
signals from the steering system, i.e., act as a real submarine.
In this thesis, such a simulator was developed. It consists of two parts, a physical model of a
submarine, and a control system for motion control. As for the physical submarine model, it can be
approximated from mechanical data of a submarine that the user provide, such as dimensions and
weight. The second options is for the user to explicitly supply the simulator with hydrodynamic
coefficients.
The control system was derived to control a model of a demo submarine. Saab is also involved in
submarine navigation systems and saw the need to, in the future, also have the possibility to test those
products. A navigation system assumes an autopilot exists, hence, an autopilot control system was
developed.
In the end, the control system consisted of a two-level cascade controller of mixed LQG- and PID-
control, along with a Kalman estimator for estimating unknown states.
The results were overall satisfactory. The performance of the control system is well within usual
customer specifications and the main problems in this thesis lay in getting a proper model.

Keywords

Classification system and/or index terms (if any)

Supplementary bibliographical information

ISSN and key title ISBN


0280-5316
Language Number of pages Recipient’s notes
English 1-87
Security classification

http://www.control.lth.se/publications/

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy