João Batista
João Batista

Reputation: 128

On Veins, how to get some values from ini file?

On Veins applications (veins/src/modules/application/app_name.(cc, h), how to get values like *.car[*].appl.numVehicles from theini file?

I can get values like sim-time-limit (see below) and anothers createad by me one, by I can't acess values on *.car[*].* or *.rsu[*].* from ini file.

stringTmp = ev.getConfig()->getConfigValue("sim-time-limit");

I'd appreciate any help

Upvotes: 1

Views: 494

Answers (2)

Douglas Nunes
Douglas Nunes

Reputation: 46

I got the "numVehicles" parameter from the .ini file using the following codification:

long numV = Veins::TraCIScenarioManagerLaunchdAccess().get()->par("numVehicles").longValue();

I hope this can help you.

Douglas

Upvotes: 3

Christoph Sommer
Christoph Sommer

Reputation: 6943

Reading parameter values of a module can be done via a call to this module's par(...) method.

I would highly recommend doing the TicToc tutorial, where this is demonstrated succinctly

Upvotes: 1

Related Questions