How do roller coaster designers use math

Spline modeling and simulation of a roller coaster


1 Bachelor thesis Spline modeling and simulation of a roller coaster Florian Martin DATE OF SUBMISSION Supervisor: Prof. Dr. Klaus Höllig University of Stuttgart, Faculty 8 Mathematics, IMNG

2 The cover picture shows the Silver Star roller coaster in Europa Park Rust (see also page 5). 2

3 Table of Contents 1 Introduction 4 Introduction 4 2 Mathematical Basics 7 Mathematical Basics B-Splines Splines Spline Interpolation One-Dimensional Interpolation Three-Dimensional Interpolation Physical Basics 15 Physical Basics Kinematics Kinetics Presentation of the rollercoasterdesigner program 19 Presentation of the rollercoasterdesigner program rollercoasterdesigner_1d rollercoasterdesigner_3d Conclusion 33 Conclusion 33 Appendix 34 Literature 35 3

4 Chapter 1 Introduction Since the construction of the first roller coasters in the 17th century, when water was poured onto wooden structures, which froze and people slid down on it [15], a lot has happened in the development and design of new roller coasters. But the speed at which new roller coasters are being built is also increasing rapidly. Entries are made in the database of the “rollercoaster database” [10] today, around 1000 more than two years ago and 2000 more than six years ago. Almost exactly 200 years ago, the first roller coasters were built in France with the carriages attached to the track (see Figure 1.1). As the first roller coaster in Germany, the “giant auto-airway” [14] was created in 1908 in Munich and today there are 135 roller coasters in Germany. Germany's most famous roller coaster, the “silver Star” (see Figure 1.2), is located in Europa Park Rust near Freiburg and, at 73 m, is Germany's highest and longest roller coaster. The »kingda Ka« in Jackson, USA (see Figure 1.3), which is almost twice as high at 139 m, is the world's highest roller coaster and has the longest in the world with a 127 m long and 90 degree steep descent. In terms of speed, it is only topped by the “Formula Rossa” in Dubai (see Figure 1.3), which reaches top speeds of up to 240 km / h. 4th

5 5 Figure 1.2: Silver Star With the help of mathematics and physics, the task should now be to model such a roller coaster and to simulate the ride on it. Information such as speed, acceleration and the forces acting should be displayed while driving. The spline curves are used as a modeling tool. Nowadays these are mainly used in the field of CAD (computer-aided design) and when working with graphics, but are also used as modeling tools, e.g. used for finite elements [8]. First used by Schoenberg as a designator for smooth, compound curves [16], they were later used as a modeling tool in the automotive industry, mainly by de Casteljau (Citroën) [4], de-boor (General Motors) and Bézier (Renault) [2 , 3] developed. They offer a number of advantages over polynomials and e.g. Bézier curves. On the one hand, a local change in the curve does not have any global effects. After all, you don't want the end to be higher than expected if you change the middle of the path. Furthermore, a large number of points can be identified by a spline curve with a low degree, e.g. 3, interpolate. By means of polynomial interpolation, a polynomial of high order would be created, in most cases the number of points reduced by one. Especially with small distances between the points, this would result in a strong oscillation of the curve and the train would not be suitable for transporting people. Figure 1.3: left: Formula Rossa, right: Kingda Ka

6 6 CHAPTER 1. INTRODUCTION A final reason that speaks in favor of spline curves are easy-to-implement algorithms for evaluation and differentiation. These can also be implemented quickly through skillful calculations with matrices. For the task described above, the most important aspects of the spline theory are first listed in Chapter 2 and then a differential equation is derived in Chapter 3 using sub-areas of physics, which describes the time sequence of the journey. In order to not only provide the user with prefabricated roller coasters, he is given the opportunity to model and simulate his own roller coasters. This was implemented in two kinds of programs in MATLAB, and their description and operation is devoted to Chapter 4.

