Home | The engine drives your car. |
|
Introduction
For a complete list of car settings, visit the car.ini reference page.
The engine simulated in Racer is relatively simple. It can stall,
and you can restart it. The engine generates a specific amount of torque depending
only on engine RPM. The (normalized) torque is given through a curve file, which
can be edited by Curved (Windows-only currently, 13-11-03) and determines the
characteristics of output torque vs. engine RPM. Through engine.max_torque
you then scale this curve to generate the actual torque (specified in Nm).
At low gears the engine may produce a lot of torque, making controlling the
car quite hard. You can add engine mapping parameters, per gear, that define
the linearity of the throttle for each gear. This is used in Formula 1 for example
for some more control in lower gears; it is also useful for other high-power
cars. Perhaps inverted linearity is also useful for low-power cars, to give
them a bit more responsiveness.
Revving the engine generates torque for the wheels, but at the same time this also ofcourse affects the chassis directly too (in the reverse direction of the engine rotation). This is called Engine Torque Reaction, and is simulated as well. The specific options are listed below.
Quick shortcuts to the variety of engine paramters are listed here:
The engine mass is given in engine.mass. Typical values range from 250kg to 400kg. F1 cars are more in the 100kg range. This mass is added to the body mass, as if in the same spot as the CG. This is not really true in practice, but as the engine is not a separate entity in Racer, the engine mass is assumed to be a part of the body/chassis, and the body's inertia values should include the engine's contribution.
The engine rotational inertia is specified in engine.inertia.engine (in kg*m^2). Older Racer versions (<v0.8.2) also defined a final_drive inertia in its default/car.ini file, but that has become obsolete.
There's some confusion often about power (W) and torque (Nm).
Racer uses torque, and that's all that is needed, since power is just torque
x rpm. So you don't need to specify power, that is just a derived figure.
You can enter a torque curve using Curved (Windows only), and engine.curve_torque
gives its filename (usually just torque.crv). The torque curve is characteristic
for the engine (for example, it may keep torque high at high revs). To ensure
the engine doesn't rev beyond its limit, make a zero entry in the curve near
it's max rev limit. This way, a balance near the max rpm will be reached in
Racer automatically, without introducing a hard revlimiter. Also, note that
the torque curve is normalized; you specify values only from 0..1. After that,
with engine.max_torque you specify the peak torque height.
This makes it easy to try out more powerful engines by just changing that 1
value and leaving the characteristic curve the same.
Note that diesel engines generally have a different kind of curve than normal
gasoline engines.
Note that engine.constant_torque is obsolete. It was used in case no torque curve file was given (but that's really too lame to accept).
The engine has a couple of special RPMs associated with it. First, there is engine.idle_rpm. This indicates the idle revving rpm (when keeping things in neutral without applying any throttle).
This was/is used (from v0.5 on) to calculate an amount of required throttle to keep the engine at at least this rpm. So actually, when you let go of the throttle, there still will be a low feed of fuel to the engine, keeping it running just at idle_rpm. The problem with this is that even at high speed, letting go of the throttle pedal means that you still get a fair amount of throttle at the engine (so that once the rpm reaches low values, it won't dive deeper than idle_rpm).
v0.8.1 introduces a more realistic method though, which really sets throttle to 0 when you let go of the pedal. This method is used if you set engine.idle_method to 1 (the default is the old one, 0, for compatibility reasons). With idle_method 1, the throttle is only opened when the rpm dips below near-idle_rpm. The amount of throttle is determined using the stall_rpm number, linearly opening the throttle slowly from a bit above idle_rpm upto stall_rpm, where it would give 100% throttle. This balance act gets a certain amount of throttle at which the engine stays stable (check the Ctrl-4 screen in Racer for 'Actual Throttle'; letting go off the throttle should give 'Actual Throttle'=0 at high rpms, then at low rpms, near idle_rpm, it should go up to prevent the engine from stalling).
Racer versions below 0.8.6 let the rpm dip a bit below idle_rpm, but v0.8.6 fixed this by calculating an rpm slightly above idle_rpm at which to start applying throttle. The exact formula depends on the engine torque, idle_rpm and stall_rpm.
The amount of throttle used when letting go off the pedal can be specified using idle_throttle. For diesel engines this should be zero (no fuel is used) but regular fueled engines still feed a small amount of fuel to the engine).
For automatic clutching, engine.autoclutch_rpm was used upto and including v0.8.8. This gives the rpm at which the clutch starts being disengaged if that assist is turned on (which it often is; see assist.auto_clutch in racer.ini). As the engine hits idle_rpm the clutch will be set to fully disengaged. So make sure that autoclutch_rpm is greater than idle_rpm, otherwise this feature won't work (and the engine will probably stall).
v0.8.9 introduced a dynamic autoclutch_rpm; the engine.autoclutch_rpm setting is no longer required. Instead, if it is not specified, to get faster launches, the throttle pedal decides the rpm at which the clutch kicks in. When driving away slowly (throttle near 0), the autoclutch rpm is near idle rpm so you get smooth acceleration. When throttling hard at the start, this autoclutch rpm (now internal to the physics engine, not a constant) is moved towards the rpm at which the engine generates the maximum amount of torque (calculated from the torque.crv file). So throttling hard will result in the engine rpm going towards the maximum torque rpm, at which point the clutch is released (within a small rpm range to avoid on/off behavior). This allows faster drive-offs than in previous Racer versions, but much more like real racing. Still, you may specify engine.autoclutch_rpm if you want a static autoclutch rpm instead of the (better) dynamic one.
(v0.8.29) For autoclutch_rpm=0, you can specify launch_control. If set to 1, the engine will hunt for the optimal (torque-wise) rpm when driving off in 1st gear. This will allow you to drive off faster. It does make things less gentle for normal road cars, where you want to be able to drive off gracefully.
Since v0.8.4, each car has an rpm warning range. Once within the range, the player should probably shift up to a higher gear. This phenomenon has been abstracted into the engine.min_warn_rpm and engine.max_warn_rpm values. Once the RPM ends up between these values, you can use the view variable rpm_warning to drive a dial that shows the player that he/she needs to shift.
For more special RPM values, see also Starting and stalling.
Another special RPM is engine.max_rpm. If the engine's RPM gets higher than this value, the rev limiter kicks in. This limiter keeps throttle off during a small period of time. Upto and including v0.8.21 that time stretch was defined globally for all cars in racer.ini in the parameter dbg_car.rev_limiter_time (probably 50ms), but v0.8.22 made it per-car. That variable is now engine.rev_limiter_time and gives the time (in milliseconds) for which to cut throttle when the engine rpm rises above max_rpm. The max_rpm value isn't limited hard in software; the engine can an does rise above that rpm, but cutting throttle with the rev limiter should let it fall below the maximum again.
The default rev_limiter_time in v0.8.22 is 50 (ms).
The engine can stall and can be started again. To facilitate this, a number of parameters are used:
When the engine is spinning, it has the tendency to slow down,
mostly because of the compression effects in the cylinders. A coefficient is
used in combination with an offset (engine.braking_offset,
the offset available since v0.5.3 beta 7) which generates a negative torque;
its value is in engine.braking_coeff and it is used as braking_torque=braking_offset+raking_coeff*rps.
Note the rps, which is rotations per second. So an F1 car doing 14,500 rpm would
mean rps=14500/60 = 241, so the negative torque with a coefficient of 0.74 would
be 07.4*241=180 Nm of engine braking torque.
This effect helps a lot in braking for F1 cars, and most other cars. You can
feel the effect by driving and letting go of the throttle and feeling how fast
the engine tries to brake the car (the rolling resistance of the tires will
generally be a secondary effect).
Note that this coefficient and the engine inertia decides on how fast the engine will rev down when the clutch is fully disengaged (after all, F=m*a, as is T=I*w, so 'w', the angular acceleration of the engine, is dependent on torque and inertia). It is upto this point (v0.5) not yet known whether a street car has a lower or higher engine braking coefficient w.r.t. an F1 car.
Racer v0.8.1 also added an engine braking torque curve so you don't need to be limited to the linear function. Set engine.braking_torque_curve to the curve for the engine braking. The curve is specified in Nm (absolute torque, not normalized!). An example engine braking torque curve is shown below:
No friction is implemented yet. It will be something that grows with rpm in the future. It may also be left out, since the engine braking coefficent can include this.
Stored in engine.inertia.engine. (notice that engine.inertia.final_drive isn't used anymore) The engine takes power to spin up. For example, with the clutch fully disengaged you would otherwise spin up the engine far too fast. This slowed engine acceleration represents the engine inertia, and is specified by engine.inertia.engine (in units kg*m^2). A typical value may be 0.09, but I'm not too sure about this.
When the driver steps onto the throttle with the clutch disengaged, the engine starts revving quickly. The torque that it generates can have an effect on body roll, depending on the connection method of the driveshaft near the differential. Depending on this, the torque gets more or less reacted by the body. In engine.torque_reaction, you can specify the magnitude of this effect, ranging from 0 to 1 (values above 1 can be used, although they're unrealistically high, since you can't get more roll torque than engine torque). The generated engine torque is then passed to the chassis as torqueRoll=engineOutputTorque*torque_reaction.
In Grand Prix Legends from Papyrus, you can see the effect by holding the clutch disengaged and throttling away. The body rolls a bit. Ofcourse this has an effect on handling, since one side of the car gets loaded more when you drive off.
Engine mapping / throttle mapping
You can specify engine mapping per gear; this affects the throttle sensitivity. The linearity of the throttle is set in gearbox.gear<n>.engine_map. The default is 1.0, which is full linear (input=output). For high-power low gears (such as with Formula-style cars), start with lower numbers between 0 and 1 to decrease the throttle sensitivity. Using 0 gives you a x^3 curve, 1 gives an x^1 curve (linear), use 0.5 to be halfway inbetween the two extremees.
Values above 1 can be used, in which case the sensitivity is increased. Normally you don't want to do this; only use values between 0 and 1.
Engine mapping is used in Formula 1 for example to allow more control at lower gears.
You can control a special effect that is triggered when shifting. The rpm sound is jittered for a small moment to simulate the sound that cars with low-inertia flywheels make. The following parameters influence this effect:
Racer v0.8.9 added a small effect that will let the car shake due to the engine running. The engine phase is computed so that forces can be passed from the engine to the chassis. See below for an image of the 4 phases of the combustion engine:
An example extract of car.ini's engine tree is shown below:
engine { ... ; Engine rumble - amplitude (try 5000 in your own car.ini)
rumble_amplitude=0
; RPM at which rumble calculation are skipped (too faint to notice)
rumble_maxrpm=4000
; Number of cylinders
cylinders=4
; For V shaped engines, enter the angle (in degrees!) between the rows of cylinders
cylinder_angle=60 ...
The parameters are as follows:
Speed limiter (velocity based)
Racer v0.8.22 added a speed limiter. It's velocity based, unlike the rev limiter. Two parameters deal (per-car, so use car.ini) with the limiter:
An example extract from data/cars/default/car.ini:
; Speed limiter - velocity at which limiter kicks in (m/s)
speedlimiter
{
; 80 km/h
velocity=22.22
; Time (ms) to keep throttle cut when going above the limiter velocity
time=10
}
(last updated November 13, 2012 )