Java in Simulation Time

From
Jump to navigation Jump to search

Misc

Pitfalls

  • Use Java 1.4 compatibility, BCel cannot handle Java 5.0
  • If more than one node use the same NetAddress, the simulation aborts prematurely without any error message.
  • All entity classes and related interfaces MUST be public.
  • JiST does not support JUnit.Workaround: Write test code without JUnit support.
  • Superclasses must be final. Otherwise the Rewriter generates invalid code (A java.verifier exception will occur). So a best practise is to mark all concrete classes as final to prevent this error.
  • Since it is a discrete simulator, it is possible to schedule more than one event at exactly one point in time. In this particular case, the execution order is not predefined.
  • Jist does not (fully) support polymorphism for implementation classes (entities), only for interfaces.
    • Workaround 1: Do not use implementation inheritance.
    • Workaround 2: Use implementation inheritance, but do not use overriding of methods.
    • Workaround 3: Use method overriding, but make sure all methods (the overridden and the overriding) are both rewritten in the same way, i.e. they are both continuable or both not.

Interesting Things

computeAvgConnectivity

Collisions

  • RadioNoiseIndep and RadioSimpleStochastic both do not implement packet collisions on radio level:
 RadioNoiseIndep.receive():

     case Constants.RADIO_MODE_RECEIVING:
       if(Main.ASSERT) Util.assertion(signals>0);
       if(power_mW >= radioInfo.shared.threshold_mW
           &&  power_mW > signalPower_mW*thresholdSNR)
       {
         lockSignal(msg, power_mW, duration);
       }
       break;
  • RadioNoiseAdditive implements additive superposition of radio signals and packet collisions. A signal is received only if it is stronger than thresholdSNR multiplied with the sum of the power of all other signals. Otherwise all signals are scrambled.
 RadioNoiseAdditive.receive():

     case Constants.RADIO_MODE_RECEIVING:
       if(power_mW > signalPower_mW  &&  power_mW >= totalPower_mW*thresholdSNR)
       {
         lockSignal(msg, power_mW, duration);
         setMode(Constants.RADIO_MODE_RECEIVING);
       }
       else if(type == SNR  
           &&  signalPower_mW < (totalPower_mW-signalPower_mW+power_mW)*thresholdSNR)
       {
         unlockSignal();
         setMode(Constants.RADIO_MODE_SENSING);
       }
       break;


Multi-Channel Support for JiST

Architecture

RadioIf <|--- ChannelIf ---|> FieldIf
NetworkIf
   |
MacIf <|-- Mac802_11 <|-- MacMc802_11
   |                         |
RadioIf                      |
   |                         |
ChannelIf <|------------- Channel
   |
FieldIf
  • Channels are realized through an additional channel layer
    • Has an active channel within a given set of channels
    • Discards packets on other channels
    • Delayed channel switching (only possible, when not transmitting)
    • TODO Cross-channel interference


ExOR Implementation in JiST

Frame Format

  • Data Frame
  • Acknowledgement Frame
    • 802.11 Frame Control
    • DstAddr: Data frame sender’s address
    • SrcAddr: Data frame receiver's address
    • The position within the candidate list of the node with the highest priority acknowledgment
    • 802.11 Frame Control Sequence
|------------------------|----------------------------------------------------|-----|
|                        | Mac Frame                                          |     |
|----------|-------------|---------------|---------|---------|----------|-----|-----|
| Preamble | PLCP Header | Frame Control | DstAddr | SrcAddr | Cand. ID | FCS | Pad |
|----------|-------------|---------------|---------|---------|----------|-----|-----|
Bytes                    | 2             | 6       | 6       | 1        | 4   |
                         |----------------------------------------------------|

References


Extensions

McExOR in JiST

Further Information