### Lesson Summary

This lesson takes approximately 4 50-minute class periods. Students watch sections of a video throughout the lesson. The video increases student engagement and also introduces the challenge that students need to solve. The challenge is to solve congestion and traffic delays in an intersection through modifying traffic signal operation. Students are required to collect traffic data, optimize the timing of a traffic signal via the use of Excel, and then optimize the timing of a grid of traffic lights using a NetLogo simulation.

Outline of lesson

- Introduce activity (5 minutes)
- Students watch the video, TrafficJam - Part 1: Into
- Discuss the video as a class (10 minutes)
- Students watch the video, TrafficJam - Part 2: Straight to the Source
- Reflect on the video (10 minutes)
- Students watch the third part of the video, TrafficJam - Part 3: Brainstorm
- Students lay out a plan and share it (20 minutes)
- Students watch TrafficJam - Part 4: Take the Numbers and finalize their plan.
- In day 2, students collect data (50 minutes) [Note, if it is not possible to bring students to an intersection to collect data then the teacher can use the data collected by the kids in the video. The teacher can start implementing day 3 activities in day 2, then the whole lesson takes 3 days instead of 4 days.]
- In day 3, students watch TrafficJam - Part 5: Make a Model and then build spreadsheet models and share results with the teacher and classmates (50 minutes)
- In day 4, students watch the video, TrafficJam - Part 6: Run a Simulation and use NetLogo simulation to determine optimal signal timing for a network of traffic lights (40 minutes)
- Students watch the last section of the video, TrafficJam - Part 7: Mission Accomplished.

TrafficJam - Part 1: Into (1:51 Video)

TrafficJam - Part 2: Straight to the Source (1:54 Video)

TrafficJam - Part 3: Brainstorm (3:01 Video)

TrafficJam - Part 4: Take the Numbers (1:31 Video)

TrafficJam - Part 5: Make a Model (3:31 Video)

TrafficJam - Part 6: Run a Simulation (3:55 Video)

TrafficJam - Part 7: Mission Accomplished (1:53 Video)

### Time Allotment

Four 50-minute class periods

### Learning Objectives

**The student will be able to:**

- Collect and analyze data
- Model data via spreadsheet analysis
- Model data via simulation
- Explore traffic engineering

**AP Computer Science Principles Learning Objective**

- Big Idea II (abstraction) – Models and simulations use abstraction to generate new understanding and knowledge.
- 2.3.1 Use models and simulations to represent phenomena
- 2.3.2 Use models and simulations to formulate, refine, and test hypotheses.

### Prep for Teachers

**Essential/Guiding Question(s)**

The following guiding questions will lead students to the learning objectives indicated above.

- How is data analyzed computationally to test hypotheses and draw conclusions?
- How is simulation used to combine data and world knowledge in order to test the quality of models?

### Prerequisite Knowledge

**Prerequisite knowledge**

Excel modeling:

- For basic modeling: students need to know how to work with formulas in a spreadsheet.
- For more advanced modeling: familiarity with table lookup capabilities, such as via VLOOKUP, is useful.

Simulation via Netlogo:

- To gain experience using a simulation tool: no prerequisite knowledge is required.
- To gain experience in modeling and enhancing a simulation: previous programming experience in NetLogo is necessary.

### Learning Activities

**Student Activities**

- In groups, design a data collection strategy to solve the engineering challenge
- Collect data
- Model data in a spreadsheet
- Optimize signal timing via NetLogo simulation

**Day 1- Introduction**

- Introduce the activity, explain their task is to watch the video and complete a challenge that uses traffic engineering as a context.
- Ask students if they wait in a long line of cars jammed up at an intersection and have students share responses.
- Divide students into groups of 3 or 4. Ask the students to discuss how delays in intersection impact their life and how they can reduce delays in intersections. These discussions would help you to determine students’ prior knowledge about the topic.
- Have students watch the first part of the video where a group of students are having the same problem.
- Have a short discussion about what the first part of the video is about. Ask questions that lead students to start thinking about delay time due to both red lights and queue effects.
- Tell students that they need to explore traffic analysis in order to have possible solutions to the traffic delay problem.
- Have students watch the second part of the video where a traffic engineer presents information about traffic systems.
- Have students write on their journal about what they learn from the traffic engineer in the video.
- Have a brief discussion of the second part of the video and let students watch the next part to learn about the challenge and possible solutions. As a class decide where to collect data (e.g. an intersection close to the school)
- Have students discuss the value of computation in solving the problem, specifically regarding the freedom to explore options without trying out a bunch of different signal timings in the real world.
- Ask students to work in small groups to lay out the steps and process of the their own investigation.
- Before the end of the class, ask students to share their plans with the whole class.
- Have students watch part IV and allow them revise their plans. [Note: Again, even if students are not collecting data, asking them to plan for an investigation and encouraging them to lay out the steps and process of this investigation is critical.

**Day 2- Data Collection**

- Have students collect data based on their plans that they presented the previous day. If students are not collecting data, give students the data kids collected in the video, and start implementing the activities planned for day III.

**Day 3-Building Models**

- Have students watch part V where the computer scientist explains how to use the data and make a model.
- Have students use a spreadsheet to build models to optimize timing for their traffic signal. Work to minimize delay time, but also account for real world constraints such as pedestrian wait times.
- Have students share models and outcomes.

**Day 4- NetLogo**

- Have students watch part V of the video.
- Students put their timing measurements that they collected into the NetLogo simulation.
- Each group of students determines optimal signal timing for a network of 9 traffic lights using the NetLogo simulation.
- Students should explain their model before watching the last section of the video
- Ask students questions that will get them reflect on why they proceeded in the manner they did.
- Finally, have students watch the last part of the video.

### Culminating Activity

**Extensions to Excel exercise**

In its most basic form, students will use Excel to estimate traffic delays based on the fraction of time that the light is red in a particular direction. There are a variety of interesting extensions that students can pursue:

- Model time that pedestrians must wait
- Model effect of buses stopping and blocking traffic
- Model effect of left turns, and the presence or lack thereof of turn lanes
- Model effect of being stuck in traffic queues, and the differing delays that occur depending on which position in line a car finds itself. (This can be done via lookup tables, and possibly even iterative modeling to account for the fact that a longer queue subtracts from the fraction of time that cars can freely move through the intersection, which in turn, extends the length of the queue)

**Extensions to NetLogo exercise**

In its most basic form, students will use the NetLogo simulation to optimize timing of traffic lights to reduce delays. More advanced students who want to learn NetLogo can modify the simulation in a wide variety of ways, including:

- Adding yellow lights and appropriate traffic behavior
- Adding pedestrians and measuring their delays
- Adding buses and simulating the effects when they stop and block traffic
- Adaptive traffic lights that turn green if a car is waiting and there is no cross-traffic