ns2-MIRACLE: a Modular Framework for Multi-Technology and Cross-Layer Support in Network Simulator 2 Nicola Baldo * , Federico Maguolo * , Marco Miozzo , Michele Rossi *† and Michele Zorzi *† * Department of Information Engineering – University of Padova, Italy Consorzio Ferrara Ricerche – Ferrara, Italy {baldo,maguolof,rossi,zorzi}@dei.unipd.it, mzzmrc@unife.it ABSTRACT In this paper we present a novel framework for ns2 to facilitate the simulation and, in general, the design of beyond 3G networks. The set of libraries we wrote for this purpose is called Multi InteR- fAce Cross Layer Extension for ns2 (MIRACLE). They enhance the functionalities offered by the Network Simulator ns2 by pro- viding an efficient and embedded engine for handling cross-layer messages and, at the same time, enabling the coexistence of multi- ple modules within each layer of the protocol stack. For instance, multiple network, link, MAC or physical layers can be specified and used within the same node. The implications of this are mani- fold. First of all, the framework facilitates the implementation and the simulation of modern communication systems in ns2. Secondly, due to its modularity, the code will be portable, re-usable and ex- tensible. As an example of the advantages offered by our architecture, we show how the MIRACLE framework can be used to quickly set up protocol architectures for Ambient Networks [1] and evaluate their performance in wireless and multi-technology environments. We stress that, even though the emphasis in the present paper is put on wireless systems, MIRACLE is a general framework which can be used for simulating wired networks as well as a mixture of wired and wireless scenarios. Throughout the paper we also discuss some of the downsides of existing ns2 extensions, which are often programmed in a rather ad hoc manner, according to specific needs or technologies and, as such, are often difficult to extend/re-use. In contrast, our effort aims at providing well defined interfaces and is based on a truly modular architectural design. Our work can be seen as a step toward the definition of a standard framework for the simulation of cross-layer, multi-technology and mobile systems in ns2. Categories and Subject Descriptors I.6 [Simulation and Modeling]: General, Model Validation and Analysis, Model Development; C.2.6 [Computer-Communications Networks]: Internetworking Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. NSTools ’07, October 22, 2007, Nantes, France Copyright 2007 ICST 978-963-9799-00-4. General Terms Multi-technology, Cross-layer, Dynamic Libraries, Heterogeneous Networks, Ambient Networks 1. INTRODUCTION In the last few years, advances in the hardware for wireless net- working and, especially, embedded microprocessor technologies have made it possible to manufacture very small radio equipments at low cost. This enables the integration of different technologies in the same mobile equipment. These multi-technology solutions are now available on the market and open up the possibility of ex- ploiting new communication paradigms. As multi-interface hard- ware becomes available at low cost, there is a parallel need for un- derstanding its performance limits and devising new networking protocols that will make full use of the offered potential. Often, these systems are way too complex to be fully characterized ana- lytically, and we have to resort to accurate simulation tools for their complete understanding. One of the most used simulation tools in the networking research community is without doubt the Network Simulator, ns2 [2]. We observe, however, that ns2 does not cur- rently support multiple radio interfaces and lacks flexible tools for the cross-layer control of communication systems. Moreover, in the standard distribution of the simulator, the wireless channel is represented via unrealistic models, which may lead to biased re- sults. Also, alternative implementations of the wireless channel are available for specific radio technologies, such as Bluetooth. Nev- ertheless, these are neither standardized nor re-usable for different radio interfaces. This makes it very difficult to carry out studies on wireless coexistence and spectrum sharing. In this paper we present an architecture that we developed for the ns2 simulator in order to fill these gaps. Our framework is called Multi InteRfAce Cross Layer Extension (MIRACLE) for ns2 [3]. It is conceived as a set of dynamic libraries which are loaded to add support for multi-technology and cross-layering. We also wrote a patch which facilitates the use of dynamic libraries in ns2. No- tably, working with dynamic libraries allows the development and subsequent use of new features without the need for re-compiling the whole simulator. In fact, libraries can be loaded on demand at simulation time. Moreover, as we show later, our architecture is highly modular as it allows the interconnection of multiple down and upstream modules at every layer in the protocol stack. Ded- icated and broadcast channels are allocated, at each node, for the inter-layer communication of control as well as data messages. We finally observe that, even though our emphasis as well as the ex- amples that we show later in this paper are on wireless systems, the framework can be used to simulate wired networks as well as a mixture of wired and wireless architectures. In the first part of this paper we introduce MIRACLE, by high-