"Peak Efficiency" Control Mode?

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

Re: "Peak Efficiency" Control Mode?

Postby devin » 14 Oct 2017, 09:38

Throttle Response Update:

In theory this update to the code improves the dynamic throttle response produced by the algorithm at times when full throttle would result in the motor amp limit setting or duty cycle limit setting being reached.

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

—————————

Conclusion

In theory this code improves the dynamic throttle response when full throttle will result in reaching the motor amp limit or the duty cycle limit. With the last version, 100% throttle position was defined to supply the wattage necessary to achieve the desired efficiency setting, but if %100 throttle (desired efficiency wattage) resulted in reaching the motor amp limit or duty cycle limit, then all throttle positions that would result in exceeding duty cycle limit or motor amp limit would result in the same amount of power to the motor (to stay under the limits) leading to reduction in dynamic throttle response at the higher end of the throttle range when the duty cycle/motor amp limits could potentially be exceeded. This update in theory fixes and ensures a fully dynamic throttle response by always mapping “100% throttle” to the desired efficiency unless it results in exceeding motor amp/duty cycle limit, in which case 100% throttle would then correspond to the wattage required to stay under both limits, and % throttle would correspond to a % of this under-the-limits-wattage.
Last edited by devin on 14 Oct 2017, 12:17, edited 2 times in total.

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

Re: "Peak Efficiency" Control Mode?

Postby devin » 14 Oct 2017, 10:42

% Motor Amps throttle variation:

In theory this code is just another throttle option which instead defines % throttle as % motor amps at desired efficiency (while staying under the various limits) instead of % watts at desired efficiency in the other code.

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
H= XX.XXXw = Desired 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 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)
&
H=(M*((-1)*D*(M-100)*sqrt((D^2)+4*F*N)+((D^2)*(M-100))+(2*F*M*N)))/(20000*F)
&
C=((50*(sqrt((D^2)+(4*F*H))+D))/G)
&
repeat

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

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

&

H=(M*((-1)*D*(M-100)*sqrt((D^2)+4*F*N)+((D^2)*(M-100))+(2*F*M*N)))/(20000*F)

^this line calculates the desired full throttle motor amps, reduces the motor amps by a percentage based on throttle position, and then calculates the resulting desired wattage

&

C=((50*(sqrt((D^2)+(4*F*H))+D))/G)

^this line calculates the duty cycle control variable from the desired wattage, back emf voltage, winding resistance, and pack voltage.

&

repeat

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

Conclusion

With this control option, percent throttle is percent of max desired motor amps at desired efficiency (while staying within the other defined limits), and since motor amps are linearly proportional with torque, the throttle position becomes linearly proportional with max torque at desired efficiency. The previously written about watt-throttle control option would by contrast be linearly proportional with the max desired battery amps (assuming constant voltage pack), but more accurately wattage since it increases the "battery amp limit" when the pack voltage dips.
Last edited by devin on 14 Oct 2017, 12:33, edited 2 times in total.

rew
Posts: 939
Joined: 25 Mar 2016, 12:29
Location: Delft, Netherlands.

Re: "Peak Efficiency" Control Mode?

Postby rew » 14 Oct 2017, 11:59

devin wrote:PS How many kg thrust does your electric bicycle put out at 20a motor amps at 5kmh, just for curiosity?

At 20A motor amps, the thrust is (very closely) the same independent of the speed.

By my calculations I have about 80N of thrust with 20A motor current.

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

Re: "Peak Efficiency" Control Mode?

Postby devin » 14 Oct 2017, 13:05

rew wrote:At 20A motor amps, the thrust is (very closely) the same independent of the speed.

By my calculations I have about 80N of thrust with 20A motor current.


@rew 80N=17.94lb=8.1577kg thrust at 5kmh=3.11mph

devin wrote:The board is putting out [183.97N=]41.35829lb=18.76kg thrust at 5kmh=3.11mph simply.


