# Integrated Evaluation of Reliability and Power Consumption of Wireless Sensor Networks
## 3 Methodology  
This section presents the proposed methodology to design WSN infrastructures and applications considering their power consumption and reliability. As mentioned in Section 1, the proposed methodology integrates reliability into the power consumption evaluation, and it is based on the generation and simulation of formal models described in CPN and RBD as shown in Section 4. The methodology presented in Figure 3 is divided into four phases: _Planning and Development_, _Improvement_, _Validation_ and _Deployment_. It includes a set of manual (white rectangles) and semi-automatic activities (grey rectangles), their connections (arrows), generated artefacts, decision points (diamonds) and a repository. A manual activity is one performed exclusively by the user, and a semi-automatic activity is primarily carried out by a tool and demands either no action or small intervention of the user. Decision points allow the user or a tool to select a particular flow of the methodology. Artefacts are generated as a result of an activity and serve as input to the next activity. Finally, the repository stores reusable models used to specify the power consumption. **Planning and Development. ** In this phase, the user defines the network and application conditions, and create the WSN based on these requirements. Hence, the first activity of the methodology, namely _Plan the WSN_, is a manual action whose objective is to define functional and non-functional requirements of the WSN and WSN applications. For example, the user should specify the operating system and programming language used to implement the WSN applications. He/she can also determine what kind of data the sensor node collects, WSN regions and lifetime, WSN deployment area, environment conditions (e.g., interference and noise), routing protocols and the number of sensor nodes. This information is put in _Planning Document_, which must be used for the next activity to create the WSN. Activity _Design the Application and Network_ creates the WSN based on _Planning Document_. The user manually implements the application code to be installed in the sensor node and creates the network design (e.g., WiseML [15]) that configures and deploys virtual sensor nodes at a virtual environment like in the real situation. These two artefacts (application code and network design) are based on the WSN planning and will be used to validate the WSN. **Improvement. ** In this phase, the user must analyse the WSN to find inconsistencies among the requirements or to improve the power consumption and reliability of the WSN, based on recommendations to all WSNs. Some inconsistencies can be found, and standards recommendations can be suggested only by analysing the features of the application code and the network design without their evaluation. This phase can be semi-automatic because some inconsistencies and recommendations are already known and common to WSNs. For example, if a sensor node has not a direct access to the sink node, protocols DIRECT and LEACH are not appropriate for this WSN, requiring choose another routing protocol or change the WSN configuration. This kind of check (e.g., if the distance between the sensor node and the sink node is less than or equal to the communication radius of the sensor node) can be performed without the CPN and RBD models. Regarding the application, an improvement could be to optimise the application code to reduce the power consumption of the sensor node. For example, the application should avoid parentheses or should use a constant instead of a variable when the value does not change. These patterns can be automatically analysed and suggested to the user, which must decide to apply or not the suggestion (activity _Make Improvements_). Furthermore, it is also important to guarantee that the proposed improvements do not conflict with the functional requirements defined in the _Planning Document_.