# MAC/PHY Comprehensive Visible Light Communication Networks Simulation
## 4 Proposed Simulation Scheme  
As mentioned in Section 2, most authors focused only on MAC modeling, using closed-form expressions to estimate path loss in the communications link. Nonetheless, VLC coordinators are usually located on the ceiling pointing downwards, limiting the likelihood of LOS situations between user nodes. However, depending on the scenario's materials, reflections may be sufficiently powerful to be used during CAP to carry out CSMA/CA. In general terms, accurate impulse responses have not been generally considered during MAC-layer simulations, limiting the practical usefulness of those results. In this work, a combination of a MAC-layer simulation tool and a Monte Carlo Ray Tracing (MCRT) algorithm for realistic channel estimation is considered. This approach allows the evaluation of NLOS situations in which channel sensing could be feasible, as well as the possibility of considering real-world scenarios.  
There is a significant number of programming platforms to carry out network-level simulations taking into account MAC operation and simplistic physical behavior. In this work, OMNET++ has been selected because it is based on Object-Oriented Programming (OOP), it is a C++ framework and is easily scalable. Since OMNET++ defines an event-driven simulation, it provides an easy interface to implement the MAC-layer operation based on callbacks.  
The developed simulator is illustrated in Figure 4. It comprises of two main modules that reflect both the coordinator and nodes. Each of these modules is divided into two parts. The physical layer submodule evaluates the communication performance according to the link's characteristics (which are accurately obtained using a MCRT algorithm), whilst the MAC control submodule applies the logical procedures of IEEE 802.15.7 and considers time synchronization.  
Figure 3: Association process of a new node in a Visible Light Communications (VLC) network.  
A flow diagram of the simulation process is depicted in Figure 5. Each part of the algorithm is described in the following subsections.  
In OMNET++ the modules present a hierarchical organization in which the main modules can be split into smaller ones in charge of simpler tasks. The small modules are associated with a C++ file and a NED file, whilst the complex modules only have a NED file. The C++ file contains the behavioral description of each node. On the other hand, the NED file describes its organization and allows simulation parametrization without modifying the C++ file. In this work, a complex module for the coordinator and another one for the user node have been developed. In these modules, it is possible to set up MAC and PHY parameters such as BO, SO, the optical clock, the node location, and the transmitted power, among others. To modify them, the new values can be added in the parameters  
Figure 4: Structure of the developed simulation platform.  
Figure 5: Flow diagram of the Monte Carlo Ray Tracing algorithm for physical layer simulation.  
section of each node's NED file. Furthermore, the network is described in a separate NED file in which the considered nodes (coordinators and users) are included and connected.