У меня проект ВАНЭЦ, работаю с вен-2.0-рс2.
В классе LinearMobility.cc у меня есть этот код,
void LinearMobility::initialize(int stage)
{
BaseMobility::initialize(stage);
debugEV << "initializing LinearMobility stage " << stage << endl;
if (stage == 0)
{
move.setSpeed(par("speed").doubleValue());
acceleration = par("acceleration");
angle = par("angle");
angle = fmod(angle,360);
}
else if(stage == 1)
{
stepTarget = move.getStartPos();
if(!world->use2D())
{
opp_warning("This mobility module does not yet support 3 dimensional movement."\
"Movements will probably be incorrect.");
}
if(!world->useTorus())
{
opp_warning("You are not using a torus (parameter \"useTorus\" in"\
"BaseWorldUtility module) playground but this mobility"\
"module uses WRAP as border policy.");
}
}
}
Я пытаюсь добавить событие аварии в свой сценарий, изменив класс LinearMobility.cc.
void LinearMobility::initialize(int stage)
{
BaseMobility::initialize(stage);
debugEV << "initializing LinearMobility stage " << stage << endl;
if (stage == 0){
move.setSpeed(par("speed").doubleValue());
acceleration = par("acceleration");
angle = par("angle");
angle = fmod(angle,360);
accidentCount = par("accidentCount");
WATCH(angle);
startAccidentMsg = 0;
stopAccidentMsg = 0;
if (accidentCount > 0) {
simtime_t accidentStart = par("accidentStart");
startAccidentMsg = new cMessage("scheduledAccident");
stopAccidentMsg = new cMessage("scheduledAccidentResolved");
scheduleAt(simTime() + accidentStart, startAccidentMsg);
}
}
else if(stage == 1){
stepTarget = move.getStartPos();
if(!world->use2D()) {
opp_warning("This mobility module does not yet support 3 dimensional movement."\
"Movements will probably be incorrect.");
}
if(!world->useTorus()) {
opp_warning("You are not using a torus (parameter \"useTorus\" in"\
"BaseWorldUtility module) playground but this mobility"\
"module uses WRAP as border policy.");
}
}
}
void LinearMobility::handleSelfMsg(cMessage *msg)
{
if (msg == startAccidentMsg) {
simtime_t accidentDuration = par("accidentDuration");
scheduleAt(simTime() + accidentDuration, stopAccidentMsg);
accidentCount--;
}
else if (msg == stopAccidentMsg) {
if (accidentCount > 0) {
simtime_t accidentInterval = par("accidentInterval");
scheduleAt(simTime() + accidentInterval, startAccidentMsg);
}
}
}
Но у меня есть эта проблема в OMNeT++:
undisposed object: (cMessage) Scenario.node[0].mobility.scheduledAccidentResolved -- проверить деструктор модуля
undisposed object: (cMessage) Scenario.node[0].mobility.scheduledAccident -- проверка деструктора модуля
undisposed object: (cMessage) Scenario.node[1].mobility.move -- проверить деструктор модуля undisposed object: (cMessage) Scenario.node[2].mobility.move -- проверить деструктор модуля undisposed object: (cMessage) Scenario. node[3].mobility.move -- проверить деструктор модуля undisposed object: (cMessage) Scenario.node[4].mobility.move -- проверить деструктор модуля
Может ли кто-нибудь помочь мне решить эту проблему?