# Thread: Efficiency Control Algorithm For BLDC Electric Motors

1. The code for the algorithm has already been published at: "Peak Efficiency" Control Mode? - Page 10 - vedder.se forums

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

Efficiency Control Algorithm For BLDC Electric Motors Proof

The basic concept underlying the algorithm is there is always a ratio between electrical watts and mechanical watts which can be both calculated and manipulated.

For example if instantaneous values for one motor are the following, then electrical to mechanical conversion efficiency is 50%:

Electrical Watts: 500w
Mechanical Watts 250w

This ratio is represented by the equation:

(250/500)*100=50%

The discovery underlying the invention is that at each particular rpm, this ratio can be increased or decreased by applying more or less wattage at the same rpm.

As a result, a constant "desired efficiency" can be achieved by applying a different amount of electrical wattage at every RPM as the motor accelerates, by varying the "duty cycle" control variable.

It turns out that at very low rpms, lower wattage must be applied to maintain a "constant efficiency" value compared to when the motor is spinning faster.

So I begin the mathematical scenario as follows (& these values are numerically close to the values of the motors under development at SteelHubs.com):

Suppose I have a BLDC motor that is 93kv (93 rpm per applied volt), with 0.09ohm resistance lead-to-lead. If the motor is turning at 2000rpm, and I want an exactly 80% conversion efficiency of electrical to mechanical watts, then exactly how many electrical watts must I apply to the motor to achieve the 80% conversion efficiency?

The method of answering this question is the "heart" of my algorithm (with additional features added in to make it more "practically usable" -- such as throttle control and wattage limits, etc).  2.

3. Achieving 80% conversion efficiency at 2000rpm, with a 93kv 0.09ohm motor

93kv = 93 rpm per volt

1/93kv = 0.01075 volts <- Back EMF Voltage generated by motor per RPM

2000rpm * 0.01075 volts per rpm = 21.5v Back EMF Voltage at 2000rpm

Ohm's Law:
Amps * Ohms = Volts ( I*R=V )
Volts * Amps = Electrical Watts ( V*I=W )

Source: Ohms Law Calculator

&

Where E = Back Emf Voltage

(V-E)/R = I

V = Applied Volts
E = Back EMF Voltage
R = Resistance Ohms
I = Amps Motor Current

Source: http://physics.bu.edu/~duffy/sc545_n.../back_emf.html

The mathematical observation I made enabling the invention is that, surprisingly to me at the time, the ratio between the back emf voltage produced by the spinning rotor and the applied "effective voltage" is always the same numerically as the ratio between the instantaneous electrical and mechanical watts.

For example, if the back emf voltage value is 50% of the applied effective voltage value, then the conversion efficiency of electrical to mechanical watts will be exactly 50%.

Proof of this is provided below:

Earlier we calculated:

21.5v Back EMF Voltage at 2000rpm = 2000rpm * 0.01075 volts BEMF per rpm

Since we are trying to achieve 80% conversion efficiency of electrical to mechanical watts, I use the following formula since, as stated, I have observed that the ratio of bemf v to effective v is always the same as the ratio of mechanical to electrical watts (proof below):

So on that basis:

21.5v Back EMF V / 80% = Applied Effective Voltage Necessary For 80% conversion efficiency

Therefore:

21.5v/(80/100) = 26.875v Effective Applied Voltage Necessary for 80% conversion efficiency

If we choose to apply 26.875v effective voltage while the motor produces 21.5v back emf voltage @ 2000rpm (21.5v is 80% of 26.875v)-- we now have all the numbers necessary to calculate the electrical wattage using the earlier formula:

V = 26.875v = Applied Effective Voltage
E = 21.5v = Back EMF Voltage
R = 0.09ohm = Detected/Measured Winding Resistance
I = Motor Current in Amps

(V-E)/R = I

Source: http://physics.bu.edu/~duffy/sc545_n.../back_emf.html

(26.875-21.5)/0.09 = I

(26.875-21.5)/0.09 = 59.72222a motor amps

I=59.72222a motor amps

Since Ohm's Law: Volts * Amps = Electrical Watts

59.72222a motor amps * 26.875v applied voltage = 1605.0346w

When we calculate the mechanical watts, it will be exactly the desired 80% of the 1605.0346w electrical watts if my algorithm is correct.

In order to determine the mechanical watts it is necessary to calculate the motor constant KT which can done directly from the KV Value via the following formula:

KT = 60/(2pi*KV)

KT = Torque per motor amp

Source: https://en.wikipedia.org/wiki/Motor_constants

