Java代写:SENG201-Traffic-Engineering-Application-Part2

Some simplifying assumptions

We will make a few assumptions in order to make the problem simpler.

  • All intersections involve one north-south rood meeting an east-west road.
  • Signal faces are oriented to the north, 4 south, east or west and are located at the north-west, north-east, south-west or south-east corners of intersections. No overhead signal faces need be considered.
  • Semi-actuated intersections need not be considered. If necessary, we can always add a SemiActuatedPhasePlan class later to cope with these.
  • Signal faces contain 3 lights: one of each colour and all of the same shape.
  • For “round” signal faces, green lights are always followed by yellow lights which are followed in turn by red lights in each cycle. We need not consider other sequences — such as those in countries where another yellow interval occurs between red and green.
  • Change intervals and all-red intervals are treated as separate phases.
  • Only passive detectors are used. These can report, when asked, whether they have seen any vehicles pass over them.
  • No phases are optional.

Getting started

You should be able to begin the following activities already and you will find them helpful preparation for the next part which will be available soom.

  • Make sure you read the description of the way intersections work and that you understand it fully.
  • Observe some real intersections in action. You can start this right away. Identify the signal faces, traffic streams and phases.
  • For the active phase plan, draw up a table listing the phases and the state of each stream in the phase.
  • Note which signal faces are associated with each traffic stream. Remember that signal faces might shared between streams.
  • Using Smarties TM, Pebbles TM or other tools, construct a diagram such as that
    shown in Figure 5 to show the lights displayed in the signal faces in each phase.
  • Time some phases. Do you think your intersection is unactuated or fully-actuated?
  • Do you think it has more than one phase plan? For example, is there any difference between rush hour and off peak plans?

Our toolkit

Figure 6 shows a very simple intersection monitor — an instance of IntersectionMonitor. Near the top is a panel showing the intersection’s signal faces, together with their locations and orientations.

The monitor displays a “row” for each phase — the active phase is highlighted. As well as the phase description, there is some information about each stream and a colour chip showing the state of each stream (remember that signal faces can be shared between streams) in the corresponding phase.

A transcript provides a log of the activity at the intersection. Each entry has a time stamp (traffic.misc.TimeStamp) and the transcript can be saved in a file for subsequent analysis.

Given an Intersection, an IntersectionMonitor can display information about its state. The traffic package contains classes (such as TrafficStream which can be used to assemble an intersection.

Intersections may also be constructed by reading intersection descriptions from a file. Figure 7 shows the description file corresponding to the intersection of Figure 6.

  • The file contains a number of tags, such as SignalFaces — valid tags are found in traffic.Tags.
  • Lines beginning with // are treated as comments and empty lines are ignored.
  • Within a tag body each line contains one or more fields. The fields are separated by tabs (which are shown underlined in Figure 7). Why tabs? The idea is to make it easy to use a Scanner to parse the content of the line. Using commas as separators seems appealing but ultimately the hassle of escaping commas inside field content is frustrating.

Next steps

Now that you have completed the activities, you are ready to start working with intersection data.

  • Obtain a copy of the intersection monitor demonstrated in class — from the Learn assessment page where you found this document.
  • Run it and familiarise yourself with the way it displays information about elements such as phases, streams and signal faces.
  • The File menu contains an item to run a working demo, plus one to read files, such as the one in Firgure 7, in the format described.
  • The Intersection menu can be used to start and stop the intersection’s phase plan cycle. The signal faces will change to reflect the current phase.
  • Information about the changing states of the intersection appears in the transcript pane. The Transcript menu incldes an item which allows the transcript content to be saved for later analysis.
  • Write an intersection file for each intersection you oberved as desribed and check that it is correct by loading and running it.

Using the resources provided

  • You will find the javadoc in the api folder.
  • Create an Eclipse project (e.g. myrequest).
  • Create a package traffic.diy in the src directory. This is where the code you will write/modify goes.
  • Add the Java source files from the skeleton folder to the package you created. These contain the sources for classes MyIntersectionMonitor,ModelIntersection and MyIntersectionLoader.
  • In the Project — Properties dialog, add the JAR file traffic-library-1.2.jar to the build path (using the Add External JARs button).
  • You should now be able to run the application (there’s a main method in MyIntersectionMonitor.

Submission

We’ll update you on the exact details of your submission soon.