|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object peersim.cdsim.CDSimulator
public class CDSimulator
This is the cycle driven simulation engine. It is a fully static
singleton class. For a cycle driven simulation the configuration can
describe a set of Protocol
s, and their ordering, a set of
Control
s and their ordering and a set of initializers and their
ordering. See parameters "init", "control". Out
of the set of protocols, this engine only executes the ones that
implement the CDProtocol
interface.
One experiment run by nextExperiment()
works as follows. First
the initializers are run in the specified order, then the following is
iterated "simulation.cycles" times: If "simulation.nodefaultcycle" is
specified, then simply the controls specified in the configuration are
run in the specified order. If "simulation.nodefaultcycle" is not specified,
then the controls in the configuration are run in the specified order,
followed by the execution of FullNextCycle
.
All components (controls and protocols) can have configuration
parameters that control their scheduling (see Scheduler
). This
way they can skip cycles, start from a specified cycle, etc. As a
special case, components can be scheduled to run after the last cycle.
That is, each experiment is finished by running the controls that are
scheduled after the last cycle.
Finally, any control can interrupt an experiment at any time it is
executed by returning true in method Control.execute()
. However,
the controls scheduled to run after the last cycle are still executed
completely, irrespective of their return value and even if the
experiment was interrupted.
Configuration
Parameter Summary | |
---|---|
simulation.cycles
Parameter representing the maximum number of cycles to be performed |
|
simulation.nodefaultcycle
This option is only for experts. |
|
init
This is the prefix for initializers. |
|
control
This is the prefix for controls. |
Method Summary | |
---|---|
static boolean |
isConfigurationCycleDriven()
This method is used to check whether the current configuration can be used for cycle-driven simulations. |
static void |
nextExperiment()
Runs an experiment, resetting everything except the random seed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Parameter Detail |
---|
simulation.cycles
simulation.nodefaultcycle
FullNextCycle
, NextCycle
). It's there for
people who want maximal flexibility for their hacks.
init
Control
. They are run at the beginning of each experiment, in
the order specified by the configuration.
Configuration
control
Control
. They are run before each cycle, in the order specified
by the configuration.
Configuration
Method Detail |
---|
public static final boolean isConfigurationCycleDriven()
public static final void nextExperiment()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |