#### Archived

This topic is now archived and is closed to further replies.

# RPM and clutches

This topic is 5132 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

How do you calculate the relationship between throttle position and engine speed in neutual (gear(or when clutch is engaged))? As the crank and the wheel are not connected at that state.

##### Share on other sites
Your throttle (along with the current RPMs) sets the engine torque, right? Just have a certain amount of friction in the engine (constant negative torque, with the net torque clipped to zero), and take into account the rotational inertia of the engine, and it''ll automagically sort itself out. Then just tweak your figures until it behaves sorta sensibly.

##### Share on other sites
Without having to step the RPMs as in engine.rpm += 20; How would be the best way to go about it? What I would really like to do is treat it like a tyre and give it an angVel that updates based on throttle, friction and such. However I am relearning math since I''ve been out of school for nearly 10 years now so this is a bit confusing to me.

Sam

##### Share on other sites
ermm... off the top of my head (and not ever actually having done this, so I'm making it up as I go along):
const float ENGINE_DRAG = 30; //Nmconst float ENGINE_IDLE_THROTTLE = 0.1f; //10% of full throttleconst float ENGINE_REVLIMIT = 6500; //RPMconst float ENGINE_REVLIMIT_BOUNCE = 0.05; //5% of max RPMs float NewEngineSpeed(float currentRPM, float maxTorqueAtCurrentRPM,          float engineRotationalInertia, float throttle, float timestep){    Clip(throttle, ENGINE_IDLE_THROTTLE, 1.0f);    float curTorque = maxTorqueAtCurrentRPM * throttle;    float curAngularVel = curRPM * TWOPI / 60; //radians/sec    //subtract engine drag from current torque.    curTorque -= ENGINE_DRAG;    //accelerate engine using the current torque    curAngularVel += curTorque / engineRotationalInertia * timestep;    //make sure our drag didn't make our engine start to go backwards :)    if (curAngularVel < 0) curAngularVel = 0;    //return the new value    curRPM = curAngularVel * 60 / TWOPI; //RPM    if (curRPM > ENGINE_REVLIMIT)        curRPM = ENGINE_REVLIMIT - ((float)rand() / MAX_RAND)            * ENGINE_REVLIMIT * ENGINE_REVLIMIT_BOUNCE;    return curRPM;}

Hmm... is 1.0f a magic number, since it's not an int?

[edit: added in rev limiter (with throttle bouncing off revlimiter quasirealistically) and fixed some formatting. Oh wonderful staff people, can we please have the crlf-to-<br> automagic conversion work for all crlfs in source? otherwise extra lines get omitted]

[edit again: ok, cut that, can we just have a 'preview' button? ]

[edited by - fractoid on May 29, 2004 5:28:02 AM]

##### Share on other sites
I wish I were as knowledgeable as you at this stuff, you rock! Now all I must do is take the curRPM and apply it to the rest of the drive train once I shift into gear.

##### Share on other sites
this looks like a good idea

http://www.gamedev.net/community/forums/topic.asp?topic_id=224910

implementing the engine and drive train+wheels as separate flywheel bodies, and the clutch connection would pass only a fraction of the torque to and from the engine.

##### Share on other sites
There is a trick in simulating drivetrain in this way oliii.
Firstly, your clutch may be engaged, and then this all work as if would be one rotating object, but when the clutch slips, it''s two rotating object. This should be solved properly.

In my new model I am working on I will inculde this too.
Obtainchi: if you haven''t tried my carsim yet, then see my profile for the URL if you are interested in it.

##### Share on other sites
Ok, so in order for me to get the total rpms of the car, I'll need the angVel of the engine, the angVel of the drive wheels and get the sum of those two values fading from one to another based on clutch factor?

*edit*
Ok, Im just plain ignorant I suppose and I can find anything on how the two should go together to get the final rpm.

@ szinkopa
I tried your sim a while back, things seem in order but I dont think tyre traction feels right..

[edited by - Obtainchi on May 30, 2004 3:52:51 AM]

##### Share on other sites
quote:
Ok, so in order for me to get the total rpms of the car, I''ll need the angVel of the engine, the angVel of the drive wheels and get the sum of those two values fading from one to another based on clutch factor?

I guess that would be a simple solution. Well worth a try.
Unless you want to go into detailed physics, with modelling the clutch/drivetrain with proper dynamics, like for tyres (clutch slip, friction forces, maybe even hydraulics pressure . very complex in my opinion for what it''s worth, but you''d get things like engine struggling to keep the revs up and transmission rattles more accurately).

If you think about it, that''s what a clutch is for. to ease the transition between the transmission and the engine, so they all sing the same song. you can then model the limited slip differentials in a sort of similar way. It can be as complex as you want, and I think the integration to do it that way would have to be very accurate (not just a simple euler).

I''d have a look at www.racer.nl, they must have something in their tech documents about that sort of stuff, since they strive on producing a very accurate, very complex car model.

##### Share on other sites
Yeah, I have been in and out of the source there just to get an idea of how Rudd is doing it but the code is so messy lol..

The only real reason I need a clutch is for rev'ing at the start of the race and switching into gear at the high rpm and being able to convert the rpms from the rev to engine torque. Im not looking for super real physics but a real enough feel to get by with since its only drag racing.

[edited by - Obtainchi on May 30, 2004 6:12:21 AM]

• 11
• 20
• 12
• 9
• 34
• ### Forum Statistics

• Total Topics
631399
• Total Posts
2999844
×

## Important Information

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!