X-File: Understanding VESC: the difference between "battery amps" and "motor amps"
#1
[Image: fancy-switch.jpg]





The information in this post was recovered from a back-up archive of posts by user @devin after some of the information was hidden, deleted or removed from the Electric-Skateboard.builders forum.


Link to Original Thread @ Electric-Skateboard.builders

------------------------------------------

Understanding VESC: the difference between "battery amps" and "motor amps"

@devin
2017-01-13 00:19:32 UTC

In any attempt to understand the VESC, one must grasp basic equations governing the software:

- battery amps x pack voltage = wattage into motor

- (motor amps x (% duty cycle / 100)) x pack voltage = wattage into motor

- battery amps = (motor amps x (% duty cycle / 100))

- % duty cycle = (battery ampsmotor amps) x 100

^ these ratios will be true at all times in any VESC data logging video

the meaning of "battery amps" and "motor amps" ... a constant source of tension in the esk8 community....

these equations may sound objectionable to many at first glance!

indeed they did to me. but i challenge anyone to show a single frame of a vesc logging video under throttle which does not match the equations.

ANY VESC logging video proves the fundamental difference in meaning between "MOTOR amps" and "BATTERY amps" in the VESC.

If anyone can DISPROVE any of these equations with a single logging video still frame which doesn't match the equations, please post here.

Also, please post any logging video still frames which do support the equations and basic definitions.

",1,0,http://www.electric-skateboard.builders/t/understanding-vesc-the-difference-between-battery-amps-and-motor-amps/15995/1,2017-01-13 00:19:32 UTC

[Image: 48-200-200-1.png]

[Image: 48-200-200-2.png]




[Image: h.jpg]
Reply
#2
Now I propose a thought experiment:

Understanding the VESC: Software

For the purposes of this SOFTWARE thought experiment, we will assume the VESC's physical HARDWARE is immune to any form of damage.

How will changing numerical software parameters change the performance of the motor?

How will changing "Battery Amp Limit" and "Motor Amp Limit" alter the performance (acceleration, top speed & hill climbing of the motor)?

What are some of the real world numbers we can use for this experiment?

",0,0,http://www.electric-skateboard.builders/t/understanding-vesc-the-difference-between-battery-amps-and-motor-amps/15995/2,2017-01-13 02:20:31 UTC
Reply
#3
Any type of software, including VESC software, takes numerical inputs (ie from sensors or programming instructions stored in memory), performs calculations on these numbers, then generates numerical outputs.

Numerical input -> calculation -> numerical output

What does the numerical output of the VESC software actually do?

In oversimplified terms the numerical output controls on-off switches (called mosfets) sitting between the battery and motor.

what does the software do to the switches?

there are actually multiple switches and the main degree of control the software has over the switches is the percent of each second the switches remain on for and the sum of all this switching activity can be averaged into a single number called "Duty Cycle" which is the average percent of time in a single second that electricity is flowing from the battery. If electricity flows on average %50 of one whole second this is %50 duty cycle.

Ultimately the numerical output of the software controls the "% Duty Cycle" or "% ON TIME" of the switches."

,0,1,http://www.electric-skateboard.builders/t/understanding-vesc-the-difference-between-battery-amps-and-motor-amps/15995/3,2017-01-13 03:08:00 UTC
Reply
#4
lowGuido, post:4, topic:15995 Wrote:what are you trying to prove here?

- determine hardware independent VESC input software parameters required to achieve any desired system performance (acceleration, top speed, hill climbing)

- identify which hardware independent VESC input software parameters if any may be bottlenecking or causing undesired or unexpected performance

",0,0,http://www.electric-skateboard.builders/t/understanding-vesc-the-difference-between-battery-amps-and-motor-amps/15995/5,2017-01-13 03:45:22 UTC
Reply
#5
What effect will different choices of "Battery Amp Limit" and "Motor Amp Limit" settings have on acceleration?

Anonymous ESK8 Rider ""A"" Shared these numbers:
500 watts desired from battery full throttle
50V pack
0.2386 ohm windings
2 motors
x/x/x batt/motor/absolute amp limit settings

From the above values it is simple to calculate the settings that are necessary to reach various performance targets.

Only one set of batt/motor/absolute amp max settings gives the Rider's desired low speed 500w / all speeds under 500w values. Some values give uneven "low speed watt" / "all speed watt limit" values:

5/33/33 gives 500w total available electrical watts at low (under 200rpms) speeds, but at higher speeds, no more than 500w total available electrical watts (500w/500w) <-- even

20/50/50 gives 1193w total available electrical watts at low (under 200rpms) speeds, but at higher speeds, no more than 2000w total available electrical watts is available (1193w /2000w) <-- uneven/unequal

20/30/30 gives 429.48w total available electrical watts at low (under 200rpms) speeds, but at higher speeds, no more than 2000w total available electrical watts (429.48w/2000w) <-- uneven/unequal

----------
the math to make these predictions is all very straightforward

ohm's law
volts = amps x resistance
volts x amps = watts

rider has 2 motors so desired 500 watts is 250 watts per motor

solve for 0.2386ohm and 250 desired watts:

volts = amps x 0.2386 ohm resistance
volts x amps = 250 watts

enter the 2 numbers into an ohm's law calculator to find the other 2 answers:

7.72 volts = 32.36 amps x 0.2386 ohm resistance
7.72 volts x 32.36 amps = 250 watts

this gives us 4 values:
7.72 volts
32.36 amps
0.2386 ohms
250 watts

how do these numbers tell us how to choose battery amp limit and motor amp limit?

the 32.36 amps value, rounded up to 33, turns out to be the motor amp limit required to achieve 250 watts-electrical-into-motor while accelerating full throttle at low (under 200rpm) speeds

since there are 2 motors, 2 x 250W = 500W (the desired battery draw limit)

since we don't want more than 250 watts per motor at any speed, the battery amp limit is calculated as follows:

250W / 50V pack voltage = 5 battery amp limit

this gives us:
5 battery amp limit
33 motor amp limit
500w low speeds & no more than 500w any speed resulting in the evenest acceleration possible limited to desired 500w battery draw electrical (2 x 250W motor draw electrical)

in conclusion:

we started by knowing winding resistance, pack voltage, desired battery max wattage and number of motors

from this we calculated the appropriate battery amp limit and motor amp limit settings.

it is outside the scope of this particular thought experiment to say whether or not any particular values for these settings will or will not harm a VESC or other components.

but from a purely software perspective, the calculated 5 battery amp limit and 33 motor amp limit effectively achieves the rider's electrical power input and steady-acceleration goals.

devin, post:3, topic:15995 Wrote:Ultimately the numerical output of the software controls the "% Duty Cycle" or "% ON TIME" of the switches.

so how do those 5/33 batt motor max limits we inputted into the VESC exactly mathematically determine the controller's on-off switching % Duty Cycle during the very first moments of  acceleration?

remember those 4 numbers we got out of the ohm's law equation?

7.72 volts <------------ divide this number by the battery pack voltage, then x 100
32.36 amps
0.2386 ohms
250 watts

this gives us 7.72 volts / 50 volts = 0.1544
0.1544 x 100 = %15.44

%15.44 will be the contoller's initial on-off % duty cycle during full throttle acceleration (under 200) rpms.

",3,1,http://www.electric-skateboard.builders/t/understanding-vesc-the-difference-between-battery-amps-and-motor-amps/15995/6,2017-01-13 05:06:34 UTC


long story short from last post:

choice of batt/motor/absolute amp limit settings directly determines the on time % duty cycle of the VESC during acceleration, which in turn directly controls electrical wattage into motor which in turn directly affects rate of acceleration.

--------------

what if 3 different riders all want 500 watts battery draw max with even acceleration, using completely different setups and boards? what batt/motor amp limit settings would each rider choose to get 500W battery max? (setups are immune to damage for thought experiment)

