Drivetrain
From UnityCar Wiki
| Line 110: | Line 110: | ||
| - | *'''Shift Speed''' this values represents how much time it takes to change gears (in seconds).Typical values are in the range of 0.2 – 0.8 | + | *'''Shift Speed''' this values represents how much time it takes to change gears (in seconds).Typical values are in the range of 0.2 – 0.8 seconds. Sports cars have lower values than offroad cars. |
Revision as of 10:54, 9 June 2011
This class simulates the engine and the driveline.
Contents |
Engine
The engine torque can be simulated in two different ways: using the function CalcEngineTorqueInt or writing an external torque file.
Calculate the torque curve using the function CalcEngineTorqueInt
Uncheck Load External Torque Data checkbox in order to use this function.
Using CalcEngineTorqueInt means that the engine torque is calculated by a polynomial expression which needs the following parameters:
- max Power, which represents the max power (in HP) produced by the engine. Typical value for a medium car is 150 HP, for a powerful car is 450 HP;
- max Power RPM, which represents the RPM (Revs Per Minute) at which the max Power is produced. Typical values are in the range 5000 – 9000 RPM. Should be lower or equal than max RPM;
- min RPM, which represents the minimum RPM (Revs Per Minute) for the engine to work. This is the idle RPM. Typical values are in the range 500 – 1500 RPM;
- max RPM, which represents the maximum RPM (Revs Per Minute) for the engine to work. Typical values are in the range 6000 – 10000 RPM. Should be higher or equal than max Power RPM;
As you can see, in this case you don't need to set the engine torque but only the engine power. Engine torque is calculated automatically from the engine power. More info on this function can be found in Motor Vehicle Dynamics, Giancarlo Genta 1997.
Calculate the torque curve using an external torque file
Check Load External Torque Data checkbox in order to use this function.
Using an external torque file means that you specify the torque (and consequently the power) of the engine in a discrete way, specifying a certain numbers of steps (interpolated internally by the script). Each step consists of a couple of value, the torque (in Nm) and the RPM (Revs Per Minute) at which the torque is expressed. This is an example of a torque file:
[engine] torque-curve = 500, 240 torque-curve = 700, 408 torque-curve = 1000, 530 torque-curve = 1500, 598 torque-curve = 2000, 650 torque-curve = 3000, 680 torque-curve = 4000, 693 torque-curve = 5000, 466 torque-curve = 6000, 112 torque-curve = 6500, 10
The first value is the RPM (Revs Per Minute), the second is the torque (in Nm). You can specify as many steps as you want. Engine power is calculated from its torque. In order to UnityCar to load the torque file properly, the file must be in the same directory of the unity3d package and must be called with the same name as the car in the inspector (with space character " " substituted with the underscore "_") and must have the extension ".ini". So for example: unity3d_package_directory\Monster_Truck.ini
unity3d_package_directory\Catamount_UM001.ini
unity3d_package_directory\Peugeot_205_T16.ini
Its important to define some steps for the lowest RPMs of the engine in order to obtain smooth starts.
Driveline
The Driveline represents everything needed to transfer the engine torque to the wheels. Parameters:
- Load External Torque Data when checked, UnityCar search for a file called with the same name as the car in the inspector (with space character " " substituted with the underscore "_") and with extension ".ini", in the same directory of the unity3d package. So for example unity3d_package_directory\Catamount_UM001.ini.
- Transmission specify the number and which wheels are used to transfer power to the ground. Values are FWD (two front wheels), RWD (two rear wheels) and AWD (both the two front wheels and the two rear wheels).
- Gear Ratios represents the number and the ratio of the gears. The size value represents the numbers of the gears (included neutral and reverse). The value of each element represents the ratio, that is the length of that gear. The smaller the value, the longer the gear. The first element is the reverse (so its value should be negative), the second element is the neutral (so its value should be zero), the third element is the first gear and soon. Anyway you can use as many reverse and as many forward gear, provided that in the middle there is a neutral gear (that is with value zero).
- Final Drive Ratio represents the ratio of all gears. So if you want to make all gearslonger, just decrease this value, if you want to make all gears shorter, increase this value.Typical values are 3.5 for a medium car and 6.0 for a powerful car.
- max Power represents the max power (in HP) produced by the engine. Typical value for a medium car is 150 HP, for a powerful car is 450 HP;
- max Power RPM represents the RPM (Revs Per Minute) at which the max Power is produced. Typical values are in the range 5000 – 9000 RPM. Should be lower than max RPM;
- min RPM represents the minimum RPM (Revs Per Minute) for the engine to work. This is the idle RPM. Typical values are in the range 500 – 1500 RPM;
- max RPM represents the maximum RPM (Revs Per Minute) for the engine to work. Typical values are in the range 6000 – 10000 RPM. Should be higher than max Power RPM;
- Rev limiter when engine RPM gets highier than max RPM, the rev limiter kicks in and cuts off the throttle for a small period of time.
- Engage RPM this value represents the RPM (Revs Per Minute) at which the clutch starts engaging (that is the clutch starts connecting the engine to the wheel). Should be higher than the minRPM.
- Disengage RPM this value represents the RPM (Revs Per Minute) at which the clutch starts disengaging (that is the clutch starts disconnecting the engine from the wheel) when the RPM is too low for the current gear. Should be higher than the minRPM and lower than EngageRPM.
- Engine Inertia Min and Max these values represent the engine inertia at low RPM (Engine Inertia Max) and engine inertia at high RPM (Engine Inertia Min). Engine inertia slow down engine revving up. The higher the engine inertia, the slower the engine revs up.
- Drivetrain Inertia this value represents the inertia of the drivetrain. It works in a similarway of the engine inertia, and it adds a further inertia to the system.
- Engine Friction Factor this value causes the engine to slow down and cause enginebraking. The higher this value, the quicker the engine is slowed down. Typical value is 0.25. Important: Engine Friction Factor causes power loss. With a value of 0.25 the power loss is about 13%.
- Engine orientation typically either Vector3.forward or Vector3.right. This determines howthe car body moves as the engine revs up in neutral.
- Differential Lock Coefficient Coefficient determining how much torque is Transferred between the wheels when they move at different speeds, to simulate differential locking.
- Automatic if checked, gears are shifted automatically.
- Shift Down RPM this value represents the RPM (Revs Per Minute) at which the automatic transmissionshifts to the previous gear. Works only if Automatic is checked. Should be higher than minRPM. Please note that Shift Up RPM coincides with max Power RPM.
- Shift Speed this values represents how much time it takes to change gears (in seconds).Typical values are in the range of 0.2 – 0.8 seconds. Sports cars have lower values than offroad cars.
- Clutch Max Torque represent the maximum torque that the clutch can generate. Typical values are 1.5 1.6 times engine max torque. If left to 0 its automatically calculated from engine torque.
- Auto Clutch if checked, clutch is engaged and disengaged automatically.