Esk8 calculator

You’re doing the code review :stuck_out_tongue_winking_eye:

1 Like

I don’t ever recommend using C-rating and the only reason I put that there is because the old one had that there. You’re better off just typing your own current numbers in there.

4 Likes

Damn broski. Thanks!!

2 Likes

The root cause of the problem is that the C-ratings are almost meaningless as they are mostly marketing jive. It’s at that point where you move from “science” to “guessing”, as evidenced by one line in the source code:

miToKm:number = 1.609344;
lipoManufacturerExaggerationFactor:number = 5.25;
pi:number = Math.asin(1)*2;
1 Like

If you send me a spreadsheet in .ods format with inputs and output formulas, I will make a tab for that.

1 Like

@b264 how about a “peak loaded velocity & gear ratio calculator” for those uphill races?


suppose i’ll be climbing 1.8miles on a steady 5% grade…

i have 4x 190kv 0.05ohm motors & 83mm tires, 120a motor current and 60a battery current limit per motor, & 13S (48.1v)

what’s my maximum top speed up slope and what gear ratio gives this top speed assuming 0.6m^2 frontal area, 0.75 drag coefficient & 200lbs?


assuming battery current limit is 95% or less than the motor current limit, and a vesc with max 95% duty cycle is used in BLDC mode:

60a battery limit / 95% duty = 63.1578a motor current at peak mechanical power

63.1578a^2 * 0.05ohm = 199.445385042w copper loss per motor at peak mechanical power

60a battery limit * 48.1v battery = 2886w electrical power at peak mechanical power per motor

2886w peak electrical - 199.445385042w copper loss = 2686.554614958w peak mechanical power per motor

2686.554614958w peak mechanical power per motor * 4 motors = 10746.218459832w peak mechanical

60 / (190kv * 2 * pi) = 0.05025945571323010603228Nm per motor amp

63.1578a * 0.05025945571323010603228Nm per motor amp = 3.174276652045044390766 Nm torque at peak mechanical power

2686.554614958w peak mechanical / 3.174276652045044390766 Nm = 846.3517548878964569933rad/sec @ peak mechanical

(60 / (2 * pi)) * 846.3517548878964569933rad/sec = 8082.063923094534641801 motor rpm @ peak mechanical power

^peak mechanical power is 10746.218459832w @ 8082.063923094534641801 motor rpm

A = meters per second = XX.XXX
B = drag coefficient = 0.75
C = frontal area = 0.6m^2
D = fluid density of air = 1.225kg/m^3
E = wind drag force in watts
F = sine of 5% slope = sin(atan(5/100)) = 0.04993761694389223373491
G = acceleration of gravity = 9.80655m/s^2
H = vehicle mass in kg = 90.7184kg = 200lb / 2.20462lb/kg
I = mechanical watts required for constant speed up slope with no wind drag
J = mechanical watts required for constant speed up slope including wind drag
K = H * G * F
L = (1/2) * D * C * B

E = ((1/2) * D * C * (A^2) * B) * A

I = H * G * A * F

J = E + I

J = (((1/2) * D * C *(A^2) * B) * A) + (H * G * A * F)

J = (1/2) * D * C * B * A^3 + H * G * F * A

J = (L * A^3) + (K * A)

^this can be rearranged to:

A=(sqrt(3) * sqrt(27 * J^2 * L^4 + 4 * K^3 * L^3) + 9 * J * L^2)^(1 / 3) / (2^(1 / 3) * 3^(2 / 3) * L) - ((2 / 3)^(1 / 3) * K) / (sqrt(3) * sqrt(27 * J^2 * L^4 + 4 * K^3 * L^3) + 9 * J * L^2)^(1 / 3)

we know:

J = 10746.218459832w peak mechanical
L = 0.275625 = (1/2) * D * C * B
K = 44.42622815547907982077 = H * G * F

therefore:

A=(sqrt(3) * sqrt(27 * 10746.218459832^2 * 0.275625^4 + 4 * 44.42622815547907982077^3 * 0.275625^3) + 9 * 10746.218459832 * 0.275625^2)^(1 / 3) / (2^(1 / 3) * 3^(2 / 3) * 0.275625) - ((2 / 3)^(1 / 3) * 44.42622815547907982077) / (sqrt(3) * sqrt(27 * 10746.218459832^2 * 0.275625^4 + 4 * 44.42622815547907982077^3 * 0.275625^3) + 9 * 10746.218459832 * 0.275625^2)^(1 / 3)

A=32.32551993764664323864 meters per second

^therefore the peak velocity up slope is 32.32551993764664323864 meters per second

72.31024856931928212624mph = 32.32551993764664323864 meters per second * 2.23694 mph per m/s

