|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Understanding Motor speed, torque, voltage
I am working on programming a motor simulator for FRC motors, which allows a user to input a set of motors, a gear reduction, and an attachment in the form of a moment of inertia.
The simulator should calculate the angle, angular velocity, and angular acceleration of the attachment at any time. Currently, I calculate the angular acceleration (alpha) of the attachment, then add alpha(*dt) to the angular velocity (omega), and omega to the position (theta). I had determined the following formula for torque of the motor, given voltage and current speed: stallTorque * (percentVoltage - (omega / freeSpeed) and I know from physics that: alpha=torque/moment. This does not work as expected, and I think it's because my formula for torque is wrong, and I don't fully understand DC motors. How are speed and torque related? by most explanations, speed should have an inverse relationship with torque, but this system would indicate that it does not. Am I making a false assumption? |
|
#2
|
|||||
|
|||||
|
Re: Understanding Motor speed, torque, voltage
You are correct that the torque formula isn't correct.
The angular momentum does not play into the torque calculation (though it will be part of the angular acceleration). Torque is (modeled as) proportional to current, not speed. Torque = stallTorque * (current - freeCurrent)/(stallCurrent-freeCurrent)At stall, current is proportional to inputVoltage (V=IR): if (speed==0) current = inputVoltage * stallCurrent / nominalVoltageBy spinning, the motor generates a backVoltage proportional to speed: backVoltage = speed * freeBackVoltage / freeSpeedFree back voltage is calculated from the residual voltage at free speed and V=IR (R being calculated from stall): freeBackVoltage = nominalVoltage * (1- freeCurrent / stallCurrent)and finally, current at speed is again calculated from V=IR, using the residual voltage (applied - back): current = (inputVoltage - backVoltage) * stallCurrent / nominalVoltageI leave rolling all this back up into your calculation to you. Last edited by GeeTwo : 05-01-2017 at 08:54. Reason: added and finally and current calculation; indents |
|
#3
|
||||
|
||||
|
Re: Understanding Motor speed, torque, voltage
https://github.com/RobotCasserole173...ib/motor_CIM.m might be of some help.
https://github.com/RobotCasserole173...r_model_test.m will give some context to how that above code can be used. Last edited by gerthworm : 05-01-2017 at 09:11. |
|
#4
|
||||
|
||||
|
Re: Understanding Motor speed, torque, voltage
Torque vs speed at the spec voltage is commonly modeled as a straight line connecting the stall point (stall torque @ zero speed) at the spec voltage to the free speed point (zero torque @ free speed) at the spec voltage.
So the equation of that line would be: T = Ts*(1-N/Nf) ... where T is torque, Ts is stall torque at the spec voltage, N is speed, and Nf is free speed at the spec voltage. Values for Stall Torque and Free Speed of FRC-legal motors are published every year. Let's say the spec voltage is 12 volts (it is for most FRC motors). If the applied voltage "V" is not equal to 12 volts, the equation can be generalized by using the approximation: T=Ts*(V/12-N/Nf) Quote:
This is called Euler integration. Given all the other tolerances in the model, it's probably adequate for what you are doing. But for students who may be interested in learning about it, the Midpoint Method is a better way to do numerical integration that is quite easy to implement in Excel. You can find a discussion thread here. Last edited by Ether : 05-01-2017 at 11:06. |
|
#5
|
||||
|
||||
|
Re: Understanding Motor speed, torque, voltage
Quote:
I love how you think, your instincts are spot on. The devil's in the details as they say, and you just need to scale the right terms. I started out 30 years ago as a brushless DC motor guy, and it's all too easy (for me) to recite equations but I really struggle to explain DC motors in a clear and understandable way. If you assume that the motor torque when stalled is the "stall torque" (given a full input command) then when the motor reaches the no-load speed the torque reaches zero (hence max speed with no torque). Look at the factor (no-load speed - speed)/no-load speed and you'll get a term that starts at 1 and linearly goes to 0 at the no-load speed. let torque = stall_torque*(no-load speed - speed)/no-load speed and you've got it. let alpha = torque/inertia, and velocity = velocity + alpha*deltatime, and your done. BTW, if you're using a motor command of let's say: cmd = k, where k is between + and - 1, torque becomes = stall_torque*(cmd*no-load speed - speed)/no-load speed. If you publish what you have, we have about 17 hours before build season starts to sort it out ![]() Sincerely, Steve Spoldi. |
|
#6
|
|||||
|
|||||
|
Re: Understanding Motor speed, torque, voltage
Less whatever time we will spend banking sleep and cooking (and otherwise preparing) for kickoff, of course!
Last edited by GeeTwo : 06-01-2017 at 20:55. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|