applying loop in ini file

242 views
Skip to first unread message

Atif Shahzad

unread,
Sep 13, 2017, 9:35:25 AM9/13/17
to OMNeT++ Users


i have implemented simple TDMA. now i want to make it dynamic with respect to no of nodes. as i enter it should automatically assign slots to each node. right now i have to enter slots in .ini file manually. example is as shown: Manual Procedure:

**.noHost = 10
**.host[0].slotTime = 0.0
**.host[1].slotTime = 0.1
**.host[2].slotTime = 0.2
**.host[3].slotTime = 0.3
**.host[4].slotTime = 0.4
**.host[5].slotTime = 0.5
**.host[6].slotTime = 0.6
**.host[7].slotTime = 0.7
**.host[8].slotTime = 0.8
**.host[9].slotTime = 0.9

However, now i want to change it wrt noHost. how can i apply loop in ini file for this. can anyone help? i will be highly obliged.

Attila Török

unread,
Sep 13, 2017, 9:43:35 AM9/13/17
to OMNeT++ Users
You can use the special value index to achieve this, for example:

**.host[*].slotTime = index * 0.1

See the corresponding manual section: https://omnetpp.org/doc/omnetpp/manual/#sec:ned-lang:expressions

Attila

--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/omnetpp.
For more options, visit https://groups.google.com/d/optout.

Atif Shahzad

unread,
Sep 13, 2017, 9:50:40 AM9/13/17
to OMNeT++ Users
But how to vary this index value?


On Wednesday, September 13, 2017 at 6:43:35 PM UTC+5, Attila Török wrote:
You can use the special value index to achieve this, for example:

**.host[*].slotTime = index * 0.1

See the corresponding manual section: https://omnetpp.org/doc/omnetpp/manual/#sec:ned-lang:expressions

Attila
2017-09-13 15:35 GMT+02:00 Atif Shahzad <shahzad...@gmail.com>:


i have implemented simple TDMA. now i want to make it dynamic with respect to no of nodes. as i enter it should automatically assign slots to each node. right now i have to enter slots in .ini file manually. example is as shown: Manual Procedure:

**.noHost = 10
**.host[0].slotTime = 0.0
**.host[1].slotTime = 0.1
**.host[2].slotTime = 0.2
**.host[3].slotTime = 0.3
**.host[4].slotTime = 0.4
**.host[5].slotTime = 0.5
**.host[6].slotTime = 0.6
**.host[7].slotTime = 0.7
**.host[8].slotTime = 0.8
**.host[9].slotTime = 0.9

However, now i want to change it wrt noHost. how can i apply loop in ini file for this. can anyone help? i will be highly obliged.

--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages