## "Peak Efficiency" Control Mode?

General topics and discussions about the VESC and its development.
devin
Posts: 255
Joined: 08 May 2017, 01:55
Location: San Francisco, California, US

### Re: "Peak Efficiency" Control Mode?

devin
Posts: 255
Joined: 08 May 2017, 01:55
Location: San Francisco, California, US

### Re: "Peak Efficiency" Control Mode?

I updated the code to account for the fact that max duty cycle is 95% and max motor amps is 120a... by my calculations a single hub motor+vesc could conceivably propel a human to 40mph at more than 90% conversion efficiency with the following assumptions...

Efficiency Control Program

K= 90.00% = Desired Efficiency % Setting
L= 500.00w = Desired Min Watts Available Setting
P= 4500.00w = Desired Max Watts Available Setting
Y= 120.00a = Max Motor Amps Setting
Z= 95.00% = Max Duty Cycle % Setting
M= 100.00% = Throttle % Setting

G= 48.2v = Battery Voltage
F= 0.025ohm = Winding Resistance
I= 120kv = Motor KV
J= 2032.81rpm = Present RPM

A= XX.XXXa = Battery Amps
B= XX.XXXa = Motor Amps
C= XX.XXX% = Duty Cycle
D= XX.XXXv = Back EMF Voltage
E= XX.XXXv = PWM Voltage
H= XX.XXXw = Electrical Wattage
N= XX.XXXw = Desired Full Throttle Wattage

Where:

D=(1/I)*J
&
E=0
&
if D>0 then E=D/(K/100)
&
if E>(G*(Z/100)) then E=G*(Z/100)
&
N=0
&
if E>0 then N=(E*(E-D))/F
&
if N<L then N=L
&
if N>P then N=P
&
H=N*(M/100)
&
A=H/G
&
E=(1/2)(sqrt((4*A*F*G)+(D^2))+D)
&
if E>G then E=G
&
if E>(G*(Z/100)) then E=(G*(Z/100))
&
B=(E-D)/F
&
if B>Y then B=Y
&
E=(B*F)+D
&
C=(E/G)*100
&
A=B*(C/100)
&
H=A*G

Therefore:

20mph @ 84mm tire diameter @ 1:1 gearing:

A= 29.40a = Battery Amps
B= 75.28a = Motor Amps
C= 39.05% = Duty Cycle
D= 16.94v = Back EMF Voltage
E= 18.82v = PWM Voltage
F= 0.025ohm = Winding Resistance
G= 48.2v = Battery Voltage
H= 1417.12w = Electrical Wattage
I= 120kv = Motor KV
J= 2032.81rpm = Present RPM
K= 90% = Desired Efficiency % Setting
L= 500w = Desired Min Watts Available
M= 100% = Throttle % Setting
N= 1417.12 = Desired Full Throttle Wattage
P= 4500w = Desired Max Watts Available
Y= 120a = Max Motor Amps
Z= 95% = Max Duty Cycle %

Wind Watts Assumptions:

1.2 = Standing Human Estimated Drag Coefficient
0.929m^2 = Standing Human Estimated Frontal Area
1.225kg/m^3 = Fluid Density of Air

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

In theory simply, a single hub motor and vesc using efficiency control could conceivably propel a human rider to 40mph at greater than 90% electrical to mechanical conversion efficiency.
Last edited by devin on 28 Sep 2017, 21:56, edited 1 time in total.

devin
Posts: 255
Joined: 08 May 2017, 01:55
Location: San Francisco, California, US

### Re: "Peak Efficiency" Control Mode?

Efficiency Control in Least Code Steps

I've simplified the efficiency control code down to what I believe is in theory the least possible number of code execution steps:

Assuming:

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

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

N= XX.XXXw = Desired Full Throttle Wattage
E= XX.XXXv = PWM Voltage
B= XX.XXXa = Motor Amps
C= XX.XXX% = Duty Cycle

Where:

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

Therefore:

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

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

B= 75.28a = Motor Amps
C= 39.05% = Duty Cycle

———————————

