Forums Home

« Back

SystemVision Site Discussion

SystemVision Blog: First Robotics (FRC) Motor Modeling

Darrelljoined November 6, 2013

posted Friday, May 6, 2016 | 6:14 pm PDT

Introduction
In the world of the First Robotics Competition, the CIM motor is the trusted workhorse. These motors have lots of power and they can take a ton of abuse and keep on running.  Most FRC robots use CIM motors for any and all heavy-lifting jobs, including primary drive motors and any game tools that need a lot of torque or power. Read here if you're curious why it's called a 'CIM' motor.

Figure 1. Vex Robotics CIM Motor

This blog will show you how this motor is modeled, mathematically, using the tools on SystemVision® Cloud.  This allows you to design with this motor and be able to accurately predict how your system will perform, all in a virtual environment.  Let's start with the end, though, by first looking at a SystemVision test circuit that includes a model of a CIM motor.  Then, later in this blog, I will show you how the model was developed.
SystemVision® Cloud CIM Motor Test Example
This SystemVision schematic shows a CIM motor under the same test conditions as measured data provided by Vex Robotics (see Figure 3. below).  This is a live view of this design.  You can move the probes and see different signals of interest. When you compare it with the measured data below, you will see that it matches quite well.

Figure 2. CIM Motor Test Circuit
Note that the electrical power supplied to the motor is from an ideal 12 volt DC source.  This corresponds to a lab bench instrument that regulates the voltage to ensure it stays constant at the set value (12 V).  Any electrical current that is necessary will be supplied to support keeping the voltage at 12 V.
Unfortunately, this is not the same thing as using a battery to power the CIM motor!  The batteries that are typically used in FRC competitions are nominally 12 volt batteries, but the actual voltage across the battery terminals is a function of when the battery was last charged as well as the electrical current being drawn from the battery at any particular time.  As a current load is drawn from the battery, the voltage drops.  Consequently, a battery's voltage can be as high as about 12.6 volts, under no-load conditions, and can drop as low as about 6 volts under heavy load.
Also notice the mechanical load configuration of this test circuit.  The block with an "ω" on it is a source that will force the mechanical shaft velocity (in radians-per-second) of the motor to a specified value.  Just as in the voltage source, the speed source will supply any torque that is necessary to keep the velocity at the specified value.  This model is controlled by the chain of signals to the left, causing the shaft speed to be swept from 0 rpm up to 5,330 rpm, over time, from 0 seconds to 5,330 seconds.  Thus the time axis of the plots and the rpm of the motor correspond.
View in systemvision.com
You can use this test circuit yourself.  Just click on the "View in systemvision.com" button.  This will open the design for viewing.  Click on the "Copy" button to edit the design for your own use (you may need to login or create a free account).  You can change the voltage or loading conditions or make any other variation of the circuit that you wish and re-simulate the circuit.  Move the probes to see results.
Why Model a CIM Motor?
Motors are used to accomplish a job -- driving the wheels or tracks to make the robot move, or to spin a wheel as part of a shooter mechanism, or driving a winch to enable the robot to scale a wall.  Any robot design using a motor has to answer several questions: will the motor be able to provide the necessary force or torque for the mechanical load?  How much current will the motor draw under load?  Will the breaker be tripped?  Will the motor burn up?  What gear ratio gives us the right tradeoff of torque and speed?
Like all DC motors, the CIM motor provides performance that varies significantly as a function of the electrical source (voltage & current), and mechanical load (speed & torque).  These are represented by the multi-dimensional graph below.  The measured data below, provided by Vex Robotics, characterizes the performance of this motor, across these variables.
Answering the above questions depends on determining where on these curves the motor is operating.  But this isn't easy to do, as the operating point changes while the motor is being used, and all of the variables interact.
This remainder of this blog will show you how to encapsulate this information into a mathematical model, then use it to predict CIM motor performance under conditions that are different than the test data.
Measured Data for a CIM Motor
This graph shows the performance of a CIM motor as a function of mechanical shaft velocity in RPM.  This corresponds exactly to the SystemVision Cloud test circuit shown above -- with an ideal 12 volt voltage source and a swept shaft velocity load.

Figure 3. CIM Experimental Data
DC Motor Equations
This model uses the following simultaneous differential equations, shown below in Equation 1 and Equation 2.
(Equation 1)
(Equation 2)

