How to change destination with respect to simulation time.

42 views
Skip to first unread message

Muhammad Imran

unread,
Aug 23, 2014, 2:17:05 AM8/23/14
to omn...@googlegroups.com
Hi, 

Consider we have 10 networks and hosts in network are named as network{1..10}host{1..40}. First 5 and last 5 network hosts communicate with each other during whole simulation. I select destination as following. 

**.network{1..5}host*.**.destAddresses = moduleListByPath("**.network{1..5}host*")
**.network{6..10}host*.**.destAddresses = moduleListByPath("**.network{6..10}host*")

If I run simulation for 2 seconds they will communicate with each. I want to change to change destinations with respect to simulation time. For example after 1 second network1 hosts should communicate with network 10 hosts, network 2 hosts with network 9 hosts etc. 

Is there any way to do this dynamically with respect to simulation time. 

I would be very grateful for any help.

Best Regards

Muhammad Imran 

Rudolf Hornig

unread,
Aug 25, 2014, 10:35:00 AM8/25/14
to omn...@googlegroups.com
It may be a little tricky but:

a) the destAddress parameter MUST be defined volatile otherwise it is cached by OMNeT++ and the parameter will return always the same value. A quick look at the INET code shows that the PING app for example have a non-volatile destAddress parameter, so you may have to modify that.
b) you must check also whether the parameter is not cached in C++ either (i.e. not read at the INIT stage, but rather it is accessed by a par("destAddresses") call each time it is needed. (It seems that it is so, in the PING app at least).
c) You have to be able to produce simTime dependent values for the parameter. You can do a bit hack and use the ? : operator and the simTime() ned function. something like:

**.myParam = simTime < 5s ? valueForTheFirst5Secs : valueForTherestOfTheTime

you can chain several ?: operators so you may have more than 2 time intervals...
Rudolf

Muhammad Imran

unread,
Aug 25, 2014, 2:22:16 PM8/25/14
to omn...@googlegroups.com
Hi Rudolf,

I am using inet UDPBasicBurst  application in standard inet host. Please guide where do I have to make changes. Thanks

Best Regards
Reply all
Reply to author
Forward
0 new messages