The simulation runs but in the console I have this note.
undisposed object: (omnetpp::cMessage) Mysimulation.Switch4.eth[2].queue.scheduler.IntervalTimemsg -- check module destructor undisposed object: (omnetpp::cMessage) Mysimulation.Switch5.eth[1].queue.scheduler.IntervalTimemsg -- check module destructor
Actually It is a module that I have created using two timing messages over and over through the simulation. I read online and found that this error is related to creating objects that is not deleted at the time it should be deleted.
void PriorityScheduler::initialize() {
gateCycleTimemsg = new cMessage("gateCycleTimemsg");
scheduleAt(baseTime , gateCycleTimemsg);
// baseTime = 2s
}
void PriorityScheduler::handleMessage(cMessage *msg) {
if (msg == gateCycleTimemsg) {
if (currentList == (lastIntervalTime)) {
delete msg;
gateCycleTimemsg = new cMessage("gateCycleTimemsg");
scheduleAt( simTime() + gateCycleTime , gateCycleTimemsg);
...
IntervalTimemsg = new cMessage("IntervalTimemsg");
scheduleAt( simTime() + Interval , IntervalTimemsg);
}
else if (currentList == (firstIntervalTime)) {
gateCycleTimemsg = msg; // same message reused
scheduleAt(simTime() + gateCycleTime , gateCycleTimemsg);
//gateCycleTime = 10 seconds
...
IntervalTimemsg = new cMessage("IntervalTimemsg");
scheduleAt( simTime() + Interval , IntervalTimemsg);
// Interval = 1s
}
}
else if (msg == IntervalTimemsg) {
if (currentList == (lastIntervalTime));
else{
IntervalTimemsg = msg;
scheduleAt( simTime() + Interval , IntervalTimemsg);
}
}
Plugin path: /home/amr/omnetpp-5.0/samples/etc/plugins;./plugins terminate called after throwing an instance of 'omnetpp::cRuntimeError' what(): Object pk-56-145 is currently in (omnetpp::cEventHeap)simulation.scheduled-events, it cannot be deleted. If this error occurs inside omnetpp::cEventHeap, it needs to be changed to call drop() before it can delete that object. If this error occurs inside omnetpp::cEventHeap's destructor and pk-56-145 is a class member, omnetpp::cEventHeap needs to call drop() in the destructor
I created a constructor as well as destructor. I also created the function finish() after reading online for solutions. Still this didn't solve it.
I also removed each message received and created a new one while sending but It didn't change any thing.
edit: I edited the coding with delete msg; I added and gave an example of timings and added the below part,
BaseTime 'BT', gateCycleTime 'CT', Interval 'IT'
----> BT
<---- IT1 ----> <----- IT2 ----> .........<-------- ITx -------->
<------------------------------ CT ----------------------------->
I used the same message for BT and CT while another message for ITs as I dont know the timing of the last IT 'ITx'.