jPapaBench

Overview

jPapaBench is a Java version of the PapaBench benchmark, originally written in C. The benchmark is based on the Paparazzi project which provides a free implementation of an autopilot for unmanned aerial vehicles (UAVs). The autopilot has been successfully tested on several real devices. The main motivation for implementing a Java-based PapaBench version was to provide a realistic application benchmark that would allow comparison of different Java Virtual Machine implementations and different flavors of real-time Java. jPapaBench is available for plain Java, Real-Time Specification for Java (RTSJ), and Safety-Critical Java.

Source Code Structure

For portability reasons, the implementation is split into these components:

  • papabench-core provides an implementation of the application logic, independent of the Java flavor. In particular, it implements modules (autopilot, fly-by-wire), sensors (IR, GPS), communication  and tasks. It also contains a simple environment simulator.
  • papanech-pj encapsulates papabench-core into plain Java constructs. It uses common Java threads and dynamic memory allocation with a garbage collector.
  • papabench-rtsj encapsulates papabench-core into RTSJ constructs. It uses real-time threads and supports scoped memory.
  • papabench-scj encapsulates papabench-core into SCJ constructs. There are two versions, one that relies only on SCJ Level 0 (L0) API, and one that uses also SCJ Level 1 (L1).

Modules

The papabench-core component copies the modular design of the original C-based PapaBench.
There are two top-level modules Autopilot and FBW (fly-by-wire) connected by SPI bus. On real hardware these modules are deployed on two different computation units. In jPapabench, they are present in a single JVM.

The FBW module receives commands from the ground and sends them to servos. The Autopilot module is responsible for flying according to a given flight-plan. Based on data from sensors it sends low-level flying to the FBW module. jPapaBench is deployed with third module called Simulator, which collects information about commands sent to servos and computes a physical model of the plane. Further, it produces data for sensors.

picture of high-level design

Tasks

Each module contains a set of tasks, which are responsible for computation and communication.

Autopilot tasks
# Task Period Depends on
A1 Radio control 25ms F2
A2 Stabilization 50ms A1,A4,A7,S3
A3 Fly-by-wire link 50ms A2
A4 Reporting 100ms
A5 Navigation 250ms S2
A6 Altitude control 250ms A5
A7 Climb control 250ms A6
FBW module tasks
# Task Period Depends on
F1 Test PPM 25ms
F2 Send data to autopilot 25ms F1
F3 Check fail-safe mode 50ms
F4 Check autopilot 50ms A3
Simulator module tasks
# Task Period Depends on
S1 Environment simulator 25ms
S2 GPS interrupt 50ms
S3 Infra-red interrupt 250ms
Tasks precedence graph

Tasks precedence graph

Interrupts

jPapaBench has no native interrupts handlers (as they are defined by RTSJ or SCJ specifications). Instead of them, the separated tasks with specified periods are utilized. They produces data for GPS and IR sensors.

Source code

Source code is available at google code. If you want to contribute do not hesitate to contact me.

You can also check the source code of jPapaBench as a part of the archive experiments.tgz which contains all source code related to the JTRES 2010 paper “Exhaustive Testing of Safety Critical Java”. Source code of jPapaBench is located in the directory examples/papabench-{core|rtsj|scj}.

Differences from C-based version of PapaBench

The C-based Papabench uses timeline scheduling, and thus needs no explicit synchronization. In order to support other types of scheduling present in RTSJ/SCJ L1 or even plain Java, jPapabench (papabench-core) includes explicit synchronization statements. These are ignored at SCJ L0.

Other differences are connected with the fact, that the Java-version is currently not intended to be run on real hardware. Thus, selected hardware-specific parts of the implementation are simplified:

  • sensors are simulated via periodic tasks and data from computed by the simulator module
  • communication bus SPI is simplified to round buffer
  • functionality of PapaBench task Transmit servos integrated into the task Check autopilot

Future work

The main future direction of the jPapaBench project is to make the code compatible with the Paparazzi project. Such upgrade will allow to use Paparazzi tools such as an external simulator or visualization engine.

The second objective is to employ model-driven techniques to improve a configuration variability of jPapaBench. The motivation comes from the original PapaBench which tries to define the architecture of benchmark with the help of the Architecture Analysis & Design Language (AADL). We would like to be able to generate a benchmark configuration (or some parts of implementation) from the AADL model.

Links