Final Project Solution



  • Overview

The goal of the project is to build the rst stage of a CSIM model of cars traveling along a section of roadway in front of a school, dropping o students just before classes begin in the morning. First, you need to collect some empirical data about passenger loading and unload times from “the real world”. Later on, you will add more features to your simulator and run more experiments. You are only respons-ible for completing only the following.

  1. Data collection. You can go to a nearby school (maybe North High or University Heights Middle School, which are near campus) to record some data about how long cars stop to drop o passengers, and how much space is available for multiple cars to unload in parallel.

  1. Demonstrate car movement without crashes. Begin your experiments by testing a sim-pli ed version of the program. In this case, assume that there is only room for a single car in the unloading zone. Measure the throughput (number of cars that have dropped-o their passengers per hour)

  1. Increase the number of drop-off spots to 2 and then 4. How does the throughput change as you vary the number of drop-o locations?

  • Modeling Cars on a Roadway

2.1 Representation of the Roadway

For this assignment, the roadway is just a single lane of tra c that passes in front of a school. (This means you cannot pass the car in front of you, even if its speed is below your own target).

The roadway will be modeled by a linear sequence of discrete “cells”, each representing a short seg-ment of road (11 feet long, say) that is half the length of a car. Entrance to the roadway is controlled by a tra c light (or a crossing guard holding a sign that reads “STOP”/”GO” on opposite sides) that permits “one care per green” to enter the school zone. Large numbers of cars are queue at the entrance for their chance to enter the school zone and drop o some passengers.

Assume that:

the distance from the tra c light to the beginning of the drop-o zone is 10 car lengths;

the length of the drop-o zone is 2*N, where N is the number of cars that can unload simultaneously the distance from the end of the drop-o zone to the \end of the world” (where cars disappear) is

10 car lengths.

You will need to change these values after collecting data from an actual school.


2.2 Low-level functions describing how cars move along the Roadway

A stopped car occupies two consecutive cells, whereas we say that a moving car occupies three cells at a time to account for the two partially-occupied cells from which the car’s tail of the car is leaving and its nose is entering. To make sure that only one car at a time can occupy a particular cell, we will represent them as individual CSIM facilities.

For example, suppose cells are numbered 0, 1, 2, etc while cars are labelled A, B, C, etc. Initially, let’s assume that both cars are stopped so that cells 2 and 3 reserved by car A, and cells 0 and 1 reserved by car B. In order for car A to start moving, it must immediately reserve cell 4, then after moving ahead by one cell, car A reserves cell 5 and immediately releases cell 2, and so on.

In order for prevent crashes, a moving car monitors the status of the roadway up to 4 car-lengths (or 8 cells) ahead of its current position, depending on its speed. To allow this, each car sets the following variables associated with each of its currently-reserved cells:


0 (= stopped)

1 (= 3 seconds/car length or 5 mph)

2 (= 11/6 seconds/car length or 8 mph)

3 (= 1 second/ car length or 15 mph)

4 (= 2/3 second/car length or 20 mph)

5 (= 1/2 second/car length or 30 mph)

cell exit time

