Adv Syst Sci Appl 2019; 03; 1-10 Published online at http://ijassa.ipu.ru/index.php/ijassa/article/view/753 Test Bench Algorithms for Catamaran Roll Simulation Ivan Lipko* Sevastopol state university, Sevastopol, Russia E-mail: ivanlipko@yandex.ru Received May 28, 2019; Revised August 21, 2019; Published October 1, 2019 Abstract: Creation of catamaran seaworthiness system requires two stages: computer simulation of models and prototyping of software and hardware. To implement second stage we made test bench to perform catamaran roll simulation, computation and collecting experiment data. Possibility of making computations like on real onboard vessel deck is required. Thus test bench consists of a Stewart platform with microcontrollers and computer connected to them. First performs catamaran deck roll and second performs calculations. 3-DOF sensor mounted on movable plate of platform gives us roll and pitch measurements. Using transfer function approximation of Pierson-Moskowitz spectrum and Runge-Kutta 4-order method with constant step size we developed algorithms for sea-wave simulation, roll generation, data filtering and common calculations. We made a set of command-line software based on these algorithms. Utilizing all possibilities of test bench allows us to collect statistics and compare recorded data. Keywords: Stewart platform, catamaran roll, test bench, simulation, motion platform. 1. INTRODUCTION This article is devoted to developing of algorithms for test bench. Test benches are complex devices which consist of several parts and designed to test any electronic devices or software in natural environment. In comparison with numerical simulation researcher has conditions when his theoretical models are not limited by math representation of real world. The industrial scope application of the test bench is the testing of electronic devices for catamarans. Simulation is a one of important steps in developing any electronic devices and systems. At first one performs a numerical simulation. The goal of this step is research of the system, synthesis of controls and algorithms. At second one performs a hardware testing on conditions close to real. The goal of this step is proof of theoretical results. Then engineers carry out onboard experiments. And final is exploitation. The test bench we discuss aims at the simulation of the catamaran roll and to test and to debug onboard measurement systems like on real environmental conditions and collect data to verify theoretical results. It is known that in vessel researching and simulation procedures researches use wave generation pool [6]. In this pool a small prototype of real vessel is swinging in the water. Special wave generator creates waves similar to a real sea. Researcher watches on vessel position, roll angles, etc. This method is very good to research vessel seaworthiness but has several restrictions: difficult to repeat conditions of experiment, require special laboratory with expensive equipment. In our case, we need to reproduce vessel roll as many times as possible in a limited time. Mathematical descriptions of the real sea disturbances and catamaran are considered sufficient. That is why we develop test bench instead of using the special pool. Usually the necessary algorithms for the bench include methods to prepare, to conduct experiments and to collect the results. Preparation of experiment includes a generation of theoretical path of events which must be registered. Conduction and collection include a control of all actions executed by test bench, registration and saving of a data. In our case there *Corresponding author: ivanlipko@yandex.ru mailto:ivanlipko@yandex.ru 2 I. LIPKO Copyright ©2019 ASSA Adv. in Systems Science and Appl. (2019) are respectively: trajectory generation of catamaran roll, filtering the data, collecting data to files. The test bench consists of the Stewart platform with bottom fixed part and top mobile part which corresponds to vessel deck and PC-based operator workspace and microcontrollers. There are known several examples of Stewart platform [15] usage to simulate roll of vessels and sea-offshore construction under sea disturbances [13]. Some of them use two merged platforms to simulate sea-waves (bottom platform) and vessel deck (top platform) [9]. The same situation is in the other fields: automobile [1, 8, 14], aircraft and helicopters [16], where simulators are used to train machine operators or to test devices. To move mobile part of the platform most of them use linear actuators such as hydraulic, electro-mechanic or pneumatic. These actuators have many advantages, but very expensive. In contrast to them we use rotated step motors which less expensive. We have several conceptual requirements for test bench and operator workspace: 1. Simple intuitive inputs and outputs. There are many situations when one requires interpreting results according to reality: real vessel has horizontal velocity, vessel hull is influenced by wind and sea waves which have an angle to vessel direction, wind velocity, etc. Therefore appropriate mathematical models of catamaran and external disturbances are required. 2. Repeat experiment as many times as one needs. Ideal actions sequence is a loop: set input, run experiment, collect, show and explore data, export data to other applications. E.g. we developed several predictive algorithms [2, 3, 12] which must be tested on the real applications. Repeating of experiments allows us to verify the quality of the algorithms. 3. Test bench must support mounting of any available microelectronic or other sensors. Due to these requirements the key development points are: 1. Compute trajectory of catamaran roll on a microcontroller or a PC. So we use linear models when it possible. 2. Reproduce catamaran roll trajectory by Stewart platform. 3. Collect angle and velocity data from sensors mounted on mobile part of platform. Using these measurements estimate full state vector and produce special-task computations (e.g. stability, overpitch probability, seaworthiness, etc.). The paper is organized as follow. Test bench based on the Stewart platform is briefly described in Section 2, where block diagram of its construction is discussed. The mathematical models of simulated catamaran, sea-wave disturbances and state observation are presented in Section 3. Results of simulation and experimental study are given in Section 4. Concluding remarks and the future work intentions are presented in the last section. 2. CONSTRUCTION This section will describe a bench construction and its function diagram. Test bench (Fig. 2.1) is designed for debugging of predictive algorithms of catamaran roll based on Large Deviation Theory. Physically it consists of Stewart platform and PC connected to microcontroller which drives motors (Fig. 2.2). At the same time there are two logical parts which allow to reproduce catamaran roll and to collect and to process data from the sensors. The first part is the Stewart platform that reproduces the movement of the ship deck disturbed by sea wave. The bottom part of platform is fixed and top part is movable. This version of Stewart platform uses rotated step motors and legs connecting bottom and top parts of the platform (details in [4]). Ball joints in the sole of the legs are a weakness of this construction because it leads to small rattling in motion. Noise is not visible by eyes but noticeable by sensor. To reduce this noise we use ballast weight on top surface. Motivation of use it is cheap cost and availability, simple control. The pitching trajectories are generated on the computer and converted into data for the microcontroller which controls platform motors. TEST BENCH ALGORITHMS FOR CATAMARAN ROLL SIMULATION 3 Copyright ©2019 ASSA Adv. in Systems Science and Appl. (2019) Fig. 2.1.Test bench The second part (blocks “Sensor”, “Filter and Estimate”, “General computations”) is a prototype of device for reading the roll data and calculating probability estimates. Roll data (roll angle and velocity, pitch angle and velocity) are taken by a sensor mounted on the movable surface of platform and transmitted to the computer where calculations are made and displayed on the screen: current state of the vessel, estimates of the probability of large deviations. The blocks described above are modules of developed programs and perform certain tasks. All programs (unless otherwise written) are written in C++ in the Qt Creator and executed under the console environment. Console usage is convenient for creating a test bench user interface application. Block “Roll Generation”. The pitching trajectory generator is program designed to create trajectories of the catamaran that the platform will reproduce. The program started using command line parameters or a special configuration file. The parameters include initial state of the catamaran, seed-number for the random number generator, service flags. As a result the program creates a CSV-file containing in each line the time countdown and the current catamaran state: angle and velocity of roll, level of heave, angle and velocity of pitch. To generate trajectories we use 4-order Runge-Kutta integration method with a discrete step. The system of differential equations describing the catamaran under the influence of wind-wave disturbances discussed in Section 3.2. Block “Motor Calculation”. This block solves inverse kinematics problem and translates roll trajectory motion to the motors control signals of the Stewart platform. CSV file with trajectory from previous block is an input of the program (written in C#). Output of this block is CSV file with lines which contain the angles of platform motors. A special program implements the execution of platform movements [4]. Block “Filter and estimate”. This block performs data reading and restoring the state of catamaran. 3DOF-sensor (MPU6050) and microcontroller NUCLEO-F401RE are used for reading angles and their velocities. The values of the observable state vector are passed to the input of the filter and recovery module. Filtration and estimation of the full state vector is performed in accordance with the Section 3.3. The restored full state vector is saved to a file and passed into next block. 4 I. LIPKO Copyright ©2019 ASSA Adv. in Systems Science and Appl. (2019) Fig. 2.2. Block diagram Block “General Computations”. This block implements the predictive algorithms which necessary for other research. Input of the block is full state estimates The resulting vector is a task-special data displayed and saved to a file. 3. ALGORITHMS This section describes the mathematical model of the simulated catamaran and its control system aimed to reduce the amplitude of the roll and the angle of the roll; the mathematical description of the wind-wave disturbances acting on the catamaran, used in the generation of the trajectory of the catamaran and the estimation of state vector. 3.1. Catamaran model The catamaran is a vessel with two identical symmetrical hulls connected by a deck [11]. To reduce pitching of the boat it have T-foil and thruster flaps, which create a forces (𝐹𝑇 and 𝐹𝐹 respectively) and moments (𝑀𝑇 and 𝑀𝐹, respectively). The main dimensions of the catamaran are presented in Table 3.1, block diagram on Fig 3.1. Table 3.1 The catamaran dimensions Name Value Length, m 90 Width, m 25.96 Draught, m 2.6 Displacement, t 734.54 In general there is a relationship between all types of ship pitching in the motion model [7]. In this case we are interested in roll, pitch angles and heave of the catamaran. The space-state equations for the catamaran will be as follows: { �̇� = 𝐴𝑥 + 𝐵(𝑢 + 𝑤) 𝑦 = 𝐶𝑥 , (3) Stewart Platform Roll Generation Motors Sea State Path Computer Sensor Motor Calculation Motor Angles Filter and Estimate General Computations Roll, Pitch State vector Results TEST BENCH ALGORITHMS FOR CATAMARAN ROLL SIMULATION 5 Copyright ©2019 ASSA Adv. in Systems Science and Appl. (2019) Fig. 3.1.Catamaran controller and signals where 𝑥 = [η̇, ζ̇, η, ζ, θ̇, θ] is state vector including heave velocity, pitch velocity, heave, pitch, roll velocity, roll; 𝑢 = [ 𝐹𝑇 + 𝐹𝐹 𝑀𝑇 + 𝑀𝐹 ] is control vector including forces and moments of actuators; 𝑤 = [ 𝐹𝑤 𝑀𝑤 ] is wind-wave disturbances including forces and moments acting on vessel hull; state and input matrices are: A = [ −0.9073 −25.1097 −14.1503 −17.4945 0.001 0 0.0514 −0.503 0.2442 −12.4 0.001 0 1 0 0 0 0 0 0 1 0 0 0 0 0.001 0.001 −0.01 −0.01 −5 −15 0 0 0 0 1 0 ] , 𝐵 = [ 0.0082 0.0000083 −0.00016 0.000017 0 0 0 0 0.002 0.0000083 0 0 ] , and output matrix is 𝐶 = [ 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 ]. For simulation and path generation matrix 𝐶 is identity matrix, but in real situation measuring a heave is very difficult task. We have actuators that will be controlled by feedback controller. In this article we use LQ- regulator which will reduce pitching amplitudes. So matrices 𝐴, 𝐵, 𝐶 are suitable to make controller with feedback matrix 𝐾 = [ 59.3026 26.6427 18336.7 2006.9 −1807.6 −2950.1 −1.2133 2.5576 14.2237 −2.8566 2.1435 93.5241 ] and control 𝑢 = −𝐾𝑥. As a result we have a closed-loop system { �̇� = (𝐴 − 𝐵𝐾)𝑥 + 𝐵𝑤 𝑦 = 𝐶𝑥 . (4) Equation (4) is integrated via 4-order Runge-Kutta method with constant step size 0.01. Wind-wave disturbances 𝑤 is input of the system. Sea-Wind Forces and Moments Controller Catamaran Actuators T-foil signal Flaps signal x Moments Forces Forces Moments 6 I. LIPKO Copyright ©2019 ASSA Adv. in Systems Science and Appl. (2019) 3.2. Wave-wind disturbances To describe sea-wind disturbances we use Pierson-Moskowitz spectrum in common form 𝑆(ω) = 8.1 ∙ 10−39.82 ∙ ω−5 ∙ exp (−0.74 ∙ 0.92 ∙ ω−4). Above numbers and parameters corresponds to sea state with 2.14 m significant wave height and 10 m/s wind velocity [5]. Pitching of the catamaran arises as a result of the external forces and moments actions created by sea waves. The simulation of these forces and moments is obtained by using two transfer functions (see Fig. 3.2). Transfer functions are the linear approximations of the corresponding nonlinear relations (e.g. spectrum in Fig. 3.3). First, white noise is applied to the input of the Pierson-Moskowitz spectrum linear approximation block and then to the block of linear approximation of forces and moments. Pierson-Moskowitz spectrum linearized by 2-order transfer function [5] has form 𝐻𝑃𝑀(𝑠) = 𝐾ω𝑠 𝑠2+2λω0𝑠+ω0 2, where𝐾𝜔 = 2λω0σ is amplifier constant, σ2 = max 0<ω<∞ 𝑆(ω) is wave disturbance intensity constant, σ is damping factor, ω0 is dominating wave frequency. Damping factor 𝜎 is calculated using nonlinear least square method. Fig. 3.2.Sea-wind forces and moments generation Fig. 3.3. Pierson-Moskowitz (PM) spectrum (dashed) and linear approximation (solid) Block “Linear approximation of Forces and Moments” approximates “wave to force” function by constant 𝐾𝑓. It is tuned so that the amplitude of roll catamaran satisfies sea state statistics [5]. Resulting signal is an input 𝑤 to system (4). 3.3. State estimation In this section we describe in short about filtering the data from sensor. To do this we use Kalman filter which performs data filtering and estimation of full state vector. Remind that from sensor we receive only roll, pitch and their velocities and we also need to know heave and heave velocity. Linear approximation of Spectrum White noise Linear approximation of Forces and Moments Sea state, spectrum Wave amplitude Forces, Moments P o w er , ra d /s Frequency, rad/s TEST BENCH ALGORITHMS FOR CATAMARAN ROLL SIMULATION 7 Copyright ©2019 ASSA Adv. in Systems Science and Appl. (2019) To programming filter we need to discretize object system (4) and made discrete version of Kalman filter so called “delayed estimator” [10]. Delayed estimator is very simple to programming, but it is enough to get sufficient quality: �̂�𝑛+1,𝑛 = (𝐴𝑒 − 𝐿𝑒𝐶𝑒)�̂�𝑛,𝑛+1 + [𝐵𝑒 − 𝐿𝑒𝐷𝑒 𝐿𝑒] ∙ [𝑂4,1 𝑦𝑟𝑎𝑤]𝑇, [ �̂�𝑛,𝑛−1 �̂�𝑛,𝑛−1 ] = [ 𝐶𝑒 𝐼6 ] �̂�𝑛,𝑛−1 + [ 𝐷𝑒 𝑂10,4 𝑂6,4 𝑂6,4 ] ∙ [𝑂4,1 𝑦𝑟𝑎𝑤]𝑇, where�̂�𝑛,𝑛−1 is catamaran state estimate, �̂�𝑛,𝑛−1 is catamaran output estimate, 𝑦𝑟𝑎𝑤 is raw sensor data vector. Matrices 𝐴𝑒, 𝐵𝑒, 𝐿𝑒, 𝐷𝑒 are the following: 𝐴𝑒 = [ 0.8770 −0.0091 −0.0762 −0.0119 0.0053 0.0244 −1.0854 −0.0195 −0.7805 −0.1685 −0.0077 0.4085 0.0067 0.0975 0.5590 0.0360 −0.0055 0.0040 −0.1307 −0.7889 −5.9193 −0.0658 −0.0661 −0.0626 0.0004 −0.0007 0.0075 0.0013 0.9390 0.0930 0.0013 0.0231 0.0866 0.0200 −1.1861 0.8465] , 𝐵𝑒 = [ 0.0597 0.0857 0.0001 0.0003 −0.0674 0.5716 0.0026 0.0359 −0.0077 −0.0980 −0.0004 −0.0067 0.1209 0.7826 0.0026 0.0231 −0.0004 0.0007 0.0001 0.0003 −0.0013 −0.0229 −0.0002 0.0004] , 𝐶𝑒 = [ [ 𝐼2 02,4 02,4 𝐼2 ] 𝐼6 ], 𝐷𝑒 = 𝑂10,4, 𝐿𝑒 = [ 0.0597 0.0857 0.0001 0.0003 −0.0674 0.5716 0.0026 0.0359 −0.0077 −0.0980 −0.0004 −0.0067 0.1209 0.7826 0.0026 0.0231 −0.0004 0.0007 0.0001 0.0003 −0.0013 −0.0229 −0.0002 0.0004] . Matrices above include 𝐼𝑛 that is identity matrix with size n x n; 𝑂𝑛,𝑚 is zero matrix with n rows and m columns; and computed via Kalman filter synthesis procedure with parameters 𝑄 = 𝐸(𝑤𝑤𝑇) = 𝐼2 ∙ 107, 𝑅 = 𝐸(ζζ𝑇) = 𝐼4 ∙ 10−1, 𝑁 = 𝐸(𝑤ζ𝑇) = 𝑂2,4, where ζ is measurement noise. 4. RESULTS, EXPERIMENTS In this section we show several examples of test bench experiments. To make sure in quality of results we perform experiments in range of input parameters. Here some of them. All test bench experiments are configured for better compare and interpretation via natural parameters: wind velocity, relative bearing, initial state vector of catamaran and seed-number. Fig. 4.1 and Fig. 4.2 show examples where test bench filter outputs are compared with numeric simulation results. Raw data from sensors were scaled and filtered. The test bench reproduces catamaran roll with satisfactory quality for our applications. The initial state vector of catamaran is equal to zero in next examples. 8 I. LIPKO Copyright ©2019 ASSA Adv. in Systems Science and Appl. (2019) Fig. 4.1.Errors in catamaran roll (top) and pitch (bottom) between simulated and experimental angles corresponding to a) wind 13.45 m/s, seed-number 11622; b) wind 13.23 m/s, seed-number 5; c) wind 12.96 m/s, seed-number 25 a) b) c) Fig. 4.2.Test bench and Runge-Kutta outputs a) wind 13.45 m/s, seed-number 11622; b) wind 13.23 m/s, seed-number 5; c) wind 12.96 m/s, seed-number 25 TEST BENCH ALGORITHMS FOR CATAMARAN ROLL SIMULATION 9 Copyright ©2019 ASSA Adv. in Systems Science and Appl. (2019) Experiment data in Fig. 4.1 and 4.2 have some rattling and noise influenced by ball joints in the sole of the legs connecting the bottom and the top parts of platform. Paths from these figures can be associated via indices “a”, “b”, “c”. 5. CONCLUSION The algorithms for reproducing a catamaran roll on test bench are developed. For better interpretation of results inputs of algorithms have nature-like parameters: wind velocity, direction, catamaran initial state and other. Mathematical models of algorithms include the catamaran and sea-wave disturbances. Full state of catamaran is estimated by Kalman filter. To improve estimating one should use another filter, e.g. extended Kalman filter The test bench for reproducing a catamaran roll includes the Stewart platform, sensors, microcontrollers and PC. The top part of the platform moves like a catamaran deck and results of experiments are collected by sensors. Thus, it turns out to reproduce the same oscillations of the catamaran and to debug device prototypes that will be installed on the real vessel. Software for test bench has been developed based on these algorithms. It helps to create the trajectories of the catamaran deck roll, to filter data obtained from the sensors, and to estimate the full state vector of the catamaran. These developments can also be used in any other similar area where it is necessary to accurately reproduce the specified motion of the object, for example, any other vessels, submarines or aircraft. ACKNOWLEDGEMENTS Studies were supported by the Ministry of Science and Higher Education of Russian Federation (project RFMEFI57817X0259) Mechanic and electro-mechanic components were assembled by Osadchenko A.E. and Lazarev V.B. We would also like to show our gratitude to the reviewer for his useful insights and for comments on an earlier version of the manuscript. REFERENCES 1. Andrievsky, B. et al. (2014). Control of pneumatically actuated 6-DOF Stewart platform for driving simulator, 2014 19th International Conference on Methods and Models in Automation and Robotics (MMAR), Miedzyzdroje, 663-668, DOI: 10.1109/MMAR.2014.6957433. 2. Dubovik, S. A. & Kabanov, A. A. (2017). Quasipotentials in synthesis of control systems based on knowledge. Proceedings of International Conference on Industrial Engineering, Applications and Manufacturing (ICIEAM), St. Petersburg, 1-4. DOI: 10.1109/ICIEAM.2017.8076123. 3. Dubovik, S. A. & Kabanov, A. A. (2019). Funkcional'no ustojchivye sistemy upravleniya: asimptoticheskie metody sinteza [Functionally stable control systems: asymptotic methods of synthesis].Moscow, INFRA-M, [In Russian]. DOI: 10.12737/monography_5b446a985cf9a5.11626044. 4. Dubovik, S. A., Kabanov, A. A. & Lipko, I.U. (2017). Sistema kontrolya krena sudna na baze analiza bolshih ukloneniy [Control system of vessel roll, based on large deviations analysis]. Перспективные системы и задачи управления, South federal university, Rostov- on-Don, 196-209, [In Russian]. 5. Fossen, T. I. (2011). Handbook of marine craft hydrodynamics and motion control. Jhon Wiley & Sons, ISBN 978-1-119-99149-6. 10 I. LIPKO Copyright ©2019 ASSA Adv. in Systems Science and Appl. (2019) 6. Hassani, V., Alterskjær, S. A., Fathi, D., Selvik, O. & Sæther, L. O. (2014). Experimental results on motion regulation in high speed marine vessels, 22nd Mediterranean Conference on Control and Automation, Palermo, 487-492, DOI: 10.1109/MED.2014.6961420. 7. Kramar, V. (2018). The Construction Principle and System Architecture of the Automatic Hold System of an Unmanned Vessel. 2018 International Multi-Conference on Industrial Engineering and Modern Technologies (FarEastCon), Vladivostok, 1-4, DOI: 10.1109/FarEastCon.2018.8602791. 8. Krasnov, E. I., Mikhaylov V. V., Sergeev, S. L. & Stuchenkov, A. B. (2015). Development of a motion system for a training simulator based on Stewart platform, International Conference "Stability and Control Processes" in Memory of V.I. Zubov (SCP), St. Petersburg, 99-101, DOI: 10.1109/SCP.2015.7342074. 9. Lebrón, R., Valente, V., Sobczyk, M. & Perondi, E. (2016). Control of an Electrohydraulic Stewart Platform Manipulator as Vessels Motion Simulator, 9th FPNI Ph.D. Symposium on Fluid Power, V001T01A033. DOI: 10.1115/FPNI2016-1553. 10. Lewis, F. L., Xie, L. & Popa, D. (2017). Optimal and Robust Estimation: With an Introduction to Stochastic Control Theory, Second Edition. CRC Press. ISBN: 978- 0849390081. 11. Liang, L., Yuan J. & Zhang, S. (2016). Application of model predictive control technique for wave piercing catamarans ride control system, 2016 IEEE International Conference on Mechatronics and Automation, Harbin, 726-731, DOI: 10.1109/ICMA.2016.7558652. 12. Lipko, I. U. (2018). Forecasting of Catamaran Roll Threshold Exceeding.2018 International Russian Automation Conference (RusAutoCon), 9-16 Sept. 2018, Sochi, Russia, IEEE, ISBN: 978-1-5386-4938-1, DOI: 10.1109/RUSAUTOCON.2018.8501764. 13. Rekdalsbakken, W. (2006). Design and Application of a Motion Platform for a High-Speed Craft Simulator, IEEE International Conference on Mechatronics, Budapest, 38-43.DOI: 10.1109/ICMECH.2006.252493. 14. Shiong, C. Y., Jalil, M. K. A. & Hussein M. (2009). Motion visualization and control of a driving simulator motion platform, 2009 6th International Symposium on Mechatronics and its Applications, Sharjah, 1-5. DOI: 10.1109/ISMA.2009.5164839 15. Stewart, D. (1965-66).A Platform with Six Degrees of Freedom, Proceedings of the Institution of Mechanical Engineers, vol. 180, 371-378. 16. Villacís, C. et al. (2017). Real-time flight simulator construction with a network for training pilots using mechatronics and cyber-physical system approaches, 2017 IEEE International Conference on Power, Control, Signals and Instrumentation Engineering (ICPCSI), Chennai, 238-247, DOI: 10.1109/ICPCSI.2017.8392169.