################################################################################ Author: Ajith Kumar (Admar Ajith Kumar Somappa) Homepage: www.hib.no/ansatte/aaks Title : Tutorial for creating own MAC Layer and simulation in Castalia Omnet++ This will list the difference between MiXiM Mac and Castalia Mac MiXiM vs Castalia v2 Related: MiXiM Mac tutorial References: Castalia, MiXiM, OMNET++ Weblink: Check User manual in http://castalia.research.nicta.com.au/index.php/en/documentation Section 5 Creating your own Module, page 89 ################################################################################ #To get better understanding check the manual for steps #Start with putting in the folders given in proper place myTestMac folder goes into Castalia-3.2/src/node/communication/mac MyMacSimulation folder goes into Castalia-3.2/Simulations Compile castalia after this. to run the Simulation once you have compiled move to the simulation folder: @comp:~/Desktop/Castalia-3.2/Simulations/MyMacSimulations$Castalia omnetpp.ini Executes the general configuration I have setup. You can setup more configurations if required. #Commands to print simple graphs based on the result. CastaliaResults -i test1.txt -s RX -n | CastaliaPlot -o graphRX.png CastaliaResults -i test1.txt -s energy -n | CastaliaPlot -o graphEnergy.png #test1.txt is the name of the output file created usually named with the date #CastaliaResults uses the output files and CastaliaPlot plots a graph -i is input -s is to select a particular word -n is for all nodes -o is output for CastaliaPlot (a graph) #For more details check the manual #Further understanding on MAC is commented on the file itself. ################################################################################# Once you have some understanding on working of Castalia and MiXiM this might help. Note: The aim is to assist in creating a very basic MAC in both MiXiM and Castalia, also addressing the necessary changes when migrating from one to the other. (and not to compare MiXiM and Castalia) There are major differences between the way the MAC is implemented on these two platforms/frameworks. 1. ChannelSense implementation is handled differently in both MiXiM and Castalia. In Castalia radioModule->isChannelClear() can be used, that returns the present channel state. In MiXiM channelSenseRequest message is defined which can be used and in the MAC implementation the channel sense until idle is implemented by sending the control down with message (UNTIL_IDLE: meaning sense until idle) when carrier sense is intiated. In Castalia I was not sure how pass on the control hence have used self message to invoke MAC at a later time if carrier is busy. If you know how to do so you could suggest me. for MiXiM check channelSenseRequest_m.h and cc for Castalia check Radio.h and cc "isChannelClear() returns the "current" state of the channel or NOT_READY indications. In general it is built to resemble the interface that real low-power radios support. MiXiM's "sense until idle" functionality might be handy for developers as a higer level abstraction, but it does not model a realistic radio interface (although few radios might support this feature)." 2. MiXiM sends out radio_switching_over control command, which can be used to make certain decisions. Castalia has it private. Thus has to be handled differently. Since this is simple MAC, we do not use timers etc. Use of timers could make these implementation easier in Castalia. (Given that the time required to switch radio from RX to TX or TX to RX is usually known). 3. Radio States in MiXiM (default we can override): TX, RX, SLEEP, SWITCHING Castalia radio states: TX, RX, SLEEP 4. MiXiM: Radio switching to TX and to RX have to be handled by MAC. Castalia: Radio switching to TX has to handled by MAC, Switch to RX is handled by Radio by default. 5. Otherwise the skeleton is similar, does CSMA based Broadcast using throughputtest application with highdata rate to see effects of interference, when two nodes start transmitting with immediate succession with a difference of 0.000006s. 6. Castalia gives the possibility to obtain RSSI, LQI from the Radio and can be used in the MAC layer. In MiXiM these are not provided by default, but could be accessed otherwise. Also for further information on using isChannelClear(), you can check TunableMAC. If you have any suggestions or corrections you can e-mail me at: a.ajith.kumar.s at gmail