• Keine Ergebnisse gefunden

Especially for performance and robustness analysis and simulation of communication protocols, an important feature is the possibility to generate random numbers. Non-determinism is only in very rare cases efficiently suited to yield random values that are required to model packet losses for packet switched networks, especially in wireless environments. Therefore, well-designed random generators are required with a sufficient number of different distributions.

Furthermore, it is also argued that the generated random number sequences are re-producible. This is required to be able to run a slightly modified version of a system with the same sequence of generated random numbers. A random generates a pseudo random value which is derived from a given random seed value. The sequence of random value numbers is identical in each run of the system. This is especially required for high amount of participating entities and high amount of communication. In particular, when an analysis of a system with a random value shows a specific (erroneous) behavior, a second run with a different set of random values might result in correct behavior. In this case, it would be hard for the engineer to re-produce the random values that led to the failure. In addition, automatic validation of specification would introduce an additional high amount of complexity. Therefore, varying random values sequences can only be generated by means of different random seed values.

Semantics

When a «random» is executed it returns a pseudo-random value. Inspired from the Tau G1 [Tau]

random library, following operations are provided for randomness. Note that the following random operations are all specialized forms of the random stereotype noted above. The following notation is used as shorthand for replacing the stereotype tables:

UMLNODE TYPE UMLNOTATION REFERENCE

CallOperationAction

<<Erlang>>

Erlang(in realValue, in intValue, in rndCtrl, return result)

11.3.10

CallOperationAction

UMLCSSTEREOTYPE UMLCSMETACLASS TAGGED VALUES

«random» CallOperationAction (from

BasicActions) arguments: Property [0..*]

isAbstract=true

OCLCONSTRAINTS INFORMAL CONSTRAINTS

context CallOperationAction

inv: self.operation.method-> isEmpty() inv: self.onPort->isEmpty()

There shall be no behavioral implementation of the operation’s method as this is internally done.

The CallOperationAction shall not denote an onPort rendering it a remote call.

This stereotype is abstract. It is specialized by the noted random classes.

7.5 Random

RandomControl: Integer -> RandomControl;

RandomControl creates a RandomControl instance with an initial seed value. The seed value is used to generate the random values. Identical seed values yield the same sequence of random values.

Random : RandomControl -> Real;

Random : RandomControl -> Duration;

Random : RandomControl -> Time;

Random generates a random value x, where x is 0.0<=x<=1.0.

Erlang : Real, Integer, RandomControl -> Real;

Erlang : Real, Integer, RandomControl -> Duration;

Erlang : Real, Integer, RandomControl -> Time;

Erlang : Duration, Integer, RandomControl -> Real;

Erlang : Duration, Integer, RandomControl -> Duration;

Erlang : Duration, Integer, RandomControl -> Time;

Erlang : Time, Integer, RandomControl -> Real;

Erlang : Time, Integer, RandomControl -> Duration;

Erlang : Time, Integer, RandomControl -> Time;

Erlang creates an Erlang-N distributed random value. The first value specifies the mean, the second value specifies N.

NegExp : Real, RandomControl -> Real;

NegExp : Real, RandomControl -> Duration;

NegExp : Real, RandomControl -> Time;

NegExp : Duration, RandomControl -> Real;

NegExp : Duration, Rando mControl -> Duration;

NegExp : Duration, RandomControl -> Time;

NegExp : Time, RandomControl -> Real;

NegExp : Time, RandomControl -> Duration;

NegExp : Time, RandomControl -> Time;

NegExp creates a negative exponential distributed random value with the specified mean.

Uniform : Real, Real, RandomControl -> Real;

Uniform : Real, Real, RandomControl -> Duration;

Uniform : Real, Real, RandomControl -> Time;

Uniform : Duration, Duration, RandomControl -> Real;

Uniform : Duration, Duration, RandomControl -> Duration;

Uniform : Duration, Duration, RandomControl -> Time;

Uniform : Time, Time, RandomControl -> Real;

Uniform : Time, Time, RandomControl -> Duration;

Uniform : Time, Time, RandomControl -> Time;

Uniform creates a random value that is uniformly distributed between the ranges that are specified by the two values. The range is specified including the values.

Draw : Real, RandomControl -> Boolean;

Draw performs a single randomized test for the specified probability. That is, the operator Draw yields a true value with the given probability x and a false value with the probability 1-x.

geometric : Real, RandomControl -> Integer;

geometric : Real, RandomControl -> Duration;

geometric : Real, RandomControl -> Time;

geometric : Duration, RandomControl -> Integer;

geometric : Duration, RandomControl -> Duration;

geometric : Duration, RandomControl -> Time;

geometric : Time, RandomControl -> Integer;

geometric : Time, RandomControl -> Duration;

geometric : Time, RandomControl -> Time;

