admin管理员组

文章数量:1332873

I am a beginner in OMNet++. I need to chnage my mobiliity parameter during runtime. I came across the handleParameterChange() in OMNet++ simulation Manual . I actually want to set the displayCommunicationRange parameter to true of a particular node.

cModule* cNode=getParentModule()->getSubmodule("wlan", 0)->getSubmodule("radio");  
cNode->par("displayCommunicationRange").setBoolValue(true);  

but this results that the parameter cannot be set during runtime. Can anyone give me steps to use handleParameterChange() to do this?

I am a beginner in OMNet++. I need to chnage my mobiliity parameter during runtime. I came across the handleParameterChange() in OMNet++ simulation Manual . I actually want to set the displayCommunicationRange parameter to true of a particular node.

cModule* cNode=getParentModule()->getSubmodule("wlan", 0)->getSubmodule("radio");  
cNode->par("displayCommunicationRange").setBoolValue(true);  

but this results that the parameter cannot be set during runtime. Can anyone give me steps to use handleParameterChange() to do this?

Share Improve this question edited Nov 25, 2024 at 7:57 Nishani Kasineshan asked Nov 22, 2024 at 5:14 Nishani KasineshanNishani Kasineshan 6828 silver badges16 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

You have to add the @mutable property to the parameter to allow parameter changes. As this is display parameter that is not cached (i.e. it is always accessed by par() you don't have to implement anything in handleParameteChange()

本文标签: Change parameters during runtime using handleParameterChange() in OMNetStack Overflow