Search code examples
omnet++veins

What does (stage=0) mean in Veins application?


I've been studying TraciDemo11p and couldn't clearly understand what does stage means.

void TraCIDemo11p::initialize(int stage)
{
    DemoBaseApplLayer::initialize(stage);
    if (stage == 0) {
        sentMessage = false;
        lastDroveAt = simTime();
        currentSubscribedServiceId = -1;
    }
}

Solution

  • This is explained in the OMNeT++ user manual, section 4.3.3.3 ("Multi-Stage Initialization"): Basically, OMNeT++ modules can be initialized in multiple stages. This allows modules to ensure that, first, all stage 0 initialization is performed for all modules, then all stage 1 initialization, and so on.