omnet++event-simulation

Specifying simulation end time in terms of number of events in omnet++


In omnetpp.ini, to end a simulation we specify:

sim-time-limit = 10s (say)

How to specify this in terms of number of events. Does OMNeT++ have a related parameter in built?


Solution

  • No, OMNeT++ does not have ready to use parameter to stop a simulation after specified number of events.
    However, it is possible to achieve that behaviour programmatically, by adding the following piece of code to every handleMessage():

    if (getSimulation()->getEventNumber() > 20000) {
        endSimulation();
    }