Anda di halaman 1dari 15

Simulation of Wheel

Introduction
The simulation of objects is an area of vast interest in aerodynamic engineering,dynamics
and animation or visualization objects in computer graphics. The demand for increasingly
realistic visual simulations of complex phenomena is tremendous. The ultimate goal is to bring
the graphics and animations alive. The project is motivated by the recognition that to support
interactive simulations or respond to events occurring in the scene especially motion of the
wheel. Further-more, exhibiting realistic dynamics under the broadest range of conditions,
requires the use of models that are as physically accurate as possible. And, since boundary
conditions largely define a flow field while also playing an extremely important role in object
dynamics and coupling, it is essential to be able to handle complex shaped and moving
boundaries.
What happens when a wheel rotates?
The picture below traces the path (purple curve) of a point on the rim of a rolling wheel. This
curve is called a cycloid.

Fig. 1 : Diagram of a wheel rotating about an axle


A wheel turns clockwise about its axis. We measure its angular velocity in radians per second.
So the number of complete turns per second is /2. If it rotates through angle d in time dt, then
= d/dt
Let a point on the rim of the wheel travel a distance ds in time dt, so v = ds/dt. From the definition of
angle, ds = rd, we get

v = rd/dt, or v = r

Page 1

Simulation of Wheel

Fig. 2 : Points on the rim of the wheel


The diagram shows that all points on the rim of the wheel are travelling at speed v with respect
to the axle, although their directions are different. The top of the wheel is travelling to the right,
the bottom to the left, and so on.
Now let's suppose that the wheel is rolling on the ground--let's imagine it as a bicycle
wheel--and we insist that it is rolling, not skidding. The view we have presented above left is the
view of the bike rider, who is travelling to the right in this case. With respect to the rider, the
position of the axle is fixed, the top of the wheel is going forwards at v, and the bottom of the
wheel is going backwards at v, as above.
Now the difference between rolling and skidding is that, in rolling, there is no relative
motion at the point of contact. To have a feeling for this (literally), do this experiment: first, roll a
bottle or ball along your arm. Then drag it along your arm. In the first case, there is no
(horizontal) relative motion between the contact of the bottle and your skin, whereas in the
second case you feel the bottle slide over the skin.
The point at the bottom of a rolling wheel is instantaneously stationary. The axle is
moving forward at speed v so, from the geometry shown, the top of the wheel is moving
forwards at 2v. We can also understand this in terms of relative velocities.
To an observer standing on the road, the axle of the bicycle is travelling at v. The cyclist
sees the bottom of the wheel travelling at -v (speed v backwards, see diagram above), so the
observer sees this point as having velocity v-v = 0. The cyclist sees the top of the wheel
'overtaking' him at speed v, so the observer sees it moving at 2v.

Page 2

Simulation of Wheel

Fig. 3 : Diagram of a wheel rolling


We can watch the variation in position and velocity of a point on the rim of the wheel. In the film
clip, a piece of white tape on the rear tire labels such a point. Observe in particular the horizontal
(and vertical) components of the displacement from one frame to the next. Let's be quantitative.
For a point rotating clockwise in a circle with radius r at angular frequency , starting at the top
of the circle, the coordinates are
x = r sin t, y = r cos t
(You may wish to check that this has its centre at (0,0) and that x 2+y2=r2.) To make it roll along
the x axis, as in the animation, the axle should move to the right at speed v = r, and should be r
above the axis, so we put the centre of the rotation at (vt,r). So we raise all points by r, and we
move them to the right at v = r. The coordinates of the point initially at the top of the wheel (the
point circled in the animation or the white tape on the wheel) are now
x = rt + r sin t, y = r + r cos t or

x = r(t + sin t), y = r(1 + cos t)

Let's now look at the horizontal component of the velocity of that point:
dx/dt = r( + cos t) = r(1 + cos t)
The value of the cos function varies from -1 to +1. So dx/dt for this point, the horizontal
component of the velocity, has a maximum value of 2r = 2v when it is at the top of the wheel-the top of the wheel is overtaking the axle with twice its speed. It has a minimum value of zero,
when its value is instanteously zero as it touches the ground.

Page 3

Simulation of Wheel

System Flowchart

Fig. 4: Flowchart of the system


The wheel starts to rotate from the left side f screen. After completion of each rotation, the system
checks whether the right border is reached. If the wheel has crossed the rignt border, it restarts from the
left side again.
The flowchart symbols are as follows-

1. Start/End symbol An oval shape is used to mark the end or start point.

Page 4

Simulation of Wheel

2. Arrows The line is a connector that shows relationship between the representative
shapes

3. Input/Output The parallelogram represents the input or output instruction

4. Process The rectangle represents a process

5. Decision A diamond shape is used to represent decision

Languages and tools


HARDWARE
Page 5

Simulation of Wheel
A Desktop Computer with configuration given belowOperating system
:
Windows XP
RAM
:
1 GB
Processor
:
2.3 Ghz Intel Dual Core Processor
Screen Resolution
:
SVGA
Keyboard
:
I-ball 102 Keys wired Keyboared
Mouse
:
I-ball wired optical mouse
SOFTWARE
Turbo C Compiler
Microsoft Notepad
C Language
C is a general-purpose, imperative computer programming language, supporting
structured programming, lexical variable scope and recursion, while a static type system prevents
many unintended operations. By design, C provides constructs that map efficiently to typical
machine instructions, and therefore it has found lasting use in applications that had formerly
been coded in assembly language, including operating systems, as well as various application
software for computers ranging from supercomputers to embedded systems.
C was originally developed by Dennis Ritchie between 1969 and 1973 at Bell Labs,[5]
and used to re-implement the Unix operating system.[6] It has since become one of the most
widely used programming languages of all time,[7][8] with C compilers from various vendors
available for the majority of existing computer architectures and operating systems. C has been
standardized by the American National Standards Institute (ANSI) since 1989 (see ANSI C) and
subsequently by the International Organization for Standardization (ISO).
C Graphics programming is very easy and interesting. You can use graphics programming
for developing your own games, in making projects, for animation etc. It's not like traditional C
programming in which you have to apply complex logic in your program and then you end up
with a lot of errors and warnings in your program. In C graphics programming you have to use
standard library functions ( need not worry if you don't know functions ) to get your task done.
Just you pass arguments to the functions and it's done. On this website you will find almost all
functions with detailed explanation and a sample program showing the usage of a function. To
make things easy you are provided with executable files which you can download and execute.
Firstly you should know the function initgraph which is used to initialize the graphics mode . To
initialize graphics mode we use initgraph function in our program. initgraph function is present
Page 6

Simulation of Wheel
in "graphics.h" header file, so your every graphics program should include "graphics.h" header
file.
C is widely used for "system programming", including implementing operating systems
and embedded system applications, due to a combination of desirable characteristics such as code
portability and efficiency, ability to access specific hardware addresses, ability to pun types to
match externally imposed data access requirements, and low run-time demand on system
resources. C can also be used for website programming using CGI as a "gateway" for information
between the Web application, the server, and the browser. Some reasons for choosing C over
interpreted languages are its speed, stability, and near-universal availability.
One consequence of C's wide availability and efficiency is that compilers, libraries and
interpreters of other programming languages are often implemented in C. The primary
implementations of Python, Perl 5 and PHP, for example, are all written in C.
Due to its thin layer of abstraction and low overhead, C allows efficient implementations
of algorithms and data structures, which is useful for programs that perform a lot of computations.
For example, the GNU Multiple Precision Arithmetic Library, the GNU Scientific Library,
Mathematica and MATLAB are completely or partially written in C.
C is sometimes used as an intermediate language by implementations of other languages.
This approach may be used for portability or convenience; by using C as an intermediate
language, it is not necessary to develop machine-specific code generators. C has some features,
such as line-number preprocessor directives and optional superfluous commas at the end of
initializer lists, which support compilation of generated code. However, some of C's shortcomings
have prompted the development of other C-based languages specifically designed for use as
intermediate languages, such as C--.
C has also been widely used to implement end-user applications, but much of that
development has shifted to newer, higher-level languages.
Microsoft Notepad
Microsoft Notepad - Microsoft Notepad is a simple text editor for Microsoft Windows and a basic
text-editing program which enables computer users to create documents. It has been included in
all versions of Microsoft Windows since Windows 1.0 in 1985.
Notepad is a common text-only (plain text) editor. The resulting filestypically saved with the
.txt extensionhave no format tags or styles, making the program suitable for editing system files
to use in a DOS environment and, occasionally, source code for later compilation or execution,
usually through a command prompt. It is also useful for its negligible use of system resources;
Page 7

Simulation of Wheel
making for quick load time and processing time, especially on under-powered hardware. Notepad
supports both left-to-right and right-to-left based languages. Unlike WordPad, Notepad does not
treat newlines in Unix- or Mac-style text files correctly. Notepad offers only the most basic text
manipulation functions, such as finding text. Only newer versions of Windows include an updated
version of Notepad with a search and replace function. However, it has much less functionality in
comparison to full-scale editors.
In all versions of Windows, Notepad uses a built-in window class named EDIT.
Older versions included with Windows 95, Windows 98, Windows Me and Windows 3.1, imposed
a 64 K limit on file size, which was an operating system limit of the EDIT class. Up to Windows
95, Fixedsys was the only available display font for Notepad. Windows NT 4.0 and 98 introduced
the ability to change this font. As of Windows 2000, the default font was changed to Lucida
Console. The font setting, however, only affects how the text is shown to the user and how it is
printed, not how the file is saved to disk. The default font was changed to Consolas on Windows
8. Up to Windows Me, there were almost no keyboard shortcuts and no line-counting feature.
Starting with Windows 2000, shortcuts for common tasks like new, open and save were added, as
well as a status-bar with a line counter (available only when word-wrap is disabled). In the
Windows NT-based versions of Windows, Notepad can edit traditional 8-bit text files as well as
Unicode text files (both UTF-8 and UTF-16, and in case of UTF-16, both little-endian and bigendian).

Project Description
The wheel is displayed after running the program. The wheels translates from left to right as well
as rotates around the surface. The translation starts from left and continues to right. At one point
the wheel entirely crosses the right border of the screen.

Page 8

Simulation of Wheel

Fig 5: The moving wheel from left to right


After crossing the right border as shown in the figure below, the wheel emerges from the left side and
continues the translation motion. The entire process continues until any keystroke is received by the
system.

We have used following C functions in code1. Line - ine function is used to draw a line from a point(x1,y1) to point(x2,y2) i.e. (x1,y1)
and (x2,y2) are end points of the line. The code given below draws a line.
Declaration :- void line(int x1, int y1, int x2, int y2);
2. Setcolor- In Turbo Graphics each color is assigned a number. Total 16 colors are
available. Strictly speaking number of available colors depends on current graphics mode
and driver.For Example :- BLACK is assigned 0, RED is assigned 4 etc. setcolor function
Page 9

Simulation of Wheel
is used to change the current drawing color.e.g. setcolor(RED) or setcolor(4) changes the
current drawing color to RED. Remember that default drawing color is WHITE.
Declaration :- void setcolor(int color);
3. Delay - Delay function is used to suspend execution of a program for a particular time.
Here unsigned int is the number of milliseconds ( remember 1 second = 1000
milliseconds ). To use delay function in your program you should include the dos.h
header file.
Declaration :- void delay(unsigned int);
4. Initgraph - To start the graphics system, you must first call initgraph. initgraph initializes
the graphics system by loading a graphics driver from
driver) then putting the system into
settings (color, palette, current

disk (or validating a registered

graphics mode. initgraph also resets all graphics

position, viewport, etc.) to their defaults, then resets

graphresult to 0.
void far initgraph(int far *graphdriver, int far *graphmode, char far *pathtodriver);

Page 10

Simulation of Wheel

Fig 6: The wheel crossing the right border of the screen

Results and Discussion


Page 11

Simulation of Wheel
When a wheel moves along the straight track, the centre of the wheel moves forward in pure
translation. A point on the rim of the wheel, however, traces out more complex path. We can
analyze the motion of the rolling wheel by viewing it as the combination of pure translation and
pure rotation and then by viewing it as rotation alone.
We have translated the wheel from left to right direction by following a constant delay
throughout. We have implemented rotation motion to the spoke of the wheel and the
circumference of the wheel. The point at the bottom of a rolling wheel is instantaneously
stationary.

Conclusion
To simulate the motion of the wheel, we have to considered two transformations
simultaneouslyPage 12

Simulation of Wheel
1. Translation
2. Rotation
The wheel is shown running continuously from left to right order of the screen on the plane
surface. Once it crosses the right boundary of the screen completely, it emerges from the left side
and continues translation. The spokes of the wheel can be seen rotating as it translates.
The points on the circumference of the wheel and the spikes of the wheel undergo
rotation transformation while the entire wheel undergoes translation transformation.

Future Scope
We can improve the project in future as-

Page 13

Simulation of Wheel
1. The project at present works with constant delay which controls the speed of the
simulation. In future, we can extend same project to manage the speed of animation.
2. The project currently moves the wheel from left to right in horizontal direction. We can
add different direction like reverse motion or motion between two specified points.
3. We may show motion of different wheels at the same time.
4. We can extend this mini project to simulate motion of other objects like solid spheres,
balls, etc.
5. We can improve the simulation details by embedding C language with other languages.
6. Further study is required to detect the effect of motion of wheel on the inclined surface or
rough surface like road with pebbles.
7. We can add light effects to the simulation like shadow of wheel or the motion of spokes.

References
Books:
Page 14

Simulation of Wheel
1. Let Us C, Yashwant Kanetkar, Infinity Science Press.
2. Graphics Programming in C, Peter Aitken, Foresman Publications.
3. Mastering Graphics Programming, Dawara, Sudhir, Laxmi Publications.
Websites:
1.
2.
3.
4.

www.wikipaedia.org
www.tutorialspoint.com
www.scribd.com
www.ctutorialspoint.com

Index
Introduction.................................................................................................................... 1
System Flowchart............................................................................................................ 4
Languages and tools......................................................................................................... 5
Project Description........................................................................................................... 8
Results and Discussion.................................................................................................... 10
Conclusion................................................................................................................... 11
Future Scope................................................................................................................ 12
References................................................................................................................... 13

Page 15