Anda di halaman 1dari 30

IoT Workshop-2019

CupCarbon
Starting CupCarbon
In windows java –jar filename.jar
Launch CupCarbon.

Creating a new project


Before adding objects you must create a new project (Project -> New Project).
The project must be saved (Project -> Save Project). It is also possible to create
a new project by starting with the same environment as the current one (Project -> New Project From the Current).
Add/Delete objects
You can add an element by clicking on the values 1 to 8 or by
choosing the element to add directely from the tool bar.

Sensor
Gas
Flying objects
Media Sensor
Base station
Mobile
Marker
To delete an object, select it and then press 'del'.
Moving objects/markers
To move objects or marker, select it and the press m. Do not click on any button of the
mouse, just move it. To stop moving an object either click on the map or by pressing on
Escape (esc) key.

Duplicate Sensors [Not recommended in this version] DEPRECATED


It is possible to duplicate a sensor by selecting it and pressing on c. Please do not
use this option in this version.
Display the parameters of an object
1. Select a node (object)
2. Click on Menu -> Nodes -> "Device Parameters"
3. Any keyboard key to display the parameters
Device manipulation
It is possible to modify some visual parameters of a sensor (or
another object).
k : hide/show the selected object
h : show parts of the sensor (you can click many times to see the
different parts)
j : show all the parts of the object
d : hide/show the sensor name (S+id)
S : independent simulation (mobility) of the selected device
(capital s). This simulation is used only for the verification.
q : stop the simulation in the scenario mode
m : move
CTRL z/y : undo/redo
i : invert the selection
r : show/hide the informations of the selected sensor
v : show/hide the radio link
b : show/hide the battery level and the buffer level
w : select some objects by their type
x : show/hide the distance between sensors
( : decrease the sensor unit radius
) : increase the sensor unit radius
- : decrease the radio radius
+ : increase the radio radius
a : show the radio link arrows of a selected sensor node
A : show the arrows of the markers
CTRL a : Select all

Simulate a mobile
Do not confound the WSN simulation and the mobile simulation. The mobile
simulation allow you to validate that the simulation corresponds to what you want
to do. This will be taken into account automatically in the WSN simulation.
Print hi : To Print Something
set x abcd : To Assign the Value
Plus : Addition
Minus : Subtraction
Mult : Multiplication
Mod : Modulus
Inc : Increment
Dec : Decrement
For z 0 11 : for (z=0;z<=11;z++) end
Delay : Delay
Mark 1 : light on
Mark 0 : Light off
Rand : random function
Hello World

Steps : Project-> New Project -> Add Sensor->Simulation->


Communication Script-> Give File Name & Type Your Script ->
Save-> Selection-> Select Sensor By ID-> Nodes-> Device
Parameters-> Select Script File - > Click On Arrow(Run)
Run it

loop
println Hello World
stop
Addition
Steps : Project-> New Project -> Add Sensor->Simulation->
Communication Script-> Give File Name & Type Your Script ->
Save-> Selection-> Select Sensor By ID-> Nodes-> Device
Parameters-> Select Script File - > Click On Arrow(Run)
Run it

loop
set a 7
set b 8
plus x $a $b
println a + b = $x
stop

HOW to Print table of 7 ????


Print a Table of 7
set a 7
loop
for b 0 11
mult x $a $b
println $a X $b = $x
delay 1000
end
Mark LED
Loop
Mark 1
stop
Blink LED
loop
mark 1
delay 1000
mark 0
delay 1000

Generate Arduino code


Change the Colors of LED
loop
for i 0 15
led 13 $i
delay 1000
end
DJ Mixer
loop
rand x
if($x<0.5)
mark 1
else
mark 0
end
delay 10
Generate Arduino code
Send Data from 1 Sensor to Another Sensor

//Transmitter
loop //Receiver
send 1 loop
delay 1000 wait
send 0 read v
delay 1000 mark $v
Routing

//Router
loop
wait
read v //Receiver
send $v 4 loop
wait
//Transmitter read v
loop mark $v
send 1 //Router
delay 1000 loop
send 0 wait
delay 1000 read v
send $v 3
Broadcasting
1 transmitter 4 receivers

