Hardware in the Loop Simulation Underwater Unmanned

6
Hardware In The Loop Simulation Applied To Semi-Autonomous Underwater Vehicles Hilgad Montelo, Celso Massatoshi Furukawa University of São Paulo [email protected], [email protected]  Abstract-Unmanned Underwater Vehicles (UUV’s) have many commercial, military, and scientific applications because of their potential capabilities and significant cost-performance improvements over traditional means of obtaining valuable underwater information The development of a reliable sampling and testing platform for these vehicles requires a thorough system design and many costly at-sea trials during which systems specifications can be validated. Modeling and simulation provide a cost-effective measure to carry out preliminary component, system (hardware and software), and mission testing and verification, thereby reducing the number of potential failures in at-sea trials. An accurate simulation environment can help engineers to find hidden errors in the UUV embedded software and gain insights into the UUV operation and dynamics. This work describes the implementation of a UUV's control algorithm using MATLAB/SIMULINK, its automatic conversion to an executable code (in C++) and the verification of its performance directly into the embedded computer using simulations. It is detailed the necessary procedure to allow the conversion of the models from MATL AB to C++ co de, integration of the control software with the real time operating system used on the embedded computer (VxWorks) and the developed strategy of Hardware In the Loop Simulation (HILS). The Main contribution of this work is to present a rational framework to support the final implementation of the control software on the embedded computer, starting from the model developed on an environment friendly to the control engineers, like SIMULINK. I. INTRODUCTION Traditional tests, many times refereed as static tests, are the evaluation of functionalities of a particular component where, to it, are provided measurable inputs and outputs. The growing of the demand for new products faster and a consequent reduction of the development cycles associated to the projects, ha s caused a increase on necessity to execute dynamic tests, where the behavior of each component is evaluated at same moment of its interaction with the rest of the system and environment. Dynamic tests, in [7], minimize risks related to the security and costs, covering more tests conditions when compared to static tests. The application of the test approach involving components of hardware, software and dynamic or behavioral conditions is called HILS. The HILS, described by [3], is a tool that comes to aid the work of the control’s engineer. Unnumbered systems could be developed faster only using an initial conceptual model developed adapting or adjusting the necessary control’s variables (for instance: maximum supported pressure, maximum speed, minimal temperature, maximum depth, bus clock, minimal system’s memory, etc), where a set of them could be encapsulated into a configuration’s profile, validated in a simulated or basic prototype, and, finally, verified in a final target. Into this environment, the control’s engineer could to spend more time analyzing and detailing features to solve the control problems related to the project, avoiding the necessity to take much time writing or debugging lines of firmware’s code or even the necessity to handle with complexities like time restrictions, establishment of priorities, techniques to schedule tasks or load balance over the each microprocessor or microcontroller used into the system. The HILS could be applied to all systems, for research and development; in the most assorted areas, like military, medicine, automotive, air space, like indicated by [1], [5], [9], [13], [20]... wherever could to exist an interaction between a product in development and its environment of operation (part of the real world) that is not so simple to represent it complete and formally like some applications described by [10], [15], [18], [21], [22]; then exists an opportunity to use HILS. The objective of this work is to present a rationale approach to assist engineers during a project to develop a semi-autonomous unmanned underwater vehicle – Vehicles that could realize part of its operations with or without the remote human interference. A project where the final product contains a lot of complex subsystems like: navigation, power management, control of actuators, control of sensors, etc… all integrated and operating in an unpredictable and sometimes hazardous environment: the undersea. II. METODOLOGY Development Environment: It consist, specifically, of the assembly and utilization of a hardware with similar features (preferentially) to those presented by the unmanned underwater vehicle in development in the laboratory of mechatronic engineer at Polytechnic School of São Paulo (Escola Politécnica de São Paulo - EPUSP), allowing to make a good utilization of the resources and solutions already in research like described in [2], [8], [11], [12]. Real Time Operating Environment: VxWorks is a real time operating system manufactured by Windriver Systems and initial description could be found in [19]. Like others real time operating systems, it includes a kernel that supports multiple tasks and preemptive scheduling. Very popular in embedded applications and widely used in a variety of

