aim4.vehicle
Class AccelSchedule

java.lang.Object
  extended by aim4.vehicle.AccelSchedule

public class AccelSchedule
extends Object

The acceleration schedule


Nested Class Summary
static class AccelSchedule.TimeAccel
          The time-acceleration pair.
 
Constructor Summary
AccelSchedule()
          Create an acceleration schedule.
 
Method Summary
 void add(double time, double accel)
          Add a time-acceleration pair to the acceleration schedule.
 double[] calcFinalDistanceAndVelocity(double time1, double v1, double timeEnd)
          Calculate the distance and velocity traveled by the vehicle starting at a given time and velocity and ending at a given time.
 double[] calcFinalTimeAndVelocity(double time1, double v1, double dTotal)
          Calculate the distance and velocity traveled by the vehicle starting at a given time and velocity and ending at a given time.
 double calcFinalVelocity(double v1)
          Calculate the velocity after executing the acceleration schedule, starting from the initial velocity.
 double calcTotalDistance(double time1, double v1, double timeEnd)
          Calculate the distance traveled by the vehicle starting at a given time and velocity and ending at a given time.
 boolean checkVelocityUpperLimit(double v1, double vTop)
          Whether the velocity does not exceed the velocity's upper limit at any time point during the execution of the acceleration schedule
 List<AccelSchedule.TimeAccel> getList()
          Get the list of time-acceleration pairs.
 int size()
          Get the number of time-acceleration pairs in the acceleration schedule.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AccelSchedule

public AccelSchedule()
Create an acceleration schedule.

Method Detail

add

public void add(double time,
                double accel)
Add a time-acceleration pair to the acceleration schedule.

Parameters:
time - the time
accel - the acceleration

size

public int size()
Get the number of time-acceleration pairs in the acceleration schedule.

Returns:
the number of time-acceleration pairs in the acceleration schedule.

getList

public List<AccelSchedule.TimeAccel> getList()
Get the list of time-acceleration pairs.


calcFinalVelocity

public double calcFinalVelocity(double v1)
Calculate the velocity after executing the acceleration schedule, starting from the initial velocity. The last acceleration will be ignored.

Parameters:
v1 - the initial velocity
Returns:
the velocity after executing the acceleration schedule

checkVelocityUpperLimit

public boolean checkVelocityUpperLimit(double v1,
                                       double vTop)
Whether the velocity does not exceed the velocity's upper limit at any time point during the execution of the acceleration schedule

Parameters:
v1 - the initial velocity
vTop - the velocity's upper limit
Returns:
Whether the velocity does not exceed the velocity's upper limit at all time during the execution of this acceleration schedule.

calcTotalDistance

public double calcTotalDistance(double time1,
                                double v1,
                                double timeEnd)
Calculate the distance traveled by the vehicle starting at a given time and velocity and ending at a given time.

Parameters:
time1 - the initial time
v1 - the initial velocity
timeEnd - the final time
Returns:
the distance traveled

calcFinalDistanceAndVelocity

public double[] calcFinalDistanceAndVelocity(double time1,
                                             double v1,
                                             double timeEnd)
Calculate the distance and velocity traveled by the vehicle starting at a given time and velocity and ending at a given time.

Parameters:
time1 - the initial time
v1 - the initial velocity
timeEnd - the final time
Returns:
the velocity after executing the acceleration schedule after a period of time t

calcFinalTimeAndVelocity

public double[] calcFinalTimeAndVelocity(double time1,
                                         double v1,
                                         double dTotal)
Calculate the distance and velocity traveled by the vehicle starting at a given time and velocity and ending at a given time.

Parameters:
time1 - the initial time
v1 - the initial velocity
dTotal - the distance traveled
Returns:
the velocity after executing the acceleration schedule after a period of time t

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.