# Formal Modeling of IoT and Drone-Based Forest Fire Detection and Counteraction System
## 4 Specifying Model Formally Using VDM-SL
### Static Model
If the temperature rises from the threshold value, then the status of the sensor becomes active and fire information will be sent else the status remains sleep. The connection of the sensor node is enabled if and only if the neighbor set is not empty. ```
Humid::currenthumidreinalmathumidreinal; HumidSensor::nsnode:NODE hsdeployed:mapsetofNID toLocation connds:setofNODE humid:Humidreinalm  invmkHumidSensor(nsnode,hsdeployed,connds,humid)==forallsnodeinsetdomnsdeployed&snode=(hsnode.ndiad)and if humid.currenthumid>=humid.nathumidthenhsnode.status=<ACTIVE>and hsnode.fireinfo<<INFORTANSMIT>elsehsnode.status=<SLEEP>and hsnode.connect=true<=>connds<()and hsnode.connect=false<=>connds=();
```  
To detect the humidity level in the forest, the _HumidSensor_ was used as a composite object. The description of the fields is defined in the given table. The hsnode accesses attributes of the object NODE. The hsdeployed indicates that a set of sensor nodes are deployed at a specific location. The humid field records the current and natural humidity level. The _invariant_ is defined as: the group of sensors placed on trees and the ground to monitor the humidity level in the forest. If the humidity decreases, then the sensor's state changes to active and fire information is sent; otherwise, the status remains sleep. ```
\(\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{ \mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{}}}}}}}}}}}}}}\)\(\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\{{\mathtt{\mathtt{{                                {{}}}}}}{{}}}}}}\)
```  
```
\(\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{ \mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{ \mathtt{ \mathtt{ } \mathtt{\mathtt{\mathtt{ }}}}}}}}}}}}}}\)\(\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{ \mathtt{  \mathtt{ }}}}}}}}}}}}}}}\)\(\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{ \mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{\mathtt{ \mathtt{ \mathtt{ \mathtt{  }}}}}}}}}}}}}}}\)
```  
The third type of sensor is for detecting the flame emission described as _FlameSensor_ with six fields. The flamedeplyed denotes the deployment of a group of sensor nodes in a given area. The con_nds is used to show the connection between the nodes, and the flame emission field records whether the flame is emitted or not. In the _invariant_, it is described that if the flame emission is detected, then the status will be active, and the information is transmitted for actions; otherwise, the status will be asleep. The sensor nodes are linked if and only if the set of neighbor's nodes is not empty; otherwise, they are not connected. ```
\(\mathtt{\mathtt



GWNode = <IDLE>|<WORDING>|

GateWay: ignorode: NODE

sense: Sensor

gymode: GWMode

con gads: set of NODE

inv mk GateWay(gymode, sense, gymode, con_gnds) == gwnode.Power = <High>

and gymode = <IDLE> and gwnode.fireinfo = <INFORECEIVED> <=>

sense.detection = <FDETECTED> = gymode = <WORKING> and

gymode.signal = <SIGNAL SENDINGCR> and

gwnode.connect = true <=> con_gnds <> {} and

gwnode.connect = false <=> con_gnds = {};

The gateway node is the most powerful node defined as a _GateWay_ composite object with four fields, and the working is described. The gwnode is used to access the characteristics of the object NODE; this field is used. The sense denotes that the gateway will obtain information sensed by the sensors. The gymode is used to show the mode of the gateway if fire information is obtained, and the con_gnds field is used to show the neighbors of the gateway node.