Since the KV of this motor is measured as 93 kv, we get:

KT = 60/(2*pi*KV)

KT = 60/(2*pi*93)

0.102680608 = 60/(2*pi*93)

KT = 0.102680608

In other words the 93kv motor has a KT of 0.102680608 & produces 0.102680608 newton meters torque per motor amp.

Since torque per amp is 0.102680608 newton meters torque per amp, and we've calculated the motor is drawing 59.72222a motor amps, to calculate the instantaneous torque we use:

0.102680608nm/a * 59.72222a = 6.13231386070976 newton meters torque.

So far we know the motor draws 1605.0346w, and supplies 6.13231386070976 newton meters torque, and the motor is turning 2000 rpm. The last step is to calculate the mechanical watts, and compare to the electrical watts to determine if, as predicted it is exactly 80%.

To calculate mechanical watts from torque and rpm, we use the following formulas:

Power Out = Torque in newton meters * angular speed in radians per second

Angular Speed in Radian Per second = RPM * 2 * pi / 60

Source: Calculations | Simple Electric Motors

Since we measured the motor as spinning 2000 rpm, we calculate the angular speed as follows:

2000rpm*2*pi/60=209.43951 radians per second angular velocity

Source: Calculations | Simple Electric Motors

209.43951 radians per second angular velocity * 6.13231386070976 newton meters torque= 1284.34881w

Mechanical Watts = 1284.34881w

To calculate the conversion efficiency % of electrical to mechanical watts we use:

(1284.34881w mechanical / 1605.0346w) * 100 = 80.02% conversion efficiency of electrical to mechanical watts (as predicted).

Now what if instead we want 90% conversion efficiency instead of 80%? All we have to do is go back to the following formula and switch out the "80" for "90"...

21.5v/(80/100) = 26.875v Effective V Necessary for 80% conversion efficiency

becomes:

21.5v/(90/100) = 23.8888v Effective V Necessary for 90% conversion efficiency

^by lowering the effective voltage we can increase the conversion efficiency & this can easily be verified by repeating the preceding calculations.

So how is possible to apply any desired effective voltage to the motor?

"PWM is also used in efficient voltage regulators. By switching voltage to the load with the appropriate duty cycle, the output will approximate a voltage at the desired level. The switching noise is usually filtered with an inductor and a capacitor."

Source: https://en.wikipedia.org/wiki/Pulse-width_modulation

"In a circuit known as a chopper, the average voltage applied to the motor is varied by switching the supply voltage very rapidly. As the "on" to "off" ratio is varied to alter the average applied voltage, the speed of the motor varies. The percentage "on" time multiplied by the supply voltage gives the average voltage applied to the motor. Therefore, with a 100 V supply and a 25% "on" time, the average voltage at the motor will be 25 V."

Source: https://en.wikipedia.org/wiki/Brushed_DC_electric_motor

So earlier we calculated that for 80% conversion efficiency at 2000rpm in the scenario I need to apply 26.875v effective volts. If I have a battery pack currently measured at 43.5v, the formula to calculate the duty cycle to achieve 26.875 effective volts to the motor is:

Pack Voltage * (Duty Cycle / 100) = Effective Voltage

P*(D/100)=F

Source: https://en.wikipedia.org/wiki/Brushed_DC_electric_motor

This can be rearranged to:

D=(100*F)/P

Source: Wolfram|Alpha Widgets: "Rearrange Equations" - Free Physics Widget

Where

D = Duty Cycle = XX.XXX%
P = Pack Voltage = 43.5v
F = Desired Effective Voltage = 26.875v

D=(100*F)/P

D=(100*26.875)/43.5

61.78160=(100*26.875)/43.5

61.78160%= Duty Cycle for 26.875v effective volts w/ 43.5v battery pack

Therefore with a 93kv motor, 0.09ohm resistance, presently 2000rpm, and 43.5v pack, to achieve exactly 80% electrical to mechanical conversion efficiency, a duty cycle of 61.78% is supplied to the motor which supplies 26.875v effective volts.

In order for the algorithm to constantly calculate the duty cycle necessary for the desired efficiency, the above calculations would be performed on the order of 20,000 times per second or more.

The finished algorithm incorporates further logic to account for user's throttle position, hardware duty cycle limit, motor amp limit, user's minimum desired wattage and maximum desired wattage.  4. Simulation:

