The Traffic Simulator uses SystemJ to create a simple traffic simulator with a focus on traffic signals. The simulator is comprised of two parts implemented using SystemJ:
- A webserver and web based frontend to visualise the traffic.
- An environment to model cars, traffic lights and the road.
An HTTP request sent from a web browser can be used as an input signal to the webserver SystemJ program. A custom class was created to handle the request object in Java. The SystemJ program can then use the reactive mechanisms such as: await Request; to wait for a new request, and respond accordingly.
The graphical frontend was created using the HTML5 canvas element, and is all rendered on the client. This eliminates a lot of the server load, as the only data that needs to be sent is the state of the environment. An example of the graphical frontend can be seen in Figure 1.