Trafix is an animated, open source road traffic simulator which simulates cars, trucks and buses. The vehicles are animated and display using X windows. The code is written in C++. Input road files are created graphically using Xfig.
The Trafix simulator was developed by one of the authors in C++ with the GNU gcc compiler under the GNU-Linux operating system. The program was designed to verify the vehicle routing algorithms selected for this hardware simulator study. Trafix is currently in a stage of development which is analogous to the program precursors of fetchmail. An open source program was needed to verify the traffic movement algorithms, and after failing to find an existing solution, Trafix was generated to fill the void.
Trafix is now available as a starting point for others who need to test traffic routing algorithms, roadway patterns, etc. Trafix uses Xfig, a freely available, open-source UNIX drawing package, to generate its input files which describe the input road networks. Trafix displays its animated output in X windows as illustrated in Figure 1. The code is written to be modular so that various components can be replaced as the user community requires.
Attempts were made to allow the code to be easily changed in the future, altering the current dependence on Xfig input files and X windows output displays. In addition to using Xfig for its input and X windows for output, Trafix employs the Standard Template Library (STLPORT) routines wherever expedient to foster the reuse of code which is intended to both lead to efficiency and reduce errors.