Simulation means running a model of a system with suitable input and observing the corresponding output. Real-time environment simulation is a special kind of simulation used to simulate a control system's environment in real-time. This is done to test the control system before it is used in its real environment. In this project, computer simulation of a certain kind of environments, called track-based systems, is studied and a general model for track-based systems is developed. In this model, track layouts are represented by graphs, which is a flexible and extensible representation and a method for visualizing these layouts is presented. The model also includes representation of switches, sensors, and trains. In addition, a configurable prototype simulator is designed and implemented for a model railroad system. The experience gained in this project is documented in the report and is presented as guidelines for developing simulators for track-based systems.