I have written a line of codes in omnetpp.ini file like:
S.node[0..4].forwarding = false
What I want to do is change the parameter "forwarding" dynamically (dynamically switching between true and false) in UDPBasicApp module.
void UDPBasicApp::processForwardSwitch(){
if (isSelfish) {
//std::cout << host->par("forwarding").str() << std::endl;
if (rand()%10<5)
host->par("forwarding").setBoolValue(false);
else
host->par("forwarding").setBoolValue(true);
}
scheduleAt(simTime()+forwardSwitchInterval, forwardSwitchTimer);
}
I can confirm the value of the parameter does changes during simulation, but it seems no effect to the modules related to this parameter, e.g. routing modules. Anyone help? Thanks in advance!
Usually parameters are read only once, during initialization of a module.