Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


From Angular Velocity to rpm


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 jujunosuke   Members   -  Reputation: 188

Like
0Likes
Like

Posted 20 April 2012 - 03:41 AM

Hi all,

In my car simulation i have change a lot of settings and i am trying a new approach.
I try to simulate an Engine and then get the resulting speed of the wheels.

Here is what i have done so far, but i don't think that my engine_rpm calculation is correct..
I try to calculate it from the engine angular velocity.

var maxTorque = getTorqueCurve( getRPMEngine() ); //This function return a Torque at a given rpm ( rpm minimum is 1000 )
            
engineAngularAcceleration = maxTorque / getCylinderInertia( 1000, 0.5 );
engineAngularVelocity += engineAngularAcceleration * TIME_STEP;

var rps_engine = engineAngularVelocity * Math.PI * 2;
rpm_engine = rps_engine * 60;

Any help to clear this out would be welcome.
Thank you very much.

Sponsor:

#2 Álvaro   Crossbones+   -  Reputation: 13624

Like
0Likes
Like

Posted 20 April 2012 - 07:42 AM

What seems to be the problem? Do you have an example of a situation where that code produces a clearly absurd output?

And why did you call that variable `maxTorque'? Isn't it just `torque'?

#3 kunos   Crossbones+   -  Reputation: 2207

Like
1Likes
Like

Posted 20 April 2012 - 08:59 AM

To convert from rad/s to rpm this is the macro I use:

#define RADS_TO_RPM(a) ((a)/(PI*2.0f)*60.0f)

So ya, your calculation is wrong.
Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#4 Álvaro   Crossbones+   -  Reputation: 13624

Like
2Likes
Like

Posted 20 April 2012 - 12:00 PM

kunos is right:

var rps_engine = engineAngularVelocity * Math.PI * 2;

should be

var rps_engine = engineAngularVelocity / (Math.PI * 2);

But please use functions instead of macros.

#5 jujunosuke   Members   -  Reputation: 188

Like
0Likes
Like

Posted 22 April 2012 - 07:18 PM

What seems to be the problem? Do you have an example of a situation where that code produces a clearly absurd output?

I don't have totally strange output but, any wrong calculation will lead to wrong simulation of course...

And why did you call that variable `maxTorque'? Isn't it just `torque'?

Yeah, This is just an example, in fact, i have some previous calculation with the variable torque, but anyway..

Thank you Kunos my master ! :D
And thank you alvaro.

I really appreciate both of your help !
Thanks again !




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS