## 1 Introduction
### Related Works and Contributions  
A lot of efforts have been devoted to modeling the IEEE 802.15.4 CSMA protocol. Typically, a multi-dimension Markov chain approach [7; 11] was employed to model the state evolution in a CSMA/CA network. From the model, the key performance metrics such as packet success rate, average delay, actual throughput [12] and energy consumption can be derived [13]. Such models are essential at the design phase as network designers can estimate the network performance simply by running the model and high accuracy can usually be expected. However, such models are complex and can thus only be applied in an offline manner. When frequent changes are expected, e.g., changes on number of active nodes, a Markov chain model can hardly serve to estimate the system performance at runtime. Furthermore, most of the models assume the homogeneity of the network as well as saturated traffics. Little attention has been paid to consider heterogeneous networks and unsaturated traffics that are very common in a variety of control and industrial applications [14, 15, 16]. The goal of this paper is thus to develop a distributed transmission rate tuning algorithm which is able to guarantee throughput requirement for IEEE 802.15.4 heterogeneous networks with varying traffics. To implement such a tuning algorithm, it first requires the exploitation of the locally available information on MAC layer. Authors in [6] devised an approximation method to evaluate the performance metrics online using busy channel probability and transmission probability for a homogeneous CSMA/CA network. This work assumes that the number of nodes is known _a priori_, which is not the case for a time-varying network. The work in [17] explored the use of clear channel assessment (CCA) results for the tuning of binary exponent (BE) in order to achieve energy efficiency. In [18], authors used a frame-analytic mechanism to estimate the number of nodes and optimize the 802.15.4 parameters. The works in [19, 20, 21] investigated the pattern and optimal number of the clear channel assessments. Furthermore, for transmission rate tuning, a distributed model or mathematical framework is also required to relate the local information to the estimated variables (e.g., the active number of nodes). This topic has been relatively less studied for IEEE 802.15.4 protocol compared with that of IEEE 802.11 protocol [22, 23]. In [5], the authors proposed a dual-model approach to characterize the IEEE 8021.5.4 CSMA/CA protocol. Instead of using a multi-dimension Markov chain, the authors proposed two simpler Markov chains, namely node-state model and channel-state model. This simple construct is able to achieve comparable accuracy to complex modeling methods. Moreover, using the channel-state model as the baseline, we discovered in this paper that it is possible to devise a distributed algorithm that can estimate the network performance at runtime, not only for homogeneous networks, but also for heterogeneous networks. In the context of distributed algorithms in CSMA/CA networks, quite a number of research works are focused on MAC layer parameter tuning [24]. The work in [8] used busy channel probability and transmission rate to minimize the energy consumption by tuning MAC layer parameters. A priority-based CSMA/CA was proposed in [25] to provide deadline-aware scheduling by varying the MAC layer parameters. Authors of [22] proposed an extended Kalman filter approach to estimate the number of active nodes in a homogeneous IEEE 802.11 network. The work in [23] proposed a sequential Monte Carlo (SMC) method for the same problem. The estimation results were then used to optimize the backoff parameters to achieve Nash equilibrium. The work in [26] uses the received power to determine the optimal transmit power and transmission rate for space capacity maximization. All these works, however, assume homogeneity of the network and the extension to heterogeneous networks is not straightforward.