Resources:
- Chapter 7, 10, 15 in Fossen.
Objective: In this assignment, you will design a heading autopilot to steer the marine craft model from Assignment 2, Part 1. The autopilot will be tested by adding environmental disturbances in the form of current and wind.
Problem 1: Environmental Disturbance
Resources: Chapter 10 in Fossen
a)
We have from equation 10.149 in Fossen that:
Where
- , is the sway velocity
- is the yaw rate
- is the yaw angle
- is the direction of the current
- are the current velocities
Which has been implemented in the Matlab file main.m
b)
No current
With current
We see in the second plot that when the sideslip angle is zero, the crab angle is non zero. This is because they are directly related, and to stay on the wanted path a crab angle to counteract the current is necessary.
c)
The following changes were done in order to implement the wind moments and in sway and yaw respectively.
% Part 2, 1c) Add wind here
u_w = V_w * cos(beta_w - x(6));
v_w = V_w * sin(beta_w - x(6));
u_rw = x(1) - u_w;
v_rw = x(2) - v_w;
Vrw = sqrt(u_rw^2 + v_rw^2);
gamma_rw = -atan2(v_rw,u_rw);
Ywind = 0.5*rho_a*V_w^2*c_y*sin(gamma_rw)*A_L;
Nwind = 0.5*rho_a*V_w^2*c_n*sin(2*gamma_rw)*A_L*L_oa;
if t(i) > 200
tau_wind = [0 Ywind Nwind]';
else
tau_wind = [0 0 0]';
end
Where
- m/s
- , where is the length of the ship
Problem 2: Heading Autopilot
Resources:
- Chapter 7 and 15 in Fossen
a)
From part 1 we know that
and
Where , and (Eq. 6.47 → 6.52).
Linearizing and around , and we get:
Thus giving us the linearized Coriolis forces as
b)
The sway-yaw maneuvering model is given by
Where
- .
Using the function ss2tf
where , and and we get
Where , , , and .
c)
Using the Nomoto Model we get that the first-order Nomoto model has parameters , and .
d)
We now want to design a PID controller using pole placement according to Alg 15.1 in Fossen, with the following parameters:
- - Critical dampening
e)
Based on the response we can see signs of integrator wind up in the yaw angle plot where the actual yaw rate keeps increasing even though the desired yaw raw is constant at .
This is due to to saturation in the maximum possible yaw rate which in turn leads to integrator wind up since we integrate the error. This is fixed by turning of the integrator when the system is in saturation. See the Matlab file main.m
and the plot.