7 Chapter 2 Mathematical Basics In the following two chapters, the theoretical basics are to be created with the help of which the representation and simulation of a roller coaster can be carried out as a spline curve. From the spline theory, B-splines are first introduced in Chapter 2.1 and, based on this, splines are defined and various algorithms are presented (Chapter 2.2). In the last chapter 2.3 there is an introduction to interpolation with the help of splines for both 1-dimensional and 3-dimensional points. 2.1 B-Splines Before a spline function or curve can be defined, basic functions are required. For this purpose, the necessary basic features of the B-spline theory are listed, based on the book by Höllig and Hörner [9], which deals with the topic of B-splines and splines to a greater extent. Definition 2.1 (B-Spline) Let ξ: ξ 1 ξ 0 ξ 1 be a knot vector, ie a monotonically increasing sequence of real numbers, then the associated B-splines bnk, ξ of degree n are described by the following recursion: bnk, ξ = γ nkbn 1 k + (1 γ n k + 1) bn 1 k + 1, γn k (x) = x ξ k ξ n + k ξ k starting with the characteristic function: {b 0 1 x [ξ k , ξ k + 1) k, ξ (x) = 0 otherwise In the following, the convention is used that a B-spline is always defined on a node sequence ξ, which means that the index on the B-spline that represents the node sequence is no longer defined is specified. 7th

8 8 CHAPTER 2. MATHEMATICAL PRINCIPLES In the subchapter on the theory of splines, among other things, the derivation of a spline is derived; knowledge of the derivation of a B-spline is necessary for this. Since the B-spline theory is not a main part of the thesis, the following theorem is not proven. Theorem 2.1 (Derivation) The derivation of a B-spline bnk spline of degree n 1: (bnk) = α n kb n 1 k is a weighted linear combination of B- + α n k + 1b n 1 k + 1, αn k = n ξ k + n ξ k If the denominator ξ k + n ξ k disappears, the corresponding term is omitted. Figure 2.1: Cubic B-spline with nodes 0, 1, 2, 3, 4 (blue) and its derivation (red) 2.2 Splines After a necessary basis for splines has been created with the B-splines, these can now be defined. Since the general definition of a spline is not necessary for the task, a restricted definition is introduced, which is examined in the above-mentioned book under the term "Standard Spline Space". Definition 2.2 (Spline) A spline p of degree n to a finite node sequence ξ: ξ 0, ..., ξ n + m (mn) is a linear combination of the B-splines bn 0, ξ, ..., bn m 1 , ξ: p (x) = m 1 k = 0 ckbnk, ξ (x), x [ξ n, ξ m]

9 2.2. SPLINES 9 Within the programs belonging to the work, only the points of the parameter interval D = [angegeben n, ξ m] are specified for the representation of the roller coaster as a spline. In order to be able to define the basic function, an additional 2n outer nodes are required. This problem is solved by the following choice: with l = 1, ..., n. Ξ nl = ξ nl (ξ n + 1 ξ n), ξ m + l = ξ m + l (ξ m ξ m 1) To solve the differential equation, which represents the chronological sequence of a car on a roller coaster, two algorithms of the spline theory are required: First the differentiation of a spline and then the evaluation at a point. Theorem 2.2 (differentiation of a spline) The derivation of a spline p = m 1 ckbnk is a spline of degree n 1 with the k = 0 node sequence ξ: ξ 1, ..., ξ m + n 1 and the coefficients dk = α nk , ξ (ckck 1), α nk, ξ = n ξ k + n ξ k Hence p = m 1 k = 1 dkbn 1 k, ξ Proof: By definition, p = (m 1 k = 0 = m 1 k = 0 ckbnkck (bnk) If you insert the formula for the derivation of a B-spline from Theorem 2.1 and split the sum, then p = m 1 k = 0 m 1 ck αkb nn 1 k + k = 0) ck α n k + 1b n 1 k + 1 (2.1) The summand for k = 0 in the first sum is no longer relevant because it disappears completely on the parameter interval D = [ξ n, ξ m] and the index of the is increased second sum by one, it follows that the last summand, which starts at ξ m, is no longer relevant. Equation 2.1 can thus be written as p = m 1 k = 1 m 1 c k α kb n n 1 k + k = 1 c k 1 α n kb n 1 k

10 10 CHAPTER 2. MATHEMATICAL PRINCIPLES Figure 2.2: kub. Spline (blue) with derivation (red) and you get the formula you are looking for. After it has been proven that the derivation of a spline is again a spline, the last component missing for efficient work is an algorithm for evaluating a spline. For this purpose, the algorithm of de-boor [1] is used, which generalizes the algorithm of de-casteljau for Bézier curves. Theorem 2.3 (Evaluation of a spline) Let p = m 1 ckbnk be a spline of degree n and x a value from the parameter interval k = 0 D = [ξ n, ξ m], more precisely x [ξ l, ξ l + 1) with ln, l

11 2.3. SPLINE INTERPOLATION 11 If the recursion formula for the B spline is used, the result is p (x) = lk = lnp 0 k (γk nbn 1 k (x) + (1 γk + 1) bnn 1 k + 1 (x) ) Analogous to the proof of Theorem 2.2 one splits the sum up and carries out an index shift in the second sum, thus p (x) = lk = lnp 0 kγ nkbn 1 k + l + 1 k = l n + 1 (1 γ nk ) p 0 k 1b n 1 The first B-spline in the first sum and the last in the second sum are no longer relevant for the value of p at x and the same summation indices are obtained again: p (x) = lk = l n + 1 (p 0 kγk n + (1 γk n) p 0} {{k 1)} p 1 k If you carry out this step n times, only the B-spline b 0 l = 1 [l, l + 1 remains ) remaining with coefficient pnl, which therefore corresponds exactly to the value p (x). b n 1 k k 2.3 Spline interpolation With the spline theory presented so far, all requirements are met to represent a roller coaster as a spline curve. However, the program should give the user the opportunity to create their own roller coaster. On the one hand in the one-dimensional case by setting points, on the other hand in the three-dimensional case by selecting predefined components. In both cases, interpolation with splines is used, so that the necessary theory is presented in the following chapter. One-dimensional interpolation Let values ​​fk R at corresponding points xk with k = 0, ..., M and x 0

12 12 CHAPTER 2. MATHEMATICAL PRINCIPLES Definition 2.3 (natural spline interpolant) The natural spline interpolant for values ​​fk at interpolation points xk with k = 0, ... M is a cubic spline p, which is twice continuously differentiable at interpolation points xk and also fulfills the boundary conditions. p (x 0) = 0, p (x M) = 0 Under the given conditions there is a natural spline interpolant [9] and the question of how the spline is calculated from given points should now be investigated. From the definition it follows directly that it is a cubic spline and the dimension m of the spline is set to M + 3. Furthermore, the interpolation points x k are selected as nodes for the spline: x k = ξ k + 3. Thus, the parameter interval is set to D = [x 0, x M] and equidistant continuations of the outermost node intervals are used as the choice of the outer point, as described in Definition 2.2 below. Finally, the coefficients c k of the B-splines must be calculated, which is done using a linear system of equations Ac = f. The interpolation condition p (xi) = fi yields M + 1 equations m 1 k = 0 ckb 3 k (xi) = fi The two missing equations are obtained from the boundary conditions that are placed on the natural spline interpolants: p (x 0 ) = 0, p (x M) = 0 If the edge points are inserted into the second derivative, only the first or last coefficient remains, since B-splines of degree 1 evaluated at the middle node result in 1. Thus the two equations follow: and c 0 2c 1 + c 2 = 0 cm 3 2c m 2 + cm 1 = 0 Finally, c = (c 0, ..., cm 1) T, f = (0, f 0 , ..., f M, 0) T and A = (ai) m 1 (1, 2, 1, 0, ..., 0) i = 0 ai = (b 3 0 (xi 1), .. ., b 3 m 1 (xi 1)) 0

13 2.3. Given SPLINE INTERPOLATION 13, the system of equations has the form c c c c 3 = c 4 0 The resulting spline interpolant is shown in Figure 2.3. Figure 2.3: natural spline interpolant three-dimensional interpolation The difference to the previous chapter is that now only points fk R 3 with k = 0, ..., M are given and a spline curve p = m 1 ckbnk with ck R 3 is sought which interpolates the points. As in the one-dimensional case, a natural spline interpolant is generated again, with the difference that the control points are three-dimensional. In order to get this interpolant, a one-dimensional interpolation is carried out in each variable, so a total of 3 interpolations and at the end the control points are written accordingly in a vector. Before the systems of equations can be generated, nodes must first be generated from the given points. For this purpose ξ 3 = 0 is set canonically and the following nodes up to ξ m are calculated using the recursion ξ i + 4 = ξ i + 3 + f i + 1 f i 2, i = 0, ..., M 1. The outer nodes are again generated in the same way as in the one-dimensional case and the corresponding entries of the vectors f i serve as the right-hand side in the system of equations. k = 0

14 14 CHAPTER 2. MATHEMATICAL PRINCIPLES Example: If one interpolates the points cos (π / 2 i) pi = sin (π / 2 i), i = 0, ..., 8 i with a natural spline interpolant, the picture is obtained Figure 2.4: natural spline interpolant 3-dim. Points

15 Chapter 3 Physical Basics In Chapter 2 the basis was created to represent a roller coaster as a spline curve. Building on this, the following chapter serves to derive a differential equation that describes the movement of a car on a given curve. For this purpose, the necessary fundamentals from kinematics based on the physics textbook by Gerthsen and Vogel [7] and the textbook on technical mechanics 3 [5] are first listed in Chapter 3.1, and finally the equation is derived in Chapter 3.2 with the help of kinetics. 3.1 Kinematics The program, which is used to simulate a ride on a roller coaster, regards the car as a mass point, i.e. its mass is centered in a point and only its location is relevant for its movement [6]. The entire movement depends on the time and a position vector r (t) describes the position at time t, the Cartesian coordinates with origin 0 being selected as the inertial system: x (t) r (t) = y (t) = x ( t) ex + y (t) ey + z (t) ezz (t) When moving on a path, the mean speed between two points r (t 1) and r (t 2) can be expressed as the quotient of the displacement r = Calculate r (t 2) r (t 1) and the time difference t 2 t 1. The (instantaneous) speed v, which is of much greater importance, is obtained through the limit crossing t 2 t 1. Given the path r, the speed at time t is thus defined as r (t + t) r (t) v (t) = lim t 0 t = dr (t) = ṙ (3.1) dt From equation 3.1 it becomes clear that the speed is a vector which, due to its background, is a derivative tangential to curve 15

16 16 CHAPTER 3. PHYSICAL BASICS Figure 3.1: a) Inertial system with position vector r b) Calculation of the velocity [5]. The speed can thus also be written as v = ṙ = v e T (3.2) where e T describes the tangential vector on the curve and v the absolute value of the speed. If you consider the speed at two points in time t 1, t 2, you can form the quotient of v = v (t 2) v (t 1) and t 2 t 1, as in the above case, and obtain the mean acceleration.Again, the limit transition can be formed and the formula for calculating the (instantaneous) acceleration is obtained: v (t + t) v (t) a (t) = lim t 0 t = d dt d2 v (t) = r (t ) = r (3.3) dt2 If one takes the result just obtained and uses equation 3.2 for the definition of the speed, the result is the representation r = ve T + v ė T (3.4) This representation corresponds to the decomposition of the acceleration into tangential acceleration a T = ve T and normal acceleration a N = v ė T, which was discovered by Huygen [17]. With tangential acceleration, the amount of the speed changes, but the direction remains the same and with normal acceleration, the direction changes and not the amount. The latter is thus perpendicular to the track (see Figure 3.2).

