Mechatronics Optimization Development for Wind Tunnel Tests Master’s thesis in Mechatronics Engineering applied to Aerodynamics Pierfrancesco Oselin DEPARTMENT OF MECHANICS AND MARITIME SCIENCES CHALMERS UNIVERSITY OF TECHNOLOGY Gothenburg, Sweden 2023 www.chalmers.se www.chalmers.se Master’s thesis 2023 Mechatronics Optimization and Development for wind tunnel tests Pierfrancesco Oselin Department of Mechanics and Maritime Sciences Division of Vehicle Engineering and Autonomous Systems Chalmers University of Technology Gothenburg, Sweden 2023 Mechatronics Optimization and Development for wind tunnel tests Pierfrancesco Oselin © Pierfrancesco Oselin, 2023. Supervisor: Guglielmo Minelli, Volvo Cars Examiner: Simone Sebben, Department Master’s Thesis 2023 Department of Mechanics and Maritime Sciences Division of Vehicle Engineering and Autonomous Systems Chalmers University of Technology SE-412 96 Gothenburg Telephone +46 31 772 1000 Cover: Rear diffusers optimized for different side wind conditions, mounted on the Volvo EX90 Typeset in LATEX, template by Kyriaki Antoniadou-Plytaria Printed by Chalmers Reproservice Gothenburg, Sweden 2023 iv Mechatronics Optimization and Development for wind tunnel tests Pierfrancesco Oselin Department of Mechanics and Maritime Sciences Division of Vehicle Engineering and Autonomous Systems Chalmers University of Technology Abstract In the realm of the automotive industry, the development of vehicles entails the fulfillment of numerous requirements such as appealing design, comfort, safety, and efficiency. Notably, in recent years, the significance of efficiency has grown due to mounting environmental concerns regarding internal combustion engine (ICE) vehicles and limitations on the range of battery electric vehicles (BEVs). Of the various engineering aspects, aerodynamics assumes a pivotal role in deter- mining the performance of cars, exerting a substantial influence on vehicle efficiency. To investigate and enhance aerodynamics, automotive companies adopt a combined approach involving both digital and real-world testing. The former is accomplished through the utilization of Computed Fluid Dynamic (CFD) analyses, while the latter entails wind tunnel testing of clay car models. This thesis covers the current approach to the study of aerodynamics, focusing on the issues that characterize the existing workflow, including downtime and inaccu- racies. In response to these challenges, a novel workflow founded on automated mechatronics optimization is introduced and a prototype is tested, thereby show- casing a fresh and more efficient modality of working with clay car models within wind tunnel facilities. The proposed workflow aims to enhance the aerodynamic optimization of vehicles by implementing a scalable, plug-and-play system that expedites the process and yields advanced, efficient designs. This endeavor has brought to remarkable results, such as the development of an innovative diffuser configuration that enhances efficiency during side-wind conditions, as well as a 73.4% reduction in time within the current wind tunnel workflow through the application of automated mechatronics. Keywords: BEV, mechatronics, optimization, wind tunnel tests, clay car. v Acknowledgements Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. PIERFRANCESCO OSELIN, Gothenburg, June 2023 vii List of Acronyms Below is the list of acronyms that have been used throughout this thesis listed in alphabetical order: AC Alternate Current ADAS Advanced Driver Assistance System BEV Battery Electric Vehicle CFD Computed Fluid Dynamic CPS Cyber-Physical System DC Direct Current DNN Deep Neural Network GUI Graphical User Interface ICE Internal Combustion Engine IP Internet Protocol LIMO Loop-In-the-Model Optimization MQTT Message Queuing Telemetry Transport PLC Programmable Logic Controller QoS Quality of Service TCP Transmission Control Protocol ix Contents List of Acronyms ix List of Figures xiii List of Tables xvii 1 Introduction 1 1.1 The importance of aerodynamics . . . . . . . . . . . . . . . . . . . . 2 1.1.1 Vehicle dynamics . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1.2 Advantages and disadvantages of computational fluid dynamics 7 1.1.3 Advantages and disadvantages of clay car testing . . . . . . . 8 1.2 Current workflow in the wind tunnel . . . . . . . . . . . . . . . . . . 8 1.3 Mechatronics automation and optimization . . . . . . . . . . . . . . . 10 1.4 Thesis objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.5 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2 Methodology 13 2.1 System architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.1.1 Test rig communication . . . . . . . . . . . . . . . . . . . . . . 14 2.1.2 Communication with the wind tunnel . . . . . . . . . . . . . . 15 2.2 Test rig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.2.1 Control box . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.2.2 Power box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.2.3 Flaps and motors . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.3 Test object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.4 Test facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.5 Optimization software . . . . . . . . . . . . . . . . . . . . . . . . . . 25 2.5.1 Multidimensional control . . . . . . . . . . . . . . . . . . . . . 25 2.5.2 Optimization algorithms . . . . . . . . . . . . . . . . . . . . . 26 2.6 Wind tunnel tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.7 Car efficiency and drag coefficient . . . . . . . . . . . . . . . . . . . . 28 2.7.1 The rule of thumb . . . . . . . . . . . . . . . . . . . . . . . . 28 3 Results 33 3.1 Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 3.1.1 Benchmark functions . . . . . . . . . . . . . . . . . . . . . . . 33 3.1.2 Optimizer comparison . . . . . . . . . . . . . . . . . . . . . . 37 xi Contents 3.1.3 Averaging time in wind tunnel . . . . . . . . . . . . . . . . . . 39 3.1.4 Number of samples . . . . . . . . . . . . . . . . . . . . . . . . 42 3.1.5 The initialization effect . . . . . . . . . . . . . . . . . . . . . . 44 3.1.6 Repeatability . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3.2 Data discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 3.2.1 Validation of the averaging time assumption . . . . . . . . . . 51 3.2.2 Optimization at 0° yaw . . . . . . . . . . . . . . . . . . . . . . 53 3.2.3 Optimization at -5° yaw . . . . . . . . . . . . . . . . . . . . . 59 3.2.4 Optimization at -10° yaw . . . . . . . . . . . . . . . . . . . . . 63 3.2.5 Wind-averaged-drag coefficient . . . . . . . . . . . . . . . . . 67 3.2.6 Pareto front and multi-objective optimization . . . . . . . . . 70 3.3 Economic impact . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 3.3.1 Potential savings on the current workflow . . . . . . . . . . . . 73 3.3.2 Potential savings on advanced optimization . . . . . . . . . . . 74 4 Conclusion 77 Bibliography 79 A Appendix 1 I B Appendix 2 V xii List of Figures 1.1 Forces acting on a two-axle vehicle, according to [1]. . . . . . . . . . . 3 1.2 Rolling resistance and aerodynamic drag of a representative SUV. Rolling resistance coefficient from Equation 1.1 in [1]. Weight of the vehicle chosen to match Figure 2.5 in [2]. The area and drag for the SUV were calculated using the mean area and drag coefficient of the vehicles presented in [3] and [4]. SUV mean CD = 0.358, mean A = 2.626m2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.4 Design workflow to develop the most aerodynamically efficient vehicle. 6 1.3 Example of clay car model. In the picture a Volvo XC40 is shown, located in the Volvo Cars wind tunnel facility. . . . . . . . . . . . . . 7 1.5 Current workflow for wind tunnel tests. Inefficiency and downtime characterize the system. . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.6 Diagram of CPS framework for optimal vehicle design under wind loading. Inspired by the one reported in [5], re-adapted for the specific case. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.7 New proposed workflow for wind tunnel tests. The mechatronics op- timization box represents the LIMO of Figure 1.6. . . . . . . . . . . . 11 2.1 System architecture and data flow for the mechatronics implementation. 14 2.2 System architecture and data flow for the mechatronics implementation. 15 2.3 System architecture and data flow for the mechatronics implementation. 16 2.4 Schematic representation of the components in the test rig. . . . . . . 18 2.5 Plug and play test rig and agents involved. . . . . . . . . . . . . . . . 18 2.6 Control box schematic and its components. . . . . . . . . . . . . . . . 19 2.7 Power box schematic and its components. . . . . . . . . . . . . . . . 21 2.8 CAD model of the flaps and mounting brackets used in this project. . 22 2.9 Different wheel configurations. . . . . . . . . . . . . . . . . . . . . . . 23 2.10 Roof kick added for the second clay car configuration . . . . . . . . . 23 2.11 Clay car mounted on the wind tunnel balance. . . . . . . . . . . . . . 24 2.12 Side view of the flaps mounted on the clay car, showing the sign convention for the flap angles. The horizontal axis is parallel to the ground. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3.1 3D visualization of the considered benchmark functions. Search space is represented by the xy-plane, while the output space is displayed on the z-axis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 xiii List of Figures 3.2 2D visualization of the considered benchmark functions. The function has been color-mapped accordingly to the function values. . . . . . . 36 3.3 Evaluation of the optimization algorithms performances: 250 tests have been run over the benchmark functions, in order to compute relevant statistics. On the x-axis, the algorithm iterations are re- ported while on the y-axis the emulated CD value. . . . . . . . . . . . 37 3.4 Evaluation of the Latin Hypercube performances over 250 tests. The test is the same as Figure 3.3, but a narrower output space is displayed to better appreciate small improvements. . . . . . . . . . . . . . . . . 38 3.5 Focus on the standard deviations obtained during the tests on the Bohachevsky function reported in Figure 3.3. The first two graphs present higher standard deviation, while the Urquhart surrogate model results to be more reliable. . . . . . . . . . . . . . . . . . . . . . . . . 39 3.6 Effect of different confidence interval on optimization algorithms. The Nelder Mead case is illustrated, as easier to observe the true impact the uncertainty induces. . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.7 Maximum allowed sampling budgets versus optimization algorithms performances. The algorithms were tested 20 times for each budget, leading to the computation of mean and standard deviation. . . . . . 43 3.8 Different sampling methods considered for the mechatronics imple- mentation. 100 points have been sampled from a 2-dimensional space. Each dimension is bounded in the range xi ∈ [−5,+5]. . . . . . . . . 44 3.9 Different sampling methods considered for the mechatronics imple- mentation. The points have been sampled from a 2-dimensional space. Neighbourhood was also reported to better visualize possi- ble superimposition. . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3.10 Different sampling methods considered for the mechatronics imple- mentation. The points have been sampled from a 2-dimensional space and the neighbourhood was highlighted to better identify the super- imposition. A) strong superimposition effect and B) strong clustering effect. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3.11 Impact of the initialization effect on the Particle Swarm Optimiza- tion algorithm, tested 250 times. Mean and standard deviation are displayed for each method. . . . . . . . . . . . . . . . . . . . . . . . . 47 3.12 Standard (random) Latin Hypercube sampling (left) with respect to Optimized Latin Hypercube sampling (right). The clustering problem is solved in the optimized version. . . . . . . . . . . . . . . . . . . . . 47 3.13 Visualization of the CD values obtained during the repeatability test, conducted at 140 km/h and by using a 60 s averaging time. The error bars, colored in red in the graph, show the standard deviation associated to the tested point. . . . . . . . . . . . . . . . . . . . . . . 49 3.14 Visualization of the CLR values obtained during the repeatability test. 50 3.15 Performance comparison between the 20 s and the 60 s averaging dur- ing a 4-dimensional optimization at 0◦ yaw. The clay car CD value is displayed. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 xiv List of Figures 3.16 Performance comparison between the 20 s and the 60 s averaging dur- ing a 4-dimensional optimization at −5◦ yaw. The clay car CD value is displayed. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 3.17 Performance comparison between the 20 s and the 60 s averaging dur- ing a 4-dimensional optimization at −10◦ yaw. The clay car CD value is displayed. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 3.18 1-dimensional mechatronics test to optimize the clay car drag coeffi- cient CD at 0◦ yaw and wind speed of 140 km/h. . . . . . . . . . . . . 54 3.19 4-dimensional mechatronics test to optimize the clay car drag co- efficient CD at 0◦ yaw and wind speed of 140 km/h, by using the Urquhart surrogate model. On the left side, CD values obtained from the sampling process are shown along with the evolution of the best value found over time. On the right side, a 2-dimensional hyperspace is shown, to better represent the disposition of the points and their relative distance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 3.20 Performance comparison between the 1-dimensional and the 4-dimensional optimization. Achieved CD values are compared . . . . . . . . . . . . 56 3.21 Visualization of the optimized diffuser shape obtained at 0◦ yaw. On the left side, the outcome from 1-dimensional optimization is illus- trated. On the right side, instead, the 4-dimensional optimization one. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 3.22 Velocity visualization obtained via CFD analyses for the optimized diffusers at 0◦ yaw. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 3.23 Normalized pressure (adimensional pressure coefficient) contour plot obtained from the diffuser optimization at 0◦ yaw. . . . . . . . . . . . 59 3.24 1-dimensional mechatronics test to optimize the clay car drag coeffi- cient CD at −5◦ yaw and wind speed of 140 km/h. . . . . . . . . . . . 60 3.25 4-dimensional mechatronics test to optimize the clay car drag coeffi- cient CD at −5◦ yaw and wind speed of 140 km/h. On the left side, CD values obtained from the sampling process are shown along with the evolution of the best value found over time. On the right side, a 2- dimensional hyperspace is shown, to better represent the disposition of the points and their relative distance. . . . . . . . . . . . . . . . . 60 3.26 Performance comparison between the 1-dimensional and the 4-dimensional optimization conducted at −5◦ yaw. Achieved CD values are compared. 61 3.27 Visualization of the optimized diffuser shape obtained at −5◦ yaw. On the left side, the outcome from 1-dimensional optimization is il- lustrated. On the right side, instead, the 4-dimensional optimization one. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 3.28 Velocity visualization obtained via CFD analyses for the optimized diffusers at −5◦ yaw. . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 3.29 Normalized pressure (adimensional pressure coefficient) contour plot obtained from the diffuser optimization at −5◦ yaw. . . . . . . . . . . 63 3.30 1-dimensional mechatronics test to optimize the clay car drag coeffi- cient CD at −10◦ yaw and wind speed of 140 km/h. . . . . . . . . . . 63 xv List of Figures 3.31 4-dimensional mechatronics test to optimize the clay car drag coeffi- cient CD at −5◦ yaw and wind speed of 140 km/h. On the left side, CD values obtained from the sampling process are shown along with the evolution of the best value found over time. On the right side, a 2- dimensional hyperspace is shown, to better represent the disposition of the points and their relative distance. . . . . . . . . . . . . . . . . 64 3.32 Performance comparison between the 1-dimensional and the 4-dimensional optimization. Achieved CD values are compared. . . . . . . . . . . . . 65 3.33 Visualization of the optimized diffuser shape obtained at −10◦ yaw. On the left side, the outcome from 1-dimensional optimization is il- lustrated. On the right side, instead, the 4-dimensional optimization one. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 3.34 Velocity visualization obtained via CFD analyses for the optimized diffusers at −10◦ yaw. . . . . . . . . . . . . . . . . . . . . . . . . . . 66 3.35 Normalized pressure (adimensional pressure coefficient) contour plot obtained from the diffuser optimization at −10◦ yaw. . . . . . . . . . 67 3.36 Velocity diagram for a car in a crosswind. φ is the wind angle relative to the vehicle axis, ψ yaw angle, UV car speed, UW wind speed and UR resultant velocity. . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 3.37 Visualization of the 4-dimensional optimized diffuser shape at differ- ent yaw values. In the scenario in which an active diffuser is imple- mented in a vehicle, its shape would change accordingly to best face side-wind conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . 70 3.38 CLR values obtained during the CD mono-objective optimization. Samples and evolution over time of the best value found are displayed. The CLR value corresponding to configuration that minimized CD is highlighted as well. The clay car was tested at different yaw val- ues (0◦, −5◦ and −10◦ from left to right) and with a wind speed of 140 km/h. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 3.39 Pareto front built from mono-objective optimization. The test aimed to minimize CD values. The clay car was tested at 0◦ yaw and with wind speed of 140 km/h. . . . . . . . . . . . . . . . . . . . . . . . . . 72 3.40 Pareto front built from multi-objective optimization. The test aimed to minimize both CD and CLR values. The clay car was tested at 0◦ yaw and with wind speed of 140 km/h. . . . . . . . . . . . . . . . . . 73 3.41 System complexity growing exponentially with the number of vari- ables present in the system. In the graph, each variable range was considered the same and equal to 46, as the one for this project. On the y-axis, the number or years required to solve the system are pointed. 75 B.1 Complete schematic of the test rig. . . . . . . . . . . . . . . . . . . . VI xvi List of Tables 2.1 Modbus register types, including memory allocation and possible ranges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.2 Motor specifications according to the manufacturer manual, reported on its website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.3 Motor specifications according to the manufacturer manual, reported on its website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.4 List of considered algorithms and their class description . . . . . . . . 27 2.5 WLTP ratings reported in [6]. Rated = official figures as published by manufacturer. Rated consumption and fuel equivalency figures include charging losses. Vehicle = calculated battery energy con- sumption used by the vehicle for propulsion and on-board systems. . 30 3.1 Benchmark function names and their mathematical definition. . . . . 34 3.2 Estimated confidence interval coming from different averaging times. . 40 3.3 Errors in the minimization processes due to Gaussian distributed noise with zero mean and variable standard deviation values. The scores points out how different confidence intervals affect the quality of the optimization processes. . . . . . . . . . . . . . . . . . . . . . . 42 3.4 Repeatability tests and the obtained CD values. Data has been col- lected at 0◦-yaw with a wind speed of 140 km/h, considering an aver- aging time of 60 s. Mean value and standard deviation for each test are listed. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3.5 Repeatability tests and the obtained CLR values. Data has been col- lected at 0◦-yaw with a wind speed of 140 km/h, considering an aver- aging time of 60 s. Mean value and standard deviation for each test are listed. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 3.6 Confidence intervals associated to the repeatability tests . . . . . . . 50 3.7 Summary of the CD values obtained during the 1-dimensional opti- mization at different yaw angles. . . . . . . . . . . . . . . . . . . . . . 69 3.8 Cycle-averaged-drag coefficients obtained from 1D optimized diffuser solutions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 3.9 Cycle-averaged-drag coefficients obtained from 4D optimized diffuser solutions, assuming variable shape during the motion of the vehicle. . 69 3.10 CD, CLR and CLF corresponding to the optimized diffuser configura- tions, obtained from the 4-dimensional mono-objective minimization. 70 A.1 List of tests run in the wind tunnel, part 1 . . . . . . . . . . . . . . . II xvii List of Tables A.2 List of tests run in the wind tunnel, part 2 . . . . . . . . . . . . . . . III xviii 1 Introduction The automotive industry faces numerous challenges when it comes to the devel- opment and production of cars. From the initial digital concept to the tangible realization of a vehicle, car manufacturers are tasked with finding the optimal bal- ance between various requirements while always striving for exceptional performance and efficiency. Among these requirements, it is possible to find factors such as appealing design, comfort, driving experience, safety, and reliability. However, in recent years, a new imperative has emerged – the need for efficiency, driven by the growing awareness of global warming and the rising costs of traditional fuel sources. As customers expectation demands vehicles that cover more kilometers while min- imizing fuel consumption, automotive manufacturers must incorporate efficiency considerations into their research and development phases. The focus on efficiency is not only driven by economic factors but also by the pressing need to reduce emis- sions and pollution associated with the transportation sector. Furthermore, the advent of battery electric vehicles (BEVs) has introduced a paradigm shift, distin- guishing them from traditional internal combustion engine (ICE) vehicles that rely on fuel combustion for propulsion. Aerodynamics plays a critical role in making modern cars meet the efficiency re- quirements. By comprehensively understanding the principles and effects of aerody- namics, vehicles can be designed with enhanced fuel efficiency, reduced emissions, and aligned with global environmental goals. Moreover, by examining the contrast between BEVs and ICE vehicles, we can iden- tify how aerodynamic considerations play a crucial role in the development of both vehicle types. Modern car manufacturing companies currently cover the aerodynamic study in a hybrid manner: after few iteration in the styling of a vehicle, aerodynamics engineers test the model and its efficiency in a digital environment to simulate its performances and estimate how promising a new car concept could be. This virtual study, defined by the use of Computed Fluid Dynamics (CFD) allows to investigate interesting factors and phenomena, but trade-off in accuracy must be assumed. Because of that, an additional set of physical tests is required in these companies. Pre-production clay car model of the selected concept are tested in wind tunnel facilities to more accurately determine the aerodynamic characteristics of this car. Nevertheless, this second approach comes with downsides: a less flexible setup in terms of model changes and configurations, as well as extended downtime during wind tunnel studies. These directly influence the research and development (R&D) costs and the time needed to develop a new vehicle version, eventually reflecting on 1 1. Introduction the final customer. In this thesis, a new automated workflow for studying the aerodynamics of a vehicle is introduced, with the aim to drastically reduce downtime in wind tunnels. In this work, a prototype that demonstrates a new way of working with clay cars is tested. This paves the way to a new, more efficient and advanced investigation for an improved and better integrated aerodynamics design. 1.1 The importance of aerodynamics As briefly mentioned before, customers focus has been slowly moving, in the recent years, to a new awareness of vehicle consumption and impact on the environment. With classical ICE vehicles, consumption translates into fuel consumption and effi- ciency, namely the maximization of kilometers that can be covered per unit of fuel. This kind of efficiency is often measured in kilometers per liter (km/l). Addition- ally, customers have also begun to take into account the emissions of CO2 and other harmful pollutants, often quantified as grams emitted per kilometer (g/km). In response to the growing environmental concerns, the automotive industry has un- dergone a significant transformation, focusing on the study, development, and sale of battery electric vehicles (BEVs). Given that this technology is still in its develop- mental stages and energy storage remains a prominent challenge, car manufacturers have intensified their efforts to enhance vehicle aerodynamics. The objective is to minimize energy consumption and maximize the driving range of BEVs through the implementation of streamlined designs. Consequently, aerodynamics has assumed a pivotal role in the contemporary re- search and development (R&D) process, as it exerts a profound influence on various performance aspects, including vehicle range, speed, and energy consumption. To facilitate a better comprehension of this concept, a brief explanation of vehicle dy- namics is covered in the following section. 1.1.1 Vehicle dynamics Performances related to a road vehicles refer to the capability of accelerating, break- ing and dealing with grades during a straight-line motion. The main external forces acting a two-axle vehicle, considered as a unique rigid body, are shown in Figure 1.1. 2 1. Introduction 1 2 L L L ma mg a θ Froll,r Fr s Froll,r W r W f Fdrag Ff Figure 1.1: Forces acting on a two-axle vehicle, according to [1]. Fr and Ff correspond to the tractive forces [1] that allow the actual motion. These forces originate from the rotational motion of the wheels, driven by the engine. For a rear-wheel-drive vehicle, Ff = 0, whereas for a front-wheel vehicle, Fr = 0. Fg represents the grade resistance experienced by a vehicle when it is in motion on an inclined surface. This force is inherently dependent on the sine of the angle of inclination, being defined Fg = mg sin θs. Froll, r and Froll, f correspond to the rolling resistances, caused by the surfaces of contact between the ground and the tyres. The force denoted as Fdrag represents the aerodynamic drag force resulting from the movement of the vehicle within the surrounding airflow. This force is directly proportional to the square of the velocity. Its magnitude is significantly influenced by the design of the vehicle, specifically dependent on the exposed surfaces and the aerodynamic flow separation occurring at the rear section of the car. Finally, although not explicitly reported in the diagram, it should be noted the pres- ence of two significant forces: lift force (Flift) and downforce (Fdown). These forces arise due to the vehicle’s horizontal movement, where it assumes a role similar to that of an airfoil within the airflow. It is important to highlight that while the dis- parity between these latest two forces does not directly affect the vehicle’s efficiency, it greatly influences its stability, particularly when operating at high speeds. Considering the longitudinal axis in Figure 1.1, it is possible to design the equation of motion, here reported in Equation 1.1 mẍ = Ft, r + Ff, f − Froll, r − Froll, f − Fdrag + Fg (1.1) By introducing the concept of inertial force Fi = mẍ and by summing all the rolling resistance contributions in one term Froll, the equation above can be rewritten as Ft = Froll + Fdrag + Fg + Fi (1.2) with Ft total tractive effort. 3 1. Introduction From Equation 1.2, however, it is not immediate to understand the correlation between traction force and efficiency. By recalling the definition of energy E = ∫ F (t) v(t)δt (1.3) is is possible to estimate what is the total energy required to a vehicle for guaran- teeing a specific motion. Naturally, the less energy is used for assessing the exact same movement, the more efficient. For this reason, Equation 1.3 can be interpreted as energy consumption from a vehicle perspective Econsump = ∫ Ftot vvehicle δt The definition of energy, written is such manner, is simple to decode. vvehicle is a function of time and, unless ADAS or fully-autonomous driving are implemented, it entirely depends on the driver and cannot be optimized. By assuming this state- ment, it is immediate that energy consumption minimization comes only with the minimization of Ftot, and thus its factors. As mentioned before, Fi depends on the vehicle inertia and, unless a car manufac- turer company starts making lighter-weight vehicles, it is hard to reduce its contri- bution. Fg, instead, depends on the plane inclination and its contribution depends on the surrounding topography and environment. It is of course a parameter that cannot be controlled and additionally, for pure horizontal motions, its magnitude goes to zero. The only remaining factors that might be reduced for achieving efficiency are the rolling resistance Froll and the drag force Fdrag. In the automotive industry, they are indeed the most studied agents and dedicated departments focus on minimizing them. The definition of rolling resistance is reported in Equation 1.4 Froll = −fRmg (1.4) with g gravitational acceleration, m vehicle mass and fR rolling coefficient. In particular, the latter may change with the steering, as it is a function of slip angle and lateral adherence coefficients and, based on experimental data, it was demonstrated to change with the vehicle longitudinal velocity. In [1], an empirical formula was proposed to define the rolling coefficient, based on radial-ply passenger car tires data, reported here as Equation 1.5. fR = 0.0136 + 0.40 × 10−7 V 2 (1.5) with V vehicle speed, in km/h. Since it depends of the tire inflating pressure and the type of ground surface, to reduce it, a tire optimization should be conducted, but this is not the focus of this thesis. Additionally, the rolling resistance does mainly affect the vehicle dynamics at low speed, while at high velocities the aerodynamic drag becomes the main resistance force, as illustrated in Figure 1.2. 4 1. Introduction 0 20 40 60 80 100 120 140 Vehicle Speed [km/h] 0 200 400 600 800 1000 1200 F or ce [N ] Comparison between rolling resistance and drag resistance at different vehicle speed Rolling resistance Drag resistance Total resistance Figure 1.2: Rolling resistance and aerodynamic drag of a representative SUV. Rolling resistance coefficient from Equation 1.1 in [1]. Weight of the vehicle chosen to match Figure 2.5 in [2]. The area and drag for the SUV were calculated using the mean area and drag coefficient of the vehicles presented in [3] and [4]. SUV mean CD = 0.358, mean A = 2.626m2. On the other hand, the definition of aerodynamic drag is reported in Equation 1.6 Fdrag = 1 2 ρCD Av 2 (1.6) with ρ representing the density of the fluid the car is located in, CD its drag co- efficient, A the cross sectional area and v the relative speed of the vehicle to the fluid. Particularly, CD is a dimensionless quantity used to represent the overall resistance of an object. It summarizes the contribution of skin friction and form drag. The former is mainly related to the viscosity of the fluid and represents the friction of fluid particles on the surface of the considered body, whilst the latter is related to the shape of the body interacting with the flow and it is mainly determined by the wake separation of the flow. Since the second one plays a major role in cars and clay bodies, the only factor that aerodynamic engineers can tune is the shape of the vehicle, to eventually reduce the overall CD and thus increase efficiency. The work in [7] supports what just stated, reporting that the aerodynamic drag accounts for more than a quarter of the tractions energy required, based on the World Light Vehicle Test (WLTP) test cycle. Aerodynamics, however, does not only affect efficiency and stability, but a set of different system parameter as well. As an example, a good aerodynamic study covers the cooling for battery, transmissions and brakes, the exterior durability and contamination in terms of visibility and splashes behaviour. 5 1. Introduction It is then fundamental to deeply understand and study the aerodynamics of a vehicle, to increase the quality of the product and to raise its technical specifications. In such manner, automotive companies car release more competitive products and widen their customer segment, as well as increasing their trust. As briefly introduced at the beginning of the chapter, car manufacturers nowadays study the aerodynamics of new vehicles via a 2-step approach. Initially, the design department proposes a digital twin of what could be a good version of the car under development. The defined CAD model is then tested and analyzed via CFD, to better understand what is its aerodynamics and come up with aero solutions. A sequence of redesign iterations occurs, according to the feedback that aerodynamic engineers provide to designers and new versions of the model are tested as a result. Once a stable design version is reached, a full-scale clay car model is built and tested in the wind tunnel facility, to collect more accurate data about drag and lift coefficients, as well as other crucial parameters. A clay car model, shown in Figure 1.3, is a full-or-scaled copy of a vehicle whose aim is to allow realistic aerodynamic tests without building a complete vehicle. Starting from a foam core, layers of clay are applied sequentially, to provide a surface that can be easily carved but able to maintain the given design. Initially done by hand, nowadays clay car carving is applied by multi-axis milling machines. After an initial roughing phase, during which most of the material is removed, a sequence of increasing precision machining follows. Additionally, clay car models include metallic and plastic components, such as steering mechanism, hoods, side mirrors, as well as a fully-functional suspension systems, to better mimic the real vehicle properties. The clay car testing represents an important step in the workflow since it allows to test different scenarios, namely different wind speed and yaw angle combinations, in a short period of time. Finally, the tests provide additional feedback allowing to continue the iteration pro- cess. Figure 1.4 provides a visual illustration of what has just been explained. Virtual test Selected design version Feedback for new design New design iterations Step 1 Step 2 Figure 1.4: Design workflow to develop the most aerodynamically efficient vehicle. Nevertheless, some downsides affect it directly, impacting on the research and de- velopment costs. First of all, CFD and clay car analyses are not perfect methods and present some 6 1. Introduction Figure 1.3: Example of clay car model. In the picture a Volvo XC40 is shown, located in the Volvo Cars wind tunnel facility. constraints. The joint usage of the methods might lead to a series of trial-and-error tests whose outcomes do not bring any insightful information nor improvement in the vehicle aerodynamic performances. Moreover, the system as structured is highly complex and fast decisions cannot be undertaken. From the first digital version to the first wind tunnel test, several months could pass, slowing down the improvement rate and developing time. The need of a faster and better workflow then arises, to more effectively develop new vehicles and reduce costs. In the following sections, a better explanation of the downsides associated to CFD analysis and clay car testing are discussed, to make the reader aware of why a new development workflow is needed. 1.1.2 Advantages and disadvantages of computational fluid dynamics CFD is a computational technique used to analyze and solve fluid flow problems, enabling engineers to study and visualize complex phenomena and wake behaviours. CFD exploits numerical analysis to solve the equations that govern the dynamics of the fluid, such as the conservation of mass, conservation of linear momentum and conservation of energy that describe the motion of the fluid over time. Discretization methods then play a crucial role in CFD, allowing the continuous governing equations of fluid dynamics to be approximated and numerically solved in a finite time. Even though it is a powerful tool that allows a strong and effective analysis, it 7 1. Introduction presents some downsides that limit its application in the automotive industry. To test one scenario, meaning a unique combination of wind speed and yaw angle, from 10 to 30 hours of cluster-computation are needed, slowing down the overall analysis and investigation. Consequently, to store all the information coming from few test analyses, an important memory allocation size, in the order of terabytes, is needed. Moreover, to solve the complete dynamic in finite times, CFD tools rely on physics and numerical approximations that allow to get a more or less accurate idea of the interaction of the vehicle with the flow field. However, these approximations do not allow companies to issue official certifications of their vehicles, and even internal benchmark are considered approximated compared to a real test. Furthermore, as stated in [8], CFD is mainly used for estimating the aerodynamic performance of a specific configuration and does not guarantee the identification of optimal designs. For these reasons, additional studies and tests in the wind tunnel are necessary, to provide true results by directly measuring forces on a full-or-scaled vehicle model. 1.1.3 Advantages and disadvantages of clay car testing As just introduced, clay car tests in the wind tunnel become necessary to provide true, reliable results when high accuracy must be achieved. Additionally, a strong advantage in exploiting these tests is that different configuration of the vehicle can be tested in few hours, overcoming the bottleneck caused by the long computation times of the CFD analysis. One notable benefit of utilizing wind tunnel experiments resides in the precision with which the wheel-induced flow contributions can be assessed. As evidenced in the literature, CFD analyses prevent a comprehensive investigation of these effects, relying on the utilization of simplifications and approximations that compromise the accuracy of findings. Wind tunnel studies, as tools for testing the aerodynamics of a vehicle, are very ac- curate, even though open road conditions cannot be studied. As Figure 1.4 showed, they are exploited along with CFD analysis to come up with performing designs that minimize aerodynamic drag and enhance vehicle efficiency. Downsides start rising when modifications on the vehicle designs must be introduced and then tested, as there is no automatic way for achieving this task. Consequently, aerodynamic engineers have to physically enter the facility to manually change the clay car shape, interrupting the workflow and increasing downtime, thus costs. A better discussion of those is provided in Section 1.2. 1.2 Current workflow in the wind tunnel By referring again to Figure 1.4, it is possible to observe that the wind tunnel is involved only in the second stage of the workflow. Specifically, it is used once an already good and efficient design is achieved and wind tunnel data is requested. The design is thus tested along with slightly different versions of it, such as the ones characterized by different diffuser angles, wheel deflector shapes and sizes, or the presence of additional spoilers. 8 1. Introduction The continuous testing and verification of somewhat modified configurations is used for fine tuning the correct, but approximated outcome that the CFD analysis pro- duced. In particular, this iteration process cannot be assessed via digital analysis [8] since improvements in drag coefficient or lift forces might be suppressed by nu- merical approximation of the software. It comes then necessary to manually test out the small but significant improvements introduced by design upgrades. Even though wind tunnel tests can successfully satisfy this need by providing real and accurate results, the physical process comes with downsides. It has been told in the previous sections that wind tunnel tests allow to try several vehicle configurations in a limited amount of time, definitely smaller than the one taken by the CFD analysis. Nevertheless, short amount of time does not imply efficiency. Aerodynamics engineers have to manually apply modifications and ad- justments to the clay car model: to assess that, the fan that generates the wind must be started and stopped as in a swinging process. Additionally, extra waiting time for reaching the wind nominal speed is needed as well. Figure 1.5 visually illustrates what has just been explained. New design suggestions Wind tunnel tests Figure 1.5: Current workflow for wind tunnel tests. Inefficiency and downtime characterize the system. While dealing with complex systems such as wind tunnel facilities, efficiency matters. Downtime, namely a period of time during which no value is created for the company, represents only a cost for the industries and the missing value does not justify the energy consumption and the employed staff. A detailed discussion of that can be found in Section 3.3. Moreover, the continuous testing of new car configurations represents the so called trial and error approach. Once data is started to be collected, engineers try to mod- ify the vehicle design according to their previous experience, seeking more optimal configurations. Nevertheless, a car design is different from others and the introduc- tion of components such as deflectors, diffuser or spoilers, might result beneficial for some models and generate the opposite behaviour in others. This workflow, then, leads to additional inefficiencies as it is based on attempts that might turn worthless for some cases. The last critical point in the existing aerodynamic study is due to the precision in 9 1. Introduction applying the new changes during the wind tunnel tests. Since the adjustments are manually performed, poor accuracy is introduced in the workflow. Human errors, as well as low sensitivity in the design variations might lead to inconclusive results that would have actually been interesting to investigate. It is then obvious the strong need of improving the aerodynamic optimization workflow to faster release better products on the market. The idea of introducing an advanced design optimization based on aerodynamic performances comes from the papers [5] and [8], in which the authors tried to aero- dynamically optimize the shape of buildings via cyber-physical systems (CPS). In the specific case, real scaled models of buildings were jointly used with servo-motors to adaptly change edges and create efficient designs. Because the model is under- going physical change as it approaches the optimal solution, this approach is given the name loop-in-the-model optimization (LIMO) [5]. The strength of this innova- tive method lies in the ability by CPSs to link the real world with the cyber world, leveraging the capabilities of computers to monitor and control physical attributes. Additionally, LIMO approaches guarantee high flexibility, since they can be built around any optimization algorithm, by replacing the evaluation of a numerical model with physical testing. For simplicity, the loop-in-the-model optimization will be referred in this work as mechatronics optimization. An illustration of how it works is reported in Figure 1.6. Experimental Numerical Mechatronics optimization Wind tunnel sensors Parameters New candidate solution Figure 1.6: Diagram of CPS framework for optimal vehicle design under wind loading. Inspired by the one reported in [5], re-adapted for the specific case. 1.3 Mechatronics automation and optimization A similar implementation of what just discussed was realized by Urquhart in [9]. In the paper, the author optimized the angles of small trailing edge flaps on a base cavity of a full-scale sports utility vehicle placed in a wind tunnel. The work led to high performance results but it was focused more on the optimization of the vehicle design. This thesis differentiates from [9] by implementing a smooth and seamless work- flow that optimizes car designs by automating wind tunnel tests and introducing advanced clay car models. The focus, then, does not only cover the design or the optimization part, but aims to create a new way to interact with the wind tunnel 10 1. Introduction facility and realize a so-called efficient plug-and-play system to reduce downtime. The schematic of the new workflow proposed in this thesis is shown in Figure 1.7, in which the Mechatronics optimization box summarizes the CPS framework illustrated in Figure 1.6. As it possible to observe, the new proposed procedure is simpler than the one reported in Figure 1.5 and, as mentioned in Section 1.2, completely automated. In section 1.4 the system design requirements for the mechatronic system are intro- duce while the illustration of the implementation will be covered in Chapter 2. Optimized design Figure 1.7: New proposed workflow for wind tunnel tests. The mechatronics optimization box represents the LIMO of Figure 1.6. 1.4 Thesis objectives After the introduced knowledge about how a vehicle is developed from an aerody- namic perspective, it is clear the need of developing a new, automated workflow that relies on optimization algorithms to detect potential efficient and innovative designs. This research, however, is not only carried out for improving the literature and better understand the strong impact that optimized configurations might have in terms of range and energy consumption. The additional goal is to provide a new, flexible way for Volvo Cars Corporation, the sponsor of this project, to interact with its wind tunnel facility and fasten the aerodynamic study of its incoming vehicles to eventually realize better products. To assess this standard, in agreement with the company, some system design re- quirements have been chosen, to create a seamless workflow that could interact with the already existing technology, as well as be ready for supporting more complex mechatronics-actuated vehicles. • The system must be scalable, it must support from 1 to N moving components (parameters) • The system must be plug-and-play, it must be easy to use even for non- technical experts. Nothing is hardcoded and system values can be updated over time • Introduction of active communication with the wind tunnel facility. Not only data must be read, but information such as yaw angles or wind speed can be commanded for future cross-yaw or varying-wind speed optimizations • The system must be easily upgraded, with the chance of adding new optimiza- tion algorithms even written in different coding languages • The system must be highly tunable, allowing the declaration of sampling bud- gets, specific ranges and dimensions of the search space to investigate 11 1. Introduction • The system must support mono- or multi-objective optimization 1.5 Outline The first part of this thesis, already covered, illustrates the reasons why aerody- namic optimization is such important while developing a vehicle and what are the limitations of the current workflow. Further, the methodology chapter explains the test facility, the test rig and the mechatronic solutions introduced for respecting the system design criteria. After that, a detailed illustration of the gathered data and the successful results obtained follows, paving the way for advanced aerodynamic studies in the future. Finally, some concluding remarks and possible future work is presented. 12 2 Methodology The successful implementation of mechatronics solutions requires the development of a seamless system that facilitates an uninterrupted flow of data between the agents involved. Accomplishing this task poses significant challenges. To address this issue, it is necessary to first gain a deep understanding of how to construct such a system and to identify the key agents involved in data transmission and processing. Once this is achieved, the next step is to construct a test rig and implement the optimization software. This chapter aims to explore the methods and processes used to a seamless mechatronics system that steered and defined by a continuous flow of data. 2.1 System architecture Volvo Cars currently studies the aerodynamics of early prototypes and clay car models as described in Chapter 1, with all the pros and cons already discussed. After carefully analyzing the existing workflow, and considering all the requirements introduced with the system design, three agents have been identified as the major players in the construction of a more advanced mechatronics system. 1. the wind tunnel system 2. the clay car test rig 3. the optimization software To achieve the desired goal, the wind tunnel and the test rig must interact and exchange data with the optimization software. Since the type of data that are sent and received by these two agents is different, there is no need for them to have a direct communication. Thus, the software, running on a dedicated machine called here optimization computer, will act as a server, namely receiving evaluated data points and forwarding new sets of parameter variables. By facing the problem in this way, the system can be schematized as reported in Figure 2.1. 13 2. Methodology Data points W ind tunnel setup Parameters Wind tunnelTest rig Optimization computer Figure 2.1: System architecture and data flow for the mechatronics implementa- tion. To build an effective system, it is crucial to overcome a significant challenge: estab- lishing seamless communication between its various components. Once the system’s structure has been understood, the focus shifts to addressing the complexities of data transmission and processing. Specifically, to enable a smooth and continuous data flow, the following issues must be optimized: 1. Communication with the test rig and the motors 2. Communication with the wind tunnel and its software 3. Realization of a software that can both handle the communications and the optimization Each point will be broken down and analyzed in the following sections. 2.1.1 Test rig communication In this first mechatronics prototype, the motors that govern the flaps are driven by microcontrollers, namely low-power computers on single integrated circuit. Due to this, a lightweight and reliable communication protocol must be adopted for high performances. Moreover, due to the potential intense data traffic and the length of cables, the network on which the system relies could be unstable or affected by high latency. For all these reasons, among the several alternatives, the MQTT protocol was adopted, as it supports all the requirements for supporting this scenario. According to its definition, Message Queuing Telemetry Transport (MQTT) is a lightweight messaging protocol designed for devices with limited computing capa- bilities and for low-bandwidth, high-latency, or unreliable networks. The MQTT protocol follows a publish-subscribe messaging model, where a client publishes a message to a broker with a specific topic, to which other clients subscribe for receiving the message. A broker, on the other hand, is a small computer that acts as a server or gateway. It is responsible for collecting messages from all the publishers and forwarding them to the right subscribers. 14 2. Methodology Additionally, the protocol supports three levels of Quality of Service (QoS), which provide different guarantees of message delivery. The QoS introduces an even higher flexibility, as high-priority messages can be temporary stored on memory while hand- shake procedures are adopted to verify the actual message delivery. In this particular case, the microcontrollers and the optimization software act both as MQTT publishers and MQTT subscribers to correctly exchange data and achieve the desired motion. An additional low-power computer is needed to play the role of the broker. By creating such a system, the test rig is one step closer to the required plug-and-play behavior, as it becomes fully functional without leaning on external devices for handling the message forwarding. To use that, indeed, it is only necessary to join the local network via Ethernet connection and publish the right commands on the correct MQTT topics. An example of this setup can be found in Figure 2.2 while a better explanation of the test rig can be found in Section 2.2. Optimization computer MQTT pub/sub Test rig Figure 2.2: System architecture and data flow for the mechatronics implementa- tion. 2.1.2 Communication with the wind tunnel Establishing a proper communication with the wind tunnel is one of the major chal- lenges faced during the implementation of this project. In the past, other researchers and engineers at Volvo Cars used to read information from the tunnel in heuristic ways. One example is the work by Urquhart [9], where analog voltage signals from the wind tunnel balance were used to get data points. Even though this approach resulted to be effective, uncertainty and errors were introduced, as a cascade of signal conversions and manipulations were performed. Moreover, voltage signals had to be scaled in order to create a correlation between their magnitudes and the measured CD values. Additionally, with that approach time-averaged values of CD, CLR, CLF , offered by the wind tunnel software could not be retrieved, as digitally computed and not physically available. Due to the need of finding better solutions to interact with the existing system, alternative approaches were considered. After few months of discussions and tests, an optimal and reliable answer was found in the Modbus-TCP/IP protocol. Modbus is a simple and widely used industrial communication protocol that is used to send data between industrial devices. When TCP/IP protocol is used as transport layer instead of a standard serial communication, the protocol is referred to as Modbus-TCP/IP. Its advantage is to allow devices to connect over Ethernet, making it easier to communicate over longer distances. 15 2. Methodology In more detail, the communication and exchange of information occur only via Trans- mission Control Protocol (TCP), as it can handle and prevent possible data loss. Recalling its theory, the protocol is connection oriented, meaning that a connection must be established before sending actual data. In this method, one device listens to connection requests (passive open) from other devices. The former are known as server whilst the latter as clients. Acknowledged that, existing constraints in the wind tunnel software made it behave only as TCP client, therefore the optimization computer, unconstrained and more flexible, had to assume the role of TCP server. Data request and interpretation is instead delegated to the Modbus protocol. Al- most in an opposite way, this standard works with the master-slave approach: a good explanation of how it works is provided by Schneider Electric [10] and here summarized • Only 1 master is connected to the network at a time. • Only the master can initiate communication and send requests to the slaves. • The master can address each slave individually using its specific address or all slaves simultaneously using address 0. • The slaves can only send replies to the master. • The slaves cannot initiate communication, either to the master or to other slaves. The wind tunnel software already exploits a Modbus-TCP/IP communication to gather information from different devices, such as pressure and humidity sensors. Due to their slave nature, the main software plays the role of the master, querying requests to update data only if needed. Nevertheless, since only one master can run at a time on a specific network, to run the mechatronics, and at the same time being able to interact with the sensors, the optimization computer needs to behave as a slave. This new system and its setup is well summarized in Figure 2.3. Optimization computer TCP server, Modbus slave Wind tunnel TCP client, Modbus Master Data flow Sensors Modbus slave Data flo w Figure 2.3: System architecture and data flow for the mechatronics implementa- tion. A clever solution would hence be to make the new computer act as a PLC device 16 2. Methodology on the network, to mimic the other sensors behavior and work along with them. To successfully achieve this, a portion of the optimization machine memory must be dedicated to Modbus registers. Modbus registers allow data to flow continuously upon master requests. They can be divided in four categories, listed in Table 2.1. Data Type Access Mode Size Address Range Coil Read-write 1 bit 00001 – 09999 Discrete input Read-only 1 bit 10001 – 19999 Input register Read-only 16 bits 30001 – 39999 Holding register Read-write 16 bits 40001 – 49999 Table 2.1: Modbus register types, including memory allocation and possible ranges. Even though each register type has its own purpose, it is frequent to find all I/O mapped to holding registers only. To ease the workflow, this implementation allo- cates all the data to holding registries as well. 2.2 Test rig A early prototype of the test rig was already developed by Koncept Center, the Volvo Cars department responsible for creating, among the rest, mechatronics proofs of concepts. This version consisted of two wide flaps mounted on a bench, to demon- strate the system capabilities and the range of motion that could be achieved. After this stage, the prototype has been disassembled to build the final version, structured as following • Flaps and motors mounted on a clay car • Power box • Control box • Connection cables The name of these components suggests their role in the rig system: the power box is responsible for providing power to the entire rig, the control box for handling the signals, the flap motors for assessing the physical motion and the connection cables for allowing data to flow through the system. A representation of the whole setup can be seen in Figure 2.4. Each of these parts will be better discussed in dedicated sections. To make the system more flexible and portable, the control and power boxes were mounted on a standing rack 1.5 meters high. The rig has been created with the idea to have a flexible and modular system. Therefore a plug-and-play system is an excellent solution that allows future development, modularity and flexibility. Having this in mind, a complete setup is sketched in Figure 2.5. To use the system, then, it is sufficient to plug in one cable to the clay car and another one in the optimization computer. The setup, eventually, will look similar to the one represented in Figure 2.5. 17 2. Methodology Data Clay car with moving flaps Control box Control signals Power Power box Figure 2.4: Schematic representation of the components in the test rig. Plug and play
 ethernet connection Plug and play
 serial connection Figure 2.5: Plug and play test rig and agents involved. 2.2.1 Control box The control box, as the name suggests, is responsible for controlling the motors mounted on the clay car and handle feedback signals. It essentially includes all the electronics that manage the test rig. With the current design, a control box contains the following components • Raspberry Pi • Fuse box • Network switch • 4 motor controllers • 4 microcontrollers Each element plays a fundamental role to make the system work. The Raspberry Pi runs Linux and behaves as a server. Accordingly to MQTT terminology it plays the role of the broker, being responsible to forward the MQTT messages to the subscribed devices. Without it, no communication could be handled. The fuse box is a set of fuses that prevents any possible shortage of the system. The network switch allows the communication among the broker, the microcon- trollers and the optimization software via Ethernet communication. In this imple- mentation it is of type unmanaged, meaning that it is not responsible for assigning IP addresses to the connected devices. Therefore, it is important to correctly set the right addresses, hard-coding the value of the microcontrollers. Moreover, it is fundamental to be sure that all the devices share the same subnet mask. In the control box, 4 different microcontrollers can be found. As briefly mentioned in the previous section, a microcontroller is responsible for moving one flap , meaning that this box implementation can support up to 4 different spoilers. In this case, ESP32-POE-ISO by Olimex were used even though less powerful chips could have 18 2. Methodology been exploited. These controllers, in particular, have enough I/O ports to correctly drive two identical motors. Consequently, wide and heavy flaps can be governed as well by using two synchronized actuators. Claiming that the microcontrollers drive the motors is a generalization. In reality, motor signals and power are provided by the motor controllers. As a result, for each microcontroller a motor controller is coupled. Its output, in terms of voltage signals, will follow the microcontroller one, adding enough power to allow the motion. The schematic representing the connections among the aforementioned components is reported in Figure 2.6. P o rt 1 P o rt 2 P o rt 3 P o rt 4 P o w e r in Figure 2.6: Control box schematic and its components. To implement the so-desired scalability, namely the possibility to increase the num- ber of controlled components with limited effort, the control boxes were designed accordingly. Multiple identical copies can, potentially, work along, allowing the correct management of 4N wings. However, according to the MQTT rules, only one broker is necessary to receive, forward and broadcast the signals onto the network. For this reason, only one box will contain the Linux server. 19 2. Methodology 2.2.2 Power box The power box is responsible for powering up the test rig and making all the elec- tronics run. Since the control box runs with two different voltage circuits, different converters can be found inside it. In particular, the control box requires a 5V circuit for the microcontrollers, the Rasp- berry Pi and the network switch, and a 24V circuit to power the motor controllers and therefore the motors. Because of that, two different types of power converters can be found in the box. The power box therefore presents multiple high-voltage converters to support the system scalability. With this design one power box can provide power up to 3 different control boxes. The limited amount of supported devices is due to space constraints for the internal components and the maximum nominal power that it can provide, set to 1200W . If more than 3 control boxes were used, an additional power box is needed, following the 3-to-1 ratio. The components inside the box are • Earth fault protection • AC/DC converter for low-voltage circuit • AC/DC converter for high-voltage circuit (control box 1) • AC/DC converter for high-voltage circuit (control box 2) • AC/DC converter for high-voltage circuit (control box 3) The earth fault protection is intended to protect equipment when an insulation fault occurs, for instance a direct contact between a life conductor and earth. In such a situation, great fault currents will flow back to the transformer through its neutral point when connected to earth. The AC/DC converter for low-voltage circuit converts the standard 230V of the power grid to 5V, being able to provide the needed volts to run the microcontroller, the network switch and the Raspberry Pi. The AC/DC converter for high-voltage circuit converts the standard 230V of the power grid to 24V, in order to correctly run the motors and their controllers. In Figure 2.7 the power box schematic is reported. Eventually, the complete schematic of the test rig is reported as Appendix 2 at the end of the document. 2.2.3 Flaps and motors Briefly introduced in the sections before, the test rig includes 4 individual and identical flaps, mounted in the rear part of the car. Each flap is controlled by a motor, which movement is driven by the control box. On top of each motor rod, a 3D- printed plastic cap is mounted while a switch button is attached on top of each stator. In this way, with the rod approaching its end stop, the switch is triggered via physical contact with the cap and a stop signal is sent to the respective microcontroller. By doing so, failures or physical damages to the system are prevented and safer tests can be run, even in case values out of the allowed range of motion are sent. The motors used for the mechatronic prototype are DINGS’ MOTION 14N2215AA4250SMSN, chosen for their reliability and precision. Since they are stepmotors, no particular controllers are needed to drive them, thus avoiding the 20 2. Methodology 5 V p ort P ort 1 P ort 2 P ort 3 P ow er in Figure 2.7: Power box schematic and its components. implementation of PID or alternatives to make them reach the desired positions. Table 2.2 reports a more accurate description of the motor specifications, according to the manufacturer website. Category Code Meaning Motors Size 14 35mm Linear Actuator Type N Non-Captive Linear Actuator Step angle 2 2 Phase with 1.8° Motor length/Stack 2 Double Stack Rated current/Phase 15 15A Lead Screw Code AA Code AA Number of Lead Wires 4 4 Flying Leads Lead Screw Length / Stroke 250 250mm Lead Screw Surface Treatment S Standard [No Teflon Coating] End Machining M Metric Nut Style S Standard Flange Nut [External Linear Actuator] Encoder Option N None Customer Sequence Number - - Table 2.2: Motor specifications according to the manufacturer manual, reported on its website The switch buttons are attached on the motors via metallic mountain brackets. They are handmade and irregularities can be found. In particular, one of those 21 2. Methodology showed strong differences from the others, reducing the actual flap range of motion by 2 degrees. To solve this issue and guarantee the same performances for each flap, the motors range of motion was limited via software, from −10◦ to +13◦. Additionally, due to the trigonometric calculations to convert the rod rotations to flap degrees, a sensitivity of 0.5◦ was achieved. This directly leads each flap to assume 46 possible configurations. Figure 2.8 shows the CAD model of the flaps and their mounting brackets to be easily installed on the clay car vehicle. Figure 2.8: CAD model of the flaps and mounting brackets used in this project. 2.3 Test object The test object is a full-scale clay car model of the new Volvo EX90 SUV electric vehicle, with the test rig mounted in the rear section of the car. The flaps, thus, play the role of a small rear diffuser with variable shape. The clay car model respects the new design guidelines dictated by Volvo, which include a small bump in the front part of the roof. This extra space is used in the latest models for allocating a LiDAR sensor to achieve Advanced Driver Assistance Systems (ADAS) capabilities. The cooling inlets at the front part of the vehicle are closed. Since the final goal of this project is to demonstrate the capabilities that the mechatronics implementation could provide, the analysis is focused on the changes in values (deltas) rather than the actual magnitude. For the tests, two different configurations were tested to verify the reliability of the mechatronics solution, as well as to add variety to the test object. The considered configurations are reported in Table 2.3. 22 2. Methodology Configuration 1 Configuration 2 Car Volvo EX90 Volvo EX90 Tires Scorpion Verde 275/40 R21 Scorpion Verde 275/40 R21 Rims 21" Volvo Inscription 21" Volvo Inscription Front inlets Closed Closed Roof kick No Rear Rim coves No Flatter Cover 20" Table 2.3: Motor specifications according to the manufacturer manual, reported on its website In Figure 2.9 and Figure 2.10 it is possible to observe the modification applied to the vehicle to switch from Configuration 1 to Configuration 2, as reported in Table 2.3. (a) 21" Volvo Inscription rims (b) 20" wheel cover Figure 2.9: Different wheel configurations. Figure 2.10: Roof kick added for the second clay car configuration Eventually the majority of the tests have been run using the second car configuration, as the more insightful information is the achieved deltas rather than the comparison between different car models. 23 2. Methodology 2.4 Test facility The wind tunnel experiments were conducted at the Volvo Cars Aerodynamic Wind Tunnel (PVT), which has the capacity to reach speeds of up to 250 km/h. For this particular research, tests were carried out at a speed of 140 km/h, resulting in a Reynolds number of Re√ A = 4.2 · 106 based on the square root of the frontal area of the vehicle A as characteristic length in the definition. The tunnel is a closed return type with slotted walls, featuring a test section of 27 m2, resulting in a blockage ratio of around 10% for a full-scale model. The ground simulation features a five-belt moving ground system mounted with distributed suction and scoop boundary layer control. Each belt has tangential blowers behind it that increase the appearance of the belts’ length. To enable the model to yaw, the vehicle is mounted on a turntable. In the study that is being given, only negative yaw angles are used according to the SAE standard J1594 [11], which means that when viewing the vehicle from the rear, the wind moves from left to right. Four struts, which fixate the vehicle’s position and height, are used to attach the vehicle to a six-component balance. In order to account for blockage effects, the forces and moments are non-dimensionalized to coefficients. Figure 2.11 illustrates the wind tunnel facility and where the car is mounted during the tests. Figure 2.11: Clay car mounted on the wind tunnel balance. The wind tunnel instrumentation allows to achieve a sensitivity of 0.0005 for the drag and lift normalized coefficients, a sensitivity of 0.01 km/h for the wind speed 24 2. Methodology and 0.01◦ for the yaw value. 2.5 Optimization software The optimization software represents the core of the mechatronics project, as it has to handle the communication with both the wind tunnel system and the test rig. The channels and protocols that are used to exchange data among these are explained in Sections 2.1.1 and 2.1.2. In addition to this, several criteria have been taken into account to design and realize the final product. Some of those are here reported. • The software must run on Windows, both 32-bit and 64-bit versions • The software must only work offline, for security reasons • The software must be scalable • The software must be plug-and-play • The software must be easy to use. GUI is preferred • The software must be safe, no risky or dangerous actions can be done • The software must be easy to upgrade, even for non-experts. To respect all the constraints and create a flexible and reliable product, the opti- mization software was developed in C# .NET Framework using Microsoft Visual Studio. This guaranteed the possibility to create a friendly user interface as well as to exploit all the computational power needed for the processes. To realize a scalable system, every 2 seconds the software looks for microcontrollers connected to the network. In this way, flaps can be added or removed smoothly and effortlessly. Once a new device is detected, respective information are queried. Nothing is harcoded, meaning that the software can support from 1 to N different flaps by default. The only and known bottleneck in the system might be the MQTT broker, run on a Raspberry Pi in this implementation. With the increasing number of connected flaps in the system, data flow could be too high to be handled by such tiny computer and more powerful devices should be used. To respect the plug-and-play requirement, the software tries to connect to both the wind tunnel system and the test rig every time it detects a disconnection. This leads the user to only connect the optimization computer to the other devices via Ethernet cables in order to make it work. The optimization software was also designed to be easy to upgrade and to use. One of its major feature is the possibility to run optimization algorithms written in any programming language, such as C++, Python or Julia. Consequently, engineers can write their own code in the language they feel more comfortable with. The algorithms are loaded at runtime, avoiding to hardcode them in the main software. 2.5.1 Multidimensional control Both monodimensional and multidimensional controls can be achieved via software by grouping the desired flaps together (from 1D to (N -1)D), or leaving them move individually (ND). In such a manner, further analysis can be conducted and sym- metric constraints can be introduced to fasten the design exploration. 25 2. Methodology 2.5.2 Optimization algorithms As introduced before, each flaps was limited to a 23◦ range of motion, going from −10◦ to +13◦. The sign convention is reported in Figure 2.12. +θ Figure 2.12: Side view of the flaps mounted on the clay car, showing the sign convention for the flap angles. The horizontal axis is parallel to the ground. Since the test rig , as implemented in the software, is characterized by a sensitivity of 0.5◦, each surface can assume 46 different configurations, leading to 464 ≃ 4.48 · 106 different combinations. Considering the motion time, the stabilization time and the averaging time, the system takes up to 110 s to test a single configuration. It is of course unfeasible to try every combination, indeed the operation would take 4.9 · 108 s, or 15.5 years of uninterrupted tests. Economic and time constraints force to find a smarter solution to solve the problem. An effective answer consists in the introduction of optimization algorithms, which consider the clay car and the test rig as a black-box-function. The function domain becomes the flaps configuration space and the codomain the wind tunnel values, such as drag force coefficient CD, front lift force coefficient CLF or rear lift force coefficient CLR. Other alternatives including deep neural network (DNN) implementations or the introduction of optimal controllers were discarded. The former, indeed, are too dependent from the car geometry, meaning that if a deep neural network such as a multilayer perceptron (MLP) is trained on a car model, it will not suit other designs due to the differences in the geometry. This might not provide the correct configuration that minimizes the targeted value, e.g. the drag coefficient. Moreover DNN methods require large data, namely they need vast datasets to prop- erly train the model. Sampling and gathering data from the wind tunnel is an expensive procedure that must be reduced as much as possible. The optimal con- figuration should then be found with the minimum collection of data points, in the minimum amount of time. Training a neural network is not compliant with these constraints. Introducing advanced methods from the control theory such as LQ control implies 26 2. Methodology solving extremely complex non-linear systems that can be hardly modeled. This might increase the computational times, creating a new bottleneck in the mecha- tronics system that prevents the possibility to find any optimal configuration. For this reason, this approach has also been discarded. Once understood that the optimization algorithms are the best approach to face the problem, several options from the literature have been considered. In particular, the ones taken into account and implemented via software are listed in Table 2.4. Algorithm Family Bayesian Optimization Sequential Model-Based Optimiza- tion (SMBO) Broyden–Fletcher–Goldfarb–Shanno (BFGS) Numerical optimization Latin Hypercube Sampling Statistics Nelder Mead Numerical optimization Particle Swarm Optimization Evolutionary algorithm Response Surface Modeling Statistics Sobol Sampling Statistics Surrogate model Model-based Optimization Table 2.4: List of considered algorithms and their class description The algorithms were intentionally chosen from different background in order to understand which suits the optimal car configuration problem the best. As it will be shown in Chapter 3, some algorithms performed better than others due to the nature of the challenge. In addition to this, statistical sampling methods such as Latin Hypercube Sam- pling and Sobol Sampling were considered for two purposes. The first one is to select points from the search space in order to uniformly cover it and test configu- rations. In several applications, indeed, quasi-random methods perform better than optimization-oriented ones. The second one is used to initialize other algorithms in alternative ways compared to the classical Gaussian distribution. A deeper discus- sion of this can be found in Section 3.1.5. Eventually, a simple sweep approach is also considered to make the test rig behave as a standard rear diffuser, tackling the problem as monodimensional. The sweep consists in a progressive motion from the minimum to the maximum value of the allowed input space. This approach not only brings a 1-D analysis but also economic advantages as better explained in Section 3.3. A final note regards the surrogate model optimization algorithm just introduced. It was taken from [12] and it will be defined in this work as Urquhart Surrogate model, from the principal author of the paper. 2.6 Wind tunnel tests Tests were performed for about 78 hours. The first 12 hours were used to test the communication with the wind tunnel and the test rig, while the remaining hours for 27 2. Methodology gathering data. Different algorithms were tested at different yaw values. For the latter, 0◦, −5◦ and −10◦ were considered. The wind speed was instead kept constant at 140 km/h. For denoting the positive sign of rotation the SAE J1594 [11] was used. Different averaging times for computing the wind tunnel values were also considered: initially a 20 s average was exploited, switching to a 60 s for other tests, as better explained in Section 3.1.3. The complete list of the tests done for this project can be found as Appendix 1 in the dedicated section. 2.7 Car efficiency and drag coefficient The theoretical formulation and meaning of drag coefficient CD has been already introduced in Chapter 1. Through this value, it is possible to estimate the drag forces acting on a car due to longitudinal speed. Even though more complex dynamics occur, such as the contribution of side wind, the coefficient remains a good indicator of a vehicle aerodynamic efficiency. Nevertheless, a more sophisticated relation between efficiency and drag coefficient must be considered, to better understand what possible ∆CD values might lead to in terms of energy consumption and range. Covering the true effect that small changes in CD values lead to vehicle efficiency is a complex study that requires a dedicated investigation, not included in the objective of this work. Nevertheless, a less precise but still reliable reasoning can be done in order to have a general idea of possible advantages the car could benefit. Therefore, the following discussion will be called rule of thumbs as it provides a rough but correct idea of the relation between efficiency and drag. 2.7.1 The rule of thumb As already introduced in Section 1.1, the drag force (from Equation 1.6) can be expressed as following Fdrag = 1 2 ρCD Av 2 with ρ fluid (air) density, A vehicle frontal area and v vehicle longitudinal velocity. In order to overcome this force during the vehicle motion ∆s, a precise amount of energy is required, equal to E = Fdrag ∆s (2.1) with E expressed in Joule J and ∆s in m. Vehicle parameters, however, are usually expressed differently: distances are measured in km and energy in Wh. Particularly, Wh is the standardized way to express the amount of energy stored in BEVs. It is possible then to use those unit measures by introducing a conversion coefficient γ, namely E = γ Fdrag ∆s (2.2) 28 2. Methodology with velocity in Fdrag expressed in km/h. By isolating Fdrag in Equation 2.2, it is possible to obtain γFdrag = E ∆s = [ Wh km ] (2.3) Looking at the unit measure obtained, Wh/km can be seen as the energy consump- tion per kilometer of the vehicle. In other words, it represents the vehicle’s efficiency, since its minimization results to be beneficial for the system. From Equation 2.3 is it possible to observe that by multiplying Fdrag by the conver- sion factor γ, it is easy to switch from a force to energy consumption representation, so that eloss = γFdrag = 1 2 γ ρCD Av 2 (2.4) Equation 2.4 represents the energy consumption per kilometer of a vehicle to over- come the aerodynamic drag. According to the WLTP legislation [13] and [14], the density for dry air is ρ = 1.189 kg/m3 while the conversion coefficient is γ = 0.0214. These values leads Equation 2.4 to the case-specific version eloss = γFdrag = 0.01274CD Av2 (2.5) WLTP legislation provides standard test cycles, called WLTP cycles, used for certi- fication and official car range estimations in European Union. During the test, the speed is made varying over time, scoring an average velocity of v = 82 km/h. Equation 2.5, for such velocity, becomes eloss ≃ 86CD A (2.6) while, if high speed value such as v = 120 km/h is considered, it becomes eloss ≃ 183CD A (2.7) Additionally, WLTP legislation provides information about the claimed and actual energy losses, called vehicle consumption. This value, expressed in Wh/km for elec- tric vehicles, is the result of a complex interaction among weather conditions, vehicle dynamics, driving mode, environment and secondary systems such as infotainment or ADAS. Nevertheless, for this work the vehicle consumption can be generalized to be due to only vehicle resistance. By recalling the mathematical manipulation obtained in Equation 2.3 eloss, tot = γFres A further simplification can be done. The total vehicle resistance Fres, indeed, can be safely broken down in two main factors: rolling resistance Froll and air drag resistance Fdrag Fres = Froll + Fdrag (2.8) 29 2. Methodology leading to the simplified definition of energy losses eloss, tot = γFres = γ (Froll + Fdrag) The WLTP official ratings for the Volvo EX90 are reported in Table 2.5, according to data reported in [6]. Range 585 km CO2 Emissions 0 g/km Rated Consumption 209 Wh/h Rated Fuel Equivalent 2.3 l/100km Vehicle Consumption 183 Wh/km Vehicle Fuel Equivalent 2.1 l/100km Table 2.5: WLTP ratings reported in [6]. Rated = official figures as published by manufacturer. Rated consumption and fuel equivalency figures include charging losses. Vehicle = calculated battery energy consumption used by the vehicle for propulsion and on-board systems. Even if Volvo Cars claimed both rated consumption and rated fuel equivalent values, it is better to consider the values obtained during the WLTP test. Since the mechatronics project does not involve rolling resistance optimization, it is possible to break down the total vehicle consumption in a constant factor, Froll, and a optimizable contribution, Fdrag. In order to evaluate the reduction in energy consumption ∆eloss, tot after a possible optimization, the following reasoning can be done ∆eloss, tot = eloss, tot, new − eloss, tot, old = γ (Froll, new + Fdrag, new) − γ (Froll, old + Fdrag, old) Due to the constant nature of Froll in this project, ∆eloss, tot becomes ∆eloss, tot = γ (Fdrag, new − Fdrag, old) (2.9) and by recalling the definition of Fdrag, Equation 2.9 turns into ∆eloss, tot = 1 2 γ ρ∆CD Av2 (2.10) assuming the front area A and the vehicle speed v constant. Equation 2.10 allows to estimate the potential reduction in energy consumption via minimization of the drag force. For this specific case, recalling Equation 2.6, Equation 2.10 turns into the actual rule of thumb ∆eloss, tot = 86 ∆CD Av2 (2.11) In [6] the usable battery capacity Cbattery is also reported, smaller in magnitude than the nominal one claimed by the company. In particular, a 107 kWh battery capacity was rated. This value allows to convert energy consumption in car range Range = Cbattery eloss, tot = 107 · 103 eloss, tot 30 2. Methodology By considering the non-optimized vehicle consumption, a total range of about 585 km can be achieved. If the energy losses can be even more minimized via the mecha- tronics approach, higher values could be obtained. In Chapter 3 considerations about possible efficiency and range improvements will be covered. 31 2. Methodology 32 3 Results In this chapter, all data resulting from this work are gathered and analyzed. The main objective is to quantify the benefit of an automated mechatronic solution when incorporated into traditional wind tunnel tests. Results are compared in terms of costs savings and performances. This chapter is divided into two main sections. First, a validation study is con- ducted. Optimization algorithms, averaging time and minimum number of samples are discussed. Next, the core of the work is presented, and the advantages that an automated mechatronic system can bring to traditional wind tunnel experiments is discussed in details. 3.1 Validation As just mentioned, here below a series of choices that have been made during the realization and the startup of this project are presented. 3.1.1 Benchmark functions One of the first analysis to be conducted has been the benchmarking and ranking of the developed optimization algorithms. This was done due to the need of maximizing the quality of the obtainable results from the test days, by using the most effective strategies and techniques. Few benchmark functions, reported in Table 3.1, were introduced. The targeted algorithms were evaluated on those, by assessing different behavioural tests. In particular, only 2D functions were considered, to be able to visualize them and easily judge the quality of the results. 33 3. Results Function Definition Stybliski-Tang 2D 1 2 2∑ i=1 ( x4 i − 16x2 i + 5xi ) Rastrigin 2D 20 + 2∑ i=1 [ x2 i − 10 cos(2π xi) ] Rosenbrock 2D 100 ( x2 − x2 1 )2 + (x1 − 1)2 Beale 2D (1.5 − x1 + x1 x2)2 + ( 2.25 − x1 + x1x2 2 )2 + ( 2.625 − x1 + x1 x 3 2 )2 Sphere 2D 2∑ i=1 x2 i Perm d, β 2D 2∑ i=1  2∑ j=1 ( ji + β ) (xj j )i − 1 2 Goldstein-Price 2D [ 1 + (x1 + x2 + 1)2 ×( 19 − 14x1 + 3x2 1 − 14x2 + 6x1x2 + 3x2 2 )] ×[ 30 + (2x1 − 3x2)2 ×( 18 − 32x1 + 12x2 1 + 48x2 − 36x1x2 + 27x2 2 )] Ackley 2D − a exp −b √√√√1 2 2∑ i=1 x2 i − exp ( 1 2 2∑ i=1 cos(c xi) ) + a+ exp (1) Bohachevsky 2D x2 1 + 2x2 2 − 0.3 cos(3πx1) − 0.4 cos(4πx2) + 0.7 Table 3.1: Benchmark function names and their mathematical definition. 34 3. Results Each benchmark function has its own magnitude. In order to facilitate the compar- ison, as well as lead the analysis on more case-oriented scenarios, a scaling has been applied, narrowing the interval to f(X) ∈ [0.20; 0.35]. Reducing the output to this narrow span allows to get values closer to real car drag coefficients. Specifically, a linear scaling has been applied, according to Equation 3.1. Fscaled(x) = Fmax − Fmin fmax − fmin (f(x) − fmin) + Fmin (3.1) where Fmin = 0.20 is the new desired minimum and Fmax = 0.35 is the new desired maximum. Instead, fmin and fmax are the original minimum and maximum of the functions. The search space and the respective scaled output space of the functions are shown in Figure 3.1. X −4 −2 0 2 4 Y−4 −2 0 2 4 Z 0.200 0.225 0.250 0.275 0.300 0.325 0.350 StybliskiTang X −4 −2 0 2 4 Y−4 −2 0 2 4 Z 0.200 0.225 0.250 0.275 0.300 0.325 0.350 Rastrigin X −4 −2 0 2 4 Y−4 −2 0 2 4 Z 0.200 0.225 0.250 0.275 0.300 0.325 0.350 Rosenbrock X −4 −2 0 2 4 Y−4 −2 0 2 4 Z 0.200 0.225 0.250 0.275 0.300 0.325 0.350 Beale X −4 −2 0 2 4 Y−4 −2 0 2 4 Z 0.200 0.225 0.250 0.275 0.300 0.325 0.350 Sphere X −4 −2 0 2 4 Y−4 −2 0 2 4 Z 0.200 0.225 0.250 0.275 0.300 0.325 0.350 Perm X −4 −2 0 2 4 Y−4 −2 0 2 4 Z 0.200 0.225 0.250 0.275 0.300 0.325 0.350 GoldsteinPrice X −4 −2 0 2 4 Y−4 −2 0 2 4 Z 0.200 0.225 0.250 0.275 0.300 0.325 0.350 Ackley X −4 −2 0 2 4 Y−4 −2 0 2 4 Z 0.200 0.225 0.250 0.275 0.300 0.325 0.350 Bohachevsky Figure 3.1: 3D visualization of the considered benchmark functions. Search space is represented by the xy-plane, while the output space is displayed on the z-axis. Another interesting visualization of the benchmark functions is the one proposed 35 3. Results in Figure 3.2, in which the distribution of local maxima and minima can be read more easily. In the following sections, all the introduced benchmark functions will be considered to evaluate the algorithms performances, even though more attention will be given to Sphere, Perm, and Bohachevsky functions. The particular focus on these three specific functions is due to their convex char- acteristic: it is assumed, in this pilot project, that the problem associated to clay car aerodynamic optimization via mechatronic diffuser is convex, or at least that it does not exhibit plenty of local minima, as for example the Ackley function. −4 −2 0 2 4 X −4 −2 0 2 4 Y StybliskiTang −4 −2 0 2 4 X −4 −2 0 2 4 Y Rastrigin −4 −2 0 2 4 X −4 −2 0 2 4 Y Rosenbrock −4 −2 0 2 4 X −4 −2 0 2 4 Y Beale −4 −2 0 2 4 X −4 −2 0 2 4 Y Sphere −4 −2 0 2 4 X −4 −2 0 2 4 Y Perm −4 −2 0 2 4 X −4 −2 0 2 4 Y GoldsteinPrice −4 −2 0 2 4 X −4 −2 0 2 4 Y Ackley −4 −2 0 2 4 X −4 −2 0 2 4 Y Bohachevsky Figure 3.2: 2D visualization of the considered benchmark functions. The function has been color-mapped accordingly to the function values. Additionally, it is believed that the black box function coming from the clay car model has a gradient significantly different from zero, leading to true and effective optimization possibilities. Functions such as Goldstein-Price or Beale, characterized by strong flat regions, do not show this behavior, thus less importance will be given to the performances coming from them. 36 3. Results 3.1.2 Optimizer comparison To understand which algorithms perform better than others, the optimizers have been tested on the benchmark functions to get insights on their performances. Specifically, the optimization algorithms were provided with a sampling budget of maximum 100 values. This number was chosen arbitrarily but with the condition to be high enough to make the algorithms work. In reality, a lower budged is con- sidered, due to the expensiveness of interacting with the wind tunnel, in terms of costs and time. A more detailed discussion of this can be found in section 3.1.4. Additionally, the algorithms have been run 250 times on each benchmark function, in order to estimate their average behaviour (mean) and confidence (standard devia- tion). This is due to the fact that some optimization processes are not systematically but stochastically initialized, as illustrated in Section 3.1.5. Stybliski-Tang Rastrigin Rosenbrock Beale Sphere Perm Goldstein-Price Ackley Bohachevsky B ay es ia n O p tim iz at io n La tin H yp er cu b e N el d er M ea d P ar tic le S w ar m R es p on se S ur fa ce S ob ol U rq uh ar t su rr og at e m od el Mean True minimum Std Algorithm iterations Figure 3.3: Evaluation of the optimization algorithms performances: 250 tests have been run over the benchmark functions, in order to compute relevant statistics. On the x-axis, the algorithm iterations are reported while on the y-axis the emulated CD value. In Figure 3.3 the performances over the algorithm iterations are displayed. Here, the y-axis represents the optimization cost. 37 3. Results As it is possible to see, the algorithms provide high performances over specific bench- mark tests, while performing worse on others. Some functions, due to their initialization, spotted the true optimum, or very close to it, during their first iterations. This is the reason why some curves are completely flat, overlapping the true known minimum. Moreover, the graph scale has been set the same in all plots, in order to ease the comparison for the reader. Small improvements are thus difficult to appreciate. Figure 3.4 displays a more focused representation of the Latin Hypercube test, to demonstrate the existence of small steps impossible to see from the previous picture. From this figure it is possible to observe its evolution over time, improving with the algorithm iterations, that is not constant but stochastic. Indeed, it it were deterministic, no standard deviation, thus the green area, would be observed. 0 20 40 60 80 100 Algorithm iterations 0.1995 0.2000 0.2005 0.2010 0.2015 0.2020 E m u la te d C D Latin Hypercube True minimum Mean Std Figure 3.4: Evaluation of the Latin Hypercube performances over 250 tests. The test is the same as Figure 3.3, but a narrower output space is displayed to better appreciate small improvements. Another insightful information is the standard deviation obtained from the tests and highlighted with light blue shadow in Figure 3.3 and 3.5. This allows to expresses the algorithms uncertainty over time. A small standard deviation is a indication for reliability, meaning that even though the processes are initialized with different points, the outcome is robust and repeatable. Algorithms that presented high stan- dard deviations during the benchmark tests will be discarded, as not reliable enough for collecting high quality data for the mechatronics demonstration. As mention in Section 3.1.1, more attention is payed on the results obtained from the tests over Sphere, Perm, and Bohachevsky benchmark functions, as they present a convex property, more similar to current optimization problems. A comparison example is reported in Figure 3.5, in which Nelder Mead, Response Surface and Urquhart surrogate model are shown. Nelder Mead and Response Sur- face algorithms present higher standard deviation over time with respect to the Urquhart surrogate model. Even though they might still perform sufficiently good 38 3. Results during wind tunnel tests, the choice of not using them has been made. This guar- antees that reliable data will be gathered. 0 5 10 15 20 0.20 0.21 0.22 0.23 0.24 0.25 E m u la te d C D Nelder Mead 0 5 10 15 Algorithm iterations 0.20 0.21 0.22 0.23 0.24 0.25 Response Surface 0 20 40 60 80 100 0.20 0.21 0.22 0.23 0.24 0.25 Urquhart model True minimum Mean Std Figure 3.5: Focus on the standard deviations obtained during the tests on the Bohachevsky function reported in Figure 3.3. The first two graphs present higher standard deviation, while the Urquhart surrogate model results to be more reliable. It is also important to underline that the Latin Hypercube Sampling and the Sobol Sampling, as pure optimization algorithms, shown in Figure 3.3, just consist in selecting almost-random points. Since they are structured as such, and no advanced logic nor development is included in these approaches, the optima that can be found only depend on stochasticity. This led to interpret the two methods as trial and error approaches, the exact same way the aerodynamics department is nowadays using to find the best configurations. The two methods have thus been discarded as pure way to investigate the optimum. After all these consideration, only the Bayesian Optimization, Particle Swarm and Urquhart surrogate model remain to be exploited. Looking at the performances displayed in Figure 3.3, the algorithms are completely equivalent. Even though they have been initially tested in the wind tunnel, the majority of the results is created using the surrogate model, as considered to be more reliable and stable since already tested by Urquhart et al. in PVT [9]. In this way, the certainty of obtaining good results was guaranteed. 3.1.3 Averaging time in wind tunnel Previous works run at PVT showed to have obtained a confidence interval of 0.0008 for CD value for a confidence of 95% with a 20 s averaging [9]. The facility and the instruments used in this work are the same used in the mentioned paper, while the clay car model differs. , it is appropriate to assume that the tests for this project will be affected by the same standard deviation. Since two different averaging can be used, 20 s and 60 s respectively, it is fundamental to understand which is the one that best suits the problem. The definition of confidence interval CI is reported in Equation 3.2. CI = x̄± z∗ σ√ n (3.2) 39 3. Results with x̄ representing the sample mean value, z∗ the level of confidence, also known as z-score, σ the sample standard deviation and n the size of the considered number of samples. From statistics, it is known that a confidence level of 95% is associated to z∗ = 1.96 CI = x̄± 1.96 σ√ n To compute the averaged values, the wind tunnel systems updates data at a fre- quency of 1Hz, meaning that for a 20 s averaging the population size becomes n = 20. Assuming that the sampled data will be affected by the same standard de- viation, a 60s averaging will lead to a confidence level with a population size three times bigger. In [9] the confidence interval was