1

I am using VEINS 4a2 and I have two different application eg. one normal application from TraciDemo11.cc and another one I modified it. Is it possible to assign the two different applications to 50 nodes randomly. Eg. from *.node[5..20].applType = "TraCI" and "Modified traci" ? so that in each simulation run each nodes have different application running.

Thank you.

  • Why do you want to assing them randomly? Is it not enough to assign `*.node[0..24].applType = "Application1"` and `*.node[25..49].applType = "Application1"`? – floxyz Mar 30 '16 at 12:54
  • I have been doing like that previously but after each run, I get the same simulation result. To get different result with different application I have to manually change each application and node range. I have to run 30 simulation run and each run should give different results. I want to implement normal application for some nodes and attack application to other nodes but the attack nodes should be chosen randomly. –  Mar 30 '16 at 13:11

2 Answers2

4

The ?: operator can be used to assign Appl1 to 50% of the nodes:

**.applType = uniform(0,1) < 0.5 ? "Appl1" : "Appl2"

This will create a different assignment for each run, as each run receives a different seed for the random functions.

Rudi
  • 6,418
  • 1
  • 16
  • 20
  • Thanks @Rudi, its exactly what i am looking for. But each time I repeat the same simulation each node is assigned the same application eg. **.applType = uniform(0,1) < 0.3 ? "Appl1" : "Appl2" and run for several times, the result shows that the same node is using the same application; not random assignment. Thanks again. –  Apr 01 '16 at 08:50
  • Yes. That is the intended behavior. OMNeT++ simulations are repeatable. Each time you run the same simulation, you will get the same random seed, resulting exactly the same random numbers in the same order. By default the seed is generated from the "run number" which is the same each time you run the simulation from the command line. You should get a bit familiar with "parameter studies" from the manual. – Rudi Apr 01 '16 at 15:00
0

Starting with Veins 4.3 you can assign different OMNeT++ module types for different SUMO vehicle types. So, if you upgrade to Veins 4.3 and configure SUMO to use random vehicle types, you can achieve the desired result.

Christoph Sommer
  • 6,893
  • 1
  • 17
  • 35