# 18-649 Project 3

### Drive Acceleration Profile

*Please submit all project-related questions to -- thanks!

In order to control the elevator Drive at Fast speed, you need to calculate the commit point for the elevator based on the drive's acceleration profile.  The details are described below.
*** Note that for project 3 you are not required to command the drive to a speed faster than Slow.  At Slow speed, the AtFloor[f, b] is essentially your commit point.

Distance between each floor: 5 meters (so floor 1 is at position 0 meters, floor 2 is at position 5 meters, floor 3 is at position 10 meters, etc)

Relevant velocity and acceleration values:

• Stop speed: 0.0 meters/sec (use constant value simulator.elevatormodules.DriveObject.StopSpeed)
• Leveling speed: 0.05 meters/sec (use constant value simulator.elevatormodules.DriveObject.LevelingSpeed)
• Slow speed: 0.25 meters/sec (use constant value simulator.elevatormodules.DriveObject.SlowSpeed)
• Fast speed: 1.0 meters/sec (use constant value simulator.elevatormodules.DriveObject.FastSpeed)
• Constant acceleration: 1.0 meters/sec^2 (use constant value simulator.elevatormodules.DriveObject.Acceleration)
• Constant deceleration: 1.0 meters/sec^2 (use constant value simulator.elevatormodules.DriveObject.Deceleration)
The elevator will accelerate or decelerate linearly at the rate of 1 m/s^2 until it reaches the desired speed (the command your DriveControl sends).  So you can track the motion of the elevator with simple physics:

x(t) = x0 + v0 * t + 1/2 * a * t^2
v(t) = v0 + a * t

x0 = initial position
v0 = initial velocity
a = constant acceleration/deceleration = +/- 1 m/s^2

So you can calculate the commit point based on the current DriveSpeed and the current elevator position CarLevelPosition (Where do you have to start slowing down to be able to stop in time at the next floor?).  Keep in mind that you only get CarLevelPosition updates at 10 cm intervals in the hoistway, so you want your commit point to be a range slightly ahead of the actual physical commit point to allow for latency for the DriveControl to receive and process the messages and send the Drive command.

So for example, to calculate the commit point for the next floor, you can assume you're going to be traveling at the Fast velocity of 1.0 m/s.  Now you need to know how far away from the floor you have to be to be able to issue a slow command with enough time to issue a stop command to stop at the floor.  The time it takes to decelerate from 1.0 m/s to 0 m/s at the constant deceleration is 1 second.  This is enough information to figure out where the commit point should be, plus a bit of slack to account for network latency, based on the period you have selected for CarLevelPosition.

In general, you should not use the AtFloor message as a substitute for the CarLevelPosition message.  You are not guaranteed to receive an AtFloor[f,b] true for every floor the car passes if the car is moving faster than the SLOW speed.  AtFloor should be used for leveling (at SLOW speed) and determining the current floor while the car is stopped.

In later projects, we will change the Fast speed to a larger value.  We will not specify what this larger value is ahead of time, but you should think about what changes in fast speed would be "interesting" from a the standpoint of the design.