Oh, I forgot to mention where to place the methods indicated in the
user manual for terminating the simulation...
Normally, a node may die either because it is out of energy, or
because of physical damages (e.g. a wildfire burns the main board
etc.).
In file $CASTALIA_HOME/src/Node/Resource_Manager/
ResourceGenericManager.cc you will find the consumeEnergy() and
destroyNode() methods.
Each node is an instance of a compound module, and thus, when it
consumes energy or gets damaged, these two functions are called
respectively, independently for each node.
Normally the simulation won't stop when a node becomes dead. However,
you can follow one the following tricks to do so:
---- (A) Stop simulation from within Resource_Manager module ----
Inside consumeEnergy() method's body, locate the following block:
if(remainingEnergy < amount)
At the end of this block (but still inside it), you can add a
simulation termination method call.
Similarly, you may add a simulation termination method call at the end
of the main body of method destroyNode(void).
---- (B) Stop simulation from within Application module ----
If you notice, inside methods consumeEnergy() and destroyNode() there
is code which sends special control messages of kind
RESOURCE_MGR_OUT_OF_ENERGY and RESOURCE_MGR_DESTROY_NODE to the
following modules:
- sensor device manager
- application
- network
- Mac
- Radio
When these modules receive such control messages, they get disabled,
and stop processing incoming messages.
It is should be now clear, that you can alternatively add a simulation
termination method call inside the code of the modules listed above,
at the points that they handle the control messages of type
RESOURCE_MGR_OUT_OF_ENERGY or/and RESOURCE_MGR_DESTROY_NODE
Hope that helps,
Dimos
On 20 Oct, 14:31, Dimos <
dimosthe...@gmail.com> wrote:
> Dear Prakash,
>
> please refer tohttp://
www.omnetpp.org/doc/omnetpp33/manual/usman.html#sec188