(183.97/80)*100= 229.96%

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

Re: "Peak Efficiency" Control Mode?

Postby devin » 18 Oct 2017, 16:31

rew wrote:So your algorithm gets to propose a throttle setting to amp conversion depending on more than just the throttle, right?

Well if your algorithm limits "max throttle" to < 5A at < 5km/h, then you will lose customers fast. Acceleration on my bike is unacceptably slow with 20A motor current. It's just an AID for me, so I don't care. But on an electric skateboard, it is the main propulsion, right?

Your "test question" almost includes "world domination" in the requirements. It wants "everything". That is just not possible.

We can formalize your theoretical commute to something like: Accelerate to 15mph, slow down for a stop every 500m repeat 10x or something like that. Now the math simplifies to optimizing the battery usage over just one of these cycles.

Your proposal: Aim for a specific efficiency in the motor is not going to be acceptable: Way too slow startup (if at all).


So you should compare "my algorithm": floor it until I reach 15mph and then cruise along at 15mph at say 30% throttle with yours, but do compare both in terms of energy used, and time spent.

If you assume just a static friction force, then the energy lost towards getting the distance constant. So that doesn't matter. But say wind resistance that goes up with the square of the speed and accounts for say 50% of the energy used at 15mph does make a difference.

I challenge you to come up with a strategy that manages to travel the 500m in the same amount of time as the "floor it" algorithm, but uses less energy. I think it can be done, but not with your "stay off the throttle until you're moving fast" algorithm.


@rew Let's suppose rider A & B have identical boards matching the board we are discussing. If the math simplifies to optimizing battery use over just one acceleration cycle, let's suppose the comparison is conducted on a flat runway with a simulated green light as the starting line and a red light as the finish line, separated by 500 meters. Let's suppose mechanical braking is used in order to stop before the red light, and both riders stop using their throttles and coast and brake to a stop for the final 100 meters (in other words both riders use full throttle acceleration for 400 meters). In theory, the rider who used less amp hours from their battery over the course of the 400 meters gets longer range in start and stop traffic.

Additionally both the "classical algorithm" rider and the "efficiency control" rider must demonstrate their board possesses a mechanical advantage over the wind drag up to at least 30mph....

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

@rew 80N=17.94lb=8.1577kg thrust at 5kmh=3.11mph


devin wrote:The board is putting out [183.97N=]41.35829lb=18.76kg thrust at 5kmh=3.11mph simply.


(183.97/80)*100= 229.96%


@rew i think we can agree since the efficiency control board is putting out 229.96% as much thrust as your own electric bicycle, it is sufficient thrust at low speeds to meet the rider's requirements.

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

Re: "Peak Efficiency" Control Mode?

Postby devin » 19 Oct 2017, 13:58

devin wrote:@rew Let's suppose rider A & B have identical boards matching the board we are discussing. If the math simplifies to optimizing battery use over just one acceleration cycle, let's suppose the comparison is conducted on a flat runway with a simulated green light as the starting line and a red light as the finish line, separated by 500 meters. Let's suppose mechanical braking is used in order to stop before the red light, and both riders stop using their throttles and coast and brake to a stop for the final 100 meters (in other words both riders use full throttle acceleration for 400 meters). In theory, the rider who used less amp hours from their battery over the course of the 400 meters gets longer range in start and stop traffic.

Additionally both the "classical algorithm" rider and the "efficiency control" rider must demonstrate their board possesses a mechanical advantage over the wind drag up to at least 30mph....


Step 1: Optimize both "classical algorithm" and "efficiency control" algorithm to use minimum power while accelerating, yet still retaining 30mph capability....

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

Classical Algorithm Settings: 10a Battery Amp Limit & 11a Motor Amp Limit

Image

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

Efficiency Control Settings: 96% Desired Efficiency Setting, 85w Min Wattage Setting, 434w Max Wattage Setting & 11a Motor Amp Limit

Image

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

