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.

  1. SetupEvent – alter global simulation settings
  2. StartNodeEvent – start a node
  3. KillNodeEvent – kill a node
  4. TerminateExperiment – terminate the experiment
  5. ChangeNetworkModelEvent – 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:

  1. ConstantDistribution – pass a fixed custom parameter to all events
  2. IntegerUniformDistribution – generate uniformly distributed integers
  3. DoubleUniformDistribution – generate uniformly distributed doubles
  4. LongUniformDistribution – generate uniformly distributed longs
  5. BigIntegerUniformDistribution – generate uniformly distributed big integers
  6. IntegerNormalDistribution – generate normally distributed integers
  7. DoubleNormalDistribution – generate normally distributed doubles
  8. LongNormalDistribution – generate normally distributed longs
  9. BigIntegerNormalDistribution – generate normally distributed big integers
  10. IntegerExponentialDistribution – generate exponentially distributed integers
  11. DoubleExponentialDistribution – generate exponentially distributed doubles
  12. LongExponentialDistribution – generate exponentially distributed longs
  13. BigIntegerExponentialDistribution – generate exponentially distributed big integers
  14. BasicIntSequentialDistribution – generate a predefined sequence N, N+1, N+2, ... for parameter N
  15. 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.

  1. Operation – created via Op{(_: Unit) => SomeEvent}
  2. Operation1 – created via Op{(param: DistributionOutputType) => SomeEvent}
  3. Operation2 – created via Op{(param1: Distribution1OutputType, param2: Distribution2OutputType) => SomeEvent}
  4. Operation3 – and so on…
  5. Operation4
  6. Operation5

StochasticProcesses

Event generation related methods:

  1. eventInterarrivalTime
  2. raise

Process order related methods: start, terminate.

The DSL methods for creating stochastic processes from operations and then combining them into simulation scenarios can be found in StochasticProcess.scala.

The source code for this page can be found here.