Aqua Phoenix
     >>  Lectures >>  Matlab 5  
 

Navigator
   
 
       
   

5.3 Exercise 1

For this exercise, we will compute the total amount of Energy in the Segway's fully charged batteries, in a reverse engineering manner. The Segway web site tells us that

Accounting for a variety of real-world conditions we expect you'll be able to travel about 10 miles (16 km) on a single battery charge.
The values are summarized in Table 5.1 for other types of situations. We will assume normal conditions. Unfortunately, we don't know anything about how the Segway testers arrived at these results. Specifically, we don't know about the rider's weight, how fast she was riding, and even what a normal terrain looks like. For now, we will need to make assumptions, which can easily be changed through variables later on. Let's assume the following:
  • the rider travelled at a constant 20 km/h, which is the maximum speed on the Segway.
  • the rider has a typical body weight of 80 kg (176 pounds).
  • the rider has a body height of 180 cm (6 ft).
  • the terrain is a 0 degree inclined street.

We first define a series of variables, which can be changed later on to account for any misjudgements in our previous assumptions. Also, some of these variables will be reused in later exercises and assignments.

  • vconst = 20 km/h
  • mrider = 80 kg
  • hrider = 180 cm
  • mbatteries = 9 kg (Table 5.1)
  • msegway w/o bat = 29 kg
  • msegway = mbatteries + msegway w/o bat by means of adding two defined variables
  • dwheel = 0.48 m (Table 5.1)
  • Asegway = 0.2 m2 (see Segway Physics)
  • cD = 1.5 (Table 5.2)
  • alpha = 0
  • effoverall = 0.5 (see Discussion on Electrical Issues)
  • time = 48 min (16 km travelled at 20 km/h = 4/5 of 1 hour = 48 minutes)

In order to compute the total amount of energy in the Segway's fully charged batteries, we need to first compute the mechanical power required to move the Segway and its rider at the specified speed. From equation 5.9 we know that the required force is:

FTotal = FTraction = D = FAir + FRoll + FSlope + FAccel       (Eq. 5.23)
For our purposes, we will not take into account the Force required to accelerate the vehicle; we assume that the Segway is in motion and does not stop until the Energy in the batteries is exhausted. This is not a realistic assumption, but not taking it into account will simplify our problem setup. The equation becomes:

FTotal = FAir + FRoll + FSlope       (Eq. 5.24)
From equation 5.14 we can now compute the total Torque exerted on the wheel with diameter dwheel that is needed for force FTotal:

T = (dwheel / 2) * FTotal       (Eq. 5.25)
Using equation 5.15, we arrive at a measure for Power:

Pmech = T * Ω       (Eq. 5.26)
where Ω is measured in radians per second.

We have established in the discussion of Electric Issues, that the mechanical power experienced at the wheels is not a 100% measure of how much electrical power is drawn from the batteries. We have established that there exists some efficiency factor, by which energy is lost on the path from batteries to wheels. We have given it a quantity of 50%. Thus, any mechnical power at the wheels is due to 1 / efficiency, in our case 1/.5 times the electrical power from the batteries. In order to compute the true power from the batteries, we multiply the previously derived Power by this quantity:

Pbatteries = Pmech * (1 / effoverall)       (Eq. 5.27)
Finally, we compute the total amount of Energy in the batteries. Mathematically, we would integrate the amount of required power over time in seconds, which is equivalent to multiplying Power by time:

Ebatteries = Pbatteries * time       (Eq. 5.28)

5.3.1 Setup and Solution in Matlab

We begin by creating a empty m-file, in which we will define all variables, and from where we will call functions to handle the actual calculation.

Figure 5.11
Click image to enlarge, or click here to open
We now begin entering these equations into the m-file, substituting for defined variable names. We could either write out all equations for total energy, or we could call functions that compute smaller parts of the problem, which may again make use of other functions. For our purposes, we will split the problem into smaller pieces systematically. We start by defining Torque:

Torque   =   (dwheel / 2) * Ftotal(A, v, cD, m, alpha)
where (dwheel / 2) is the radius of the wheel, and Ftotal(A, v, cD, m, alpha) is the undefined quantity of total Force. We do know, however, what parameters are necessary to compute FTotal, which is why we have substituted them with dummy variable names for now.

Save this m-file under the name exercise_batterypower.m.

Figure 5.12
Click image to enlarge, or click here to open
We now create a new m-file for the function that computes the Total Force, given the arguments A for frontal area, v for velocity, cD for the coefficient of drag, m for the total weight of the vehicle + rider, and alpha for the slope of the inclined terrain.

This function is rather simple, as it merely redistributes the parameters to each component of force:

F   =   Fair(A, v, cD) + Froll(m, v) + Fslope(alpha, m)
Save this m-file under the name FtotalNext, we will need to define each of the component force functions, Fair, Froll, and Fslope.

