【发布时间】:2019-01-02 10:59:59
【问题描述】:
在我的模拟中,我需要在停车场停放一辆车,当汽车离开停车场时,它会将他们的信息传递给停车场内的其余汽车。因此,当车辆停在停车场时停车时,不应中断与外部或与停车场内部的通信。
我正在使用 omnetpp-5.0、sumo-0.25.0 和 Veins-veins-4.4。我尝试将更改应用于基础静脉,但没有得到结果。
如何在不中断与停车场内外的通信的情况下停车?
谁能帮帮我?
【问题讨论】:
在我的模拟中,我需要在停车场停放一辆车,当汽车离开停车场时,它会将他们的信息传递给停车场内的其余汽车。因此,当车辆停在停车场时停车时,不应中断与外部或与停车场内部的通信。
我正在使用 omnetpp-5.0、sumo-0.25.0 和 Veins-veins-4.4。我尝试将更改应用于基础静脉,但没有得到结果。
如何在不中断与停车场内外的通信的情况下停车?
谁能帮帮我?
【问题讨论】:
我不是静脉方面的专家,所以我只能代表相扑方面。您可以简单地在车辆路线上添加一个停靠点并标记它是这样的停车场:
<vehicle id="1" depart="0">
<route edges="edge1 edge2"/>
<stop lane="edge2_0" endPos="100" duration="100" parking="true"/>
</vehicle>
如果这不起作用,因为停车将车辆从网络中移除,因此可能会因为不再有可靠的位置而禁用通信,然后在您的网络中创建一个单独的街道:
<vehicle id="1" depart="0">
<route edges="edge1 edge2a parking edge2b"/>
<stop lane="parking_0" endPos="100" duration="100"/>
</vehicle>
其中“停车位”至少有一个多于 edge2 的车道,以便车辆可以超车。 (我从内存中写了这个例子,没有测试,所以可能有错误。)
【讨论】:
下面的摘录可能会有所帮助,因为它展示了一辆临时停车的车辆(模拟停车)。有关详细信息,请查看 TraCIMobility.cc
void TraCIMobility::handleSelfMsg(cMessage *msg)
{
if (msg == startAccidentMsg) {
commandSetSpeed(0);
simtime_t accidentDuration = par("accidentDuration");
scheduleAt(simTime() + accidentDuration, stopAccidentMsg);
accidentCount--;
}
else if (msg == stopAccidentMsg) {
commandSetSpeed(-1);
if (accidentCount > 0) {
simtime_t accidentInterval = par("accidentInterval");
scheduleAt(simTime() + accidentInterval, startAccidentMsg);
}
}
}
【讨论】: