我发现信息表明可以以某种方式循环配置: some_variable = ${several value},但没有条件条款在 .ini 文件中,无法将来自 C++ 函数的任何数据传递给这些文件(就我而言)。
事实上你可以使用内置的约束 http://www.omnetpp.org/doc/omnetpp/manual/usman.html#sec346INI 文件中的表达式。这将允许您为给定的配置创建运行,同时尊重指定的约束(健康)状况)。
但是,此约束仅适用于 .ini 文件中指定的参数,即,如果您尝试更改的变量是作为代码的一部分动态计算的,则这对您没有帮助
下面,我从 .ini 文件中为您提供了一个相当复杂的“代码片段”,它使用了您提到的许多内置函数(变量迭代、条件等)
# Parameter assignment using iteration loops and constrains #
# first define the static values on which the others depend #
scenario.node[*].application.ADVlowerBound = ${t0= 0.1}s
scenario.node[*].application.aggToServerUpperBound = ${t3= 0.9}s
#
## assign values to "dependent" parameters using variable names and loop iterations #
scenario.node[*].application.ADVupperBound = ${t1= ${t0}..${t3} step 0.1}s # ADVupperBound == t1; t1 will take values starting from t0 to t3 (0.1 - 0.9) iterating 0.1
scenario.node[*].application.CMtoCHupperBound = ${t2= ${t0}..${t3} step 0.1}s
#
## connect "dependent" parameters to their "copies" -- this part of the snippet is only variable assignment.
scenario.node[*].application.CMtoCHlowerBound = ${t11 = ${t1}}s
scenario.node[*].application.joinToServerLowerBound = ${t12 = ${t1}}s
#
scenario.node[*].application.aggToServerLowerBound = ${t21 = ${t2}}s
scenario.node[*].application.joinToServerUpperBound = ${t22 = ${t2}}s
#
constraint = ($t0) < ($t1) && ($t1) < ($t2) && ($t2) < ($t3)
# END END END #
上面的代码创建了所有可能的时间值组合t0
to t3
,他们可以在之间取值0.1
and 0.9
.
t0
and t3
分别是起点和终点。t1
and t2
以它们为基础采取价值观。
t1
将取之间的值t0
and t3
每次增加0.1
(参见上面的语法)。对于t2
too.
不过,我想要t0
总是小于t1
, t1
小于t2
, and t2
小于t3
。我在中指定这些条件constraint
部分。
我确信,仔细阅读this http://www.omnetpp.org/doc/omnetpp/manual/usman.html#sec341手册的部分将帮助您找到解决方案。