Figure 5.13
Click image to enlarge, or click here to open
We create a new m-file for function Fair.

From equation 5.5, we define the following:

F   =   0.5 * rho * A * (v^2) * cD
where rho = 1.225 is the constant for density of air, A is the frontal area measured in square meters, v is the velocity measured in meters per second, and cD is the coefficient of drag.

Save this m-file under the name F_air.m

Figure 5.14
Click image to enlarge, or click here to open
Next, we create a new m-file for function Froll.

From equation 5.6 we define the following:

F   =   cR(v) * m * g
where g = 9.81 is the constant for acceleration due to gravity, v is the velocity measured in meters per second, and m is the mass measured in kilograms.

Save this m-file under the name F_roll.mSince the Rolling Resistance Coefficient is a function of velocity (Table 5.3), we will need to define the proper function.

Figure 5.15
Click image to enlarge, or click here to open
We create a new m-file for function cR.

From the first equation in Table 5.3, we define the following:

F   =   0.0136 + 0.04 * 10-6 * (v * 3.6)^2
where v is the velocity measured in meters per second.

Save this m-file under the name c_R.m

Figure 5.16
Click image to enlarge, or click here to open
Next, we create a new m-file for function Fslope.

From equation 5.7 we define the following:

F   =   m * g * sin((pi * alpha) / 180)
where g = 9.81 is the constant for acceleration due to gravity, m is the mass measured in kilograms, and alpha is the angle of the inclined terrain measured in degrees.

Note that pi is a pre-defined value for 3.1415... (Matlab variable name: pi)

Similar to the function for conversion of velocity from km/h to m/sec, we need to check the angle for negative values, in which case the required force is 0. We thus refine the function as follows:

if (t < 0)
  F = 0
else
  F = m*g*sin((pi*alpha)/180)
end
Save this m-file under the name F_slope.m

Figure 5.17
Click image to enlarge, or click here to open
We now revisit the m-file for this exercise. Previously, we have defined:

Torque   =   (dwheel / 2) * Ftotal(A, v, cD, m, alpha)
We now need to substitute variables for the parameters passed to Ftotal.

Frontal surface area A depends on the FSA of the Segway and the FSA of the rider. The FSA of the rider has been established in equation 5.12.

Figure 5.18
Click image to enlarge, or click here to open
We now create a new m-file for function FSA.

From equations 5.12 and 5.11 we define the following:

A   =   (2 / 5) * √((h * m) / 3600)
where h is the height of the person measured in centimeters, and m is the weight of the person measured in kilograms.

Save this m-file under the name FSA.m

Figure 5.19
Click image to enlarge, or click here to open
We are now ready to substitute all variables and helper functions for the parameters passed to Ftotal. For readability, we assign the function calls to different short variable names:

A   =   FSA(hrider, mrider) + Asegway
v   =   vkmh2msec(vconst)
m   =   msegway + mrider
Torque   =   (dwheel / 2) * Ftotal(A, v, cD, m, alpha)
which gives us a complete formula for Torque. This quantity represents the power required to move the Segway and its rider at the given speed with a given mass.

Figure 5.20
Click image to enlarge, or click here to open
We can now compute the mechanical Power at the wheel:

Pmech effective   =   Torque * vmsd2rad(v, dwheel)
Since we measure velocity in kilometers per hour, we need to convert this quantity to radians per second. We have already defined a function that converts kilometers per hour to meters per second. We thus need to write a function that converts m/sec to rad/sec.

Figure 5.21
Click image to enlarge, or click here to open
We now create a new m-file for function vmsd2rad.

Given the diameter of a wheel and the speed at which it turns in m/sec, we can compute the circumference of the wheel and finally the number of radians per second:

v   =   (msec / (d * pi)) * (2 * pi)
or:

v   =   msec * 2 / d
where msec is the velocity measured in meters per second and d is the diameter of the wheel measured in meters.

Save this m-file under the name v_msd2rad.m

Figure 5.22
Click image to enlarge, or click here to open
We now compute the actual Power in the batteries, which is not the same as the Power at the wheels, due to inefficiencies:

Pideal batteries   =   Pmech effective * (1 / effoverall)
The resulting quantity Pideal batteries is a better measure for how much power is required to move the Segway and its rider at velocity v with mass m.

Figure 5.23
Click image to enlarge, or click here to open
To finally compute the total amount of Energy in the batteries, we multiply Power by time:

Ebatteries total   =   Pideal batteries * (time * 60)
where time in minutes is multiplied by 60 for the right quantity in seconds.

Ebatteries total is the final amount of energy in the batteries. With this quantity, we can now compute a variety of other scenarios.

Figure 5.24
Click image to enlarge, or click here to open
Once all m-files are saved and in the same directory, you can run the program by merely typing the name exercise_batterypower into the Command Window.

Figure 5.25
Click image to enlarge, or click here to open