|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbcds.phison.sim.SimCore<V,E>
bcds.phison.sim.SimTask<V,E>
public class SimTask<V extends GraphIONode,E>
SimTask offers a simulation execution environment that is prepared based on parameters given in the SimParams object and, to a lesser extent, in the SimGlobals object, passed to the constructor.
The execution environment consists of the following:
PmTrfReader
is automatically
added to the list of processing modules.
ZoneMap
.
DemandTypesReader
.
If no demands type file is given, the only routing algorithm
employed is the one specified in opt.ra.
IEPReader
.
run()
method.
One key structure initialized there is the traffic engineering database
object, which is an instance of TED
. The capacity
each link is set according to the value obtained from the topology file,
multiplied by the parametr opt.capmult. Link cost depends on
what is provided in opt.costtype. Typically, the cost of each
link will be value taken from the topology file. Note: this is an
area where further generalization is needed, so that link costs can be
set more flexibily..
This class processes events of type CONN_REQUEST and
CONN_RELEASE besides the one handled by the parent class.
See processEventOnCurrentTime(bcds.phison.sim.SimCore
for
details on connection handling.
Simulation can terminate on any of the following conditions:
Processing modules are loaded dynamically. They are referenced as either unqualified or fully qualified class names. To resolve an unqualified name (that is, a class without its package name), the colon-separated list of prefixes given in opt.mod_prefixes is used. Likewise, routing algorithms are loaded dynamically; their prefix is in opt.ra_prefixes.
At the end of the simulation, modules are shut down, so that final statistics can be collected, summaries be printed, etc.
This class implements the Runnable interface so that the caller
may spawn several instances in parallel. Processing modules usually write
to System.out, and it is convenient that simple
output to stdout remains as usual. However, different instances (threads)
might want to have their stdout separated). When the parameter
opt.rep_out_file is not null, this class assumes that
System.out has been replaced with an instace of
ThreadedPrintStream
and redirects all output to
the file named in opt.rep_out_file. That file is always
overwritten.
The way to use this class is: instantiate the object passing the two required parameters; call the run method, or activated it as a thread.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class bcds.phison.sim.SimCore |
---|
SimCore.EventEntry |
Field Summary | |
---|---|
static java.lang.String |
PHISON_RANDOM_SEED
The key used as seed for opt.rnd_gen. |
Constructor Summary | |
---|---|
SimTask(SimGlobals<V,E> context,
SimParams opt)
Creates a new instance; the parameters are passed to the parent constructor. |
Method Summary | |
---|---|
ConnectionInfo<V,E> |
createConnection(ConnectionInfo<V,E> rq)
Returns a new connection between two nodes, of a given capacity, as indicated in the parameter rq . |
void |
run()
Executes a simulation: prepares the required data, starts the simulator's core and process events until no event exists or a limit is reached, signaled with a LimitReachedException, which is catched (swallowed) here. |
Methods inherited from class bcds.phison.sim.SimCore |
---|
advanceTime, callProcessingModules, ctx, enqueueCall, enqueueEvent, getLastBlockingReason, getSimStartTime, getSimStopTime, getTime, opt, processEnqueuedEventsPreviousTo, setLastBlockingReason, shutdownProcessingModules, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PHISON_RANDOM_SEED
Constructor Detail |
---|
public SimTask(SimGlobals<V,E> context, SimParams opt)
Method Detail |
---|
public ConnectionInfo<V,E> createConnection(ConnectionInfo<V,E> rq)
rq
.
This method is responsible for:
processEventOnCurrentTime(bcds.phison.sim.SimCore.EventEntry)
.
The parameter rq
must be treated as input-only,
that is, its state must not be changed.
Note: This restriction might be lifted in the future; if each
request was already enqueued with a new instance, this requirement
should not be necessary.
ConnBlockingException
- with its error code set to one of the
following reasons:
public void run()
If there is an error, the modules are not shut down.
If requested so, the environment is always printed, even when the
execution was interrupted by an error. Likewise,
cleanup()
is always called before returning.
run
in interface java.lang.Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |