avrora.sim.radio
Class SimpleAir

java.lang.Object
  extended byavrora.sim.radio.SimpleAir
All Implemented Interfaces:
RadioAir

public class SimpleAir
extends java.lang.Object
implements RadioAir

Very simple implementation of radio air. It assumes a lossless environment where all radios are able to communicate with each other. This simple air is blind to the frequencies used in transmission (i.e. it assumes that all frequencies are really the same).

This class should provide the proper scheduling policy with respect to threads that more complicated radio implementations can use the time scheduling policy and only overload the delivery policy.


Nested Class Summary
protected  class SimpleAir.DeliveryMeet
           
protected  class SimpleAir.RadioClock
          An extended version of GlobalClock that implements a version of LocalMeet that is appropriate for delivering radio packets.
protected  class SimpleAir.RadioTicker
          The RadioTicker class is the global timer for the radio.
 
Field Summary
static int bitPeriod
           
static int bitPeriod2
           
 long bitsDiscarded
           
static int bytePeriod
          The amount of cycles it takes for one byte to be sent.
 long bytesAttempted
           
 long bytesCorrupted
           
 long bytesDelivered
           
protected  Radio.RadioPacket firstPacket
           
 long firstPacketTime
           
protected  java.util.LinkedList packetsLeftOver
           
protected  java.util.LinkedList packetsThisPeriod
           
protected  SimpleAir.RadioClock radioClock
          GlobalClock used by the air environment.
protected  java.util.HashSet radios
           
static int sampleTime
           
static SimpleAir simpleAir
           
protected  boolean utilization
           
 
Constructor Summary
SimpleAir()
           
 
Method Summary
 void addRadio(Radio r)
          Add a radio to the environment.
 void recordUtilization(boolean v)
           
 void removeRadio(Radio r)
          Remove a radio from the environment.
 int sampleRSSI(Radio r)
           
 void transmit(Radio r, Radio.RadioPacket f)
          Transmits frame f into the radio environment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

simpleAir

public static final SimpleAir simpleAir

radioClock

protected final SimpleAir.RadioClock radioClock
GlobalClock used by the air environment. Essential for synchronization.


firstPacket

protected Radio.RadioPacket firstPacket

packetsThisPeriod

protected java.util.LinkedList packetsThisPeriod

packetsLeftOver

protected java.util.LinkedList packetsLeftOver

radios

protected final java.util.HashSet radios

utilization

protected boolean utilization

firstPacketTime

public long firstPacketTime

bytesDelivered

public long bytesDelivered

bytesAttempted

public long bytesAttempted

bitsDiscarded

public long bitsDiscarded

bytesCorrupted

public long bytesCorrupted

bytePeriod

public static final int bytePeriod
The amount of cycles it takes for one byte to be sent.

See Also:
Constant Field Values

bitPeriod

public static final int bitPeriod
See Also:
Constant Field Values

bitPeriod2

public static final int bitPeriod2
See Also:
Constant Field Values

sampleTime

public static final int sampleTime
See Also:
Constant Field Values
Constructor Detail

SimpleAir

public SimpleAir()
Method Detail

recordUtilization

public void recordUtilization(boolean v)

addRadio

public void addRadio(Radio r)
Description copied from interface: RadioAir
Add a radio to the environment.

Specified by:
addRadio in interface RadioAir

removeRadio

public void removeRadio(Radio r)
Description copied from interface: RadioAir
Remove a radio from the environment.

Specified by:
removeRadio in interface RadioAir

transmit

public void transmit(Radio r,
                     Radio.RadioPacket f)
Description copied from interface: RadioAir
Transmits frame f into the radio environment.

Specified by:
transmit in interface RadioAir

sampleRSSI

public int sampleRSSI(Radio r)
Specified by:
sampleRSSI in interface RadioAir