1

OMNeT++ で要素の.iniファイルのいくつかのパラメーターを変更したいと考えています。たとえば、ノードが制御メッセージを受信するときなど、シミュレーションの実行中にノードの伝送速度を変更したいと考えています。

一部の変数= ${複数の値}として記述された構成を何らかの方法でループすることが可能であるという情報を見つけましたが、 .iniファイルには条件句がなく、それらのファイルに C++ 関数からのデータを渡す方法はありません (私は心配です)。

私は INET を使用していますが、他のモデルのユーザーはすでにこのような問題に悩まされているかもしれません。

4

3 に答える 3

3

I found information saying that it's possible to somehow loop the configuration stated as: some_variable = ${several values}, but there are no conditional clauses in .ini files and no way to pass to those files any data from C++ functions (as far as I'm concerned).

In fact you can use the built-in constraint expression in the INI file. This will allow you to create runs for the given configuration while respecting the specified constraint (condition).

However, this constraint will only apply to the parameters that are specified in the .ini file, i.e. this won't help you if the variable which you are trying to change is computed dynamically as part of the code

Below, I give you a rather complicated "code-snippet" from the .ini file which uses many of the built-in functions that you have mentioned (variable iteration, conditionals etc.)

                # 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 #

The code above creates all the possible combinations of time values for t0 to t3, where they can take values between 0.1 and 0.9.

t0 and t3 are the beginning and the end points, respectively. t1 and t2 take values based on them.

t1 will take values between t0 and t3 each time being incremented by 0.1 (see the syntax above). The same is true for t2 too.

However, I want t0 to always be smaller than t1, t1 smaller than t2, and t2 smaller than t3. I specify these conditions in the constraint section.

I am sure, a thorough read through this section of the manual, will help you find the solution.

于 2015-04-14T08:21:57.933 に答える
0

確かに揮発性パラメーターを手動で変更できますが、OMNeT++ (私が知る限り) は、実行時にパラメーターを自動変更するための統合サポートを提供していません。

ただし、揮発性パラメーターをプログラムで変更するモデル コードを作成することはできます。

于 2015-04-14T07:43:58.803 に答える