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(100K))) then N=(1)*((100*(D^2)*(K100))/(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(100K))) then N=(1)*((100*(D^2)*(K100))/(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 underthelimitswattage.
"Peak Efficiency" Control Mode?

 Posts: 255
 Joined: 08 May 2017, 01:55
 Location: San Francisco, California, US [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
Re: "Peak Efficiency" Control Mode?
Last edited by devin on 14 Oct 2017, 12:17, edited 2 times in total.

 Posts: 255
 Joined: 08 May 2017, 01:55
 Location: San Francisco, California, US [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
Re: "Peak Efficiency" Control Mode?
% 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(100K))) then N=(1)*((100*(D^2)*(K100))/(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*(M100)*sqrt((D^2)+4*F*N)+((D^2)*(M100))+(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(100K))) then N=(1)*((100*(D^2)*(K100))/(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*(M100)*sqrt((D^2)+4*F*N)+((D^2)*(M100))+(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 wattthrottle 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.
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(100K))) then N=(1)*((100*(D^2)*(K100))/(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*(M100)*sqrt((D^2)+4*F*N)+((D^2)*(M100))+(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(100K))) then N=(1)*((100*(D^2)*(K100))/(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*(M100)*sqrt((D^2)+4*F*N)+((D^2)*(M100))+(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 wattthrottle 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.

 Posts: 255
 Joined: 08 May 2017, 01:55
 Location: San Francisco, California, US [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
Re: "Peak Efficiency" Control Mode?
Last edited by devin on 22 Oct 2017, 17:21, edited 1 time in total.

 Posts: 310
 Joined: 28 Mar 2016, 14:37
 Location: FR Valence [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
Re: "Peak Efficiency" Control Mode?
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.
Who is online
Users browsing this forum: No registered users and 2 guests