The scheduler service is usually hardware dependent, as it requires interaction with the specific single board computer (SBC) to put it into a sleep state and allow it to be woken up. On modems, this is usually the modem driver agent.
The HalfDuplexModem
simulated modem doesn't provide this service, and so it won't work out of the box. Since HalfDuplexModem
doesn't have an energy model build into it, "sleep" doesn't mean much to it. If you wanted to simulate networks where nodes slept and consumed less energy during the sleep, it would be possible to extend the HalfDuplexModem
to implement the SCHEDULER service. The service is quite simple, with just 4 messages (AddScheduledSleepReq
, RemoveScheduledSleepReq
, GetSleepScheduleReq
and WakeFromSleepNtf
). Your implementation could keep track of the energy used by each node, based on whether it is sleeping, listening or transmitting, since you can keep track of the sleep schedule and hence know how much time the node has been awake/sleeping.
Commands addsleep
, showsleep
etc are simply convenience shortcuts in the shell extension that use the above 4 messages to do the actual work. They are enabled in the shell by loading the SchedulerShellExt
, and you can simply use the messages directly from agents or in simulation scripts.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…