我的问题是: 我构建了一个用于模拟通信网络的c ++代码(使用OMNeT ++离散事件模拟器)直到没有错误并且模拟完成,当我试图增加模拟实体的数量时,在任何运行中,模拟停止的某个时间点在命令提示符中打印的消息显示“此应用程序已请求运行时以不寻常的方式终止它。请联系应用程序的支持团队以获取更多信息“并在标题”应用程序错误“下的专用窗口中显示错误消息”应用程序位置发生异常未知软件异常(0x40000015).......“ 我认为问题,即模拟在以下代码中停止并由于此部分“((cMessage *)msg-> dup()”(但可能不正确):
********
`void ChannelAccess :: sendToChannel(AirFrame * msg) { const ChannelControl :: ModuleList& neighbors = cc-> getNeighbors(myHostRef);
coreEV << "sendToChannel: sending to gates\n";
// loop through all hosts in range
ChannelControl::ModuleList::const_iterator it;
for (it = neighbors.begin(); it != neighbors.end(); ++it)
{
cModule *mod = *it;
// we need to send to each radioIn[] gate
cGate *radioGate = mod->gate("radioIn");
if (radioGate == NULL)
error("module %s must have a gate called radioIn", mod->fullPath().c_str());
for (int i = 0; i < radioGate->size(); i++)
{
ChannelControl::HostRef h = cc->lookupHost(mod);
if (h == NULL)
error("cannot find module in channel control");
if (h->channel == msg->getChannelNumber())
{
coreEV << "sending message to host listening on the same channel\n";
// account for propagation delay, based on distance in meters
// Over 300m, dt=1us=10 bit times @ 10Mbps
sendDirect((cMessage *)msg->dup(),myHostRef->pos.distance(h->pos) / LIGHT_SPEED, mod, radioGate->id() + i);
}
else
coreEV << "skipping host listening on a different channel\n";
}
}
// register transmission in ChannelControl
cc->addOngoingTransmission(myHostRef, msg);
} ` 的 ********* 所以,任何帮助都将受到赞赏,因为我想为大量节点运行模拟。
对于知识我使用win xp SP3和win 7,OMNet ++ 3.3,Microsoft visual c ++ 2005 express edition,我运行模拟的计算机之一是带8G RAM的i7处理器。
提前谢谢。