This exercise is the first of a sequence of six programming exercises based on a common theme (which we will develop and evolve throughout the rest of the quarter) in which we wish to evaluate the performance of human powered vehicles (hpv) for land transportation. Performance refers to the steady state velocity reached versus applied human power under constant specific conditions.

Human powered vehicles have captured the imagination
of designers, builders, and riders all over the world, for transportation,
load carrying, socializing, racing, and touring. My favorite hpv
link is the **International Human
Powered Vehicle Association** site which gives one a glimps
into hpv activity throughout the world. A more general directory
of cycling related websites is presented in **Cycling
Resources**.

In 1992, the 200m world human powered land
speed record was set by team **Cheetah**
at 68.73mph. This record was broken by Canadian **Sam
Whittingham** during the 2002 Human Powered Speed Championships
in Battle Mountain, Nevada at 81.00mph! During the same event
in 2002, Sam's wife, **Andrea Blasecki**,
broke the women's human powered land speed record at 64.74mph.
This remarkable husband and wife team from Victoria BC were both
riding human powered vehicles built by Canadian sculptor/designer
George Georgiev - Sam rode a Varna Diablo II and Andrea a Varna
Mephisto, as shown below.

In the 2004 World Human Power Speed Challenge
the women's land speed record was broken by Ellen van Vugt from
Holland, who did the flying 200m run at 65.89mph! (see below)

Ellen van Vugth showing her paces in the Varnowski bike. (Photo by Ruben
Garcia from the Pictures
of the 2004 WHPSC) |
Ellen van Vugt was jammed into the bike like a sardine. The bottom bracket was too close and her helmet was jammed into the canopy. (Photo by Brad Teubner from the Pictures
of the 2004 WHPSC) |

This record was subsequently broken in 2005
by **Lisa Vetterlein** riding
in a **Varna at 66.58 mph**!

** Latest Update (June 2011)** In 2009, SamWhittingham broke his own record again
for a human powered speed record of 82.819 mph, and Barbara Buatois
broke the previous woman's speed record by 9 mph with a speed
of 75.458 mph. She subsequently broke her own record in 2010 with
a speed of 75.69 mph (refer to the

Human powered vehicles range in complexity from amateur homebuilt machines to exotic machines suitable for commuting or touring, such as the Danish Leitra shown below. The Leitra is an efficient, all weather machine, which includes a hand powered windshield wiper, a rear view mirror conveniently placed above your head, and a well designed ventilated cover which can be lifted on its hinge in a matter of seconds for easy entry or exit.

Typical of the amateur homebuilt machines is
the front-wheel-drive Grasshopper I, as shown below: In this picture
we see a famous racing rider in his finest hour - racing in the
1993 British Human Power Speed Championships (unfortunately he
came last in this race). This was the precurser to the famous
**Grasshopper**
series of hpvs, of which the current version is Grasshopper 5.

I have a soft spot for front-wheel-drive human
powered vehicles. They result in extremely compact and elegant
designs, such as the beautiful Dutch **Chinkara**
or the compact rear-wheel steered construction by **Hans
Ulrich Reimer**. Notice the full suspension on both of these
bikes. Another example of a very fast, compact design is the twisting
chain front-wheel-drive bike by **John
Tetz**. This is amateur building at its prime - John built
both the bike and the fairing.

In this first exercise we develop and test the basic power function which we will use without change throughout the exercise sequence.

We first develop the power equation and examine the limitations of the human engine. The word statement of the basic power equation follows:

Recall that the kinetic energy of a mass m moving with velocity V is given by:

The inertial power is given by the time derivative of the kinetic energy, thus:

Thus the complete power equation is given by:

Note that the above equation is a nonlinear
differential equation in velocity V and can only be solved by
numerical techniques for the nonsteady conditions of acceleration
or deceleration.

Under steady state (constant velocity) the power equation can
be written as follows:

Consider now the human engine. In 1983 Douglas Malewicki gave a landmark paper at the International Human Powered Vehicle Association Scientific Symposium, in which he presented a graph showing the maximum duration of human effort for various steady power levels. This graph has been reproduced below for convenience. Notice from the graph that an average "healthy human" can produce a steady 0.1 horsepower for a full eight hour period, while a "first class athlete" can produce 0.4 horsepower for a similar period. Note that each data point on the curves represents an exhausted human. No more power is available without some rest and recovery. Thus at 0.4 hp the "healthy human" becomes exhausted within 10 minutes! Try to decide where you fit in this curve.

Note that in the power equation the units of power is watts (W), however we can apply the conversion 0.1 hp = 75 W (approximately) in reading the graph. Once you have decided the steady power level that you can comfortably apply at the pedals, it would be of interest to know the velocity that you will achieve at steady state when all other parameters are maintained at constant values. Unfortunately the steady state power equation above cannot be solved explicitly for velocity, thus we will develop a root finding technique to solve this problem in a forthcoming exercise. This first exercise introduces modular programming using functions, and is much less ambitious:

There are two parts to this exercise, the computer
program to evaluate the applied power as a function of velocity,
and a graph which you will plot by hand on regular graph paper.

- Write a program that defines a class
**HPvehicle**based on the steady state power equation above. The various relevant parameters used in the equation should be declared as private or public variables, as shown in the structure diagram below. The default constructor should initialise the variables as shown, including the total mass (choose a value based on your own mass and the mass of your bicycle). After declaring a**HPvehicle**object, the main function should first invoke two functions**get_wind**and**get_slope**, in order to obtain respective values for the wind velocity and the slope. Subsequently the main function should get a value of hpv velocity from the keyboard, and invoke the function**find_power**to evaluate and return the applied power using the steady state power equation given above, and display both on the screen. A typical flow diagram of the program is shown below:

Note that the equations are given in SI units, in which power has units of watts (W) and velocity has units of meters per second (m/s). Most Americans find it more intuitive to consider velocity in units of miles per hour (mph). Thus we will allow the user to enter the data in mph, and convert it to m/s using the following approximate conversion:

9 mph = 4 m/s (approximately)

Thus the function 'find_power' should have only one argument, being the hpv velocity in mph. Within the function both the hpv velocity and the wind velocity should be converted from mph to m/s, prior to evaluating the steady state power equation.

We have to standardize on the order of entering data on the keyboard, since your programs will be tested automatically. The first data item should be the wind velocity (mph), followed by the slope, and the last item should be the hpv velocity (mph).

The source code should be in your home directory and named**hpv.cpp**. A typical output follows. Notice that the three data items entered from the keyboard are shown in*italics*

**evaluate power vs velocity as a function of wind and slope****hpv initialised as follows:****mass (hpv + rider): 92[kg]****cda (coeff.drag*area): 0.4[sq.m]****cr (coeff.rolling resist): 0.005****local conditions initialised as follws:****gravity acceleration: 9.807[m/s/s]****air density: 1.18[kg/cu.m]****wind velocity: 0[mph]****slope: 0****-----------------------------------------------------****enter wind velocity [mph] - positive for headwind***-1***value entered is -1[mph]****enter slope (height/distance) - positive for uphill***-0.02***value entered is -0.02****new local conditions:****wind velocity = -1[mph]****slope = -0.02****enter hpv velocity [mph]***20***value entered is 20[mph]****for velocity of 20[mph],****applied power is 29.2905[watts]** - You will need to execute the program as many
times as required to obtain enough points in order to plot a
suitable
**power vs velocity graph**. For each execution the values of wind velocity and slope should remain the same, according to the first two non-zero values of your OU ID 6-digit number. Thus for a typical OU ID number (say) iu012345, choose a wind velocity of -1 mph (negative means tailwind) and a slope of -0.02 (negative means downhill slope).

From the above curve of time to exhaustion vs sustained level of power, decide on a level of power which is comfortable for you, and draw the equivalent horizontal line on your graph. From your graph determine and write down the steady state velocity that you will attain when you apply this level of power as well as the steady state downhill coasting velocity (no power applied).

Notice that in this exercise we have used the
computer in a very unsophisticated role - as a mere calculator.
In the coming exercises we will successively (and joyfully) relinquish
all of the manual processes above (multiple execution of the program,
drawing the graph, determining the steady state velocity for a
specified applied power) to the computer.