Animated Comparison:

Image

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

Step 2: Calculate battery amp hours consumption over 400 meters full throttle acceleration...

(to be continued)

https://youtu.be/BkkTSVVrPYk

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

Re: "Peak Efficiency" Control Mode?

Postby devin » 20 Oct 2017, 16:31

devin wrote:Step 2: Calculate battery amp hours consumption over 400 meters full throttle acceleration...

(to be continued)


Final Results:

Efficiency Control at 400 meters: 12.28 watt hours
Classical Algorithm at 400 meters: 14.24 watt hours

The classical algorithm used about %115.96 as much energy to go half a kilometer in this start and stop traffic scenario & both algorithms are capable of reaching 30mph.

The efficiency control algorithm used about %86.23 as much energy to go half a kilometer in this start and stop traffic scenario.

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

Image

————————————

Image
Last edited by devin on 22 Oct 2017, 17:21, edited 1 time in total.

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

Re: "Peak Efficiency" Control Mode?

Postby pf26 » 20 Oct 2017, 17:28

Did you try to record the measurements of a know scenario (like 50% throttle for 20 secondes, then 0%), with a real VESC board ? (for instance using VSC monitor with bluetooth on android). I think it would be nice to validate the model, especially regarding the motor/transmission/aero losses.

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

Re: "Peak Efficiency" Control Mode?

Postby devin » 21 Oct 2017, 15:56

devin wrote:@rew Test Question: 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.)


rew wrote:So your algorithm gets to propose a throttle setting to amp conversion depending on more than just the throttle, right?

Well if your algorithm limits "max throttle" to < 5A at < 5km/h, then you will lose customers fast. Acceleration on my bike is unacceptably slow with 20A motor current. It's just an AID for me, so I don't care. But on an electric skateboard, it is the main propulsion, right?

Your "test question" almost includes "world domination" in the requirements. It wants "everything". That is just not possible.

We can formalize your theoretical commute to something like: Accelerate to 15mph, slow down for a stop every 500m repeat 10x or something like that. Now the math simplifies to optimizing the battery usage over just one of these cycles.


Your proposal: Aim for a specific efficiency in the motor is not going to be acceptable: Way too slow startup (if at all).

So you should compare "my algorithm": floor it until I reach 15mph and then cruise along at 15mph at say 30% throttle with yours, but do compare both in terms of energy used, and time spent.

If you assume just a static friction force, then the energy lost towards getting the distance constant. So that doesn't matter. But say wind resistance that goes up with the square of the speed and accounts for say 50% of the energy used at 15mph does make a difference.

I challenge you to come up with a strategy that manages to travel the 500m in the same amount of time as the "floor it" algorithm, but uses less energy. I think it can be done, but not with your "stay off the throttle until you're moving fast" algorithm.


devin wrote:@rew Let's suppose rider A & B have identical boards matching the board we are discussing. If the math simplifies to optimizing battery use over just one acceleration cycle, let's suppose the comparison is conducted on a flat runway with a simulated green light as the starting line and a red light as the finish line, separated by 500 meters. Let's suppose mechanical braking is used in order to stop before the red light, and both riders stop using their throttles and coast and brake to a stop for the final 100 meters (in other words both riders use full throttle acceleration for 400 meters). In theory, the rider who used less amp hours from their battery over the course of the 400 meters gets longer range in start and stop traffic.

Additionally both the "classical algorithm" rider and the "efficiency control" rider must demonstrate their board possesses a mechanical advantage over the wind drag up to at least 30mph....


devin wrote:Step 1: Optimize both "classical algorithm" and "efficiency control" algorithm to use minimum power while accelerating, yet still retaining 30mph capability....

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

Classical Algorithm Settings: 10a Battery Amp Limit & 11a Motor Amp Limit

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

Efficiency Control Settings: 96% Desired Efficiency Setting, 85w Min Wattage Setting, 434w Max Wattage Setting & 11a Motor Amp Limit

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

Step 2: Calculate battery amp hours consumption over 400 meters full throttle acceleration...

(to be continued)

https://youtu.be/BkkTSVVrPYk


Final Results:

Efficiency Control at 400 meters: 12.28 watt hours
Classical Algorithm at 400 meters: 14.24 watt hours

The classical algorithm used about %115.96 as much energy to go half a kilometer in this start and stop traffic scenario & both algorithms are capable of reaching 30mph.

The efficiency control algorithm used about %86.23 as much energy to go half a kilometer in this start and stop traffic scenario.


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


@rew 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


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

@rew In the city where I live, San Francisco California, many of the stop signs are in fact separated by only 183.5 meters. How is the efficiency of each rider affected when each full throttle acceleration cycle is only 150 meters followed by 33.5 meters of coasting & mechanical braking? Fortunately this question can be answered with the very same data set.

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

Image

Stop Sign Separation Distance: 183.5 Meters
Full Throttle Acceleration Distance: 150 Meters

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

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

Re: "Peak Efficiency" Control Mode?

Postby devin » 29 Oct 2017, 13:46

rew wrote:If you keep talking about kinetic energy in electrons, one day I'll calculate that kinetic energy for you. It's going to be less than you expect. For all practical purposes the kinetic energy in the electrons is zero. You should also stop talking about 100% duty at stall.

The hobbyking motor I linked simply allows 1.5V of effective voltage above the BEMF. So if the rotor is stalled, you're allowed 1.5V or 3% duty cylce (at 50V battery voltage). If the rotor is doing 150RPM, (1V BEMF) you're allowed to do 2.5V or 5% dutycycle.


@rew If we take the number of copper free electrons in a typical motor winding, and send them on a straight line trajectory relative to the earth at their fermi velocity (1570km/s), how much kinetic energy is this?

devin wrote:http://hyperphysics.phy-astr.gsu.edu/hbase/Tables/fermi.html#c1

Copper Fermi Velocity: 1570000 meters per second
(about 1570 kilometers per second or about 0.5% the speed of light)

Copper Free Electron Density: 8.4*10^28 per m^3

http://hyperphysics.phy-astr.gsu.edu/hbase/electric/ohmmic.html


https://en.wikipedia.org/wiki/Electron_rest_mass

rew wrote:You should also stop talking about 100% duty at stall.


@rew How about 100% duty at all rpms?

Image

For Comparison:

Image

devin wrote:@rew Test Question: There is a contest with a prize of $1000 USD for whoever achieves the highest mechanical power output from a particular BLDC motor for 100 milliseconds. My entry fee costs $100, therefore the $1000 prize would cover 10 times the entry fee so the longevity of the motor is of little concern for winning this contest. I have a controller capable of 100% duty cycle at any RPM in bursts of 100 milliseconds and a dynamometer. Assuming all contestants have the same voltage lab supply, if I want to win the prize, at what % of no load rpm should I apply my 100 millisecond 100% duty cycle burst for the greatest chances of victory? What is the approximate electrical to mechanical % conversion efficiency during this 100 milliseconds?


rew wrote:Well... If the iron in the motor cannot saturate (it can) and if the permanent magnets are infinitely strong, then at 50% of the max RPM. You happy now?

But the iron that helps increase efficiency DOES saturate. I expect not very much above the rated max current. And the magnets will become demagnetized if you apply too big magnetic forces on them.

The VESC is quite capable of driving say a DT750 motor. It has a rated current of 18A and 61mOhms of winding resistance. That would mean 180A at stall and 90A at your max-power point. Do you have a VESC6? That will do a short burst of 90A no problem. But maybe, to be on the safe side, this experiment should be done with a motor that is just a little bit smaller. One with say 5A max current and we drive it with 50-70A for that short burst of yours.


@rew lucky guess! ;)


Return to “General”

Who is online

Users browsing this forum: No registered users and 3 guests