Skip to main content

The simulation kernel

The simulation kernel is the heart of OMNeT++ and any other discrete event simulator. It is the one that takes all of your messages, organizes them into the event queue (see last page) and calls them one by one when their time has come.

It is very important to understand some principles:

  1. Your simulation consists of nodes that produce and consume messages. This is pretty much all. No messages, no simulation.
  2. Once you "give" your message to the kernel (for example, by using scheduleAt() or send()), it is added to the event queue and you cannot and should not access it any more. It is not "yours" any more.
  3. Once the time of the event has come, the kernel will send it to the node it is destined to and call the node's handleMessage() with the message inside.

You can imagine the whole thing as a postal system. You write letters, to yourself and to others. You hand them over to the post service and once there, you are out of control. The post service will place them in the respective letterbox once the time comes. (It is an advanced post service with scheduled delivery times).

Note: In fact, you can delete an already scheduled message, but you need to call the function cancelEvent() with the original message pointer.