Simulation Scenarios Reference
The simulator comes with quite a number of classes and helper methods for controlling how simulation is run. In this section we will simply list them, to give the reader an idea of what is available.
Simulation Events
As already mentioned before, the only events interpreted by the simulator are the following.
SetupEvent
– alter global simulation settingsStartNodeEvent
– start a nodeKillNodeEvent
– kill a nodeTerminateExperiment
– terminate the experimentChangeNetworkModelEvent
– change the network model
Creating an operation that produces any other kind of event, will result in a runtime exception.
Distributions
The main class in this package is Distribution
. There are a number of distributions defined in the simulator module:
ConstantDistribution
– pass a fixed custom parameter to all eventsIntegerUniformDistribution
– generate uniformly distributed integersDoubleUniformDistribution
– generate uniformly distributed doublesLongUniformDistribution
– generate uniformly distributed longsBigIntegerUniformDistribution
– generate uniformly distributed big integersIntegerNormalDistribution
– generate normally distributed integersDoubleNormalDistribution
– generate normally distributed doublesLongNormalDistribution
– generate normally distributed longsBigIntegerNormalDistribution
– generate normally distributed big integersIntegerExponentialDistribution
– generate exponentially distributed integersDoubleExponentialDistribution
– generate exponentially distributed doublesLongExponentialDistribution
– generate exponentially distributed longsBigIntegerExponentialDistribution
– generate exponentially distributed big integersBasicIntSequentialDistribution
– generate a predefined sequenceN, N+1, N+2, ...
for parameterN
GenIntSequentialDistribution
– genrate a predefined sequence as given in the constructor. Make sure you do not try to raise more events than the size of the provided sequence, as once all the numbers in the sequence have been drawn,null
values will be returned.
Many of these distributions have convenience methods within a SimulationScenario
subclass.All these distributions have convenient helpers in Distributions
.
In case these distributions to not fit your needs, you can define your own by extending the Distribution
class
Operations
Depending on the amount of customisation you need for the simulation events, there are 6 types of operations allowing between 0 and 5 generated parameters. Each parameter is generated using some distribution you must provide. You can choose among the distributions presented above or create your own parameter distribution, which fits your needs better.
Operation
– created viaOp{(_: Unit) => SomeEvent}
Operation1
– created viaOp{(param: DistributionOutputType) => SomeEvent}
Operation2
– created viaOp{(param1: Distribution1OutputType, param2: Distribution2OutputType) => SomeEvent}
Operation3
– and so on…Operation4
Operation5
StochasticProcesses
Event generation related methods:
The DSL methods for creating stochastic processes from operations and then combining them into simulation scenarios can be found in StochasticProcess.scala.