Anonymous ESK8 Rider "A" Shares these numbers:
500 watts desired from battery full throttle
50V pack
0.2386 ohm windings
2 motors

result:
5/33/33 batt/motor/absolute amp limit settings for 500w
10/46/46 batt/motor/absolute amp limit settings for 1000w

Anonymous ESK8 Rider "B" Shares these numbers:
500 watts desired from battery full throttle
35V pack
0.0415 ohm windings
1 motor

result:
15/109/109 batt/motor/absolute amp limit settings for 500w
29/156/156 batt/motor/absolute amp limit settings for 1000w

Anonymous ESK8 Rider "C" Shares these numbers:
500 watts desired from battery full throttle
37V pack
0.02058 ohm windings
1 motor

result:
14/155/155 batt/motor/absolute amp limit settings for 500w
27/220/220 batt/motor/absolute amp limit settings for 1000w

Conclusion: widely different batt/motor/absolute settings are required to obtain 500W battery max & even acceleration wattage on differently configured ESK8 boards.

",0,0,http://www.electric-skateboard.builders/t/understanding-vesc-the-difference-between-battery-amps-and-motor-amps/15995/7,2017-01-13 06:23:36 UTC

Are there any other important and useful mathematical formulas for understanding the VESC software?

It turns out there is a very interesting mathematical relationship that always exists in a VESC between "motor amps" "battery amps" and "on time % duty cycle". If you know the true values of any 2 of these numbers, you can calculate the value of the 3rd number.

For example:

- if you know the instant "motor amps" and "battery amps" values, you can calculate the "on-time % duty cycle"

- if you know the instant "on-time % duty cycle" and battery amps values, you can calculate the motor amps

- if you know the instant "on-time % duty cycle" and motor amps values, you can calculate the battery amps

The formulas for the relationship between these values are:

battery amps x pack voltage = wattage into motor

- (motor amps x (% duty cycle / 100)) x pack voltage = wattage into motor

- battery amps = (motor amps x (% duty cycle / 100))

- % duty cycle = (battery amps / motor amps) x 100

^ these ratios will be true at all times & can be seen in any VESC data logging video during throttle use, such as this one by Benjamin Vedder:





",0,1,http://www.electric-skateboard.builders/t/understanding-vesc-the-difference-between-battery-amps-and-motor-amps/15995/8,2017-01-13 07:23:32 UTC
Reply
#6
how can I tell if any of these calculations are accurate?

I picked a random still frame from Benjamin Vedder's data logging video:

[Image: vesc-log.png]

Let's take a look at the pertinent values.

From this still frame we can grab 5 pertinent values:
Power: 433.5 watts
Duty Cycle: 77.10%
Battery Current: 13.42 amps
Motor Current: 17.34 amps
Pack Voltage: 32.3 V

devin, post:8, topic:15995 Wrote:The formulas for the relationship between these values are:

- battery amps x pack voltage = wattage into motor

- (motor amps x (% duty cycle / 100)) x pack voltage = wattage into motor

- battery amps = (motor amps x (% duty cycle / 100))

- % duty cycle = (battery amps / motor amps) x 100

let's look at each of each of these formulas separately and compare whether they match the random logging data frame:

battery amps x pack voltage = wattage into motor
13.42A x 32.3V = 429.44 watts (actual 433.5 watts)
^verified 99.06% accuracy

