在静脉中,我试图模拟一个VANET场景,在这种场景中,如果道路被阻塞,那么在特定的时间之后,汽车会广播一条消息,包括阻塞的道路ID和周围100米的车辆数量。
在TraCIDemo11p应用程序中,当车辆停止超过10秒时,它会将节点颜色更改为红色(以显示事故),并向其他车辆发送包含阻塞道路id的消息,所有这些都是通过handlePositionUpdate方法完成的:
findHost()->getDisplayString().updateWith("r=16,red");
sentMessage = true;
WaveShortMessage* wsm = new WaveShortMessage();
populateWSM(wsm);
wsm->setWsmData(mobility->getRoadId().c_str());
//host is standing still due to crash
if (dataOnSch) {
startService(Channels::SCH2, 42, "Traffic Information Service");
//started service and server advertising, schedule message to self to send later
scheduleAt(computeAsynchronousSendingTime(1,type_SCH),wsm);
}
else {
//send right away on CCH, because channel switching is disabled
sendDown(wsm);
}
可以通过在中更新maxInterfDist值来设置100m的限制。ini文件
*.connectionManager.maxInterfDist = 100m
现在我的问题是如何获得车辆数量和100米的面积,我有一个想法,这将使用TraCI完成,很可能使用
LaneAreaDetector's getJamLengthVehicle
但我不知道这将如何在静脉中完成,他们有没有等效的方法,或者我看错了方向?