>>  Lectures >>  Matlab 5

 Navigator

## 5.5 Assignment Solutions - Lecture 5

Solution m-files:

 assignment_regenbraking.m
 geometric_series.m
The key to solving the problem is formulating an equation that resembles the verbal solution given in the problem.

The total distance travelled is equal to the distance x travelled on initial battery power + the distance y travelled on energy through regenerative braking:

disttotal = x + y       (Eq. 5.29)
The variable y depends on x given that 20% of x's distance the vehicle was braking:

y = 0.2 * x       (Eq. 5.30)
Since regenerative braking effectively adds to the distance that the vehicle can travel, we could say that y is the additional distance travelled based on regenerative braking. However, we must still include the efficiency values. 50% of the 20% additional distance is lost due to inefficiencies when storing the energy in the batteries (mechanical power to electrical power), and 50% of that is again lost when converting electrical power to mechanical power. This effectively means that of the 20% only 5% are left for true additional distance travelled:

y = 0.05 * x       (Eq. 5.31)
This additional distance y is only the first (the red) portion of additional distance in figure 5.27. To include the blue and additional distances we change the formula to:

y = (0.05 * x) + (0.05 * 0.05 * x) + (0.05 * 0.05 * 0.05 * x) + ...       (Eq. 5.32)
Rewritten:

y = (0.05 * x) + (0.052 * x) + (0.053 * x) + ...       (Eq. 5.33)
Plug Eq. 5.33 back into Eq. 5.29:

disttotal = x + (0.05 * x) + (0.052 * x) + (0.053 * x) + ...       (Eq. 5.34)
Isolate x:

disttotal = x * (1 + 0.05 + 0.052 + 0.053 + ...)       (Eq. 5.35)
Bring knowns and unknowns on their respective sides of the equation:

x = disttotal / (1 + 0.05 + 0.052 + 0.053 + ... )       (Eq. 5.36)
For a converging geometric series of the form:

a + ar + ar2 + ar3 + ... + arn       (Eq. 5.37)
where a is some constant and r is a recurring term (0 < r < 1) with increasing exponent, the following equation computes the quantity of the series:

a/(1-r)       (Eq. 5.38)
Letting a=1 and r=0.05, we can rewrite Eq. 5.36 as follows:

x = disttotal / (1/(1-r))       (Eq. 5.39)
This is in fact the general solution to the problem.

We now create an m-file for the function that computes the general geometric series:

function s = geometric_series(a, r)
%  GEOM_SERIES a, r
%  GEOM_SERIES(A, R) computes the geometric series
%  A + AR + AR^2 + AR^3 + AR^4 + ...
%  as
%    A
%  -----
%  1 - R

error(nargchk(2, 2, nargin));

s = a / (1 - r);
The file is saved as geometric_series.m

We then create an m-file for the assignment solution:

exercise_batterypower;

dist_total = 16000;  % in meters
regen_braking = 0.2;  % in percent

r = regen_braking * (eff_overall ^ 2);
init_distance = dist_total / geometric_series(1, r);

dist_regen = dist_total - init_distance
We save the file as assignment_regenbraking.m