Java代写:SENG201 Traffic Engineering Application Part1

Introduction

代写一个交通灯的应用的第一部分,需要使用给定的Java库,工程性质的领域应用作业,第一部分主要是介绍领域背景。

In this assignment you are going to use a Java toolkit for use in traffic engineering applications. As well as writing some code yourself, you will also modify or use code written by others. Like all good Java software, the various classes you write may be used by a variety of clients such as graphical simulation software packages for modelling traffic flows under various conditions or by the software that controls the city’s network of traffic lights.
There’s quite a lot of reading here — don’t be discouraged! Once you have a good understanding of the way the various aspects of the topic fit together, you will find writing your part a lot easier. We’ll be releasing material in several parts: the focus of this part is domain knowledge and analysis — no Java coding is involved.
This assignment is not just a programming exercise: it is an opportunity for you to demonstrate a range of software engineering skills. These might include analysis, modelling, design, testing and documentation as well as coding. It is typical in software engineering projects for the domain to be one you may not be expert in, and for requirements to be vague, incomplete or contradictory — we’ll also exercise our communication skills!

How intersections work

Overview

We all spend a considerable part of our lives travelling on our country’s roads. As city dwellers 1 , most of us spend much of our travelling time at intersections. As you complete this assignment, you will get to think more deeply about intersections and learn a little 2 about how they are controlled. We hope your future journeys will be much more interesting as a result.
To begin with, we need to gather some terminology and definitions. Intersections — places where roads meet or cross — come in many different shapes and sizes (geometries). Figure 1 on the following page shows the two most common geometries — the familiar ‘T’ and ‘+’ intersections.
There are many variations on these basic geometries. The roads may not meet at right angles or there may be more than two intersecting roads.
The simplest kind of intersections are uncontrolled and vehicles move through the intersection in accordance with the basic road rules governing right of way. Uncontrolled intersections are now quite rare in urban areas and are only suitable for low traffic volume locations. The next level of sophistication involves the use of signs to reinforce the rules (as on an intersection with Give Way signs at all approaches) or to override them (as in the case of Stop signs on a minor road where it joins a major one).
Other options include the use of roundabouts (also known as traffic islands or rotary intersections) and “free turn” lanes to increase traffic flow while relying on basic road rules. We will not consider these further in this assignment.
We will only be considering controlled intersections where electronic signalling devices — traffic lights — are used to enforce a plan for giving the right of way in turn to vehicles approaching the intersection from different directions.

Traffic streams

We can describe what happens at an intersection in terms of a number of traffic streams. The traffic approaching an intersection along a particular road may be regarded conceptually as being made up of several separate streams. Whenever we approach an intersection we have (usually!) already selected a traffic stream that fits our intended movement. Examples might be “I’m in the right turn lane” or “I’m in the straight ahead or left turn lane”. Figure 2 on the next page shows six common streams seen at intersections — see how many you can spot on your way home. These 6 streams are for traffic approaching from one particular direction. The streams for traffic approaching from other directions are simply those shown in Figure 2 on the following page rotated by the appropriate amount.
Many streets are divided into a number of parallel lanes by road markings and sometimes physical features such as median strips. Lane markings are usually designed so that they correspond to particular traffic streams (e.g. north-bound through traffic AND west-bound left turning traffic). Detectors embedded in the road are unable to tell whether vehicles are intending to continue straight through or make turns. In this case the stream is regarded as consisting of the combination of the possible options. Detectors are considered further in later sections.
For example, traffic approaching the intersection of Hoare Street and Dahl Drive from the south (see Figure 1) could consist of up to three traffic streams: through traffic continuing north on Dahl Drive, left-turning traffic continuing west on Hoare Street and right-turning traffic continuing east on Hoare Street. These could be accommodated in different ways depending on the number of lanes available at the intersection: by having three separate traffic streams (types (a), (b) and (c) in Figure 2 on the next page); by having two traffic streams (types (c) and (d)) or (types (b) and (e)); by having one traffic stream (type (f)).
Sometimes particular potential traffic streams are not available — such as a turn onto a one-way street or continuing straight ahead at a ‘T’ junction — at an intersection.

Traffic lights

