*4.3. Hybrid Power Cycling for Mesh Devices*

Thread is an emerging routing protocol that is extensively used in smart home appliances [44]. The thread's communication model has mains-powered thread routers and duty-cycled sleepy end devices. Such a hybrid power cycling works for smart home mesh networks. However, the mains power is not suitable for mesh forwarders employed in a smart parking lot because a huge number of forwarders are required to cover the entire parking lot. However, the data collators are smaller in numbers and can be mains powered to maximize the packet reception rate of the data servers and also cater to high data volumes. They mains-powered devices do not switch off their radios. All other sensor nodes can have radio duty cycling to reduce energy consumption and switch off their radios most of the time except during packet transmissions. The BR, too, has its radio on so as to have a seamless connection to Internet. The positioning of BR makes it easier to extend the same to the data servers that are nearby. This hybrid power solution allows for lower energy consumption for the battery-powered nodes and ensures reliable occupancy data collection for the data servers.

#### *4.4. Concise Data Format for Data Exchange*

The occupancy data can be expressed in binary as they are two-state data, which are either occupied or not occupied. Hence, a single byte can represent eight parking slots and an 80-byte IP payload can effectively contain occupancy data for 640 parking slots. The occupancy data can be multiplexed at the data servers and is used for exchanging collated data between servers. The same is sent to data consumers. The concise string is then broken down back to occupancy data in the consumer node. The BR uses the compressed occupancy string in the HTTP data exchanged with the web browser. This short data exchange format reduces the load time of the web page.

The algorithm presented in Algorithm 1 takes the occupancy data array and converts the same to a single consolidated string. The index of the array is mapped to the position of the parking lot and is subsequently filled with either zero or one. The data collators fill the respective slots in the data array and convert the data to a concise string. This string is eight times compressed and can hold over 600 occupancy data in a single IP payload of IEEE 802.15.4 mesh.

#### **Algorithm 1** Convert occupancy data to a concise string.

```
Input is ODA, Occupancy data array
Output is occupancy_str, Concised occupancy data as string
for i = 0 to no_o f _parking_slots − 1 do
  for j = 0 to 7 do
    shi f ted_bit = ODA[i] << j
    combined_byte = combined_byte | shi f ted_bit
  end for
  byte_str = int_to_char(combined_byte)
  concatenate byte_str with occupancy_str
end for
```
The algorithm presented in Algorithm 2 takes the consolidated string and converts it back to occupancy data.

**Algorithm 2** Convert the concise string back to occupancy data.

```
Input is occupancy_str, Concised occupancy data as array of characters
Output is ODA, Occupancy data array
bit_mask[] is {128, 64, 32, 16, 8, 4, 2, 1}
for i = 0 to no_o f _parking_slots − 1 do
  int_value = char_to_int(occupancy_str[i])
  for j = 0 to 7 do
    occupancy_bit = bit_mask[j] & int_value
    if occupancy_bit > 0 then
       occupancy_bit = 1
    else
       occupancy_bit = 0
    end if
    ODA[i] = occupancy_bit
  end for
end for
```
All these decisions are expected to play a role in establishing efficient communication between all the concerned entities of the SPS system.

#### **5. Evaluations**

All the five different communication models referenced in the previous section are evaluated against each other for their efficiency in terms of data loss, packet latency, control overhead, energy consumption, time needed to obtain occupancy data for all the parking slots and the time taken for the occupancy data to reach the consumers. To this effect, an experimental study is carried out in a simulated IPv6 mesh network with 100 nodes and one BR. The Cooja simulator is a widely accepted simulator for conducting experimental studies of IEEE 802.15.4 based IoT networks [45].
