各ノードがそれ自体にスケジュールする定期的なメッセージを利用できます。の最終段階に入れてinitialize()
OKです。
次の行で何かを行うことができます。
void initialize(int stage)
{
if (stage == 3)
{
cMessage *pMsg = new cMessage("myPeriodicMessage");
scheduleAt(simTime()+1.0, pMsg);
}
}
次にhandleMessage()
持っています:
void handleMessage(cMessage *msg)
{
if (msg->isSelfMessage())
{
/* if you have different selfMessages, compare them like below, or use different message kinds and checks accordingly */
if (strcmp("myPeriodicMessage", msg->getName())==0)
{
doPeriodicTaks();
scheduleAt(simTime()+1.0, pMsg);
}
}
}
この方法では、必要な情報がノードごとに個別に取得されることに注意してください。集中管理したい場合は、@Rudi の提案に従う必要があります。