Skip to content

Applications for Channel Assignment

Jose Saldana edited this page Oct 2, 2017 · 43 revisions

There are three applications for channel assignment:

  • ChannelAssignment. Algorithm for optimal channel assignment. It takes monitoring info as an input, runs an algorithm and implements the resulting channel assigmnent in the APs, moving the AP itself and its associated STAs. It uses as an input the result of the application for obtaining the distance in dBs. This application integrates the channel assignment algorithms with the Wi-5 controller. For this aim, the Matlab code implementing the algorithm has been exported as a Java library , which is integrated in the controller and can then be called from the channel assignment application. As the code is compiled previously, it can run fast and does not need the controller to have Matlab. However, you have to install MATLAB Compiler Runtime (MCR) libraries in the Wi-5 controller. See this.

  • ChannelPrompt. Interactive (prompt-based) application, which allows the user to introduce a channel number for each AP throught the keyboard.

  • ChannelLoop. It performs a continuous loop (10 sec) between the 11 channels of 2.4 GHz. The application moves an AP between all the channels.

Parameters

These are the parameters that the user can set for the application, using poolfile:

Parameters of the ChannelAssignment application

  • TimeToStart(sec): The application will wait some seconds before starting. It gives time to the user to start the agents.
  • PauseBetweenScans(sec): Time between successive scans.
  • ScanningInterval(sec): Time used for collecting the monitoring information.
  • AddedTime(sec): An extra time after scanning (a margin). Recommended value: 1 second.
  • NumberOfScans: Number of scans to calculate the cumulative moving average and run the algorithm.
  • IdleTime(sec): Time between channel assignment and restart the process.
  • Channel: Channel used for the measurement of the distance (sending and hearing for special beacons).
  • Method: Three values can be chosen:
    • 1: Wi-5 algorithm. It will use the algorithm for optimal channel selection.
    • 2: Random channel selection.
    • 3: Least Congested Channel (LCC).

Delays

After the initial wait for agents’ connections, the application orders a scan, waits ScanningInterval + AddedTime seconds and gets the distance in dBm, doing that for each agent. It repeats the loop after PauseBetweenScans seconds for NumberOfScans times, each iteration saving the cumulative moving average.

Using this average, it runs the channel assignment algorithm and sets the APs’ channels according to that result. Then, it waits IdleTime seconds until it restarts the process.

This will result on the algorithm being run every:

IdleTime + AlgorithmTime +
+ NumberOfScans*[NumberOfAgents*(ScanningInterval+ AddedTime+ ProcessingTime)]
+(NumberOfScans-1)*PauseBetweenScans 

As an example, the line CHANNEL 30 30 2 1 3 7200 6 1 in poolfile, with 3 agents, will result in the channel assignment algorithm being run every 7299.5 seconds (roughly 2 hours).

AlgorithmTime is the time required for running the Matlab code, which in our setup (Intel Core i3) varies between 1 and 8 seconds.

ProcessingTime is the time required after each scanning. In our setup it is about 0.5 seconds.

How it works

The scheme of the operation of switching an AP with its associated STAs is illustrated in ShowMatrixOfDistancedBs. We also show here some parts of the log information shown by the controller.

First, this is the information sent by the last AP:

[ChannelAssignment] Agent: /192.168.1.13 in channel 6
	AP MAC: 60:E3:27:4F:CA:63
	avg signal: -44.3179827593 dBm
[ChannelAssignment]
[ChannelAssignment] Agent: /192.168.1.15 in channel 6
	AP MAC: 60:E3:27:4F:CA:63
	avg signal: -50 dBm
[ChannelAssignment]
[ChannelAssignment] Agent: /192.168.1.14 in channel 6
	AP MAC: 60:E3:27:4F:CA:63
	avg signal: -31.0237290871 dBm

Now, the controller has all the information so it can build the matrix of distances and run the algorithm (in this example, 4 APs have been used), obtaining a channel assignment including channels 1, 6 and 11 in this case:

[ChannelAssignment] === MATRIX OF DISTANCES (dBs) ===

192.168.1.13	----------	-57.95 dBm	-55.52 dBm	-43.97 dBm
192.168.1.15	-54.68 dBm	----------	-50 dBm   	-42.14 dBm
192.168.1.14	-50 dBm   	-40 dBm   	----------	-30 dBm   
192.168.1.10	-44.31 dBm	-50 dBm   	-31.02 dBm	----------

