配置文件中的变量算术错误 [英] Errors while variable arithmetic in configuration file

查看:101
本文介绍了配置文件中的变量算术错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据一个不同的变量和一个数字来计算一个ini变量,但是我无法使其正常工作.我尝试了以下代码的不同版本-该词前后带有方括号:

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 ++总是给我这个错误:

OMNeT++ always gives me this error:

错误:无法从中读取选项sim-time-limit = 配置:语法错误解析数量"0 + 2400s":垃圾 在第一个数字之后

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

我还尝试使用($warmup)代替${warump},如

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

错误:无法从中读取选项sim-time-limit = 配置:语法错误解析数量'(0)+ 2400s':必须开始 用数字

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版.

I am using OMNeT++ version 5.1.

推荐答案

对于sim-time-limit,无法使用INI变量,因为模拟环境只希望 个数字(带单位).这是来自src\envir\envirbase.cc的行,该行读取sim-time-limit的值:

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);

这篇关于配置文件中的变量算术错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