Lightweight Bartering Grid

lbg.simulator
Class SimulatorEnvironment

java.lang.Object
  extended by lbg.simulator.SimulatorEnvironment
All Implemented Interfaces:
ISimulator

public class SimulatorEnvironment
extends java.lang.Object
implements ISimulator

Author:
Cyril Briquet

Constructor Summary
SimulatorEnvironment(Simulator sim, java.util.Properties scenario_props, java.lang.String scenario_filename)
           
 
Method Summary
 void activateLocalScheduling()
           
 void addJobSubmission(UserAgent user, java.lang.String peer_id)
          ISimulator implementation.
 EnvironmentController controller()
           
static SimulatedResource[] createPeerResources(InternalPeerHandle owner_peer, int peer_power, int res_count, int lo_power, int hi_power, int cache_capacity, int mtbf, EventList event_list)
          Creates Resources for target Peer.
 EventList eventList()
           
 long extraSelfEvents()
           
 Scenario scenario()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimulatorEnvironment

public SimulatorEnvironment(Simulator sim,
                            java.util.Properties scenario_props,
                            java.lang.String scenario_filename)
                     throws GridException
Throws:
GridException
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

scenario

public Scenario scenario()

extraSelfEvents

public long extraSelfEvents()

eventList

public EventList eventList()

controller

public EnvironmentController controller()

activateLocalScheduling

public void activateLocalScheduling()
                             throws GridException
Throws:
GridException

addJobSubmission

public void addJobSubmission(UserAgent user,
                             java.lang.String peer_id)
                      throws GridException
ISimulator implementation.

Specified by:
addJobSubmission in interface ISimulator
Throws:
GridException

createPeerResources

public static SimulatedResource[] createPeerResources(InternalPeerHandle owner_peer,
                                                      int peer_power,
                                                      int res_count,
                                                      int lo_power,
                                                      int hi_power,
                                                      int cache_capacity,
                                                      int mtbf,
                                                      EventList event_list)
                                               throws GridException
Creates Resources for target Peer.

Power repartition between Resources depends on PEER_POWER, RES_COUNT, RES_POWER_LO, RES_POWER_HI..

Power repartition algorithm:

        if (res_count == 0) {
                // random number of Resources, variable Resource power (in [lo..hi])
        }
        else if (res_count > 0) {
                if (peer_power > 0) {
                        // fixed number of Resources, fixed Resource power (= peer_power / res_count)
                }
                else if (peer_power == 0) {
                        // fixed number of Resources, variable Resource power (in [lo..hi])
                }
        }

Throws:
GridException

Lightweight Bartering Grid

Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.