Sunteți pe pagina 1din 15

distance analytic of an electric motor

with bisection method


Ayusta Dea Novalina (15/379084/TK/43026)
Bagaskara Eka Nugraha (15/385268/TK/43930)
Bartolomeus DelPhito (15/38569/TK/43931)
Gama Atmajaya (15/385278/TK/43940)

abstract
Based on WEA, the numbers of electric bike user has increase significantly. An electric
bike has become main trasportation, as its speed can reach hundred km/h. Despite of its
popularity, one of the main problem that the biker face is distance.
An electric bike mainly use SLA-Acid battery or Li-Ion battery, and on its top speed, it
drains a vast amount of energy and the battery can be emptied quickly. Based on this
problem, we decided to measure how much distance can the biker ride, based on its velocity
and batttery capacity.
Our paper focuses on making an instrument to calculate the distance length while the
biker ride. We provide information about the disctance and minutes can a biker ride while
maintaining at its current speed. The input variables that necessary for our research are
battery capacity, velocity, ampere. Those variables are calculated based on bisection method
to provide the necessary information the biker needs.

I. basic theory
1. Current
Ohm's law states that the current through a conductor between two points is directly
proportional to the potential difference across the two points. Introducing the constant of
proportionality, the resistance, one arrives at the usual mathematical equation that describes
this relationship:
I = V/R
where I is the current through the conductor in units of amperes, V is the potential difference
measured across the conductor in units of volts, and R is the resistance of the conductor in
units of ohms. More specifically, Ohm's law states that the R in this relation is constant,
independent of the current.
2. Battery capacity and discharge
A battery's capacity is the amount of electric charge it can deliver at the rated voltage. The
more electrode material contained in the cell the greater its capacity. A small cell has less
capacity than a larger cell with the same chemistry, although they develop the same opencircuit voltage. Capacity is measured in units such as amp-hour (Ah). The rated capacity of a
battery is usually expressed as the product of 20 hours multiplied by the current that a new
battery can consistently supply for 20 hours at 68 F (20 C), while remaining above a
specified terminal voltage per cell. For example, a battery rated at 100 Ah can deliver 5 A
over a 20-hour period at room temperature. The fraction of the stored charge that a battery
can deliver depends on multiple factors, including battery chemistry, the rate at which the
charge is delivered (current), the required terminal voltage, the storage period, ambient
temperature and other factors.
The higher the discharge rate, the lower the capacity. The relationship between current,
discharge time and capacity for a lead acid battery is approximated (over a typical range of
current values) by Peukert's law:
t = Qp/Ik
3. function of S(t)
S(t)=v(t)* Qp/I(t)
s(t) = range until battery run out
v(t) = speed of the bike at t
Qp = the capacity of battery when discharged at a rate of 1 amp
I(t) = current at t

II. methodology
An equation

f ( x) 0

one root between

and

and

xu

(Figures 2 and 3). If

root between
between

and

if

is a real continuous function, has at least

f ( x ) f ( xu ) 0

f ( x ) f ( xu ) 0

Note that if

xu

f (x)
, where

and

xu

xu

(See Figure 1).

, there may or may not be any root between

f ( x ) f ( xu ) 0

, then there may be more than one

(Figure 4). So the theorem only guarantees one root

Since the bisection method is based on finding the root between two
points, the method falls under the category of bracketing methods.
Since the root is bracketed between two points,
the mid-point,
1.
2.

x
xm

and
and

xm
xm
xu

between

, and
.

and

xu

and

xu

, one can find

. This gives us two new intervals

f (x)

x
xu

Figure 1 At least one root exists between the two points if the function is real,
continuous, and changes sign.

f (x)

xu

Figure 2 If the function

f (x)

points, roots of the equation


points.

does not change sign between the two

f ( x) 0

f (x)

may still exist between the two

f (x)

xu

x xu

Figure 3 If the function

f (x)
does not change sign between two

points, there may not be any roots for the equation


between the two points.

f ( x) 0

f (x)

xu

Figure 4 If the function

f (x)

one root for the equation

changes sign between the two points, more than

f ( x) 0

Is the root now between


the sign of
and

xm

f ( x ) f ( x m )

, and if

may exist between the two points.

and

xm

or between

f ( x ) f ( x m ) 0

, otherwise, it is between

xm

and

xu

xm

and

xu

? Well, one can find

then the new bracket is between

. So, you can see that you are literally

x , xu

halving the interval. As one repeats this process, the width of the interval
becomes smaller and smaller, and you can zero in to the root of the equation

f ( x) 0

. The algorithm for the bisection method is given as follows.

The steps to apply the bisection method to find the root of the equation
are
1. Choose

and

xu

as two guesses for the root such that

f (x)
in other words,

changes sign between

and

xu

f ( x) 0

f ( x ) f ( x u ) 0

, or

2. Estimate the root,

xu

and

xm

, of the equation

f ( x) 0

as the mid-point between

as

xm =

x xu
2

3. Now check the following


a) If

f ( x ) f ( xm ) 0

and
b) If

xu x m

xu xu

, then the root lies between

; then

xm

and

xu

; then

x x

x x m

f ( x ) f ( x m ) 0

c) If
; then the root is
4. Find the new estimate of the root

xm =

and

xm

f ( x ) f ( x m ) 0

and

, then the root lies between

xm

. Stop the algorithm if this is true.

x xu
2

Find the absolute relative approximate error as

xmnew - xmold
a =
100
xmnew
where

xmnew
xmold

= estimated root from present iteration

= estimated root from previous iteration

a
5. Compare the absolute relative approximate error

with the pre-

a s

specified relative error tolerance


. If
, then go to Step 3, else
stop the algorithm. Note one should also check whether the number of
iterations is more than the maximum number of iterations allowed. If so,
one needs to terminate the algorithm and notify the user about it.

Advantages of bisection method


a) The bisection method is always convergent. Since the method
brackets the root, the method is guaranteed to converge.

b) As iterations are conducted, the interval gets halved. So one can


guarantee the error in the solution of the equation.

Drawbacks of bisection method


a) The convergence of the bisection method is slow as it is simply based
on halving the interval.
b) If one of the initial guesses is closer to the root, it will take larger
number of iterations to reach the root.
f (x )
x
c) If a function
is such that it just touches the -axis (Figure 6) such
as

f ( x) x 2 0

it will be unable to find the lower guess,

, and upper guess,

xu

, such

that

f ( x ) f ( xu ) 0
f (x)

d) For functions
where there is a singularity and it reverses sign at
the singularity, the bisection method may converge on the singularity
(Figure 7). An example includes

f ( x)

where

1
x

x 2 xu 3
,

are valid initial guesses which satisfy

f ( x ) f ( xu ) 0
However, the function is not continuous and the theorem that a root
exists is also not applicable.

f (x)

Figure 6 The equation

f ( x) x 2 0

has a single root at

x0

that cannot be

bracketed.

A singularity in a function is defined as a point where the function becomes infinite. For example, for a function
such as

1/ x

, the point of singularity is

x0

as it becomes infinite.

f (x)

f x

Figure 7 The equation

1
0
x

has no root but changes sign.

The matlab worksheet of bisection method


% Topic
: Bisection Method - Roots of Equations
% Simulation : Graphical Simulation of the Method
% Language
: Matlab r12
% Authors
: Nathan Collier, Autar Kaw
% Date
: 6 September 2002
% Abstract
: This simulation shows how the bisection method works for
finding roots of an equation f(x)=0
clear all
% INPUTS: Enter the following
% Function in f(x)=0
f = inline('x^3-0.165*x^2+3.993*10^(-4)');
% Upper initial guess
xu = 0.11;
% Lower initial guess
xl = 0.0;
% Lower bound of range of 'x' to be seen
lxrange = -0.02;
% Upper bound of range of 'x' to be seen
uxrange = 0.12;
%
% SOLUTION
% The following finds the upper and lower 'y' limits for the plot based on
the given
%
'x' range in the input section.
maxi = f(lxrange);
mini = f(lxrange);
for i=lxrange:(uxrange-lxrange)/10:uxrange
if f(i) > maxi
maxi = f(i);
end
if f(i) < mini
mini = f(i);
end
end
tot=maxi-mini;
mini=mini-0.1*tot;
maxi=maxi+0.1*tot;
% This calculates window size to be used in figures
set(0,'Units','pixels')
scnsize = get(0,'ScreenSize');
wid = round(scnsize(3));
hei = round(0.95*scnsize(4));
wind = [1, 1, wid, hei];
% This graphs the function and two lines representing the two guesses
figure('Position',wind)
clf
fplot(f,[lxrange,uxrange])
hold on
plot([xl,xl],[maxi,mini],'y','linewidth',2)
plot([xu,xu],[maxi,mini],'g','linewidth',2)
plot([lxrange,uxrange],[0,0],'k','linewidth',1)
title('Entered function on given interval with initial guesses')

hold off
%
------------------------------------------------------------------------------% Iteration 1
figure('Position',wind)
xr=(xu+xl)/2;
% This graphs the function and two lines representing the two guesses
clf
subplot(3,1,2),fplot(f,[lxrange,uxrange])
hold on
plot([xl,xl],[maxi,mini],'y','linewidth',2)
plot([xu,xu],[maxi,mini],'g','linewidth',2)
plot([xr,xr],[maxi,mini],'r','linewidth',2)
plot([lxrange,uxrange],[0,0],'k','linewidth',1)
title('Entered function on given interval with upper and lower guesses')
% This portion adds the text and math to the top part of the figure window
subplot(3,1,1), text(0,1,['Iteration 1'])
text(0.2,.8,['xr = (xu + xl)/2 = ',num2str(xr)])
text(0,.6,['Finding the value of the function at the lower and upper
guesses and the estimated root'])
text(0.2,.4,['f(xl) = ',num2str(f(xl))])
text(0.2,.2,['f(xu) = ',num2str(f(xu))])
text(0.2,0,['f(xr) = ',num2str(f(xr))])
axis off
hold off
% Check the interval between which the root lies
if f(xu)*f(xr)<0
xl=xr;
else
xu=xr;
end
% This portion adds the text and math to the bottom part of the figure
window
subplot(3,1,3), text(0,1,['Check the interval between which the root lies.
Does it lie in ( xl , xu ) or ( xr , xu )?'])
text(0,.8,[''])
text(0.2,0.6,['xu = ',num2str(xu)])
text(0.2,0.4,['xl = ',num2str(xl)])
axis off
xp=xr;
%
------------------------------------------------------------------------------% Iteration 2
figure('Position',wind)
xr=(xu+xl)/2;
% This graphs the function and two lines representing the two guesses
clf
subplot(3,1,2),fplot(f,[lxrange,uxrange])
hold on
plot([xl,xl],[maxi,mini],'y','linewidth',2)
plot([xu,xu],[maxi,mini],'g','linewidth',2)

plot([xr,xr],[maxi,mini],'r','linewidth',2)
plot([lxrange,uxrange],[0,0],'k','linewidth',1)
title('Entered function on given interval with upper and lower guesses')
% This portion adds the text and math to the top part of the figure window
subplot(3,1,1), text(0,1,['Iteration 2'])
text(0.2,.8,['xr = (xu + xl) / 2 = ',num2str(xr)])
text(0,.6,['Finding the value of the function at the lower and upper
guesses and the estimated root'])
text(0.2,.4,['f(xl) = ',num2str(f(xl))])
text(0.2,.2,['f(xu) = ',num2str(f(xu))])
text(0.2,0,['f(xr) = ',num2str(f(xr))])
axis off
hold off
% Check the interval between which the root lies
if f(xu)*f(xr)<0
xl=xr;
else
xu=xr;
end
% Calculate relative approximate error
ea=abs((xr-xp)/xr)*100;
% This portion adds the text and math to the bottom part of the figure
window
subplot(3,1,3), text(0,1,['Absolute relative approximate error'])
text(0,.8,['ea = abs((xr - xp) / xr)*100 = ',num2str(ea),'%'])
text(0,.4,['Check the interval between which the root lies. Does it lie in
( xl , xu ) or ( xr , xu )?'])
text(0.2,0.2,['xu = ',num2str(xu)])
text(0.2,0,['xl = ',num2str(xl)])
axis off
xp=xr;
%
------------------------------------------------------------------------------% Iteration 3
figure('Position',wind)
xr=(xu+xl)/2;
% This graphs the function and two lines representing the two guesses
clf
subplot(3,1,2),fplot(f,[lxrange,uxrange])
hold on
plot([xl,xl],[maxi,mini],'y','linewidth',2)
plot([xu,xu],[maxi,mini],'g','linewidth',2)
plot([xr,xr],[maxi,mini],'r','linewidth',2)
plot([lxrange,uxrange],[0,0],'k','linewidth',1)
title('Entered function on given interval with upper and lower guesses')
% This portion adds the text and math to the top part of the figure window
subplot(3,1,1), text(0,1,['Iteration 3'])
text(0.2,.8,['xr = (xu + xl) / 2 = ',num2str(xr)])
text(0,.6,['Finding the value of the function at the lower and upper
guesses and the estimated root'])
text(0.2,.4,['f(xl) = ',num2str(f(xl))])
text(0.2,.2,['f(xu) = ',num2str(f(xu))])
text(0.2,0,['f(xr) = ',num2str(f(xr))])

axis off
hold off
% Check the interval between which the root lies
if f(xu)*f(xr)<0
xl=xr;
else
xu=xr;
end
% Calculate relative approximate error
ea=abs((xr-xp)/xr)*100;
% This portion adds the text and math to the bottom part of the figure
window
subplot(3,1,3), text(0,1,['Absolute relative approximate error'])
text(0,.8,['ea = abs((xr - xp) / xr)*100 = ',num2str(ea),'%'])
text(0,.4,['Check the interval between which the root lies. Does it lie in
( xl , xu ) or ( xr , xu )?'])
text(0.2,0.2,['xu = ',num2str(xu)])
text(0.2,0,['xl = ',num2str(xl)])
axis off
xp=xr;
%
------------------------------------------------------------------------------% Iteration 4
figure('Position',wind)
xr=(xu+xl)/2;
% This graphs the function and two lines representing the two guesses
clf
subplot(3,1,2),fplot(f,[lxrange,uxrange])
hold on
plot([xl,xl],[maxi,mini],'y','linewidth',2)
plot([xu,xu],[maxi,mini],'g','linewidth',2)
plot([xr,xr],[maxi,mini],'r','linewidth',2)
plot([lxrange,uxrange],[0,0],'k','linewidth',1)
title('Entered function on given interval with upper and lower guesses')
% This portion adds the text and math to the top part of the figure window
subplot(3,1,1), text(0,1,['Iteration 4'])
text(0.2,.8,['xr = (xu + xl) / 2 = ',num2str(xr)])
text(0,.6,['Finding the value of the function at the lower and upper
guesses and the estimated root'])
text(0.2,.4,['f(xl) = ',num2str(f(xl))])
text(0.2,.2,['f(xu) = ',num2str(f(xu))])
text(0.2,0,['f(xr) = ',num2str(f(xr))])
axis off
hold off
% Check the interval between which the root lies
if f(xu)*f(xr)<0
xl=xr;
else
xu=xr;
end
% Calculate relative approximate error
ea=abs((xr-xp)/xr)*100;

% This portion adds the text and math to the bottom part of the figure
window
subplot(3,1,3), text(0,1,['Absolute relative approximate error'])
text(0,.8,['ea = abs((xr - xp) / xr)*100 = ',num2str(ea),'%'])
text(0,.4,['Check the interval between which the root lies. Does it lie in
( xl , xu ) or ( xr , xu )?'])
text(0.2,0.2,['xu = ',num2str(xu)])
text(0.2,0,['xl = ',num2str(xl)])
axis off
xp=xr;
%
------------------------------------------------------------------------------% Iteration 5
figure('Position',wind)
xr=(xu+xl)/2;
% This graphs the function and two lines representing the two guesses
clf
subplot(3,1,2),fplot(f,[lxrange,uxrange])
hold on
plot([xl,xl],[maxi,mini],'y','linewidth',2)
plot([xu,xu],[maxi,mini],'g','linewidth',2)
plot([xr,xr],[maxi,mini],'r','linewidth',2)
plot([lxrange,uxrange],[0,0],'k','linewidth',1)
title('Entered function on given interval with upper and lower guesses')
% This portion adds the text and math to the top part of the figure window
subplot(3,1,1), text(0,1,['Iteration 5'])
text(0.2,.8,['xr = (xu + xl) / 2 = ',num2str(xr)])
text(0,.6,['Finding the value of the function at the lower and upper
guesses and the estimated root'])
text(0.2,.4,['f(xl) = ',num2str(f(xl))])
text(0.2,.2,['f(xu) = ',num2str(f(xu))])
text(0.2,0,['f(xr) = ',num2str(f(xr))])
axis off
hold off
% Check the interval between which the root lies
if f(xu)*f(xr)<0
xl=xr;
else
xu=xr;
end
% Calculate relative approximate error
ea=abs((xr-xp)/xr)*100;
% This portion adds the text and math to the bottom part of the figure
window
subplot(3,1,3), text(0,1,['Absolute relative approximate error'])
text(0,.8,['ea = abs((xr - xp) / xr)*100 = ',num2str(ea),'%'])
text(0,.4,['Check the interval between which the root lies. Does it lie in
( xl , xu ) or ( xr , xu )?'])
text(0.2,0.2,['xu = ',num2str(xu)])
text(0.2,0,['xl = ',num2str(xl)])
axis off
xp=xr;

III. analysis
IV. data and graphic
V. summary
VI. reference

http://nm.mathforcollege.com/topics/bisection_method.html

S-ar putea să vă placă și