Iteration variable in module vector index in INI file

151 views
Skip to first unread message

Qutab Qazi

unread,
Jun 10, 2015, 7:07:02 AM6/10/15
to omn...@googlegroups.com
Hi,

How can I use iteration variable as an index range in INI file for a module vector.

For example I want to write:

**.numHosts = ${num = 200}
**.node[0..${num}].distance = 25

but this doesn't work. Is it possible to do that?

A similar question was asked here with no answer. https://groups.google.com/forum/#!newtopic/omnetpp/omnetpp/VkoIiAbUotk

Thanks.
BR,
Qutab

Michael Kirsche

unread,
Jun 10, 2015, 7:35:37 AM6/10/15
to omn...@googlegroups.com
So you want to iterate of the number of node (from 1 to 200) and each node shall have the distance of 25, correct?
**.numHosts = ${1..200, step 1}
**.node[*].distance = 25

Qutab Qazi

unread,
Jun 10, 2015, 7:42:03 AM6/10/15
to omn...@googlegroups.com
Sorry if I wasn't clear. I know it can be done this way. That was just an example. Eventually, I want to do something like this:

**.numHosts = ${num = 200}
**.node[0..${num}/2].distance = 25
**.node[${num}/2..].distance = 50

So based on the index values I want to have different distances assigned to them. Hope it's clear now. Thanks for replying.

BR,
Qutab

Michael Kirsche

unread,
Jun 10, 2015, 8:16:19 AM6/10/15
to omn...@googlegroups.com
**.numHosts = ${num = 1..200}
**.node[0..($num/2)].distance = 25
**.node[($num/2)..$num].distance = 50

Qutab Qazi

unread,
Jun 10, 2015, 11:58:27 AM6/10/15
to omn...@googlegroups.com
It doesn't work for me. Correct values are not being assigned to paramters this way. Testing with Omnet++ 4.3.1.

Thanks.

--
You received this message because you are subscribed to a topic in the Google Groups "OMNeT++ Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/omnetpp/wQa0bQskf-k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to omnetpp+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/omnetpp.
For more options, visit https://groups.google.com/d/optout.

Michael Kirsche

unread,
Jun 11, 2015, 5:21:56 AM6/11/15
to omn...@googlegroups.com
Seems like an iteration inside the node parentheses (left of the equal sign) is not possible.

Maybe you can
(a) rework your condition (distance depending on the node number) into a constrained expression (https://omnetpp.org/doc/omnetpp/manual/usman.html#sec346)
or
(b) define your distance parameter otherwise, maybe let it be drawn randomly between both values, 25 and 50 

Shaikha Al-Khuder

unread,
Feb 8, 2016, 1:01:03 PM2/8/16
to OMNeT++ Users
Can I write it like this:


*.Node[0..30].udpApp[*].typename = "UDPBasicApp"

*.Node[32..99].udpApp[*].typename = "UDPBasicApp"


*.Node[31].udpApp[*].typename = "UDPSink"


??

Reply all
Reply to author
Forward
0 new messages