Understanding torque and horsepower

Started by
4 comments, last by pTymN 16 years, 6 months ago
So I found this article: explanation. I sort of understand it now. So when using my physics engine of choice, my wheel body can only have a torque applied to it. What kind of formula do I use to determine how much torque to apply to my tire in a given iteration? My simulated car has a single geared electric motor (flat torque curve), and I am given dt, w. It seems like the relationship should be really simple here. Bonus question: The physics engine that I am using is Chipmunk. It does not have a proper motor that I can use, so I'm wondering if its even feasible to fake a motor by simply applying a torque to the drive wheels each frame.

Advertisement
Well... the engine produces a torque which is modified by the gear box, passed down the drive train and applied to the road. Engines have an associated torque curve indicating how much power they produce for a given RPM... typically an electric motor produces torque proportional to rev rate (up to it's maximum rev rate). Without a gear box the motor's shaft will rotate at a rate that is typically too high to drive wheels (unless they are tiny, eg the shaft of an electric motor itself). In putting the motors drive through a gear box we effectively scale down the RPM, but the total power output is fixed (appart from mechanical losses which can be ignored for these purposes), so the torque proportionally increases. The drive train transfers this drive to the wheels (with further loss which we can ignore) and given the radius of the wheels we can calculate the effective linear force experienced by the tyres where they contact the road. From this you can calculate the acceleration (assuming no slip on the road and you know the weight of the vehicle). Note that the engine produces no torque at no revs... Hence the engine must be turned in order to start it and must rest at some "idle" rev rate when you aren't moving (the clutch is disengaged). I didn't really mention the clutch... but in practise you can consider it to disengage the motor from the gearbox... that's to say when the clutch is down, there is no load on the engine (or rather only load due to the motor itself). In an electric motor when it's not powered the magnets/coils sit in a low energy position... so when the coils are charged they move out of that state and "rev up" hence electric motors not requiring starting (though if you make one yourself, you'll probably find you need to give it a spin by hand to get it started). As for how this all translates into a game... it all depends what you want to happen in game. You could for example ignore the fact that it's a motor altogether and simply apply a constant torque in the appropriate direction corresponding the the users requirements to the wheels. If you are going to add some sort of engine/gear/wheel relationship then the user should be able to pick the gear as otherwise it'll be (from the user's point of view) no more useful than the "simple method". If you are going for one of these monster truck/dirt bike/whatever games that seem to be quite popular nowadays, then allowing the user to select gears could add an extra dimension that they don't typically have, but equally... more complex play mechanics can detract from the simple and direct fun of the game. In an even simpler case you could effectively just have the wheels free to rotate as appropriate and simply apply a linear force to the vehicle (in the forward direction tangent to the ground the vehicle is touching). Depending on the level type this may be sufficient.
Good luck with it,

Dan

Quote:You could for example ignore the fact that it's a motor altogether and simply apply a constant torque in the appropriate direction corresponding the the users requirements to the wheels.


Sounds good. When the user's car is flipped over and rights itself, the crazy amount of spin on the wheel causes the car to fly very far. If I was spinning my car tires at 100mph and then my car was dropped 6 inches from a crane, the amount of energy stored in the tires would be very small. I would expect a small chirp and then my car would lurch forward a little bit, but it wouldn't start flying, because the mass of the car FAR exceeds the angular momentum of the spinning drive tires.

Think about it this way: If I use a drill on a high torque setting that spins slowly and leave the drill sitting out, it does not start spinning faster and faster. Almost instantly, it spins up to a slower angular velocity and then just stays at that angular velocity. What I'm concerned about is that maybe my physical model is too simplistic, and that I need to both understand and write more robust code that considers the output torque from an engine as a different kind of thing from the rotational velocity of the tires that the engine drives.

Clarification:

void Vehicle::applyWheelForces(cpBody *chassisb, cpBody *wheel1b, 	cpBody *wheel2b, bool breaksb, float input_powerb, float maxw, float dt){	if(!breaksb)	{		cpFloat torque = -2000000.0f * input_powerb;		// uncommenting this next line causes cars that flip back over to fly        // wheel2b->w *= pow(0.01f, dt);		wheel2b->t += torque;		chassisb->t -= torque;		wheel1b->i = wheel_moment;		wheel1b->i_inv = 1.0f/wheel_moment;		wheel2b->i = wheel_moment;		wheel2b->i_inv = 1.0f/wheel_moment;	}else{		wheel1b->w = 0;		wheel2b->w = 0;		wheel1b->t = 0;		wheel2b->t = 0;		wheel1b->i = (float)HUGE_VAL;		wheel1b->i_inv = 0;		wheel2b->i = (float)HUGE_VAL;		wheel2b->i_inv = 0;	}}


Nowhere is dt being used. What also confuses me is that a high torque drill doesn't use its unused torque by spinning faster. Is that just related to the mechanical properties of an electric motor specifically, or are the two physical quantifiers of power and torque helpful in understanding this more generally?

Quote:Original post by pTymN
What also confuses me is that a high torque drill doesn't use its unused torque by spinning faster. Is that just related to the mechanical properties of an electric motor specifically, or are the two physical quantifiers of power and torque helpful in understanding this more generally?


Actually, there is no unused torque! If the drill spins at a constant rate, then the torque generated by the motor exactly balances the torque due to friction in the shaft plus any externally applied torque transferred from the screw in the wall (which itself originates from friction between the screw and the wood).

So, there are some things you can observe about power drills. First, a fixed or constant "speed" drill actually will be variable speed in reality...it'll spin at different rotation rates depending on the external load applied. Fixed "speed" really means fixed current, which translates to a constant generated torque---this is all due to the electromagnetic phenomena exploited by the motor design. If you are not turning a screw, then the only load on the motor is the internal friction, and the drill will spin up until the internal friction balances the constant generated torque. It'll spin up to the fast spin rate possible to balance that friction.

You can think about torque as being the following. While the drill is spinning at a constant rate (e.g., it is not rotationally accelerating), then torque is in balance and:

Generated_torque = Torque_absorbed_by_internal_friction +                   Torque_balancing_external_loads


Or,

(Eq 1) Tgen = Tfriction + Texternal


Or, rewriting,

(Eq 2) Tfriction = Tgen - Texternal


For a constant speed drill with no load, Texternal is zero and Tgen = Tfriction. If you need to apply a load, then Texternal will be nonzero, and the available torque to balance friction, Tfriction, is reduced, which means the drill must run at a slower speed, e.g., the drill will spin up until Equation 2 is satisfied...less Tfriction means it spins up to a slower speed.

Lets proceed to variable speed drills. With a variable speed, you can squeeze the trigger in different ways to get the drill to spin at different rates. What you're really doing is changing the current applied to the motor, which changes Tgen! The generated torque is NOT constant. It is a function of the current that you are varying.

By changing the current, by changing Tgen indirectly, what you are enabling is that Texternal can be constant at different speeds, e.g., If you want to apply a larger load at a larger speed, pull the trigger more to up the Tgen to enable a larger Tfriction with the same Texternal load. If you want to spin slower, reduce the trigger so that the drill reaches equilibrium with a smaller Tfriction but with the same Texternal.

So, the terminology of drills is a bit misleading when you think about the physics. Constant/fixed speed isn't constant at all, and does generate a constant torque that will balance the applied load while the speed will vary based on that load. And a variable speed drill is just that, but it actually generates variable torque in order to provide a constant available load torque at different speeds.

Tim, does that help at all? I'm sure all this make sense. I just wanted to spell it out clearly to clarify how the physics of torque worked within the power drill environment, :).
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Actually, that helps alot! I added a friction to the wheels of the car in my game, so when it flips back over, the wheels don't have a crazy amount of energy stored in them from spinning up. When the car flips back over I get the small jerk that I would expect.

This topic is closed to new replies.

Advertisement