With the following sign conventions for the main variables: voltage, current, angular velocity, and torque.

Figure 4. Motor Symbol With Sign Conventions
Note that torque () is defined as a positive value when applied to the motor, not by the motor. Consequently, from the perspective of the motor model, a positive current produces a negative torque.
Where the variable names are defined as:
Symbol
Description
Units

Type

Typical
value

Motor shaft torque

Dependent

Motor torque coefficient -- torque produced by motor current

Coefficient

Motor winding current

Independent

Viscous damping coefficient

Coefficient

Motor shaft speed

Independent

Motor rotor moment-of-inertia

Coefficient

Motor winding voltage

Dependent

Motor voltage coefficient -- EMF produced by motor shaft velocity

Coefficient

Motor winding resistance

Coefficient

Motor winding inductance

Coefficient

Table 1. Model Variable Names and Descriptions
The EMF (electro-motive-force) -- also known as 'back EMF' -- is the voltage produced by the motor when it is operating as a generator.  Spinning the shaft of a motor, by applying mechanical work, produces a corresponding voltage on the winding terminals.
There is a good discussion on the Chief Delphi forum regarding the relationship between the torque coefficent (Kt) and the voltage coefficient (Kv).  Under certain modeling assumptions, these two values should be identical.  The model here lumps certain losses into the Kv term, which causes the value of Kv to be larger than Kt.
This set of equations has sufficient flexibility to accurately model the CIM motor.  Fitting this model to the measured data, by determining specific values for the coefficients, is the task of the next section.
Determining Model Coefficients
The data in Figure 3. is for steady-state operation of the motor -- each data point is obtained by running the motor at a fixed speed long enough for all transient behavior to settle out.  Then all of the other variables (current, voltage, & torque) are measured and recorded.  This is repeated for each motor speed in the data set. The entire original data set can be downloaded here.  A spreadsheet with all of the calculations below can be found here.
Since this motor is in steady-state for each data point, the time derivatives of current and angular velocity are zero:
(Equation 3)
(Equation 4)
Therefore, Equations 1 and 2 reduce to:
(Equation 5)
(Equation 6)
Calculate
Using the data point where  (Speed RPM = 0), we see that the torque is 2.41 and the current is 131 .  We can then solve Equation 5 for

Note that torque () is defined as a positive value when applied to the motor, not by the motor.  The data set provided by Vex Robotics is therefore a set of negative torque values, from the perspective of the model.
Calculate
Also using the data point where  (Speed RPM = 0), we see that the voltage is 12 and the current is 131 . We can then solve Equation 6 for

Calculate
Now that we have a value for , we can plug in values for torque, current, and speed, for each data point supplied, to determine D for each data point in the data set.  This set of values can then be averaged to determine a good value for D.
(Equation 7)

Calculate
Now that we have a value for , we can plug in values for voltage, current, and speed, for each data point supplied, to determine for each data point in the data set.  This set of values can then be averaged to determine a good value for .
(Equation 8)

Rotor MOI J
The moment of inertia (MOI) of the motor's rotor (J) affects how quickly the motor can spin up or down.  There is a good discussion on calculating the motor moment of inertia on the Chief Delphi forum. This analysis found the value of J to be:

Winding Inductance L
The inductance of the motor's winding (L) affects how quickly the electrical current in the winding can increase or decrease.  There is a good discussion on calculating the motor winding inductance on the Chief Delphi forum. This analysis found the value of J to be:

Implementing the Model in VHDL-AMS
A model that corresponds to the equations described in this blog can be created for use with the SystemVision Cloud tools.  This is accomplished by using the IEEE standard 1076.1 VHDL-AMS language, which is well-supported by the SystemVision simulator.  The symbols in the schematic, above, each have a corresponding model associated with them.  To see the source code of the model, simply click the right-mouse-button on the symbol and select "View/copy model."  You will then see a view of the model text, which you can also copy, save, and edit to create a new model.
The VHDL-AMS language looks like a programming language, but it is primarily a modeling language.  It allows you to express the equations of your model as a set of simultaneous, nonlinear, differential equations.  You don't have to write any software to solve the equations, you only have to express the equations in a form that the simulator can interpret.
Use This Model
You can use this model to create electro-mechanical circuit diagrams of your own and predict how your system will behave, both electrically and mechanically.