我是新来的。我需要访问网络参数才能在sensornode.cc文件中使用它。因为我统一分发节点wrt用户输入。我的意思是,我想用网络参数来检查分布范围,比如宽度和高度。
我尝试过cPar,但是失败了,因为参数没有在sensornode.ned中定义。那么,如何在sonsornode.cc中访问这个参数。
rng =par("range");
widthInCC =par("width");
if(rng>widthInCC+1)
rng=widthInCC+1;
snX=uniform(0,rng);
snY=uniform(0,rng);simple SensorNode { parameters: double range @unit(m);
gates:
inout snsGate[] @loose;}
发布于 2015-11-27 13:13:15
首先获得指向网络模块的指针,然后也可以获得该参数。
int width = getParentModule()->par("width");https://stackoverflow.com/questions/33853312
复制相似问题