Professional Documents
Culture Documents
Final CupCarbon
Final CupCarbon
Final CupCarbon
CupCarbon
Starting CupCarbon
In windows java –jar filename.jar
Launch CupCarbon.
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.
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
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
//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
•JARVIS Algorithm
•LPCN & LPCN MOBILE (Least Polar-
angle Connected Node Algorithm)
•Graham Algorithm
•MAP
Graham Algorithm