Pages

Subscribe:

Ads 468x60px

5/5/11

How to make a visualisation of caverage

In my project, i have create a limitation such as :
1. Size of coverage area is 100 x 100 m
2. Total of sensor that used is 4 sensors
3. Every sensor's radius are randomly pick base on the table bellow :
The table itself is taken from Sami J. Habib's paper Modeling and simulating coverage in sensor networks. For visualize the area in Java, firstly we create a new class in NetBean like this :
*Because i have create firstmutation.java for this project.
a new class is created and import these for create a GUI :
import java.awt.*;
And because we make a class that have a characteristic of class Frame, since we need to make a frame for GUI. So, it should be like this :
i set class secondmutation extends Frame as a main class, that's why on class main, i make an object from secondmutation extends Frame class. Which lead the running program to method secondmutation, where's the CanvasKu is called. In method secondmutation, we set the size of frame with this syntax:
setSize(160,160);
Then, make an object of class CanvasKu, and we add that object on the frame. The object will call the progress from class Canvasku where's i put the program of inisialitation and coverage's calculation there. Since CanvasKu is a class that create a canvas on top of frame, so it should have characteristic like Canvas class. That's why the program is should be like this :
And the output of this program would be like this :
because it's random so the second run and another would be different, such as:









0 comments:

Post a Comment