# A Petri Net Model for Cognitive Radio Internet of Things Networks Exploiting GSM Bands +
## 4 QoS Evaluation of Secondary User Based on NMSPNs
### The Primary User Model
The firing of CS\({}_{\text{i}}\), which means that the call is over, consumes the token from its input place (CS_busy\({}_{\text{i}}\) and puts a new token in the place CS_end\({}_{\text{i}}\). Suddenly, the token from one of the two places (\(V_{i}\) or S\({}_{\text{i}}\)) will be removed thanks to the immediate transitions CS_freeV\({}_{\text{i}}\) or CS_freeS\({}_{\text{i}}\). It is worth noting that only one of the two transitions CS_freeV\({}_{\text{i}}\) and CS_freeS\({}_{\text{i}}\) can be enabled depending on the state of the VAD; their firing puts one token in place CS_load, representing the system state where the slot becomes free. The _data workload_ block models the data packet arrival for the data packet switching service; it is created by the places PS_load and PS_choice and the transition PS_arrival; tokens in place PS_load enable the timed transition PS_arrival to fire. We assume the packet arrival process to be a Poisson process; thus, the interarrival time is modeled by using an exponential transition with parameter \(\lambda_{b}\), with \(\lambda_{b}\) being the parameter of the arrival process. The number of tokens \(M\) in place PS_load represents the size of the queue buffer in terms of packets; thus, when the place is empty, the queue is full and packets will be discarded. When a new packet arrives (when PS_arrival fires), a token is put in place PS_choice and all the immediate enabled transitions PS_slot\({}_{\text{i}}\), with \(i=5,\dots,7\) corresponding to free CS+PS slots, are triggered. One of the triggered transitions PS_slot\({}_{\text{i}}\) is randomly selected to fire; we set all their weights to 1.0 in such a way that the random selection follows a uniform distribution. If we have no PS_slot\({}_{\text{i}}\)-enabled transition, the token simply accumulates in place PS_choice, emulating the buffering of the corresponding packet in the queue. As soon as a PS_slot\({}_{\text{i}}\) transition becomes enabled, the corresponding packet transmission starts moving the token to the corresponding place PS_busy\({}_{\text{i}}\). Indeed, the packet switching service is modeled through place PS_busy\({}_{\text{i}}\) and timed transition PS\({}_{\text{i}}\). A token in place PS_busy\({}_{\text{i}}\) means that the slot \(i\) is currently being used by a packet transmission; thus, an inhibitor arc from this place to the transitions PS_slot\({}_{\text{i}}\) and CS_slot\({}_{\text{i}}\) ensures that the slot cannot be selected for neither a new incoming call nor other data packet transmission. We model the transmission time with an exponential distribution as we consider the message length to be exponentially distributed [55] with mean \(N_{c}\) bit and with the transmission rate constant being equal to \(r_{c}\) bps. We have settled this last value while assuming the average radio interface rate per time slot over all possible channel coding schemes for the EDGE packet switching transmission (CS-1/4, PCS-1/6). Accordingly, we set the expected firing time of the timed transitions PS\({}_{\text{i}}\) to be equal to \(\frac{1}{\lambda_{c}}=\frac{N_{c}}{r_{c}}\). The last block of the model, _slot selection_, is used to represent the activation of slots; the number of tokens in place enabled_slot models the slots that are actually active, i.e., \(i\) tokens in the place means that slot \(i\) is the active slot. Instead, place turn is used to count the turns inside a round of \(N\) slot activation. The mechanism is implemented as follows. When the round starts, there are zero and eight tokens in places turn and enabled_slot, respectively; the transition nextSlot is enabled until the tokens are in their input place turn. Transition nextSlot is a timed deterministic transition whose firing time is set to the slot length \(\tau_{i}\); because turn is its only input place, it will fire eight times at regular intervals, moving a token from turn to enabled_slot.