Skip to main content

Two nodes: Summary

Sending messages from one node to another is simple. You need to define gates in the nodes, connect them and then use send() to send messages around.

In our last example, we had quite a lot of messages, bouncing here and there.

The biggest difficulty in mastering discrete event network simulations is to:

  1. Understand the time properties: You can only schedule events into the future.
  2. Understand that many nodes have the same behaviour code, but actually do different things, depending on what messages they receive.

Play with the message timings in our example - try to set the timing of the random SEND_CHANGE_TO_YELLOW to a fixed value: First, with node 1 sending it out first (e.g. at 100) and node 2 later (e.g. 300); Then the other way around or at exactly the same time. Use a parameter to simplify the process. Observe the behaviour.