Suppose I'm an electric skateboard vendor, and a previous customer asks me what options they have to achieve greatest possible range and efficiency on their electric skateboard when commuting in start and stop city traffic. The customer's route to work features many stop signs and stop lights, so they start and stop very frequently, but they live in a completely flat area and don't expect to encounter any hills. The board we are discussing has a battery which typically runs at 45.98V, (4) 81.42kv hub motors which are 0.136ohms and has 83mm diameter tires. The customer states their only requirements are they want to ensure the board is capable of 30mph top speed on flat ground, and aside from that requirement, they also want highest possible range and electrical to mechanical conversion efficiency while repeatedly accelerating at full throttle during their start-and-stop morning commute. Should I recommend "efficiency control" or the "classical algorithm" to achieve this customer's requirements (at least 30mph top speed on flat ground and greatest possible range & conversion efficiency while repeatedly accelerating at full throttle in start and stop city commuter traffic.)   -------------

Simulation Images:

Classical Algorithm 30mph-Capable Data Chart:

http://tppsf.com/classical-algorithm2.jpg

Efficiency Control Algorithm 30mph-Capable Data Chart:

http://tppsf.com/efficiency-control2.jpg

Classical vs Efficiency Control Algorithm Comparison Data Chart:

http://tppsf.com/efficiency-classical-comparison.gif

Classical vs Efficiency Control Algorithm 400m Acceleration Simulation Chart:

http://tppsf.com/400m-efficiency-vs-classical-2.jpg

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

Results:

The 30mph-capable rider with “efficiency control” gets 115.95% as much range in start and stop traffic with stop signs placed 500 meters apart compared to the 30mph-capable “classical algorithm” rider, while both use full throttle acceleration for the first 400 meters of each acceleration cycle, followed by mechanical braking.

Efficiency Control: 40.71 kilometers = 25.29 miles per kilowatt hour

Classical Algorithm: 35.11 kilometers = 21.81 miles per kilowatt hour

The 30mph-capable rider with “efficiency control” gets 148.25% as much range in start and stop traffic with stop signs placed 183.5 meters apart compared to the 30mph-capable “classical algorithm” rider, while both use full throttle acceleration for the first 150 meters of each acceleration cycle, followed by mechanical braking.

Efficiency Control: 51.62 kilometers = 32.07 miles per kilowatt hour

Classical Algorithm: 34.81 kilometers = 21.63 miles per kilowatt hour

(see linked image charts)

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

Code:

Where:

M= 100 = Throttle % Setting
K= 90 = Desired Efficiency % Setting
L= 500 = Desired Min Watts Available Setting
P= 4500 = Desired Max Watts Available Setting

G= 48.2 = Battery Voltage
D= 16.94 = Back EMF Voltage
F= 0.025 = Winding Resistance Ohms
Y= 120 = Max Motor Amps
Z= 95 = Max Duty Cycle %

N= XX.XXXw = Desired Full Throttle Wattage
C= XX.XXX% = Duty Cycle

N=L
&
if D>((sqrt(F)*K*sqrt(L))/(10*sqrt(100-K))) then N=(-1)*((100*(D^2)*(K-100))/(F*(K^2)))
&
if N>P then N=P
&
if Y<((sqrt((D^2)+(4*F*N))-D)/(2*F)) then N=Y*(D+(F*Y))
&
if Z<((50*(sqrt((D^2)+(4*F*N))+D))/G) then N=(G*Z*(G*Z-(100*D)))/(10000*F)
&
C=10*((sqrt((25*(D^2))+(F*M*N))/G)+((5*D)/G))
&
repeat

Therefore:

M= 100% = Throttle % Setting
K= 90% = Desired Efficiency % Setting
L= 500w = Desired Min Watts Available Setting
P= 4500w = Desired Max Watts Available Setting

G= 48.2v = Battery Voltage
D= 16.94v = Back EMF Voltage
F= 0.025ohm = Winding Resistance Ohms
Y= 120a = Max Motor Amps
Z= 95% = Max Duty Cycle %

N= 1417.10w = Desired Full Throttle Wattage
C= 39.049% = Duty Cycle

——————————

Explanation:

N=L

^this line sets the desired full throttle wattage at the minimum desired wattage value

&

if D>((sqrt(F)*K*sqrt(L))/(10*sqrt(100-K))) then N=(-1)*((100*(D^2)*(K-100))/(F*(K^2)))

^this line calculates whether there is enough back emf voltage present to allow the desired minimum full throttle wattage at or above the desired efficiency, and if there is, it adjusts the desired full throttle wattage to the value which achieves the desired electrical to mechanical conversion efficiency at the present rpm

&

if N>P then N=P

^this line adjusts the desired full throttle wattage to the maximum desired wattage setting if the wattage at desired efficiency exceeds the desired max wattage setting