[ChannelAssignment] =================================
Optimization terminated.
[ChannelAssignment] =======CHANNEL ASSIGNMENTS=======
1    11     6    11

When the optimisation algorithm has finished, and a channel assignment has been decided, a message WRITE odinagent.channel 1 is sent by the controller to each AP:

[ChannelAssignment] =================================
[ChannelAssignment] Setting AP /192.168.1.13 to channel: 1
[ChannelAssignment] Setting AP /192.168.1.15 to channel: 11
[ChannelAssignment] Setting AP /192.168.1.14 to channel: 6
[ChannelAssignment] Setting AP /192.168.1.10 to channel: 11
[ChannelAssignment] =================================

When the AP receives the message, it has to instruct all the associated STAs to switch to the new channel. Beacons with the Channel Switch Announcement element are used for this. A countdown is implemented so the STA switches to the new channel when it reaches zero.

When the AP has finished the channel switch (including the switch of the associated STAs), it sends to the Wi-5 controller a 200 write handler 'odinagent.channel' OK message.

Scheme of the operation of the ChannelAssignment application

Additional requirements for running ChannelAssignment

You can also follow the instructions here

How to generate the .jar archive from the Matlab code:

  1. Run the Matlab Compiler by typing deploytool in Matlab command line and select Library Compiler.

  2. In the compiler window, select Java Package as Type.

  3. Click the plus sign (+) next to the Exported Functions section, and select the file getChannelAssignments.m

  4. Fill in the Library Information as you see fit. In this section, the most important part is the Class Name. This will be the name of the class that needs to be instantiated in the Java code. Change the default value of Class1 to a more suitable name, e.g. wi5.

  5. Save the project.

  6. Click the Package button to create the .jar file.

  7. Go to the folder for_redistribution_files_only in the output file and copy the generated .jar file in order to deploy it on another computer.

Note. A version generated with Matlab version R2015a (v8.5) can be downloaded from here.

Additional configurations required in the computer acting as the Wi-5 controller,

  1. Download and Install MATLAB Compiler Runtime (MCR) from https://www.mathworks.com/products/compiler/mcr.html. Make sure to select the version corresponding to the Matlab version used for generating the jar file.

This document assumes that the MCR is installed to location $MCR. You can set an environment variable named $MCR for your system, or replace $MCR with the exact path to the installation in the following steps.

  1. Commands after download and unzip MCR:
   chmod +x -R MCR/
   ./install -mode silent -agreeToLicense yes
  1. Copy the following .jar into your project, and add it to the build path where XX should be replaced with the MCR version.
    $MCR/MATLAB_Runtime/vXX/toolbox/javabuilder/jar/javabuilder.jar

Note. In this directory you have the javabuilder.jar version R2015a (v8.5). In this case vXX would be v85.

  1. Copy the .jar file generated previously (e.g. wi5.jar) into the project and add it to the build path.

Note. In this directory you have a file called wi5.jar, which is the result of this compilation.

  1. The following directories should be added to the LD_LIBRARY_PATH.
$MCR/MATLAB_Runtime/v85/runtime/glnxa64:$MCR/MATLAB_Runtime/v85/bin/glnxa64:$MCR/MATLAB_Runtime/vXX/sys/os/glnxa64:$MCR/MATLAB_Runtime/v85/sys/opengl/lib/glnxa64

IMPORTANT: We have observed system errors when LD_LIBRARY_PATH is modified permanently (by modifying /etc/ld.so.conf.d/ or by other means).

Therefore, we modify it within the terminal that is to run the odin controller with the following command:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MCR/MATLAB_Runtime/v85/runtime/glnxa64:$MCR/MATLAB_Runtime/vXX/bin/glnxa64:$MCR/MATLAB_Runtime/v85/sys/os/glnxa64:$MCR/MATLAB_Runtime/v85/sys/opengl/lib/glnxa64

It is adequate to run this command once, just before odin controller is started. For subsequent runs, you do not need to run the command again.

For example, with MCR version 8.5 installed in /usr/local/MATLAB, you have to execute the following command:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/MATLAB/MATLAB_Runtime/v85/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v85/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v85/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v85/sys/opengl/lib/glnxa64
  1. For the use of the library, you can take a look at the sample java file provided.