## 5 Experimental Results  
The proposed distributed algorithm has been implemented and extensively tested using the TelosB node [36]. TelosB consists of a Texas Instrument MSP430F1611 microcontroller and an IEEE 802.15.4-complaint CC2420 radio transceiver. The proposed algorithm is built on top of the TinyOS operating system [37], using a dialect of C language called nesC (network embedded system C language) [38]. The codes for the proposed algorithm occupy about 8-kB program memory. For the medium access control (MAC) layer and the interfaces to the radio stack, the IEEE 802.15.4 slotted CSMA/CA implementation [39] is used. The network is organized using star topology where multiple nodes transmit data to a pre-defined receiver. A packet transmission cycle consisting of transmitting the data packet and waiting and receiving the ACK packet is of 100 symbols long, which is translated to five time slots in the model in Section 2. The function value \(h\big{(}\sum_{j\
eq i}\big{(}1/t_{j}\big{)}\big{)}\) is discretized for \(\sum_{j\
eq i}\big{(}1/t_{j}\big{)}\in[0,0.1]\) with an interval of 0.0025 using a \"float\" type C array as a look-up table. In the following discussions, the performance of the algorithm is evaluated under a typical laboratory environment, as shown in Figures 4 and 5. Each node is placed on top of a 1-m PVC stand. The network to be tested is assumed to be a sparse and low-traffic network. The transmission power is set to 0 dBm. The application considered is an indoor laboratory monitoring and control system, where sensors of heterogeneous nature transmit packets to a central coordinator (controller). The traffic in such a system is unsaturated, but within a certain time interval, a minimum number of successful packets are expected (as \"throughput demand\") for each sensor node in order to stabilize a control system, as discussed in [30,40], or to enable real-time monitoring. To take into account the effect of multi-path fading, the sensor nodes and the central coordinator are randomly placed in the nine spots in Figure 5 and are shuffled after each experiment. The homogeneous case where each sensor node in the network has the same throughput demand is first tested. Different numbers of sensor nodes in the network are evaluated, ranging from three to  
Figure 4: The testing area. Figure 5: The floor plan of the testing area. seven. Each node is assigned a throughput demand of 1/200. Each experiment is run for 300 s and repeated 3 times and more than 5000 packets are transmitted by each node for each experiment. The result is shown in Figure 6. Figure 6 first compares the actual throughput (mean and standard deviation) _versus_ the throughput demand. It is observed that the actual throughput is very close to the demand, with an average relative error of 0.43%. The transmission rate (mean and standard deviation) is also compared with the one predicted using the Markov chain model [5]. The result is in general very close but the proposed distributed algorithm performs slightly better in providing the optimal transmission rate based on the actual throughput. Figure 7 presents the result for a heterogeneous network consisting of six sensor nodes which are assigned a throughput demand of 1/100, 1/120, 1/140, 1/160, 1/180, 1/200, respectively. The experiment is run for 300 s and repeated 10 times. The actual throughput for each node matches very well with the demands, with an average percentage error of 0.524%. Figure 6: Experiment results of homogeneous networks (TR: transmission rate). Figure 7: Experiment results of heterogeneous networks (TR: transmission rate). Table 1 compares the proposed method with the Markov chain-based methods. It is shown that the proposed one is able to satisfy the throughput demand with a smaller error than the one achieved by the Markov chain model in both homogeneous networks and heterogeneous networks.