&

if Y<((sqrt((D^2)+(4*F*N))-D)/(2*F)) then N=Y*(D+(F*Y))

^this line calculates whether the desired full throttle wattage exceeds the max motor amp setting, and if it does, it adjusts the desired full throttle wattage to a value which does not exceed the max motor amp setting

&

if Z<((50*(sqrt((D^2)+(4*F*N))+D))/G) then N=(G*Z*(G*Z-(100*D)))/(10000*F)

^this line calculates whether the desired full throttle wattage exceeds the max duty cycle setting, and if it does, it adjusts the desired full throttle wattage to a value which does not exceed the max duty cycle setting

&

C=10*((sqrt((25*(D^2))+(F*M*N))/G)+((5*D)/G))

^this line calculates the duty cycle control value based on the final desired full throttle wattage value, throttle position, back emf voltage value, winding resistance, and pack voltage

&

repeat

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

Sincerely,

Devin  5. Where:

M= 100 = Throttle % Setting
K= 90 = Desired Efficiency % Setting
L= 500 = Desired Min Watts Available Setting
P= 4500 = Desired Max Watts Available Setting

G= 48.2 = Battery Voltage
D= 16.94 = Back EMF Voltage
F= 0.025 = Winding Resistance Ohms
Y= 120 = Max Motor Amps
Z= 95 = Max Duty Cycle %

N= XX.XXXw = Desired Full Throttle Wattage
C= XX.XXX% = Duty Cycle

As a side note, if we wish to convert the C=Duty Cycle algorithm output to E= XX.XXXv = PWM Effective Voltage

We take:

C= 39.049 = Duty Cycle %

and add the following line before the "repeat":

E=G*(C/100)

Therefore:

E=G*(C/100)

E=48.2*(39.049/100)

18.821618=48.2*(39.049/100)

E = 18.821618 = PWM Effective Voltage <--39.049% Duty Cycle is 18.821618 PWM Effective Voltage

N=L
&
if D>((sqrt(F)*K*sqrt(L))/(10*sqrt(100-K))) then N=(-1)*((100*(D^2)*(K-100))/(F*(K^2)))
&
if N>P then N=P
&
if Y<((sqrt((D^2)+(4*F*N))-D)/(2*F)) then N=Y*(D+(F*Y))
&
if Z<((50*(sqrt((D^2)+(4*F*N))+D))/G) then N=(G*Z*(G*Z-(100*D)))/(10000*F)
&
C=10*((sqrt((25*(D^2))+(F*M*N))/G)+((5*D)/G))
&
E=G*(C/100)
&
repeat

Therefore:

E = 18.821618 = PWM Effective Voltage

Simply because 16.94V Back EMF Voltage is 90% of the applied 18.821618V PWM Effective Voltage, it follows that instantaneous electrical to mechanical conversion efficiency is also 90%.  6. point???......

eg, what exactly are you wanting to discuss? This is a discussion forum, and not a blog or a technical journal.  7. Devin-m: I'll reiterate Paleo's question - what is the point of discussion here? You appear to be simply blogging.  8. I've shown mathematically the ratios between BEMF & Applied voltage and Electrical and Mechanical Watts are the same, but can anyone explain why or what causes this to be the case as I don't fully understand it myself? But it does seem to have an important energy saving application by enabling people to choose their efficiency, so to speak, and I thought it related to the description of the physics forum "The science of matter and energy and of interactions between the two" and some folks may find the topic interesting, as I do.

In practice lower efficiency results in greater acceleration and greater efficiency results in lower acceleration.

@Dywyddyr & I'm relieved you haven't asserted the formulas are wrong!       9. Im going to be honest, spamming a crap ton of images does NOT answer the question I asked, at all.....

It still feels like you are blogging at this point, and trying to drive up click counts on your personal sites.  10. Originally Posted by Paleoichneum Im going to be honest, spamming a crap ton of images does NOT answer the question I asked, at all.....

It still feels like you are blogging at this point, and trying to drive up click counts on your personal sites.
@Paleoichneum -- I'd be happy to remove the external links if you prefer as it was not my intention to spam -- i intended to include them as reference materials. I thought I answered your question -- if you have any questions about the algorithm itself, I'd be happy to answer your questions.  Bookmarks
 Posting Permissions
 You may not post new threads You may not post replies You may not post attachments You may not edit your posts   BB code is On Smilies are On [IMG] code is On [VIDEO] code is On HTML code is Off Trackbacks are Off Pingbacks are Off Refbacks are On Terms of Use Agreement