motor amps x (% duty cycle / 100)) x pack voltage = wattage into motor
(17.34A x (77.1% duty cycle / 100) x 32.3V = 431.82 watts (actual 433.5 watts)
^verified 99.61% accuracy

battery amps = (motor amps x (% duty cycle / 100))
13.36A (actual 13.42A) = (17.34A x (77.1% duty cycle / 100))
^verified 99.7% accuracy

% duty cycle = (battery amps / motor amps) x 100
77.57% duty cycle (77.1% duty cycle actual) = (13.42A / 17.34A) x 100
^verified 99.39% accuracy

[Image: MOSFETs.jpg]

",1,1,http://www.electric-skateboard.builders/t/understanding-vesc-the-difference-between-battery-amps-and-motor-amps/15995/10,2017-01-13 10:13:02 UTC
Reply
#7
Why does the Motor Amp limit need to be so much higher than the Battery Amp Limit to achieve even acceleration?

What does a "Motor Amp" even mean?!

What are the implications for the humble "Battery Amp?"

How do different "% duty cycle on" values affect all these different amps?

Let's assume on a certain random VESC data logging frame, we see:

Duty Cycle = %50
Battery Amps = 10

What does this look like in the wires coming from the battery?

Is it a continuous stream of electrons flowing at a steady rate of 10 amps DC?

Since the % ON TIME = %50, it is definitely not a smooth continuous steady stream of electrons.

The electricity is flowing in a constant direction ( DC ) but turning on and off rapidly in a series of PULSES. This is pulsed DC.

In a dramatic oversimplification, lets say that in 1 second there were 400 evenly spaced pulses. The %50 duty cycle would mean the 400 evenly spaced pulses were each ON for 1/800th of a second.

With our basic coulometer we are measuring 10 steady amps from the battery but in fact it is 400 evenly spaced ON pulses in one second, each lasting 1/800th of one second.

This is Pulsed DC @ %50 duty cycle = 400hz @ 1/800th second @ 10 battery amps.

This is known as Pulse Width Modulation.

",2,0,http://www.electric-skateboard.builders/t/understanding-vesc-the-difference-between-battery-amps-and-motor-amps/15995/11,2017-01-13 20:57:45 UTC
Reply
#8
theory ?: "BATTERY amp limit" and "MOTOR amp limit" (in PC-side software) should allow precision up to at least (2) decimal places. (ie 10.74 / 50.25 batt / motor max amp limit settings)

assuming perfect hardware these 2 values should not be arbitrarily limited under 200 A

",0,0,http://www.electric-skateboard.builders/t/understanding-vesc-the-difference-between-battery-amps-and-motor-amps/15995/12,2017-01-13 23:26:04 UTC
Reply
#9
it depends if the shunt is rated in DC terms. (But often times we are using pulsed DC from the battery) If the shunt "limit" is 160 amp DC  A.k.a. "Battery amps", this has a different meaning from 160 "motor amps" as implied earlier.

 we won't know until someone ponies up to a real world test.

 also the "software" thought experiment presumes no hardware damage is possible

we are only looking at which software numerical values are required for a given performance, with a given rig

",0,0,http://www.electric-skateboard.builders/t/understanding-vesc-the-difference-between-battery-amps-and-motor-amps/15995/15,2017-01-14 02:35:44 UTC
Reply
#10
So to recap the second-to-last post, it is apparent our DC values actually need to be discussed sometimes in Pulsed DC terminology.

So what does the "Motor Amp" really mean?

Using the variables from the previous example:

Pulsed DC @ %50 duty cycle = 400hz @ 1/800th second @ 10 battery amps.

How does "Motor Amps" have any relation to these 10 battery amps?

Lets look closely at just one of the 400 pulses over the course of one second.

A single pulse lasts 1/800th of a second, and 400 of these result in 10 "battery amps," averaged over an entire second.

During the 1/800th of a second the pulse is "ON":

How many amps are actually flowing on average during this 1/800th of a second?

It turns out average amps (20) during 1/800th second "ON time" equals the "Motor Amps" value = 20 "MOTOR amps"

Earlier it was shown:

battery amps = (motor amps x (% duty cycle / 100))

so:

10 battery amps = (20 motor amps x (%50 duty cycle / 100)

In other words, during a single 1/800th second pulse, 20 amps, "MOTOR amps" on average are flowing. This 20 average amps, "'MOTOR amps," flowing during the 1/800th second pulse the equals "10 battery amps," averaged for the entire second.

",0,0,http://www.electric-skateboard.builders/t/understanding-vesc-the-difference-between-battery-amps-and-motor-amps/15995/16,2017-01-14 03:24:13 UTC
Reply


Forum Jump: