Tutorial 8 - Ship Autopilot

Document Sample
Tutorial 8 - Ship Autopilot Powered By Docstoc
					                         Tutorial 8 – Ship Autopilot
                             (JEE344 Applied Control Engineering)

Aim
   •   To design and simulate an PID- based autopilot system
   •   To use simulation as a diagnostic tool to improve autopilot performance and select
       control gains

Learning Outcomes
   • Simulate a ship’s steering dynamics with LabVIEW
   • Simulate PID autopilot with Auto/Man switch mode for course keeping and changing

Ship 1: Autopilot system for Shioji Maru using Nomoto’s model

Problem Statement
Let’s consider the Nomotor’s first order manoeuvring model:
        Tr + r = Kδ (or Tψ + ψ = Kδ )
           &                && &                                             (1)
        ψ=r
         &                                                                   (2)
where ψ is yaw angle (rad) and δ is rudder angle (rad, −40π /180 to +40π /180 , T = 7.5
seconds and K = 0.11. Ship speed is constant, v = 15 knots (1 NM = 1,852.00 m). The
steering machine model is
        &         δc − δ
        δ=                                                                   (3)
             δ c − δ TRUD + a
where TRUD is rudder constant, TRUD = 11.9 (sec), and a is constant chosen as 1 to avoid zero
dividing. The ship’s heading is control by a PID autopilot system with control gains of KP, KI
and KD. It is assumed that the rudder angle for the PID autopilot is in range of -10o (port) to
+10o (starboard), rudder rate in range of -5 deg/s to +5 deg/s, error (between the actual yaw
angle and set course) in range of -180o to +180o, and yaw angle in range of 0-360o. The
position of the ship is represented by the following model:
        x = u sin ψ + v cos ψ
        &                                                                    (4)
        y = u cos ψ − v sin ψ
        &                                                                    (5)
where u is surge velocity and v is sway velocity (assuming that v = 0). Make simulation
program/s with LabVIEW.

Solution

1. Ship’s open-loop system


                                                                       U (knot)
                                                                               x
        δc        Steering       δ       Ship hull      ψ           Ship
                                                                               y
                  machine                dynamics                trajectory
   -40 to +40                                        0 to 360



                       Figure 1 Block diagram of the open-loop system

                                                                                              1
2. Block diagram algorithm for the ship’s hull dynamics:
             1 K
       r=− + δ
       &                                                                                  (6)
            T T
       ψ=r
        &                                                                                 (7)
                                  Sum
                  ×                                     &
                                                        r                  r [rad/s]               ψ [rad]
                                              ×
                  ×                           ÷                    ∫                       ∫
δ [rad]      K                             T Divide         Integrator                 Integrator       Display ψ




                    Figure 2 Block diagram algorithm for ship’s hull dynamics

3. Block diagram algorithm for ship’s trajectory on the earth-fixed reference frame:
        x = u sin ψ + v cos ψ
        &                                                              (9)
        y = u cos ψ − v sin ψ
        &                                                              (9)

 ψ [rad]
                   cos                 ×
                                                  +
                                       ×                    &
                                                            y                 y
                                                                       ∫          x
                   sin              ×
                                                  –              Integrator
                                    ×
  u [m/s]                                                                                  (0,0)

                                       ×
                                                  +                                            XY-Chart
  v [m/s]                              ×                    &
                                                            x                x
                                                                       ∫          y
                                    ×
                                                  +              Integrator
                                    ×

          Figure 3 Block diagram for the ship’s trajectory (x – latitude, y – longitude)

4. Block diagram algorithm for the steering machine
        &        δc − δ
       δ=                                                                                 (10)
            δ c − δ TRUD + a

  δc
                                   +                              δc − δ
             &
             δ                δ                                                                     ×
                      ∫            –                  abs              ×              +
                                                                       ×                            ÷
                 Integrator                                                           +
                                                                Trud          a

                    Figure 4 Block diagram algorithm for the steering machine

                                                                                                             2
5. Ship’s Closed-loop Control System (Autopilot with Auto/Man Switch)

                                                                                         U (knot)
SP ψ d                      -40 to +40                                 0 to 360
                                                                                                x
                    PID        δc      Steering           δ   Ship hull ψ          Ship
                  Autopilot            machine                dynamics          trajectory      y
                                                                                                GPS

                                     ψm         Gyro-
                                               compass


                     Figure 5 Block diagram of the closed-loop autopilot system

The block diagram algorithm for PID autopilot with Auto/Man mode is below:
                              PID Autopilot

                 Comparator                               Sum
                                                          (Compound
SP ψ d               Subtract                 Multiply    Arithmetic)
PV ψ                                                          +            Auto/Man
                                         Kp               P
                                              Multiply                          Select
                     Integral uin                                                         OP
                                                              +         Auto
                                                          I
                                    KI                                                (Control signal)
                                               Multiply                               Commanded
               uin                                                      Man
                                                              +                       rudder angle
                                                                        To Steering
            Derivative                                    D
                                KD                                      Machine


         Figure 6 Block diagram algorithm for PID autopilot with Auto/Man switch mode

Hands-on Exercise 1 (Save as ShipSimulator01.vi)
Open-loop system without the steering machine & trajectory: Refer to Figure 2 and the
following sample code:




            Figure 7 Sample code for the open-loop system without SM & trajectory

                                                                                                    3
   •   Save the VI.
   •   Do testing of its functionality.

Hands-on Exercise 2 (Save as ShipSimulator02.vi)
Open-loop system with the trajectory (without steering machine): Refer to Figure 3 and the
following sample code:




Figure 8 Sample code for the open-loop with trajectory (without the SM)

Hint: When using the XY Graph for ship’s trajectory, uncheck “Clear data on each call”:




                             Figure 9 Setting the Build XY Graph

   •   Save the VI.
   •   Do testing of its functionality.

Hands-on Exercise 3 (Save as ShipSimulator03.vi)
Open-loop system with steering machine and trajectory: Refer to Figure 4 and the following
sample code:




                                                                                             4
                        Figure 10 Sample code for the steering machine

   •   Save the VI.
   •   Do testing of its functionality.

Note: You can add indicator/s and/or a waveform chart to display the commanded rudder and
actual rudder.

Hands-on Exercise 4 (Save as ShipSimulator04.vi)
Program a gyrocompass and set limits for ship’s heading in range 0 to 360o.

Algorithm to set limits:
       If psi >= 2 π then psi = psi – 2 π ,
       Else if psi < 0 then psi = psi + 2 π
       Else psi = psi

C language code (Formula Node):
       If psi >= 2*pi
               { psi = psi – 2*pi;}
       Else if (yaw < 0)
               { psi = psi + 2*pi;}
       Else
               { psi = psi}

MATLAB language code (MathScripts Node):
    if (psi >= 2*pi)
             psi = psi – 2*pi;
    elseif (psi < 0)
             psi = psi + pi*2;
    else
             psi = psi;
    end

Hands-on Exercise 5 (Save as ShipSimulator05.vi)
Closed-loop system (Autopilot with Auto/Man)
   • Save the VI.
   • Do testing of its functionality.


                                                                                        5
Conclusions
At this point the following LOs have been satisfied:
    • Simulate a ship’s steering dynamics with LabVIEW
    • Simulate PID autopilot with Auto/Man switch mode for course keeping and changing

Follow-up Exercise
Modify the above program for ship autopilot system in consideration of the trajectory with
initial latitude and longitude (the Control Lab’s latitude and longitude!):
         x(0) = current latitude = 41o27.179’ S
         y(0) = current longitude = 147o04.246’ E
such that the ship’s position is expressed with latitude and longitude. One nautical mile is
approximately 1852 m, and equivalent to one minute of arc.

Refer to Nautical mile: http://en.wikipedia.org/wiki/Nautical_mile




                                                                                               6

				
DOCUMENT INFO