Geometric returns an Integer value based on geometric distribution.

Poisson : Real, RandomControl -> Integer;

Poisson : Real, RandomControl -> Duration;

Poisson : Real, RandomControl -> Time;

Poisson : Duration, RandomControl -> Integer;

Poisson : Duration, RandomControl -> Duration;

Poisson : Duration, RandomControl -> Time;

Poisson : Time, RandomControl -> Integer;

Poisson : Time, RandomControl -> Duration;

Poisson : Time, RandomControl -> Time;

Poisson returns a random value based on the Poisson distribution with the first value specifying the mean value.

RandInt : Integer, Integer, RandomControl -> Integer;

RandInt : Integer, Integer, RandomControl -> Duration;

RandInt : Integer, Integer, RandomControl -> Time;

RandInt returns an Integer value between the specified ranges. The values are equally distributed.

The following Figure 72 gives an overview of the random passive classes which are available in this profile. The CallOperationAction with the random extension invokes the corresponding operation implementation of the specific class. These classes are passive classes and do not execute a behavior unless an operation is called.

7.5 Random

+nextDuration(in value1: Duration[1], in seed: randomControl[1]):Duration +nextTime(in value1: Duration[1], in seed: randomControl[1]):Time +nextReal(in value1: Duration[1], in seed: randomControl[1]):Real +nextReal(in value1: Real[1], in seed: randomControl[1]):Real +nextReal(in value1: Time[1], in seed: randomControl[1]):Real +nextDuration(in value1: Real[1], in seed: randomControl[1]):Duration +nextDuration(in value1: Time[1], in seed: randomControl[1]):Duration +nextTime(in value1: Real[1], in seed: randomControl[1]):Time +nextTime(in value1: Time[1], in seedrandomControl[1]):Time

<<class>>

erlang Operations

+nextDuration(in value1: Time[1], in value2: Integer[1], in seed: randomControl[1]):Duration +nextTime(in value1: Time[1], in value2Integer[1], in seed: randomControl[1]):Time +nextReal(in value1: Time[1], in value2: Integer[1], in seed: randomControl[1]):Real

+nextDuration(in value1: Duration[1], in value2: Integer[1], in seed: randomControl[1]):Duration +nextTime(in value1: Duration[1], in value2: Integer[1], in seed: randomControl[1]):Time +nextReal(in value1: Duration[1], in value2: Integer[1], in seed: randomControl[1]):Real +nextReal(in value1: Real[1], in value2: Integer[1], in seed: randomControl[1]):Real +nextDuration(in value1: Real[1], in value2: Integer[1], in seed: randomControl[1]):Duration +nextTime(in value1: Real[1], in value2: Integer[1], in seed: randomControl[1]):Time

<<class>>

+nextBoolean(in value1: Real[1], in seed: randomControl[1]):Boolean

<<class>>

geometric Operations

+nextDuration(in value1: Duration[1], in seed: randomControl[1]):Duration +nextTime(in value1: Duration[1], in seed: randomControl[1]):Time +nextInteger(in value1: Duration[1], in seed: randomControl[1]):Integer +nextInteger(in value1: Real[1], in seed: randomControl[1]):Integer +nextDuration(in value1: Real[1], in seed: randomControl[1]):Duration +nextTime(in value1: Real[1], in seed: randomControl[1]):Time

<<class>>

poisson

<<class>>

uniform Operations

+nextDuration(in value1: Time[1], in value2: Time[1], in seed:randomControl[1]):Duration +nextTime(in value1: Time[1], in value2: Time[1], in seedrandomControl[1]):Time +nextReal(in value1: Time[1], in value2: Time[1], in seedrandomControl[1]):Real

+nextDuration(in value1: Duration[1], in value2: Duration[1], in seed: randomControl[1]):Duration +nextTime(in value1: Duration[1], in value2: Duration[1], in seed:randomControl[1]):Time +nextReal(in value1: Duration[1], in value2: Duration[1], in seed: randomControl[1]):Real +nextReal(in value1: Real[1], in value2: Real[1], in seed: randomControl[1]):Real +nextDuration(in value1: Real[1], in value2: Real[1], in seed: randomControl[1]):Duration +nextTime(in value1: Real[1], in value2: Real[1], in seed: randomControl[1]):Time

<<class>>

randInt Operations

+nextInteger(in value1: Integer[1], in value2: Integer[1], in seed: randomControl[1]):Integer +nextDuration(in value1: Integer[1], in value2: Integer[1], in seed: randomControl[1]):Duration +nextTime(in value1: Integer[1], in value2: Integer[1], in seed: randomControl[1]):Time

<<inherits>>

Figure 72: Predefined Set of Random Classes

Im Dokument UML Profile for Communicating Systems (Seite 166-170)