Upload
seantrobinson
View
217
Download
0
Embed Size (px)
Citation preview
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
1/32
Page 1 of32 Sean Robinson
University of Glamorgan
USING MATHEMATICAL MODELLING TO CREATE A
CONTINUOUS SIMULATION OF A BICYCLE
SEAN ROBINSON
Abstract The stages inherent in the development of a bicycle simulator will be explored, tested
and then documented. Each stage will provide detailed research into the different methods of
solving the current problem and then conclude with the solution decided upon through testing
and evaluation. Solutions are required for modelling the integration from movement, constraint
modelling the object in order to provide accuracy within the simulation and mapping the real
world physics and mechanics of bicycle components and compounds to a virtual counterpart.
Conclusions are drawn based on the accuracy and feasibility of providing solutions within a time
constraint project. The development time frame is considered to be approximately two months
and the solutions provided allow adequate time for the entire simulation to be created using
these methods.
TABLE OF CONTENTS
Introduction ........................................................................ .................................................................... ................ 2
Objectives ............................................................................................................................................................... 3
User Requirements ........................................................................... ............................................................ .......... 4
Timeline .................................................................................................................................................................. 5
Software Development Platform ........................................................................ .................................................... 6
1. Languages: ..................................................................................................................................................... 7
a. C: ......................................................................... ......................................................................... .............. 7
b. C++: .................................................................... ......................................................................... ............... 7
c. C#: ...................................................................... ......................................................................... ............... 7
d. Java: ........................................................................................................................................................... 7
2. Platforms:....................................................................................................................................................... 8
a. Visual Studio 2010: .................................................................................................................................... 8
b. Netbeans: .................................................................................................................................................. 8
c. Eclipse: .............................................................. ......................................................................... ................ 8
d. Text Editors: ..................................................................... ...................................................................... .... 8
3. Conclusions: ................................................................................................................................................... 8
Movement Integration ........................................................................................................................................... 8
1. Euler Integration: ........................................................................................................................................... 9
2. Verlet Integration: ....................................................................................................................................... 10
3. Runge-Kutta: ................................................................................................................................................ 17
4. Conclusions: ................................................................................................................................................. 20
Constraint Modelling ............................................................................................................................................ 21
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
2/32
Page 2 of32 Sean Robinson
University of Glamorgan
1. Introduction ................................................................................................................................................. 21
2. Constraints ............................................................................. ................................................................ ...... 21
3. Constraint Satisfaction Problems ..................................................................... ............................................ 22
4. Constraint Programming ............................................................................... ............................................... 22
5. Bicycle Constraints ..................................................................................................................................... .. 23
6. Conclusions .................................................................................................................................................. 24
Bicycle Physics and Mechanics ............................................................................................................................. 25
1. Introduction ................................................................................................................................................. 25
2. Bicycle parts ................................................................................................................... .............................. 26
3. Component Physics .............................................................................. ........................................................ 27
a. Steering.................................................................................................................................................... 27
b. Pedalling .................................................................................................................................................. 27
c. Suspension ....................................................................... ....................................................................... . 28
d. Braking ............................................................. ......................................................................... ............... 28
E. Trail .................................................................... ......................................................................... ............. 28
4. General physics ............................................................................................................................. ............... 28
a. Gravity ..................................................................................................................................................... 28
b. Friction .............................................................. ......................................................................... .............. 29
c. Air Resistance .......................................................................................................................................... 29
Conclusions ......................................................................... .................................................................... .............. 29
Works Cited .......................................................................................................................................................... 30
INTRODUCTION
Mathematical Modelling is a large area of computing, with many branches; both specialised and
general. It is the way in which objects, both simple and complex, can be envisioned within a virtual
environment. Modelling something as relatively basic as a bicycle considers many variables and
functionality; both owning a considerable amount of potential solutions.
In order to develop such a project, extensive planning must be paramount. Only then is it viable to
begin researching potential solutions. As so many solutions exist for individual problems, it is
important to thoroughly investigate a variety in order to conclude with a solution that best matches
the specific problem. Sometimes it becomes unfeasible to map a real world solution to a virtual
project so the designer must be able to reach compromises between actual accuracy, accuracy of
solution to the real world mechanics and the constraints applied, such as time and cost.
This document will take the format of an over-arching design that narrates the life cycle of the
project described. At specific junctures, research articles that have been created in order to solve
individual problems will be included as separate, embedded objects.
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
3/32
Page 3 of32 Sean Robinson
University of Glamorgan
OBJECTIVES
The project being considered, while complex, can be easily synopsised into a single sentence.
A suite of libraries to continuously process the virtual inputs from both the environment and bicycle
and then output the relevant data so that the bicycles state is modified and then correctlydisplayed
Within this high level objective, there are several components that need to be addressed. A meeting
with a mathematician has been arranged following the successful completion of these solutions.
This meeting will be a way of obtaining professional counsel in order to ensure the model devised is
as accurate as possible within an appropriate frame of time and cost.
1. Solve Movement Integration:In order to accurately represent the movement of a modelled object, integration can be
used to plot the course. Different methods will be researched and then a solution decided
on. The evaluation of the method will be through means of testing the output data against
the actual values. Computation cost will also be taken into consideration. Output of this
research will be data tables and graphs plotting the effectiveness.
2. Model Constraints:Constraints between the bicycle components will be assessed for feasibility. This is quite a
complex domain and may be deemed outside the scope of the project. The methods will be
introduced and then evaluated initially on just the time cost and complexity. Should
constraint modelling be used, further evaluation into methodology will take place. This
research will only output a feasibility assessment for constraint modelling to begin; furtherresearch is pending on outcome.
3. Represent Mechanics:There are many mechanisms on a bicycle that need to be accurately modelled for a perfect
representation, some of the more critical will be considered for this basic model.
a. Steering:Considerations into how to model the steering of the object will be undertaken,
different methods of varying complexity and accuracy will be explored and assessed
on feasibility. This research will output either a method to be used or actual
equations should there be enough time. The methods will be assessed on accuracy
and ease of implementation. Should there exist tested and reputable solutions,
these will be utilised and referenced. Further testing may take place at a later stage
in order to fully prove viability.
b. Pedalling:Pedalling is the way in which the bicycle will be propelled forwards. There are
several methods that could be used for achieving this, ranging from simply assigning
a value based on pedal rate that will be used to determine speed or distance
travelled, to calculating the actual forces generated by a rider and the modifying this
based on environmental factors. Mapping the solution to real world physics may
prove to be too complicated for a project of this nature. The ideal solution will be
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
4/32
Page 4 of32 Sean Robinson
University of Glamorgan
explored for feasibility and existing solutions, should a viable solution exist, then this
will be testing for accuracy and cost in order to prove effectiveness. Should a real
world solution prove too complex, then an appropriate balance will be determined
and a solution that closely maps to the actual solution will be provided. This report
will document the feasibility of the provided solution.
4. Model Real World Physics:While there are many factors that will affect the movement of the bicycle in a real
environment, these are often too numerous to fully explore, a report will be generated
exploring the most critical of these factors. While real world solutions do exist, should these
prove too complex or difficult to model, then an appropriate measure will be taken to
provide an accurate approximation, this will be tested for accuracy and cost against the
actual solution. The output for this objective will be the report discussing these sections.
a. Friction:Friction can come from many sources in the physical world and solving every factorwill usually prove to be too expensive for a small scale project. As each components
moves against another and the air, friction will be generated which will remove
force from the relationship. This paper will focus on the main sources of friction,
such as wind resistance and ground friction. Should an effective, reputable and
tested solution already exist then this can be used to approximate the effect.
Otherwise, an appropriate system will need to be developed and tested for
accuracy.
b. Gravity:Gravity is often simply thought of as a force pulling us towards the ground. In a three
dimensional environment, gravity must be accounted for with respect to several
areas. The areas that will need to be considered are specifically concerning
gradients. When the machine is moving uphill or downhill, gravity must be
considered and calculated to show how it is currently affecting the simulation.
Output will be either a set of equations based on proven work or an appropriate
solution that matches the real world solution as accurately as possible.
USER REQUIREMENTS
As this project is client provided, there are specific details that should be considered when designing
the product that have been supplied by the client.
1. Simulation must account for the lean of a bicycle:This will be explored when the steering method is taken into consideration. Lean will be
documented in a similar fashion.
2. Final deliverable should preferably take the format of .DLL or COM components:Research into the creation of these types will be completed in the second stage of the
project.
3. Model is built around two Cartesian coordinates of the centres of both wheels:
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
5/32
Page 5 of32 Sean Robinson
University of Glamorgan
With the wheel size being stored, the position and state of the bicycle can be calculated
using Pythagorean Theorem.
4. Consider front suspension:Front suspension is the way in which the shock absorber attached to the front fork
compresses and decompresses based on the environmental factors. These devices can be
thought of as springs so will be researched during the integration report and then also when
documenting how real world physics will be solved and mapped to individual components.
5. Consider front braking:The application of pads to the front wheel generates friction in order to decelerate the
machine, the solution to this problem will be considered during the experiments into the
effect of friction.
6. Allow bicycle specifics to be loaded from file:This requirement means that when the libraries are being built, there should be methods
available for file handling. Should a file not be loaded, default parameters should be
provided based on an average state.
7. Future extensibility to allow for different tyre and wheel types should be provided:This links in with file handling. Default parameters should be provided but the potential to
load a specific machine should be developed or the structure of the application allow for this
as a future development.
8. Surface friction should be taken from texture type:Each surface type will need to stored within the application or in a file that accompanies the
texture. Friction values based on the surface type can either be assigned based on previous
research and average friction values of the types or determined values used following a
discussion with the client.
TIMELINE
As this project can be thought of as a collection of individual problems, decomposing the task into
smaller objectives is a very viable method of breaking down the project into smaller, specific
problems. A by-product of this decomposition it that it allows for a timeline to be created where
each task is allocated certain resources and time. These tasks can be mapped to the deadlines in
order to ensure a successful completion. When this timeline is generated, it becomes easy to see
whether the actual objectives of the project are going to be met. This comes from both the
completion estimate and the way in which each task is represented, should an objective be absent
from the timeline, the plan can be reviewed. Below is a GANTT chart and timeline created for this
project.
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
6/32
Page 6 of32 Sean Robinson
University of Glamorgan
TASK NAME DURATION START FINISH
1 Initial Presentation 6 days Wed 19/10/11 Wed 26/10/11
2 Milestone 1 - Research and Output 18 days Thu 27/10/11 Mon 21/11/11 1
3 Milestone 2 - Design and Development 51 days Tue 22/11/11 Tue 31/01/12 2
4 Milestone 3 - Final report 64 days Thu 02/02/12 Tue 01/05/12 3
5 Initial Presentation 7 days Wed 19/10/11 Thu 27/10/116 Generate Power Point for Initial Presentation 3 days Wed 19/10/11 Sun 23/10/11
7 Create initial UML 1 day Mon 24/10/11 Mon 24/10/11 6
8 Create Initial ERD 1 day Tue 25/10/11 Tue 25/10/11 7
9 Retype Blog Transcript Into report and Prepare Handouts1 day Wed 26/10/11 Wed 26/10/11 8
10 Give Presentation 1 day Thu 27/10/11 Thu 27/10/11 9
11 Milestone 1 - Research and Output 23 days Fri 28/10/11 Wed 23/11/11 10
12 Initial Research Using 'Net' Method 5 days Fri 28/10/11 Thu 03/11/11
13 Evaluate Research Quality and Appropriateness 1 day Fri 04/11/11 Fri 04/11/11 12
14 Document Report, Include references 3 days Sat 05/11/11 Mon 07/11/11 13
15 Extend Design Documents 3 days Tue 08/11/11 Thu 10/11/11 14
16 Design Core Solutions (Pseudo with Fragments) 5 days Fri 11/11/11 Wed 16/11/11 1517 Document and Test Solutions 2 days Thu 17/11/11 Fri 18/11/11 16
18 Buffer 4 days Sat 19/11/11 Wed 23/11/11 17
19 Milestone 2 - Design and Development 205.13 days Thu 24/11/11 Tue 31/01/12 1820 Extended Research Using 'Net' Method 7 days Thu 24/11/11 Fri 02/12/11
21 Evaluate Research Quality and Appropriateness 3 days Sat 03/12/11 Tue 06/12/11 20
22 Document Report, Include references 7 days Wed 07/12/11 Thu 15/12/11 21
23 Complete Design Documents 7 days Fri 16/12/11 Mon 26/12/11 22
24 Build Core Solutions 7 days Tue 27/12/11 Wed 04/01/12 23
25 Design Other Solutions 5 days Thu 05/01/12 Wed 11/01/12 24
26 Document and Test New Solutions 7 days Thu 12/01/12 Fri 20/01/12 25
27 Buffer 8 days Sat 21/01/12 Tue 31/01/12 26
28 Milestone 3 - Final report 69 days Wed 01/02/12 Tue 01/05/12 27
This list of tasks represents each stage in the design and devleopment cycle of this project
demonstrates that the objectives will be met. By following a timeline, it can be ensured that tasks
are completed to schedule.
SOFTWARE DEVELOPMENT PLATFORM
One of the first things to decide in a project is the form in which the final product will take and the
method that will used in order to develop it. The platform and language assessment is a vital first
step in a project and the outcome of this stage is documented below.
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
7/32
Page 7 of32 Sean Robinson 2011
ASSESSMENT AND EVALUATION OF SOFTWARE
DEVELOPMENT PLATFORMS AND LANGUAGES
SEAN ROBINSON
Abstract - This report will document the
analysis of several programming
development platforms and languages which
could be utilised with them in order to create
the final application. Platforms and
languages will be assessed based on
appropriateness to the project and
feasibility. It is important to evaluate theitems not only in terms of stand-alone
functionality but also with regard to how
their usage directly relates to a developer.
This report assumes that the developer of
this product will be familiar with the most
widely used languages as reported by
langpop (1). The views expressed regarding
these languages are the opinion of this paper
and are from a developers perspective, such
as the one described above.
1.LANGUAGES:a. C:
For many domains, C is the most popular
language for developers. By providing
functionality for structs, dynamic memory
usage and a vast stl, developers can take
advantage of a huge amount of content. An
issue with C is that it can lack flexibility when
compared with other high level languages likeJava and C++. For a large project, object
orientation can be a hugely valuable tool as it
allows for a high level of code reuse. While
structs can be created, the ability to create
specialised classes is lost.
b. C++:C++ is an evolved form of C and provides extra
functionality in addition to the previouslydescribed usages from the C language. The
largest selling point of C++ is that the ability to
create classes is now present. Classes enable
a developer to take advantage of such things
as polymorphism, which can be vital when
dealing with inheritance in a project. While
the code may eventually become larger in
terms of lines, the ability to reuse classes and
functions is an exceptional ability.
c. C#:The main focus of C# is that it is specialised
for Rapid Application Development (RAD).
Even though this project is time constrained,
an interface is not required as the scope
simply refers to the logic that powers the
application. While the syntax is similar to C
and C++, this higher level language lacks some
of the lower level control inherent in its
parent languages. C# can be considered
toward the end of the project if there is
enough time remaining to consider a GUI for
the engine, where its RAD techniques will
prove valuable. It may also be considered to
act as a marshal for creating COM
components.
d. JAVA:Java can be thought of as a counterpart to C#.
While more established, it lacks the
connectivity to the lower level C languages
that is enjoyed by C#. While a good choice to
develop a RAD project on its own, the lack of
GUI in this project makes the benefits slightly
redundant and the lack of dynamic memory
usage removes some of the control that could
be utilised in other languages.
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
8/32
Page 8 of32 Sean Robinson 2011
2.PLATFORMS:a. VISUAL STUDIO 2010:
One of the most widely used platforms is VS,
it provides huge amounts of support for the C
family of languages and has a very pleasant
interface from which to develop from. Some
of the stronger assets are the intellisense,
which allows for dynamic debugging and
structure exploration, and the autocomplete
feature, which can help reduce the overall
development time. The main cause for
concern with VS is the bloat. Projects
developed in VS are very well organised and
removes much of the hard work from theuser. However, these files can be enormous,
even for smaller projects. Even when
weighing the file size into the equation, VS is
still an incredibly strong contender that would
allow for a high level of precision in the
development of this project.
b. NETBEANS:Netbeans is an alternative environment to VS
and supports Java and its relations. While the
IDE is very useful in the development of Web
based applications and GUIs, this
functionality would be lost in this project as
they could not be utilised.
c. ECLIPSE:Eclipse is a very general IDE that supports
many different languages. This extended
functionality is actually a reason to remove it
from the considerations. By trying tospecialise in so many languages, the IDE does
not support any specific language particularly
well, especially when compared to the more
specialised IDEs. While a very good IDE for
languages lacking a dedicated platform, this
package lacks the functionality that could
easily be gained from elsewhere.
d. TEXT EDITORS:An honourable mention more than anything,
text editors are very lightweight alternatives
to the more bloated IDEs. Many modern
editors come with functionality for
compilation, optimisation and linking but still
lack the finesse and power of more
commercial alternatives.
3.CONCLUSIONS:There are many possibilities when selecting a
language and platform to develop from.
However, as may be clear from the report,
this paper recommends the use of C++ from
within the Visual Studio IDE for the
development of this project. The huge
amount of functionality and support for the
main languages under consideration shows it
to be a very viable solution for this particular
problem.
MOVEMENT INTEGRATION
As previously indicated, the propulsion of the bicycle will take the form of an integration of
movement. A report was generated that explored the different methods of achieving this and then
tested the outputs of this research before reaching conclusions.
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
9/32
Page 9 of32 Sean Robinson 2011
ASSESSMENT OF MATHEMATICAL INTEGRATION
METHODS FOR USE IN CONTINUOUS SIMULATION
SEAN ROBINSON
Abstract - Continuous simulation is a process
whereby the state of an object being
represented is calculated on the fly (2). This
paper will investigate how different methods
of propulsion will affect the object as it
moves throughout the environment and then
assess these methods based on efficiency
and accuracy.
1.EULER INTEGRATION:The Euler method was first set out by
Leonhardo Euler in one of many seminal
works on calculus in 1769 (3). The original
manuscript has been scanned and is available
from Dartmouth University (4); an English
translation of the original text has been
developed and is maintained by Bruce, I (5).
This is one of the most basic ways for solvingdifferential equations. In this particular case,
it will be demonstrated how this method can
be used for governing the movement of
particles in a simulated world. While it is not
the interest of this paper to simulate particles,
the method can be used to solve for basic
particle entities and then expanded in order
to affect a compound of rigid bodies.
A basic Euler integration algorithm uses thefirst two terms in the Taylor Series Expansion
(6), in order to solve for each integration step.
First the new velocity of the particle is solved
by multiplying the elapsed time by the current
acceleration. This is done for both x and y
values, although in a three dimensional world,
a z component is included.
The second integration is used to calculate the
new position on the particle by multiplyingthe current position by the new velocity and
the time elapsed since the last iteration. Once
again, this is calculated for all axis values
used.
In pure Math, the function is:
X(t + dt) ~= x(t) + dt * (dx/dt)|t. (7)
t is used to represent the time elapsed since
the last update and the method outlinedabove is used to solve for both steps of
integration.
Once the basic premise of this function is
understood, it is quite easy to construct some
pseudo code to aid in the development of a
code fragment.
Create new 2d vector to represent new
velocity;Assign X value as time elapsed * acceleration
of particles current X;
Assign Y value as time elapsed * acceleration
of particles current Y;
Create new 2d vector to represent updated
position;
Set new position x value as current x position
* new x velocity * time elapsed;
Set new position y value as current y position* new y velocity * time elapsed;
Assign new position to particle;
Assign new velocity to particle;
It becomes apparent that the implementation
of a Euler Integration is very simple and can
be developed easily. Some problems with this
method are also becoming clear. Because the
Euler method only uses the first two terms of
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
10/32
Page 10 of32 Sean Robinson 2011
the Taylor Series Expansion, it is classified as a
First Order Method. This means it may lack
the accuracy of others that utilise a deeper
range in this system (8).
One way of improving this accuracy would be
to implement multiple iterations such as with
the Runge-Kutta solution, which is covered
later in this paper. This would allow an
improvement over the basic Euler from a first
order, to an Nth order depending on how
many iterations are made. This system has
increased overhead as it is looping multiple
times, this would need to be weighed against
accuracy in order to balance both criteria for
the specific problem.
One possible solution is suggested by Boesch
(9). He suggests using the looping method
because it divides the time step into uniform
sections, each section now reduces the
integration error as we are integrating a
smaller section. This is most useful when
there is a large integration as the variance is
dramatically reduced. This solution is quite
interesting as the advantages of Eulers
efficiency are kept, while dramatically
reducing the integration error.
Below is a code example for a potential Euler
Implementation in C++ based on Golgobots
(8).
void updateparticle(double telapsed,
*particle currentparticle) {
2dvector newvelocity = new
2dvector();
newvelocity.x = telapsed *
currentparticle->acceleration->x;
newvelocity.y = telapsed *
currentparticle->acceleration->y;
2dvector updatedposition = new
2dvector();
updatedposition.x = (telapsed *newvelocity.x) + currentparticle->x;
updatedposition.y = (telapsed *
newvelocity.y) + currentparticle->y;
currentparticle->position =
updatedposition;
currentparticle->velocity =
newvelocity;
}
2.VERLET INTEGRATION:Perhaps a misnomer, Brun, V (10) says that the
Norwegian Mathematician and Physicist Carl
Strmer used Verlet Integration in his
Astrophysical work on aurorae many years before
Verlet published. Verlet Integration is also calledStrmers Method for this reason. The original
paper (11) where Verlet set forth his research is
available for further reading (12).
Verlet is very similar to Euler, but has some slight
variation. It is more compact as it does the
necessary calculations in a single equation. It can
achieve this as it does not store the particle
velocity, but computes it on the fly. As the velocity
of the particle is not stored, this attribute is not
included when developing a vector class.
The most basic version of Verlet integration
involves simply adding Taylor Expansion for the
current step in the iteration with the previous time
step, Van Verth also gives the equation for this
method (13).
Y(t+h) + y(t-h) = y(t) + hy(t) + ((h^2)/2)y(t) +
+ y(t) hy(t) + ((h^2)/2)y(t) -
As velocity is not used as a stored variable
anymore, this solution should not be used for
systems where velocity is used in other
calculations. The velocity can be estimated, but
this may be inaccurate and would be more
inefficient than simply storing the value.
One of the reasons that Verlet integration will be
discussed is the accuracy. According to Dummer
(14), Verlet integration is 4th order accurate. It
has already established that Euler is only 1st order
and Runge-Kutta 2 is only second order.
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
11/32
Page 11 of32 Sean Robinson 2011
While a far greater accuracy can be obtained from
using a higher order Runge-Kutta, the substantial
increase in computation may be something that is
too high to ignore. By comparison, a basic Verlet
implementation is very quick to compute and can
achieve a very high level of accuracy.
An interesting use of Verlet integration was
suggested by Kai-Alesi et al (15), it was
suggested that if rigid bodies are also present,
then the Verlet method can be applied to each
bodies centre of mass and/or spring attachment
points.
In order to demonstrate the improved accuracy of
Verlet over Euler, some basic calculations can be
used to see how an object would react whenutilising Euler methodology. This can then be
compared against the same object with Verlet
integration applied; these can be then be
compared against the actual values of where the
object should be according to Newtonian physics.
An experiment will be devised where the position
of a body over time is calculated as it is dropped
from a finite height. The value 9.82 for
acceleration (a) due to gravity is used and the
object will be dropped from a height (y0) of 1000
metres. Time steps of 1 second are planned. The
values and equations are synopsised below.
A = 9.82 m/22
Y0 = 1000
dt = 1
Height at t = y0 + v0t + (1/2)a0t2
The formula for calculating the position at these
time steps becomes:
Y(t) = 1000 + (0*t) + ((1/2)*(-9.82)*t2)
= 1000 4.91t2
After breaking down our time step into blocks, the
following table is generated, which indicates the
objects position at uniform times within the step.
To the side is a table indicating where the object
would actually be.
Euler Method Actual Trajectory
Time Position Velocity Time Position Velocity
0 1000 0 0 1000 0
1 1000 9.82 1 1000 9.82
2 990.18 19.64 2 980.36 19.64
3 970.54 29.46 3 950.9 29.46
4 941.08 39.28 4 911.62 39.28
5 901.8 49.1 5 862.52 49.1
6 852.7 58.92 6 803.6 58.92
7 793.78 68.74 7 734.86 68.74
8 725.04 78.56 8 656.3 78.56
9 646.48 88.38 9 567.92 88.38
10 558.1 98.2 10 469.72 98.2
11 459.9 108.02 11 361.7 108.02
12 351.88 117.84 12 243.86 117.84
13 234.04 127.66 13 116.2 127.66
14 106.38 137.48 14 -21.28 137.48
15 -31.1 147.3 15 -168.58 147.3
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
12/32
Page 12 of32 Sean Robinson 2011
Here, the error generated by using the Euler
method is apparent. This can be seen above
where the graph shows exactly how both systems
would plot the object.
In order to demonstrate the accuracy of Verlet,another set of values is included that represent
how this method would plot the trajectory of our
object. Here, it is shown that Verlet is accurate as
long as the acceleration remains constant.
The Verlet method will use the same constants
described above, but will utilise the formula
previously mentioned and use its own values. A
difficulty in using Verlet Integration is that time
steps are not controlled as well as with Euler,
Dummer describes it as being a Non-Starter (14).
To this end, the initial values must be set up
independently. Verlet needs two steps to begin
working, so it must be backtracked from the initial
starting point in order to obtain these values.
Yi yi-1 = vi-1 * dti-1 + 0.5 * ai-1 * dti-1 + dti
Integration can now be used to determine vi and
load this back into the equation.
Vi = vi-1 + ai-1 * dti-1
Yi yi-1 = (vi-1 + ai-1 * dti-1) * dti-1 + 0.5 * ai-1 *
dti-1 + dti
Several other errors that can come with Verlet
integration are now apparent. In order to utilise
the basic method, it must be assumed that each
time step and acceleration value will be constant
throughout the experiment. This will not work for
more complex systems but there are steps that
can be taken to remedy this to certain degrees,
these will be discussed later. For now, the formula
below will be used and then plugged back into the
initial equation.
Yi - yi-1 + a * dt * dt = vi * dt - 0.5 * a * dt * dt + a
* dt * dt
Yi+1 = yi + (yi yi-1) + a * dt * dt =
Y+1 = 1000 + (1000 1000-1) + 9.82 * 1 * 1 =
1008.82
The y+1 starting point value is now available. By
utilising the Verlet step equation of: newx =
2(current) oldx + (acceleration * dt * dt), a plot
table is generated.
Verlet Integration
Time Position Velocity
-1 1008.820 1000
-400
-200
0
200
400
600
800
1000
1200
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Actual
Euler
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
13/32
Page 13 of32 Sean Robinson 2011
1 981.36
2 952.9
3 914.62
4 866.52
5 808.6
6 740.86
7 663.3
8 575.92
9 478.72
10 371.7
11 254.86
12 128.2
13 -8.28
14 -154.58
15 -310.7
It can be immediately seen that Verlet integration
has a much higher accuracy score than by simply
using Euler. This is demonstrated on the graph
below.
Despite the accuracy now achieved, there is no
ignoring the issue that became apparent earlier.
For this system to be accurate, both the time step
and acceleration need to be constant. This is
easily managed when simply explaining the
process, but where this needs to be used to
represent a real world solution, it becomes more
fragile. When attempting to model objects in a
virtual world, the time step is going to vary due to
the screen refresh rate. It is also unlikely that the
acceleration will remain constant as the user will
be using varying degrees of energy to power the
bicycle and the world terrain itself will become a
factor. Correcting for varying acceleration will bediscussed first.
In order to modify the equation to account for this
deviation, a basic harmonic oscillation system will
be looked at. This system is based on Isaac
Newtons second law of motion. The second law
was first described in Newtons seminal work
Philosophi Naturalis Principia Mathematica
(Mathematical Principles of Natural Philosophy)
(16), an English translation of this manuscript is
available from Google Books (17). Quotations
within this paper have been refrained from, but
the following describes the basis for what most
modelling attempts to achieve.
The alteration of motion is ever proportional to
the motive force impressed and is made in the
direction of the right line in which that force is
impressed
Sir Isaac NewtonThe Mathematical Principles of Natural Philosophy
(1687)
-400
-200
0
200
400
600
800
1000
1200
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Actual
Euler
Verlet
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
14/32
Page 14 of32 Sean Robinson 2011
The origin of these systems or the mathematics
behind them will not be discussed in detail as this
paper is only interested in how they directly apply
to a situation. Newtons Second law will be used,
solved and the results used to apply new measures
to the Verlet method in order to overcome the
restrictions derived from a variance in
acceleration.
The equation is:
= =
=
Here, F is equal to the force pulling an object, m isthe mass of the object, x gives the position and k is
the constant defined by Newton. This is simplified
for a basic system to:
= , =
For simplicity, mass is ignored for now and the
assumption that it is 1 is used. Giving the
following:
=
The object is starting at position 1000 (y) and with
a null velocity (v0 = 0), the solution that is used for
the plot becomes:
=
This formula can now be used to approximate the
trajectory of an object when acceleration varies. It
is shown in the data that the Verlet integration
approximation is quite inaccurate now; this isbecause the slight randomisation in the time step
has not been accounted for. The dt is the product
of a random function applied to a standard time
step.
Time A Actual Euler Verlet
Dt Velocity Position Velocity Position Position
0.026799 0 0 -1 0 -1 0 1
0.017896 0.026799 0.026796 -0.99964 -0.0268 -0.99964 -0.0268 0.999115
0.001894 0.044695 0.04468 -0.999 -0.04468 -0.99916 -0.04468 0.9975390.174507 0.046589 0.046572 -0.99891 -0.04657 -0.99908 -0.04657 0.997326
0.143306 0.221096 0.219299 -0.97566 -0.2193 -0.99095 -0.2195 0.940356
0.065715 0.364402 0.35639 -0.93434 -0.35639 -0.95952 -0.357 0.84076
0.024215 0.430117 0.416977 -0.90892 -0.41698 -0.9361 -0.41852 0.780529
0.194272 0.454332 0.438862 -0.89855 -0.43886 -0.92601 -0.44094 0.756206
0.13849 0.648604 0.604075 -0.79693 -0.60407 -0.84075 -0.60428 0.524806
0.031749 0.787094 0.708305 -0.70591 -0.70831 -0.75709 -0.70912 0.328824
0.18079 0.818843 0.730356 -0.68307 -0.73036 -0.7346 -0.73245 0.281361
0.142205 0.999634 0.841273 -0.54061 -0.84127 -0.60256 -0.84138 0.001372
0.054408 1.141838 0.9094 -0.41592 -0.9094 -0.48293 -0.91006 -0.220070.182448 1.196246 0.930672 -0.36585 -0.93067 -0.43345 -0.93364 -0.3025
0.06885 1.378694 0.981605 -0.19092 -0.98161 -0.26365 -0.98174 -0.55948
0.182812 1.447544 0.992414 -0.12294 -0.99241 -0.19606 -0.99524 -0.64563
0.18639 1.630356 0.998227 0.059525 -0.99823 -0.01464 -0.99792 -0.8354
0.165648 1.816747 0.969906 0.243478 -0.96991 0.171421 -0.96597 -0.95844
0.141371 1.982395 0.916483 0.400075 -0.91648 0.332083 -0.91096 -0.99957
0.029471 2.123766 0.850969 0.525216 -0.85097 0.461647 -0.8457 -0.98149
0.156094 2.153237 0.835123 0.550064 -0.83512 0.486726 -0.83135 -0.97158
0.04697 2.309331 0.739456 0.673205 -0.73946 0.617084 -0.73503 -0.88511
0.125581 2.356301 0.707031 0.707182 -0.70703 0.651817 -0.70441 -0.84842
0.034601 2.481883 0.612888 0.79017 -0.61289 0.740607 -0.6114 -0.7283
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
15/32
Page 15 of32 Sean Robinson 2011
0.097476 2.516484 0.585185 0.8109 -0.58519 0.761813 -0.58505 -0.69001
0.054734 2.61396 0.503489 0.864001 -0.50349 0.818855 -0.50523 -0.57161
0.034168 2.668694 0.455469 0.890252 -0.45547 0.846413 -0.4589 -0.49908
0.113073 2.702862 0.424791 0.905292 -0.42479 0.861975 -0.42945 -0.4519
0.139187 2.815935 0.319932 0.947441 -0.31993 0.910008 -0.32655 -0.28727
0.03803 2.955122 0.185392 0.982665 -0.18539 0.954538 -0.19369 -0.07278
0.106171 2.993152 0.147896 0.989003 -0.1479 0.961589 -0.15712 -0.01314
0.083779 3.099324 0.042256 0.999107 -0.04226 0.977291 -0.05336 0.152947
0.086587 3.183103 -0.0415 0.999139 0.041498 0.980831 0.028813 0.281236
0.062274 3.26969 -0.12775 0.991807 0.127747 0.977238 0.113429 0.408695
0.057614 3.331963 -0.18922 0.981934 0.189223 0.969283 0.17379 0.495833
0.111787 3.389577 -0.24545 0.969409 0.245451 0.958381 0.229006 0.57225
0.160512 3.501365 -0.35206 0.935977 0.352061 0.930943 0.333073 0.706651
0.050821 3.661877 -0.49713 0.867678 0.497127 0.874433 0.47343 0.860758
0.077803 3.712698 -0.54056 0.841304 0.540562 0.849168 0.516586 0.898591
0.065553 3.790501 -0.60432 0.796744 0.604317 0.80711 0.579382 0.94536
0.192825 3.856054 -0.65521 0.755446 0.655211 0.767496 0.629693 0.973853
0.082889 4.048879 -0.78784 0.615886 0.787835 0.641155 0.753324 0.997296
0.051159 4.131768 -0.83612 0.548544 0.836122 0.575852 0.801056 0.979327
0.098683 4.182926 -0.86308 0.50507 0.863079 0.533077 0.828327 0.95994
0.189642 4.281609 -0.90864 0.41758 0.90864 0.447906 0.872528 0.905202
0.051977 4.47125 -0.97107 0.238808 0.971067 0.27559 0.924791 0.740704
0.153102 4.523228 -0.98216 0.188035 0.982162 0.225117 0.936492 0.683476
0.07822 4.67633 -0.99935 0.036051 0.99935 0.074746 0.947936 0.490047
0.102014 4.754549 -0.99911 -0.04215 0.999111 -0.00342 0.947668 0.379577
0.115507 4.856564 -0.98962 -0.14368 0.989625 -0.10535 0.936921 0.227176
0.165815 4.972071 -0.96647 -0.25677 0.966472 -0.21966 0.91155 0.047812
Static dt:
-1.5
-1
-0.5
0
0.5
1
1.5
1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49
Verlet
Actual
Euler
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
16/32
Page 16 of32 Sean Robinson 2011
Random dt:
The second issue with Verlet will now be looked at,
accounting for a slight deviation in time step each
cycle. By solving this, Verlet integration can be
used in a simulated world.
The solution to this issue is not a constant, more a
way of increasing the accuracy of approximations
by utilising averages. The function in a pseudo-
code style would be.
+
+
Where:
Pp Previous Position
Ppp Previous, Previous Position
Ct Current Time
Pt Previous Time
Ppt Previous, Previous Time
Pa Previous Acceleration
By creating a new column for a TCV, it is shown
how accuracy is affected.
-1.5
-1
-0.5
0
0.5
1
1.5
1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49
Verlet
Actual
Euler
-1.5
-1
-0.5
0
0.5
1
1.5
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51
Verlet
Actual
Euler
TCV
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
17/32
Page 17 of32 Sean Robinson 2011
As a final, small exercise, a primitive average was
calculated to find out how accurate the different
methods were overall. The absolute differences
for each method from the actual were averaged.
This is only a single result as the dt is randomised
every time an action is taken on the spread sheet.This changes the data every time; it does show,
however, an overwhelming consistency in the
graph, data and final accuracy ratings.
Euler Verlet TCV
0.02194 0.347227 0.003489
This is the end point with Verlet; the mechanics of
the system have been explored, advantages and
disadvantages explained, how these factors affect
data have been demonstrated and then solutions
to the shortfalls documented. With these
solutions, Verlet integration has been successfully
shown to be more accurate than Euler, have
almost the same cost and can be modified to
account for diversity in acceleration and time step
values that would otherwise cause serious issues
with modelling.
A step further can now be taken and the final
integration of the main triumvirate explored.
3.RUNGE-KUTTA:Runge-Kutta is an integration method that
uses a trial step at the midpoint of
integration; this is used to remove the error
associated with lower order terms within the
Taylor Expansion (18). There is a whole family
of these methods, but the most popular RK4
method will remain the focus.
This method was first described in 1901 by
Runge, C (19) and then modified by Kutta, M
(20) to become the RK4 which will be looked
at in this paper. As the method is more
complex than either previously discussed, this
will be looked at from a programmers
perspective. This will move past the calculus
and show how this method can be utilised for
the specific problem described
The overview of this method is that an
attempt to detect curvature in an integration
by evaluating derivatives is made, this is done
several times during a time step and then a
weighted average to generate a best
approximation over the dt is used.
To begin, a combination of position, velocity
and values are used to give a state. The
position could either be a single point in 1D
space or something more complex like a
vector, which will give the position in a 3D
world.
As samples are taken throughout the time
step, derivatives of certain values will be
stored. These values will be the derivative of
the position, the velocity and the derivative of
the velocity, which will give the acceleration.
The heart of the RK4 is the method used to
approximate the state as time steps are
advanced. After approximation is known, the
derivatives can be recalculated.
The approximated state will be the result ofthe following:
= +
= +
The derivatives are then recalculated:
=
=
This entire process will repeat four times, this
gives the RK4 method. It is this multiple
sampling method that affords greater
accuracy. It is essentially an average of
several Euler samplings.
In the code, a function able to evaluate these
new states and derivatives will be defined and
called several times. This function will simply
perform the above calculations using theprevious derivative each time. When all four
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
18/32
Page 18 of32 Sean Robinson 2011
derivatives are known, the best
approximation can be calculated using a
weighted total of each derivative. With this
single value, this can be used to advance
position and velocity in an accurate manner.
An RK4 system has been plotted in Excel as
was done for the other methods, below is the
pure data calculated.
Dt Time Position D1 D2 D3 D4
0.09229771 0 1 -0.09229771 -0.087586303 -0.088416895 -0.073031277
0.114414475 0.09229771 0.913777436 -0.098704957 -0.097925654 -0.098079839 -0.0791919
0.165939801 0.206712184 0.818792796 -0.101501139 -0.126185007 -0.119943703 -0.092499624
0.155279604 0.372651985 0.704416432 -0.09985555 -0.092810212 -0.094246083 -0.07540413
0.123279892 0.52793159 0.612854387 -0.094191088 -0.057893971 -0.063038388 -0.053508798
0.0641516 0.651211481 0.547926953 -0.088060874 -0.024317992 -0.028569396 -0.026347822
0.191193666 0.715363081 0.511229708 -0.083577313 -0.067484888 -0.070398368 -0.057526516
0.076140863 0.906556747 0.441751318 -0.075463175 -0.020381359 -0.023885764 -0.022114276
0.173054026 0.98269761 0.410732701 -0.070979318 -0.041734416 -0.04560659 -0.039141975
0.021438646 1.155751636 0.363265484 -0.064177219 -0.00405493 -0.004947411 -0.004857323
0.170895163 1.177190282 0.348758946 -0.061678773 -0.030676177 -0.034127105 -0.029965373
0.122867024 1.348085444 0.311883828 -0.055955018 -0.018016261 -0.020751499 -0.019037343
0.116164034 1.470952468 0.286462515 -0.051760974 -0.014592953 -0.016923362 -0.015696131
0.172410143 1.587116502 0.264714225 -0.048075513 -0.018835044 -0.02133542 -0.019286096
0.026451873 1.759526645 0.240097136 -0.043850144 -0.00238852 -0.002889811 -0.002847104
0.137012337 1.785978518 0.230554818 -0.042124584 -0.011500642 -0.01332289 -0.012405633
0.188907845 1.922990855 0.213191938 -0.039066013 -0.013725137 -0.015639917 -0.014300558
0.012472451 2.1118987 0.194509158 -0.035741956 -0.000756617 -0.000918403 -0.000913179
0.175453097 2.124371151 0.187841629 -0.034517167 -0.009980697 -0.011502231 -0.010681459
0.184098438 2.299824248 0.173147548 -0.031869179 -0.008959485 -0.010333933 -0.009619426
0.127204088 2.483922686 0.159801642 -0.02944508 -0.005293763 -0.00622227 -0.005939624
0.168220476 2.611126774 0.150065513 -0.02766483 -0.006192365 -0.007215323 -0.006813677
0.035425706 2.77934725 0.139849866 -0.025793563 -0.001133882 -0.001366462 -0.001350727
0.140552761 2.814772956 0.13449237 -0.02480682 -0.00416559 -0.004903937 -0.004696162
0.176624484 2.955325717 0.12655203 -0.023347901 -0.004642695 -0.005432662 -0.005163005
0.174352007 3.131950201 0.118441761 -0.021856139 -0.004019587 -0.004716022 -0.004498828
0.046385772 3.306302208 0.111137396 -0.02051091 -0.000942021 -0.001134047 -0.001120474
0.114685944 3.35268798 0.106840143 -0.019718247 -0.002153179 -0.002561601 -0.002490057
0.04933705 3.467373924 0.101567165 -0.018746031 -0.000837315 -0.001008145 -0.000996413
0.121062244 3.516710974 0.097661605 -0.018025468 -0.001900121 -0.002261976 -0.002200952
0.138490707 3.637773217 0.092903169 -0.017147818 -0.001967683 -0.002338212 -0.002269755
0.085821459 3.776263924 0.088231609 -0.016286041 -0.001100042 -0.001318694 -0.001295659
0.171269276 3.862085384 0.08449508 -0.015596547 -0.002013718 -0.00238636 -0.00230811
0.133564322 4.03335466 0.080044278 -0.014775294 -0.001409561 -0.001680902 -0.001639781
0.189023202 4.166918982 0.076278278 -0.014080277 -0.001811794 -0.00214715 -0.002076995
0.005149927 4.355942184 0.072265751 -0.013339732 -4.43076E-05 -5.37456E-05 -5.36986E-05
0.050182845 4.36109211 0.070000829 -0.01292164 -0.000405113 -0.000488865 -0.000484861
0.154420839 4.411274956 0.067468419 -0.012454196 -0.001158091 -0.001381597 -0.001348637
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
19/32
Page 19 of32 Sean Robinson 2011
0.105277629 4.565695795 0.064321384 -0.011873329 -0.000717634 -0.000861325 -0.000847843
0.06263202 4.670973424 0.061674869 -0.011384823 -0.000392535 -0.000473403 -0.000469145
0.144425267 4.733605444 0.059410562 -0.010966855 -0.000839937 -0.001005089 -0.000985248
0.106998589 4.878030711 0.056803536 -0.010485632 -0.000568873 -0.000683554 -0.000673934
0.189177658 4.9850293 0.054526133 -0.010065245 -0.000926776 -0.001105804 -0.001079679
0.198338238 5.174206958 0.051991119 -0.009597306 -0.000883423 -0.001054078 -0.001029183
0.044870554 5.372545196 0.049574204 -0.009151162 -0.00018171 -0.000219736 -0.000218593
0.170025064 5.417415751 0.047878762 -0.008838192 -0.000642256 -0.00076909 -0.000754669
0.097824316 5.587440815 0.045809504 -0.00845622 -0.000338274 -0.00040754 -0.000403294
0.054924425 5.685265131 0.044084313 -0.008137759 -0.000175892 -0.00021263 -0.000211427
0.073219741 5.740189556 0.042563275 -0.007856983 -0.00021858 -0.000263932 -0.000262012
0.180591984 5.813409297 0.041049272 -0.007577505 -0.000501445 -0.000601195 -0.00059091
0.011627978 5.994001281 0.039320323 -0.00725835 -2.96246E-05 -3.59285E-05 -3.58899E-05
0
0.2
0.4
0.6
0.8
1
1.2
0
0.
370505942
0.560467842
0.
87485585
1.
055720134
1.
246652093
1.
4851065
1.720910701
1.
804827196
1.
964739699
2.
08191124
2.
33737549
2.
498610598
2.
62348036
2.758695435
2.
860150733
3.
044864439
3.
164707173
3.514114689
3.
620559527
3.753624642
3.
926642677
4.
1241743
4.
303745384
4.584232267
4.
914369508
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
20/32
Page 20 of32 Sean Robinson 2011
University of Glamorgan
The graph that is used to plot this shows a
very pleasing and smooth curve, this indicates
that the approximations are helping to ensure
that the
curvature of the integration is as clear as
possible to ensure a smooth running end
result.
If this is compared with the previous examples
that use a randomised dt, there is a clear
distinction favouring the RK4 method. This
coupled with a very high accuracy rating and
the possibility to extend the method for evengreater clarity presents a very strong
contender.
The main factor that was considered when
comparing RK4 with others is the extension
capabilities. Some systems may require that
vectors are modelled, not simply particles. To
this end, the method must extend whatever
solution chosen to use vectors. This is actually
something that can be implemented rathereasily with RK4; the other variables such as
extra dimensions or spring components are
included as extra differential equations and
combined into the integration (21). This
possibility will not be explored further in this
section.
Fiedler provides a more detailed article
explaining Runge-Kutta methodology, his site
is also an excellent resource for further gamesphysics. (22)
4.CONCLUSIONS:Throughout this paper, numerous methods
for integration within a system have been
discussed. Each method has been carefully
described in terms of an overview,
mathematics and then some aspects to
consider when programming.
In addition to a discussion for each method,
their mechanics have been demonstrated and
experiments have been devised that indicate
their usefulness with regards to accuracy,
simplicity and computational cost.
Each of these methods has been evaluated
against each other and all realistic
improvements at this stage have been
considered in order to achieve an accurate
decision. It has been decided that although
high levels of accuracy can be achieved
through the use of Verlet, or even high
iterations of Euler; a Runge-Kutta method
using four iterations provides a very high level
of accuracy, even surpassing higher order
Verlet. In addition, RK4 gives the option of
quite easily expanding the mathematics in
order to consider objects as vectors rather
than particles. RK4 has been proven to work
well for a variety of inputs and that it can
handle randomised time steps very well, the
inclusion of derivative approximations even
generates a much smoother curvature than
other methods.
This paper concludes that while there may be
more accurate or quicker solutions, RK4
provides a highly stable and balanced model
that can be applied to a variety of situations
and is recommended for a variety of systems,
including a means to mathematically model
objects propulsion throughout a virtual world.
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
21/32
Page 21 of32 Sean Robinson 2011
CONSTRAINT MODELLING
Constraint modelling is the way in which the relationships between objects affect the way in which they are
modelled. As this is type of simulation can be quite complex, a report into the feasibility of its usage was
generated.
RESEARCH AND FEASIBILITY ASSESSMENT OF
CONSTRAINT MODELLING FOR USE IN THE CONTINUOUS
SIMULATION OF A BICYCLE
SEAN ROBINSON
Abstract Constraint modelling is the way in
which mathematics can be applied to
simulated objects in order to model them
accurately in a virtual world. By applying
constraints, a hierarchy of objects is held
together and will move with each other in an
appropriate way. This paper will explore the
method behind this modelling and discuss
its suitability for application within a time
constrained situation, where the objective iscontinuous simulation. The output of this
paper will be used to determine what
method, if any, should be used in this
condition. This paper will focus on the
specialised Constraint Programming
method of constraint modelling.
1.INTRODUCTIONConstraint modelling was first developed afterstudies of the engineering design process
were undertaken and a solution was required
that covered a variety of subsets that govern
feasible designs (23). Constraint modelling is
the way in which conditions are specified that
must be true within a design. Each set of
constraints for a particular item forms a
subset of possible solutions (23). These
subsets become increasingly smaller as more
constraints are added. Once all constraints
are included, then the subset contains
potential solutions for the problem that
satisfies all criteria specified and the most
appropriate can be chosen by the designer for
use within the system.
These constraints can be anything from
simple observations such as comparing a
timescale with minimum achievement or can
be more complex. A basic example of a
technical constraint within a system could be
that when building a house, the walls should
be perpendicular to the floor. More
constraints can then be attached to the
subset, such as the four walls must link
together and form a cube (24).
A constraint that is more appropriate to this
instance is that when modelling a compound
of rigid bodies, the angles between the
individual components must lie within a
certain range.
When a subset has been built and there exists
no solutions, it is the designers charge to
decide which of the constraints may be
relaxed or removed. Should there exist no
candidates, then an alternative method
should be considered.
2.CONSTRAINTS
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
22/32
Page 22 of32 Sean Robinson 2011
In order to generate solutions, constraints
must first be identified. This can be a difficult
proposition as there is only a general
guideline to consider when developing
constraints. As mentioned, these can be
relaxed heuristics or implicit declarations that
must be conformed to.
There are many variations of constraints, each
with individual and collective properties.
Properties to consider could be whether a
variable value is known in advance, how
relationships are added together, if
constraints share variables or what variables a
relationship owns.
When considering constraints appropriate to
a solution, the type of constraint most
applicable to a solution should also be
considered.
Types such as Boolean, linear or equality
checks form a basic subset of types; to which
arithmetic can be added for more complex
relationships. Ceberio, M considers the
arithmetic subset to consist of types such as
integer and real intervals, real sets and finite
integer domains. (25).
3.CONSTRAINT SATISFACTIONPROBLEMS
CSP is a method in which a set of variables is
defined, so that each represents a constraint
to be modelled. Each variable has a subset of
possible values that they can hold. In addition
to the potential values (range), constraints are
given to control which range is acceptable
(26).
There are several steps that need to be
considered for each solution, these steps will
define what sort of solution is required. It
may be the case that a problem only requires
that there exists a solution, others may
require an optimal or several optimal
solutions. Certain cases may test the solution
for a given value of good; others may require
that every solution to the given problem is
found.
We can categorise CSPs into the broad terms
of integer, real, Boolean and symbolic; these
specify the type domains that the variables
range over.
A useful way of modelling CSP is through the
use of a constraint graph. A constraint graph
uses a set of variables and their domains to
show how the constraints applied generate
and modify relationships between them (27).
4.CONSTRAINT PROGRAMMINGWith a set of rules that apply generally and
specific rules for individual components of a
model, it becomes apparent that when
solved, constraint modelling transfers quite
well onto a computer environment. The
decomposition of a problem, mapping a
solution to it and then completing the
mathematics are the most time consumingareas of modelling. Once they are completed,
the task is to translate that solution into code.
A common example of constraint
programming is the map colouring problem.
The MCP is where there is an area divided into
separate pieces by boundary lines. The goal is
to colour so that none of the neighbours have
the same colour.
A typical start state is illustrated below.
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
23/32
Page 23 of32 Sean Robinson 2011
In this example, the different sections
represent variables in the system, each of
these systems will also have a set of values
they can take called the domain. The domain
can be almost anything, but a colour type will
be used here for simplicity. With this data set,
constraints need to be applied so that a
desired outcome is achieved.
This data can be synopsised as:
Variables = {A, B, C, D, E}
Domain = {Red, Blue, Yellow, Green}
Constraints:
A!=B, A!=C, A!=D
B!=C, B!=E
C!=D, C!=E
D!=E
This data can then be processed in whichever
way is most appropriate to the situation. This
can be either: purely mathematical, modelled
in mathematical software or even
programmed.
Whichever method is used, the outcome will
be a list of solutions that conform to the
constraints. One example is below.
5.BICYCLE CONSTRAINTSA bicycle can be considered in many different
ways; from the basic rigid body, to a complete
decomposition of parts. When each part is
specified separately, a much more complex
picture is observed. Not only does each part
need to have its own degree of movement,
they must connect with each other in an
appropriate manner and maintain that stable
relationship throughout the simulation.
When there are complex relationships
between parts, a further complication arises;
how to model compound parts within the
object, this aggregation of parts becomes
recursive as compounds link with other
compounds and parts within those
compounds link within parts inside its
compound and those in other compounds.
Now the bicycle has become a highly technical
and delicately balanced object that must
maintain many relationships with many
variables and each with many domains and
domain subsets.
A more appropriate example than the MCP
would be that of a steering shaft that governs
the handlebars on a bicycle. The entire front
of the bike; handlebars, front wheel, front
A
B
C
D
E
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
24/32
Page 24 of32 Sean Robinson 2011
suspension, head tube and front brake can be
thought of as a single object when rotation
around the Y axis due to steering is
considered. Each object within this variable
also owns its own set of variables.
Imagine the image above a top down view of
a set of handlebars on a bicycle. The striped
oval represents the wheel, the purple bar is
the handlebars and the green circles are the
front shock absorbers attached to the fork.
While this object is made up of several
components, it can also be considered a single
object that rotationmust be applied to when
steering. When modelling the steering it is
important to consider how much of a turning
degree is going to be used. Constraints can be
used to specify this.
Variables = {Bicycle_Front_Steering}
Domain = {0..360}
Constraints:
Bicycle_Front_Steering < 45
Bicycle_Front_Steering > 315
This set of rules governs how far the steering
is able to turn in both directions along the Y
axis.
A set of rules like this one will need to be
developed for each individual component and
also every compound that is used within the
model. Other basic constraints to consider
are shock absorber compression value, brakeapplication value, pedal turning speed and
wheel turning speed. A second compound
that would also need attention would the
entire object without the wheels as the
movement along the Y axis front the shock
absorbers would affect the entire frame but
not the wheels in a basic example. In a real
world situation, the wheels would also be
pressed into the ground as the suspension
compresses.
6.CONCLUSIONSThis paper has introduced Constraint
Modelling, shown how to specify constraints
and explained the different types available.
The method of utilising constraints for specific
solutions has been discussed. Constraint
Programming has been the focus of this paper
and it has become apparent how models can
be mapped to a computer and then solved
once the initial setup has been completed.
The difficulty in utilising constraint
programming for a bicycle simulator is that it
is difficult to know how far to decompose aparticular problem. Considering a bicycle as
component parts and compounds of
components makes the output significantly
more complex and difficult to achieve. It is
the findings of this paper that while
component and compound constraint
modelling is a very attractive method of
creating a well simulated object, it is beyond
the scope of small scale projects and should
remain confined to the larger systems that
span longer time frames and utilise significant
resources.
By devoting huge blocks of time and resources
to highly complex modelling features, the core
components of a project will suffer. The
solution is to specify that a project will utilise
a more basic model such as a rigid body,
complete it to satisfaction and then begin
work on improvement. Should no time
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
25/32
Page 25 of32 Sean Robinson 2011
remain then the initial research and
development ideas can be documented for
future users to explore.
A concession within this realm is that of
simplistic constraints such as those governing
the turning degree of the steering compound
or limits to revolutions of the wheels and
pedals. These are simple tests against an
objects relative position or movement and
take very little computational and
development time.
BICYCLE PHYSICS AND MECHANICS
Throughout the research in this project, the goal has always been appropriate accuracy balanced
against cost and feasibility. Modelling the specific components of the bicycle in a way that truly
represents the real world mechanics would enable to bicycle to respond in a very accurate manner.
A study into the way in which bicycle components actually work and affect each other was carriedout. This report explores the ways in which these solutions can then be represented in a computer
environment and finally gives recommendations base on these findings.
ASSESSMENT OF BICYCLE PHYSICS AND MECHANICS AND
THEIR USAGE WITHIN A CONTINUOUS SIMULATION
SEAN ROBINSON
Abstract This paper will consider the
relationships between the component parts
of a bicycle and how their relationships with
other parts come together to form a whole
object. When considering these parts,
certain physics and mechanics need to be
understood and applied so that the object is
appropriately functional. By understanding
how these rules are applied and how theyaffect the bicycle, it is possible to map the
functionality to a computer simulation. This
paper will not concern itself with the
mechanics of each and every part as the
outcome is simply to provide a higher level of
understanding for the machine as a whole
and to demonstrate limited rules that should
be considered in order to generate a realistic
model.
1.INTRODUCTIONBicycles are complex machines in the real
world; they are made up of many components
that work in unison with each other in order
to provide a functional machine. These
components also form compounds with each
other, with many parts being components in
several compounds, these compounds thenform other compounds and so on. Each part
in a bicycle will have relationships to the
surrounding parts; these relationships specify
how the bicycle reacts.
Some relationships simply specify that parts
must be connected and must maintain a
locked relationship, such as the separate
pipes that form the frame. Other parts need a
certain degree of movement but mustmaintain a locked relationship with other
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
26/32
Page 26 of32 Sean Robinson 2011
components. The wheel is a good example of
this. A wheel must have a certain degree of
movement for rotation when the bicycle is in
motion or turning, but must also maintain a
stable relationship with the brakes, shock
absorbers and with certain parts of the frame
across some axis.
Each of these rules that specify motion of
some kind must have constraints applied that
limit the motion, but also criteria that
initialise that motion and outcomes of that
motion should be specified.
Maintaining the wheel example, it is
understood that turning the pedals will create
a chain of effects that will result in the wheel
being turned. The wheel must turn at an
appropriate rate to the pedal speed, but will
also be affected by other factors such as the
terrain type, degree of incline and whether
brakes are applied. The outcome of this will
be a force propelling the wheels that has been
modified by the other external factors; this
will then be used to move the bicycle to a new
position.
This is simply one example of how the
mechanics and physics of a bicycle affect how
it
behaves in the real world. There are many
behaviours, such as this, to model in order to
build a truly accurate, virtual representation.
This paper will document those behaviours
which are considered critical in order to
develop an appropriate level of detail for a
basic simulation.
2.BICYCLE PARTSThe virtual bicycle will be decomposed to an
appropriate level so that each part owns a
specific, critical constraint for the machine.
These parts may not simply be components
in a real bicycle, but will be treated as a base
level component in the simulation.
The most critical example
of this is the front section
of the bicycle shown to
the side.
All of these parts can be
considered a single
object for the purposes
of steering the machine.
In order to accurately model even a basic
simulation, the degree of turning must be
considered.
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
27/32
Page 27 of32 Sean Robinson 2011
3.COMPONENT PHYSICSa. STEERING
When considering the steering of a bicycle,
there are two main areas of focus. The initial
calculation is that of the turning radius, this is
the degree of rotation that the bicycle will
take following a user moving the steering
column. For a bicycle in an upright position,
the radius of a turn can be calculated by the
function (28):
=
Here, w is the wheelbase of the object (The
distance between the centres of the wheels
along the x axis), is the steering angle and
represents the caster angle (The angle from
which the forks or shock absorbers are
displaced from the perpendicular).
When bicycles turn, a new type of motion
becomes apparent, this is the lean (or Yaw).
The lean of the machine is calculated using
the laws of circular motion and is calculated
from the following equation (29).
=
)
Here, v is the speed of the bicycle, r is the
radius of the turn and g equals the constant
acceleration due to gravity, 9.82.
Once lean is taken under consideration, the
previous equation to calculate the turn radius
becomes invalid, it must now be updated to
correctly represent how lean factors into the
mathematics (30).
=
This equation is very similar to the one
presented above, but uses another value, torepresent the lean angle.
To add further complexity, the lean angle
previously computed is not a complete
solution. When calculating the actual lean,
other criteria such as tyre thickness and
centre of mass must be considered. The
equation above is altered only to add anothervalue, this is the amount that the lean must
be increased due to these factors.
The increase in lean is given by (30):
.
.
Where h is the height of the centre of mass
for the object and t is the thickness of the
tyres being used.
By adding this result to the previously
calculated lean value, and then applying this
outcome to the modified turning radius
function, the actual angle that the bicycle will
rotate due to steering will be solved.
b. PEDALLINGPedalling a bicycle is usually quite a complex
matter as it involves linking together a seriesof events by piping equations in order to
generate a final value that is used to calculate
forward movement.
The overall force used to propel the bicycle is
a function of its current speed and pedalling
power output (31).
=
Where Fr is the resultant force, Pp is the
power output and S is the current speed of
the bicycle in km/h. The Pp wattage is
different for every circumstance and person,
but for simplicity, Coggan suggests an average
of 50 100w and provides spread sheets that
can be used to calculate wattage per kilogram
(32).
This can then be used in Newtons second law
to calculate the acceleration (33).
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
28/32
Page 28 of32 Sean Robinson 2011
=
Even with the acceleration calculated,
external factors such as wind resistance and
friction must be applied in order to give acomplete solution.
c. SUSPENSIONSuspension within a bicycle can be a very
complicated matter as there are an enormous
amount of variables to consider when modelling it.
There are also a wide variety of types, most of
these fall into either rigid (No suspension), Hardtail
(Only front suspension) or Full Suspension (34).
In a very basic system, it should only be the
concern to model the suspension values based on
an average normal load and then modify this value
based on environmental factors.
A suspension value of 25 33% of maximum travel
with a maximum travel of 150mm is one set of
values set for modern trail bicycles (34). In order
to keep a model within the realm of feasibility, this
value could be used as a starting point for
calculations, it can then be modified using afunction of the current gradient. While this is not
strictly accurate, the study of suspension in detail
is beyond the scope of this paper, more
information can be obtained from rdrop.com (35)
or everythingbicycling.co.za (34).
d. BRAKINGBraking on a bicycle occurs when the brake
pads are pressed against the wheel in order to
create friction. There are several factors to
consider when defining brake power, which
affects the deceleration.
In addition to the friction between the tyres
and the surface, which is discussed later in the
paper, the kinetic friction between the brake
and tyre and the potential for pitching must
be considered. Whitt, F gives the maximum,
safe deceleration concerning these factors as
0.5g (36). Using this as a maximum safe value,
a basic simulation could take a factor of this
as defined by the percentage of brake power
applied and result in a deceleration value that
can be applied to the machine.
E. TRAILTrail is the distance between the line
perpendicular to the floor from the centre of
the front wheel to the point on the ground
that continues the line following the head
angle.
This distance is crucial in maintaining a stable
machine and most modern bicycles usually
employ a positive trail, that is; a trail which
extends forwards from the perpendicular line
made with the ground and the centre of the
front wheel (36).
As this paper is only considering a basic model
and does look at the more advanced
mechanics and physics behind the movement
of bicycles, trail will not feature heavily here.
But the function below shows how it can be
calculated (37).
=
Here, is the wheel radius, is the head
angle and is the fork offset, sometimes
known as rake.
4.GENERAL PHYSICSa. GRAVITY
In a complex model, bicycles will not simply to
moving along a perfectly flat terrain, there will
be minor bumps and long hills. In order to
accurately model the way in which the slopes
affects a rider in these conditions, gravity is
calculated. The function to calculate the
power needed to overcome gravity is (38):
=
8/3/2019 Using Mathematical Modelling to Create a Continuous Simulation of a Bicycle
29/32
Page 29 of32 Sean Robinson 2011
In this equation, w is the watts required to
overcome gravity, G is standard acceleration
due to gravity, P is the weight of the object,
is the slope percentage and V is the current
velocity.
b. FRICTIONWhen riding a bicycle, one of the most
fundamental forces being applied is that of
friction. This force slows the rider through the loss
of energy from the wheel contact points with the
floor. When calculating the pedalling power, it is
important to account for friction and alter the
output accordingly. Friction is a difficult thing to
calculate as it is different for every surface. A good
approximation of the power required to overcome
friction on a flat surface is given by May (38).
= .
Where w = watts to overcome friction, V is
the velocity in m/s and p is the weight in
kilograms. This wattage must be subtracted
from the pedal power output before
calculating the force.
c. AIR RESISTANCEMuch like friction, wind resistance can be
thought of as a force that slows the rider as
he or she attempts to pass through it. Once
again it is very difficult to calculate but Mayalso provides the formula to calculate it (38).
= +
Here, w is the watts required to overcome air
resistance, is wind resistance, v is velocity
and is wind velocity.
CONCLUSIONS
This report has set out to document a problem defined by the project brief. The overall problem has
been decomposed into specific tasks that require independent research and solutions. By
decomposing these tasks, reports have been generated that address the problem and then evaluate
potential solutions based on the criteria specified. In order to accurately solve these problems, tests
and experiments have been devised in order to prove the effectiveness. By monitoring these
experiments and utilising work previous completed on certain subject areas, solutions to all
problems defined have been output.
These solutions are tried and tested, either th