Procedure: MainCalr
Returns: distance, engine speed, ground speed, engine torque, fuel consumption, gear selected
Yes
Altitude = EndAltitude
Section 2
At beginning of the simulation start in 1 st gear OldGear=l
LastChange = -5 dt = 0.5
Assume starting speed of 1000 r/min in 1st gear KMPH = 1000 / KMPHtoRPM / Ratio| 1 ]
Yes
Force vehicle to a certain speed KMPH = SpLimit|ll - 1000
SpeedLimit = SpLimit|2|
Gear = 0
Move up one gear and calculate the RPM Gear = Gear + 1
RPM= KMPH * KMPHtoRPM * Ratio[Gear]
Yes
Oldgear = Gear EngTorque = 0 LastChange = Totaltime - 5
Figure 1.1.1 Flowchart illustrating the algorithm for the modified Main procedure
Section 2
GVM - Vehicleiviass + rayioau
No . / S Is \
vehicle to be off loaded
^ ^ Y e s
GYM— Venicieiviass
Impiementuown - False N o _ / ^ ' Is
(Flag / 4) an odd number
^ ^ ^ Y e s
I m piemen thown = True
Calculate the motion resistance force Call Function: AirResistance Call Function: GradeResistance Call Function: RollingResistance
Resistance = AirResistance + GradeResistance + RollingResistance
Initialise the thrust value Thrust = 1
Section 3
Figure 1.1.2 Flowchart illustrating the algorithm for the modified Main procedure
Section 3
The clutch is engaged
Yes
Force vehicle to drive in a single specified gear
Gear = GearMode
* The clutch is disengaged
Adjust dt to ensure the time step occurs at the gear change time
dt - TimeToChange - (TotalTime - LastChange)
Torque converter TqCRatio = 1 TqCE = 1
^ ^ Is ^ ~ ~ - ^ ^ Yes
^ ^ ^ TqCStall o 1 ^ - ^
NoT
GearMode is either greenband or maxim torque Determine if a gear selection is necessary
Torque converter fitted Call Function: GetTnrqiieCnnversion
Vehicle has stalled G e a r = 1
Gear change has occurred L a s t C h a n g e = TotalTime
R P M = S p [ l ] PEngTorque = 0
Thrust = 0 OldGear = G e a r Clutch disengaged
No gear change has occurred.
Set time step back to 0.5 s dt = 0.5
dt = TimeToChange
RPM = S p | l | EngTorque - 0
Thrust = 0
No ^ - ^ Is ^ \
Clutch disengaged
~~~"~"-\ ? ^ ^ *
JYes
Is
TimeToChange - (TotalTime - L a s t C h a n g e ) = 0
?
No
Section 4
^ Y e s
Gear change time now elapsed so now engage clutch Clutch engaged
dt = 0.5 Thrust = 1
Figure 1.1.3 Flowchart illustrating the algorithm for the modified Main procedure
Section 4
Yes
Torque converter TqCRatio = 1 TqCE = 1
Torque converter fitted Call Function: GetTorqueConversion
Yes
Calculate the current engine speed
RPM = KMPH * KMPHtoRPM * Ratio|Gear] * TqCRatio / TqCE/ (1 - Slip)
Calculate maximum torque available from engine from current engine speed Call Function: GetMaxEngTorque
Calculate the torque lost through transmission Call Function: GetTorqiieLnsses
Calculate the thrust available at the wheels
Thrust = MaxEngTorque * TqCRatio * TqCE * (1 - TorqueLosses) * RatiojGear] * LeverArm
Section 5
Figure 1.1.4 Flowchart illustrating the algorithm for the modified Main procedure
DesiredAcceleration »(SpeedLimit - KMPH) / 3.6
Limit acceleration DesiredAccele ration = 1.5
Road surface is soft
Use Wismer & Luth traction equations, SurfaceRR is the cone index
Limit deceleration DesiredAccele ration =
Road surface is hard
Calculate the thrust needed to reach speed limit LastThrust = DesiredAcceleration * G V M + Resistance
WheelTorque = MaxTorque * TqCRatio * TqCE * (1 - Losses) « Ratio[Gear] * AxleRatio
CalllJnit: CalcTraction
EngTorque = EngTorque / TqCRatio / TqCE/ (1 - Losses) / Ratio|Gear| /AxleRatio
Acceleration = Acceleration - AirResistance / GVM
More thrust is available than what is required Acceleration = DesiredAccele ration Thrust ™ Acceleration * GVM + Resistance
Thrust required is higher than available Acceleration = (Thrust - Resistance) / GVM
Last Acceleration = Acceleration LastThrust = Thrust
EngTorque - Thrust / TqCRatio / TqCE/ (1 - Losses) / Ratio[Gear] / LeverArm
Calculate how much negative torque is available from the brakes Call Function; GetBrakeTnrqiie
EngTorque = EngTorque - BrakeTorque
Calculate the maximum torque available from engine at current engine sp Call Function: GetMaxEngTnrque
Engine power is limiting kWPeak = true
Engine power is not limiting kWPeak « False
Determine new vehicle speed OldKMPH = KMPH
KMPH - KMPH + (Acceleration * dt) / 1 0 0 0 * 3600
Section 6
Figure 1.1.5 Flowchart illustrating the algorithm for the modified Main procedure
Section 6
s ^ Is ^ ^ \ Yes X ^ KMPH<0 ^
No J
Calculate fuel consumption (Fuel) Tall Function: GetFuel
Can't have a negative speed KMPH = 0
Determine distance travelled in this time step dKM= (KMPH * dt / 3600) + (0.5 * Acceleration * dt2) /1000
Adjust dt so that current calculation ends at end of road segment. Recalculate previous vehicle speed:
KMPH = KMPH - (Acceleration * dt) /1000 * 3600
No acceleration dt - 3600 * RemSegDist / KMPH
Yes
If vehicle accelerating, then need to solve the quadratic equation of motion to find dt (s = u*t + l/2*a*tA2) rit = (-1* KMPH + V fKMPH2 + 2 * RemSegDist « Acceleration * (36002 / IQOOVtt
(Acceleration * (3600/ 1000))
dt = 0.5
dt = TimeToChange - (TotalTime - LastChange) dKM = (KMPH * dt / 3600)
Already at the end of the segment dKM = RemSegDist
d t = 0 . 5
KMPH - KMPH + (Acceleration * dt) / 1000 * 3600
Calculate new vehicle speed and calculate new incremental distance KMPH = KMPH + (Acceleration * dt) /1000 * 3600 dKM - (KMPH * dt / 3600) + (0.5 * Acceleration * dt2) / 1000
Calculate new altitude
Altitude = Altitude + dKM * 1000 * sin(Grade)
Calculate total distance now travelled KM = KM + dKM
End
Figure 1.1.6 Flowchart illustrating the algorithm for the modified Main procedure
Procedure: AccelerationCalc Returns: the desired acceleration
DesiredAcceleration = (SpeedLimit - KMPH) / 3600 * 1000
Yes
Limit acceleration DesiredAcceleration = 1.5
Limit deceleration DesiredAcceleration = -1.5
Calculate the maximum torque available from engine at current engine Call Function: GetMaxFngTnrque
Calculate the torque lost through transmission Call Function: GetTnrqiiel.nsses
Calculate the thrust available at the wheels
Thrust = MaxEngTorque » TqCRatio * TqCE * (1 - TorqueLosses) * Ratio[Gear] * LeverArm
Road surface is soft
More thrust is available than what is required Acceleration m DesiredAcceleration
Acceleration = Acceleration - AirResistance / GVM
Knd
Road surface is hard
Calculate the thrust needed to reach speed limit LastThrust = DesiredAcceleration * GVM + Resistance
Thrust required is higher than available Acceleration = (Thrust - Resistance) / GVM
Figure 1.2 Flowchart illustrating the algorithm for the AccelerationCalc procedure
Figure 1.3.1 Flowchart illustrating the algorithm for the modified SelectGear function
Calculate maximum torque available in current gear (OldTorque) Call Function: GetMaxEngTorque
Calculate new engine speed in next highest gear
NewRPM = KMPH * KMPHtoRPM * R a t i o | G e a r + l l * TqCRatio / TqCE / (1 - Slip)
Calculate maximum torque available in next highest gear (NewEngTorque) Call Function: GetMaxEngTorque
No gear change
Calculate new engine speed in next highest gear after a change NewRPM - (KMPH - SpeedDrop) * KMPHtoRPM *
R a t i o | G e a r + l | * TqCRatio / T q C E / (1 - Slip)
Calculate maximum torque available in next highest gear after a gear change (NewEngTorque)
Call Function: GerMaxEngTnrque
Calculate engine speed in current gear after a gear change OldRPM - (KMPH - SpeedDrop) * KMPHtoRPM *
RatioIGear] * TqCRatio / T q C E / (1 - Slip)
Calculate maximum torque available in current gear after a gear change (OldTorque) Call Function: GetMaxEngTorque
Shift up one gear G e a r = G e a r + 1
Shift down one gear G e a r = G e a r - 1
Calculate new engine speed in next lowest gear NewRPM - KMPH * KMPHtoRPM * R a t i o | G e a r - l ] * TqCRatio / T q C E / (1 - Slip)
Calculate maximum torque available in next highest gear (NewEngTorque) Call Function: GetMaxEn,gTorq»e
Calculate new engine speed m next lowest gear after a change NewRPM = (KMPH - SpeedDrop) * KMPHtoRPM *
R a t i o [ G e a r - l ] * TqCRatio / T q C E / (1 - Slip)
Calculate maximum torque available in next lowest gear (NewEngTorque) Call Function: GetMaxEngTorque
Calculate engine speed in current gear after a gear change OldRPM - (KMPH - SpeedDrop) * KMPHtoRPM *
R a t i o | G e a r | * TqCRatio / T q C E / (1 - Slip)
Figure 1.3.2 Flowchart illustrating the algorithm for the modified SelectGear function