Talip Tolga Sarı
Talip Tolga Sarı

Reputation: 140

Using a parameter for multiple assignments

I'm simulating a network topology on multiple session lengths. I want my experiment's repetitions to increase as the session lengths decrease. So I tried tying $repeat value with *.sendBytes and failed.

Here is my attempt 1

[some config]

repeat = ${1, 10, 100} # fails

...

**.app[0].sendBytes = repeat * 1KiB

Here is my second attemp

[some config]

**.app[0].sendBytes = ${load = 1KiB, 10KiB, 100KiB}

... 

repeat = 100KiB / ${load} # fails 

I don't want to waste simulation time for repeating long sessions for reliability in measurements.

Upvotes: 0

Views: 80

Answers (1)

Rudi
Rudi

Reputation: 6681

What you are looking for is called "Parallel Iteration" in the omnet manual:

The body of an iteration may end in an exclamation mark followed by the name of another iteration variable. This syntax denotes a parallel iteration. A parallel iteration does not define a loop of its own, but rather, the sequence is advanced in lockstep with the variable after the “!”. In other words, the “!” syntax chooses the kth value from the iteration, where k is the position (iteration count) of the iteration variable after the “!”.

An example:

**.plan =     ${plan= "A", "B", "C", "D"}
**.numHosts = ${hosts= 10,  20,  50, 100 ! plan}
**.load =     ${load= 0.2, 0.3, 0.3, 0.4 ! plan}

You could write something like this:

repeat =  ${5, 50, 200 ! load}

Upvotes: 2

Related Questions