Skip to content

NathanBlais/UCM-TinyOS-Network-Implementation

Repository files navigation

Introduction

This code is the based on https://github.com/UCMAndesLab/CSE160-Project-Skeleton-Code.

General Information

Data Structures

There are two data structures included into the project design to help with the assignment. See dataStructures/interfaces/ for the header information of these structures.

  • Hashmap - This is for anything that needs to retrieve a value based on a key.

  • List - The list is design to have pushfront, pushback capabilities. For the most part, you can stick with an array or even a QueueC (FIFO) which are more robust.

General Libraries

/lib/interfaces

  • CommandHandler - CommandHandler is what interfaces with TOSSIM. Commands are sent to this function, and based on the parameters passed, an event is fired.
  • SimpleSend - This is a wrapper of the lower level sender in TinyOS. The features included is a basic queuing mechanism and some small delays to prevent collisions. Do not change the delays. You can duplicate SimpleSendC to use a different AM type or possibly rewire it.
  • Transport - There is only the interface of Transport included. The actual implementation of the Transport layer is left to the student as an exercise. For CSE160 this will be Project 3 so don't worry about it now.

Noise

/noise/

This is the "noise" of the network. A heavy noised network will cause issues with packet loss.

  • no_noise.txt - There should be no packet loss using this model.

Topography

/topo/

This folder contains a few example topographies of the network and how they are connected to each other. Be sure to try additional networks when testing your code since additional ones will be added when grading.

  • long_line.topo - this topography is a line of 19 motes that have bidirectional links.
  • example.topo - A slightly more complex connection

Each line has three values, the source node, the destination node, and the gain. For now you can keep the gain constant for all of your topographies. A line written as 1 2 -53 denotes a one-way connection from 1 to 2. To make it bidirectional include also 2 1 -53.

Running Simulations

The following is an example of a simulation script.

from TestSim import TestSim

def main():
    # Get simulation ready to run.
    s = TestSim();

    # Before we do anything, lets simulate the network off.
    s.runTime(1);

    # Load the the layout of the network.
    s.loadTopo("long_line.topo");

    # Add a noise model to all of the motes.
    s.loadNoise("no_noise.txt");

    # Turn on all of the sensors.
    s.bootAll();

    # Add the main channels. These channels are declared in includes/channels.h
    s.addChannel(s.COMMAND_CHANNEL);
    s.addChannel(s.GENERAL_CHANNEL);

    # After sending a ping, simulate a little to prevent collision.
    s.runTime(1);
    s.ping(1, 2, "Hello, World");
    s.runTime(1);

    s.ping(1, 10, "Hi!");
    s.runTime(1);

if __name__ == '__main__':
    main()

About

A nesC network implementation project for UCM CSE 160 course.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published