1

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 Answers2

3

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

Unheilig
  • 16,196
  • 193
  • 68
  • 98
  • Cool! I needed to add one include in my BaseWaveApplLayer.h and your code works. `#include "veins/modules/mobility/traci/TraCIScenarioManagerLaunchd.h"` Now I can get all value from [TraCIScenarioManagerLaunchd.ned](https://github.com/namnatulco/veins/blob/master/src/veins/modules/mobility/traci/TraCIScenarioManagerLaunchd.ned) using the [TraCIScenarioManagerLaunchdAccess](https://github.com/namnatulco/veins/blob/master/src/veins/modules/mobility/traci/TraCIScenarioManagerLaunchd.h#L64).get(). Thank you for all the help : ). – João Batista Oct 13 '16 at 02:17
1

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

Christoph Sommer
  • 6,893
  • 1
  • 17
  • 35
  • Hello Sommer. I have read the TicToc tutorial. I'm using `par(...)`, but I can't get values from somes module. For exemple, I want get the value of `*.manager.numVehicles` (from veins/src/modules/mobility/traci/TraCIScenarioManagerLaunchd.ned), I tried with `par(...)`, but he don't accept . or *, so I created one variable `numVehicles` (to use `*.car[*].appl.numVehicles`) on BaseWaveApplLayer.ned to get this value and I have to make sure that with both have the same value. Maybe has one way with `par(...)` to get this value directly, but I don't know how. Thanks for your help until now : ). – João Batista Jan 31 '16 at 22:24