# Secure and Time-Aware Communication of Wireless Sensors Monitoring Overhead Transmission Lines
## 4 Transmission Grid Model in Quality of Protection Modeling Language
### Model Description  
Analyzing the transmission line monitoring scheme, we utilized the QoP-ML to prepare a functional model of the considered segment of smart grid environment. We gathered and used real hardware security metrics and developed appropriate scenarios in order to examine how different factors influence transmission time delays, lifetime of sensor devices, confidentiality, integrity, and availability of the data traversing transmission grid environments. In this section, we briefly discuss all the elements we prepared to create the transmission grid models, and analyze the results we gathered using the Automated Quality of Protection Analysis (AQoPA) tool [19]. (The AQoPA tool performs the automatic evaluation and optimization of complex system models which are created in QoP-ML.) In this article, describing our model, we considered only the scenario where \(\eta=2\). (However, remaining scenarios are designed analogically, so they can be understood without further explanation.) Both the models and the AQoPA tool can be downloaded from the QoP-ML's project webpage [20]. In QoP-ML, in order to perform a simulation, one needs to prepare and implement 3 basic elements, namely: the model itself, hardware security metrics and miscellaneous scenarios of the considered environment (which are also called versions). For more information about QoP-ML, its syntax, semantics, algorithms and example usages, please refer to [17; 21]. Before we present implementation details, let us describe the model in general. We have 4 types of communicating hosts: manager, sink, sensor and a substation (in our model referred to as the base station). While there is no manager in a real life deployment of the considered scenario, its abstraction in QoP-ML needs the manager to handle proper packet flows. Manager stores lists of sinks and sensors, and knows which sensor is assigned to which sink. Its main role is to send control messages to sink nodes, in order to give them instructions from which sensors they should collect data from, or when it is the best time for performing data transmission to the substation. Sink nodes receive a list of its sensors from manager, generate some parameters, send them to assigned motes and wait for the collected data. After the data is collected, sensors send it to their relay node. When the relay node receives a message from each of four sensors and the manager, it immediately starts the routing to the substation. Communication ends when the base station receives packets from all the sinks that connect directly. In Listing 1 we present functions prepared for the transmission grid model. Lines 3-7 contain declaration of functions, which are used by the manager to, for instance, handle the division of sensors to proper sinks. Functions representing the type of the message traversing the transmission grid environment are defined in lines 8-14. Symmetric encryption and symmetric decryption functions (lines 16-17) take two functional arguments, the data to be encrypted/decrypted (data) and the key used for encryption/decryption (K). Besides functional arguments, s_enc and s_dec take two additional, QoP parameters: the algorithm used for encryption/decryption, and the size of the key in bytes (key_size). Remaining functions (lines 19-21) refer to data collection, and are fairly self-explanatory. ```
functions {  run empty_list():  run add_to_list(list, element);  run get_from_list(list);  run go_list();  run i_list_empty(list);  run node_msg();  run i_tok_data_msg();  run j_msg();  run data_collection_msg();  run data_msg();  run k_enc(k,)[Time: algorithm_key_size);  run_dec(data,K)[Time: algorithm_key_size];  run generate_params(node_id);  run collected_data();  run k_exec_collected_data(data); }
```  
Listing 1: QoP-ML's functions prepared for a transmission grid model. ```
Listing 2: QoP-ML's equations prepared for a transmission grid model. Secure communication between sinks all over transmission line is a crucial element in our simulation: communicating hosts need a medium to exchange messages.