avrora.sim.types
Class SensorSimulation
java.lang.Object
avrora.util.help.HelpCategory
avrora.sim.Simulation
avrora.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. |
Fields inherited from class avrora.sim.Simulation |
CLOCKSPEED, EXTCLOCKSPEED, MCU, monitorFactoryList, MONITORS, nodes, num_nodes, options, paused, PLATFORM, random, RANDOMSEED, running, SCHEDULE, SECONDS, synchronizer |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
SensorSimulation
public SensorSimulation()
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 nodepf
- the platform factory to use to instantiate the nodep
- 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 lineargs
- 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