This is a deep dive into how motors and motor controllers work and the physics behind motors. You don't necessarily need to know this for software, but it will help understand why the Design team makes the decisions they do.

How do motors move?

The core part of a DC brushless motor is the rotor and the stator. The rotor is the part of the motor that spins, while the stator is made of wound up copper windings that act as an electromagnet. Motors move by turning on the appropriate windings in a way that the magnets attract the rotor in the correct direction, and since we are talking about brushless motors, the windings are activated through software instead of mechanically.

What is commutation?

Commutation refers to the method by which the motor controller controls the windings to optimally move the rotor inside the motor. The three main types for BLDC are trapezoidal, sinusoidal, and FOC (Field Oriented Control) commutation. Trapezoidal commutation is the simplest, and works by completely switching windings off and turning the next winding on. Trapezoidal is okay for most purposes, but can cause torque ripple and noise by not smoothly changing the power applied to the windings. Sinusoidal commutation is a step up and works by smoothly applying power to the windings (like a sinusoidal curve on a graph). Since CTRE doesn't use this type of commutation, we won't really talk about it. The most complex, advanced, and efficient method is FOC commutation, which CTRE supports through their Pro license. FOC commutation aims to directly control the torque of the motor instead of applying voltage or arbitrary power to the windings. Since torque is directly proportional to current, this is what leads to the TorqueCurrentFOC control modes.

Motor Graphs

The motor graphs from manufacturer's websites are cool and all, but it helps even more to understand how they came to these numbers and lines. Here is an example of the Kraken X60 FOC motor graph from the WCP website:

To understand these lines, we have to first understand a motor's constants (from ReCalc):

Since torque is directly proportional to current, Kt represents the amount of torque per unit of current.

Kv represents the RPM per volt applied. This is equal to the free speed of the motor / the voltage that was applied to achieve the free speed.

R represents the resistance of the windings inside of the motor. This has no relation to the load applied to the output shaft of the motor.

With these three constants, we are to (basically) recreate this graph.

First we need to understand what this graph is telling us. The X axis is measured in RPM, and the Y axis is a variety of metrics. This graph is essentially telling us how the motor behaves as the speed increases. For example, a motor at standstill accelerating to its free speed will very quickly traverse through this whole graph.

Back EMF

Back EMF is a crucial part of brushless motor controllers. As a motor spins, it produces voltage in the opposite direction proportional to the speed that it is spinning, so a motor near its free speed is producing much more back EMF than a motor near zero velocity. This is the reason that motors cannot just keep spinning at infinite velocity. The free speed of a motor is the point at which the applied voltage (the total voltage - back emf voltage) is equal to zero. We can calculate back EMF using the motor's KV constant. The back EMF is equal to s/KV, where s is the current speed of the motor.

The fundamental electrical equation is V = IR. The V is the voltage being applied to our motor controller, which is the original voltage minus the voltage loss due to back EMF. The R is a motor constant of the resistance in the windings inside of the motor. So, we can say that C(s) = (VI-s/KV)/R.

Torque is the next step up from motor. Since torque is directly proportional to current, and KT represents that ratio, we can simply say T(s) = KTC(s).

Now it gets more complicated thinking about power. Mechanical power is equal to torque times speed, and that's easy enough to calculate, but it doesn't take into account the losses with the motor. If we just plotted power times torque or power times current, the graph would look very different from the line you see above. The two main losses in BLDC motors are thermal losses and iron losses. Thermal losses are simply the energy lost due to heat at high currents. We can calculate it with LC = R x I2. This essentially means that as the current increases linearly, the thermal loss doubles. Iron losses are a constant loss in a BLDC motor due to something in the magnetic flux (I don't really know the specifics). Iron loss is equal to the applied voltage (not after back EMF) times the free current (the current needed to barely spin the motor). So, putting it all together, LI = VI x IF.

So, the mechanical power of a motor can be expressed as P(s) = VIC(s) - R x C(s)2 - VI x IF, where VI is the initial voltage applied, R is the resistance of the copper windings, IF is the free current of the motor, and C(s) is the function above to calculate the current of the motor.

Finally, the last step is efficiency. Efficiency is the ratio of how much electrical power was converted into mechanical power. Electrical power is in Watts, calculated as voltage times current, and mechanical power is equal to torque times velocity and can be calculated from the power equation we found above. Efficiency can be calculated as E(s) = PM(s) / (VIC(s)), where PM is the mechanical power equation from above. An example of these equations is here.

Noticing Patterns

After all of these equations, we can notice some patterns with the graph, specifically with the efficiency equation. The dip at the very end of the graph is because of iron loss. The motor can no longer generate enough power (because of the back EMF) to make the iron loss negligible, and most of the electrical power is being used to get over the iron loss. We can see that torque and current are very high at near-zero speed, which might make you think that you should design a motor to run at near zero speed, but notice that the power and efficiency is very low. This is because of the thermal loss.