Simulation and Conceptions for the Development of a Control System for the Positioning of an Oil Platform

cand. el. Burkhard Sommer Matrikel-Nr.: 2005171 7th April 2005

Contents

1. Introduction 2. Simulation 2.1. The Platform P-13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1. The non-linear Model . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.2. Transformation of the coordinates . . . . . . . . . . . . . . . . . . 2.1.3. The linearized Model . . . . . . . . . . . . . . . . . . . . . . . . . 3. Optimal distribution of the control variable 3.1. LAGRANGEn Multiplier . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.1. Realization of the optimization . . . . . . . . . . . . . . . . . . . 3.1.2. Adaptation to the real conditions . . . . . . . . . . . . . . . . . . 3.1.3. Influence of the Delays . . . . . . . . . . . . . . . . . . . . . . . . 4. Perturbations 4.1. Simulation of the Waves . . . . . . . . . . . . . . . . . . . . . . . . . . . 5. Controlling 5.1. PID Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2. PID in the platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3. Numeric Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4. Iterative Feedback Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5. Design of a digital controller with IFT . . . . . . . . . . . . . . . . . . . 5.6. Controller Parameters with IFT . . . . . . . . . . . . . . . . . . . . . . . 5.7. Optimization via Matlab Response Optimization Toolbox . . . . . . . . . 5.8. Controlling via LQR/LTR and Fuzzy . . . . . . . . . . . . . . . . . . . .

4 6 6 9 10 11 15 15 17 20 21 25 26 31 31 32 34 34 38 40 40 43

2

Contents 6. Soft- and Hardware Implementation 6.1. The Microcontroller Board Rabbit RCM 3200 . . . . . . . . . . . . . . . 6.2. The Microcontroller ATMEL Mega64 . . . . . . . . . . . . . . . . . . . . 6.3. The Serial Communication Interface . . . . . . . . . . . . . . . . . . . . . 6.3.1. Low-Level Ebene . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.2. High-Level Kommunikation . . . . . . . . . . . . . . . . . . . . . 6.4. Alternative Communication Method . . . . . . . . . . . . . . . . . . . . . 6.5. Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7. Conclusion A. The Matlab M-Files A.1. Source Code Optimization via Lagrange (Propsim.m) . . . . . . . . . . . A.2. Source Code (Propkonfsim.m) . . . . . . . . . . . . . . . . . . . . . . . . A.3. Source Code Generation of Waves (wave02bs.m) . . . . . . . . . . . . . . A.4. Source Code propdir.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.5. Source Code itfdisc.m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B. Matlab Fuzzy Functions C. Communication C.1. Source Code Avr p13.c . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.2. Configuration of der Registers: . . . . . . . . . . . . . . . . . . . . . . . . 46 46 48 48 49 50 52 53 54 55 55 57 60 61 62 66 68 68 79

3

1. Introduction
The institute of controlling of the University of Rio de Janeiro has obtained a model of the oil platform P13 from the company Petrobras for studying proposes (1:40). Some studies should be done concerning the controllability of it with the intention to create a simulation in order to design and test a positioning control, which should on the one hand take the platform to a determined target position and on the other hand to keep the platform on a determined position. This requires an active positioning control, also within aggravating conditions due to a turbulent swell. A design also should take some economical proposes in consideration that takes account of the usage of the propellers and fuel consumption. As much tests as possible should be performed in order to reduce the costs by using computer simulations. This, on the other hand, requires the best knowledge of the platform model that is possible. The simulation implementation should be the main part of this work. The mathematical models should be put into a Mathworks Matlab and Simulink Simulation. A mathematical model is already available. An institute of the Netherlands did already some tests that can be used for this actual work. A simulation also has to include, in addition to the mathematical platform model, an environment model in order to simulate the perturbations which affect the platform, a model of the drive propulsion system, which includes physical limitations like finite rotation velocities and limited run up speed of the propulsion system. By using all of these parameters, a project of a suitable controller can be made with this simulation. After these tests, it would be possible to implement the developed algorithms in microcontrollers in order to simulate its behavior using the physical model. These microcontrollers should control the platform’s engines in order to maneuver the platform. For as much it, is not the objective of this project to design the perfect controller. This would be too extensive. It’s more important to find out how one should process in general, to program a simulation and to think about the available ways to realize a hardware and software implementation for the model. Because of that my work is separated into the following parts: Design of a Simulation with Matlab and

4

1. The simulation of the perturbations can be found in the fourth chapter.and software implementation are described in the last chapter.: Model of the platform 1:40 5 .Simulink. Figure 1. This is explained in the second chapter. A design of some controllers can be found in the fifth chapter. Some methods concerning a hard. The integration and an optimization of the propulsion system in the simulation can be found in the third chapter.

very complex and complicated systems can be designed. saturation and mathematical signs and up to blocks of highest complexity can be put. similar to structures which are common and frequently used in the control engineering. like microprocessor simulating blocks. Four of these can be used to store solid materials. That mentioned hierarchy I would like to use to realize my simulation. The platform consists of two swimmers. It offers a great amount of different toolboxes and libraries and could be handled intuitively. one or more blocks for the propulsion and optimization system. derivatives. Simulation In order to realize the software simulation I use Matlab and Matlab Simulink. one control system block and some additional blocks like the Virtual Reality Toolbox to visualize in 3D the behavior of the platform.2. In the present case I need one block for the platform. It’s also possible to create new blocks based on the principle of ”Black-Box”. In the case of Simulink the elements can be dragged and dropped using a block diagram structure. it is possible to let only the inputs and outputs visible. Using this kind of hierarchy. one for the perturbations. In the year 1993 the idea to convert the platform in a production 6 . calculated and simulated. The Platform P-13 The platform P-13 of the company Petrobras is a platform of an older type. each of it are separated into three vertical columns. A graphical visualization is always useful just to get a better feeling for the system response and can be used for presentation proposes and will be realized with VRML and will be included.1. integrators. When a block is ready. Starting with simple blocks like gains. 2. too. This software is a relatively easy-to-use tool which is already very important for the whole engineering industry. It has been built in the year 1983 by the consortium UIE-CFEM in France and was actually designed to make bore holes up to 8000 meters while anchored. too. Diagonal braces join the lower part of the structure with the center of the deck.

: Simulink Complete System 7 .1.1. There are already some measurements. Some technical of the platform specifications are following: Figure 2. THE PLATFORM P-13 unit with a dynamic positioning control system has been born. parameters and equations available which had been made by an institute from the Netherlands and which are used in this work. This project is based on that idea.2.

21 m UIE-CFEM Konsortium Monrovia. Lib´ria e BV 1983 92 m 74. In the given case there are a set of nonlinear differential equations with a lot of parameters.2 m 34865 t 9.4 m 13 m 92 m 19.1 m 3.824m 6. THE PLATFORM P-13 Specifications and Dimensions Constructor Harbor of registration Company Launching Length Width Distance from keel to main deck Swimmer Length Width Depth Distance propeller mid point to keel Columns Diameter Diameter with base Braces Diameter Length Height in relation to keel Weight 2m 42 m 11. The best way is to convert the mathematical equations into a form which is easier to handle and implement.2.1. Because of this nonlinearity of the equations it is not possible to implement them into a state-space- 8 .824 m 41 m On order to begin with a project of the simulation it is necessary to put the mathematical model into the Simulink Simulation.

