avrora.sim.types
Class SensorSimulation

java.lang.Object
  extended byavrora.util.help.HelpCategory
      extended byavrora.sim.Simulation
          extended byavrora.sim.types.SensorSimulation
All Implemented Interfaces:
HelpItem

public class SensorSimulation
extends Simulation

The SensorSimulation class represents a simulaion type where multiple sensor nodes, each with a microcontroller, sensors, and a radio, are run in parallel. It supports options from the command line that allow a simulation to be constructed with multiple nodes with multiple different programs.


Nested Class Summary
protected  class SensorSimulation.SensorNode
          The SensorNode class extends the Node class of a simulation by adding a reference to the radio device as well as sensor data input.
 
Nested classes inherited from class avrora.sim.Simulation
Simulation.Monitor, Simulation.Node
 
Field Summary
static java.lang.String HELP
           
 Option.List NODECOUNT
           
 Option.Interval RANDOM_START
           
 Option.List SENSOR_DATA
           
 Option.Long STAGGER_START
           
 Option.Str TOPOLOGY
           
 Option.Bool UPDATE_NODE_ID
           
 
Fields inherited from class avrora.sim.Simulation
CLOCKSPEED, EXTCLOCKSPEED, MCU, monitorFactoryList, MONITORS, nodes, num_nodes, options, paused, PLATFORM, random, RANDOMSEED, running, SCHEDULE, SECONDS, synchronizer
 
Fields inherited from class avrora.util.help.HelpCategory
COMPARATOR, help, name
 
Constructor Summary
SensorSimulation()
           
 
Method Summary
protected  void instantiateNodes()
           
 Simulation.Node newNode(int id, PlatformFactory pf, LoadableProgram p)
          The newNode() method creates a new node in the simulation.
 void process(Options o, java.lang.String[] args)
          The process() method processes options and arguments from the command line.
 void setAir(RadioAir nair)
           
 
Methods inherited from class avrora.sim.Simulation
createNode, getNode, getNodeIterator, getNumberOfNodes, getPlatform, getRandom, isPaused, isRunning, join, pause, processMonitorList, removeNode, resume, start, stop, stopNode
 
Methods inherited from class avrora.util.help.HelpCategory
addCommandExample, addListSection, addOptionSection, addSection, addSubcategorySection, getHelp, getName, printHelp, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HELP

public static java.lang.String HELP

NODECOUNT

public final Option.List NODECOUNT

TOPOLOGY

public final Option.Str TOPOLOGY

RANDOM_START

public final Option.Interval RANDOM_START

STAGGER_START

public final Option.Long STAGGER_START

SENSOR_DATA

public final Option.List SENSOR_DATA

UPDATE_NODE_ID

public final Option.Bool UPDATE_NODE_ID
Constructor Detail

SensorSimulation

public SensorSimulation()
Method Detail

newNode

public Simulation.Node newNode(int id,
                               PlatformFactory pf,
                               LoadableProgram p)
The newNode() method creates a new node in the simulation. In this implementation, a SensorNode is created that contains, in addition to the simulator, ID, program, etc, a reference to the Radio instance for the node and a SimulatorThread for the node.

Overrides:
newNode in class Simulation
Parameters:
id - the integer identifier for the node
pf - the platform factory to use to instantiate the node
p - the program to load onto the node
Returns:
a new instance of the SensorNode class for the node

process

public void process(Options o,
                    java.lang.String[] args)
             throws java.lang.Exception
The process() method processes options and arguments from the command line. In this implementation, this method accepts multiple programs from the command line as arguments as well as options that describe how many of each type of node to instantiate.

Specified by:
process in class Simulation
Parameters:
o - the options from the command line
args - the arguments from the command line
Throws:
java.lang.Exception - if there is a problem loading any of the files or instantiating the simulation

setAir

public void setAir(RadioAir nair)

instantiateNodes

protected void instantiateNodes()
Overrides:
instantiateNodes in class Simulation