//Transmitter
//Receiver
loop
loop
send 1
wait
delay 1000
read v
send 0
mark $v
delay 1000
areadsensor (Analog Read Sensor)
atpl 60-> Change the signal power
atnd x -> x = the number of the neighbors of the sensor
coord
coord x y t-> Change the coordinates of the sensor to the
latitude (x)
distance x 2 -> x = the Euclidean distance
dreadsensor x -> Read the value of the detected event
getpos2 x y -> x = longitude and y = latitude
send $p *-> Sends the value of p in a broadcast mode(the
//receiver
//sensor
loop
loop
wait
dreadsensor s
read v
send $s
println $v
delay 1000
mark $v
Moving Sensors
Select two sensors node - > select Mobile Sensor -> Select Marker and add path ->
goto Marker paramaeters -> route from maker to insert marker and save it -> add
senscript to sensor nodes(s1: sensor,s2: receiver & m3: route1.gps) ->goto simulation
parameter and click on mobility event-> start simulation
Move the sensor

//Moving
print route1
set step 1 //receiver
loop loop
if($step == 1) wait
send A read x
wait 1000 if($x==A)
read d data d B route2
rdata $d x r send $d
if($x==B) end
print $r
mark 1
set step 2
route $r
end Moving Sensors
end Select two sensors node - > select Mobile Sensor -> Select Marker and add
if($step == 2) path -> goto Marker paramaeters -> route from maker to insert marker and
stop save it -> add senscript to sensor nodes(s1: moving & route1.gps,s2: receiver)
end ->goto simulation parameter and click on mobility event-> start simulation
The D-LPCN algorithm allows to find the boundary sensor nodes of a network. It
starts from any boundary sensor node (for example, the one in the extreme left).
Then, each node calculates the angles formed by the previously found boundary
node and each one of its neighbors; and then it chooses the node that forms the
smallest angle as the next boundary node. To write this algorithm, we will use 3 types
of messages. A message AC to ask the neighbors to send their coordinates, a message
CS for sending the coordinates and a message SN to inform a sensor that it is a
boundary node.
The D-LPCN algorithm
1) Step 1 (lines 1 to 4): Initialization.
2) Step 2 (line 5): Run Algorithm 2(Find the minimum Angle) to determine whether the
current node is a starting node or not.
3) Step 3 (lines 6 to 10): If the current node is a starting node than it launches the D-LPCN
algorithm by broadcasting the “AC” message to its neighbors in order to ask for their
coordinates.
4) Step 4 (lines 12 to 13): Each node is waiting to receive a message.
5) Step 5 (lines 14 to 17): The variable i determines the number of received “CS”
messages. Receiving n “CS” messages means that the coordinates of all neighbors have
been received.
6) Step 6 (lines 18 to 20): If the node receives an “AC” message then it will send a “CS”
message containing its coordinates to the transmitter having the identifier id.
7) Step 7 (lines 21 to 27): For all received “CS” messages, the node calculates the
minimum angle formed with them by taking into account the intersections with the
received boundary set (in line 15). This calculation is done using the function angleWI
(angle without intersections).
8) Step 8 (lines 28 to 23): The reception of an “SN” message by a node means that this
node has been selected as a boundary node by its previous boundary neighbor node.
This node will then restart the process of finding the next boundary node by
broadcasting a “CS” message.
DLCPN ALGO

//Minifind
simulation 0 2
atget id cid
getpos2 vmin y
set marked 1
send $vmin
loop
mark $marked
wait 2000
read v
if($v == \)
if ($marked == 1)
simulation 0 100
set first $cid
delay 1000
else
set first -3
end
script dlpcn
else
if ($v < $vmin)
set marked 0
set vmin $v
send $v
end
end
//dlcpn

atget id cid if ($type==AC) if ($type==SN)


getpos2 cx cy data p $cid CS $cx $cy if($first==-1)
loop send $p $id stop
if ($cid==$first) end end
set first 0 if($first==0)
minus px $cx 1 if ($type==CS) set first -1
set py $cy rdata $p id type x y end
data p 0 $type $px $py angle2 a $px $py $cx $cy $x $y rdata $p id type px py
set type SN data p $id $a mark 1
else smin m $m $p data m $cid 10
wait rdata $m id a atnd n
read p inc i set i 0
rdata $p id type if($i==$n) data p $cid AC
end data p $cid SN $cx $cy send $p
send $p $id end
end
end
Algorithms

•JARVIS Algorithm
•LPCN & LPCN MOBILE (Least Polar-
angle Connected Node Algorithm)
•Graham Algorithm

•MAP
Graham Algorithm

• As one can see, PAB and


ABC are
counterclockwise, but
BCD isn't. The algorithm
detects this situation
and discards previously
chosen segments until
the turn taken is
counterclockwise (ABD
in this case.)
Smart City Project

• Using LPCN Mobile


Algorithm
THANK YOU & ANY
What’s Your Message?
QUESTIONS ?????
Likhesh Kolhe :
8793465361/8551876323
likhesh8@gmail.com

Anda mungkin juga menyukai