PlanetSim Peer-to-peer Simulator

Last semester, i worked on the project titled “Security Framework over Peer-to-Peer Overlays” under my professor Chittaranjan Hota, Ph.D. I was asked to work on a p2p simulator to produce some simulation results for the framework designed. I have searched for many simulators like p2psim, ns2 etc.. Some are very hard to learn while others do not suit my purpose. Finally i came across PlanetSim, a java based simulator shipped with a nice API documentation and tutorials. Installing this simulator is not just an easy task. I have come across several installation issues, which i managed to cross after several google searches. I thought why not i post the article on the installation and usage of this simulator so that others will not necessarily do more groundwork for installing it.

Requirements:

  1. PlanetSim Source
  2. Apache Ant
  3. JDK (1.4+)
  4. Windows/Linux PC

Installation Steps:

  1. Install JDK
  2. Copy tools.jar from C:\Program Files\Java\jdk1.6.0\lib to C:\Program Files\Java\jre1.6.0\lib
  3. Extract the source packages of PlanetSim and Ant into the desired directory.
    Note: I assume that the folders are extracted to C:\. i.e. C:\planetsim and C:\ant
  4. Create the environmental variables for ClassPath, ANTHome, ANTPath and JavaHome

    ANT_HOME
    c:\antCLASSPATH
    .;%ANT_HOME%\lib\ant.jar;%ANT_HOME%\lib\jaxp.jar;
    %ANT_HOME%\lib\parser.jar;C:\planetsim\src;

    JAVA_HOME
    c:\Program Files\Java\jdk1.6.0\bin

    Path
    .;%ANT_HOME%\bin;

The most difficult issue arises in adding the environment variables. To add environment variables, Right Click on MyComputer -> Properties -> Advanced tab -> Environment Variables (button).

The first set of variables are Local/User variables and those are applicable to that particular user who logged on the system. The Second set, called System variables are global to whole system.

You can view, edit or delete the keys in this GUI window…

Environmental variable Path is set to .;%ANT_HOME%\bin. here ‘.;‘ conveys that, if the environment variable is already present, then append the rest of the path to the specified path.

If you still find problem installing the environment variables, please contact me.

Testing:

  1. Change the working directory to %ANT_HOME
    C:\> CD %ANT_HOME
  2. Test the command ANT by executing it in the terminal
    c:\> ANT
  3. If you get the following output in the above step, then ANT installation is successful. Else, environmental variables are not set properly.
    Buildfile: build.xml does not exist!
    Build failed

From now, all the working folder paths will refer to the following

ANT Home : C:\ant\bin
PlanetSim : C:\planetsim\bin

Final Execution:

  1. Now, change your working directory to Planetsim. i.e. C:\planetsim\bin.
  2. Execute ant.
    C:\planetsim\bin> ant
  3. The above command should build the default XML file that is shipped with the simulator. The output of the command should say build successful by listing some options for you.
  4. Run the following command to build the jar file of the source code. (This step can be skipped for testing purpose as by default, planetsim is shipped with a built jar file. If you make any changes in the source code, then you need to rebuild the jar file again with this command.)
    C:\planetsim\bin> ant jar
  5. Lastly, running the following command will generate the simulation reports.
    C:\planetsim\bin> ant test

More about how to modify the source code and how to refer to documentation, shall be provided on request. Please feel free to contact me.

11 Responses to “PlanetSim Peer-to-peer Simulator”

  1. prasad Says:

    Hi Nice article. could you help me out on deciding whether this tool can be used for a bittorrent simulation project. I need sort of 50-60 logical computers to simulate which run a bittorrent app
    thanks

  2. rozlina Says:

    Thanks, I manage to run the test by following your instruction. But, how to set the network as ’super-peer P2P’? which code need to be change @ add? Thanks.

  3. Alex Roslyakov Says:

    Please send me adress e-mail Mr. Chittaranjan Hota

  4. Sijan Says:

    nice article.I could not setup the environment variable.Could anyone help me in step 4 of installation step?

  5. techgeekonline Says:

    Hi Sijan

    In windows, you can set the variables in MyComputer -> Properties -> Advanced tab -> Environment Variables (button).

    If the env variable already exists, then modify it.. you can search google on How to set environmental variable

  6. Sijan Says:

    Hi,
    I set the variables now and try testing .When i enter the command C:>Ant ,a merror message came,
    ” java.exe” is not recognized as an internal or external command,operable program or batch file.

    I have installed jdk and jre.Can anyone help please.
    thank you in advance.

    Sijan.

  7. Karm Says:

    Does anybody know how to generate events files like join_1000.txt ? (stored in /bin/data/ )

    To Sijan:
    Try to fix your classpath

  8. kalpesh Says:

    respected sir;

    i want to know how to run the helloworld source program (C:\planetsim\src\planet\test\helloworld) with planetsim.
    and i also want to know how to generate simulation report.

    plese give me kindly ur suggestion.

    thank you sir
    with regards
    kalpesh yadav

  9. kalpesh Says:

    please send me reply at kalpesh.1483@gmail.com

  10. ana Says:

    thnx for publishing this article :)

  11. Karm Says:

    Hi people,
    how to save-and-load the whole network?
    How to create a chord network from the file?


Leave a Reply