I am using Omnet++ and creating a scenario where a sender keeps sending packets to a receiver (uni-directional communication from sender to receiver) and I have set a counter on both the simple modules of sender and receiver.
Since the sender's counter counts down to zero first than the receiver, the simulation run well but it does not record statistics since all that is done at the receiver.
after the counter is decreased to zero both the modules invoke a finish()
function.
sender::finish()
{
EV << "message limit reached \n";
cancelAndDelete(myEvent);
}
receiver's finish function:
void receiver::finish()
{
EV << "mean: "<< iatStats.getMean() << endl;
EV << "std.dev: " << iatStats.getStddev() << endl;
EV << "variance: " << iatStats.getVariance() << endl;
iatStats.recordAs("Inter-Arrival Times");
recordScalar("#IAT", interAT_diff);
}
here iat is calculation for inter-arrival time between the packets at the receiver.
After the simulation runs, the sender's finish()
is invoked first and the simulation stops and no data is recorded in /results
folder only blank .vec
or .sca
files exist.
also the terminal says simulation fault: core dumped
The problem is how can I "pause" the sender block once the counter is run out and let the receiver invoke it's finish()
function so that I could see the stats and also record all the data I need?
Hope the description is clear enough. Thanks