How to determine the RPM of a vehicle

The title says it all. Basically I want to add gear ratios to my chassis, but I want to know how to determine the RPM of my car. (My chassis is a constraint based chassis. It is not a raycast / bodythrust vehicle).

What if you used the length of the velocity of one of the wheels as a base value for the speed?

Perhaps like:

local RPM = wheel.Velocity.Magnitude * 100

And then you could multiply it by some number to provide you with some-what accurate numbers that could be RPMs.

Just an idea, not sure if this would work or not.

1 Like

If you can calculate WheelRPM. You can approximate EngineRPM. He’s not wrong in saying that. But why ask a question you deny answers to?

4 Likes

The way I would do this most likely aint the best, but I’d just get the circumference of the wheel and use basic math to figure it out…

This of course is the RPM of the wheels, not exactly RPM of the engine… Since a RPM is not even a factor in a roblox car, it mostly just uses the “idea” RPM to make it look realistic where in all reality, there really is not any…


local diameter = 3 --3 stud wheel diameter. 

local circumference = 3*3.14

local RefreshTime = 1

while wait(RefreshTime) do
      local currentpos = wheel.Position
      wait(1)
      local distancetraveled = (currentpos-wheel.Position).Magnitude
      local RPM = (distancetraveled/circumference) * 60
end
2 Likes

Logic is not welcome here.

@DragRacer31 what is your goal for this? we have no crankshafts so you would simply be simulating it.

Gear 1 shaft RPM / wheel RPM
etc

wheel RPM is just velocity / wheel circumference
but even with that, you are going to need to pick arbitrary values for the ratios

On second thought you just want a little meter thing right?

2 Likes

Yes. Plus I am wanting to simulate gears on my chassis, but I can code that myself :wink: .

I would google various gear box ratios for different kinds of vehicles and use those values to simulate it.

You do some math magic with your velocity → Wheel RPM
then you can use those values to calculate Motor RPMs using which ever gear you are in at the time.

BaseParts also have a RotVelocity that you could use.

1 Like

Actually, if we’re realistic here, the engine will have an idle speed of around 1000RPM, the engine does not just stop whenever the accelerator is depressed.

Real-life transmissions work on gear ratios, for example:

  • Gear 1 to Gear 2 has a gear ratio of 2:1
  • Gear 2 to Gear 3 has a gear ratio of 3:1
  • Gear 3 to Gear 4 has a gear ratio of 4:1

This means that for gear 1 every time that the input gear turns twice, the output gear turns once.
This can help us simulate RPM, as we can estimate that the wheels turn at about the same rate as our output gear, or we can switch up the ratios a bit if we wanted, but for this case, we won’t.

This then becomes a simple division problem using the product of the wheel RPM and ratio of the output gear over the ratio of the input gear.

We can then have this only show up when the player is holding down the accelerator, in order for the RPM gauge to show a realistic measurement.

Note: This might not be a perfect solution, but it’s the best I have for ya.

4 Likes

Eh, it all depends on the specific gear ratios that OP wants, I gave the gear ratios of the typical car, which has overdrive, but OP most likely wants a performance car which has slight gear ratio changes.

Should go something like this:

((Distance(in 1s)/WheelCircumference) * 60 ) / (OutputGear/InputGear)

2 Likes

A vehicles wheels is coupled to the engine’s crankshaft via a transmission. It is somewhat rigidly coupled through actual gears. However, there is a part that makes this a lot more complicated, the torque converter. In a manual car, you can ‘assume’ somewhat that when the clutch is engaged your wheel speed can be used to calculate your engine speed if you know the net gear ratio. In an automatic, your cars wheel speed can be different even if your engine speed stays constant. This is because of the fluid torque converter.

Calculating the rotational velocity of our cars wheel on ROBLOX is relatively trivial. However, calculating the engine RPM from the wheel RPM is where it becomes somewhat more difficult to accurately portray. If we assume it is rigidly coupled, we can just say that wheel_rpm * net_gear_ratio = engine_rpm. That is a our basic and most simple model.

Now onto the torque converter model, which does not assume our transmission is rigidly coupled. Luckily, academic research has been done in this area. I will be using A. J Kotwicki’s 1982 paper Dynamic Models for Torque Converter Equipped Vehicles. He provides a simplified first order model for the torque converter, based on fluid coupling (symbolic definitions can be found on Kotwiciki’s paper):
https://jody.life/pics/images/png/wiM8yln.png
https://jody.life/pics/images/png/QXgBh0o.png
Solving for VFR (volume flow rate):
https://jody.life/pics/images/png/mOFXDsM.png
https://jody.life/pics/images/png/Q3PnWlv.png

We can obtain an exact torque relationship after we substitute the VFR solution:
https://jody.life/pics/images/png/UuDrm8T.png
This equation is still too complex for usage. We can approximate the VFR as a simple pipe flowrate
Q ∝ sqrt(Δp) and a Taylor expansion to obtain

First order simplification gives us

And torque relationship

The resulting model is simplified and ignores torque converter dynamics changing during coupling/overrun mode change. However, Kotwicki verifies the model performs relatively well through a regression fit with observed torque converter data.

With this model, we can calculate the torque for the converter’s pump and turbine, allowing us to model the relationship between the transmission wheel torque and the engine torque if we assume the remaining transmission is rigid. Furthermore, the converter pump and turbine rotational velocities are taken into consideration with this model. Using this model, we can then simulate a car’s engine (for now) as an instantaneous torque upon the torque converters pump. You can use the torque curve of a random engine if you want to be more realistic. You can also properly model the torque of a IC Engine if you don’t like instant torque. Using the car’s mass, we can roughly estimate the torque imparted on turbine due to inertia (ignoring drag, etc).

With this relationship, we can then calculate an estimated rotational velocity for any transmission-element located on any side of the torque converter.

6 Likes

I answered this on:
https://devforum.roblox.com/t/simulating-gears-on-car/48059/2

2 Likes

I made this while using google and some Meter/Second to Rad/Second calculator.

local function getVehicleRPM(currentSpeedinRPS : number)
	return currentSpeedinRPS * 9.549297
end
local function getSPStoRPS(currentSpeedinSPS : number)
	return currentSpeedinSPS * 0.224
end

I’m not sure if this will work or not