Distributed and Complex Systems Group : Homepage

:Vérimag Distributed and Complex Systems Group

BIP -- Incremental Component-based Construction of Real-time Systems

A Billiards example

Download BIP code


This example models a billiards board with two balls which moves independently starting from given initial positions and velocites. When they collide, they interchange their direction and velocities.
The atomic component in this model is a Co-ordinate, and a Ball is represented as a compound component which contains two Co-ordinates, X and Y.


The Billiards  component consists of two instances of the Ball component, namely green and red.
They are parameterized by their initial positions and velocities. There are two connectors,
Tick which represents the global clock synchronization, and Shock, which represents the interaction corresponding to the collision between the balls.  The Shock connector has a guard which checks for the same co-rodinate position of the two balls. It has an action which exchanges the velocity and direction of the balls.  Priorities ??. There is also a Display component which utilizes a simple graphic library to display the balls in the board.



Steps to execute the application

To generate the C++ code for the application,
$ bipc -f billiards_display.bip --genC-top Billiards   To compile the application,
$ make billiards_display.bip.x   To run the execution,
$ billiards_display.bip.x -quiet   Ctrl-C to terminate.

  Note: Here we use the "-quiet" option while running the execution to supress the
             display of the interactions executed by the engine.

Back to examples