^72.31mph is the maximum possible top speed up 5% slope w/ 200lbs, 0.75 drag coefficient, 0.6m^2 frontal area, 4x 190kv 0.05ohm motors & 120a motor current limit & 60a battery current limit per motor w/ 48.1v battery

therefore we need:

8082.063923094534641801 motor rpm @ peak mechanical power @ 72.31024856931928212624mph w/ 83mm tires

83mm * pi = 260.7521902479528387924mm per rotation

1mph = 0.44704 meters per second

72.31024856931928212624mph * 0.44704 meters per second per mph = 32.32551993764664323864 meters per second

32.32551993764664323864 meters per second * 1000mm per meter = 32325.51993764664323864mm per second

32325.51993764664323864mm per second / 260.7521902479528387924mm per rotation = 123.9702719540260136714 tire rotations per second

123.9702719540260136714 tire rotations per second * 60 seconds per minute = 7438.216317241560820284 wheel rpm required for 72.31024856931928212624mph @ 83mm tire diameter

8082.063923094534641801 motor rpm / 7438.216317241560820284 wheel rpm = 1.086559408652925905457 gear ratio

^1.08:1 gear ratio is needed to obtain maximum possible 72.31mph top speed up 5% slope w/ 200lbs, 0.6m^2 frontal area, 0.75 drag coefficient, 4x 190kv 0.05ohm motors, 83mm tires, 120a motor current limit, 60a battery current limit per motor & 48.1v (13S) battery

answer:

72.31mph & 1.08:1 gear ratio

^graphed out it looks about like this 25T wheel & 23T motor = 1.088:1 ratio for ~72mph up 5% slope w/ 4x 190kv 0.05ohm, 83mm tires, 120a motor current and 60a battery current limit per motor, 13S (48.1v) w/ 200lbs, 0.6m^2 frontal area and 0.75drag coefficient.

8 Likes

Good god I am so hard right now.

8 Likes

I think my brain fell out of my head

3 Likes

It will probably help if you use the markdown to break the entire analysis into heading, sub headings, sub sub heading, bullet points etc. People are not generally inclined to read a wall of text unless there is an outline of what they are about to read.

1 Like

I can directly turn a spreadsheet into an online calculator. A wall of text would take me 8 hours to turn into a calculator

3 Likes

ok I made it into a spreadsheet…

1 Like

I went through the equations. They seem right. I have 3 questions though.

  1. Under what assumptions is motor_current == battery_current_per_motor/duty
  2. Is KV = 1/KT always true?
  3. Lv^3 +vK = J has three solutions. How did you choose the right one?
  1. “So, for example, stepping 12 V down to 3 V (output voltage equal to one quarter of the input voltage) would require a duty cycle of 25%, in our theoretically ideal circuit.”

“The stored energy in the inductor’s magnetic field supports the current flow through the load. This current, flowing while the input voltage source is disconnected, when concatenated with the current flowing during on-state, totals to current greater than the average input current (being zero during off-state). The “increase” in average current makes up for the reduction in voltage, and ideally preserves the power provided to the load. During the off-state, the inductor is discharging its stored energy into the rest of the circuit. If the switch is closed again before the inductor fully discharges (on-state), the voltage at the load will always be greater than zero.”

  1. KT = 1/KV when kv is stated in terms of rad/sec per volt

  2. If memory serves I believe the other 2 solutions to L * v^3 + v * K = J used negative numbers or imaginary units

1 Like

also to verify you could watch this video and most times the throttle is being used, you can use battery current / duty cycle % to get the motor current:

1 Like
  1. I asked this question because you haven’t considered the battery IR. SO the total voltage available to the motor will drop under current draw.

  2. sorry I had the units flipped in my brain. I was thinking in terms of volts/radianpersecond. But I remember reading something related to KV proportional to 1/KT but equal under some assumptions.

  3. Gotcha.

The battery voltage selected should be the voltage including voltage sag at the battery current limit chosen factoring all motors. ie 4 motors @ 60a battery current limit = 240a battery amps… ie what is the battery voltage including sag?

1 Like

I haven’t gone through the equations but something caught my eye.
200w copper losses is going to end up in a boiling motor in a few minutes if not seconds.
I believe the max current value should be lowered as these settings would result in throttling very soon.

1 Like

*use these equations at your own risk

1 Like

As far as esk8 goes, I have come to the conclusion that everything I do is at my own risk :grin:

2 Likes

most interesting/surprising finding so far:

if you have 2 motors, 46v, 190kv, 0.05ohm, 205lbs, 90mm tires trying to surmount a 30% grade with only 30a battery amp limit per motor, your best gear ratio is 4.05:1 for 20.8mph…

1 Like