|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--Thread | +--eduni.simjava.Sim_entity | +--gridsim.GridSim
The main class of the GridSim package that must be extended by GridSim entities. It inherits event management and threaded entity features from the eduni.simjava.Sim_entity class. This class adds networking and event delivery features, which allow synchronous or asynchronous communication for service access or delivery.
All classes that extend this class must implement a method called body(), which is automatically invoked since it is expected to be responsible for simulating entity behavior.
The entities that extend this class can be instantiated with or without networked I/O ports. A networked GridSim entity gains communication capability via the objects of GridSim's I/O entity classes, gridsim.Input and gridsim.Output classes. Each I/O entity will have a unique name assuming each GridSim entity that the user creates has a unique name. For example, a resource entity with the name `Resource2', will have an input entity whose name is prefixed with `Input_', making the input entity's full name `Input_Resource2', which is expected to be unique. The I/O entities are concurrent entities, but they are visible within the GridSim entity and are able to communicate with other GridSim entities by sending messages.
This class supports methods for simulation initilization, management and flow control. The GridSim environment must be initialized to set-up the simulation environment before creating any other GridSim entities at the user level. This method also prepares the system for simulation by creating three GridSim internal entities - gridsim.GridInformationService, gridsim.GridSimShutdown,gridsim.GridStatistics. Invoking the startGridSimulation() method starts the Grid simulation. All the resource and user entities must be instantiated in between invoking the above two methods.
This class supports static methods for sending and receiving messages between entities directly or via network entities, managing and accessing handles to various GridSim core entities, and recording statistics.
Sim_entity
,
Output
,
Input
,
GridInformationService
,
GridSimShutdown
,
GridStatistics
Field Summary | |
protected eduni.simjava.Sim_port |
input
Reading data received via input port |
protected eduni.simjava.Sim_port |
output
Sending data via output port to external entities |
static GridSimRandom |
rand
A Random object. |
static Date |
SimulationStartDate
Simulation start date with respect to GMT 0. |
Fields inherited from class eduni.simjava.Sim_entity |
|
Fields inherited from class Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
GridSim(String name)
Allocates a new GridSim object without NETWORK communication channels: "input" and "output" Sim_port. |
|
GridSim(String name,
double baudRate)
Allocates a new GridSim object with NETWORK communication channels: "input" and "output" Sim_port. |
Method Summary | |
static double |
clock()
Gets the current simulation time (based on Sim_system.clock()) |
static double |
Clock()
Deprecated. As of GridSim 2.1, replaced by clock() |
protected void |
finalize()
Deprecated. As of GridSim 2.1, replaced by finalizeGridSimulation() |
protected void |
finalizeGridSimulation()
It terminates Entities managing NETWORK communication channels |
static int |
getEntityId(String entityName)
Gets ID of the Entity given its name |
static int |
GetEntityId(String entityName)
Deprecated. As of GridSim 2.1, replaced by getEntityId(String) |
String |
getEntityName()
Gets the name of the current entity |
String |
GetEntityName()
Deprecated. As of GridSim 2.1, replaced by getEntityName() |
static String |
getEntityName(int entityID)
Gets name of the entity given its entity ID |
static String |
GetEntityName(int entityID)
Deprecated. As of GridSim 2.1, replaced by getEntityName(int) |
static int |
getGridInfoServiceEntityId()
Gets the ID of Entity named "GridInformationService" |
LinkedList |
getGridResourceList()
Sends a request to Grid Information Service (GIS) entity to get the list of Grid resources |
LinkedList |
GetGridResourceList()
Deprecated. As of GridSim 2.1, replaced by getGridResourceList() |
static int |
getGridSimShutdownEntityId()
Gets ID of Entity named "GridSimShutdown" |
static int |
getGridStatisticsEntityId()
Gets ID of Entity named "GridStatistics" |
ResourceCharacteristics |
getResourceCharacteristics(int resourceID)
Gets a ResourceCharacteristics object |
ResourceCharacteristics |
GetResourceCharacteristics(int resourceID)
Deprecated. As of GridSim 2.1, replaced by getResourceCharacteristics(int) |
Accumulator |
getResourceDynamicInfo(int resourceID)
Gets Resource Dynamic Information |
Accumulator |
GetResourceDynamicInformation(int resourceID)
Deprecated. As of GridSim 2.1, replaced by getResourceDynamicInfo(int) |
static Date |
getSimulationStartDate()
Gets simulation start date with respect to GMT 0. |
static Date |
GetSimulationStartDate()
Deprecated. As of GridSim 2.1, replaced by getSimulationStartDate() |
static int |
GridInformationServiceEntityId()
Deprecated. As of GridSim 2.1, replaced by getGridInfoServiceEntityId() |
protected void |
GridletCancel(Gridlet gl,
int resource_id)
Cancels a Gridlet object NOT YET IMPLEMENTED |
protected Gridlet |
gridletReceive()
Gets a Gridlet object passed in this event |
protected Gridlet |
GridletReceive()
Deprecated. As of GridSim 2.1, replaced by gridletReceive() |
protected void |
gridletSubmit(Gridlet gl,
int resourceID)
Sends a gridlet based on its resource ID to Entity |
protected void |
GridletSubmit(Gridlet gl,
int resourceID)
Deprecated. As of GridSim 2.1, replaced by gridletSubmit(Gridlet,
int) |
void |
gridSimHold(double duration)
Causes the entity to hold for duration units of simulation time |
void |
GridSimHold(double duration)
Deprecated. As of GridSim 2.1, replaced by gridSimHold(double) |
static int |
GridSimShutdownEntityId()
Deprecated. As of GridSim 2.1, replaced by getGridSimShutdownEntityId() |
static int |
GridStatisticsEntityId()
Deprecated. As of GridSim 2.1, replaced by getGridStatisticsEntityId() |
static void |
init(int numUser,
Calendar cal,
boolean traceFlag,
String[] excludeFromFile,
String[] excludeFromProcessing,
String reportWriterName)
Initializes GridSim Parameters. |
static void |
Init(int numUser,
Calendar cal,
boolean traceFlag,
String[] excludeFromFile,
String[] excludeFromProcessing,
String reportWriterName)
Deprecated. As of GridSim 2.1, replaced by init(int, Calendar, boolean, String[],
String[], String) |
boolean |
isNetworked()
Check type of entity |
boolean |
IsNetworked()
Deprecated. As of GridSim 2.1, replaced by isNetworked() |
protected Object |
receiveEventObject()
Gets the data passed in this event |
protected Object |
ReceiveEventObject()
Deprecated. As of GridSim 2.1, replaced by receiveEventObject() |
protected Object |
receiveEventObject(eduni.simjava.Sim_port sourcePort)
Gets the data passed in this event |
protected Object |
ReceiveEventObject(eduni.simjava.Sim_port sourcePort)
Gets the data passed in this event |
void |
recordStatistics(String category,
boolean data)
Records statistics during the event |
void |
RecordStatistics(String category,
boolean data)
Deprecated. As of GridSim 2.1, replaced by recordStatistics(String, boolean) |
void |
recordStatistics(String category,
double data)
Records statistics during the event |
void |
RecordStatistics(String category,
double data)
Deprecated. As of GridSim 2.1, replaced by recordStatistics(String, double) |
void |
recordStatistics(String category,
int data)
Records statistics during the event |
void |
RecordStatistics(String category,
int data)
Deprecated. As of GridSim 2.1, replaced by recordStatistics(String, int) |
void |
recordStatistics(String category,
String data)
Records statistics during the event |
void |
RecordStatistics(String category,
String data)
Deprecated. As of GridSim 2.1, replaced by recordStatistics(String, String) |
protected void |
send(int entityID,
double delay,
int gridSimTag)
Sends an event/message to Entity by 'delaying' simulation time from now with user-defined tag representing the type of event. |
protected void |
Send(int entityID,
double delay,
int gridSimTag)
Deprecated. As of GridSim 2.1, replaced by send(int, double,
int) |
protected void |
send(int entityID,
double delay,
int gridSimTag,
Object data)
Sends an event/message to Entity by 'delaying' simulation time from now with user-defined tag representing the type of event. |
protected void |
Send(int entityID,
double delay,
int gridSimTag,
Object data)
Deprecated. As of GridSim 2.1, replaced by send(int, double,
int, Object) |
protected void |
send(eduni.simjava.Sim_port destPort,
double delay,
int gridSimTag)
Sends an event/message to Entity by 'delaying' simulation time from now with user-defined tag representing the type of event. |
protected void |
Send(eduni.simjava.Sim_port destPort,
double delay,
int gridSimTag)
Deprecated. As of GridSim 2.1, replaced by send(Sim_port, double,
int) |
protected void |
send(eduni.simjava.Sim_port destPort,
double delay,
int gridSimTag,
Object data)
Sends an event/message to Entity by 'delaying' simulation time from now with user-defined tag representing the type of event. |
protected void |
Send(eduni.simjava.Sim_port destPort,
double delay,
int gridSimTag,
Object data)
Deprecated. As of GridSim 2.1, replaced by send(Sim_port, double,
int, Object) |
protected void |
send(String entityName,
double delay,
int gridSimTag)
Sends an event/message to Entity by 'delaying' simulation time from now with user-defined tag representing the type of event. |
protected void |
Send(String entityName,
double delay,
int gridSimTag)
Deprecated. As of GridSim 2.1, replaced by send(String, double,
int) |
protected void |
send(String entityName,
double delay,
int gridSimTag,
Object data)
Sends an event/message to Entity by 'delaying' simulation time from now with user-defined tag representing the type of event. |
protected void |
Send(String entityName,
double delay,
int gridSimTag,
Object data)
Deprecated. As of GridSim 2.1, replaced by send(String, double,
int, Object) |
protected void |
shutdownGridStatisticsEntity()
Tells all user entities that defined ReportWriter to shut down the simulation. |
protected void |
ShutdownGridStatisticsEntity()
Deprecated. As of GridSim 2.1, replaced by shutdownGridStatisticsEntity() |
protected void |
shutdownUserEntity()
Tells all user entities to shut down the simulation. |
protected void |
ShutdownUserEntity()
Deprecated. As of GridSim 2.1, replaced by shutdownUserEntity() |
static void |
Start()
Deprecated. As of GridSim 2.1, replaced by startGridSimulation() |
static void |
startGridSimulation()
Starts the execution of GridSim simulation. |
static void |
Stop()
Deprecated. As of GridSim 2.1, replaced by stopGridSimulation() |
static void |
stopGridSimulation()
Stops Grid Simulation (based on Sim_system.run_stop()). |
protected void |
TerminateInputOutputEntities()
Deprecated. As of GridSim 2.1, replaced by terminateIOEntities() |
protected void |
terminateIOEntities()
It terminates Entities managing 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 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 Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected eduni.simjava.Sim_port input
protected eduni.simjava.Sim_port output
public static Date SimulationStartDate
init(int, Calendar, boolean, String[],
String[], String)
public static GridSimRandom rand
init(int, Calendar, boolean, String[], String[], String)
Constructor Detail |
public GridSim(String name) throws Exception
name
- the name to be associated with this entity (as
required by Sim_entity class from simjava package)
Exception
- This happens when creating this entity before
initializing GridSim package or this entity name is
null or emptyinit(int, Calendar, boolean, String[], String[],
String)
,
Sim_entity
public GridSim(String name, double baudRate) throws Exception
name
- the name to be associated with this entity (as
required by Sim_entity class from simjava package)baudRate
- communication speed
Exception
- This happens when creating this entity before
initializing GridSim package or this entity name is
null or emptyinit(int, Calendar, boolean, String[], String[],
String)
,
Sim_entity
,
Input
,
Output
Method Detail |
protected void TerminateInputOutputEntities()
terminateIOEntities()
GridSim(String, double)
protected void terminateIOEntities()
GridSim(String, double)
protected void finalize()
finalizeGridSimulation()
finalize
in class Object
terminateIOEntities()
protected void finalizeGridSimulation()
terminateIOEntities()
public boolean IsNetworked()
isNetworked()
public boolean isNetworked()
public static Date GetSimulationStartDate()
getSimulationStartDate()
init(int, Calendar, boolean, String[], String[], String)
Date
public static Date getSimulationStartDate()
init(int, Calendar, boolean, String[], String[], String)
Date
public static void Init(int numUser, Calendar cal, boolean traceFlag, String[] excludeFromFile, String[] excludeFromProcessing, String reportWriterName)
init(int, Calendar, boolean, String[],
String[], String)
numUser
- the number of User Entities created.
This parameters indicates that
gridsim.GridSimShutdown first waits for
User Entities's END_OF_SIMULATION signal before
issuing terminate signal to other entitiescal
- the Calendar object for storing peaktime, holiday,
etctraceFlag
- true if GridSim trace need to be writtenexcludeFromFile
- an array of String containing list of files to
be excluded from statisticsexcludeFromProcessing
- an array of String containing list of
processings to be excluded from writing
into a filereportWriterName
- the name of the entities which is signaled
to write any specific report just before
termination of the simulationGridSimShutdown
public static void init(int numUser, Calendar cal, boolean traceFlag, String[] excludeFromFile, String[] excludeFromProcessing, String reportWriterName)
numUser
- the number of User Entities created.
This parameters indicates that
gridsim.GridSimShutdown first waits for
User Entities's END_OF_SIMULATION signal before
issuing terminate signal to other entitiescal
- the Calendar object for storing peaktime, holiday,
etctraceFlag
- true if GridSim trace need to be writtenexcludeFromFile
- an array of String containing list of files to
be excluded from statisticsexcludeFromProcessing
- an array of String containing list of
processings to be excluded from writing
into a filereportWriterName
- the name of the entities which is signaled
to write any specific report just before
termination of the simulationGridSimShutdown
public static void Start() throws NullPointerException
startGridSimulation()
Note: This method should be called after all the entities have been setup and added, and their ports are linked.
NullPointerException
- This happens when creating this entity
before initializing GridSim package or this entity name is
null or emptyinit(int, Calendar, boolean, String[], String[],
String)
public static void startGridSimulation() throws NullPointerException
Note: This method should be called after all the entities have been setup and added, and their ports are linked.
NullPointerException
- This happens when creating this entity
before initializing GridSim package or this entity name is
null or emptyinit(int, Calendar, boolean, String[], String[],
String)
public static double Clock()
clock()
Sim_system.clock()
public static double clock()
Sim_system.clock()
public void GridSimHold(double duration)
gridSimHold(double)
duration
- the amount of time to holdpublic void gridSimHold(double duration)
duration
- the amount of time to holdpublic static void Stop() throws NullPointerException
stopGridSimulation()
NullPointerException
- This happens when creating this entity
before initializing GridSim package or this entity name is
null or emptySim_system.run_stop()
,
init(int, Calendar, boolean, String[], String[],
String)
public static void stopGridSimulation() throws NullPointerException
NullPointerException
- This happens when creating this entity
before initializing GridSim package or this entity name is
null or emptyinit(int, Calendar, boolean, String[], String[],
String)
,
Sim_system.run_stop()
protected void Send(String entityName, double delay, int gridSimTag)
send(String, double,
int)
entityName
- the name of the destination entitydelay
- how long the event/message should be delivered
from the current simulation timegridSimTag
- an user-defined number representing the type of
an event/messageprotected void send(String entityName, double delay, int gridSimTag)
entityName
- the name of the destination entitydelay
- how long the event/message should be delivered
from the current simulation timegridSimTag
- an user-defined number representing the type of
an event/messageprotected void Send(String entityName, double delay, int gridSimTag, Object data)
send(String, double,
int, Object)
entityName
- the name of the destination entitydelay
- how long the event/message should be delivered
from the current simulation timegridSimTag
- an user-defined number representing the type of
an event/messagedata
- A reference to data to be sent with the eventprotected void send(String entityName, double delay, int gridSimTag, Object data)
entityName
- the name of the destination entitydelay
- how long the event/message should be delivered
from the current simulation timegridSimTag
- an user-defined number representing the type of
an event/messagedata
- A reference to data to be sent with the eventprotected void Send(int entityID, double delay, int gridSimTag)
send(int, double,
int)
entityID
- the id number of the destination entitydelay
- how long the event/message should be delivered
from the current simulation timegridSimTag
- an user-defined number representing the type of
an event/messageprotected void send(int entityID, double delay, int gridSimTag)
entityID
- the id number of the destination entitydelay
- how long the event/message should be delivered
from the current simulation timegridSimTag
- an user-defined number representing the type of
an event/messageprotected void Send(int entityID, double delay, int gridSimTag, Object data)
send(int, double,
int, Object)
entityID
- the id number of the destination entitydelay
- how long the event/message should be delivered
from the current simulation timegridSimTag
- an user-defined number representing the type of
an event/messagedata
- A reference to data to be sent with the eventprotected void send(int entityID, double delay, int gridSimTag, Object data)
entityID
- the id number of the destination entitydelay
- how long the event/message should be delivered
from the current simulation timegridSimTag
- an user-defined number representing the type of
an event/messagedata
- A reference to data to be sent with the eventprotected void Send(eduni.simjava.Sim_port destPort, double delay, int gridSimTag)
send(Sim_port, double,
int)
destPort
- A reference to the port to send the event out ofdelay
- how long the event/message should be delivered
from the current simulation timegridSimTag
- an user-defined number representing the type of
an event/messageprotected void send(eduni.simjava.Sim_port destPort, double delay, int gridSimTag)
destPort
- A reference to the port to send the event out ofdelay
- how long the event/message should be delivered
from the current simulation timegridSimTag
- an user-defined number representing the type of
an event/messageprotected void Send(eduni.simjava.Sim_port destPort, double delay, int gridSimTag, Object data)
send(Sim_port, double,
int, Object)
destPort
- A reference to the port to send the event out ofdelay
- how long the event/message should be delivered
from the current simulation timegridSimTag
- an user-defined number representing the type of
an event/messagedata
- A reference to data to be sent with the eventprotected void send(eduni.simjava.Sim_port destPort, double delay, int gridSimTag, Object data)
destPort
- A reference to the port to send the event out ofdelay
- how long the event/message should be delivered
from the current simulation timegridSimTag
- an user-defined number representing the type of
an event/messagedata
- A reference to data to be sent with the eventprotected Object ReceiveEventObject()
receiveEventObject()
protected Object receiveEventObject()
protected Object ReceiveEventObject(eduni.simjava.Sim_port sourcePort)
sourcePort
- a Sim_port object which is used to connect entities
for event passing
Sim_port
protected Object receiveEventObject(eduni.simjava.Sim_port sourcePort)
sourcePort
- a Sim_port object which is used to connect entities
for event passing
Sim_port
protected void GridletSubmit(Gridlet gl, int resourceID)
gridletSubmit(Gridlet,
int)
gl
- a Gridlet object to be sentresourceID
- a unique resource IDprotected void gridletSubmit(Gridlet gl, int resourceID)
gl
- a Gridlet object to be sentresourceID
- a unique resource IDprotected Gridlet GridletReceive()
gridletReceive()
protected Gridlet gridletReceive()
protected void GridletCancel(Gridlet gl, int resource_id)
gl
- a Gridlet objectresource_id
- a grid resource idpublic String GetEntityName()
getEntityName()
public String getEntityName()
public static String GetEntityName(int entityID)
getEntityName(int)
entityID
- the entity ID
public static String getEntityName(int entityID)
entityID
- the entity ID
public static int GetEntityId(String entityName)
getEntityId(String)
entityName
- an Entity name
public static int getEntityId(String entityName)
entityName
- an Entity name
public static int GridStatisticsEntityId()
getGridStatisticsEntityId()
public static int getGridStatisticsEntityId()
public static int GridInformationServiceEntityId()
getGridInfoServiceEntityId()
public static int getGridInfoServiceEntityId()
public static int GridSimShutdownEntityId()
getGridSimShutdownEntityId()
public static int getGridSimShutdownEntityId()
protected void ShutdownUserEntity()
shutdownUserEntity()
GridSimShutdown
protected void shutdownUserEntity()
GridSimShutdown
protected void ShutdownGridStatisticsEntity()
shutdownGridStatisticsEntity()
GridSimShutdown
protected void shutdownGridStatisticsEntity()
GridSimShutdown
public LinkedList GetGridResourceList()
getGridResourceList()
public LinkedList getGridResourceList()
public ResourceCharacteristics GetResourceCharacteristics(int resourceID)
getResourceCharacteristics(int)
resourceID
- the resource ID
ResourceCharacteristics
public ResourceCharacteristics getResourceCharacteristics(int resourceID)
resourceID
- the resource ID
ResourceCharacteristics
public Accumulator GetResourceDynamicInformation(int resourceID)
getResourceDynamicInfo(int)
resourceID
- the resource ID
public Accumulator getResourceDynamicInfo(int resourceID)
resourceID
- the resource ID
public void RecordStatistics(String category, double data)
recordStatistics(String, double)
category
- a category namedata
- a value to be recordedpublic void recordStatistics(String category, double data)
category
- a category namedata
- a value to be recordedpublic void RecordStatistics(String category, int data)
recordStatistics(String, int)
category
- a category namedata
- a value to be recordedpublic void recordStatistics(String category, int data)
category
- a category namedata
- a value to be recordedpublic void RecordStatistics(String category, String data)
recordStatistics(String, String)
category
- a category namedata
- a value to be recordedpublic void recordStatistics(String category, String data)
category
- a category namedata
- a value to be recordedpublic void RecordStatistics(String category, boolean data)
recordStatistics(String, boolean)
category
- a category namedata
- a value to be recordedpublic void recordStatistics(String category, boolean data)
category
- a category namedata
- a value to be recorded
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |