I want to modify some parameters of element's .ini file in OMNeT++, say a node's transmission rate, during the simulation run, e.g. when a node receives some control message.
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).
I use INET, but maybe some other models' users already bothered with such a problem.
If you want to change some value during the simulation you can just do that in your C++ code. Something like:
What you are refering to as some_variable = ${several values} can be used to perform multiple runs with different parameters. For example one run with a rate of 1s, one with 2s and one with 10s. That would then be:
For more detailed information how to use such values (like to do loops) see the relevant section in the OMNeT++ User Manual
While you can certainly manually change volatile parameters, OMNeT++ (as far as I am aware) offers no integrated support for automatic changing of parameters at runtime.
You can, however, write some model code that changes volatile parameters programatically.
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.)
The code above creates all the possible combinations of time values for
t0
tot3
, where they can take values between0.1
and0.9
.t0
andt3
are the beginning and the end points, respectively.t1
andt2
take values based on them.t1
will take values betweent0
andt3
each time being incremented by0.1
(see the syntax above). The same is true fort2
too.However, I want
t0
to always be smaller thant1
,t1
smaller thant2
, andt2
smaller thant3
. I specify these conditions in theconstraint
section.I am sure, a thorough read through this section of the manual, will help you find the solution.