gridsim
Class GridSim

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--eduni.simjava.Sim_entity
              |
              +--gridsim.GridSim
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
GridInformationService, GridResource, GridSimShutdown, GridStatistics

public class GridSim
extends eduni.simjava.Sim_entity

The top most GridSim class that all GridSim entities need to extend to become concurrent entities. They automatically inherit all properties of entity which extends thread class. All entities extending GridSim should defined a body() method inwhich entitity actions (e.g., raising, processing, and receiveing events to communicate with other entities) are performed. When the execution of an entity is initiated by Start method, the method body() is automatically invoked by entity thread. Entities should exit body() method when there are no more interested in handling events.


Field Summary
protected  eduni.simjava.Sim_port input
           
protected  eduni.simjava.Sim_port output
           
static gridsim.GridSimRandom rand
           
static java.util.Date SimulationStartDate
           
 
Fields inherited from class eduni.simjava.Sim_entity
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GridSim(java.lang.String name)
          Entity WITHOUT NETWORK communication channels: "input" and "output" Sim_port.
GridSim(java.lang.String name, double baud_rate)
          Entitity with NETWORK communication channels: "input" and "output" Sim_port
 
Method Summary
static double Clock()
          Get Current Simulation Time.
protected  void finalize()
          Invoked by the garbage collector to clearn up any data
static int GetEntityId(java.lang.String EntityName)
          It returns ID (int value) of the Entity given its name
 java.lang.String GetEntityName()
          Returns the name of the current entity
static java.lang.String GetEntityName(int EntityID)
          Returns name of the entity given its Entity ID
 java.util.LinkedList GetGridResourceList()
          It send sends a request to GIS entity to get the list of Grid resources.
 gridsim.ResourceCharacteristics GetResourceCharacteristics(int resource_id)
          Get Resource Characteristics.
 gridsim.Accumulator GetResourceDynamicInformation(int resource_id)
          Get Resource Dynamic Information
static java.util.Date GetSimulationStartDate()
           
static int GridInformationServiceEntityId()
          It returns ID of the Entity named "GridInformationService"
protected  void GridletCancel(gridsim.Gridlet gl, int resource_id)
           
protected  gridsim.Gridlet GridletReceive()
           
protected  void GridletSubmit(gridsim.Gridlet gl, int resource_id)
           
 void GridSimHold(double duration)
          Causes the entity to hold for duration units of simulation time.
static int GridSimShutdownEntityId()
          It returns ID of Entity named "GridSimShutdown"
static int GridStatisticsEntityId()
          It returns ID of the Entity named "GridStatistics"
static void Init(int no_of_users, java.util.Calendar cal, boolean traceFlag, java.lang.String[] exclude_from_file, java.lang.String[] exclude_from_processing, java.lang.String ReportWriterName)
          Initialise GridSim Parameters.
 boolean IsNetworked()
          Check type of entity
protected  java.lang.Object ReceiveEventObject()
           
protected  java.lang.Object ReceiveEventObject(eduni.simjava.Sim_port source_port)
           
 void RecordStatistics(java.lang.String category, boolean data)
           
 void RecordStatistics(java.lang.String category, double data)
           
 void RecordStatistics(java.lang.String category, int data)
           
 void RecordStatistics(java.lang.String category, java.lang.String data)
           
protected  void Send(int EntityID, double delay, int GridSimTag)
           
protected  void Send(int EntityID, double delay, int GridSimTag, java.lang.Object data)
           
protected  void Send(eduni.simjava.Sim_port dest_port, double delay, int GridSimTag)
           
protected  void Send(eduni.simjava.Sim_port dest_port, double delay, int GridSimTag, java.lang.Object data)
           
protected  void Send(java.lang.String EntityName, double delay, int GridSimTag)
          Send Event/Message to Entity by 'delay' simulation time from now with user-defined tag representing the type of event.
protected  void Send(java.lang.String EntityName, double delay, int GridSimTag, java.lang.Object data)
           
protected  void ShutdownGridStatisticsEntity()
          This method should be invoked by User Defined ReportWriter if report writter is NOY defined (null) during Init, then GridSimShutDown will invoke it
protected  void ShutdownUserEntity()
          This should be invoved by all User Entities.
static void Start()
          Start the execution of GridSim simulation.
static void Stop()
          Stop Grid Simulation.
protected  void TerminateInputOutputEntities()
          It termindates Entities managing NETWORK communication channels Can be invoked explicity to shutdown NETWORK communication channels.
 
Methods inherited from class eduni.simjava.Sim_entity
add_param, add_port, body, get_id, get_name, get_port, get_port, run, send_on, set_invisible, sim_cancel, sim_current, sim_get_next, sim_get_next, sim_hold_for, sim_hold, sim_putback, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_select, sim_trace, sim_wait_for, sim_wait, sim_waiting, sim_waiting
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

input

protected eduni.simjava.Sim_port input

output

protected eduni.simjava.Sim_port output

SimulationStartDate

public static java.util.Date SimulationStartDate

rand

public static gridsim.GridSimRandom rand
Constructor Detail

GridSim

public GridSim(java.lang.String name)
Entity WITHOUT NETWORK communication channels: "input" and "output" Sim_port.


GridSim

public GridSim(java.lang.String name,
               double baud_rate)
Entitity with NETWORK communication channels: "input" and "output" Sim_port

Method Detail

TerminateInputOutputEntities

protected void TerminateInputOutputEntities()
It termindates Entities managing NETWORK communication channels Can be invoked explicity to shutdown NETWORK communication channels. It is advisable for for all entities extending GridSim class, explicityly invote this method to terminate Input and Output entities created by the constructor: GridSim(String name, double baud_rate)


finalize

protected void finalize()
Invoked by the garbage collector to clearn up any data

Overrides:
finalize in class java.lang.Object

IsNetworked

public boolean IsNetworked()
Check type of entity

Returns:
true if entity has NETWORK communication channel

GetSimulationStartDate

public static java.util.Date GetSimulationStartDate()

Init

public static void Init(int no_of_users,
                        java.util.Calendar cal,
                        boolean traceFlag,
                        java.lang.String[] exclude_from_file,
                        java.lang.String[] exclude_from_processing,
                        java.lang.String ReportWriterName)
Initialise GridSim Parameters. This should be called before creating any entities.

Parameters:
no_of_users - The number of User Entities created. This parameters indicates that GridSimShutdown first waits for User Entities's END_OF_SIMULATION signal before issuing terminate singal to other entities.
cal - The calender object for storing peaktime, holiday, etc. time
traceFlag - true if GridSim trace need to be written.
exclude_from_file -
exclude_from_processing -
ReportWriterName - The name of the entities which is signaled to write write any specific report just before termination of the simulation.

Start

public static void Start()
Start the execution of GridSim simulation. It waits for complete execution of all entitities, i.e., until all entities thread reach non-RUNNABLE state by exiting from the body() method. Then, kills threads of all entities. Note: This method should be called after all the entities have been setup and added, and their ports linked.


Clock

public static double Clock()
Get Current Simulation Time.

Returns:
The current simulation time from the simulation clock

GridSimHold

public void GridSimHold(double duration)
Causes the entity to hold for duration units of simulation time.

Parameters:
duration - The amount of time to hold.

Stop

public static void Stop()
Stop Grid Simulation. This should be called only any of the user defined entities Explicitly want to terminate simulation during execution.


Send

protected void Send(java.lang.String EntityName,
                    double delay,
                    int GridSimTag)
Send Event/Message to Entity by 'delay' simulation time from now with user-defined tag representing the type of event.

Parameters:
EntityName - The name of the destination entity
delay - How long from the current simulation time the event/message should be delivered
GridSimTag - An user-defined number representing the type of event/message

Send

protected void Send(java.lang.String EntityName,
                    double delay,
                    int GridSimTag,
                    java.lang.Object data)

Send

protected void Send(int EntityID,
                    double delay,
                    int GridSimTag)

Send

protected void Send(int EntityID,
                    double delay,
                    int GridSimTag,
                    java.lang.Object data)

Send

protected void Send(eduni.simjava.Sim_port dest_port,
                    double delay,
                    int GridSimTag)

Send

protected void Send(eduni.simjava.Sim_port dest_port,
                    double delay,
                    int GridSimTag,
                    java.lang.Object data)

ReceiveEventObject

protected java.lang.Object ReceiveEventObject()

ReceiveEventObject

protected java.lang.Object ReceiveEventObject(eduni.simjava.Sim_port source_port)

GridletSubmit

protected void GridletSubmit(gridsim.Gridlet gl,
                             int resource_id)

GridletReceive

protected gridsim.Gridlet GridletReceive()

GridletCancel

protected void GridletCancel(gridsim.Gridlet gl,
                             int resource_id)

GetEntityName

public java.lang.String GetEntityName()
Returns the name of the current entity


GetEntityName

public static java.lang.String GetEntityName(int EntityID)
Returns name of the entity given its Entity ID


GetEntityId

public static int GetEntityId(java.lang.String EntityName)
It returns ID (int value) of the Entity given its name


GridStatisticsEntityId

public static int GridStatisticsEntityId()
It returns ID of the Entity named "GridStatistics"


GridInformationServiceEntityId

public static int GridInformationServiceEntityId()
It returns ID of the Entity named "GridInformationService"


GridSimShutdownEntityId

public static int GridSimShutdownEntityId()
It returns ID of Entity named "GridSimShutdown"


ShutdownUserEntity

protected void ShutdownUserEntity()
This should be invoved by all User Entities. GridSimShutdownEntity waits for all Users termination before shuting down other entities.


ShutdownGridStatisticsEntity

protected void ShutdownGridStatisticsEntity()
This method should be invoked by User Defined ReportWriter if report writter is NOY defined (null) during Init, then GridSimShutDown will invoke it


GetGridResourceList

public java.util.LinkedList GetGridResourceList()
It send sends a request to GIS entity to get the list of Grid resources.

Returns:
A LinkedList containing GridResourceId as Integer Object.

GetResourceCharacteristics

public gridsim.ResourceCharacteristics GetResourceCharacteristics(int resource_id)
Get Resource Characteristics.

Parameters:
resource_id - The resource id
Returns:
An object of the class ResourceCharacteristics containing resource characteristics.

GetResourceDynamicInformation

public gridsim.Accumulator GetResourceDynamicInformation(int resource_id)
Get Resource Dynamic Information

Parameters:
resource_id - The resource id
Returns:
An object of the class Accumulator containing load on a resource. The Accumulator.mean() method can return that average load on a resource when invoked.

RecordStatistics

public void RecordStatistics(java.lang.String category,
                             double data)

RecordStatistics

public void RecordStatistics(java.lang.String category,
                             int data)

RecordStatistics

public void RecordStatistics(java.lang.String category,
                             java.lang.String data)

RecordStatistics

public void RecordStatistics(java.lang.String category,
                             boolean data)