Transcript of Hardware in the Loop Simulation Underwater Unmanned

Page 1: Hardware in the Loop Simulation Underwater Unmanned

8/10/2019 Hardware in the Loop Simulation Underwater Unmanned

http://slidepdf.com/reader/full/hardware-in-the-loop-simulation-underwater-unmanned 1/6

Hardware In The Loop Simulation Applied To

Semi-Autonomous Underwater VehiclesHilgad Montelo, Celso Massatoshi Furukawa

University of São Paulo

[email protected], [email protected]

 Abstract-Unmanned Underwater Vehicles (UUV’s) have manycommercial, military, and scientific applications because of theirpotential capabilities and significant cost-performanceimprovements over traditional means of obtaining valuableunderwater information The development of a reliable samplingand testing platform for these vehicles requires a thoroughsystem design and many costly at-sea trials during whichsystems specifications can be validated. Modeling and simulationprovide a cost-effective measure to carry out preliminarycomponent, system (hardware and software), and mission testingand verification, thereby reducing the number of potentialfailures in at-sea trials. An accurate simulation environment canhelp engineers to find hidden errors in the UUV embeddedsoftware and gain insights into the UUV operation anddynamics. This work describes the implementation of a UUV'scontrol algorithm using MATLAB/SIMULINK, its automaticconversion to an executable code (in C++) and the verification ofits performance directly into the embedded computer usingsimulations. It is detailed the necessary procedure to allow theconversion of the models from MATLAB to C++ code,integration of the control software with the real time operatingsystem used on the embedded computer (VxWorks) and thedeveloped strategy of Hardware In the Loop Simulation(HILS). The Main contribution of this work is to present arational framework to support the final implementation of thecontrol software on the embedded computer, starting from themodel developed on an environment friendly to the control

engineers, like SIMULINK.

I.  INTRODUCTION 

Traditional tests, many times refereed as static tests, are the

evaluation of functionalities of a particular component where,

to it, are provided measurable inputs and outputs. The

growing of the demand for new products faster and a

consequent reduction of the development cycles associated to

the projects, has caused a increase on necessity to execute

dynamic tests, where the behavior of each component is

evaluated at same moment of its interaction with the rest of

the system and environment. Dynamic tests, in [7], minimize

risks related to the security and costs, covering more testsconditions when compared to static tests. The application of

the test approach involving components of hardware,

software and dynamic or behavioral conditions is called

HILS.

The HILS, described by [3], is a tool that comes to aid the

work of the control’s engineer. Unnumbered systems could

be developed faster only using an initial conceptual model

developed adapting or adjusting the necessary control’s

variables (for instance: maximum supported pressure,

maximum speed, minimal temperature, maximum depth, bus

clock, minimal system’s memory, etc), where a set of them

could be encapsulated into a configuration’s profile, validated

in a simulated or basic prototype, and, finally, verified in a

final target. Into this environment, the control’s engineer

could to spend more time analyzing and detailing features to

solve the control problems related to the project, avoiding the

necessity to take much time writing or debugging lines of

firmware’s code or even the necessity to handle with

complexities like time restrictions, establishment of priorities,

techniques to schedule tasks or load balance over the each

microprocessor or microcontroller used into the system.

The HILS could be applied to all systems, for research anddevelopment; in the most assorted areas, like military,

medicine, automotive, air space, like indicated by [1], [5], [9],

[13], [20]... wherever could to exist an interaction between a

product in development and its environment of operation

(part of the real world) that is not so simple to represent it

complete and formally like some applications described by

[10], [15], [18], [21], [22]; then exists an opportunity to use

HILS.

The objective of this work is to present a rationale

approach to assist engineers during a project to develop a

