Topology Control is a well-known technique for saving energy in wireless sensor networks. Despite the fact that topology control algorithms and protocols have been extensively studied, they are currently unavailable in most, if not all, simulation tools. In this work we introduce Atarraya, a discrete-event simulation tool specifically designed for testing and implementing topology control protocols for wireless sensor networks. The simulation tool includes structures for designing both topology construction and topology maintenance protocols. In addition, Atarraya includes several key algorithms and applications that along with its graphical user interface can be used to support teaching activities. The correctness of the tool is validated using well-known results available in the literature.