CS 452/652 Fall 2022 - Train Control (Part 1)

(Version: 1)

Demo Date: Thu, Nov 10, 2022 (submit code & documentation by 9:00am)

Introduction

The traffic control milestones each require a capability that is likely to be useful for almost any project. The first milestone is concerned with
  1. knowing exactly where one train is when it is motion, and
  2. stopping one train at any point on the track.

Description

For the first milestone we expect that you have the train moving at a constant velocity and can stop it at a chosen location. Given an appropriate command from the terminal your program should switch turnouts that put the train on course to the location, then send a ‘speed zero’ command at the right time to stop the train at the requested location. To accomplish this, your program must be able to
  1. find a route to the location and switch the turnouts, and
  2. send the stop command at the right time.
The usual way of getting the train to a constant velocity is to set turnouts to make part of the track into a loop, then to run the train around the loop until it gets to a constant velocity. Calculate a route from any switch in the loop to the destination, switch the turnouts appropriately, wait, then give the stop command at the correct moment.

Routing and Switching

Route calculation and switching should be as simple as possible. The route need not be the shortest and it should not require the train to change direction. (In later milestones you will be required required to use routes that change direction and that are the shortest, so do your route finding in a way that will easily accommodate those improvements.)

Switching may be done all at once, usually starting at the destination and working backward so that when the train is switched out of the loop all other turnouts are set correctly. (Setting turnouts as the train requires them will be needed in later milestones to implement switching in a way that makes it easy to reorder switching and to interleave other activities.) Routing and switching should be smart enough to behave correctly when the destination is in the loop.

Use the track information available via the course web page to build an internal model of the track(s). A stopping location will be given as a track node number (from this data set) and a distance offset. The offset can be negative.

Stopping

Stopping requires two capabilities:
  1. knowing your stopping distance for the speed at which you are travelling, and
  2. knowing when you are exactly that distance from the destination, which is possible if you know the velocity at which you are travelling.
We would like to be able to assess each of these independently of the other. To do so we request that every time you receive a new sensor trigger you predict the time at which you will trigger the following sensor and compare it to the time at which the following sensor is actually triggered. The difference should be displayed on the terminal in two forms: as a time difference, tactual − tpredicted, and as a distance, v(tactual − tpredicted).

Calibration

Your train model needs to have a component that estimates the actual velocity of a train for a particular speed setting as well as the stopping distance. You can perform offline calibration experiments to obtain such estimates and should probably do so to seed your model. In addition, you can update your model during the runtime of the application.

Kernel

Make sure that your kernel and/or idle task dynamically updates and prints an ongoing assessment of the recent idle time fraction. Choose a reasonable setting for "recent", but make it easily configurable at compile time.

What To Expect During the Demo

Hand In

Hand in the following, nicely formatted and printed.
  1. A pointer to your code repository, readable by the TAs and instructor, containing the source code of your assignment, instructions how to make the executable, and documentation (see below). The code and documentation must remain unmodified after submission until the assignments have been marked. Email the commit SHA to the instructor before the deadline.
  2. A description of how to access, make, and operate your program in a README file, including the full pathname of your executable file, which we might download for testing.
  3. The names of your group members in the same README file.
  4. A description of the structure of your kernel and application so far, highlighting the changes for this assignment. We will judge your application primarily on the basis of this description. Describe which algorithms and data structures you used and why you chose them.
  5. A description of the experiments used to collect calibration information and its processing.
  6. Store the raw calibration data in a separate subdirectory in the code repository and identify the subdirectory in your documentation.
  7. Note that we intend to perform code reviews with students. A TA and/or instructor might contact you to set up a (virtual) meeting.