# Secure and Time-Aware Communication of Wireless Sensors Monitoring Overhead Transmission Lines
## 4 Transmission Grid Model in Quality of Protection Modeling Language
### Model Description
For this reason, implementing considered environment, we defined two communication channels (Listing 3): ch_WSN and ch_MGNT. Due to the fact that the manager is only a helper host, and its role is to handle packet flows, the manager uses ch_MGNT channel for sending control information (the one, which has connection quality equal to 1 (the lower the \(q\) value, the better the connection quality), and sending time equal to 0 ms). On the other hand, ch_WSN is responsible for transferring all the data traversing a transmission grid. Exact channel characteristics will be discussed while presenting the versions structure. ```
1 ch_MGNT()sum;
2 ch_MGNT(*)(gggg);
3} ```
Listing 3: QoP-ML's communication channels prepared for a transmission grid model. Moving on to the next point, let us now discuss hosts, which take part in a transmission grid communication, starting with the BaseStation host (Listing 4). The role of the base station is quite simple: in an infinite loop (lines 7-18), it waits for the data from sinks scattered over transmission line (lines 9-10), decrypts the data (only when it was encrypted (lines 12-15)), and saves it for further processing (line 17). Next, we have the Sensor host (Listing 5), responsible mainly for data collection. The very first instruction of the Sensor host is the generation of the symmetric key (line 3), which can be further used for data encryption (line 16). Sensor waits for parameters send by sink (lines 7-9), in which there is an identifier (ID) of the device, which acts as the relay node for this specific sensor. Then, the sensor performs a measurement to gather the data (lines 11-12) and optionally encrypts it (lines 14-17). ```
1 hartBaseStation(cr)(*)
2{#EF-none();
3 preconsMain(*)
4{while(rwn)
5{in(ch_MGNT:DATA_WSN:|*,id(),sink_data_msg());
6 hubETA-DATA_WSN[];
7 subprocessDecitelatedData(*){
8 hubETA-a_dec(DATA_WSN,RET)[ABS-CTN,120];
9 hubETA-a_dec(DATA_WSN)[];
10 hubETA-b_mem[];
11}
12
13
14
15
16
17
18
19



Last but not least, the Manager, represents a host, which is not available (and not needed) in a real-life deployment. As brought up earlier, its role is to work only as a helper host, which manages packet flows in our simulation. The Manager host consists of two processes, namely PrepareMessages and Main processes. The PrepareMessages process is responsible for creating lists of sensors, which belong to appropriate sinks along the transmission line (lines 7-39). Another function of this process is to maintain the list of sinks (lines 41-64), to which [PERSON] has to send the initial message, which then starts the data gathering and routing process. Acting as a fundamental managing process, Main process' first job is to inform each sink along the transmission line, from which sensors they can collect data from. [PERSON] does that by sending the nodes_msg() type message (lines 69-84) to every sink. After sinks notification, [PERSON] copies the list of all the available sinks (line 86) and collects information indicating end of data gathering process from TelosB sensors (lines 88-92). When all nodes_msg() messages are gathered, [PERSON] prepares an empty list, which will be further send to each cluster, starting data routing process (being optionally encrypted before (lines 95-99)). Next, a list of all sinks (which are initiators of data routing within a cluster), is copied to a temporary variable (line 101). The last activity of the Manager host is to send the empty message to all the sinks, which initiate communication towards the base station within a given cluster (lines 103-109). [PERSON] simply takes an ID of the sink from previously prepared list (line 105), removes it from mentioned list (line 106) and prepares a message (an empty list, actually, line 107), which is next send to each sink, one by one, until the list ends (line 108). In order to determine the transmission time of the packets being sent through the transmission grid, we implemented an algorithm, which calculates the transmission time between two sensors (Listing 7).