17 3.2. KINETICS 17 v 1 v 2 av 1 v 1 v 2 v 2 a Figure 3.2: left: tangential acceleration, right: normal acceleration [7] 3.2 Kinetics After the basic kinematic terms speed and acceleration have been introduced, the forces that act on the mass point and thus cause its movement. The development is analogous to that carried out by Prof. Dr. Rill created a document on the design of roller coasters [12]. In the following, m denotes the mass of the mass point. The main basis of kinetics are Newton's three laws, of which the second is sufficient for these purposes: 2. Newton's law: The change in momentum over time is equal to the force acting on the mass point. Using the formula for the momentum p = mv and assuming that the mass is constant, the following important formula results for the force FF = d dt mv = mdv = mv = ma (3.5) dt Thus, the force can be calculated , which acts on the mass point F = ma = mr 3.4 = m (ve T + v ė T) = ma T + ma N = G + FN whereby the frictional force and the air resistance are neglected. Thus, the force on the mass point is made up of the weight G and the normal force F N. Multiply this equation by the tangential vector on the curve

18 18 CHAPTER 3. PHYSICAL PRINCIPLES e T, results using the standard scalar product (ab = ) (mr) e T = e TG + e TFN = e TG + mve T ė T From the definition of normal acceleration follows that ė T is perpendicular to the path and thus perpendicular to e T. The second term is thus abbreviated and the final equation is (mr) e T = e TG = mge (3) T re T = ge (3) T (3.6) where e (3) T is the third component of the tangential unit vector and g the acceleration due to gravity 9.81 m / s 2. Equation 3.6 can now be used to derive the differential equation for the movement of a mass point on a roller coaster, which is represented by a spline curve p. We are looking for a monotonically increasing function ϕ: [0, tf] [ξ n, ξ m] which represents the time sequence of the journey, ie p (ϕ (t)) with t [0, tf] represents the physically correct journey (except Air resistance and friction) of a mass point on p. Here, tf represents the end time of the simulation. The orbital equation r (t) = p (ϕ (t)) is now inserted in equations 3.2 and 3.4: ṙ (t) = ϕ (t) p (ϕ (t)) (3.7 ) r (t) = (ϕ (t)) 2 p (ϕ (t)) + ϕ (t) p (ϕ (t)) (3.8) The tangential unit vector on the curve is obtained by normalizing the vector from equation 3.7 and thus all components for equation 3.6 are determined: ((ϕ (t)) 2 p (ϕ (t)) + ϕ (t) p (ϕ (t))) ϕ (t) p (ϕ (t)) ϕ (t) p (3) = g ϕ (t) (ϕ (t)) ϕ (t) p (ϕ (t)) 2 ϕ (t) p (ϕ (t)) 2 completely abbreviated and sorted you get the Differential equation with initial conditions (p (ϕ) p (ϕ)) ϕ = (p (ϕ) p (ϕ)) ϕ gp (3) (ϕ) (3.9) ϕ (0) = ξ n, ϕ (0) = 0

19 Chapter 4 Presentation of the program rollercoaster designer The main task of the work, the simulation of a ride on a roller coaster, which is represented by a spline curve, was implemented in two programs using MATLAB. The basic idea behind the programs was not only to simulate prefabricated roller coasters, but also to give the user the option of designing his own. on the one hand as a planar curve and on the other hand as a three-dimensional curve. The difference lies in the way the track is constructed, in the first case by simply setting the points through which the track travels and in the other case by selecting prefabricated components that can be adapted in one way or another . First, the implementation of splines in MATLAB is discussed in Chapter 4.1, followed by the simulation in Chapter 4.2, and finally the functionality and operation of the two programs are explained in Chapter 4.3. 4.1 Spline Representation and Interpolation Spline Representation Before you can start interpolating points or solving differential equations, you must first find a suitable representation of splines in MATLAB. With the commands bspline and spline, MATLAB offers the possibility of getting a B-spline for a given node sequence or the spline which interpolates certain data. However, the disadvantage lies in the fact that the storage is carried out as a piece-wise polynomial. This memory structure is much less intuitive than the following, which definition 2.2 reflects and thus also offers the possibility of using the algorithms presented: p.deg = 3; 19th

20 20 CHAPTER 4. PROGRAM PRESENTATION ROLLERCOASTERDESIGNER p.knot = [0,0,1,1,4,4,6,9,10,10,10]; p.coef = [3, 1.4, 6.9.5, 7]; p.dim = 7; The first property indicates the degree n of the spline, the second the node sequence ξ on which the spline is defined, the third property reflects the coefficients c k and the last property corresponds to the variable m from definition 2.2. The property dim corresponds to the length of the array with the coefficients, but was introduced for control reasons. Based on this definition, the algorithms for evaluation (2.3) and differentiation (2.2) were implemented in the following files: spline_eval.m - evaluates a spline p, which is present in the above representation at a point t. The de-boor algorithm from Theorem 2.3 is used and cleverly executed by means of matrix operations. The function was adapted for solving the differential equation 3.9 with MATLAB, so that an evaluation outside the parameter interval is also possible, whereby only the value p (ξ n) or p (ξ m) is returned here. The reason for this is explained in Section 4.2. spline_diff.m - Derives a spline p and returns the spline q that corresponds to the derivative. spline_length_1d.m or spline_length_3d.m - Determines the length of the spline function or curve through an iteration which linearly interpolates the spline piece by piece and ends if the difference to the previous value is less than a tolerance (10 3). Spline interpolation In chapter 2.3 the procedure was presented how points can be interpolated by a cubic spline in both the one-dimensional and the three-dimensional case. This was implemented in the MATLAB files natural_spline.m and natural_spline_3d.m. Both files generate a natural spline interpolant as defined in Definition 2.3. First the known parameters deg and dim are set and then the node sequence is generated. In the three-dimensional case, this is done externally in the get_knots file as described in Chapter. As the last step, the system of equations is created and solved, in the function natural_spline_3d this is done simultaneously with three right sides. The spline interpolants in Figures 2.3 and 2.4 from Chapter 2.3 were created with the help of these files and evaluated with the program presented. 4.2 Simulation After the introduction of a suitable spline representation and the possibility of generating splines by specifying points, this sub-

21 4.2. SIMULATION 21 part of the simulation of the travel on a given spline. This is made possible by solving the differential equation 3.9 derived in Section 3.2. The get_movie.m file is responsible for this in the program structure. A spline p and a start time t0 are required for this. The reason for the starting time is that when the roller coaster is drawn, a slope right at the beginning is recognized as a "chain lift" [13]. This is simulated by the program itself by means of a steady drive, so that the starting point for solving the differential equation only begins when the car is at the top of the incline. If the path begins with a slope, the starting time is ξ n Solving the DGL MATLAB offers various solvers for solving differential equations, the most common is ode45. This is based on an explicit Runge-Kutta method of degrees 4 and 5 [11] and offers good error tolerance in the case of stable equations. The method requires a function f, which reflects the right-hand side, as a parameter, a vector t which specifies the points in time at which the solution is to be evaluated or a vector [t0 t1] which contains the time interval limits t0 and t1 and last a vector with the initial conditions. In the get_movie.m file, the call is made with f (x, y, p), timerange, initialvalues); The solver is designed to solve differential equations of degree one, i.e. ẏ = f (t, y) In the case of equation 3.9 there is a differential equation of the second degree, therefore the conversion of an equation of the second degree into one of degree one is used: ŷ ( t) = (y (t), ẏ (t)) T ŷ = (ẏ, ÿ) T = f (t, (y, ẏ)) The parameter initialvalues ​​is thus an array consisting of the initial condition from equation 3.9: initialvalues = [t0.0]; The right hand side of the differential equation was written into a separate file f.m. As a fixed third parameter, it receives the spline p, on which the journey is to be simulated, and the solver transfers time t and a vector y containing the values ​​y (t) and ẏ (t) when it is called. Using this information, ÿ (t) is calculated using the equation for the right-hand side and returned as a vector together with the value for ẏ. The last parameter remains the specification of the times at which the solution is to be evaluated. The right-hand side of equation 3.9 provides for the spline to be evaluated at ϕ (t), so it can happen that if the time interval is too large, ϕ (t) lies outside the parameter interval. The spline can be found there

22 22 CHAPTER 4. PROGRAM PRESENTATION ROLLERCOASTERDESIGNER naturally do not evaluate, so the problem was solved as follows: On the one hand, to prevent an error message, the spline evaluation was adapted and it is entirely possible to evaluate outside the parameter interval, even if only the value at ξ n or ξ m is output. On the other hand, the following iteration is carried out: 1. Start with 1 second as the time interval. 2. Solve the differential equation. 3. Look at the maximum value of the solution: If it is not at the end, then the roller coaster partially moves backwards. Therefore cut off everything after the maximum and END If the maximum is at the end, then check whether it is greater than the right limit of the parameter interval, if YES: cut off all values ​​that are greater than the right limit and END NO: Increase that Time interval around 1 second and go to 2. After this iteration it is ensured that the carriage stops when its speed disappears or it has reached the end of the path. Then the formulas 3.7 and 3.8 can be used to calculate speed and acceleration while driving. The forces at the respective points in time are obtained using Newton's second law and the division into weight and normal force. 4.3 Rollercoasterdesigner With the previously worked out theory and the programming implementation, the already mentioned programs for the design and simulation of rollercoasters were developed. The following is to show how they are to be operated and in one place or another what is behind the surface. After starting rollercoasterdesigner, there are two selection areas (see Figure 4.1) that can be used to start the respective program. On the one hand there is a one-dimensional designer rollercoasterdesigner_1d (see chapter 4.3.1), in which the course is determined by setting the points, and on the other hand the three-dimensional designer rollercoasterdesigner_3d (see chapter 4.3.2), which offers several components to choose from, which are placed next to one another can be. It also provides a real roller coaster that can be simulated on a smaller scale.

23 4.3. ROLLERCOASTERDESIGNER 23 Figure 4.1: Selection menu for starting the programs rollercoasterdesigner_1d After starting the program, the start interface is available (see Figure 4.2) and two points must first be set, making sure that the second point is not to the left of the first point . The program then interpolates the two points with a spline and changes its appearance to the normal work surface (see Figure 4.3). Figure 4.2: Start surface This contains the drawing surface (a), on which the appearance of the curve can be changed by certain mouse clicks and on which the simulation of the journey is carried out. The underlying coordinate system has the dimensions [0, 20] [0, 10], this size and also that of the coordinate system in the second program result in the resulting numbers for speed, length of the path, among others, not too small, but not too are great. Also can

24 24 CHAPTER 4. PROGRAM PRESENTATION ROLLERCOASTERDESIGNER the lengths of the components in the second program with values ​​in the range from 0 to approx. 20 can be adopted without converting. Below the drawing surface there are two buttons (b) with the following functionality: Reset: By pressing the "reset" button, the currently drawn spline is deleted and a new one can be created. If you simulate the ride on the roller coaster, the button disappears and another one takes its place: Edit Mode: During the simulation, the points that you have set are not displayed. In addition, a slope at the beginning of the roller coaster is drawn in a different color and the panel (see section on changing the curve) for selecting the edit mode disappears. The »edit mode« button is used to undo this change. Exit: Terminates the program. Figure 4.3: Work surface of the program Changing the curve To change the appearance of the drawn curve, several options have been implemented, all of which can be carried out by intuitive click.

25 4.3. ROLLERCOASTERDESIGNER 25 First of all, the correct mode must be selected in panel (c) with the heading »Mode« (see Figure 4.4). Figure 4.4: Panel for selecting the editing mode An important aspect that must be observed in all modes is the following: Since the representation is a natural spline interpolant (cubic), a change at one point affects up to 3 B-splines and their coefficients, so choosing too large distances between the points will lead to unwanted changes. This can be avoided by choosing smaller distances. After starting and setting the first two points, the program is in "add Point (Extension)" mode. In this mode, a new point can be set by clicking in the free space to the right of the last point. (see Figure 4.5). Figure 4.5: Add Point (Extension) mode In this mode, no point can be set whose associated x-value is within or to the left of the previous parameter interval. To carry out this step, you have to switch to the »Add Point (Refinement)« mode. With any click on the drawing surface, this mode creates a new point through which the roller coaster drives. If the x-value of the

26 26 CHAPTER 4. PROGRAM PRESENTATION ROLLERCOASTERDESIGNER point in the parameter interval, the point is inserted between the two adjacent points (see Figure 4.6). The program determines the two points on the right and left with the smallest distance and inserts it at this point. MATLAB unfortunately does not allow you to click on the curve and in a small area of ​​the existing points, which is why it is not possible to set new points there. Figure 4.6: Add Point (Refinement) mode To delete a point that has already been set, the »delete« mode is used. All you have to do is click in the vicinity of the point that is to be deleted (see Figure 4.7). The program then determines the point that has the smallest distance to the location of the click and deletes it. As just described, the point to be deleted cannot be selected directly. As the last mode, the program offers the »move point« mode. This is used to move a point that has already been set between the two adjacent points. To do this, you select a point by pressing the left mouse button, whereupon it is drawn in red to make it clear which point you are currently working with. Now the point can be moved by pressing the left mouse button again and if it is in the desired location, the point is deselected by pressing the right mouse button (see Figure 4.8). Simulation and saving After a curve has been designed with the modes presented, a journey can then be simulated. The program initially offers the possibility of doing this

27 4.3. ROLLERCOASTERDESIGNER 27 Figure 4.7: Delete mode to change the weight of the cart (e).However, the weight has no influence on the ride, only the strength of the forces experience a change. During the simulation, the program shows the current speed (in m / s), the current tangential acceleration (in m / s 2) and the acting normal force (in N) on the drawing surface. Here, 24 values ​​are displayed per second, it is difficult to read the exact values, so the playback speed can be adjusted with a slider (d). With the command getframe, MATLAB offers a convenient way to save images one after the other and then play them back with a certain number of images per second (FPS). The command has the disadvantage that the images to be played must first be generated in order to save them and then play them back. This means that in this case the curve is traversed twice, first in a loop to save the images and then with the correct number of FPS. Therefore this problem was solved with the commands tic and toc: plot (..); f1 = tic; [..] f2 = toc (f1); pause (1/24 f2); plot(..); After the current position of the car has been plotted, a stop watch is started with tic, which measures the time up to the command toc. In the event that a picture has to be displayed for 1/24 seconds, the pause command is used to wait the remaining time until the next position is displayed. At the end of the simulation


29 4.3. ROLLERCOASTERDESIGNER 29 a panel appears (see Figure 4.9 or (g)), which shows various statistics of the journey: average speed, maximum speed (both in m / s), length of the journey (in s), maximum normal force (in N) and the Length of the curve (in m). Figure 4.9: Statistics The getframe command mentioned above is used in the course of saving. With the button to save (f) the journey of the car is saved in a matrix M and then saved in a file with a previously entered name using movie2avi Load existing roller coaster into the program. Before the correct program opens, two menus appear one after the other (see Figure 4.10) in which the starting point and the starting direction must be specified, whereby the starting point must be in the cube [0, 20] 3 and the starting direction, i.e. the direction, in which the roller coaster is being built should show in the cube. The work surface (see Figure 4.11) offers similar elements compared to the first Figure 4.10: Starting point and direction of the program. The simulation part with slider, simulation button and save button corresponds to the same elements in appearance as well as in functionality as described above.

30 30 CHAPTER 4. PROGRAM PRESENTATION ROLLERCOASTERDESIGNER The same values ​​are displayed during the simulation, with the difference that the panel is used for this, in which the statistics are later displayed. The reason is the possibility to rotate the cube in which the curve is located, which would also rotate the displayed text. In this case it would be illegible and therefore useless. Figure 4.11: Work surface generating the curve The biggest difference is in the generation of the curve. Analogous to the first program with the setting of the points, it would be a great challenge for the user to find the desired location within a three-dimensional object that is mapped on a two-dimensional disk. Another option that has been considered is entering points. The user must be clear at all times where he is exactly, and the multitude of numbers would make the program anything but user-friendly. The program therefore offers three types of components in a popup menu (see Figure 4.12), which can be modified as follows: 1. Line - Creates a line with the length and slope entered from the »Gradient« text field. The slope is entered in degrees and is allowed

31 4.3. ROLLERCOASTERDESIGNER 31 Figure 4.12: Different components with their modification options amount to a maximum of 89. The sign determines the direction: positive means upwards and negative means downwards. 2. Curve - Creates a curve with the desired radius and slope in the same way as in the previous component. If the radius has a negative sign, then a right-hand curve is obtained, and if it has a positive sign, a left-hand curve. The last field »Angle« indicates the angle of rotation of the curve. 3. Looping - Creates a looping with the specified diameter, the looping is always placed in the plane. This means that if the loop is set from a slope, the track merges into the level and then into the loop. The program generates rotary dies for the first two components. In the first case, only the direction vector at the end of the curve is rotated up or down by the respective angle and then the end point and two other points are interpolated. In the case of the curve, a planar curve is first generated regardless of the slope (see Figure 4.13 left). To do this, the program determines the center point M depending on the radius and rotates the connection vector by the angle of rotation. Then the vector is rotated up or down between the end point of the curve and point E (see Figure 4.13 right). Figure 4.13: Creating a curve With the adjacent buttons »Set Object« and »Remove last Object« the selected object can be set or the last object can be deleted again. This is not limited to what was set last, but can be carried out for as long

32 32 CHAPTER 4. PROGRAM PRESENTATION ROLLERCOASTERDESIGNER until the curve has completely disappeared. If creating your own curve is too cumbersome for the user, the program offers a popup menu (see Figure 4.14) to select a real roller coaster that can be loaded into the program. This is the “Silver Star” roller coaster presented in the introduction (see Figure 1.2). Figure 4.14: Selection of different roller coasters The »Options« button takes you to an options menu (see Figure 4.15). On the one hand, this offers the possibility to improve the atmosphere during the creation of a roller coaster by using funfair music, and the shouting that typically arises during the simulation is played in on a gradient. On the other hand, a 3D viewer can be switched on, which shows the ride on the roller coaster from the perspective of the car during the simulation. The environment is represented by a cube with sky, horizon and ground textures and while driving, the cube is shifted according to the location so that movement is simulated. The camera view is then panned in the direction of the roller coaster at the current location. This module is not activated by default, as MATLAB's options for changing the camera and view are very limited. Since such a tool was not the scope of the work, it has not been further developed as it stands and is therefore to be seen as an alpha version. Figure 4.15: Options menu

33 Chapter 5 Conclusion In the course of studying mathematics you get to know many facets of mathematics, which by and large are not accessible to outsiders. In most cases, this continues on the topics of bachelor theses, so that the title alone causes great confusion. In this case, this thesis is refuted, apart from the word "spline", even a non-mathematician can imagine something under "modeling and simulation of a roller coaster". If you look at the result of the work, the two MATLAB programs, anyone who can also use a computer can use them to design and simulate roller coasters. Furthermore, in contrast to a work that consists of proving statements or examining mathematical objects, the result can be clearly represented and is not just an aid for the proof of other manifestos. Of course, such work is also required, but contrary to the everyday image of the work of a mathematician, there are also clear and directly usable works for everyone. The work also offers a new perspective with regard to the area of ​​application of splines: As described in the introduction, splines are mainly used in CAD systems for the development of components and the like and are therefore embedded in not exactly user-friendly software. So it's nice to see that with the help of some programming effort, entire roller coasters can be displayed and simulated - packed in an almost self-explanatory program that does not require any specialist knowledge. We would like to take this opportunity to thank Prof. Dr. Klaus Höllig for the opportunity to work on this topic and to be able to develop the programs. The further developed MATLAB and L A TEX knowledge will certainly be of great help in the following course of the course. 33

34 Appendix The following is a list of the program files on the enclosed CD. / data ... contains image and sound files heaven.jpg horizont.jpg screaming.wav theme.wave wiese.jpg audioplayerloopingstopfcn.m b_spline_eval.m check_spline.m create_curve.m create_line.m create_looping.m fm get_knots_3d.m get_movie.m natural_spline.m natural_spline_3d.m options.fig options.m rollercoaster_designer.fig rollercoaster_designer.m rollercoaster_designer_1d.fig rollercoaster_designer_1d.m rollercoaster_designer_3d.fig rollercoaster_designer_3d.m silverstar.m spline_diff.m spline_eval.m spline_length

35 Literature [1] Carl de Boor. A Practical Guide to Splines. Springer-Verlag, [2] P. Bézier. Définition numérique des courbes et surfaces I. Automatisme XI, [3] P. Bézier. Définition numérique des courbes et surfaces II. Automatisme XII, [4] P. de Casteljau. Courbes and surfaces a pôles. In: Technical report, André Citroën Automobiles SA, Paris (1959). [5] Dietmar Gros et al. Technical mechanics 3. Springer Berlin Heidelberg, [6] T. Fließbach and H. Walliser. Theoretical Physics workbook. Spectrum Academic Publishing House Heidelberg, [7] Christian Gerthsen and Helmut Vogel. Physics. Springer Berlin Heidelberg, [8] Klaus Höllig. Finite Elements Methods with B-Splines. SIAM - Society for Industrial and Applied Mathematics, [9] Klaus Höllig and Jörg Hörner. Approximation and Modeling with B-Splines [10] Duane Marden. rollercoaster database. url: [11] Mathworks. Solve initial value problems for ordinary differential equations. url: [12] Prof. Dr. G. Rill i.a. MaurerSöhne GmbH. Dynamic design of roller coasters [13] Michael Pantenburg / Metamorph. Schwarzkopf Coaster net. url: [14] Lena Rosenthal. The world in numbers. In: brand eins (Sep. 2006). [15] Adam Sandy. roller coaster history: the beginning url: [16] I. J. Schoenberg. Contributions to the problem of approximation of equidistant data by analytic functions. In: Quart. Appl. Math (1946). [17] Dr. Carl Snell. About Galileo as the founder of mechanical physics and about the method of the same

36 Declaration I hereby affirm that I have prepared this Bachelor thesis independently and only using the resources specified in the bibliography. Bietigheim-Bissingen, the ?????????????? Florian Martin