Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Omnet++ 如何确定RSU(1000米)和车辆(300米)在Velse-5.0中的传输范围?_Omnet++_Veins - Fatal编程技术网

Omnet++ 如何确定RSU(1000米)和车辆(300米)在Velse-5.0中的传输范围?

Omnet++ 如何确定RSU(1000米)和车辆(300米)在Velse-5.0中的传输范围?,omnet++,veins,Omnet++,Veins,从已经存在的堆栈溢出讨论中,我知道在旧版本的Vives中,传输范围与功率、噪声和灵敏度有关 我的问题是 在最新版本的VELINES 5.1中,RSU和VELINES都考虑了全局传输范围。我怎样才能使它具体化?我想为txPower1=20mW和 txPower2=15.5mW的300米车辆 *.connectionManager.maxInterfDist=1000m\为RSU添加 *.connectionManager.maxInterfDistNodes=300m\为车辆添加 已在conne

从已经存在的堆栈溢出讨论中,我知道在旧版本的Vives中,传输范围与功率、噪声和灵敏度有关

我的问题是 在最新版本的VELINES 5.1中,RSU和VELINES都考虑了全局传输范围。我怎样才能使它具体化?我想为txPower1=20mW和

txPower2=15.5mW的300米车辆

*.connectionManager.maxInterfDist=1000m\为RSU添加 *.connectionManager.maxInterfDistNodes=300m\为车辆添加

已在connection manger.cc中检查maxInterfDist。默认情况下,RSU和车辆的maxInterfDist都考虑最大范围

在BaseConnectionManger.cc文件中,也使用maxInterfDist

我是否需要为返回距离(MaxInterdestfnodes)并因此使用Omnet.ini文件中的另一个参数来定义功率和灵敏度的车辆添加另一种方法?如果是,请指导我在哪里进行更改以及如何进行更改

.omnet.ini

*.connectionManager.maxInterfDist = 1000m
*.connectionManager.maxInterfDistNodes = 300m
*.**.nic.mac1609_4.txPower = 20mW
BaseConnection Manager.cc

