CSSE2002/7023: Traffic Management System (TMS) - Classes and Methods - IT/Computer Science Assignment Help
Question Task Id: 0
- Subject Code :
- University :
The University of Queensland TvAssignmentHelp is not sponsored or endorsed by this college or university.
- Country :
The goal of this assignment is to implement a set of classes and interfaces1 to be used to create a simulation of a traffic management system. You will implement precisely the public and protected items described in the supplied documentation (no extra public/protected members or classes). Private members may be added at your own discretion.
All work on this assignment is to be your own individual work. As detailed in Lecture 1, code supplied by course staff (from this semester) is acceptable, but there are no other exceptions. You are expected to be familiar with “What not to do” from Lecture 1. If you have questions about what is acceptable, please ask course staff.
In this assignment, you will finish building a simple simulation of a traffic management system (TMS). A traffic management system monitors traffic flow in a region and adjusts traffic signals to optimize traffic flow. A TMS uses different types of sensors and signals to monitor and manage traffic flow. In the 1st assignment, you implemented the core model for the TMS. In the second assignment, you will implement some of the more advanced logic to provide a very simple simulation for the TMS. In addition to the pressure pads and speed cameras from assignment one, you will add a vehicle count sensor. It counts vehicles passing a location and reports the traffic flow as the number of vehicles in a time period. You need to integrate this new type of sensor into the system. This is an example of a common situation when building a large system. New features need to be added to the system. A well-designed system that uses interfaces to define an API means it should be simple to add the new feature. In assignment one, you implemented traffic lights and electronic speed signs and attached them to a route. In assignment two you will provide logic to coordinate traffic lights at intersections. The TMS monitors sensors along routes and manages signals on routes, and at intersections, to optimize traffic flow. In assignment one, the network of routes was implicitly defined by your test code and SimpleDisplay. In assignment two you will implement the logic for the TMS to maintain a network of routes. Does this include the ability to load a network from a data file and save a modified network to a file?
Monitoring and managing congestion requires sophisticated logic in a real TMS. In the assignment, one congestion was simply reported by each sensor. In assignment two you will implement logic for congestion calculators. These take the congestion data from a set of sensors and determine overall congestion for the route(s) covered by the sensors. The approach taken is to define a 1From now on, classes and interfaces will be shortened to simply “classes”
Congestion Calculator interface that provides an API. Di?erent classes can implement this interface to provide different options for the logic of determining congestion. This is another example of a common approach to designing flexibility into the system’s structure. When implementing the assignment you need to remember that it is implementing a simulation of the TMS and not the real TMS. Interfaces are provided for the sensors to allow easy replacement of sensor implementations in the program. You will not be collecting data from real sensors but will be implementing classes that demonstrate the behaviour of sensors. They store a set of data values that are used to simulate the sensors returning di?erent values over time. Signals are simple simulations of real signals, in that they only store the current state of the signal and allow the route to update the signal. To manage the simulation of time, there is a TimedItem interface and a TimedItemManager class, which you implemented in assignment one. Sensors implement the TimedItem interface, as they are items that need to react to timed events. TimedItemManager stores all the TimedItem objects in the application. The simulation’s GUI tracks time passing in MainView.run() and it invokes MainViewModel.tick() once per second. The tick method calls the TimedItemManager’s one-second method, which sends the one-second message to all TimedItems. This approach of tracking the passage of time and invoking an action on all relevant objects once per second was the reason that TimedItemManager is implemented as a singleton2. A simple GUI has been provided to you as part of the provided code. It is in the tms.display package. It will not work until you have implemented the other parts of the assignment that it uses. The GUI has been implemented using JavaFX and consists of three classes and an enum. MainView creates the main window for the TMS GUI. StructureView displays the structure of the traffic network. MainViewModel represents the TMS model that is to be displayed. The TMS application is initialized and started by the Launcher class in the tms package. It loads the traffic network data and creates the GUI. Most of the GUI code has been provided to you. In MainViewModel you need to implement some of the logic that is executed by events in the simulation and to handle keyboard input for the main application’s window. The functionality you need to implement in MainViewModel is to:
• Save the state of the network to a file in response to the user selecting the save command. This is to be implemented in MainViewModel.save().
• Allow the simulation’s execution to be paused and unpaused. This is to be implemented in MainViewModel.togglePaused().
• Process time passing in the simulation. This is to be implemented in MainViewModel.tick(). Keyboard input is handled by the accept method in the MainViewModel class. It needs to process input from the user in the main window to perform actions in the simulation. Pressing the ‘P’ key will toggle whether the simulation is paused or not. The ‘Q’ key will quit the simulation. The ‘S’ key will save the current network to a file called “DefaultSave.txt”. A shell for this method has been provided because it is already hooked into the GUI.
You need to implement loading a network from a data file. The JavaDoc for the loadNetwork method in the NetworkInitialiser class describes the format of a network data file. Saving a network is done by the same method in the MainViewModel class. A network data file is structured as follows:
• The 1st line is the number of intersections (ni) in the file
• The second line is the number of routes in the file.
• The third line is the duration of yellow light.
• The following ni lines are the intersection details.
– The 1st part of an intersection line is its id.
– This is optionally followed by a ‘:’, a duration, another ‘:’, and a sequence of intersection ids that are separated by commas.
• The final set of lines is the route details, including any sensors on the routes.
– Each route is on a separate line. The sensors for a route are on the lines immediately after the line for the route.
– A route is described by the id of the from the intersection, followed by a ‘:’, then the id of the to an intersection, followed by a ‘:’, then the default speed for the route, followed by a ‘:’, then the number of sensors on the route, then optionally a ‘:’ and the speed of the electronic speed sign on the route if it has one.
– If the route has many sensors, each sensor follows on separate lines.
– The 1st part of a sensor line is its type ‘PP’, ‘SC’ or ‘VC’. This is followed by a ‘:’, then its threshold value, a ‘:’, and then a comma-separated list of the data values used to simulate the data returned by the sensor.
• Any line that starts with a semi-colon ‘;’ is a comment and is to be ignored when reading the data from the file.
• Attempting to read an invalid network data file should throw an InvalidNetworkException.
An example data file, called demo.txt, is provided in your repository in the network directory. It corresponds to the diagram below.
1. Implement the classes and methods described in the Javadoc as being required for assignment two.
2. Implement the indicated features of the user interface.
3. Write JUnit 4 tests for all the methods in the following classes:
• AveragingCongestionCalculator (in a class called AveragingCongestionCalculatorTest)
• IntersectionLights (in a class called IntersectionLightsTest)
• NetworkInitialiser (in a class called NetworkInitialiserTest)
There will be some limitations on your tests:
1. if your tests take more than 20 seconds to run, or
2. if your tests consume more memory than is reasonable or are otherwise malicious, then your tests will be stopped and a mark of zero given. These limits are very generous (your tests should not take anywhere near 20 seconds to run and in all probability could take well less than 1 second).
The electronic aspects of the marking will be carried out in a linux environment. The environment will not be running Windows, and neither IntelliJ nor Eclipse (or any other IDE) will be involved. OpenJDK 13 and JUnit 4.12 will be used to compile and execute your code and tests.
It is critical that your code compiles. If one of your classes does not compile, you will recieve zero for any electronically derived marks for that class.
This CSSE2002: IT/Computer Science Assignment has been solved by our IT/Computer Science Experts at TVAssignmentHelp. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.