At a controlled intersection, there are a number of signal heads mounted on poles or suspended above the roadway. Each signal head has a number of signal faces, each consisting of a number of individual lights. Each light has a single colour and may be on or off 3 . The lights are arranged in groups. For simplicity, we will assume that these are always groups of three, in practice other configurations (such as a single green right turn arrow light) occur. Some examples are shown in Figure 3.
The most common signal face configuration consists of red, amber & green circular lights controlled so that only one member of the group is on at any time (e.g. when the green light is on, the yellow and red lights in the same group are off). Another very common configuration is a group of three (red, amber and green) arrow lights: these are usually controlled so that at most one light is on at any time.
Variations include through arrows in red, amber & green as well as bus, tram, pedestrian and cycle lane signals.
Each signal face is positioned so that is is clearly visible to approaching vehicles in the relevant traffic stream(s). Each traffic stream may have several signal faces. Three is the usual number — check for yourself! Figure 1 on the preceding page shows the signal faces visible to the south-bound traffic streams approaching the intersection of Dahl Drive and Hoare Street from the north. Each face has a location relative to the intersection centre and an orientation indicating the direction it is facing. The locations of the signal faces in Figure 1 on the previous page are NE, SW and SE. All faces for a particular stream will usually face the same direction — all three face north in this case.
Signal faces can be shared between traffic streams. In practice, a “through and left” stream (type (d) in Figure 2) and a “through and right” stream (type (e)) would probably share a signal face for controlling through traffic movement. Figure 3(b) shows a signal face which can control types (c), (d) and (f) depending on the states of the round lights ((green, yellow or red) and right arrow (green, yellow, red, off).

Phases & phase plans

Each controlled intersection has a cycle consisting of a number of phases. The intersection has a phase plan which specifies the order of the individual phases. Each phase is carried out in turn until the cycle is complete, at which time the cycle then begins again. You may have noticed that some intersections may have more than one phase plan. For example, a “rush hour” plan might include protected right turns and shorter phases while an “off peak” plan might omit protected turns and have longer phases.
In any particular phase the intersection’s lights are switched into a pattern allowing one or more traffic streams to proceed (by giving them green lights) and preventing others from moving (by giving them red lights). For example, one phase might permit both north-bound and south-bound through traffic on Dahl Drive; another might permit north-bound and south- bound through traffic on Dahl Drive as well as left-turning traffic onto Hoare Street.
Figure 4 on the next page shows one possible cycle for the intersection of Dahl Drive and Hoare Street. The cycle consists of four phases. Each phase involves two traffic streams from the basic set shown in Figure 2 on the preceding page.

  1. The appropriate combination of red and green lights is set to permit north-bound and south-bound through traffic on Dahl Drive as well as left turns onto Hoare Street. No right turns are allowed in this phase. No traffic on Hoare Street is permitted to move in this phase.
  2. Now the appropriate lights are changed to stop the north and south bound through traffic and traffic turning left onto Hoare Street. In addition, further light changes permit right turns from Dahl Drive onto Hoare Street. Traffic on Hoare Street is still not permitted to move in this phase.
  3. Now it is the turn of the traffic which has been waiting on Hoare Street. The appropriate lights are changed to prevent right turns onto Hoare Street and to prevent any traffic on Dahl Drive from moving. East-bound and west-bound traffic on Hoare Street is permitted as well as left turns onto Dahl Drive.
  4. Finally, all streams are stopped except for cycle length, is fixed in advance. The phase right turns from Hoare Street onto Dahl plan may depend on factors such as time Drive.

At the end of phase 4 the cycle begins again.
Four-phase intersections are quite common — see how many can you spot on your way home. A 2-phase intersection has a very simple plan but you may also encounter many more complex phase plans.
Now let’s consider the details of the light changing process as one phase ends and another begins. The transition between phases is not immediate — there is a change interval which includes the yellow interval where amber lights are displayed to allow traffic already committed to crossing the intersection to be cleared and an all red interval where red lights are set to prevent any further incoming traffic from the traffic streams active in the phase and to provide a safety margin 4 . Only when the all red interval has elapsed can the next phase be permitted to begin allowing further traffic movement. Typical yellow intervals are 3–4 seconds long and typical all-red intervals are about 1 second. Is this consistent with your observations?
For simplicity, we will treat change intervals and all-red intervals as separate phases in this assignment.

Controlling intersections

Many intersections have detectors buried beneath the road surface in order to detect the approach of vehicles in the corresponding lanes (and hence traffic streams). Some cycle lanes also feature detectors. Detectors come in two types. Modern (active) detectors notify the intersection controlling software when a vehicle arrives. The intersection may then decide to switch to a phase which will service the corresponding traffic stream. Older style (passive) detectors record vehicle arrivals but the intersection must poll them to interrogate them about the data they have recorded. Polling involves asking each detector in turn if it has detected any vehicles.
Controlled intersections can be classified into three major groups according to the way they (via their phase plans) use information provided by detectors.

  • Pre-timed (unactuated) intersections have a pre-determined phase plan. The order and length of each phase, and hence the total cycle length, is fixed in advance. The phase plan may depend on factors such as time of day (e.g. shorter phases at rush hour) or day of the week (e.g. longer phases in week- ends). However, no adjustment is made for actual traffic conditions (as reported by detectors).
  • Semi-actuated intersections are often found where a minor road crosses a major road. The phase plan for such an intersection will typically remain in a default phase giving priority to the major road, until a vehicle is detected in a traffic stream on the minor road. The intersection responds by switching to a phase where the traffic streams on the minor road are serviced. This approach maximises throughput on the major road while giving traffic on the minor road a fair go. Both the cycle length and green times may vary from cycle to cycle in response to demand.
  • Fully-actuated intersections have all phase changes initiated in response to detector actuations. The phase sequence is specified, as are minimum (and sometimes maximum) green times for each phase. Cycle lengths and green times may vary from cycle to cycle. Some phases may be optional (i.e. minimum green time = 0) and may be omitted if no demand is sensed by the corresponding detectors. An example would be skipping right turn only phases (such as phases 2 & 4 in Figure 4) if no vehicles have entered right turn only lanes.

The ultimate in sophistication is linking intersections into zones with the same cycle lengths. This enables platoons of vehicles to travel through a sequence of intersections without being stopped. You may have noticed this technique used on the one-way street system around Christchurch.

A local example

Figure 5 shows an example of how we’ll think about intersections. It shows the intersection of Clyde & Creyke Roads with Kotare 5 Street — this is at the north-east corner of the block containing the campus so (as we did) you can observe it for yourself.
Traffic entering from each direction sees signal faces consisting of 3 round lights. Traffic arriving from the north also sees a signal face consisting of 3 right arrow lights (see Figure 3(b). Overhead lights are ignored, as is the “free turn” for traffic turning left from Creyke Road into Clyde Road.
The active phase plan consists of seven phases. In the first phase all traffic arriving from the east and west may proceed (i.e. traffic streams of type (f) in Figure 2), with right-turning vehicles giving way as usual, while traffic arriving from the north or south must wait. In Figure 5 the state of each signal face is indicated by the corresponding colours 6 . For example, the black “lights” indicate that the arrows are all off in phases 6 and 7.