devin wrote:A= 29.40a = Battery Amps
B= 75.28a = Motor Amps
C= 39.05% = Duty Cycle
D= 16.94v = Back EMF Voltage
E= 18.82v = PWM Voltage
F= 0.025ohm = Winding Resistance
G= 48.2v = Battery Voltage
H= 1417.12w = Electrical Wattage
I= 120kv = Motor KV
J= 2032.81rpm = Present RPM
K= 90% = Desired Efficiency % Setting
L= 500w = Desired Min Watts Available
M= 100% = Throttle % Setting
N= 1417.12 = Desired Full Throttle Wattage
P= 4500w = Desired Max Watts Available
Y= 120a = Max Motor Amps
Z= 95% = Max Duty Cycle %

^verified

———————

Simply in theory, the main portion of efficiency control can be implemented with approximately as few as 12 lines of computer programming code.

Hummie
Posts: 110
Joined: 10 May 2016, 04:05

### Re: "Peak Efficiency" Control Mode?

looking at the grin tech motor simulator you can see when the load is increased the efficiency drops with every motor on there regardless of the power applied. having the esc programmed to only apply a voltage within a close proximity of the back voltage, which would limit the power, still has the motor at much lower efficiency than 90 percent with a big load

devin
Posts: 255
Joined: 08 May 2017, 01:55
Location: San Francisco, California, US

### Re: "Peak Efficiency" Control Mode?

Hummie wrote:looking at the grin tech motor simulator you can see when the load is increased the efficiency drops with every motor on there regardless of the power applied. having the esc programmed to only apply a voltage within a close proximity of the back voltage, which would limit the power, still has the motor at much lower efficiency than 90 percent with a big load

@Hummie I set throttle to 42% and grade to 0%. in the first image the graph shows I am at peak efficiency. Notice the black curve labeled % grade. Notice how even though I set the grade to 0%, at the left side of the chart, the grade is larger than 0%. Notice when I move the mph slider in the second picture to 8.3 mph, even though I have not changed the 0% grade setting, in the numbers at the bottom it says 12% grade... i don't believe the green efficiency line is accurate for 0% grade further towards the left side of the chart because in the first picture the efficiency value applies to 0% grade and then at the left side of the chart in the second picture the efficiency value applies to 12% grade...

^notice battery amps in the second picture at 8.3 mph (19.3a battery amps) is much higher than battery amps in the first picture (4.3a battery amps).

so what would the efficiency be in the second picture at 8.3mph with same 0% grade as the first picture, & at 4.3a battery amps -- the same battery amps as the first picture versus the 19.3a battery amps shown in the second picture? i could probably use my nifty spreadsheet to find out...

simply since black grade curve is changing across the chart what is the efficiency in the second graph at 8.3mph, 0% grade and 4.3a battery amps (same battery amps as first picture)?

according to my calculations you’d need to put in less than the 4.3a battery amps shown in the first 15.4mph picture at 8.3mph in the second picture to achieve identical electrical to mechanical conversion efficiency as shown in the first 15.4mph picture.

the 19.3a battery amps shown in the second 8.3mph picture must be less than the 4.3a battery amps shown in the first picture for identical efficiency in both charts, simply.
Last edited by devin on 30 Sep 2017, 00:30, edited 3 times in total.

devin
Posts: 255
Joined: 08 May 2017, 01:55
Location: San Francisco, California, US

### Re: "Peak Efficiency" Control Mode?

@hummie in the first picture the assumption is that you are at 42% throttle going a steady 15.4mph at 0% grade & this steady speed requires 3.4a battery amps (most likely they’ve factored wind drag at 0% grade 15.4mph). in the second picture the assumption is that you are at 42% throttle going 8.3mph and accelerating at 2.66mph/s up a 12% grade. Traveling at 8.3mph and accelerating at 2.66mph/s at 42% throttle up a 12% grade would require 19.3a battery amps for the load, according to the simulator.

if you want to have identical conversion efficiency at 8.3mph & 15.4mph, you have to draw less battery amps at 8.3mph than at 15.4mph, not more, and this fact means you won’t be going up a 12% grade at 8.3mph & accelerating at 2.66mph/s if you are achieving identical electrical to mechanical conversion efficiency at both speeds, and drawing only 3.4a battery amps at 15.4mph, simply.