semi-autonomous unmanned underwater vehicle – Vehicles

that could realize part of its operations with or without the

remote human interference. A project where the final product

contains a lot of complex subsystems like: navigation, power

management, control of actuators, control of sensors, etc…

all integrated and operating in an unpredictable and

sometimes hazardous environment: the undersea.

II.  METODOLOGY

Development Environment: It consist, specifically, of the

assembly and utilization of a hardware with similar features

(preferentially) to those presented by the unmanned

underwater vehicle in development in the laboratory of

mechatronic engineer at Polytechnic School of São Paulo(Escola Politécnica de São Paulo - EPUSP), allowing to make

a good utilization of the resources and solutions already in

research like described in [2], [8], [11], [12].

Real Time Operating Environment: VxWorks is a real

time operating system manufactured by Windriver Systems

and initial description could be found in [19]. Like others real

time operating systems, it includes a kernel that supports

multiple tasks and preemptive scheduling. Very popular in

embedded applications and widely used in a variety of

Page 2: Hardware in the Loop Simulation Underwater Unmanned

8/10/2019 Hardware in the Loop Simulation Underwater Unmanned

http://slidepdf.com/reader/full/hardware-in-the-loop-simulation-underwater-unmanned 2/6

hardware architectures like: MIPS, PowerPC, SH-4, ARM,

StrongARM, xScale, and x86.

Real Time Framework: The Constellation consists of an

object oriented real time framework that provides capabilities

to interfacing and code generation from a model developed in

MATLAB/Simulink. The Constellation framework is

specified in [6]. The model could be converted in ANSI C++

programming language using all advantages of the objectedoriented programming and yet a high performance. The real

time capabilities are found in a middleware interface,

between the generated code and the real time environment.

The MATLAB’s real time workshop provides the necessary

elements to perform that relationship.

UUV’s Dynamic: One of the first steps to realize an

appropriate simulation consists of the modeling of the

dynamic equations of the Hornet UUV, specified in [4] and

used in this work as a concept prove, due the fact that UUV’s

model presents a simpler system of equations appropriate to

develop the necessary software interfaces to be used also by

others UUV’s. The Fig. 1 presents the six degrees and the

respective derivatives used by a rigid body and its system of

coordinates in the Hornet UUV’s model. Where: is the

linear movement relationship to the longitudinal axis; is the

linear movement relationship to the transversal axis; is the

linear movement relationship to the vertical axis; is the

angular or rotational movement over the X  axis; is the

angular or rotational movement over the Y axis and is the

angular or rotational movement over the Z axis.

The inputs of the system are defined by the following set of

forces: : force applied by lateral thruster, : force applied

by frontal thruster, : force applied by vertical thruster,

: external disturbs or interferences like water

current for instance, : linear hydrodynamic drag forceas defined in (1), and studied by [16].

(1) 

Where:

Cd: Drag coefficient;

ρ: Water’s density;

Ap: Projected drag’s area;

V0: Drag’s surface velocity;

The dynamic equations used to describe the vehicle’s

movement are developed in accordance with [14]. Taking the

sum of all forces in direction of the respective axis (X, Y, Z),

and solving its equations for acceleration, presented,

respectively, by (2), (3), and (4).

(2) 

(3) 

(4) 

Where:

Fd(x,y,z): Defined in (1);

Fxext = Fyext = Fzext = 0: Considering that there is not any

disturbance or current;

m: Vehicle’s mass.

Wauv: Vehicle’s weight in water(considering that the buoyancy

force is 0).

And taking the sum of the moments over the Z  axis, it is

obtained the acceleration around that axis presented by (5):

(5) 

Where:

D: Distance between the thrusters 1

(lateral thruster) and 2 (frontal

thruster)

Mzext = 0: Sum of moments over Z axis

(Considering that there is not any

disturbance over Z axis).

Iz: Inertia moment over Z axis.

For the simulation purposes those movement equations

contains eight state variables (x1, x2, x3, …, x8) and three

