配置文件中的变量运算出错
Errors while variable arithmetic in configuration file
我想根据不同的变量和数字计算一个 ini 变量,但我无法让它工作。我尝试了以下代码的不同版本 - 在术语周围有和没有括号:
warmup-period = ${warmup = 0}s
sim-time-limit = ${stime = ${warmup} + 2400}s
OMNeT++ 总是给我这个错误:
Error: Could not read option sim-time-limit= from the
configuration: Syntax error parsing quantity '0 + 2400s': Garbage
after first number
我也尝试使用 ($warmup)
而不是 manual 所建议的 ${warump}
,但这给了我以下错误:
Error: Could not read option sim-time-limit= from the
configuration: Syntax error parsing quantity '(0) + 2400s': Must begin
with a number
我正在使用 OMNeT++ 5.1 版。
不可能为sim-time-limit
使用INI变量,因为模拟环境需要只有一个数字(带单位)。这是来自 src\envir\envirbase.cc
的行,它读取 sim-time-limit
的值:
opt->simtimeLimit = cfg->getAsDouble(CFGID_SIM_TIME_LIMIT, -1);
我想根据不同的变量和数字计算一个 ini 变量,但我无法让它工作。我尝试了以下代码的不同版本 - 在术语周围有和没有括号:
warmup-period = ${warmup = 0}s
sim-time-limit = ${stime = ${warmup} + 2400}s
OMNeT++ 总是给我这个错误:
Error: Could not read option sim-time-limit= from the configuration: Syntax error parsing quantity '0 + 2400s': Garbage after first number
我也尝试使用 ($warmup)
而不是 manual 所建议的 ${warump}
,但这给了我以下错误:
Error: Could not read option sim-time-limit= from the configuration: Syntax error parsing quantity '(0) + 2400s': Must begin with a number
我正在使用 OMNeT++ 5.1 版。
不可能为sim-time-limit
使用INI变量,因为模拟环境需要只有一个数字(带单位)。这是来自 src\envir\envirbase.cc
的行,它读取 sim-time-limit
的值:
opt->simtimeLimit = cfg->getAsDouble(CFGID_SIM_TIME_LIMIT, -1);