The recent interest in tackling the distance-dependent aspects of the Mobile ad hoc networks is pushing a demand for distance awareness for nodes in reality. Unfortunately, most current network protocols do not deal with this aspect in a satisfactory fashion. In this paper, we present a method to compute the distance between any two nodes in MANETs and which was going to be implemented in the ns3 to evaluate the accuracy of our methods. We discuss the modeling theory on which our design is based, and we describe in detail the design and implementation of the framework as well as of the PHY layer modules that we developed on top of it.