Prediction Engine

The com.atc.simulator.prediction_service.engine package forms the core of the Prediction Service.

Diagrams

../../../../_images/Class_Design3.svg

Class Design

PredictionEngineThread

Within this package, the PredictionEngineThread is a thread which runs continuously, waiting for updates to the com.atc.simulator.flightdata.system_state_database.SystemStateDatabase to occur. Each update results in the creation of a new PredictionWorkItem. The new work item is then placed in a queue to later be assigned to one of the Workers belonging to the prediction engine.

PredictionEngineListener

For classes wishing to interact with the output of the prediction engine, there is the PredictionEngineListener. The primary example of this is the PredictionFeedServerThread which waits for prediction work items to complete in the prediction engine, and broadcasts the predictions to its clients.

PredictionWorkItem

The PredictionWorkItem class is designed to be a self contained unit of work for the Workers to work on to produce predictions using various Algorithms. It is used to keep track of what work is being done and by whom, and stores a complete thread-safe copy of the data required for the worker to perform the work required to complete this work item.

The PredictionWorkItem is also used to help track of the realtime status of work items and when they are complete This gains useful information on the performance of the system in order to accurately identify any major performance flaws if and when they occur.

Workers

Workers do work on PredictionWorkItem for the prediction engine. There are currently two types of workers in the project.

Java Prediction Worker

The workers.JavaPredictionWorkerThread is a pure java thread which performs the job of a worker for the prediction engine. Its algorithm implementations are stored here: com.atc.simulator.prediction_service.engine.algorithms

OpenCL Prediction Worker

The workers.OpenCLPredictionWorkerThread is a java thread, which uses the OpenCL api to perform its work item computations using specialised parallel compute hardware. The implementation is currently optimised for use on an NVIDIA GTX760 graphics processing unit.

The front end to its algorithm implementations are stored here: com.atc.simulator.prediction_service.engine.algorithms.opencl

The back end to its algorithm implementations, the OpenCL C code is stored in the project assets directory: /assets/opencl/

Algorithms

The main prediction algorithm currently employed uses least-squares method to fit circles to track data. Detailed documentation can be found here: Algorithm