{ unde ned if cell is not reserved or speed = 0

Cars always travel at constant speed for one car length, and then can increase their speed by one step when accelerating, or decrease their speed by up to 2 steps when stopping.

Each new car is created at the school zone entrance, and its current speed will be zero. However, as soon as the car has permission to move forward, it will try to adjust its current speed to match its target speed as quickly as possible, with the following exceptions. First, the car may be forced to slow down or stop to avoid hitting the car in front of it. Second, the car must stop in the furthest available drop-o spot in front of the school to let out its passengers. For now, you may assume that it takes 10 seconds to unload, although you will be changing this after you collect some data from an actual school. Once unloading is nished, it tries to accelerate to its target speed and then travel to the end of the school zone, which it disappears.

For now, assume that speed=3 is the target speed for all cars in the school zone. You will need to adjust these speeds after you have collected some data from an actual school.

2.3 Cars Accelerating

To accelerate from speed=0 to speed=5, a car needs 6.5 seconds and advances by 9 cells, as shown below for car A in the example below, where initially car A is occupying cells 2 and 3, with car B behind it occupying cells 0 and 1:

Notice that the nose of car A has advanced from cell 3 to cell 12 and it is now moving at its maximum speed.





Clear and Release


cell 4

cell 2: speed=1, exit time=1.5


cell 5

cell 3: speed=1, exit time=3

cell 2


cell 6

cell 4: speed=2, exit time=3+11/12

cell 3


cell 7

cell 5: speed=2, exit time=4+5/6

cell 4


cell 8

cell 6: speed=3, exit time=5+1/3

cell 5


cell 9

cell 7: speed=3, exit time=5+5/6

cell 6


cell 10

cell 8: speed=4, exit time=6+1/6

cell 7


cell 11

cell 9: speed=4, exit time=6+1/2

cell 8


cell 12

cell 10: speed=5, exit time=6+3/4

cell 9

Figure 1 shows a plot of occupied cells by cars A and B as a function of time, assuming the initial conditions consist of car A stopped in cells 2 and 3, and car B stopped in cells 0 and 1, wishing to start accelerating at time 0 seconds. Notice that car B does not begin moving until car A has moved far enough to leave two unoccupied cells between the two cars because a moving car cannot change its speed until it has advanced by one car length (or two cells). Thus, the actions of car B trail the corresponding actions of car A by 3 seconds, which results in a gap of 5.5 car lengths (or 11 cells) when both cars have attained speed=5.


2.4 Cars Slowing Down and Stopping

While a car is slowing down, its speed can drop by up to two steps when it crosses the next car-length boundary. Therefore, a car moving at speed=5 needs only 4 seconds to stop and advances by 4 cells, since it can jump directly to speed =3 for one car length and then to speed=1 for one car length before has stopped completely.

The e ect of di erent initial speeds is shown below in Figure 2. In most cases, stops from lower speeds take less time and distance. However, the gure also includes the e ect of a one-second reaction time { which can sometimes delay the onset of braking for more than one second because speed changes can only occur once per car length (or once every second cell). The assumption of a one second reaction time is a pretty standard for modeling drivers, for example see:

2.5 Look-Ahead to Avoid Crashing

If the car detects an obstruction (i.e., a slower moving, or stopped, car) within its monitoring range, the car continues at its present speed for 1 second to allow for the driver’s reaction time, then reduces its speed as it crosses the next car-length boundary. Note that the car only experiences a single reaction-time delay per slow-down event, since the driver should be paying close(r) attention to the situation after seeing a potential tra c hazard ahead. The new speed is set to the maximum of: (a) two steps below its current speed, or (b) the speed of the car ahead.

Including the e ect of a one-second reaction time, Figure 2 shows that a car moving at speed 5 re-quires 5 seconds and 3.5 car lengths to stop.Thus, we should be able to avoid crashes with a monitoring


range of 4 car lengths at speed 5. On the other hand, if the car is moving at speed 4, then we see that the stop only requires about 3.2 seconds and 2.5 car lengths, so a monitoring range of 3 car lengths is su cient. Similarly, a car moving at speed 2 or 3 can use a monitoring range of 2 car lengths because stopping from speed 3 requires 4 seconds and 1.5 car lengths, and stopping from speed 2 requires 2.75 seconds and 1 car length.

Cars moving at speed 1 are treated as a special case where we will use a monitoring range of 1 car length. This is su cient to avoid crashes, since a car moving at speed 1 can stop in exactly 3 seconds and 1 car length. It also allows a line of stopped cars to begin moving as soon as the inter-car gap has reached one car length (see Figure 1).

2.6 E ect of introducing Autonomous Vehicles

The previous description is intended to model the current situation, where each car has a human driver acting independently. We want to see how much we can improve the passenger drop-o experience by introducing self-driving cars that constantly share information about their actions among themselves and move as a group. Thus, if the unloading zone at the school has room for N cars, then the tra c light will tell a group of N cars to start moving together, they will all travel at exactly the same speed, following bumper-to-bumper as if they are hooked together like a train. Each will stop in its assigned spot, all passengers will exit all cars at the same time, and then all cars in the group will leave together.

  • Submit and Demo

3.1 Submit – Tuesday, 03/12

You can work in teams no more than three. You will be graded on the correctness of you solutions, the insightful discussion in your report, and the presentation. Please submit your report and zip le through iLearn by 3/12. Name them by NetID1 NetID2 and NetID1 NetID2 NetID3.pdf.

  1. Report in pdf that includes(but not limited to):

Collaboration details (clearly specify the contributions of each member of the team) Raw data collection and your preprocessing

Overview of the modeling system, including(but not limit to)


Details of how CSIM was used

Explain how you use CSIM to show results

Insructions on how to deploy the system Screenshots showing the system results

  1. Zip le with your code

3.2 Demo – Friday, 03/15

No extensions for nal project! Each team will demonstrate project in the lab section for 10 minutes at a speci ed time. Here is the timetable for nal project demo.


error: Content is protected !!