The following program illustrates some of the manipulation of objects that can be achieved:
Sub Main()
Dim tt As Object
Set tt = CreateObject("TRAVELTIMECOM.TravelTime")
Dim Truck As Object
Set Truck = tt.Truck
Dim hr As Object
Set hr = tt.HaulRoute
Dim axles As Object 'Create an Axles object
Set axles = CreateObject("TRAVELTIMECOM.Axles")
Dim frontAxle As Object
Set frontAxle = CreateObject("TRAVELTIMECOM.Axle")
Dim rearAxle As Object
Set rearAxle = CreateObject("TRAVELTIMECOM.Axle")
frontAxle.Driven = False
frontAxle.EmptyWeight = 10000
frontAxle.FullWeight = 20000
frontAxle.NumTyres = 4
axles.Add frontAxle
rearAxle.Driven = True
rearAxle.EmptyWeight = 10000
rearAxle.FullWeight = 20000
rearAxle.NumTyres = 4
axles.Add rearAxle
' Assign the Axles back to the truck.
Truck.AxleData = axles
For i = 0 To 10
Dim force As Double
Dim speed As Double
force = (11 - i) * 1000
speed = (i + 1) * 5
' Add the Rimpull and retard points directly to the Truck object.
tt.Truck.AddRimpullPoint speed, force
tt.Truck.AddRetardPoint speed, force
Next
Dim Dist, Grade, RollingRes, FinalVel, MaxVel, Weight As Double
Dist = 1000
Grade = 3
RollingRes = 3
FinalVel = 20
MaxVel = 20
Weight = 100 ' Weight is expressed as a percentage
' Add a Segment to the HaulRoute.
tt.HaulRoute.AddSegment Dist, Grade, RollingRes, FinalVel, MaxVel, Weight
Dim timeTaken As Double
timeTaken = tt.Calculate
MsgBox (timeTaken)
End Sub
|