'''BaseConnectionManager::isInRange(BaseConnectionManager::NicEntries::mapped_type pFromNic, BaseConnectionManager::NicEntries::mapped_type pToNic)
{
    double dDistance = 0.0;

    if(useTorus) 
    {
        dDistance = sqrTorusDist(pFromNic->pos, pToNic->pos, *playgroundSize);
    } 
    else 
    {
        dDistance = pFromNic->pos.sqrdist(pToNic->pos);
    }
    return (dDistance <= maxDistSquared);
}'''
'''double ConnectionManager::calcInterfDist()
{
    if (hasPar("maxInterfDist")) 
    {
        double interfDistance = par("maxInterfDist").doubleValue();
        ccEV << "max interference distance:" << interfDistance << endl;
        return interfDistance;
    } 
   else
   {
        throw cRuntimeError("ConnectionManager: No value for maximum 
        interference distance (maxInterfDist) provided.");
   }
}'''
double ConnectionManager::calcInterfDist()
{
    if (hasPar("maxInterfDist")) {
        double interfDistance = par("maxInterfDist").doubleValue();
        EV_INFO << "max interference distance:" << interfDistance << endl;
        return interfDistance;
    }
    if (hasPar("maxInterfDistNodes")){
        double interfDistanceNodes = par("maxInterfDistNodes").doubleValue();
                EV_INFO << "max interference distance between  Nodes:" << interfDistanceNodes << endl;
                return interfDistanceNodes;

    }
    else {
        throw cRuntimeError("ConnectionManager: No value for maximum interference distance (maxInterfDist) provided.");
    }
}  
BaseConnectionManager::isInRange(BaseConnectionManager::NicEntries::mapped_-type-pFromNic,BaseConnectionManager::NicEntries::mapped_-type-pToNic) { 双D=0.0; if(useTorus) { dInstance=sqrTorusDist(pFromNic->pos,pToNic->pos,*playgroundSize); } 其他的 { dInstance=pFromNic->pos.sqrdist(pToNic->pos); }
返回(dInstance看起来您将根据节点的类型(RSU或车载模块)设置两个变速器档位

通过定义两个参数(即:分别用于Cars和RSU的maxInterfDistNodes和maxInterfDist),可能有一种“复杂”的方法可以做到这一点,但我可能会考虑在initialize()部分执行此操作,即执行以下操作:

    mac->setTxPower(/*what corresponds the needed transmission power for the node type*/);
  • 在RSU和Car场景文件(traci文件夹文件)中实例化mac模块
  • 在第一阶段(=0),尝试以不同方式调整txPower(根据文件,如果是RSU或汽车)
  • 不要忘记在.ini文件的connectionmanager模块中设置传输上限(因为RSU传输范围是最大的,所以您也应该将其设置为connectionmanager)
  • 即使您看到车辆传输的数据超过了您在其initialize()函数中定义的数据量,这也不是问题,因为事实上,数据包不是由远远超过您定义的数据量(超过300m)的模块接收的,它只是图形化的
如果有误解,请告诉我们


致以最诚挚的问候,

根据建议,这可能是正确的答案。请看一看

物理控制MSG_m.h

class VEINS_API PhyControlMessage : public ::omnetpp::cMessage
{
protected:
double txPowerNodes_mW; //added
public:
virtual double getTxPowerNodes_mW() const;  //added
virtual void setTxPowerNodes_mW(double txPowerNodes_mW); //added
};
物理控制msg_m.cc

//added
double PhyControlMessage::getTxPowerNodes_mW() const
{
    return this->txPowerNodes_mW;
}
//added
void PhyControlMessage::setTxPowerNodes_mW(double txPowerNodes_mW)
{
    this->txPowerNodes_mW = txPowerNodes_mW;
}
Mac1609_4.h

void setTxPowerNodes(double txPowerNodes_mW); //added
double txPowerNodes;
Mac1609_4.cc

void Mac1609_4::initialize(int stage)
{
    BaseMacLayer::initialize(stage);
    if (stage == 0) {

        phy11p = FindModule<Mac80211pToPhy11pInterface*>::findSubModule(getParentModule());
        ASSERT(phy11p);

        // this is required to circumvent double precision issues with constants from CONST80211p.h
        ASSERT(simTime().getScaleExp() == -12);

        txPower = par("txPower").doubleValue();
        txPowerNodes = par("txPowerNodes").doubleValue(); //added

}
void Mac1609_4::handleSelfMsg(cMessage* msg)
{
  if (controlInfo) {
            // if MCS is not specified, just use the default one
            MCS explicitMcs = static_cast<MCS>(controlInfo->getMcs());
            if (explicitMcs != MCS::undefined) {
                usedMcs = explicitMcs;
            }
            // apply the same principle to tx power
            txPower_mW = controlInfo->getTxPower_mW();
            if (txPower_mW < 0) {
                txPower_mW = txPower;
            }  

   // apply the same principle to tx power nodes
        //added
                txPowerNodes_mW = controlInfo->getTxPowerNodes_mW();
                if (txPowerNodes_mW < 0) {
                    txPowerNodes_mW = txPowerNodes;
                }

            }
            else {
                txPowerNodes_mW = txPowerNodes;
                txPower_mW = txPower;
            }
}
ConnectionManager.cc

'''BaseConnectionManager::isInRange(BaseConnectionManager::NicEntries::mapped_type pFromNic, BaseConnectionManager::NicEntries::mapped_type pToNic)
{
    double dDistance = 0.0;

    if(useTorus) 
    {
        dDistance = sqrTorusDist(pFromNic->pos, pToNic->pos, *playgroundSize);
    } 
    else 
    {
        dDistance = pFromNic->pos.sqrdist(pToNic->pos);
    }
    return (dDistance <= maxDistSquared);
}'''
'''double ConnectionManager::calcInterfDist()
{
    if (hasPar("maxInterfDist")) 
    {
        double interfDistance = par("maxInterfDist").doubleValue();
        ccEV << "max interference distance:" << interfDistance << endl;
        return interfDistance;
    } 
   else
   {
        throw cRuntimeError("ConnectionManager: No value for maximum 
        interference distance (maxInterfDist) provided.");
   }
}'''
double ConnectionManager::calcInterfDist()
{
    if (hasPar("maxInterfDist")) {
        double interfDistance = par("maxInterfDist").doubleValue();
        EV_INFO << "max interference distance:" << interfDistance << endl;
        return interfDistance;
    }
    if (hasPar("maxInterfDistNodes")){
        double interfDistanceNodes = par("maxInterfDistNodes").doubleValue();
                EV_INFO << "max interference distance between  Nodes:" << interfDistanceNodes << endl;
                return interfDistanceNodes;

    }
    else {
        throw cRuntimeError("ConnectionManager: No value for maximum interference distance (maxInterfDist) provided.");
    }
}  

这对我的案例有效。我认为这是正确的方法。感谢您的指导。这真的意味着很多。

祝贺您的编辑,您已经习惯使用Velse&omnet++的基础知识。 很遗憾,我现在无法测试它,因为我正在我的其他操作系统中设置模拟,但我可以根据自己的经验进行讨论并发表几点意见:

  • 我发现您对所有通信都使用了一个传输范围,对吗?(即RSU为1000米,汽车为300米)如果是这种情况,那么任务将更容易,因为您需要为每个模块(节点/RSU)创建定义一次传输功率(我将在下面给出定位)
  • 您正确地使用了get和set方法,但我觉得您可以只在传统(已部署)的txPower\u mW字段上工作。您可以在初始化期间将后者(并且取决于模块的类型=RSU/Car)仅设置一次txPower\u mW
  • 正如您所知,我们有时可能会被模拟所欺骗,即使一切看起来都正常工作,但可能存在一些技术错误(至于所用tx_功率与覆盖范围的实际含义之间的匹配,也需要通过改变节点之间的距离进行一些测试(例如20mW和155mW)
  • 我不知道为什么,但我觉得修改connectionmanager模块不是那么明智。另外,从该模块的工作原理来看,您只能有一个interfactance,即:用于计算接收数据包的机会,因为connectionmanager模块不区分传输根据发送方的类型,从而对它们进行同等评估。(并且仍然尊重每个节点的tx_功率)
我建议如下:(它们可能包含错误,因为它们未经测试)

  • 查找每个节点(RSU/Car)对应的mac1609_4。我不知道您使用的是什么文件,但与Cars的(TraCITestApp.cc+h)和RSU的(TraCIDemoRSU11p.cc+h)等效。当然,这是通过将其添加到相应文件的initialize()中来完成的:
1-在车辆的“.h”中+RSU文件:

#include "veins/base/utils/FindModule.h"//added
#include "veins/modules/mac/ieee80211p/Mac1609_4.h"//added

2-在Car+RSU文件的“.cc”中,在其“initialize()”中,更准确地说,在其“if(stage==0)”中添加:

我仍然建议让其他文件不改变,因为这是一个好习惯,尤其是在新的语言/平台等方面(至少对于我来说,我认为我自己的年龄已经足够大了)。因此:你可以将连接管理器返回到它的初始状态。(您可以在继续之前备份整个src文件夹,因为它正在工作)

再一次:我的长篇写作只是为了给你我的想法和一些与我共事的技巧(对目标只做了一些修改),我们总是用经验来增强我们的能力,就像你用上面的代码完美地解决了这个问题一样


祝你好运:)

你能提供一些关于你想做什么的背景信息吗?你的问题
    mac->setTxPower(/*what corresponds the needed transmission power for the node type*/);