system’s inputs independently controlled (Fx, Mz, Fz)

presented by (6):

(6) 

Where:

u: It is function of the three plant’s inputs: T1, T2, and

T3.

Fig. 1. Rigid body and its coordinate system.

Page 3: Hardware in the Loop Simulation Underwater Unmanned

8/10/2019 Hardware in the Loop Simulation Underwater Unmanned

http://slidepdf.com/reader/full/hardware-in-the-loop-simulation-underwater-unmanned 3/6

Page 4: Hardware in the Loop Simulation Underwater Unmanned

8/10/2019 Hardware in the Loop Simulation Underwater Unmanned

http://slidepdf.com/reader/full/hardware-in-the-loop-simulation-underwater-unmanned 4/6

The following steps are necessary to generate a useful code

compatible with the proposal hardware in the loop

architecture, based in an initial UUV's conceptual model.

•  To prepare the UUV's control model in Simulink

environment: It consists in the utilization of the

Simulink tool box and its control blocks (like S-

Functions, PID block, Plant block, etc). OBS: Before

the next step, it is important to eliminate any algebraic

loop in the model (loops where there is a direct

feedback between a output and input in the same

control block);

•  To convert the prepared UUV's control model in asuitable software component compatible with the real

time framework adopted. There is a special tool

developed to achieve that objective where is possible

to specify event handlers, allows priority specification

and concurrent code;

•  To prepare the target environment and to configure its

real time operating system to establish all necessary

connections;

•  To configure the real time framework to operate either

with the operating system in target machine or with a

simulation environment (environment with the same

interfaces but not considering time restrictions);•  To establish connection between the target machine

and the Matlab/Simulink environment using the

middleware provided by Constellation tools;

•  Trough the Data Logger component and tools like the

Matlab's shell, WindView or Stethoscope, see [17]; is

possible to evaluate and even update values of

monitored variables or statuses in run time to achieve

the timers and specified control conditions;

•  All generated firmware's code is in ANSI C++ not

allowing the utilization of templates (generic

programming) or even dynamic memory allocation

(temporally to avoid problems with garbage

collection, for instance).

III.  RESULTS

The dynamic model and its respective control algorithm

published in [4]; was successfully reproduced in

Matlab/Simulink environment, also eliminating the

unnecessary algebraic loops with to lose the behavior

presented by the model.

The hardware in the loop environment and the UUV's

controller was embedded in a hardware developed in PC104

standard, using x86 architecture, the same configuration

presented by the UUV in development. Virtual sensors and

virtual actuators (like compass, inclinometers, depth's

sensors, thrusters, etc) also had its embedded and real time

representation stored directly into the target's file system.

For all graphs generated, the following procedure was

executed:

•  Samples representing the sensors were recorded in

format of files;•  The converted and generated controller code read the

signal values and has calculated the respective

actuation signals used by the UUV's thrusters;

•  Thos actuation signals were recorded in file format and

used as input for the dynamic simulator, generating

information about velocity control, direction control,

and depth control.

•  To compare the results obtained with the implemented

HILS (identified by the label: "reproduzido") against

the adopted bibliographic material (identified by the

label: "original").

The Fig. 5 shows a direction plot of the path traversed by

the UUV in direction to a specific point.

The starting point (0, 0), the UUV traverses the known map

until reach the specified point, coordinates (35,35) in the map

and presenting a total distance of about 49 meters. The results

are compatible with the results presented by [4].

Fig. 4. Overview of the HILS used to assist the development of UUV.

Fig. 5. Overview of the traversed path by UUV in direction of a point.

Page 5: Hardware in the Loop Simulation Underwater Unmanned

8/10/2019 Hardware in the Loop Simulation Underwater Unmanned

http://slidepdf.com/reader/full/hardware-in-the-loop-simulation-underwater-unmanned 5/6

In the graph presented in Fig. 6, the UUV when traversing

in direction of its target, initially receives a first command to

descend 61 meters (it takes about 30 meters until the UUV

completes the submersion procedure) and, at 350 meters, the

UUV receives command to start the emersion procedure with

5 meters and 55 meters, respectively. The UUV remains at 1

meter of the surface. The PID depth's controller had a good

performance with K  p = 10, K i = 0, and K d  = 5.

The results of the PID velocity's controller presented in

Fig. 7 had presented some problems to reproduce the original

model and keep a stable value. There was an almost constant

switching due the high error rate. Nevertheless, the UUV has

continued its trajectory, presenting a similar behavior (but

with more attention and careful by engineers) when compared

with the same dynamic model in the original work.

It is very important that, even after a correct code

generation, to investigate if that code is capable to be

executed in an embedded and real time environment, not

exceeding the limitations and restrictions of the system. For

instance, the Fig. 8 presents a snapshot of the control cycles,

encapsulated by the task "CSSysClockData" (into the red

circles). The total time for each task is about 20 ms (see the

red bars) and, the time consumed by the task analysis is about

2ms. In other words, the task is taking only 15% of the total

time that could be expended to perform all its internal

operations. Therefore, the chosen hardware is adequate to

implement the proposal UUV's control algorithm.

IV.  CONCLUSIONS

The UUV's dynamic model was successfully reproduced in

Matlab/Simulink. The simulation results are compatible with

the available literature, even after the addition of some delays

to avoid the generation of algebraic loops.The suggested HILS approach has worked as expected,

presenting a coherent behavior during the reading of a

Matlab/Simulink model, conversion of that model in an

executable software code and providing a final validation of

utilization of resources of time and memory through the

interaction with a real time and embedded platform. That

validation could imply in a better and optimized chosen of

hardware.

Different tools could be attached to the HILS process to

provide more information about the run time environment of

the UUV's controller and, if necessary, to adjust variables and

conditions.

Parts of the complexity to handle with embedded and real

time restrictions, synchronization techniques, task's

scheduling, priorities, etc... They could be taken in a more

transparent way, aiding the control engineers to concern with

more specific problems.

Problems that involves remotely download and upload

packets of code suggest a new and a more effective handling

for the tasks related to communication process, improving

stacks, buffers, queuing policies, etc.

ACKNOWLEDGMENT 

To our families and friends for encouraging the crowdstanding and successful completion of this work; To FINEP

than through one of its research funds, the CT-PETRO,

allowed some of the funding of this work; To CNPq

(National Council for Scientific and Technological

Development – Conselho Nacional de Desenvolvimento

Científico e Tecnológico), for having awarded the scholarship

to complete this Master in Science work, and finally to the

University of São Paulo and their collaborators - who

introduced the graduate program in Mechanical Engineer,

innovating in the environment of academic teaching.

Fig. 6. Path traversed by the UUV to test the PID depth's controller.

Fig. 7. Performance of the PID velocity's controller.

Fig. 8. Run time context switch between controller's tasks.

Page 6: Hardware in the Loop Simulation Underwater Unmanned

8/10/2019 Hardware in the Loop Simulation Underwater Unmanned

http://slidepdf.com/reader/full/hardware-in-the-loop-simulation-underwater-unmanned 6/6

 

REFERENCES 

[1] S. Alles, C. Swick and M. Hoffman. "A Real Time Hardware in theLoop Simulation for Traction Assist,"  International Journal of Vehicle Design, 1994. Vols. 15, pp. 597-625.

[2] P.E. Almeida., M.G. Simoes. "Projeto de um sistema robóticointeligente para instalação de equipamentos em poços petrolíferos emáguas profundas,"  IV SBAI – Simpósio Brasileiro de Automação

 Inteligente. São Paulo. 1999.[3] W.K. Anakawa et al. "Environments for rapid implementation of

control algorithms and hardware in the loop simulation," In IEEE 28th Annual Conference of the Industrial Electronics Society, 2002.

[4] T. Braunl et al. "The Autonomous Underwater Vehicle Initiative –Project Mako".  IEEE Conference on Robotics, Automation, and Mechatronics (IEEE-RAM), Singapore . 2004. Vols. pp: 446-451.

[5] D.P. Brutzman, Y. Kanayama and M. J. Zida. “Integrated Simulationfor Rapid Development of Autonomous Underwater Vehicles”.  IEEESymposium On Autonomous Underwater Vehicle Technology, 1992.

[6] Constellation. “Constellation, Real-Time Software Framework".  Real-Time Innovations, Inc, 2005.

[7] S.E. Duno, M. Smith and P. Betzer. “Design of AutonomousUnderwater Vehicles for Coastal Oceanography, Underwater RoboticVehicles. Design and Control”. TSI Press, 1994. Vols. pp. 229-326.

[8] A. Jansson and J.O. Palmberg. “Load simulation, a flexible tool forassessing the performance of hydraulic valves”.  In Proceedings of theFourth Triennial International Symposium on Fluid Control, Fluid Measurement, and Visualisation, Toulouse, France, 1994.

[9] C. Key. “Cooperative Planning in the Pilot’s Associate”. Proc. DARPAKnowledge-Based Planning Workshop, 1987.

[10] J. Kim and A. Srinivan. "Computationally efficient technique for realtime surgical simulation with force feedback". Proc. 10th Sym. On Haptic Interfaces For Virtual Environment & Teleoperator Systems,2002.

[11] F.V. Lima, C.M. Furukawa. “Development of a High ResolutionUnderwater Positioning System”. XIV COBEM – Brazilian Congress of Mechanical Engineer . 2003.

[12] F.V. Lima. ”Desenvolvimento de um Sistema Acústico dePosicionamento Submarino”.  Master in Science thesis presented to Escola Politécnica da USP. São Paulo. 2003.

[13] D. Maclay. “Simulation Gets Into the Loop,” IEEE Review, 1997.[14] N. Olgac, B.E. Platin and J.M. Chang. “Sliding Mode Control of

Remotely Operated Vehicles for Horizontal Plane Motions,”  IEEEProceedings, 1991. Vol. 138.

[15] E.A. Prasetiawan et al. "Modeling and control design of a powertrainsimulation testbed for earthmoving vehicles,"  Journal of Fluid PowerSystems and Technology, 1999.

[16] J.A. Roberson and C.T. Crowe. "Engineering Fluid Mechanics,"  JohnWiley & Sons, New York, 1997. Vol. Sixth Edition.

[17] Scopetools. "Windriver's ScopeTools Suite," Windriver Corp., 2005.[18] Y. Senta and E. Okamura. "HIL simulation system for hdd servo

firmware," IEEE Transactions on Magnetics, 2002. pp: 2204-2207.[19] VxWorks. "Windriver - VxWorks Programmer's Guide," Windriver ,

2005. Vol. 5.5.[20] Y. Yuroda, K. Aramik and T. Ura. “AUV Test Using Real/Virtual

Synthetic World,”  IEEE Symp. On Autonomous Underwater VehicleTechnology, 1996.

[21] R. Zhang, D.E. Carter and A.G. Alleyne. "Multivariable control of anearthmoving vehicle powertrain experimentally validated in anemulated working cycle".  In Proc ASME International Mechanical Engineering Congress & Exposition. Washington, 2003.

[22] L. Zhen, M. Kyte and B. Johnson. "Hardware in the loop real-timesimulation interface software design," In Proc of The 7th International IEEE Conference on Intelligent Transportation Systems, 2004. pp:1012-1017.

[23] K. Ogata. “Modern Control Engineering, " Prentice Hall. New Jersey,1997. Vol. Third Edition.

[24] R.A. Decarlo., S.H. Hak and S.V. Draukunov. “Variable Structure,Sliding-Mode Controller Design.,"  In The Control Handbook, CRCPress. Florida, 1996