RIT Scholar Works
Theses
Thesis/Dissertation Collections
3-1-1980
A microprocessor based control system for an
electric vehicle
Ronald C. Moffatt
Follow this and additional works at:
http://scholarworks.rit.edu/theses
This Thesis is brought to you for free and open access by the Thesis/Dissertation Collections at RIT Scholar Works. It has been accepted for inclusion
in Theses by an authorized administrator of RIT Scholar Works. For more information, please contact
Recommended Citation
ABSTRACT
The
control systemdescribed
in
this
thesis
is
alow
cost system
designed
to
controlthe
speed of an electricvehicle
by
adjusting
the
speed of a compound woundDC
motor.
The
speed control methoddeveloped
in
this
systemis
a combination ofbattery
tapping,
for
control ofthe
armature
voltage,
and pulse width modulationfor
field
control;
both
generatedby
a microprocessor.Using
amicroprocessor,
the
control systemis
readily
adaptableto
avariety
of motor voltages and motor controltechniques
by
modifying
the
internal
firmware
ofthe
processor.Overcurrent
protectionis
included
to
prolong
battery
and motor
life.
Regenerative
braking
is
automatic uponrelease of
the
accelerator andhas
two
levels
for
maximumenergy
recovery.A
display
ofthe
remaining
chargein
the
vehicle'sbatteries
has
acontinually
poweredmemory
to
retainthe
information
whenthe
vehicleis
parked.This
display
is
also
temperature
compensatedto
reflectthe
characteristicsof
lead
acidbatteries
overvarying
temperatures.
The
control system wasinstalled
in
atest
vehicleTABLE
OF
CONTENTS
Page
LIST
OF
TABLES
vLIST
OF
FIGURES
viI
.INTRODUCTION
1
II.
THE
CONTROL
SYSTEM
FOR AN
ELECTRIC
VEHICLE..
3
A.
What
needsto
be
controlled3
B
.Techniques
for
motor control9
C.
Why
use a microprocessor?13
D.
Choosing
a microprocessor14
E
.Interface
requirements16
III
.HARDWARE
18
A.
Analog
input buffers
18
B
.Power
Supplies
24
C
.Power
interface
28
D.
Microprocessor
and support29
IV.
SOFTWARE
34
A.
Pulse
wisthfield
control34
B.
Analog
to
digital
conversion38
C.
Multiplication
41
D.
Main
program44
V.
THE
TEST
VEHICLE
54
A.
Description
54
TABLE
OF
CONTENTS
(cont'd.)
Page
VI
.SUMMARY
61
APPENDIX
1
(main
programlisting)
63
APPENDIX
2
(calculation
ofdisplay
constant)
.69
APPENDIX
3
(temperature
correction ofbattery
discharge
rate)
75
REFERENCES
78
LIST
OF
TABLES
1
.TEST
VEHICLE
SPECIFICATIONS
5
6
2
.PERFORMANCE
DATA
60
LIST
OF
FIGURES
Page
1
.DC
MOTOR
TYPES
&
CHARACTERISTICS
5
2
.SPEED
CONTROL
TECHNIQUES
10
3
.ACCELERATOR BUFFER
18
4
.CURRENT
SHUNT
AMPLIFIER
19
5
.TEMPERATURE
SENSOR
21
6
.REFERENCE
VOLTAGES
23
7
.POWER
SUPPLY
LOGIC
24
8
.POWER
SUPPLY
MEMORY
25
9
.POWER
SUPPLY
NEGATIVE
27
10
.POWER
INTERFACE
30
11
.MICROPROCESSOR
HARDWARE
31
12
.PULSE
WIDTH
MODULATION
(FLOW
CHART)
35
13
.MOTOR
CONTROL
VIA
PULSE
WIDTH
MODULATION
37
14.
ANALOG
TO
DIGITAL
CONVERSION
(FLOWCHART)
39
15
.MULTIPLICATION
(ILLUSTRATION)
42
16
.MULTIPLICATION
(FLOWCHART)
43
17
.MAIN
PROGRAM
(FLOWCHART)
I
.INTRODUCTION
Although
receiving
considerable attentionrecently,
electric vehicles are
by
no means new.They
were commercially
produced asearly
as1894
and atthe
turn
ofthe
century,
over2
5
different
companies wereproducing
electrically
powered vehicles.This
represented38%
ofthe
2
total
number of vehicles onthe
road.The
early
electric vehicles(EV's)
boasted
top
speedsof
15
to
30
miles perhour
andtravel
distances
between
3
charges of30
to
60
milesdepending
onthe
vehicle size.Most
utilized series wound motors of singledigit
horse
power with chain or gear
drive.
The
control systems weresimple on/off
arrangements,
although some placed resistors4
in series withthe
motorsto
reducethe
startup
jerk.
These
resistors werethen
shorted outprogressively
to
in
crease
the
vehicles speed.By 1930,
production of roadworthy
EV's
had
ceaseddue
to
the
slow speed ofthe
vehicle andits
limited
travel
range
(as
comparedto
the
improved
gasoline poweredvehicles)
.The
renewedinterest
in
the
electric vehicleoccurred
in
the
early
'70's
whenavailability
of gasolineand environmental concerns
began
a searchfor
an alternatefuel.
These
new generationEV's
had
characteristics almostI.
INTRODUCTION
(continued)
produced
EV's
showlittle
improvement
in
their
speed,
range,
or control systems.
This
last
areais
the
topic
dealt
within
this
thesis;
The
speed control of a pure electricII.
THE
CONTROL
SYSTEM
FOR AN
ELECTRIC
VEHICLE
A.
WHAT
NEEDS
TO
BE
CONTROLLED?
The
area ofinterest
has
been
limited
to
varying
the
motor speed while
leaving
the
transmission
ratios ofthe
vehicle constant.
Additionally,
the
topic
is
confinedto
the
pureelectric
vehicle.This
is
onethat
does
notcarry
any
active generationequipment,
such as a gas poweredalternator,
onboard.
The
form
of motor speedcontrol,
usedis
dependent
onthe
motortype.
Alternating
current motors require variationof
both
the
applied voltage andfrequency
to
change the'motor
speed,
whereasdirect
current motors requireonly
7
variation of
the
voltage.AC
motors are seldom usedin
EV's
due
to
the
complexity
ofgenerating
a sinusoidalAC
voltage
from batteries
whilemaintaining
reasonable effi
ciency-There
arethree
types
ofDC
motorsto
be
consideredfor
usein
an electric vehicle.They
are:1.
Series
2.
Shunt
(self
orseparately
excited)
3
.Compound
II.
A
(continued)
g
popularity
due
to
its
high
starting
torgue
.Figure
1
illustrates
the
three
motortypes
schematically
along
with9
their
corresponding
speed/ torque
curves.Note
the
rapidincrease
in
torque
exhibitedby
a series motor as comparedto
the
shunt motor.The
compound motor exhibits restrainedcharacteristics of
the
othertwo
types.
There
aretwo
waysto
vary
the
speed of aDC
motor.1
.Vary
the
armature current(used
to
controlthe
motor
below
its
ratedspeed)
2
.Vary
the
field
strength(used
to
controlthe
motor above
its
ratedspeed)
The
armature controltechniques
are similarfor
allthree
motortypes
asthe
armature currentsfor
comparably
sized motors are about
the
same.The
series motorhas
afield
current equalto
the
armature current soits
field
II.
A
(continued)
currents.
A
shunt
motortypically
has
ahigh
resistancefield,
drawing
less
than
5%
ofthe
total
motor current.This
allows areduction
in
the
size ofthe
field
controlcomponents.
However,
from
Figure
1,
the
starting
torque
of
this
type
of motoris
less
suitablefor
the
start andstop
environment
of an electric vehicle.A
good compromiseis
the
compound wound motor.It
offers ahigh
starting
torque
(although
not as great as a seriesmotor)
andhas
asecond
high
resistancefield
allowing
simplified motorcontrol.
The
penalty
is
ahigher
motor costdue
to
the
two
separatefield
windings.As
the
motorincreases
in
speed,
the
armature generatesa
back
electro-motiveforce
(EMF)
which opposesthe
appliedvoltage.
Hence,
the
motor armature currentdecreases
to
a value proportional
to
the
load.
If
while under constantload
the
field
strengthis
increased,
the
generatedEMF
also
increases,
thereby
decreasing
the
armature currentfurther.
Therefore
the
armatureis
not requiredto
turn
asfast
to
producethe
sameback
EMF
(i.e.
the
motorspeed,
assuming
a constantload,
willdecrease)
.If
the
field
strength
is
increased
to
the
point wherethe
generatedEMF
exceeds
the
applied armaturevoltage,
the
armature currentII.
A
(continued)
supplying
powerback
to
the
source.It
is
this
mechanismthat
is
exploitedin
the
inclusion
of regenerativebraking
in
an electric vehicle.The
powerdelivered
to
the
sourceis
extractedfrom
the
kinetic
energy
ofthe
load,
in
this
case
the
vehicle,
withthe
net resultbeing
adecrease
in
the
energy
ofthe
load
(slowing
ofthe
vehicle)
.In
a seriesmotor,
asthe
armature currentdecreases,
the
field
strength will alsodecrease.
A
decreasing
field
strength requires a
higher
armature speedto
maintainthe
back
EMF.
At
noload,
the
motor speed wouldtheoretically
have
to
approachinfinity.
This
overspeed conditionis
onereason series motor powered vehicles utilize
direct
drive
from
the
motorto
the
wheels, asthe
motor wouldbe
de
stroyed
if
allowedto
run unloaded.In
a shuntmotor,
the
field
strengthis
unaffectedby
the
motorload
and resultsin
a constant speedmotor,
even with
widely
varying
loads.
The
compoundmotor,
due
to
its
dual
fields,
has
a speedthat
varies withload
althoughnot as
severly
asthe
series motor.In
addition,
its
shuntwinding
allowseasy
application of regenerativebraking.
II.
A
(continued)
to
controlboth
field
strength and armature currentfor
greatest range of motor speed and
the
addedbenefit
ofregenerative
braking.
The
compound motoris
a good comproII.
THE
CONTROL
SYSTEM
FOR AN
ELECTRIC
VEHICLE
(continued)
B.
TECHNIQUES
FOR
MOTOR
CONTROL
To
vary
the
vehiclespeed,
it
is
sufficientto
controlthe
armature andfield
voltage ofthe
motor.There
areseveral
techniques
that
canbe
usedto
achieve voltagecontrol.
They
are:1.
insertion
of a series resistance2.
battery
tapping
3.
pulse width modulationFigure
2
illustrates
these
techniques
appliedto
both
armature and
field
control of a compound motor.The
smoothest controlis
obtainedby
the
continuously
adjustable pulse width modulation
technique
(PWM)
.In
aPWM
system,
the
voltageis
turned
on and off at ahigh
rate
(typically
200
hz.)
withvarying
duty
cycles.The
average voltage seen
by
the
motoris
determined
by
the
duty
cycle and
determines
the
motor speed.An
SCR
ortransistor
is
usedfor
the
switching
element.The
maindisadvantage
in
a system ofthis
type
is
cost.A
large
amount of powermust
be
controlledin
an electric vehicle.Startup
currents(i.e.
when vehicleis
initially
atrest)
can range ashigh
as
600
amps.Semiconductors
ableto
handle
this
amount ofcurrent are
presently
very
expensive.Additionally,
in
aII.
B
(continued)
the
peak currents couldbe
severaltimes
greaterthan
the
2
average current.These
high
current peaksincrease
the
I
R
losses
in
the
wiring,
motor,
andbatteries.
Battery tapping
resultsin
discrete
steps of vehiclespeed.
This
may
ormay
notbe
objectionaldepending
onthe
number of steps used.
There
aretwo
limiting
factors,
the
cost of additional
step
switches,
andthe
minimum voltagestep
available.Also,
the
batteries
in
the
lower
voltagehalf
ofthe
battery
bank
are subjectedto
more severedis
charge rates
than
those
ofthe
higher
bank.
This
is
due
to
the
large
motor current on startup.Over
a period oftime
this
canlead
to
prematurefailure
ofthese
batteries.
If
the
batteries
areperiodically
'rotated'this
problem canbe
reduced.The
resistive approachto
speed controldissipates
the
power,
that
wouldnormally
goto
the
motor,
asheat.
With
the
amount of power required andthe
limited
amount ofenergy
carriedby
anEV
this
is
not a practical solution.When
controlling
the
field
ofthe
EV
motor,
the
magnitude
ofthe
currentis
much smaller.Now,
any
ofthe
three
II.
B
(continued)
The
focus
ofthis
thesis
willbe
on abattery
tap
technique
for
armature(and
seriesfield)
control,
with aPWM
shuntfield
control used notonly
atfull
motorvoltage,
but
atintermediate
steps of armature voltageto
reducethe
II.
THE
CONTROL
SYSTEM
FOR
AN
ELECTRIC
VEHICLE
(continued)
C.
WHY
USE
A
MICROPROCESSOR?
The
Electric
Vehicle
speed control systemdescribed
to
this
point couldbe
implemented
by
a mechanicallinkage
ofcontacts and variable resistances.
However
there
are otherparameters
that
are of considerableimportance.
A
battery's
life
is
proportionalto
the
rate at whichit
is
discharged
andthe
depth
of eachdischarge.
Since
the
batteries
areusually
one ofthe
costliestitems
in
anelectric
vehicle,
it
is
advantageousto
increase
the
complexity
ofthe
control systemto
prolong
battery
life.
A
more
ideal
control system would monitor motor current.Based
onthe
motor current andthe
driver's
input
(via
the
accelerator)
,the
system would:a.)
increase
ordecrease
the
motor speedb.)
detect
and correct motor overloadsc.)
computethe
amount of chargeremaining
in
the
batteries
These
additionalfeatures
suggest anintelligent
system
that
mightbest
be
implemented
using
a microproII.
THE
CONTROL
SYSTEM
FOR
AN
ELECTRIC
VEHICLE
(continued)
D.
CHOOSING
A
MICROPROCESSOR
Practically
any
microprocessor canbe
usedin
a systemthusfar
described.
With
an analysis ofthe
system requirements,
it
is
possibleto
narrowthe
contendersby
establishing
alist
ofthe
desired
features
ofthe
microprocessor(uP)
.For
this
systemit
wouldbe
convenientif
the
processor
had
the
following
characteristics:a.)
onboard
RAM,
ROM,
clock(minimal
support chipsrequired)
b.)
integral
timer
(used
for
currentintegration
andPWM
generation)
c.)
low
powerstandby
(to
retain percent of remaining
chargeinformation
whenthe
vehicleis
parked)
d.
)
low
coste.)
readily
available and well supportedby
the
manufacturer
f.)
control orientedinstruction
setg.)
minimal number of required power suppliesIn
this
application,
the
processor's speedis
notcritical.
The
vehicle responsetime
willbe
in
the
hundreds
of
milliseconds,
allowing
the
processor ampletime
for
calII.
D
(continued)
As
it
meets most ofthe
desired
characteristics,
Intel's
MCS-48
serieshas
been
chosento
implement
this
system.The
prototype system will use
the
ROM-less
8035-L
whereasif
produced
in
large
quantities a maskedROM
804 8-L
couldbe
used.
The
-L version ofthe
MCS-48
seriesdesignates
the
II.
THE
CONTROL
SYSTEM
FOR
AN
ELECTRIC
VEHICLE
(continued)
E.
INTERFACE
REQUIREMENTS
The
inputs
and outputs neededfor
this
controlsystem,
along
withtheir
characteristics
are asfollows:
INPUTS
accelerator
-analog
voltage proportionalto
accelerator
positionmotor current
-bipolar
analog
voltage of millivolt
level
proportionalto
currentbrake
-digital
indication
ofbrake
on or offtemperature
-analog
voltage proportionalto
temperature
OUTPUTS:
armature-on/off control of contractors
for
various
battery
taps
field
-PWM
controlpercent of
remaining
chargeindication
-2
digit
BCD
codefor
LED
display
Note
that
temperature
has
been
added as a systeminput.
This
is
usedto
correctthe
percent ofremaining
charge value
that
is
displayed.
The
capacity
of abattery
at
0C
is
only
65%
ofthe
nameplaterating
ofthe
battery
(25C)
.While
not essentialto
the
controlsystem,
the
pro-II.
E
(continued)
tection
provided will extendthe
battery's
servicelife.
With
these
system considerations,it
is
now possibleto
design
the
hardware
neededto
performthe
desired
controlIII.
HARDWARE
A.
ANALOG
INPUT
BUFFERS
In
the
circuit ofFigure
3,
alinear
potentiometeris
mechanically
coupledto
the
vehicle's accelerator pedal.As
the
pedalis
depressed,
the
wiper movestowards
a referencevoltage,
Vrefl.
A
resistance/capacitance
network reducesnoise
that
may
be
introduced
in
the
lines
connecting
the
potentiometer
to
the
control circuitry.The
signalis
buffered
by
aunity
gainnon-inverting
operational amplifier.Vrefl
is
chosento
insure
a2.5
volt output whenthe
accelerator
is
fully
depressed.
This
is
the
full
scaleanalog
voltage needed
by
the
analog
to
digital
conversion systemand was chosen
for
full
scaleto
alloweasy
interface
be
tween
the
digital
logic
levels,
the
analog
multiplexers,
and
the
analog
input
buffers
.This
signalis
appliedto
input
port
3
ofthe
analog
multiplexer onthe
uPboard.
Vrefl
250K
Accelerator
100k
.luF
^
To muxIII.
A
(continued)
The
motor currentbuffer
(Figure
4)
utilized anoperational
amplifier
configured as adifferential
amplifier.
This
reducesthe
effects of common mode voltagesinduced
in
the
system groundby
high
motor currents.The
input
ofthe
amplifieris
connectedto
the
current shunt.Vref5
adds offsetto
the
output signal suchthat
-300 ampsof current
(i.e.
regeneration)
is
representedby
ananalog
signal of
0
volts.This
allowsthe
use of unipolarconver-VrefS
47k
47k
5k
>
To mux-vW
f-.luF
430
III.
A
(continued)
sion
routine.
The
shunt usedis
.25mohm(200
amps =50
mV)
and
therefore
Vref5
is
adjustedto
be
75
mV(300
x .00025).The
gain ofthe
amplifier
is
fixed
at12.5
so asto
providea
2.5
volt output with500
amps of motor current.A
feed
back
capacitance
is
usedto
reducethe
high
frequency
gainof
the
circuitthereby
reducing
the
noise content ofthe
output signal.
The
outputis
fed
to
input
port1
ofthe
analog
multiplexer.
A
1000
ohm negativetemperature
coefficientthermistor
is
used asthe
temperature
sensing
element(Figure
5)
.Buffer
resistors were placedboth
in
series and parallelwith
the
thermistor
to
provide alinear
responseto
tempera
ture
change.This
approximatesthe
discharge
characteristicsof a
lead-acid
battery
versustemperature.
Refer
to
Appendix
3
for
adiscussion
ofbattery
performance andthe
resistor/
thermistor
approximation usedhere.
Knowing
the
thermistor
resistance at
both
-20 and25
degrees,
the
necessary
thermi
stor current
for
the
proper span was calculatedfrom
the
equation:
((R(t=-20)-R(t=25) )xl=1.25
voltswhich when solved
for
I
using
the
valuesfrom Appendix
3
'yields :
III.
A
(continued)
An
offsetis
required suchthat
full
scale occurs at -20degrees
(C)
or:R(t=-20)xl
-Vos =2.5 volts.Vref3
is
adjustedto
1.05
voltsfor
the
proper offset.For
convenience,
to
add a negativeoffset,
the
requiredcurrent
is
halved
andthe
amplifier given a gain oftwo.
This
allowsadding
offset withoutupsetting
the
differential
operation of
the
circuit.As
the
offset voltagedoes
notget multiplied
by
the
amplifier,
the
predetermined valueis
still valid.
Vref4
is
adjustedfor
840
mVresulting
in
a+5
To mux
Thermistor
III.
A
(continued)
thermistor
current of .565 mA.The
output ofthis
circuitis
appliedto
analog
input
port#1.
The
various
reference voltages required aredeveloped
by
the
circuitillustrated
in
Figure
6.
They
arederived
from
a multiple resistivedivider
that
is
suppliedby
aconstant voltage.
A
temperature
compensated zenerdiode
is
usedto
regulatethe
voltage.Two
capacitors reducethe
amount of motor noisethat
is
pres.ent onthe
unregulatedCQ
en
+j
0) o c OJ Sh OJ
m
OJ
OJ M
H
III.
HARDWARE
(continued)
B.
POWER
SUPPLIES
The
mainlogic
supply
(shown
in
Figure
7)
obtainspower
from
the
auxiliary
battery.
This
supply
is
controlled
by
the
vehicle'signition
switch.A
diode
andlarge
valued capacitor ensurethat
the
supply
remains at5
volts
for
several milliseconds after poweris
removed.This
allowsthe
processortime
to
effect anorderly
shutdown
to
retainthe
memory
contents.+12 from ignition
switch
\7 1N4004
-^ +12
7S0S
2000UF
-P'
.luF
+5 logic
Figure
7
Power
Supply
III.
B
(continued)
A
secondsupply
(Figure
8)
is
sourceddirectly
from
the
battery
andis
usedto
powerthe
processor'sinternal
RAM.
This
supply
is
on at alltimes.
+12 from
battery
unswitched100
78L05
r \
200uF
y
^7
]
r.luF
+5 memory
+5A
Figure
8
Power
Supply
III.
B
(continued)
A
negativesupply
(Figure
9)
is
neededfor
the
analog
circuitry.
The
NAND
gatesform
an astable
multivibrator.This
AC
voltageis
appliedto
the
transformer
whose secondary
is
rectified so asto
provide a negative voltage withrespect
to
ground.A
Zener
diode
is
usedto
provide reguA
M--h
-rc-^<\
i
-\_r~
>
+J
en
OJ
S3
I
a,
CO
o
cn
III.
HARDWARE
(continued)
C.
POWER
INTERFACE
The
armatureinformation
from
the
processorcircuitry
is
usedto
drive
the
relay
coils via aDarlington
transistor
circuit.
As
shownin
Figure
10,
the
relay
contactsK1-K5
are connected
between
the
motor armature andthe
variousbattery
taps
.Fuses
areincluded
to
protectthe
vehicleif
arelay
contact should weld shut.The
pulse width modulationcircuitry
is
optically
isolated
to
preventthe
high
voltage spikesin
the
motorfield winding from
reaching
the
processor.The
circuitis
ahigh
gainDC
amplifier withtwo
powertransistors
paralleled
to
drive
the
field
winding.Relays
K7
,K8
remove powerfrom
the
field
circuitry
when
the
vehicleis
parked.Relay
K6
allowsthe
armature relaysto
function
only
when
field
voltageis
applied.This
prevents an overspeedcondition
in
the
event of afailure
in
the
field
driver
III.
HARDWARE
(continued)
D.
MICROPROCESSOR
AND
SUPPORT
The
microprocessor
usedin
this
control
system(illu
strated
in
Figure
11)
is
the
ROM-less
version ofINTEL'S
MCS-4
8
series,
the
80 35.
Program memory is
containedin
Z2,
aIk
by
8
EPROM
(2758).
The
data
bus
ofthe
processoris
connectedto
latch/
decoder/
drivers
(Z12,
Z13)
that
interfaces
to
the
percentof charge
display.
A
writeto
externalmemory
commandup
dates
the
display
asthe
display
latch
is
activatedby
the
WR
line
ofthe
processor.The
lower
nibble of port2
(bits
0-3)
is
multiplexedwith
the
addresslines
(8-11)
internal
to
the
8035.
Latch
Z7
retainsthe
information
output onthe
portduring
the
memory
access cycle ofthe
processor.The
most significantbit
of port2
is
the
pulse widthmodulation output
for
field
control.Bit
6
is
presently
unused.
Bits
4
and5
addressthe
analog
multiplexerto
select
the
analog
input
quantity
to
be
convertedby
the
analog
to
digital
routine.Bit
3
turns
offthe
field
re-w u o
<
D S3
O
H H &<s
O
III.
D
(continued)
ducing
battery
drain
whenthe
motoris
turned
off.The
remaining bits
aredecoded
in
a3
to
8
line
encoder andcontrol
the
armature relays.Port
1
is
usedexclusively
to
create anA/D
conversioncircuit.
It
transmits
the
digital
approximation ofthe
analog
input
to
the
Digital
to
Analog
converterchip
Z3.
Z3
convertsthis
valueto
ananalog
voltage whichis
then
compared viaZ4
to
the
corresponding
input.
When
the
estimated value
becomes
too
large,
the
processoris
signaledby
Z4
using
the
processor'sTO
input.
The
resetline
ofthe
processoris
controlledby
the
ignition
switch.The
processoris
resetimmediately
uponthe
ignition
switchbeing
turned
off sothat
asthe
processor
supply
is
removed,
anorderly
shutdown ofthe
processor
is
guaranteed.This
protectsthe
contents ofthe
internal
RAM
which containsthe
batteries
' percent ofIII.
D
(continued)
The
status ofthe
vehiclesbrakes
is
sensedby
monitoring
the
voltage appliedto
the
brake
lights.
This
IV
.SOFTWARE
A.
PULSE
WIDTH
MODULATION
The
pulse widthmodulation
control ofthe
field
voltageis
generatedutilizing
the
internal
timer
generatedinterupt
of
the
80 35
microprocessor.The
duty
cycleis
containedin
alook
up
table
that
is
accessedaccording
to
the
controlword address and accelerator position.
Upon
entering
this
routine,
it
is
necessary
to
savethe
accumulator contentsas
the
timer
interrupt
is
unpredictable.It
can occur atany
pointin
the
program,
including
the
subroutines.Figure
12
presents alogical
flowchart
ofthe
pulsewidth modulation subroutine.
The
control word addressis
loaded
from
a register commonto
the
main program.Then
the
actual control wordis
loaded
and allbits
exceptthose
dedicated
to
field
control are removed.If
the
field
is
on,
the
offtime
is
computed and vice-versa.If
the
offtime
is
zero(i.e.
full
field
voltageis
required)
the
timer
is
reloaded withthe
ontime.
The
proper
time
is
loaded
into
the
timer,
the
accumulator restored,
the
timer
restarted,
andthe
processor continuesENTER
yes
off
timeA^^5-=0
1
turn offtimer
V
save
accumulator
V
load control word
y
compute on time
V
turn on field
-2
V
load timer
V
restore
accumulator
V
restart
timer
V
RETURN
Figure
12
Pulse
Width
Modulation
IV.
A
(continued)
Note
that
if
the
field
is
on whenentering
the
routine,
a
loop
counteris
decremented.
As
the
sura ofthe
off andon
times
is
a constant(3.3ms)
a realtime
clockis
formed.
This
clockis
usedto
determine
the
integration
rate ofthe
current
discharge
andto
setthe
relay
delay
time.
The
structure ofthe
control wordis
shownin
Figure
13
along
with atiming
chart ofthe
pulse width modulationroutine. and an example of
the
control wordtable
organization.
Refer
to
the
programlisting
(Appendix
1)
for
a)
ACCELERATOR
TABLE
table
address00
01
02
29
30
31
hex
00
8F
9F
D2
Dl
DO
ol word motor voltages
binary
field
armature0000
0000
0
0
1000
1111
36
0
1001
1111
*
36
12
1101
0010
16.5
t
36
1101
0001
15
36
1101
0000
13.5
36
b)
CONTROL
WORD
master field switch armature control 2 armature control 1 armature control 0 field control 3 field control 2 field control 1 field control 0
c)
FIELD
VOLTAGE
TIMING
Field on
Field off
interrupts occur here
I
1I
t=0 t=n t=3.3mS
1.2jn<3. 3mS
0< field control word<F
IV
.SOFTWARE
B.
ANALOG
TO
DIGITAL
CONVERSION
Figure
14
presents
the
logical
flowchart
ofthe
Analog
to
Digital
conversion
subroutine.
After
roadtesting
the
controlsystem,
it
wasfound
necessary
to
modify
the
analog
to
digital
routine(A/D)
from
asuccessive
approximation
styleto
anintegrating
approximation
technique.
This
greatly
reducedthe
noiseinfluence
onthe
conversion.
The
processorfunctions
in
conjunction with an8
bit
digital
to
analog
converter(D/A)
.A
digital
wordis
sentby
the
processorto
the
D/A
converter whichin
turn
outputsan
analog
signal proportionalto
the
digital
input.
The
output of
the
D/A
is
compared(via
the
comparator)
to
the
incoming
signalthat
has
been
selectedbefore
entering
this
routine.
The
output ofthe
comparatoris
fed
back
to
the
processor.
If
the
analog
approximationis
too
small,
the
digital
word sentto
the
D/A
is
incremented
by
1.
In
this
manner,
the
analog
approximationintegrates
up
to
the
analog
initialize
trial
St-send trial to D/A
wait for
comparator
ready next
trial
IV-
B
(continued)
When
the
approximation exceedsthe
input
value,
the
comparator signals
the
processor whichthan
usesthe
previous approximation as
the
conversion result.If
the
analog
input
is
over range, a counterin
the
routine overflows
to
indicate
this
condition.A
full
scale valueis
returned
in
this
situation.All
data
transfer
occursthrough
the
accumulator.Worst
case conversiontime
is
IV.
SOFTWARE
C.
MULTIPLICATION
SUBROUTINE
It
is
wellknown
that
whenmultiplying
two
eightbit
binary
numbers,
their
product canbe
aslarge
as sixteen
bits.
In
this
control system a number ofthat
precision
is
inconsequential.
The
errorsin
the
digital
to
analog
converter(8
bit
resolution)
andthe
analog
buffer
circuits
define
the
resolution ofthe
internal
mathematics.Therefore,
this
multiply
routine,
whileusing
the
standard'shift
and add'multiplying
technique,
allowsthe
lower
eight
bits
ofthe
productto
'fall
off,
leaving
the
mostsignificant eight
bits
asthe
result.The
multiplieris
considered
to
be
a positive numberbetween
zero and"one'.'(255/256)
.As
such,
the
maximum numberthat
canbe
returned
as~a productis
the
multiplicand(i.e.
multiplier ="one").
This
structureis
illustrated
in
Figure
16.
Figure
16
is
the
logical
flow
chart ofthis
unsignedmultiplicand
multiplier
result
discarded
Figure
15
Multiplicationset counter =8
_Y_
clear product
J
rotate result
through carry
V
rotate multiplier
through carry
yes
V<-RETURN
_Y.
add
multiplicand
to result
IV
.SOFTWARE
D.
MAIN
PROGRAM
Figures
17a
to
17
c outlinethe
logic
flow
ofthe
mainprogram.
Upon
application
of power(ignition
switchto
'on')
the
processoris
internally
resetto
address00
by
a poweron reset circuit.
The
programfirst
makes surethat
allmotor
drive
signals are setto
'off
to
prevent arunaway
vehicle.
Then,
the
starting
control word and variouspointers are
initialized.
The
main programloop
begins
by
resetting
the
regeneration
flag
andthe
continuous overloadflag.
Any
overloadshould
have
been
remediedin
the
previous programloop
by
the
protection routines.If
the
batteries
have
been
recharged,
a switchis
activatedby
the
driver
andthe
programresets
the
chargeindication
display
to
99%.
Motor
currentis
input
by
first
selecting
the
properanalog
channel(00)
viathe
multiplexer andthen
calling
the
A/D
subroutine.As
the
A/D
converter operates onpositive signals
only,
the
software subtractsthe
positive<
slaarr*?anr*tion
Andovrlo*4
flags
V
addraaa
Laput ecvlarator
*<-0
<^>
LaerMM
ntordrlvi
OOBtXOlbit*
.X^bMlMV.brk\ / ^SsJx^^
\' tornoffMrtlv*
raity
'
* '
>* uloullUIMmM
$
IV.
D
(continued)
The
polarity
ofthe
currentis
determined
to
tell
the
operational mode of
the
motor;
a positive current representsa
motoring
condition,
and a negative current representsthe
generating
mode.Two
different
paths arefollowed
depend
ing
onthe
polarity
:1.
MOTOR
-If
the
motoris
drawing
morethan
400
ampsfrom
the
batteries
, adelay
registeris
decremented
to
indicate
a shortterm
overloadhas
occured.When
this
registeris
decremented
to
zero,
the
overload
is
considered continuous andthe
overloadflag
is
set.A
shortterm
overload would occurwhen
shifting
gears orstarting
the
vehiclefrom
a standstill.
Setting
the
flag
indicates
the
current must
be
reducedto
preventdamage
to
the
motor and/or
batteries.
This
type
of overloadwould occur
during
fast
acceleration,
climbing
asteep
grade,
orstarting
in
the
wrong
gear.A
continuous overload
has
been
defined
as a currentgreater
than
400
ampsfor
a period greaterthan
3
seconds.
Three
secondsis
anarbitrary
time
chosenso as
to
be
long
enoughto
prevent nusiancede
tection
ofmomentary
surgesin
motor currentbut
short enough
to
prevent motordamage
during
aIV.
D
(continued)
Since
the
discharge
rate ofthe
batteries
is
temperature
dependent,
the
thermistor
is
addressed(01)
andthe
battery
temperature
is
convertedto
digital
format.
The
temperature
factor
is
multiplied
by
the
currentfor
an adjusteddischarge
rate which
is
then
multipliedby
the
display
constant
before
being
subtractedfrom
the
display.
The
display
constantis
discussed
in
detail
in
Appendix
2.
REGENERATION
-The
regenerationflag
is
setto
indicate
reverse currentflow
andthe
magnitude ofthe
currentis
checkedto
seeif
it
exceeds260
amps.
A
delay
systemidentical
to
that
described
in
MOTOR
aboveis
usedhere
also.Short
term
overloads
would occurinitially during down-shifting
and continuous overloads would occur when
descend
ing
asteep
grade.The
lower
currentthreshold
was chosen
to
preventwarping
ofthe
battery
platesand rapid generation of
hydrogen
gas causedby
this
current
has
been
recommended asthe
maximum rechargecurrent
for
two
6
voltbatteries
operatedin
IV.
D
(continued)
The
recharge rate of abattery
is
notgreatly
affected
by
temperature
soin
this
loop
the
thermi
stor
is
not addressed.The
charge currentis
multiplied
by
the
charging efficiency
of abattery
(80%)
andthen
by
the
display
constantbefore
being
added
to
the
display.
At
this
point,
both
paths rejoin.After
the
display
is
updated,
the
program checksfor
a continuous overload.
If
oneis
present,
the
acceleratoris
bypassed
and
the
motordrive
is
adjusted so asto
removethe
overload condition.
This
includes
increasing
the
motor
drive
to
reduce agenerating
overload orde
creasing
the
motordrive
for
amotoring
overload.In
the
absense of continuousoverloads,
the
acceleratoris
addressedCO
3)
andits
positionis
input*
If
ashort
term
overloadis
present,
the
acceleratoris
followed
only
if
it
is
in
adirection
that
wouldeliminate
the
overload.As
many
loops
expirebefore
ashort
term
overloadbecomes
a continuousone,
it
wouldIV.
D
(continued)
therefore
the
magnitude ofthe
overcurrent withoutthis
test.
This
check allowsadvancement
only
whenthe
currentis
withinthe
normaloperational
boundries
(-2 60 <;
I <
400)
.For
a complete absense ofoverloads,
the
acceleratoris
comparedto
the
present control word address.A
larger
value of
the
accelerator causesthe
control addressto
be
incremented,
whereas a smaller value causes adecrease
oftwo
in
the
control address .This
variation was added afterroad
testing
ofthe
vehicle.Single
decrementation
gavethe
feeling
of arunaway
vehicle,
asthe
braking
effect ofthe
motoris
negligiblefor
a onestep
changein
the
controltable.
The
dual
step
size moreclosely
approximatesthe
feel
of a gas powered vehicle.Once
the
motor control wordis
revised,
the
processorchecks
for
a signalfrom
the
brake
input
if
the
vehicleis
decellerating.
If
present,
abranch
occursfor
additionaltesting.
This
willbe
discussed
later.
Assuming
the
brake
is
notapplied,
the
new control wordis
loaded
from
the
table.
The
three
pertinentbits
of armatureinformation
IV.
D
(continued)
different,
the
presently
energized armaturerelay
is
turned
off.
Then,
if
complete motor shutdownis
notrequired,
aperiod of
160
mSis
allowedbefore
turning
onthe
new relay.This
allowstime
for
the
contactsto
respond,
insuring
that
no relays are closed simultaneously.
A
condition ofthis
sort would place a
direct
short circuit across abank
ofbatteries
with afault
current ofthousands
of amps.Fuses
back
up
this
software protectiondue
to
the
severity
of afailure
,however
remote.The
programis
directed
into
adelay loop
until atotal
loop
time
of254
mS expires.Alternately/
the
loop
may
be
exited
by
application ofthe
brake.
This
allowsfast
reaction
to
this
input.
When
the
brake
is
detected,
the
control wordis
additionally
decremented
to
increase
the
amount of regenerativebraking
(unless
a regenerative overload exists).If
the
brake
is
on andthe
motoris
drawing
power,
then
the
brake
and motor are
opposing
each other.This
situation resultsin
the
motorbeing
immediately
shutdown.
A
panicstop
in
IV.
D
(continued)
the
batteries
quick enough(while
stillmaintaining
safecurrent
levels)
will resultin
this
condition as willbring
ing
the
vehicleto
afull
stop
withthe
clutch engaged.Upon
completion ofthe
braking
sequence,
the
programreturns
to
adelay loop
to
awaitthe
end ofthe
234
mSde
lay.
The
registerbeing
decremented
asthe
delay
counteris
modified
by
the
timer
interrupt
subroutine which also controls
the
field
voltage.At
the
completion of eitherdelay
loops,
the
delay
V.
THE
TEST
VEHICLE
A.
DESCRIPTION
The
control system wasinstalled
in
atest
vehiclafor
'real
world'evaluation.
The
vehicleis
a1967
English
Ford,
Anglia
105E.
Originally
poweredby
a conventionalgasoline
engine,
it
has
been
modifiedto
become
an electricvehicle.
The
modificationinvolved
removing
of all gasoline related
components(engine,
gastank,
etc.).The
transmission
was retained
along
withthe
clutchto
provide moretorque
to
the
wheels atlow
vehicle speed andto
reduce motorcurrents on vehicle startup.
The
rear seat was removed andthe
resulting
area used as abattery
compartment.Nine
Deka
model9G
batteries
are storedin
this
location.
Each
battery
weighs64
pounds.The
rear suspensionhas
been
stiffened
to
supportthis
additional weight.Three
batteries
and a
General
Electric
10
horespower
starter/generator aremounted
in
the
engine compartment.All
lights,
accesories,
and
the
control system power requirements arefurnished
by
an
auxiliary
12
volt automotivetype
battery
(Sears)
located
in
the
trunk.
The
control systemhas
been
fastened
to
the
V.
A.
(continued)
The
specifications ofthe
completed vehicle areTABLE
1
SPECIFICATIONS
OF
TEST
VEHICLE
14
Wheelbase
Body
Transmission
Tires
Rear
Axle
Weight
(Original)
Weight
(Electric)
Motor
.
15
Batteries
90.5
inches
Monocoque,
front
engine,
reardrive
4
Speed
Manual
5.20x13
4
ply
4.44:1
1645
lbs.
2350
lbs.
10
hp,
30
vdc,
Compound
Field
V.
THE
TEST
VEHICLE
B.
PERFORMANCE
OF
THE
CONTROL
SYSTEM
Even
withthe
modifiedsuspension,
the
battery
weightdistribution
causeddifficulties
in
handling
the
vehicleat moderate speeds.
For
this
reason,
it
was not possibleto
license
the
test
vehiclefor
on road use.However,
aconsiderable amount of
back
roadtesting
was accomplished.Although
not as conclusive aslong
distance
driving,
these
limited
test
drives
produceddata
that
is
encouraging.Additional
work onthe
test
vehicle willbe
done
in
the
coming
yearto
provide more complete results .It
is
anticipatedthat
whenthe
vehicleis
stabilized,
fourth
gear willbe
ableto
be
usedto
obtainhigher
vehiclespeeds.
An
increased
motor current willbe
required atthese
higher
speeds, sothe
maximumdistance
that
canbe
travelled
will not change or willpossibly
decrease.
It
is
again obvious
that
the
weaklink
in
an electric vehicleis
the
energy
source.One
ofthe
majordisadvantages
ofthe
battery
tap
V.
B
(continued)
is
changed.
It
is
especially
noticeablein
low
voltagesystems where
the
tap
changeis
aconsiderable
percentageof
the
total
motor voltage.The
intent
ofthe
controlsystem
described
in
this
thesis
wasto
adjustthe
field
voltage
to
minimizethe
severity
ofthe
tap
change effects.While
this
wasaccomplished,
the
final
results were not assmooth as
anticipated.
The
torque
ofthe
motoris
reducedas
the
field
is
reduced sothat
the
vehicledoes
not accelerate
atthe
same rate as whenthe
armature voltageis
stepped.
Hence
a
smoothtransition
does
not occur.Also
noticeable was
the
150
mSdelay
usedto
allowthe
relaystime
to
settle.As
the
control systempresently
usesthe
smallest voltage
tap
sizethat
is
available,
the
alternative
is
aPWM
armature control.Unfortunately,
this
wouldgreatly
increase
the
cost ofthe
system.The
accelerationtime
wasslightly
longer
than
anticipated.
(Table
2)
This
time
is
controlledby
the
over-current
delay
time
allowedby
the
program.Increasing
the
delay
time
woulddecrease
the
accelerationtime
atthe
exV.
B
(continued)
as
easy)
wouldbe
to
reducethe
rolling
resistance ofthe
vehicle.
This
couldbest
be
done
with a vehicle specifically
built
for
electric propulsion.The
final
data
for
the
test
vehicleis
shownin
Table
2
These
values arethe
average ofdata
taken
under variousconditions and revisions of
the
test
vehicle.During
these
tests,
the
vehicle wascarrying
a single passenger on anaverage
trip
length
of1.1
miles.The
longest
distance
travelled
without astop
was .2 miles.Two
complete stopsTABLE
2
PERFORMANCE
OF
TEST
VEHICLE
Top
speedTime
to
top
speed(from
standstill)
33mph
(in
3rd
gear)
14
secondsDistance
attop
speedDecelleration
time
(from
top
speed^
to
end of
regeneration)
31
miles*6
secondsMotor
current(level
road,
top
speed)310
amps*
Calculated
from
%
of chargedisplay
by driving
at conVI
.SUMMARY
The
control systemdescribed
in
this^tesis
Ys
alow
cost
(
$300)
systemdesigned
to
control thes'peed of anelectric vehicle
by
adjusting
the
speed of a compound woundDC
motor.Since
it
uses amicroprocessor,
it
is
readily
adaptable
to
avariety
of motor voltages and motor controltechniques
by
modifying
aninternal
firmware
acceleratormap.
It
is
this
map
that
determines
the
vehicle's speed.The
methoddeveloped
in
this
systemis
a combination ofbattery
tapping
for
control ofthe
armaturevoltage,
andpulse width modulation
field
control generatedby
the
processor.
Overcurrent
protection wasincluded
to
prolong
battery
and motorlife.
Regeneration
is
automatic uponrelease of
the
accelerator andhas
two
levels.
The
first
is
alight
regenerationsimulating
the
braking
effect of agasoline engine.
The
secondlevel
is
executed whenthe
brakes
are applied.Here,
the
goalis
to
return as muchenergy
from
the
vehicle as canbe
safely
delivered
to
the
batteries