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

490 Views Asked by At

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

2

There are 2 best solutions below

1
On BEST ANSWER

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

1
On

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