1.1) 1 (F − bx − cx) ˙ (2.3) (2. The advantage of this display format is the better overview and feasibility. THE PLATFORM P-13 format.2. The non-linear Model The non-linear mathematical model with its parameters that have been provided by a the institute from the Netherlands [8]: (M + a11 )u − (M + a22 )vr + b11 + b11 u|u| + c11 x = XT + XE ˙ (M + a22 )v − (M + a11 )ur + b22 + b22 v|v| + c22 y = YT + YE ˙ (Izz + a66 )r + b66 r + b66 r|r| + c66 φ = NT + NE ˙ (1) (2) (1) (2) (1) (2) (2.: P T2 -System Using this principle all of this non-linear. 2. Let’s suppose a linear second order equation of the following form.4) (2. The best format in would be a block diagram.1. ¨ ˙ ˙ Figure 2. Like it is explained in [8].1. putting the variable of the highest degree of x= ¨ derivative to the left side considering the relation x dt = x and x dt = x.2. coupled differential equations can be put easily into the Simulink model.5) 9 . the differential equations can be converted into this form as follows.2) m This equation can be converted (see [6]). m¨ + bx + cx = F x ˙ (2.

000T a22 = 21. linear damping constant x-axis quadratical damping constant x-axis linear damping constant y-axis quadratical damping constant y-axis linear damping constant φ quadratical damping constant z-axis Federkonstante x-axis (anchor) Federkonstante y-axis (anchor) 2 sin(φ) φ Non-linear Federkonstante (anchor) 2 = 1.1. 10 . Resulting hydrodynamical additional mass x-axis Resulting hydrodynamical additional mass y-axis Resulting hydrodynamical additional inertia z-axis.1. all the c-parameters can be set to zero. The transformation between these two systems is made as follows. that this equation system is a system of: • Second Order • Non-linear • Coupled • Three degrees of freedom M = 34. 6508 · 103 T s2 m 5 c11 = c22 = c66 = 4KLA a √ The a-parameters are the result of the water mass and have been determined experimentally. 2.2. THE PLATFORM P-13 It’s important to notice. In the simulation I consider the anchorless case. 6771 m 2 1. 3199 · 10 T m a11 = 20. 9215 · 10 T ms 74 KN m KN 74 m 8 s2 Ts −155. Transformation of the coordinates The equations above contain environment coordinates as well as body coordinates. See [1] and 2.000T a66 = 30.2.000. 9520 · 10 T s2 m = 1.8. 798 T s m (2) b11 (1) b22 (2) b22 (1) b66 (2) b66 (1) 7 2 Total mass of platform Inertia z-axis.000T m2 b11 = −658. 2592 · 103 = = T m2 = −1.865T Izz = 4.

.7) (2. 11 . THE PLATFORM P-13 Figure 2.3. it looks like a standard LTI IT 1 system. By seeing the position as the output.8) 2. the system could be seen as a linear system near to a determined operating point. This results in the following. .1. Using that.6) (2.1.2. The linearized Model In order to project a controller it is useful to linearize the given equations.: Platform xN = u cos φ − v sin φ ˙ yN = u sin φ + v cos φ ˙ ˙ φ = r (2. ∂f ∂q ¨ ∂f ∂q ˙ ∂f ∂q ∂f ∂u (¨ − q0 ) + q ¨ AP (q − q0 ) + ˙ ˙ AP (q − q0 ) = AP (u − u0 ) . A linearization could be made as follows and results in the following system of differential equations (All velocities and accelerations in the operation point are set to zero). AP (2.3.9) A linearization is made by using the equations above.

THE PLATFORM P-13 Figure 2.12) 12 .10) (2.4.2.: Velocity x ˙ (M + a11 )u + b11 u = XT + XE ˙ (M + a22 )v + b22 v = YT + YE ˙ (IZZ + a66 )r + b66 r = NT + NE ˙ (1) (1) (1) (2.1.11) (2.

: Angle velocity φ 13 . THE PLATFORM P-13 Figure 2.: Velocity y ˙ ˙ Figure 2.5.6.1.2.

2.: Platform.: 3D simulation output Figure 2. THE PLATFORM P-13 Figure 2. coordinates and positions of the propellers 14 .7.8.1.

The platform possesses eight propellers. This looks like an optimization task.. 3. All of the other dimensions we can’t control. LAGRANGEn Multiplier The above mentioned Lagrange multiplier can be used ([11] and [10]) to solve an Extremwertaufgabe like f (x1 . Because of that it is better to discover an analytic way.y. . Matlab already offers a big amount of different optimization algorithms. + dxn = 0 ∂x1 ∂x2 ∂xn 1 e.. the propulsion system can provide two forces Fx and Fy and one moment M . In order to control these left positions. In totally this results into 16 values which can be used to deliver these above mentioned 3 values.g.. Optimal distribution of the control variable Like we already have seen. . x2 . Each of them can afford a pointed thrust (Fi and alphai ). x2 . xn ) = 0 with laplace g = 0. too. in order to implement it in the controller. . And even if it would work..3.. the relevant outputs we want to control are (x. since the algorithms has to be implemented in a microcontroller it would be necessary to convert the code into another form. but since they are working numerically the calculation takes more time.φ). xn ) with constrains g(x1 . . The most of them make use of the lagrange multiplier. fmincon or lsqlin 15 . For the extremal value it has to be considered df = ∂f ∂f ∂f dx1 + dx2 + .1. The actors don’t allow the manipulation of it.. I will use this kind of optimization. I have tested some of the build-in algorithms of Matlab 1 .

y) is the distance function that describes the distance between a point (x. + dxn = 0 ∂x1 ∂x2 ∂xn (3. g2 = 0. gm = 0.6) 16 . . 2. If we convert the eclipse into the following form. The equation 3.. and the constrain function g in just one equation. This results into: ∂f ∂g ∂f ∂g ∂f ∂g +λ dx1 + +λ dx2 + .1) The trick is to put the function. y0 = 1) from the eclipse 4x2 + 9y 2 = 36 may be found.. we will already have the required form. y) from the point (x0 . For a better explanation of the above mentioned equations.4) Example: Distance of a point from a body. (3. y) and the constrains g(x. because these two equations are zero. a example will follow: The minimal distance of a point (x0 = 1.3) Randbedingung If there are more constrains g1 = 0. we have correspondingly: f = λ1 g1 + λ2 g2 + . The first step is to determine the function f (x. y0 ). This is simple. .1. This results into: dg = ∂g ∂g ∂g dx1 + dx2 + . g(x. .n. . . . + λm gm . (3. ∂x1 ∂x1 ∂x2 ∂x2 ∂xn ∂xn To put it into a simpler way: ∂f + ∂xk F unktion (3. + +λ dxn = 0. . .1 will be multiplied by the langrange multiplier λ. In the given case it’ll be: A= (x − 1)2 + (y − 1)2 (3. . y) = 0. . that should be minimized or maximized f .5) The function that has to be minimized f (x. y) = 4x2 + 9y 2 − 36 = 0 (3.3. .2) λ ∂g ∂xk =0 mit k = 1. its derivatives have to be zero. LAGRANGEN MULTIPLIER Because the constrains are constant.

1. because the problem can be transferred in a system of linear equations.1681 + 0. This problem is a little bit better to handle. Realization of the optimization In the given case it’s about a quadratic optimization with linear constrains. is the force in direction y demanded by the controller.4620 .4941 -1.2*(y-1)+18*Lambda*y.8181 -0.1. LAGRANGEN MULTIPLIER This is already the required function f (x.0.9) [Lambda.x.x.1681 . which can be solved using the well known standard methods.2500 -2. the solution is as follows: syms Lambda x y (3. 17 .3360 -0.1.0563i 2.0329i 1.6285 + 1.0329i -0.y]) ans = -0. y) correspondingly the equations above. is the yaw moment demanded by the controller.0500 -0. Introducing g(x.4*x^2+9*y^2-36) double([Lambda.6285 .0.1. it results in a non-linear system of differential equations of n + m equations: 2(x − 1) + 8λx = 0 2(y − 1) + 18λy = 0 4x2 + 9y 2 − 36 = 0 Utilizing Matlab. y) = A2 .0563i 1.7) (3.4620 + 0.8) (3. The following three values have to be achieved: XReq YReq MReq is the force in direction x demanded by the controller.9070 2. The objective of the optimization is to find an optimal solution for the distribution of the thrusts over the eight (or less.8440i 3.8440i -1. in the case of failure) propellers.3.y]=solve(2*(x-1)+8*Lambda*x.

4: 18 .18) Following 3. a cost function will be supposed like follows (function which has to be optimized.3 and 3.N .11) Like described in 3.1.1. N1 N2 Cost = i=1 Ti2 + j=1 λj ·constrainsj (3. LAGRANGEN MULTIPLIER The energy is supposed to be dependent of the quadratic sum of the eight propellers.10) (3.17) 8 8 2 TXi + 2 TY i + λ1 · i=1 8 8 Cost = J = i=1 8 TXi − XReq + i=1 λ2 · i=1 TY i − YReq + λ3 · i=1 (−dyi · TXi + dxi · TY i ) − NReq (3. λj ) A·T =B (3. respectively minimized).16) T = A−1 · B (3.15) A∈ N.14) (3.T ∧ B ∈ N und N = 2n1 + n2 (3.3.13) (3. P ∼ Ti2 Es gilt: TT otal = 2 2 Tx + Ty (3.12) T = Treq T − Treq = 0 ∂Cost =0 ∂(Ti .

. To keep the problem linear another option would be to do the following: Once if the calculated thrust of 19 .3  −dy dx TT = BT = T T TX TY λT 18. more constrains can be used. this algorithm has to be modified.19) (3.1 18. the required values alphai and Ti can be found using T = A−1 · B.1. (See p13gui/Propeller Aloc).3. 2 · TY 8 + λ2 + dx8 · λ3 = 0 8 TXi − XReq = 0 i=1 8 TY i − YReq = 0 i=1 K (−dyi · TXi + dxi · TY i − NReq ) = 0 i=1 This system can be written like a system of linear equation of this form: A·T =B That results in:    2 · E 16.1   A =  11.16  08. .1 08. To consider the case of a saturated propeller (this means that a propeller has reached its maximum thrust). And Ti = TY i 2 2 TXi + TY i and αi = arctan( TXi ).1 −dy  dx        (3. After solving the equation system.8   01.20) (3. to handle and to implement in microcontrollers.8 03.16 XReq YReq NReq This form is easy to calculate.21) 01. LAGRANGEN MULTIPLIER 2 · TX1 + λ1 − dy1 · λ3 = 0 2 · TX2 + λ1 − dy2 · λ3 = 0 . Firstly.8 11. But it would cause the problem to get non-linear.8 01.

Adaptation to the real conditions The values that have been calculated by the algorithms described above can’t be realized without delays. Because of the simplicity I implemented a PT1 model. I solved the problem with the second way. A saturation of a propeller in the symmetric case easily causes saturation in the whole propulsion system. its real value has to be set to Ts . IMPORTANT: The case of a saturated propeller will occur principally.1 ) = 99% and t = 20 results in Ti.1 ≈ 4.soll its solution is: Ti (t) = Ti. 3. with the propellers that that still left. That means that a modification of the thrust or the angle won’t be followed immediately. The source code can be found in the appendix. when there is already an asymmetric propeller configuration due to a failure in one or more propellers.3. The forces and the moment which still remain has to be calculated and distributed again.2.soll −Tt i. LAGRANGEN MULTIPLIER one propeller achieves more than the saturation value Ts .soll · (1 − e Setting Ti (t=20) Ti. which can be integrated easily in Simulink using a state-space-block. This useful advantage would fall away. This is following [5]: ˙ Ti.1.23) 20 . Putting it to the form: x = Ax + B ˙ y = Cx + D results in: (3. Because of that. In this case a redistribution of the remaining forces and the moment would be done.22) (3. That means that the optimization has to be done again.1. The first suggestion would result into a non-linear problem. According Data Sheet [8] an azimuth velocity of αi = 2RP M and ˙ a run up time of TAnlauf = 20s can be supposed.3s for the time constant.1 · Ti + Ti = Ti.

27) With E as the identity matrix.4 0.8 0. a single propeller was modelled like that.8 (3..3.2 0 0 5 10 t 15 20 25 Figure 3.26) (3.3 t 0.8 Ti.1 C = E 8.1. This is the expected behaviour. And the sum of all of them should behave equivalently.1.6 T (t) Tsoll 1 − e− 4. the controller demands two different force vectors. To clarify this problem.4. LAGRANGEN MULTIPLIER 1 0.24) (3.3.: System response of a P T1 -System 1 · E 8. In point 21 .25) (3.1 1 B = · E 8.8 A = − D = O8.8 Ti. This form can easily be implemented in the Simulink model (p13gui/PT1). In point I. In this case. the propulsion system just achieves the desired thrust after 20s.3 and 3. let’s take a look at picture 3. I have introduced at the same time a new problem. azimuth velocity is realized in the block (p13gui/Azimut Delay). 3.1. because. Influence of the Delays With the introduction of the allocation block and the following delay blocks. the demanded Force jumps quickly from zero to Fx = 2000kN . like described above. Because of the limited run up time.

How can the system react? It could. the value of the Thrust doesn’t change. but it would slow down the response speed.: Delay of angle velocity II.. like it can be seen. the introduction of these blocks raises the complexity of the whole system concerning the coupling and degree of the total system. LAGRANGEN MULTIPLIER Figure 3. but the direction changes from 0◦ to 90◦ . This causes that coupling that can be seen in this point. But since it is not able to look into the future. In the last point the two forces are set to zero. Later we will see if the influence of these delays is really that big or not. Like we could see. it would be better. if the propulsion system just switches the propellers off. for example. the change has an influence to iz. But the assumptions are just approximations to achieve a more realistic simulation of the platform’s behaviour. Although the force Fx doesn’t change at this point. it doesn’t do it. In this case the azimuth delay takes place. than change the thrust direction and after that run up again. However.2. Because the system doesn’t know what command follows.3.1. Because of the relatively big time constants in relation to the time constants of the propulsion system. This would reduce the influence of the coupling. a controller design should be robust. In the given case it just changes the direction without slowing down the rotation speed of the propellers. run down the propellers. like it can be seen in the resulting thrust. I expect that it won’t affect that much the system dynamic for positioning issues which just has 22 . This is an interesting point. Since every value is zero at this point and will be zero future. it runs down and propellers and changes the position at the same time.

a low-pass which has to be adapted to the propulsion system should be used. LAGRANGEN MULTIPLIER to take the platform from one place to another.3. Disturbance of higher frequencies won’t be compensated. But it’ll be a limitation in relation to the disturbance rejection.: Demanded force 23 . Figure 3.3.1.

LAGRANGEN MULTIPLIER Figure 3.: Resulting force 24 .1.4.3.

Let’s suppose that there is a current. The last disturbances are the waves. in general. which has to be included in the simulation. That means that a mathematical description of the perturbations has to be found to implement it in the simulink simulation. The PID will control the resulting force and not the resulting rotation speed or flow velocity. But additionally one may not forget that this kind of perturbation is a little bit problematic. let’s take a look at the types of disturbances. of a constant component and a high frequency component. First. which affect the platform. firstly. Perturbations In order to perform realistic simulations. First it could be seen as a constant force which influences the platform. a constant disturbance. See [3]. the environment of the platform has to be simulated and modelled. But the current is in this case a perturbation. That means that it is necessary to. too. 25 . The next disturbance is the wind. that means a mathematical description of the environmental influences and secondly to analyze a system response in order to let the simulated platform response to this modelled stimulus. But since the thrust of the propellers is controlled by a PID this problem should not be that complicated if the current is not that high. The waves consist of lower-frequency components. But to put it in other words the maximal force to compensate the current is smaller than 8 * Ts. That means that the bigger the current is the smaller is the maximum thrust which could be provided by the propellers. Because of the platform’s weight and big inertia and because of the slowness of the propulsion system (like explained above). In general there are three different kinds of them: The current. design a simulation. the waves are the most important kind of perturbation. the waves and the wind. The propulsion system can compensate it generating a constant force on his side. Wind consists. The current can be seen one the one hand as a constant value.4. just the constant part should be compensated. On the other hand the reaction of the platform is needed to be designed. But the propulsion system generates force generating a current itself. High frequencies almost won’t affect that big platform.

191ωT1 −1 √ 2σ 2 (4. 4. Transforming these measurements in a table a signal transfer function can be determined which can directly be used to compute the system response of this kind of stimulus. Following [2]: 2 HS S(ω) = 155 4 5 e T1 ω −944 4 T1 ω 4 γY (4.4. Simulation of the Waves To integrate a perturbation block into the simulation it is firstly necessary to determine how it is compound and than it has to be analyzed how the platform reacts due to this stimulus. another random phase is calculated 1 .4) xjP O (t.4. which describes a turbulent behaviour of the local sea.2) 5. β0 ) = i=1 2S(ωi )RAOj (ωi . Using the parseval theorem and consider [4] follows: A2 (ωi ) = 2∆ωS(ωi ) i Considering the measured system response results in: n (4. the system reaction were measured in three degrees of liberty.3) It is T1 = 0.1.07 f¨r ω ≤ u σ= 0. a 4. For this see the pictures 4. SIMULATION OF THE WAVES 4. In the given case a power density spectrum called JONSWAP has been integrated.1) With the parameters: Y =e − 0.1. order butterworth filter with wg=1rads/sec has to be included in the simulation 26 .24 T1  0.09 f¨r ω > u (4. 834 · T0 and T0 = 1. The model of the platform has been stimulated with some discrete test frequencies. β0 )2 ∆ωcos(ωi t + phase(RAOj (ωi .3 and 4. 073 · Tz and γ = 3. It can vary between one and seven.24 T1 5. In order to determine this. 3.5) After passing a total period of the deepest frequency. some tests were made by an institute from the Netherlands. That means that the last two terms of the phase can be substituted by a random 1 in order to suppress the high frequency part which occurs due to this step. β0 )) + φj ) (4.2.

72 0.1 0.: Unimodal Spectrum phase 4.16 0. SIMULATION OF THE WAVES Figure 4.8) (4.58 0.9 0.52 0.4. Derivate the equation two times gives the acceleration.07 0.06 0.6 0.12 0.1.35 0.07 Table 4.1.9 0.06 0.3 0.07 0. β0 )2 ∆ωcos(ωi t + φj ) (4.95 0.07 0.8 0.1 0. In order to considerate the orientation angle in relation to the incoming wave front.9) 27 .7 0.04 0.22 0. n xjP O (t.: Amplification function RAO This can be connected directly with the mathematical model of the p13 platform (see model).26 0.5.6) ω x ζ y ζ φ ζ 0.74 0.42 0.5 0.7) (4.1. β0 ) = ¨ i=1 2 ωi · 2S(ωi )RAOj (ωi . the following equations have to be used: xξ = xξP O · cos(Φ) yξ = yξP O · sin(Φ) Φξ = ΦξP O · sin2 (Φ) (4.4 0.

Also see source code A. The PO-values xξP O . SIMULATION OF THE WAVES xξ . as a result of the perturbation.2.3 in the appendix.1. yξ and Φξ are the experimental movements. yξP O and ΦξP O are the system responses that were computed using the RAO table 4.1.: Response of Surge x 28 .4. Figure 4.

SIMULATION OF THE WAVES Figure 4.: Response of Sway y 29 .4.3.1.

4.4.: Response of Surge φ 30 . SIMULATION OF THE WAVES Figure 4.1.

The controller tries to minimize this difference.1. To show the general manner of operation I would like to explain it with the Feder-Masse-Schwinger. Figure 5. A general scheme of a system that has to be controlled with sensors. In the easiest case the controller gets the difference of the desired value and the real value as an input.1) Refering to [1] the PID is compound as follows: 31 . Controlling In [1] is shown that the system behaviour can significantly improved by using the feedback principle. PID Controller The PID Controller is a relatively simple controller which const of an proportional part. an integral part and an derivative part.: Usual controlling system 5. controller and actors is given in 5. GS (s) = X(s) k0 = 2 + bs + c U (s) ms (5.1.5.1.1 of the fms with damping results after laplace transformation and with F = k0 · u. The transfer function of 2.

This means that no permanent output error is expected and an integrator is not needed.5. 5. The differential part influences directly the damping of the system.2) (5.3) (5.1 summarizes the most important feature of these controllers and combinations of it. PID in the platform Because the platform doesn’t have anchors.2. With its help it is possible to avoid overshoots. A slow PD Controller with a big damping should be used for positioning proposes in order to economize energy.6) With F0 (s) = GS (s) · GR (s) as the transfer function of the open system.2. I suggest the following configuration: 1. that the error becomes zero (limt→∞ f (t) = lims→0 F (s) is in this case every time Ki Ki = 1) . Table 5.5) U (s) Ki = Kp + Kd · s + Qdif f (s) s (5. PID IN THE PLATFORM u(t)p = Kp · qdif f (t) u(t)d = Kd · qdif f (t) ˙ t P-Regelung D-Regelung I-Regelung t (5. the integrator integrates the error signal over the time and increases or decreases the output in that manner. There are no c-parameters in the differential equations. A filter must be used to model it 32 .7) The proportional part of the controller affects a control action that depends linearly on the error.4) qdif f (τ )dτ 0 u(t)i = Ki 0 qdif f (τ )dτ u(t) = Kp · qdif f (t) + Kd · qdif f (t) + Ki ˙ The transfer function of the controller results in 1 : GR (s) = (5. 1 Notice that an ideal derivative doesn’t exist. the close system yields in Qist (s) F0 (s) k0 (Kd · s2 + Kp · s + Ki) = = Qsoll (s) 1 + F0 (s) ms3 + (b + k0 · Kd )s2 + (c + k0 · Kp )s + k0 · Ki (5.

The closed-loop system results in : 1+ M +a11 2 s Kp Kd s Kp (1) +K b1 1 d s Kp ≈ +1 + 1 2 2s ω0 K + 2D s + 1 ω0 (5. a stronger and faster controller should be used which also is able to compensate permanent errors which are caused by constant perturbations like current or wind. . but used. The proportional part causes a fast control. It’s very common to provide a proportional controller with an integrator in order to compenate the controlling difference. An eventually set of rules can contain the difference from the wanted position. To soften the crossing area between these two controlling regions. the actual velocity and an acceleration. While trying to design a PID controller for the platform.3 in an IT 1 -system (if one takes the position as the output xb = u. one is confronted which the first problem.5. The linearized model results in reference of 2. Controls rapidly. This combination is less common. 3. I PI PD PID Controls slowly. This error can be reduces with an additional gain. proportional controller tends towards oscillations. A reasonable analytic design can only be made with the linear model. doesn’t have a permanent error.1.2. In order to keep the platforms position stable even with perturbations. A PID Controller is needed... but isn’t able to compensate permanent errors.1. the integrative part improves the accuracy and reduces the permanent error and the derivative part improves the controlling velocity. More complex controlling system. Table 5. the decision which controller takes how much part could be taken by a fuzzy controller.: The P.).I and D and its combinations 2.0205 is needed. ˙ To design a PT2 similar response with D = 1 and approaching approximately 99% of the desired position in 300s an ω0 = 0. PID IN THE PLATFORM Kind of Controller Features and Area of Application P For lower requirements. It is used to react faster to big changes of the input.8) 33 .

the mathematical model is non-linear and coupled. In order to describe how this kind of algorithm works.4. Kd = 2460 and for φ: Kp = 30000 and Kd = 3200000. But without simplification.10) ω0 By doing this computation with all the 3 coordinates it results in the following controlling Kd = parameters xb : Kp = 23. try another vector. yb : Kp = 23.3. where the equations had been linearized. The main idea is to start a first attempt with a controller parameter vector.9) 2D (1) · Kp − b11 = 2900 (5. In order to test the simulation I just implement the positioning parameters. If the transfer matrix isn’t known or non-linear.5. analyze the solution. the platform passes through a lot of different states. Kd = 2900. if the intention is to keep the platform on a position and keep the velocity and acceleration as small as possible. 5. it is obvious that the dynamical positioning perhaps shouldn’t be done by using them.5.3. every value should be near zero). that can even find suitable controller parameters. Iterative Feedback Tuning In general one can say that an optimal controller design requires a complete knowledge of the system that has to be controlled and of the disturbance. A numeric algorithm should solve this problem. Numeric Algorithm Using the linearized form of the equations is mainly permitted when being near to the operation point (e. 5. or better. That means that there is not just one operation point. analyze if this design got better or worse (gradient) and determine another solution hoping that it converges and finds a local. Perhaps a simplification of the equations is not longer the best idea. In the reality that is not often the fact. It should be used a tool. On its way from one waypoint to another. I will explain it with the iterative feedback tuning. although this kind of model is used. it’s quite difficult to 34 . global optimum. NUMERIC ALGORITHM 2 Kp = w0 (M + a11 ) = 23 (5.g.

∂J 1 0= (ρ) = ∂ρ N 2 N t=1 ∂yt yt (ρ) (ρ) + λ ∂ρ N ut (ρ) t=1 ∂ut (ρ) ∂ρ (5. Kd . this exacter system information helps to design a better controller and a better controller helps to identificate the system even more exactly in order to design another better controller. 5. The transfer function of the controller is ρ. but this case is quite unrealistic (especially for a PID Controller that is a lower-order controller).5. A opportunity to design controller of restricted complexity. I don’t consider the disturbance for now. to improve the identification of the system using close-loop tests with the actual controller. But the IFT algorithm works even without system identification. A comparable technique is used by the algorithm called ”Iterative Feedback Tuning” that I will describe here at this section. In order to obtain the minimum of the criterion. This information helps to improve the controller by successively applying the new data to the new controller. The criterion that should be minimized is: 1 J(ρ) = 2N N N 2 (Ly yt (ρ)) + λ t=1 t=1 (Lu ut (ρ))2 (5. Ki ). That means that the idea is. The algorithm that I will explain here is the original algorithm from [13] that has been simplified and adapted to the present case. but because the algorithm doesn’t have to be applied to a real plant. A good remedy can be found by utilizing a frequently-used algorithm called Ziegler-Nichols 2 .4. But in [13] is said that there are few results to support these expectations. For more details see [13]. To put it in other words closed-loop system identification is made. Actually. It’s tried to achieve a closed-loop system-response that is similar to the response of a PT1 with first order delay G(s) ke(−T s) τ s+1 35 . is to perform a plant model identification and model-based controller update. the original IFT considers disturbance. ITERATIVE FEEDBACK TUNING determine suitable controller parameters analytically. except if a full-order controller and full-order model is used.11 has to be derivated and set to zero.12) A model free procedure that was designed in the year 1942. On a PID Controller this would be ρ = (Kp . Let’s suppose a linear time-invariant transfer function G0 (Like described in [13] this assumption even seems to be allowed although the present system isn’t linear).11) With y(ρ) = y(ρ) − y d as the difference between real system response y(ρ) and desired response y d = Td r. to discover controller parameters for simple controllers in unknown systems.

This results in the following algorithm..12 and 5. Measure of u1 and y 1 with r as input 7. See 5. −1 and the matrix R-1 Ri with 5.21).22.15) 36 .14) In can be noticed. Calculate the gradient ∂ yt e (ρi ) ∂ρ ∂J (ρi ) ∂ρ and ∂ut (ρi ) ∂ρ via the equations 5.4. the author suggests to stimulate the system with a signal r (e. Following [13] the equation bellow should lead to a fast convergence: 1 Ri = N ∂ yt e (ρ) ∂ρ N t=1 ∂yt ∂yt (ρi ) · (ρi ) ∂ρ ∂ρ T +λ· ∂ut ∂ut (ρi ) · (ρi ) ∂ρ ∂ρ T (5. By measuring its responses y 2 and u2 . Determine the transfer function of the controller C(ρ) 3. Continue with 5 with the new vector ρi+1 calculated by 5. ITERATIVE FEEDBACK TUNING If this gradient could be computed. a following iterative algorithm can be used: −1 ρi+1 = ρi − γi Ri ∂J (ρi ) ∂ρ (5.12 is to obtain a solution for the gradients and ∂ut (ρ). 1. Set the parameters of the algorithms e.13 y 1 (ρi ) = C(ρi ) · G0 ·r 1 + C(ρi ) · G0 (5. Set the desired response y d = T d · r 2. Calculate the gradients 9.13) −1 Ri is a positive definite matrix.20 and 5. ∂ρ In order to obtain this. Determine the gradient ∂C (ρ) ∂ρ 4.21 and 5. Estimate a start vectorρ1 5.g. γ. step function) while measuring the output y 1 and u1 .5..) 6.g. Measure of u2 and y 2 with r − y 1 as input 8. Ri could also be the identity matrix. typically a Gauss-Newton approximation of J and the step size γi .14 10. That the gradients can be determined by stimulating once again but with r − y 1 as input. that the big obstacle in 5.

5.4. ITERATIVE FEEDBACK TUNING

u1 (ρi ) =

G0 ·r 1 + C(ρi ) · G0

(5.16)

y 2 (ρi ) =

C(ρi ) · G0 · (r − y 1 (ρi )) 1 + C(ρi ) · G0 G0 · (r − y 1 (ρi )) 1 + C(ρi ) · G0
C(ρ)·G0 1+C(ρ)·G0

(5.17)

u2 (ρi ) =

(5.18)

∂ ∂y ∂y ∂C = · = ∂ρ ∂C ∂ρ

∂C

·

∂C ∂ρ

(5.19)

With u = C(ρ) · G0 and v = (1 + C(ρ) · G0 )−1 and its derivative u = G0 and v = −1 · (1 + C(ρ) · G0 )−2 · G0 follows according to5.19: ∂y G0 G2 · C(ρ) ∂C(ρ) 0 =uv+vu= − ·r 2 ∂ρ 1 + C(ρ) · G0 (1 + C(ρ) · G0 ) ∂ρ Setting 5.15 in 5.17 and by comparison of coefficients follows ∂y 1 ∂C(ρ) 2 (ρi ) = ·y ∂ρ C(ρ) ∂ρ Doing the same with
∂u (ρi ) ∂ρ ∂y ∂ρ

(5.20)

: (5.21)

results in: ∂u 1 ∂C(ρ) 2 (ρi ) = ·u ∂ρ C(ρ) ∂ρ (5.22)

Figure 5.2.: Blockschaltbild des ITF-Systems

37

5.5. DESIGN OF A DIGITAL CONTROLLER WITH IFT

5.5. Design of a digital controller with IFT
Applying this algorithm to a PT 2 -system with m = 1, d = 0.5 and c = 1 and the fixed step size γ = 1 and λ = 0 with a desired response yd = (1 − e− 0.5 ). . The algorithm even achieves a suitable solution after less iterations that is almost similar to the analytic solution. But to begin with the algorithm, the PID has to be modified. PD-Controller: u(t) = Kp · e(t) + Kd · e(t) ˙ e(k) − e(k − 1) ∆T
Kd ∆T
t

(5.23)

u(k) = Kp · e(k) + Kd ·

(5.24)

(Kp + Kd )z − U (z) = E(z) z I-Controller:

=

az − b z

(5.25)

u(k) = u(k − 1) + ∆T · Ki u(k − 1) U (z) ∆T · Ki c = = E(z) z−1 z−1 It follows the discrete transfer function of a PID-Controller: az − b c az 2 + (c − b − a)z + b U (z) = + = E(z) z z−1 z(z − 1) With a = Kp +
Kd , ∆T

(5.26)

(5.27)

(5.28)

b=

Kd ∆T

and c = ∆T · Ki follows that:
Kd )z 2 ∆T Kd ∆T

