Simulation and Control of Submarines: Erik Lind Magnus Meijer
Simulation and Control of Submarines: Erik Lind Magnus Meijer
Simulation and Control of Submarines: Erik Lind Magnus Meijer
Submarines
Erik Lind
Magnus Meijer
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.
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
8
List of Figures
9
List of Figures
10
List of Tables
11
Denominations
12
List of Tables
13
List of Tables
subscript explanation
hs hydrostatic
hd hydrodynamic
p propulsion
c control
l lift
d drag
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
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 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.
15
Chapter 1. Introduction
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
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
• 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
• 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.
• Log velocities The current speed forward. Traditionally measured by log pro-
pellers/impellers, but modern submarines uses, e.g., pressure or acoustic logs.
• 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
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]
21
Chapter 1. Introduction
• 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
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.
23
Chapter 1. Introduction
Delimitation
The following delimitations will be assumed:
• The submarine will be in an infinitely large ocean to avoid near surface and
near bottom effects.
• Incompressible hull.
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.
24
1.6 Thesis Outline
25
2
Method
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.
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
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
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.
29
Chapter 3. Theory
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
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:
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.
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.
∑ τ 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
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
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 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)).
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.
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]:
The feedforward control part uFF = Lr r will be dimensioned to ensure that the
closed loop gain is identity:
The observer gain matrix K will create the perfect trade off between the system
model and the measured output.
38
4
Development
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
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:
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:
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]
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)
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.
where h(x) is the local hull height and L is the hull length. Correspondingly, the
44
4.1 Modelling of a submarine
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
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.
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
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.
48
4.2 Generic submarine model
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
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
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)
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.
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.
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
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
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
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
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
56
4.4 Control design
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
the dynamic mean in each region should be at a velocity closer to the upper end of
each region.
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
region 1 2 3
tower HP on on off
depth k. mode elevator mode elevator mode sledge mode
depth c. mode " sledge mode "
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
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
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
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
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
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
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
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.
66
5.3 Simulation plots
section 1 2 3
r ±0.6◦ /s ±1.2◦ /s ±3◦ /s
θ ±15◦ ±15◦ ±15◦
67
68
region 1 2 3
Chapter 5. Results
integrator enable for r !manoeuvre & ctrl effort r < 0.9 " "
integrator enable for θ ctrl effort θ < 0.9 !manoeuvre & ctrl effort θ < 0.9 !manoeuvre & ctrl effort θ < 0.9
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.
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.
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
71
Chapter 5. Results
72
5.3 Simulation plots
73
Chapter 5. Results
74
5.3 Simulation plots
75
Chapter 5. Results
76
5.3 Simulation plots
77
6
Discussion
78
6.1 Hydrodynamic Coefficients discussion
79
Chapter 6. Discussion
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
81
Chapter 6. Discussion
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
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
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
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
http://www.control.lth.se/publications/