## 3 A Generalized Approach for Multiple Event Types
### Protocol and Algorithm  
The structure of the _Pricing System_ is almost the same as _PCC_ described in Section 2.1.. However, in order to support multiple types, it is necessary to modify the communication protocol and the dropping strategy as described below. _Task 1_: In the _Pricing System_, the sink needs to broadcast the updated prices to all sensors in the network. This functionality could be implemented on multiple layers, such as application, network or MAC layers. In order to avoid additional burden to the network, the _Pricing System_ broadcasts the prices through the _ACK_s of the MAC layer so as not to introduce a new protocol. In wireless networks, _ACK_s in the MAC layer is inevitable due to the _CSMA/CA_ protocol as the sender needs the confirmation of the transmission from the receivers. In the proposed approach, the sink could update the prices and notify the nodes within one hop when it receives their data frames. Later those sensors receiving the new prices could propagate the information to their neighbors. This process will eventually ensure that all sensors are aware of the new prices. This process does take some time to propagate the updated information to the whole network. However, note that the MAC layer transmissions occur frequently even without any data communication. For example, most routing protocols need to detect whether the next hop is still alive, which triggers periodic transmissions between two neighbors at the MAC layer. In order to support the above approach, it is also necessary to modify the format of _ACK_ frame. Suppose there are totally \(M\) types of packets, \(M-1\) types of _Event_ packets and one type of _Non-Event_ packet. In the payload of an _ACK_, \(M\) variables (2 bytes for each) present the prices of all categories; and one variable presents the _time stamp_, with which the nodes can compare the newly received prices with the stored ones. Therefore, the possible price range is \(2^{16}\approx 64K\); and the length of the time stamp is \(64K\), which could be utilized circularly if necessary. _Task 2_: Unlike _PCC_, _Pricing System_ supports multiple _Event_ types. Therefore, in the header of each packet, we augment an additional part with \(n=log_{2}M\) bits to label the type of the packet. When a sensor generates a packet, it sets the header with the category so that all nodes along the path to the sink are able to process this packet according to the dropping strategy introduced below. The overall structure of the algorithm is similar to Figure 4, except that we replace the Part _2.1_ with the following new dropping strategy. To support the multiple categories of events, we introduce a new notation \(R_{i}\), which is the _price_ of packet \(i\). \(R_{i}\) can be any one of the \(M\) prices, ranging from \(1\) to \(64K\). With the definition of \(R_{i}\), the Part _2.1_ becomes  
1. \(0\leq N\leq Q_{min}\): Keep all packets since the utilization of the buffer is low. 2. \(Q_{min}<N<Q_{max}\): Keep all types of _Event_ packets and begin to drop _Non-Event_ packets according to the function \(F_{N}(N)\) shown in left part of Figure 5. The optimization problemsbecomes \[\text{maximize}_{\{K_{N}^{-}\}} \frac{(\sum_{i\in N_{N}}\frac{P_{i}\times k_{i}}{R})^{2}}{N_{N} \times\sum_{i\in N_{N}}(\frac{P_{i}\times k_{i}}{R})^{2}}\] (14) such that \[\sum_{i\in N_{N}}k_{i} = F_{N}(N)\] (15) \[\forall i\in N_{N}\quad k_{i} \in [0,1]\] (16) where \(R\) is the price of _Non-Event_ packets, and \(\vec{K_{N}}=[k_{1},k_{2},\ldots,k_{N_{N}}]\) is the accepting probability, which is the decision variable. In the optimization algorithm, we would like the ratio of different type of price to be equal to the ratio of the cumulative survival probability of different types of packets as much as possible. The ideal case is when the Jain's Fairness Index equals 1, which is achieved when \(R_{1}:R_{2}:\ldots:R_{M}=P_{1}k_{1}:P_{2}k_{2}:\ldots:P_{M}k_{M}\).