Wireless communication platforms in small enclosures are susceptible to in-device RF interference. Difficult interference cases emerge in the next-generation 4G smartphones using certain LTE bands, and support in MAC and higher protocol layers is required for efficient interference avoidance. Interference and the avoidance mechanisms create coupling between the radios complicating the interaction between the smartphone radios and their respective networks. Therefore, the purely analytical approach for studying radio performance becomes difficult. In this paper we present RCOEX, an in-device coexistence simulator for the MAC layer. RCOEX simulates simple multi-network setups focusing on various indevice coexistence mechanisms and their performance. The simulation uses the discrete event variable timedelta model. As the protocol models are complex entities with non-trivial interaction, extensive effort has been made to support rich programming environment, including transceiver emulation, threads, and complex event filtering. Within this framework, we study the design of the WiFi model in more detail.