|
GridSim v3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectThread
eduni.simjava.Sim_entity
gridsim.GridSimCore
Since GridSim version 3.0, this is the overall class of GridSim package, that must be extended by other 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 can implement a method called body(), which is automatically invoked since it is expected to be responsible for simulating entity behavior. body() method is the place to receive incoming events.
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,
Input
and 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. Input_Resource2 entity handles all incoming
events. A resource has an output entity whose name is prefixed with
Output_, e.g. Output_Resource2. Output_Resource2
entity handles all outgoing events.
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.
There are two ways to send a message or object to an entity, i.e. with or without I/O port. Below shows the differences:
send(int, double, int, Object)
method. send(Sim_port, double, int, Object)
method.Output.body()
method.
Sim_entity
,
Output
,
Input
Field Summary | |
protected Sim_port |
input
Reading data received via input port |
protected Sim_port |
output
Sending data via output port to external entities |
Fields inherited from class eduni.simjava.Sim_entity |
|
Fields inherited from class Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
GridSimCore(String name)
Allocates a new GridSim object without NETWORK communication channels: "input" and "output" Sim_port. |
|
GridSimCore(String name,
double baudRate)
Allocates a new GridSim object with NETWORK communication channels: "input" and "output" Sim_port. |
Method Summary | |
protected void |
finalize()
Deprecated. As of GridSim 2.1, replaced by finalizeGridSimulation() |
protected void |
finalizeGridSimulation()
It terminates the entities of this object that manage NETWORK communication channels |
boolean |
isNetworked()
Check type of entity |
boolean |
IsNetworked()
Deprecated. As of GridSim 2.1, replaced by isNetworked() |
protected void |
send(int entityID,
double delay,
int gridSimTag)
Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type. |
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 another entity by delaying the simulation time from the current time, with a tag representing the event type. |
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(Sim_port destPort,
double delay,
int gridSimTag)
Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type. |
protected void |
Send(Sim_port destPort,
double delay,
int gridSimTag)
Deprecated. As of GridSim 2.1, replaced by send(Sim_port, double,
int) |
protected void |
send(Sim_port destPort,
double delay,
int gridSimTag,
Object data)
Sends an event/message to another entity by delaying the simulation time from the current time, with a tag representing the event type. |
protected void |
Send(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 another entity by delaying the simulation time from the current time, with a tag representing the event type. |
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 another entity by delaying the simulation time from the current time, with a tag representing the event type. |
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 |
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_generator, add_param, add_port, body, clone, get_id, get_name, get_port, get_port, get_stat, run, send_on, set_invisible, set_stat, sim_cancel, sim_completed, sim_current, sim_get_next, sim_get_next, sim_hold_for, sim_hold, sim_pause_for, sim_pause_for, sim_pause_until, sim_pause_until, sim_pause, sim_process_for, sim_process_for, sim_process_until, sim_process_until, sim_process, sim_putback, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_select, sim_trace, sim_wait_for, sim_wait_for, 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 |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Sim_port input
protected Sim_port output
Constructor Detail |
public GridSimCore(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 emptyGridSim.init(int, Calendar, boolean, String[], String[],
String)
,
Sim_entity
public GridSimCore(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
- network communication or bandwidth speed
Exception
- This happens when creating this entity before
initializing GridSim package or this entity name is
null or emptyGridSim.init(int, Calendar, boolean, String[], String[],
String)
,
Sim_entity
,
Input
,
Output
Method Detail |
protected void TerminateInputOutputEntities()
terminateIOEntities()
GridSim.GridSim(String, double)
protected void terminateIOEntities()
GridSim.GridSim(String, double)
protected void finalize()
finalizeGridSimulation()
terminateIOEntities()
protected void finalizeGridSimulation()
terminateIOEntities()
public boolean IsNetworked()
isNetworked()
public boolean isNetworked()
protected void Send(String entityName, double delay, int gridSimTag)
send(String, double,
int)
It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:
... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);
// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;
// delay is the simulation time delay
// tag is the event type (user-defined or choose one from
GridSimTags class)
send(port, delay, tag, data);
... // remaining other code
entityName
- the name of the destination entitydelay
- how long the event/message should be delivered
from the current simulation time.
If delay is a negative number, then it will be
changed to 0.0gridSimTag
- an user-defined number representing the type of
an event/messageprotected void send(String entityName, double delay, int gridSimTag)
It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:
... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);
// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;
// delay is the simulation time delay
// tag is the event type (user-defined or choose one from
GridSimTags class)
send(port, delay, tag, data);
... // remaining other code
entityName
- the name of the destination entitydelay
- how long the event/message should be delivered
from the current simulation time
If delay is a negative number, then it will be
changed to 0.0gridSimTag
- 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)
It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:
... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);
// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;
// delay is the simulation time delay
// tag is the event type (user-defined or choose one from
GridSimTags class)
send(port, delay, tag, data);
... // remaining other code
entityName
- the name of the destination entitydelay
- how long the event/message should be delivered
from the current simulation time
If delay is a negative number, then it will be
changed to 0.0gridSimTag
- 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)
It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:
... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);
// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;
// delay is the simulation time delay
// tag is the event type (user-defined or choose one from
GridSimTags class)
send(port, delay, tag, data);
... // remaining other code
entityName
- the name of the destination entitydelay
- how long the event/message should be delivered
from the current simulation time
If delay is a negative number, then it will be
changed to 0.0gridSimTag
- 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)
It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:
... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);
// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;
// delay is the simulation time delay
// tag is the event type (user-defined or choose one from
GridSimTags class)
send(port, delay, tag, data);
... // remaining other code
entityID
- the id number of the destination entitydelay
- how long the event/message should be delivered
from the current simulation time
If delay is a negative number, then it will be
changed to 0.0gridSimTag
- an user-defined number representing the type of
an event/messageprotected void send(int entityID, double delay, int gridSimTag)
It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:
... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);
// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;
// delay is the simulation time delay
// tag is the event type (user-defined or choose one from
GridSimTags class)
send(port, delay, tag, data);
... // remaining other code
entityID
- the id number of the destination entitydelay
- how long the event/message should be delivered
from the current simulation time
If delay is a negative number, then it will be
changed to 0.0gridSimTag
- 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)
It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:
... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);
// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;
// delay is the simulation time delay
// tag is the event type (user-defined or choose one from
GridSimTags class)
send(port, delay, tag, data);
... // remaining other code
entityID
- the id number of the destination entitydelay
- how long the event/message should be delivered
from the current simulation time
If delay is a negative number, then it will be
changed to 0.0gridSimTag
- 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)
It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:
... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);
// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;
// delay is the simulation time delay
// tag is the event type (user-defined or choose one from
GridSimTags class)
send(port, delay, tag, data);
... // remaining other code
entityID
- the id number of the destination entitydelay
- how long the event/message should be delivered
from the current simulation time
If delay is a negative number, then it will be
changed to 0.0gridSimTag
- an user-defined number representing the type of
an event/messagedata
- A reference to data to be sent with the eventprotected void Send(Sim_port destPort, double delay, int gridSimTag)
send(Sim_port, double,
int)
It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:
... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);
// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;
// delay is the simulation time delay
// tag is the event type (user-defined or choose one from
GridSimTags class)
send(port, delay, tag, data);
... // remaining other code
destPort
- A reference to the port to send the event out ofdelay
- how long the event/message should be delivered
from the current simulation time
If delay is a negative number, then it will be
changed to 0.0gridSimTag
- an user-defined number representing the type of
an event/messageprotected void send(Sim_port destPort, double delay, int gridSimTag)
It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:
... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);
// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;
// delay is the simulation time delay
// tag is the event type (user-defined or choose one from
GridSimTags class)
send(port, delay, tag, data);
... // remaining other code
destPort
- A reference to the port to send the event out ofdelay
- how long the event/message should be delivered
from the current simulation time
If delay is a negative number, then it will be
changed to 0.0gridSimTag
- an user-defined number representing the type of
an event/messageprotected void Send(Sim_port destPort, double delay, int gridSimTag, Object data)
send(Sim_port, double,
int, Object)
It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:
... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);
// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;
// delay is the simulation time delay
// tag is the event type (user-defined or choose one from
GridSimTags class)
send(port, delay, tag, data);
... // remaining other code
destPort
- A reference to the port to send the event out ofdelay
- how long the event/message should be delivered
from the current simulation time
If delay is a negative number, then it will be
changed to 0.0gridSimTag
- an user-defined number representing the type of
an event/messagedata
- an object of type IO_dataIO_data
protected void send(Sim_port destPort, double delay, int gridSimTag, Object data)
It is recommended to use send() method with an output port if the network bandwidth plays an important role in this simulation. However, the entity must have the network entities, i.e. Input and Output port (specified during the creation of the entity by giving a baud rate or bandwidth speed). Below is an example on how to do:
... // other code
// object is the entity or message you want to send
// size is the object size in bytes (rough estimation)
// destination id is the entity ID you want to send the object to
IO_data data = new IO_data(object, size, destinationID);
// If this entity extends from GridSim class, then you should use it
// otherwise need to create a new Sim_port object
Sim_port port = super.output;
// delay is the simulation time delay
// tag is the event type (user-defined or choose one from
GridSimTags class)
send(port, delay, tag, data);
... // remaining other code
destPort
- A reference to the port to send the event out ofdelay
- how long the event/message should be delivered
from the current simulation time
If delay is a negative number, then it will be
changed to 0.0gridSimTag
- an user-defined number representing the type of
an event/messagedata
- an object of type IO_dataIO_data
|
GridSim v3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |