A Model for the Internet of Things
8.5 Implementation
To validate the use of mobile agents and the PherCon-C mechanism, a network of five nodes was set up using a LAN. Each node constituted a
computer running the AgentSpace [183] mobile agent platform. To demonstrate the working of a heterogeneous network, we used an ultrasonic sensor wirelessly connected to one of the nodes and a Lego NXT® [157] mobile robot connected to another. The latter used a Bluetooth® link to communicate with the node it was connected to. The programs were coded using the Java library for Lego NXT® robots running on LeJOS [160] just as described in the previous chapter. Mobile agents populating the network were capable of moving across the nodes of the network and also communicating with both the sensor and the robot as and when they landed up at the respective nodes connected to them. PherCon-C was used as the underlying mobile agent migration mechanism in this implementation.
8.5.1 SfR and PaS Scenarios
We implemented a problem that required both SfR and PaS to be carried out by the different agents populating the network. Two types of agents were released – one that was capable of SfR and the other of PaS. The former was capable of finding a resource. In this application the SfR could search the network and find a robot (resource) that is currently free and could perform a given task. Agents that carry the source code for task related to a robot, as its payload, constituted the PaS type. The Internet of Things based scenario is described below.
8.5.2 The Internet of Things Scenario
Figure 8-3 shows an aerial view of the experimental set-up used to demonstrate the working of the Internet of Things. The MAF based nodes are of the type depicted in Figure 8-1 and their topology has been superimposed on the snapshot for a better understanding.
The analogy of the set-up could be described as follows. A sensor is mounted on a scare-crow positioned in a field. As and when a stubborn bird or intruder is detected in its vicinity it requires the services of an actuating device to scare it away. Intruders like the bird can thus be driven away if a robot reaches the vicinity of the sensor.
In the implementation the ultrasonic sensor placed in the field was programmed to trigger as and when it detected the presence of an obstacle that intruded its sensing range. Since the sensor is immobile, it needs a resource that can remove the obstacle away to a safe distance from it.
Fig. 8-3 Snapshot of the aerial view of the actual experimental setup with
the network topology superimposed on it. The green lines indicate the connection
between the nodes while the orange and blue lines depict the path traced by the
SfR and PaS type agents respectivelyWhen the ultrasonic sensor connected wirelessly to node 4 detects such an intruder or obstacle within a certain distance, it sends a request for a robot (resource) which is free and capable of moving the obstacle away. This request
signal from the sensor to node 4 forces the MAF in the latter to spawn an SfR based mobile agent. This agent migrates across the network in a conscientious manner to search for a robot within the network that can service the problem at the sensor’s location. Idle robots within the network force the MAFs within the nodes they are tethered to, to diffuse pheromones, across their neighbours so as to indicate their willingness to act as a resource.
In Figure 8-3, the robot connected to node 1 forces the MAF within the node to pheromone in such a manner. These pheromones tend to attract the SfR type agents. The robot and the SfR mobile agent together use the PherCon-C strategy to discover one another. When the SfR agent hits the pheromone trail it travels to the node where the robot is tethered and provides information regarding the sensor’s bearings and nature of request. The robot checks if it has the relevant program required to service the sensor locally. If it does not then it forces the MAF within its associated node (node 1) to diffuse pheromones that can attract those PaS type agents that carry the source code for the programs required to service the condition reported by the sensor. Once again the PherCon-C mechanism brings the relevant PaS agent populating the network to node 1. The node extracts the source code, compiles and downloads the code onto the robot which in turn executes it.
In the actual implementation we used a simple line following algorithm (service) to force the robot (resource) to move towards the vicinity of the sensor and then push the obstacle away. This path is depicted in Figure 8-3 in the form of a dark black line. The superimposed portions of the figure also depict the paths taken by the SfR and PaS agents. In the process if the robot is wirelessly delinked from its original node (Node 1) then it searches for an alternate node within its wireless range, connects to it and forces its MAF to commence pheromoning once again so as to indicate its availability as a free resource. All operations to recover from a contingency reported by the sensor are thus performed autonomously and actively by the SfR and PaS mobile agents and the devices that populate this network of things.