(but you can achieve identical conversion efficiency at both speeds by drawing some amount less than 3.4a battery amps at 8.3mph assuming you draw exactly 3.4a battery amps at 15.4mph)

pf26
Posts: 309
Joined: 28 Mar 2016, 14:37
Location: FR Valence

### Re: "Peak Efficiency" Control Mode?

The ebikes.ca simulator is great !
By default, it tells you what speed you get with 0 acceleration. When you slide the speed cursor, it will tell you the grade it would require to reach that speed OR the acceleration you would get if the grade was to stay at 0%: notice that 12.1% grade is the same as 2.66mph/s
2.66*1.609/3.6/9.81=0.121 or 12.1%

devin
Posts: 255
Joined: 08 May 2017, 01:55
Location: San Francisco, California, US

### Re: "Peak Efficiency" Control Mode?

devin wrote:Efficiency Control in Least Code Steps

I previously believed that 12 lines of code was the least possible number of steps for the main portion of efficiency control… but i’ve simplified it down to just 9 lines…

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

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

N= XX.XXXw = Desired Full Throttle Wattage
B= XX.XXXa = Motor Amps
C= XX.XXX% = Duty Cycle

Where:

N=0 <————— Desired Full Throttle Wattage = 0w
&
if D>0 then N=(-1)*((100*(D^2)*(K-100))/(F*(K^2))) <——Desired Full Throttle Wattage = 1417.10w
&
if N<L then N=L <——Desired Full Throttle Wattage = 1417.10w
&
if N>P then N=P <——Desired Full Throttle Wattage = 1417.10w
&
B=(1/10)*((sqrt((25*(D^2))+(F*M*N))/F)-((5*D)/F)) <——Motor Amps = 75.28a
&
if B>Y then B=Y <——Motor Amps = 75.28a
&
C=(100*((B*F)+D))/G <——Duty Cycle = 39.049%
&
if C>Z then C=Z <——Duty Cycle = 39.049%
&
repeat

Therefore:

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

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

C= 39.05% = Duty Cycle

—————————————-

A= 29.40a = Battery Amps
B= 75.28a = Motor Amps
C= 39.05% = Duty Cycle
D= 16.94v = Back EMF Voltage
E= 18.82v = PWM Voltage
F= 0.025ohm = Winding Resistance
G= 48.2v = Battery Voltage
H= 1417.12w = Electrical Wattage
I= 120kv = Motor KV
J= 2032.81rpm = Present RPM
K= 90% = Desired Efficiency % Setting
L= 500w = Desired Min Watts Available
M= 100% = Throttle % Setting
N= 1417.12 = Desired Full Throttle Wattage
P= 4500w = Desired Max Watts Available
Y= 120a = Max Motor Amps
Z= 95% = Max Duty Cycle %

^verified
-------------
please note: if X>0 & 0/X=error then this code won't work and the 9/28/17 12:25 (12 lines) code post will be necessary to use. if X>0 & 0/X=0 then this code should still work.

devin 9/28/17 12:25 wrote:E=0
&
N=0
&
if D>0 then E=D/(K/100)
&
if E>0 then N=(E*(E-D))/F
&
if N<L then N=L
&
if N>P then N=P
&
E=(1/10)*(sqrt((25*(D^2))+(F*M*N))+(5*D))
&
if E>(G*(Z/100)) then E=(G*(Z/100))
&
B=(E-D)/F
&
if B>Y then B=Y
&
C=(100*((B*F)+D))/G
&
repeat
Last edited by devin on 01 Oct 2017, 19:49, edited 3 times in total.

devin
Posts: 255
Joined: 08 May 2017, 01:55
Location: San Francisco, California, US

### Re: "Peak Efficiency" Control Mode?

devin wrote:Efficiency Control in Least Code Steps

I previously believed that 9 lines of code was the least possible number of steps for the main portion of efficiency control… but i’ve simplified it down to just 8 lines…

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

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

N= XX.XXXw = Desired Full Throttle Wattage
B= XX.XXXa = Motor Amps
C= XX.XXX% = Duty Cycle

