in my sim, i calculate the torque in this way:
torque = input.Throttle * GetMaxTorqueAtRPM(currentEngineRpm) *
gearbox.Ratio * DifferentialRatio * TransmissionEfficiency;
wheels have mass, so they have some inertia. but there is nothing that
models the engine inertia.
this causes the engine to rev up too quickly: engine max rpm (red
line) is reached in a fraction of second.
i see this clearly when wheels are not touching the ground (as there
is no friction)
in this old post: http://groups.google.it/groups?hl=it&lr=&frame=right&th=38ae55d77110a828&seekm=b0s6pl%246q3%241%40helle.btinternet.com#link5
ruud van gaal was proposing this:
" Get a slowdown curve; as this is mostly linear you can use a formula
instead: T_min=coeff*rpm
...
- T_min=coeff*rpm
- T_max=torqueCurveValue[rpm]
- throttle=getInput() (assume 0..1)
- T_engine=throttle*(T_max-T_min)+T_min
"
but i fail to see how this could work. when at full throttle
(throttle=1) then T_engine is == T_max.
all i want is some aproximation. one thing i've tried is limiting the
amount of torque like this:
max_torque_increase =
GetMaxTorqueIncreasePerTimesetp(currentEngineRpm, timestep);
if (torque > (_prevTorque + max_torque_increase))
torque = _prevTorque + max_torque_increase ;
_prevMaxTorque = max_torque;
but i'm sure there is something more clever. do you have some ideas?
thanks in advance,
Ettore
Add a moment of inertia to the rotating parts.
In article <d2kes4$e9l$[email hidden]>, "Slowmo" <[email hidden]> wrote:
>Add a moment of inertia to the rotating parts.
Sounds like the best approach. I'm not sure what a good total
inertia is, but an approx may be to assume a flywheel of about 15
lbs and 12" dia (rough numbers) and use I = 0.5*m*R^2. Then maybe
double it for engine plus other transmission inertias? Anyway, I
rough a value of about 0.16 kg-m2, but have no idea how close this
is. Vary it to give you an acceptable windup time.
> rough a value of about 0.16 kg-m2, but have no idea how close this
> is. Vary it to give you an acceptable windup time.
thanks for your suggestion. what i fail to see is how do i use this
scalar value in my equation.
what i'm doing right now is:
1) get the engine_rpm as f(wheels_rpm, ratios)
2) get the max_torque as f(engine_rpm)
3) apply torque to each wheel
4) step the simulation
my hope was to be able to change 2) as max_torque = f(engine_rpm,
inertia)
am i just plain wrong?
In article <[email hidden]>, [email hidden] (Ettore Pancini) wrote:
Just as you were going to have the torque act on the drive wheels,
additionally have it act on the engine/flywheel/trans. The basic
eqn is:
Torque = I * alpha (alpha being the angular acceleration)
which in your would be
engine torque = (I*alpha)engine + (I*alpha)wheel
Using the respective terms for both (i.e., engine_rpm and
wheels_rpm).
At least I think that is what you want!
Quoted text (12 lines)
>thanks for your suggestion. what i fail to see is how do i use this >scalar value in my equation. > >what i'm doing right now is: >1) get the engine_rpm as f(wheels_rpm, ratios) >2) get the max_torque as f(engine_rpm) >3) apply torque to each wheel >4) step the simulation > >my hope was to be able to change 2) as max_torque = f(engine_rpm, >inertia) >am i just plain wrong?Ruud is right, you will need what he proposes to get engine braking
working in your sim, but you are also correct that when throttle=1, the
torque output will be the max torque at whatever rpm the engine is
running at. It looks from another of your replies that you are
calculating the engine rpm from the wheel rpm, which is correct, but if
the wheels are off the ground the engine *will* redline pretty quickly.
If your engine is redlining almost immediately with the wheels on the
ground and with friction there, then I think you're doing something
wrong with the torque when it gets to the wheels. Sorry if that's not
the case, but if it is, then I'll write this out. Even if it doesn't
help you it might help someone. I can't really tell what you are doing
or aren't doing so I will quickly trace out the steps so that you can
compare your code with this algorithm (this will be quite simple).
The engine has an rpm, you have a throttle position, and from these two
things you calculate a torque value, I think in your code you say
input.Throttle * GetMaxTorqueAtRPM(currentEngineRpm). You could even
just make it a scalar for now, ie torque = input.Throttle *
CONST_TORQUE and come back to fix it later, but if you already have a
GetMaxTorqueAtRPM() function that you know works then use that.
This torque is passed through the gearbox and the diff and must be
multiplied by those two ratios, in your code, torque *
gearbox.Ratio * DifferentialRatio. This gives you a torque at the
wheels.
This torque has to produce a forward force at the wheels. To use a
decent tyre model, you would use this equation T = MoI * aa, torque =
moment of inertia * angular acceleration. This is a conversion of F=ma
into the rotational domain. Then you would integrate to get a new
wheel angular velocity, compare that to the free wheel angular
velocity, get a % difference, put that into your tyre model and get a
forward force [1]. For the time being, ignore that, lets assume 100%
grip, so just take the torque and divide it by the radius of the wheel
to get the forward force produced at the contact patch.
Subtract from this the resistance forces- air resistance and rolling
resistance to get a total forward force on the car. Apply this to the
chassis, F=ma to get an acceleration for your car, integrate it to get
the new car velocity.
>From the new velocity get the free rotation speed of the wheels[2],this is a speed not a torque so as you send it back up the drivetrain
you still multiply by the gear/diff ratios instead of dividing as you
would for a torque, so take the wheel rotation speed, multiply by diff
ratio and gear ratio, that's the new engine rpm.
A couple of points. If you use this method to start with, the engine
revs should be very very low when the car starts moving, at an rpm
which would mean stalling in real life. That's because we assume 100%
grip of the tyres. If this works, you should work out the angular
velocity of the wheels from the engine torque applied to them and the
frictional forces from the road, as I said in [1]. That means you
don't have to calculate it at [2], you will already have it. This will
allow you to rev the engine and spin the wheels, you'll probably use
Pacejka to do tyre stuff to start with, the wheels will spin and the
revs will rise like in real life. Start simply though.
Make sure the basics work before complicating, writing stubs like this
float GetMaxTorqueAtRPM(float rpm)
{
return 300;
}
allow you to test things, and later you can rewrite this function body
to actually get a properly calculated value from the rpm value.


