Kd + (−2 ∆T − Kp + Ki ∆T )z + z2 − z Now just the partial derivatives are missing. These are:

(Kp +

(5.29)

∂C z2 − z = 2 =1 ∂Kp z −z 1 2 2 z − ∆T z + ∂C ∆T = ∂Kd z2 − z ∂C ∆T z = 2 ∂Ki z −z

(5.30)
1 ∆T

(5.31) (5.32)

38

5.5. DESIGN OF A DIGITAL CONTROLLER WITH IFT Taking a look to 5.3 shows that got results were achieved for the PID. The calculated parameters are: Kp = 0.9863, Kd = 1.9801 und Ki = 1.9797. Another start vector (5.4)achieves after six iteration steps Kp = 0.9866, Kd = 1.9799 and Ki = 1.9799.

Figure 5.3.: Systemantwort nach Optimierung (Startwert: Kp = 1, Kd = 0.1, Ki = 1), 5 Schritte The analytical solution is Kp = 1, Kd = 2 and Ki = 2. Here the poles are in the zeros. The close-loop system behaves like a PT1 -system. Zeros: sn1/2 = −0.2500 ± 0.9682i Poles: sp1 = −2 sp2/3 = −0.2500 ± 0.9682i

39

5.6. CONTROLLER PARAMETERS WITH IFT

Figure 5.4.: Systemantwort nach Optimierung (Startwert: Kp = 0.1, Kd = 0.1, Ki = 0.1), 6 Schritte

5.6. Controller Parameters with IFT
The algorithm above introduced algorithm of IFT is the SISO-Version of the algorithm. Since the platform is a MIMO-system it has to be modified like it is explained in [14]. But my intention was only to explain this kind of alternative. But even if I try to apply it to the platform, seeing it like an SISO system, with the input Fx and the output x, the algorithm already brings a suitable convergent result like it can be seen in 5.5.

5.7. Optimization via Matlab Response Optimization Toolbox
The most recent version of Matlab, Version 7 R14 brings some considerable improvements with its new Toolbox Simulink Response Optimization. The intention and its methods are quite similar to these of the IFT algorithm. A easy to use method, which iteratively brings good results is the following: • Positioning of Signal Constraint blocks at the output connectors.

40

• To minimize the signal enery. it is possible to position RMS-blocks at the concerning places.) • Estimating a start vectro • Passing to the Signal Constrant Toolbox the controller parameters that may be optimized and can be modified. If necessary maximum and minimum limits. 41 . In the given case of the platform a stimulus of 5. settling time. Chirp-Signal.. • Uncertain model parameters also can be passed to the toolbox. overshoot and undershoot and its limits. . The paramters of the controller that have to be modified are chosen the proportional and derivative part.7. the reference is again xs = ys = 0 and after 600 seconds ys should be ys = 25. like rise time. The integrative part of the controller is hold to zero. From xs = ys = 0 the xs -input is set to xs = 25 and ys is been hold to zero.. • Determining a stimulus (Step-function. OPTIMIZATION VIA MATLAB RESPONSE OPTIMIZATION TOOLBOX Figure 5.5.: Systemantwort P13 auf Einheitsprung ITF • Setting of certain response characteristics. It results in a PD-Controller.5. • Or/and a tracking reference signal (like ITF) can be used.7 is used. After 300 seconds.

but this wasn’t the task.80 Ki 0 0 Kd 4999 6000 Table 5.5. Like it can be seen in 5.8 and 5.2. The controller seems to by good.: Matlab Optimization Toolbox PID x y Kp 50 171. There won’t be a controlling difference. OPTIMIZATION VIA MATLAB RESPONSE OPTIMIZATION TOOLBOX Since the platform is not anchored. Some parameters that have passed to me by another student were less suitable. the system can already be seen as a integrador. matlab find successfully a suitable soultion. But I can say that the parameters are good enough to be implemented into the platform model in order to prove if the general assumptions are certain or not. Its right. With the new parameters 5. A extra integrative part would be suppressed by the Matlab algorithm via the remaining parameters.7. The toolbox tries now to find a suitable solution for the coupled system that suppresses the coupling influences.11 the platform reaches directly its position. Figure 5.10 the platform approaches oszillating to the desired position. Like it can be seen in 5.6. In particular the disturbing effect that is described in 3 seems to be not so disturbant.9. that this controller isn’t already optimal.: Optimierte Reglerparameter 42 .

The rules for the fuzzy controller that have been implemented by me just for testing proposes and can be found in the appendix. CONTROLLING VIA LQR/LTR AND FUZZY Figure 5.8. I won’t describe at this place how this approaches have been done.8.5.: Stimulus 5. 43 .7. Controlling via LQR/LTR and Fuzzy A LQR-LTR controller has also been implemented. Please refer to the concerning reports of it.

5.9. CONTROLLING VIA LQR/LTR AND FUZZY Figure 5.8.: System response with coupling delay 44 .: System response on stimulus Figure 5.8.

8.pi) Figure 5.pi) 45 .11.10. CONTROLLING VIA LQR/LTR AND FUZZY Figure 5.: Trajectory with new parameters (Position 50.: Trajectory with old parameters (Position 50.50.50.5.

what has to be controlled? The platform is equipped by 8 propellers. The Microcontroller Board Rabbit RCM 3200 As I have described above I have chosen the Rabbit 3000 µC. 512K program execution SRAM. 4 fixed outputs o 10/100Base-T RJ-45 Ethernet port • 512K flash memory. Soft. This one is on the other hand connected with four AVR Microcontroller.6. 6. Rabbit Semiconductors offers a big amount of different Board.1.and Hardware Implementation With this parameters and algorithms it is possible to determine the best hard. 4 fixed inputs. First. Following [12] the controller offers: • Powerful Rabbit 3000 Main Processor with 44. These eight propellers are distributed over the four corners of it. My idea is to connect one powerful controller with four smaller ones.and software realization of the platform. 256K data SRAM • 6 Serial Ports (4 of them are compatible with SPI) 46 .8. That means that there are 4 motors at each corner. each one for each corner.2 Mhz • 52 parallel 5 V tolerant I/O lines: 44 configurable for I/O. each one four of them via the PWM outputs of them. See 2. The structure can be seen in 6. For my purposes the Rabbit RCM 3200 is the best choice. one for the force and one for the angle. One Personal Computer is connected via TCP/IP with a Rabbit 3000 Controller for monitoring purposes.1. It would be possible to use either one powerful controller with a lot of outputs to control all of them or to use one controller which acts as a master and communicates with smaller ones. each one has two motors. which control 16 motors.

THE MICROCONTROLLER BOARD RABBIT RCM 3200 Figure 6.1.: Principle System Configuration 47 .1.6.

2. I don’t think. In order to realize a starlike communication (What is allowed in this case.2. • Since I will control four drives by each controller.6. high performance and relatively easy-touse development environment called CodeVision C. which more than fulfils all of these points above. But which of these controllers of this family is the optimal choose in my case? First let me list the criterions which the controller has to fulfil and which features are needed: • A common Serial Interface to communicate with the Rabbit 3000. The calculated values should be sent to the AVR controllers. Considering this. Like already said. The Microcontroller ATMEL Mega64 Like it can be seen in 6. This includes the acquirement of the actual position. It looks like the ATMega 64 is the best choice for the present case. The Serial Communication Interface The Rabbit Semiconductor Rabbit 3000 and the AVR ATmega 64 are two completely different processors. I have chosen the ATmega64 controller. 4 PWM Channels are needed. • Low-Power Consumption would be a nice extra. the Rabbit 3000 should run the main controlling algorithms. that more than 4 AVR’s will be used. In order to do that. An the R3000 has enough serial interfaces to manage this task). This µC family is frequentlyused controller set because of its good price. The serial communication has been implemented in two levels. It can be programmed comfortably with the STK 500 kit and STK 501 or STK 502 adapter kit. The low-level communication handles just a single incoming byte. a calculation of the controller response and the optimization that was explained in chapter 3.1 I use four AVR microcontrollers. o At least one additional Timer (8-Bit or 16-Bit). 6. o Each of these four drives should be controlled by a PID algorithm with a actualization frequency of T = 10-3s-1. • Perhaps up to four Analog/Digital Converter. for this reason I need a controller which is powerful enough to handle this. 48 .3. THE MICROCONTROLLER ATMEL MEGA64 6. a communication interface that handles the communication of this two different controllers have to be developed.

even when the processor is doing other things. 5. 49 . The only code concerning the communication which has to be implemented in the main() routine is a short command that verifies if the content of the receive buffer is larger than zero. The main routine continues where it has been stopped. Because of that all the incoming data are stored in a global variable. What will happen? See 6. they can’t return a value nor have parameters. Let’s take a look at the process-diagram in such a case. that it’s it the middle of it. To put it into one sentence: Since the communication handler uses interrupts and a receive buffer.3. I suppose that the CPU is occupied by the main() method. 2. That means that the CPU could do its controlling job without being disturbed by time-robbing check and communication loops.6. 4. which restores all the registers and recalls the routine which has been interrupted. 3. Let’s suppose. it processes the new data which is still waiting for being treated. 1. The IHSC receives the data and puts it into a certain buffer. The task-switch saves all the used registers and the re-entry point and calls the corresponding routine (in this case IHSC.2. it signifies that new data arrived. Low-Level Communication To keep the processor free while no traffic is occurring on the serial bus. the low-level communication has been realized by using an interrupt-routine. 6. Note that since interrupt routine are not called at a certain point. Just when some data arrives the routine let the CPU handle this request and after that it continues where it stopped. If it is so. The CPU is processing the main routine. THE SERIAL COMMUNICATION INTERFACE 6. Some traffic on the serial bus arrives which causes the microcontroller to throw an interrupt. If it won’t be interrupted again and when it arrives at the certain point. Interrupt Handler Serial Communication). The control is being given back the to the TS. which is doing most of the time (in the present case) its controlling job.1. it is possible to receive incoming data at any time without loses. in other words these functions can only manipulate global variables. Now some data arrives via the serial port.3.

RECEIVE and COMMANDRECEIVED. otherwise it would be possible to confuse it. the statemachine stays in the LISTEN state as long as other data than a predefined dataword arrives at the receive buffer. First. which I described above could be called as the low-level communication. At a higher level I implemented a communication interface using a relatively simple state-machine. If it would achieve it. The microcontroller starts one of its build-in timers to determinate a maximum transfer time and sends a ready-to-send command. the AVR Controller will send a TIMEOUT command to the Rabbit 3000 and will return to the LISTEN state.3. Any arriving data would be discarded. Now the Rabbit 3000 controller has to send its message within this predetermined time. This level uses on his part a interrupt handler. which just handles a single incoming byte. See 6. High-Level Communication This part of the communication protocol. the protocol switches to the COMMANDRECEIVED state and will refuse any incoming data (That means that these data will just be rejected at the high-level interface) until these are processed. the state-machine switches into the RECEIVE state. 50 .6.2. These states are: LISTEN.3. When this start byte arrives. In that case that the command arrives successfully. THE SERIAL COMMUNICATION INTERFACE Figure 6. But this time it is a Timer Interrupt. 1 This dataword can be seen as a start byte and may not be used as a data byte.3.: Process-Time-Diagram Low-Level Serial Communication 6. too. Actually the state-machine has n RECEIVE 1 states in order to store a high-level command of the length n.2.

Since the AVR receives relatively seldom commands. Figure 6.3. See source code C.: Statemachine of the High-Level Serial Communication 51 . a command buffer can be introduced that is capable to buffer m commands. If one likes to. THE SERIAL COMMUNICATION INTERFACE Those data the AVR would respond with another predefined code. In another words the state-machine won’t be reset to the LISTEN state until the higher level controlling algorithm resets it by picking these data up.6.3. it isn’t necessary.1.

The TWI is a bus system that is only supported by AVR.4.4. But it is always a good idea to think in the future. The maximum data transfer velocity is 400 kHz. If there is a suitable system that recognizes non-working propellers. it has just to be connected with the bus without modifying it. The problem of the bus system is that. the optimization algorithm in 3 can considerate it and compute another solution with the remaining propellers (The programmed algorithm is already capable to solve this kind of problem). With it. a single AVR controller can be used to act as a bus controller. Its a master-slaveprotocol that is supported by both. The big advantage of this structure is its extendibility. there is not need to implement it. if one cable is damaged. it is possible to connect 128 processors with each other via 7 Bit addressing. If one more AVR is needed. In the present case.: TWI Bus Connection 52 . Since in the present case 4 controllers are enough. See 6.4.4. the Rabbit and the AVR processor family. the whole communication system would stop working. Alternative Communication Method Another opportunity to realize a communication would be a communication via a combination of the synchronous SPI interface and the Two-Wire-Interface of the AVR.6. Figure 6. Since the R3000 doesn’t support this standard. a damaged cable won’t just cause to stop two proppelers to work. ALTERNATIVE COMMUNICATION METHOD 6. The SPI interface offers high speed serial communication with 4 wires.

in order to help the optimization algorithm to determine the optimal thrust. A standard GPS system with a resolution of 1m should be enough. some different kinds of sensors have to be mounted. Sensors In order to design a faultless controlling system. The most important sensor is a positioning sensor that provides information that are exact enough about the actual position. SENSORS 6. too. On the other hand.5.5. failure sensors that detect failures in the propulsion system have to be mounted. 53 .6.

The fact. if the assumptions made in this report are right. But now the way is almost clear to perform first test with the physical model. a realized a simple communication protokoll between the R3000 and the AVR Microcontroller world by using the important programming language C. For me.7. but it was an optimal opportunity to make some experiences in a foreign country and to learn and improve a third language. it will already be possible to discover. As already said in the introduction. that I learned very much. this project was an interesting mixture of practical simulation and implementation and of research aspects. it wasn’t the intention of this project to find the optimal controlling algorithm. I also realized a TCP based communication between a PC and the R3000. 54 . And I also extended my knowledge of the control system theory. that I did my project in Rio de Janeiro. I got to know Matlab and its toolboxes. and basing on this simulation and its controlling parameters. Brazil and not in Germany without a doubt didn’t make it easier. I needed to learn C in order to program the microcontrollers. a little bit of ship engineering and more. I can say. I never would like to miss these experiences which I made in that beautiful country. Conclusion In general.

Pges(Pf)=[]. Fxg=Eingang(1). [1 0 1 1 1 0 1 1] -> [2 6] 5 Eingang=Eingang’. sol=0. Ps=[]. Pf(i)=[]. P=diag (Plig)*Pges’. The Matlab M-Files A. ohneProp=defProp. 20 Mg=Eingang(3). Source Code Optimization via Lagrange (Propsim. defProp=Pges. 55 .1. Fyg=Eingang(2). Pges=[1 2 3 4 5 6 7 8]. 15 solved=0. Pf=Pges.m) 1 function [Ptotalsim]=propsim (Eingang).j]=find (P==0).A. Plig=(Eingang (4:11))’.g. %Convert constant input vector %e. 10 [i.

ohneProp=[defProp (Ps(:. saettigung=1. Mneu=Mg-Mprod1-Mprod2. Txsaet=820*(cos(alpha)).1. SOURCE CODE OPTIMIZATION VIA LAGRANGE (PROPSIM. dy=Ps(:.A.3). 50 Mprod2=-dy’*Txsaet. Ps=[Ps.ncolumns]=size(P). 55 dt=dtneu. for i=1:nrows 35 if dtneu.dtneu.A]=propkonfsim (Eingang(1:3).Tprop(i)=820.M) 25 %Main routine which handles the saturation problem %and calls the lagrange algorithm what is being realized %in propkonsim. %if det A=0.m while solved~=1 30 [P. 56 . ohneProp).Tf(i) dtneu.dy(i) 820 dtneu. Fyneu=Fyg-sum(Tysaet).5). Eingang=[Fxneu Fyneu Mneu]. end 40 end if saettigung~=0 alpha=Ps(:. 45 Tysaet=820*(sin(alpha)). dx=Ps(:.alpha(i)]. [nrows.2). set old value else solved=1.dx(i) dtneu.Tprop(i)>820 dtneu.1)’)]. solved=0. Fxneu=Fxg-sum(Txsaet). dtneu. if ~isempty(P) %if P is empty a det A=0 has been occured saettigung=0. Mprod1=dx’*Tysaet.

Tf dt. end %requested input has been reached? %det A problem 65 end %Cuts superflouos lines presto= [dt. 60 end else sol=0. Ptotalwithdef(1:8.A]=propkonfsim(Ft_1. 70 [i.j]=find (presto==820). A. defProp’ (zeros(nf. solved=1.A.4).4))].5)]. global dx dy Tprop alphaprop A % pf=Numbers of non-working propellers. 80 else Ptotalwithdef=Ptotal. 57 . nf=pfs. presto]. presto(i.dx dt. Ft_0. end Ptotalwithdef=sortrows(Ptotalwithdef). Ptotalsim=[Ptotalwithdef(1:8. sol=1. pf).Tprop dt.alpha]. if nf~=0 Ptotalwithdef=[Ptotal. Ptotal=[Ps. Source Code (Propkonfsim. %The output vector is being generated here 75 [pfz.m) 1 function [Pout.2.2. SOURCE CODE (PROPKONFSIM.pfs]=size (defProp).M) dt=dtneu.:)=[].dy dt.

90. 22.pfs]=size (pf). -32. %coordinates of the propellers dx=[-42.g. dya=dy. dxa=dx.75.47. 23.53]’. 42.75]’.9. P=[ Tf dx dy]. 20 dy=[-22. 10 if nargin < 2 pf=[]. end [pfz.53.53.75.A. Tfa=Tf. 42. 30 Pa=P.75. 25 n1=8. : [1 4 6] Pout=[]. Ft_0=[]. SOURCE CODE (PROPKONFSIM.90. 35 %Number of propellers which has to be %considerated in calculation n1=n1-nf. e.M) 5 % Start with the lower number.47. -23. 15 nf=pfs. 22.9. -32. sort (pf). 32. -42. Tf=[ 1 2 3 4 5 6 7 8]’.47.47. 32. -23. 23.2. 58 . -22.53.

. (zeros(1.A..1)) (ones(n1. . (-dy)’ (dx)’] (zeros(n2. 50 %Number of restrictions n2=3. B= [(zeros (1.:)=[].^2)+(Ty).Tx). P(pf. 70 alpha=atan2 (Ty.n1)) (ones(1.M) dx(pf)=[]. Tfa(Tf)=[]. Pa(Tf.*Ty. SOURCE CODE (PROPKONFSIM. dxa(Tf)=[]. N=2*n1+n2. [(ones(1.^2). 45 dya(Tf)=[]. Tprop=sqrt(((Tx).:)=[].1)) (-dy). %The Lagrange Multipier is being used here 55 A= [(2*eye (2*n1. 40 dy(pf)=[].2*n1)) [(ones(n1.1)) (dx)]. 60 if det(A)~=0 T=(A^-1)*B.1)) (zeros (n1.2*n1)) Ft_1]’. Ty=(T(n1+1:2*n1)). 65 Tx=(T(1:n1)).. (zeros(n1. 59 ..2.n1)).n2))].n1)) (zeros(1.n1)). Tf(pf)=[]. M=-dy.*Tx+dx..

Ft_0. Ft_0. % Hier wird die Welle nach dem Schema JONSWAP simuliert. Ft_0.Ty=Ty.M=M.P=P. Ft_0. 75 Ft_0.dxa=dxa.dy=dy. Ft_0.20. Ft_0. Ft_0. Wellenhoehe 10 T0=16.B=B. 90 Ft_0. 80 Ft_0.A.M) P=[P Tx Ty Tprop alpha].T=T.Tfa=Tfa. Ft_0.dya=dya.Tx=Tx. 85 Ft_0. % Mittl. Periodenlaenge 60 .Tf=Tf. Hs=7.8. 5 global phaseww. % Modales Spektrum T1=0.3. time=input(1). Source Code Generation of Waves (wave02bs.Tprop=Tprop. Ft_0. end A. Ft_0. phi=input(2).alpha=alpha.P_desc=’P=[Number dx dy ForceX ForceY TotalForce Angle]’.834*T0.3. Ft_0.dx=dx. % Signif. Pout=P.A=A.m) 1 function [wave]=wave02bs (input). SOURCE CODE GENERATION OF WAVES (WAVE02BS. Ft_0.

25 omega=RAO(:.*cos(omega.7 . x6=(pi/180)*(omega).07]’./(sqrt(2)*sigma))).52 .1 ./((omega.07 ..74 .04. sigma = 0. 30 x1=(omega)./((omega.*cos(omega.3 .58 . A.*RAO(:.9. %propdir determines the right rotation direction of the azimut %[direction] propdir ([phiref.2)).3.12 .191.1.3).5 .step)<=1e-5..02.07 .A..4 .. 15 step=round(2*pi/deltaomega).1.*sqrt(2*S.3).*omega*T1-1).^2*deltaomega). .^4)*T1^4)).6 .07 ..42 .22 .4.*time+phaseww wave=[(sum(x1)*cos(phi)) (sum(x2)*sin(phi)) (sum(x6)*sin(2*phi))].1)..*RAO(:. SOURCE CODE PROPDIR.72 .4.^5)*T1^4).26 .*sqrt(2*S.8 .*time+phaseww(:.*RAO(:.2).06 .^2*deltaomega).9 ..*sqrt(2*S.16 .^2.M gamma=3.06 .^2..24/T1)*0. x2=(omega). .m 1 function [direction]=propdir (phi).1)). Y=exp(-((0.*exp(-944. phireal]) %direction = 1 anti-clockwise 5 %direction = -1 clockwise %direction = 0 don’t rotate ps=phi(1).^2. end 20 RAO = [.95 . S=155*Hs^2.^Y.35 .^2*deltaomega).07 + (omega<=5. Source Code propdir..*gamma.*cos(omega. %omega %x %y %phi . deltaomega=0.*time+phaseww(:. if mod(time.^2. 61 . phaseww=2*pi*rand(7.4).

0 keine drehung 20 else if ((pr-ps)<=pi) direction=-1.yd.’red’). end 30 A.m 1 % Controller Optimization.M pr=phi(2).A. 25 end end else direction=0. else direction=-1. %Startvector 62 . end %1=links rum. 10 %$if (ps~=pr) if ((abs(ps-pr))>=10^(-4)) if (ps>pr) 15 if ((ps-pr)<=pi) direction=1. clear rho. In this case PD. SOURCE CODE ITFDISC. hold off 5 plot (td. Source Code itfdisc.5.5. else direction=1. hold on. -1 rechts rum.

[1 -1]}. {1.A. weighting factor %control weighting lambda=0. %%%% %genauigkeit %simulationsendzeit controller has to be known. %Controller Function dC_drho=tf ({[1].M 10 Kp=1.[deltaT 0]}. amplitude=1. SOURCE CODE ITFDISC. [1 0].%search direction gamma=1. Lu=1.01. %display the first n steps 40 solved=0.5. 0 1]. 63 .deltaT). %start kp %start kd deltaT=0. %simparameter 25 accuracy=0. 30 C=tf([Kp+Kd/deltaT -Kd/deltaT]. %%% i=0. Kd=1. 15 %Ri=[1 0.deltaT). Ly=1. %derivative of C 35 dy_drho_i=1/C*dC_drho first=3. weighting factor %frq. 20 %step size %frq. endtime=10.01.

01 75 disp(’solved’).du_drho_i. [1 -1]}. SOURCE CODE ITFDISC. 50 C=tf([Kp+Kd/deltaT -Kd/deltaT].y2.u2. 45 while (solved==0) i=i+1. Kd=rho(2.i). y1.Kd]. end 64 . of C 55 t=[0:accuracy:endtime]’.deltaT).y1. r=amplitude * ones(length(t). ydi=interp1(td. function dC_drho=tf ({[1].A.x2.y2 if max(abs(ytil))<=0.deltaT). [t1. [1 0].’cubic’).fake1.t2. y1i=interp1(t1. t=t1.r.M rho(:. Kp=rho(1. solved=1.u1.t2.x1. r=r1-y1.1).’cubic’).y1.fake2]=sim(’piditfdisc’). {1. 65 [t2.dy_drho_i]=sim(’piditfdisc’). 60 r1 = interp1(t.i).yd.’cubic’).5. %der. %interpolate to same time-base t2 70 %%% % ytil. ytil=y1i-ydi.t1. % contr.[deltaT 0]}.1)=[Kp.

SOURCE CODE ITFDISC.A.y1).M dJ_drho_i=ytil’*dy_drho_i/length(ytil) 80 %Ri=dy_drho_i’*dy_drho_i/length(dy_drho_i)+lambda*du_drho_i’*du_drho_i/length Ri=dy_drho_i’*dy_drho_i/length(dy_drho_i) rho(:.5. first=first-1. max(abs(ytil)) if (first~=0) plot (t1.10)==0) plot (t1. 95 100 65 .y1).i+1)=rho(:. end 90 if (mod(i.i)-gamma*(Ri^-1)*dJ_drho_i’ 85 disp(’max ytil: ’).y1).end end plot (t1.

Matlab Fuzzy Functions Figure B.: Membership function Input xdif f Figure B.B.1.: Membership function Input xdif f ˙ WENN deltaX==negativ WENN deltaX==positiv DANN Fx=negativ DANN Fx=positiv WENN deltaX==positiv nahe AND xpunkt==positiv DANN Fx=negativ 66 .2.

: Membership function zur Bewertung der Ausgangsgr¨ße Fx o Figure B.: Matlab Fuzzy Ruleviewer 67 .WENN deltaX==positiv nahe AND xpunkt==negativ DANN Fx=positiv WENN deltaX==negativ nahe AND xpunkt==positiv DANN Fx=negativ WENN deltaX==negativ nahe AND xpunkt==negativDANN Fx=positiv Figure B.4.3.

http://www.1.0 Standard Automatic Program Generator 5 c Copyright 1998-2003 HP InfoTech s.ro Project : 10 Version : Date Author : 11/1/2005 : Burkhard Sommer Company : Comments: 15 Chip type Program type Clock frequency 20 : ATmega32 : Application : 3.c 1 /********************************************* This program was produced by the CodeWizardAVR V1. Communication C.r.24.ro e-mail:office@hpinfotech.690000 MHz : Small : 0 : 512 Memory model External SRAM size Data Stack size *********************************************/ 25 #include <mega32. Source Code Avr p13.C.hpinfotech.h> 68 .l.

45 #define COMMAND_LENGTH 4 #define INIT 0 #define LISTEN 1 #define RECEIVE 2 #define COMMANDRECEIVED 3 //in bytes 50 #define NOWAITCLOSE 4 #define COMMOK 255 #define COMMNOTOK 0 #define OVERFLOW 1 55 //User defined.C. SOURCE CODE AVR P13.h> #define RXB8 1 #define TXB8 0 30 #define UPE 2 #define OVR 3 #define FE 4 #define UDRE 5 #define RXC 7 35 #define FRAMING_ERROR (1<<FE) #define PARITY_ERROR (1<<UPE) #define DATA_OVERRUN (1<<OVR) #define DATA_REGISTER_EMPTY (1<<UDRE) 40 #define RX_COMPLETE (1<<RXC) //User defined..C #include <delay....1. // USART Receiver buffer #define RX_BUFFER_SIZE 48 69 .

r26 r31 70 . rx_buffer_overflow=1. // This flag is set on USART Receiver buffer overflow bit rx_buffer_overflow.sreg push r26 status=UCSRA. }.rx_counter. 70 #asm push r26 push r27 push r30 push r31 75 in #endasm r26.data. 80 if ((status & (FRAMING_ERROR | PARITY_ERROR | DATA_OVERRUN))==0) { rx_buffer[rx_wr_index]=data.1. if (++rx_wr_index == RX_BUFFER_SIZE) rx_wr_index=0. 90 #asm pop out pop r26 sreg. data=UDR. unsigned char rx_wr_index.rx_rd_index.C 60 char rx_buffer[RX_BUFFER_SIZE]. 65 // USART Receiver interrupt service routine #pragma savereginterrupt [USART_RXC] void usart_rx_isr(void) //***LOW-LEVEL Kommunikation*** { char status. SOURCE CODE AVR P13. }. if (++rx_counter == RX_BUFFER_SIZE) 85 { rx_counter=0.C.

C. #asm("sei") return data. 110 if (++rx_rd_index == RX_BUFFER_SIZE) rx_rd_index=0. data=rx_buffer[rx_rd_index]. 115 } #pragma used#endif 120 // Standard Input/Output functions #include <stdio. SOURCE CODE AVR P13. #asm("cli") --rx_counter.h> 125 // Declare your global variables here int timeroverflow. while (rx_counter==0).C pop 95 r30 r27 r26 pop pop #endasm } #pragma savereg+ 100 #ifndef _DEBUG_TERMINAL_IO_ // Get a character from the USART Receiver buffer #define _ALTERNATE_GETCHAR_ #pragma used+ 105 char getchar(void) { char data.1. 71 .

bytecounter. SOURCE CODE AVR P13. } Comm. int command[COMMAND_LENGTH]. int commandreceived.output. } 140 typedef struct{ int state.C 130 // Timer 0 overflow interrupt service routine interrupt [TIM0_OVF] void timer0_ovf_isr(void) { // Place your code here 135 //****F¨r TIMOUT seriell**** u 8 Bit timer timeroverflow=1. //printf("TIMEOUT"). //Timer running CLK/1024 72 . comm->commandreceived=0. 150 void Init_Comm(Comm *comm){ comm->state=LISTEN. comm->bytecounter=0.1. 145 int input.C. } 155 //8bit 160 void CommTimerStart(){ TCCR0=0x05.

175 void processcmd(Comm *comm){ 180 int i.1. if (comm->state==COMMANDRECEIVED){ for (i=0. } //8bit //Timer Stopped 170 void Controller(){ delay_ms(50). PORTC=~(PORTC ^ 0xFE). 165 TCCR0=0x00. dass der u } //Algorithmus nicht dauerhaft unterbrochen wird. //invertiertes XOR. i<=3. i++) { //Was soll mit dem Befehl gemacht werden? //printf("Command: %d \n\r". //if 190 } void main(void) { 195 // Declare your local variables here 73 . SOURCE CODE AVR P13.C. um zu sehen. 185 }. //was auf Null ist. //for comm->state=LISTEN. Nur bit. //Blinken einer LED. soll geaendert werden.comm->command[i]). //Nur ¨bergangsweise.C } void CommTimerReset(){ timeroverflow=0. }. delay_ms(50). PORTC=~(PORTC ^ 0xFE).

200 // Input/Output Ports initialization // Port A initialization // Func0=In Func1=In Func2=In Func3=In Func4=In Func5=In Func6=In Func7=In // State0=T State1=T State2=T State3=T State4=T State5=T State6=T State7=T 205 PORTA=0x00. DDRB=0x00. DDRD=0x00. Init_Comm(&comm).1.C. DDRA=0x00. // Port B initialization // Func0=In Func1=In Func2=In Func3=In Func4=In Func5=In Func6=In Func7=In 210 // State0=T State1=T State2=T State3=T State4=T State5=T State6=T State7=T PORTB=0x00. timeroverflow=0. DDRC=0xFF. 225 // Timer/Counter 0 initialization // Clock source: System Clock // Clock value: Timer 0 Stopped // Mode: Normal top=FFh 74 . 220 // Port D initialization // Func0=In Func1=In Func2=In Func3=In Func4=In Func5=In Func6=In Func7=In // State0=T State1=T State2=T State3=T State4=T State5=T State6=T State7=T PORTD=0x00. SOURCE CODE AVR P13. // Port C initialization 215 // Func0=In Func1=In Func2=In Func3=In Func4=In Func5=In Func6=In Func7=In // State0=T State1=T State2=T State3=T State4=T State5=T State6=T State7=T PORTC=0x0F.C Comm comm.

C.604 kHz // Mode: Normal top=FFFFh 240 // OC1A output: Discon.C 230 // OC0 output: Disconnected TCCR0=0x00. // OC1B output: Discon. 250 OCR1AH=0x00. 75 . SOURCE CODE AVR P13. ICR1H=0x00. 235 // Timer/Counter 1 initialization // Clock source: System Clock // Clock value: 3. TCNT1H=0xF8. // Noise Canceler: Off // Input Capture on Falling Edge TCCR1A=0x00. TCNT0=0x00. ICR1L=0x00. TCNT1L=0xFB. OCR1BL=0x00. OCR1AL=0x00. OCR0=0x00. OCR1BH=0x00.1. // // // // Timer stopped Initial Value 245 TCCR1B=0x00. TCCR2=0x00. 255 // Timer/Counter 2 initialization // Clock source: System Clock // Clock value: Timer 2 Stopped 260 // Mode: Normal top=FFh // OC2 output: Disconnected ASSR=0x00.

1. UCSRB=0x98. 76 . //16 bit t1 TIMSK=0x01. 265 OCR2=0x00.C. UCSRC=0x86. No Parity // USART Receiver: On // USART Transmitter: On // USART Mode: Asynchronous 285 // USART Baud rate: 9600 UCSRA=0x00. // Analog Comparator initialization // Analog Comparator: Off // Analog Comparator Input Capture by Timer/Counter 1: Off 295 // Analog Comparator Output: Off ACSR=0x80.C TCNT2=0x00. 275 // Timer(s)/Counter(s) Interrupt(s) initialization //TIMSK=0x04. //8 bit timer overflow TIMER 280 // USART initialization // Communication Parameters: 8 Data. 290 UBRRL=0x0B. MCUCSR=0x00. UBRRH=0x00. // External Interrupt(s) initialization // INT0: Off // INT1: Off 270 // INT2: Off MCUCR=0x00. SFIOR=0x00. 1 Stop. SOURCE CODE AVR P13.

330 comm.bytecounter++. comm.bytecounter]=comm.1. comm.C // Global enable interrupts 300 #asm("sei") 305 while (1) { if (timeroverflow==1) {comm.} 320 break.} 310 if (rx_counter > 0){ //counter //***HIGH-LEVEL Kommunikation*** comm.C. switch (comm.state) { 315 case LISTEN: if (comm. putchar(COMMOK). if (comm.input = getchar(). comm.command[comm.state=LISTEN.bytecounter=0.input. SOURCE CODE AVR P13. case RECEIVE: 325 //printf("Is Received \r\n"). 77 . //ready to receive CommTimerStart().state=COMMANDRECEIVED.bytecounter==COMMAND_LENGTH) { putchar(COMMOK). //printf("Switching to RECEIVE STATE\r\n").state=RECEIVE.input==COMMOK) {comm. CommTimerReset().

} break. //Empfangenen Befehl verarbeiten Controller().C CommTimerReset(). //printf("Received: %d . SOURCE CODE AVR P13. 350 //Blinken einer LED... //um Byteempfang anzuzeigen }//counter 355 processcmd(&comm).C. PORTC=~(PORTC ^ 0xFD).\n\r".comm. //switch PORTC=~(PORTC ^ 0xFD). 340 }. 335 case COMMANDRECEIVED: putchar(COMMNOTOK).1. //Regelalgorithmus fortsetzen 360 } 78 . //not ready to receive new command break. }. 345 delay_ms(1).input).

Timer stopped: CS02 = CS00 = 0. 69 Mhz. 7 0 6 0 5 0 4 0 3 0 2 0/1 1 0 0 0/1 TCCR0 FOC0 WGM00 COM01 COM00 WGM01 CS02 CS01 CS00 The bits 7-3 in TCCR0 control the PWM functionality. I use the following configuration: 7 0 6 0 5 0 4 0 3 0 2 0 1 0 0 1 p ·2n clkIO TIMSK OCIE2 TOIE2 TICIE1 OCIE1A OCIE1B TOIE1 OCIE0 TOIE0 Timer/Counter0. Overflow Interrupt Enable TOIE1: Enable 8-Bit Timer 0 Overflow Interrupt (Global Interrupts have to be enabled. With a clock speed of 3. 8 Bit and a prescaler of 1024 it will take almost 70ms. All the other Timer Interrupts are disabled. Mode: Asyn. p=prescaler. only the bits CS02 and CS00 are used.2. Assuming a transfer rate of 19200 Baud it is theoretically possible to transfer 168 Byte within this time window. 8N1. too).C. Prescaler 1024: CS02 = CS00 = 1. Timer enabled. For further information see the ATmega manual. 7 UCSRA RXC 0 6 TXC 0 5 UDRE 0 4 FE 0 3 DOR 0 2 UPE 0 1 0 0 0 U2X MPCM UCSRA: Bit 7 – RXC: USART Receive Complete Bit 6 – TXC: USART Transmit Complete 79 . Since I just use its timer features. CONFIGURATION OF DER REGISTERS: C. the Timer while generate 2n ticks passing from the beginning to the end. Configuration of der Registers: Serial Communication with Timeout Interrupt: Using an n Bit Timer. Interrupt at timer overflow of Timer 0. Rate: 19200. internal clock. I want to achieve the following settings: USART: Receive and Transmit: On.2. This will take tc = seconds.

UCPOL=0 since Async Mode is used.2.69 Mhz and 19200 Baud is has to be set to 0x000B. ATmega 64: Bit 7=0! No Parity (UPM1=UPM0=0). UCSZ1=1 and UCSZ0=1). RX8B and TX8B: Have to be 1 when operating with serial frames of nine data bits. CONFIGURATION OF DER REGISTERS: Bit 5 – UDRE: USART Data Register Empty Bit 4 – FE: Frame Error Bit 3 – DOR: Data OverRun Bit 2 – PE: Parity Error Bit 1 – U2X: Double the USART Transmission Speed Bit 0 – MPCM: Multi-processor Communication Mode 7 UCSRB RXCIE 1 6 TXCIE 0 5 0 4 1 3 1 2 0 1 0 0 0 UDRIE RXEN TXEN UCSZ2 RXB8 TXB8 UCSRB: RXCIE: RX Complete Interrupt Enable=1. At 3. 8 Data Bit (UCSZ2=0 in UCSRB. TXEN: Transmitter Enable=1. UBRR: The register UBRR determines the Transfer Rate: Refer to the manual for details. 1 Stop Bit (USBS=0).C. 80 . UDRIE: USART Data Register Empty Interrupt Enable=0. RXEN: Receiver Enable=1. TXCIE: TX Complete Interrupt Enable=0. 7 UCSRC URSEL/1/0 6 UMSEL 0 5 UPM1 0 4 UPM0 0 3 USBS 0 2 1 1 1 0 0 UCSZ1 UCSZ0 UCPOL UCSRC: ATmega 32: Bit 7=1. UCSZ2: Character Size (See UCSRC). This case: 0.

2.C. CONFIGURATION OF DER REGISTERS: 7 UBRRH UBRRL – 0 0 6 – 0 0 5 – 0 0 4 – 0 0 3 0 UBRR3 1 2 0 UBRR2 0 1 0 1 0 0 1 UBRR11 UBRR10 UBRR9 UBRR8 UBRR1 UBRR0 UBRR7 UBRR6 UBRR5 UBRR4 81 .

. . . . . . 4. . . Systemantwort nach Optimierung (Startwert: Kp = 1. .3. . . . . . . Platform . . . . . . . . . 5. . Simulink Complete System . . . . . . . . . . . . . . . 2. . . . . .4. . . . . Angle velocity φ . . . . . . . . . . . . . . . 5 7 9 11 12 13 13 14 14 21 22 23 24 27 28 29 30 31 37 39 82 . . .4. . . . . . . . . . . . . . . .2. . . . . . . . . . . . .1. . . . .4. . . . . . . . . . . . . Response of Surge x . 4. . . . ˙ 2. . . . . . 5. . . Model of the platform 1:40 . . . . 5. . . . . . . . . . . . . . . . . . . . . . . . .5. . . . .3. .7. . . . . . . . . . . . . . . . . . . . . . Velocity x . . . Velocity y . . . Response of Sway y . . . . . . . . . .2. . . . . . . . . . 2. . . . . . . . . . Blockschaltbild des ITF-Systems . . . . 4. . . . . . . . . . Usual controlling system . . . . . . . . . . . . 2. . . . . . . . 2. . . . . . . . . . . . Kd = 0. . . . . . . . Unimodal Spectrum . . .1. . . .1.2. . . . . . . . . . . . . . . . .6. . . . . . . . . 4. . 3. . . . . . . . . . . . . . . . Platform. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. . . . . 5 Schritte . . . . . . . . . . . . . . . . . . . . .2. . . . . . . . . . . . . 3. . . . . . . . . .3. 2. . . . 3. . . . . . . . . . . . . . . . .1. . . . . . . . . . . . . P T2 -System . . . . . . . . coordinates and positions of the propellers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2. System response of a P T1 -System . . . . . 3. . . . . . . . . . . . Delay of angle velocity . . . .8. Ki = 1). . . . . . . . . . . . . . . . . . . . . . . ˙ ˙ 2. . . . . . Response of Surge φ . . . . . . 3D simulation output . . . .List of Figures 1. . . .3. . Resulting force . . . . . . Demanded force . . . . . . . . . . . . .1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . .3. . . . . . . . . Systemantwort P13 auf Einheitsprung ITF . .50. .1. . . . . . . . . . . . . . . .10. . . . . . . . . . . . . . . . Trajectory with old parameters (Position 50. o B. . . . . . . . . .pi) . . . . . . . 6. . . . . .1. . . . . . . . . . . Statemachine of the High-Level Serial Communication . . . . TWI Bus Connection . 5. . System response with coupling delay . . . . . 6.8. . 6 Schritte . . Stimulus . 5. . . . . Membership function Input xdif f ˙ . . . . . . . 5. . . . . . . . . . . . . . . .50. . . . . . 83 . .1. . 6. . . . . . .1. . . . . 5. . . . . . . . . . . 5. . . . . . System response on stimulus . . . . . . . . . . B. Trajectory with new parameters (Position 50. . . . . . . . . . . .List of Figures 5. . . . . .4. . . . . . .7. . . . . . . . Process-Time-Diagram Low-Level Serial Communication . . . . . . . . Ki = 0. . . . . . .5. .9. . . . . . . Membership function zur Bewertung der Ausgangsgr¨ße Fx . . . . . . . . .pi) . . . . .4. . .4. Matlab Optimization Toolbox . . . .6. . . . . . . . . . . . . . . . . Systemantwort nach Optimierung (Startwert: Kp = 0. . . 6. . . . . . . .1). . . 40 41 42 43 44 44 45 45 47 50 51 52 66 66 67 67 B. . . . . . Matlab Fuzzy Ruleviewer . . . . . . . . . . . . . . . Principle System Configuration . . . 5. .3. . . . . . . . . . . . . . . . . . 5. . . . . . . . .2. . . . . . .2. . . . . . . . . . . Membership function Input xdif f B. . . . . . . . . .11. Kd = 0.

MASSIE. Fachbuchverlag Leipzig. COPPE. Introduction to Applied Mathematics.M. Messtechnik II. Vorlesungsumdruck. IRT. Universit¨t Hannover. RJ . Regelungstechnik II. Mechatronik. ”Lagrange Multipliers. Offshore Hydromechanics. Tese de Mestrado. 2000 ´ [2] J.Bibliography [1] HEIMANN/GERTH/POPP. 945-950. 2002 [8] MARIN. 2001 [3] M. Department of Ocean Engineering. Posicionamento Dinˆmico de Plataformas Semi-submers´ a ıveis em Ambiente Multi-direcional. ISBN 0-9614088-0-4 [11] G. Ubungsumdruck. Report No.HAASE. Komponenten . Messeigenschaften dynamischer Systeme.GERTH. Maritime Research Institute Netherlands. 2002 a ¨ [5] W. 2003.Methoden . Universit¨t Hannover.S. ARFKEN.6 in Mathematical Methods for Physicists.W. [10] G. [9] S. JOURNEE / W. Wellesley-Cambridge Press Cambridge. Rio de Janeiro. Programa de Engenharia Naval. FL: Academic Press. Universit¨t Hannover. 1985 84 . Maneuvering and Control of Marine Vehicles.Beispiele. TRIANTAFYLLOU F. 2002 [4] H. pp. GEML. Skript zur Vorlesung.Brasil. Regelungstechnik I. 3rd ed. HOVER. UFRJ.MOTTA.STRANG. IRT.” §17..S. 14493-1-GT. MA 02139 USA. MIT. Fuzzy Logic Toolbox User’s Guide.J. a 2000 [7] THE MATHWORKS INC. 2001 a [6] W. Delft University of Technology. Orlando.GERTH.

ATMEL Mega64 Documentation.Bibliography [12] Z-World and Rabbit Semiconductors.HJALMARSSON. Iterative Feedback Tuning: Theory and Applications. IEEE Control Systems Magazine. August 1998 [14] H. M.GERVERS and O. T. 1998 [15] ATMEL Corporation. 2004 [13] H.pdf. CDC 98. 2004 85 . doc2503. BIRKELAND.LEQUIN. Rabbit Board User Manual . Iterative Feedback Tuning of Linear TimeInvariant MIMO Systems.HJALMARSSON.

Sign up to vote on this title
UsefulNot useful