Where:

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
&
B=(1/10)*((sqrt((25*(D^2))+(F*M*N))/F)-((5*D)/F))
&
if B>Y then B=Y
&
C=(100*((B*F)+D))/G
&
if C>Z then C=Z
&
repeat

Therefore:

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

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

C= 39.049% = Duty Cycle

——————
devin wrote:A= 29.40a = Battery Amps
B= 75.28a = Motor Amps
C= 39.05% = Duty Cycle
D= 16.94v = Back EMF Voltage
E= 18.82v = PWM Voltage
F= 0.025ohm = Winding Resistance
G= 48.2v = Battery Voltage
H= 1417.12w = Electrical Wattage
I= 120kv = Motor KV
J= 2032.81rpm = Present RPM
K= 90% = Desired Efficiency % Setting
L= 500w = Desired Min Watts Available
M= 100% = Throttle % Setting
N= 1417.12 = Desired Full Throttle Wattage
P= 4500w = Desired Max Watts Available
Y= 120a = Max Motor Amps
Z= 95% = Max Duty Cycle %

^verified
----------
please note: if X>0 & 0/X=error then this code won't work and the 9/28/17 12:25 (12 lines) code post will be necessary to use. if X>0 & 0/X=0 then this code should still work.

devin 9/28/17 12:25 wrote:E=0
&
N=0
&
if D>0 then E=D/(K/100)
&
if E>0 then N=(E*(E-D))/F
&
if N<L then N=L
&
if N>P then N=P
&
E=(1/10)*(sqrt((25*(D^2))+(F*M*N))+(5*D))
&
if E>(G*(Z/100)) then E=(G*(Z/100))
&
B=(E-D)/F
&
if B>Y then B=Y
&
C=(100*((B*F)+D))/G
&
repeat
Last edited by devin on 01 Oct 2017, 19:48, edited 4 times in total.

devin
Posts: 255
Joined: 08 May 2017, 01:55
Location: San Francisco, California, US

### Re: "Peak Efficiency" Control Mode?

devin wrote:Efficiency Control in Least Code Steps

I previously believed that 8 lines of code was the least possible number of steps for the main portion of efficiency control… but i’ve simplified it down to just 7 lines…

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

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

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

Where:

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 ((1/10)*((sqrt((25*(D^2))+(F*M*N))/F)-((5*D)/F)))>Y then C=(100*((Y*F)+D))/G
&
if ((1/10)*((sqrt((25*(D^2))+(F*M*N))/F)-((5*D)/F)))<=Y then C=10*((sqrt((25*(D^2))+(F*M*N))/G)+((5*D)/G))
&
if C>Z then C=Z
&
repeat

Therefore:

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

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

C= 39.049% = Duty Cycle

——————
devin wrote:A= 29.40a = Battery Amps
B= 75.28a = Motor Amps
C= 39.05% = Duty Cycle
D= 16.94v = Back EMF Voltage
E= 18.82v = PWM Voltage
F= 0.025ohm = Winding Resistance
G= 48.2v = Battery Voltage
H= 1417.12w = Electrical Wattage
I= 120kv = Motor KV
J= 2032.81rpm = Present RPM
K= 90% = Desired Efficiency % Setting
L= 500w = Desired Min Watts Available
M= 100% = Throttle % Setting
N= 1417.12 = Desired Full Throttle Wattage
P= 4500w = Desired Max Watts Available
Y= 120a = Max Motor Amps
Z= 95% = Max Duty Cycle %

^verified
-------------
please note: if X>0 & 0/X=error then this code won't work and the 9/28/17 12:25 (12 lines) code post will be necessary to use. if X>0 & 0/X=0 then this code should still work.

devin 9/28/17 12:25 wrote:E=0
&
N=0
&
if D>0 then E=D/(K/100)
&
if E>0 then N=(E*(E-D))/F
&
if N<L then N=L
&
if N>P then N=P
&
E=(1/10)*(sqrt((25*(D^2))+(F*M*N))+(5*D))
&
if E>(G*(Z/100)) then E=(G*(Z/100))
&
B=(E-D)/F
&
if B>Y then B=Y
&
C=(100*((B*F)+D))/G
&
repeat