Errors while variable arithmetic in configuration

2019-08-29 12:55发布

问题:

I want to calculate an ini variable depending on a different variable and a number, but I can't get it to work. I tried different versions of the following code - with and without brackets around the term:

warmup-period = ${warmup = 0}s
sim-time-limit = ${stime = ${warmup} + 2400}s

OMNeT++ always gives me this error:

Error: Could not read option sim-time-limit= from the configuration: Syntax error parsing quantity '0 + 2400s': Garbage after first number

I also tried using ($warmup) instead of ${warump} as suggested by the manual, but this gives me the following error:

Error: Could not read option sim-time-limit= from the configuration: Syntax error parsing quantity '(0) + 2400s': Must begin with a number

I am using OMNeT++ version 5.1.

回答1:

It is impossible to use an INI variable for sim-time-limit, because the simulation environment expects only a number (with unit). Here is the line from src\envir\envirbase.cc which reads the value of sim-time-limit:

opt->simtimeLimit = cfg->getAsDouble(CFGID_SIM_TIME_LIMIT, -1);


标签: omnet++