user5965248
user5965248

Reputation:

Getting total number of objects during simulation OMNET++/VEINS

I am running VEINS simulation for VANETs. Is there a way to access the total number of cars being simulated during a specific time in OMNET++?(I am trying to count the number of packets being exchanged between cars, and since I am broadcasting it, I thought multiplying the packet sent to the number of vehicles being simulated would provide a good indicator of how many received packets count should be).

Upvotes: 2

Views: 715

Answers (1)

Christoph Sommer
Christoph Sommer

Reputation: 6943

The return value of TraCIScenarioManager::getManagedHosts contains all active vehicles. You should get the same result as if you manually iterate over (and then filter) all submodules of your network using cModule::SubmoduleIterator.

Upvotes: 5

Related Questions