Go to Post It's hilarious to watch this conversation about a box which probably has a 95% chance of being robot batteries turn into all kinds of bowling ball conspiracies. - artdutra04 [more]
Home
Go Back   Chief Delphi > Technical > Motors
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-01-2017, 02:23
AriMindell AriMindell is offline
Registered User
FRC #1389 (The Body Electric)
Team Role: Programmer
 
Join Date: May 2016
Rookie Year: 2015
Location: Maryland
Posts: 18
AriMindell will become famous soon enoughAriMindell will become famous soon enough
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 05-01-2017, 08:47
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,593
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
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 / nominalVoltage
By spinning, the motor generates a backVoltage proportional to speed:
backVoltage = speed * freeBackVoltage / freeSpeed
Free 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 / nominalVoltage
I leave rolling all this back up into your calculation to you.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.

Last edited by GeeTwo : 05-01-2017 at 08:54. Reason: added and finally and current calculation; indents
Reply With Quote
  #3   Spotlight this post!  
Unread 05-01-2017, 09:07
gerthworm's Avatar
gerthworm gerthworm is offline
Making the 1's and 0's
FRC #1736 (Robot Casserole)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Peoria, IL
Posts: 64
gerthworm has a spectacular aura aboutgerthworm has a spectacular aura about
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 05-01-2017, 10:57
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,059
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Understanding Motor speed, torque, voltage

Quote:
Originally Posted by AriMindell View Post
How are speed and torque related?
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:
Originally Posted by AriMindell View Post
I calculate the angular acceleration (alpha) of the attachment, then add alpha(*dt) to the angular velocity (omega), and omega*dt to the position (theta).
I added the red part.

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.
Reply With Quote
  #5   Spotlight this post!  
Unread 06-01-2017, 18:04
sspoldi's Avatar
sspoldi sspoldi is offline
Steven Spoldi
AKA: Steve Spoldi
FRC #0230 (Gaelhawks)
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2008
Location: Shelton, CT
Posts: 16
sspoldi is a splendid one to beholdsspoldi is a splendid one to beholdsspoldi is a splendid one to beholdsspoldi is a splendid one to beholdsspoldi is a splendid one to beholdsspoldi is a splendid one to behold
Re: Understanding Motor speed, torque, voltage

Quote:
Originally Posted by AriMindell View Post
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?
Hi Ari,
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.
Reply With Quote
  #6   Spotlight this post!  
Unread 06-01-2017, 20:50
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,593
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Understanding Motor speed, torque, voltage

Quote:
Originally Posted by sspoldi View Post
If you publish what you have, we have about 17 hours before build season starts to sort it out
Less whatever time we will spend banking sleep and cooking (and otherwise preparing) for kickoff, of course!
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.

Last edited by GeeTwo : 06-01-2017 at 20:55.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:41.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi