SERVFORU

Latest Post

Simulation and Analysis of Routing Protocol under CBR and TCP Traffic Source in NS2




In this project we are going to investigate the performance of some routing protocols for Ad-Hoc Networks under CBR and TCP traffic source. The behaviors of TCP still have not well understood in the multi-hop wireless networks. Through this paper we are able to find that how TCP will react under different network conditions. In this traffic and mobility scenarios play an important role in evaluating the performance of these networks, despite comment and belief from various researches on TCP's weaknesses on MANET. As Mobile Ad-Hoc Network (MANET) support multi-hops wireless communication without using any existing infrastructure or centralized administration. And support continuous changing network topology, provides distributed operations, easily deployment and thus, routing becomes a challenging task. A different flavor of reactive and proactive routing protocols are analyze with varying network conditions and speed to find an optimized route from a source to some possible destination. This paper presents how routing protocol will behave in less and more stressful condition, performance of mobile ad hoc network routing protocol such as AODV, DSDV, DSR, to simulate the above said protocol on the base of normalize routing load, throughput, Average End-to-End to delay, packet loss and packet delivery fraction. For our simulation we used a discrete event simulator known as Network Simulator version 2.34.









 

some simple TRICKS in UBUNTU OS




#1 Add a . before the file name to hide your files (for example .song.mp3)


Unlike Windows where you need to go to a file's properties in order to hide it, Ubuntu has a simple and easy method for hiding a file. Simply add . as the first letter to a filename and your file automatically becomes hidden. For example, if you want to hide "mypicture.jpg", simply rename it to ".mypicture.jpg" to hide it.

To see these files, simply open the location folder and press Ctrl+H. (Isn't that faster!!)

#2 Run a lost program and discover hidden software

If you can't find an installed application, then press Alt+F2. And from the buttons shown at the foot of your screen you can explore all categories of applications on your system.

#3 Change folder and file icons

If you want to use a different image for your file or folder instead of the standard icons, just right click an item and go to the Properties. The current icon is visible at the top left corner, click that icon and browse to the image that you want to use. Once changed, you can also reset the image by clicking Revert at the bottom.

#4 Create fancy desktop effects

You first need to Install Compiz Config Settings apt:compizconfig-settings-manager Manager. 

Now go to System > Preferences > CompizConfig Settings Manager.

You'll find a whole range of options to change your appearance settings.

To enable these effects, you will require a decent graphics card. If things seem to be slow afterwards, you can disable this in System > Preferences > Appearance, and use None or Normal Visual Effects. 
 

How to Root HTC One X


The One X is HTC's flagship phone for the first half of 2012. It features a highly-acclaimed Super LCD2 720p screen, which many consider to be the best display on a mobile phone to date. The international version of the One X ships with a quad-core Nvidia Tegra 3 CPU processor that is backed by a full gigabyte of RAM and 32 gigs of flash memory. The device's software is also notable. The One X comes pre-loaded with Android 4.0.3, featuring the HTC Sense 4 user interface, which marked the slimming of their previously heavy custom skin.

  1. Download and install the HTC mobile phone drivers. [Windows]
  2. Download the root.zip file.
  3. Extract root.zip into a directory on your computer.
  4. Plug your HTC One X into your computer via USB. Recommended: Plug your device’s USB cable into the back of your computer if you’re using a desktop PC.
  5. Enable USB Debugging on your HTC One X. Settings >> Developer Options >>USB debugging (checked)
  6. Double click root.bat/root-linux.sh/root-mac.sh to run the script.
  7. Congratulations! Your device will reboot a number of times and then you will have full root access.

1. Download and install the HTC mobile phone drivers. [Windows]
2. Download the root.zip file.
3. Extract root.zip into a directory on your computer.
4. Plug your HTC One X into your computer via USB. Recommended: Plug your device’s USB cable into the back of your computer if you’re using a desktop PC.
5. Enable USB Debugging on your HTC One X. Settings >> Developer Options >>USB debugging (checked)
6. Double click root.bat/root-linux.sh/root-mac.sh to run the script.
See more here

Congratulations! Your device will reboot a number of times and then you will have full root access.
 

Temperature controlled Water Pump using PIC16f877A and LM35


Automatic Garden Light And Water Pump



Maybe someone today need everything more easy and effective, included with their garden lamp at home. There are many garden lamp operated manually to turn-on and turn-off. Someone need to turn on in the night and turn off in the morning manually. Garden lamp can not work automatically, when condition is dark garden lamp will turn on and when condition is bright garden lamp will turn off automatically too.

I think it is very important in this day. Someone will not again confuse when they go to leave home who will turn on and turn off garden lamp. To take solution for this problem i think someone can use automatically garden lamp that can work automatically. Garden lamp will turn on when condition is dark, and garden lamp will turn off when condition is bright.

Components
PIC16F877A
This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single word instructions) CMOS FLASH-based 8-bit microcontroller packs Microchip's powerful PIC® architecture into an 40- or 44-pin package and is upwards compatible with the PIC16C5X, PIC12CXXX and PIC16C7X devices. The PIC16F877A features 256 bytes of EEPROM data memory, self programming, an ICD, 2 Comparators, 8 channels of 10-bit Analog-to-Digital (A/D) converter, 2 capture/compare/PWM functions, the synchronous serial port can be configured as either 3-wire Serial Peripheral Interface (SPI™) or the 2-wire Inter-Integrated Circuit (I²C™) bus and a Universal Asynchronous Receiver Transmitter (USART). All of these features make it ideal for more advanced level A/D applications in automotive, industrial, appliances and consumer applications.

LDR
LDR (or Light Dependant Resistor, or Photoresistor) is a variable resistor. Light falling on the sensor decreases its resistance.
Output: This module outputs 5v when the sensor receives no light (the circuit is open) and 0v when exposed to bright light (the circuit is closed). When connected to an input on the Arduino using the TinkerKit Shield, you can expect to read values from 0 to 1023.
Module Description: This module features a Light Dependent Resistor, a signal amplifier, the standard TinkerKit 3pin connector, a green LED that signals that the module is correctly powered and a yellow LED whose brightness changes according to the amount of lightness.
This module is a SENSOR. The connector is an OUTPUT which must be connected to one of the INPUT connectors on the TinkerKit Shield.

LM35
Description

The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage over linear temperature sensors calibrated in ° Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling. The LM35 does not require any external calibration or trimming to provide typical accuracies of ±¼°C at room temperature and ±¾°C over a full -55 to +150°C temperature range. Low cost is assured by trimming and calibration at the wafer level. The LM35's low output impedance, linear output, and precise inherent calibration make interfacing to readout or control circuitry especially easy. It can be used with single power supplies, or with plus and minus supplies. As it draws only 60 µA from its supply, it has very low self-heating, less than 0.1°C in still air. The LM35 is rated to operate over a -55° to +150°C temperature range, while the LM35C is rated for a -40° to +110°C range (-10° with improved accuracy). The LM35 series is available packaged in hermetic TO-46 transistor packages, while the LM35C, LM35CA, and LM35D are also available in the plastic TO-92 transistor package. The LM35D is also available in an 8-lead surface mount small outline package and a plastic TO-220 package.


Program 

#include<htc.h>

void initialize(void)
{
        TRISA0=1;
        TRISA1=1;
ADCS1 = 0; //select Fosc/8
ADCS0 = 1;
ADCON1=0; // A/D port configuration 0
ADFM = 1; //right justified result
ADON=1; // turn on the AD conversion module
}
/* return a 10-bit result */
unsigned int read_adc(unsigned char channel)
{
channel&=0x07; // truncate channel to 3 bits
ADCON0&=0xC5; // clear current channel select
ADCON0|=(channel<<3); // apply the new channel select
DelayMs(10);
ADGO=1; // initiate conversion on the selected channel
while(ADGO)continue;
return(((ADRESH&0x03)<<8)+ADRESL); // return the 10-bit result
}



void main(void)
{
long int temp,pres;
initialize();
while(1)
{
temp =read_adc(0)*((5.0*100.0)/1023.0);
               

if (temp>27)
{
PORTD=0x00;
}
else
{

 

What is the best ad server site for publishers?

If you  are looking for a free ad server with high revenue percentages paid to the publisher and low monthly minimums for payment.check the following







Ad server? Meaning you want a tool to help manage and serve the ads on your site; or are you looking for an ad network where you can earn money by serving their ads?

If ad server, the tool, which will not provide ads for you but will manage the ads you have whether they are from various ad networks and/or your own ad sales, check out

OpenX http://www.openx.com
Google Admanager http://www.google.com/admanager

If ad server you mean an ad network which gathers advertisers for you and you earn a revenue percentage, check out

Burst Media http://www.burstmedia.com
Advertising.com. http://www.advertising.com
Tribal Fusion http://www.tribalfusion.c
We are looking for a free ad server with high revenue percentages paid to the publisher and low monthly minimums for payment. We are using ValueClick right now, but it's not working so well









Ad server? Meaning you want a tool to help manage and serve the ads on your site; or are you looking for an ad network where you can earn money by serving their ads?

If ad server, the tool, which will not provide ads for you but will manage the ads you have whether they are from various ad networks and/or your own ad sales, check out

OpenX http://www.openx.com
Google Admanager http://www.google.com/admanager

If ad server you mean an ad network which gathers advertisers for you and you earn a revenue percentage, check out

Burst Media http://www.burstmedia.com
Advertising.com. http://www.advertising.com
Tribal Fusion http://www.tribalfusion.com 

Also consider contextual advertising networks

Google Adsense https://www.google.com/adsense/
Yahoo! Publishing Network (currently in beta and available to US publishers only)http://publisher.yahoo.com/ 
Intellixt http://vibrantmedia.com/site/web_01a5.ht… 
Quigo Adsonar http://www.quigo.com/adsonarexchange.htm 
IndustryBrains http://www.industrybrains.com 
Commission Junction Evolution http://www.cj.com
Kanoodle Brightads http://www.kanoodle.com/about/brightads.…
Clicksor http://www.clicksor.com/affiliate_progra… 
Contextweb http://www.contextweb.com/ 
Bidclix http://www.bidclix.com/ 
Bidvertiser http://www.bidvertiser.com/om 

Also consider contextual advertising networks

Google Adsense https://www.google.com/adsense/
Yahoo! Publishing Network (currently in beta and available to US publishers only)http://publisher.yahoo.com/ 
Intellixt http://vibrantmedia.com/site/web_01a5.ht… 
Quigo Adsonar http://www.quigo.com/adsonarexchange.htm 
IndustryBrains http://www.industrybrains.com 
Commission Junction Evolution http://www.cj.com
Kanoodle Brightads http://www.kanoodle.com/about/brightads.…
Clicksor http://www.clicksor.com/affiliate_progra… 
Contextweb http://www.contextweb.com/ 
Bidclix http://www.bidclix.com/ 
Bidvertiser http://www.bidvertiser.com/
 

Traffic pattern based performance comparison of two reactive routing protocols for Ad hoc networks using NS2


Ad hoc networks are characterized by wireless connectivity, continuous changing topology, distributed operations and ease of deployment. Routing in Ad hoc networks is a challenge due to mobility and thus is a current area of research. We compare two reactive routing protocols by considering multiple performance metrics to bring out their relative merits. Both DSR and AODV share similar on demand behavior, but the protocols internal mechanism leads to significant performance differences. We have analyzed the performance of protocols by varying network load, mobility and type of traffic (CBR, TCP). A detailed simulation has been done using NS2. We consider packet delivery fraction, normalized routing load, average delay, routing overhead, and packet loss as metrics for performance analysis of these protocols.

The TCL code is available here : Click here
 

How to install ClockWorkMode in Samsung Galaxy R i9103


I.  Before You Begin

1.  Make sure that you have backed up everything you feel is important before you proceed.
2.  Charge your device to more than 75% before you begin.

II.  Necessary Downloads

Clockworkmode

xda link is here

File Type: zipCWMv5.5.0.4_v1.zip - [Click for QR Code] (4.73 MB, 1720 views)

File Type: zipCWMv6.0.0.0_v1.zip - [Click for QR Code] (4.75 MB, 612 views)
File Type: zipCWMv6.0.0.3.zip - [Click for QR Code] (5.01 MB, 1620 views)


III.  Installing ClockworkMod Recovery on the Galaxy R

1.  Power down your device.
2. press Volume Down + Home Keys
3 .Get in to recovery menu
4. Select install zip from sd by using up and down keys

5.select the zip file and enter in to clockwork mode recovery
 

How to use App Inventor To create Android Apps with out codes


way to create simple applications for Android

For those whose eyes glaze over at the sight of a few lines of code, App Inventor may well be the answer. This Google Labs innovation lets you create applications using your browser and either a connected phone or an Android phone emulator. All your work is stored on the App Inventor servers, so you can come back to it at any point.
App Inventor consists of three main components. The App Inventor Designer lets you select components for your app, including media, buttons, labels and everything else that's related to the way your app looks and feels.
Check the site for more

http://appinventor.mit.edu

 

Best Wireless Data Card In India




Reliance Netconnect: 


Reliance Netconnect +, one of the best wireless connections in the country, is the most suitable for both desktops and laptops. It offers download speed up to 3.1 Mbps and upload speed up to 1.8 Mbps. Reliance Netconnect Broadband+comes with EVDO technology that will allow you to access Internet at the very high speed. The network of this high speed broadband is available in many cities in India. So you can easily browse the internet in across 24,000 towns and 6 lacs villages and major highways, railway routes, remote locations etc. With simply plug and play, an individual can easily use this device. Reliance has recently introduced its unlimited plan wherein now you can get unlimited internet usage with Reliance Netconnect Broadband+.

Tata Photon Plus:

Tata Photon Plus offers High speed Internet access service (HSIA) through USB modem. This device operates @ 800 MHz frequency in order to provide you best connectivity even indoor too. Moreover, you can also enjoy free roaming all over India. Besides, it offers a wide range of plans. So you can choose your plan as per your convenience. This data card is again worked on laptops and desktops as well.

Photon Plus with built-in MP3 Player:

Tata Teleservices has newly launched hi-tech Tata Photon Plus MP3 device offering a wide range of music features for e.g. MP3, Recording and radio with Internet surfing and much more. This fantastic device brings many benefits for its hi-end customers such as wireless internet connectivity & music. Besides, it also comes well equipped with built in MP3 player, FM radio and a 2GB microSD card for storing data. So the music lovers can enjoy their favorite music without any hassle. For listening music, there is no requirement of plugged into a computer to play MP3 files or activate the FM radio. Apart from this, you can also access Internet with the help of  Tata Photon Plus with built-in MP3 player. When you plug into your computer, it will transform into a hi-speed Internet device with the download speed of up to 3.1 Mbps and upload speed of 1.8 Mbps.

Reliance 3G Data Card:

Reliance Communications has introduced its 3G data card with 7.2 Mbps to 21 mbps speed. Initially, the company will provide it in three metros i.e. Mumbai, Kolkata and Delhi and one city – Chandigarh. The president and CEO, Reliance communication, Syed Safawi said, “By next three months, we will launch it in the remaining nine circles for which the company has spectrum. Our tariffs will be affordable, simple and transparent based on try and buy pricing proposition.” Within few days, RCOM will soon launch 3G services in the remaining operating nine circles.

The 3G USB Data Cards are SIM based devices just like handsets. To buy Reliance 3G data card, customers will have to purchase a Reliance SIM card and select the desired prepaid or postpaid data plan.

Tata Docomo 3G USB E-Stick:

This 3G data card is specially designed for delivering the heaviest data at different speeds. By having this hi-tech data card, you can enjoy surfing without any hassle of wires and any kind of installation.

With Tata DOCOMO 3G e-Stick, you can get maximum speed of 21 Mbps. This data card comes equipped with blazing speeds that will allow you to do huge data exchange within few seconds. Moreover, it also doubles up as a Flash Drive with up to 32GB data storage.  This data card comes with enhanced Signal strength along with Receive diversity (Rx). This device also works on SDPA/HSUPA/EDGE/WCDMA/GPRS/GSM networks. With 2.0 high speed, you can easily access Gmail, Facebook™, YouTube™ and top social networking websites in just a single click. Tata DOCOMO 3G data card comes with Mobile TV that would permit you to watch your favorite Television serial on the move.

Idea NetSetter Datacard:

Idea cellular, the 3rd largest mobile service provider of the country, has recently launched the Gold standard for 3G services. In starting, these services will start from MP, Gujarat, Chhattisgarh and Himachal Pradesh. They will ensure supreme customer experience in 200 towns by the month of April 2011 and around 4000 towns by the end of 2012. By subscribing these 3G services, the user can enjoy Mobile TV, Video conferencing, Video on demand, Idea Mall and fastest speed of Internet.
*USB Data Card
*High-speed EDGE enable
*Plug & Play function (No CD Installation required)
*SIM-lock function
*SMS services allowed (Group SMS to max 10 people)
*It allows you to track your daily/monthly/yearly usage
*GSM/GPRS/EDGE 850 MHz/900 MHz/1800 MHz/1900 MHz
*Multiple operating systems, such as Windows 2000, XP, Vista

Vodafone 3G Data Card:


Vodafone 3G mobile connect USB Data Card: Quick, simple and secure, the USB data card gives me instant access to the Internet .

Features:
1. Gets you high-speed connectivity to the internet through the Vodafone EDGE network.
2. Is easy to install – just plug in and you are ready, no CDs required.
3. Gives 3G Broadband speeds when you travel abroad.
4. Works with your preferred VPN software, to give you secure access to your company server and intranet.
5. Has many different tariff plans, so you can choose the one that meets your requirements.
6. Saves you from high internet charges on your hotel bills.
7. Gets you high-speed connectivity to the internet through the Vodafone EDGE network.
8. Supports SMS
9. Supports Micro SD card upto 2 GB.>

Airtel 3G Datacard :

Provides you flexibility to start from a lower rent and pay as per usage, instead of committing a higher rent upfront. When your total data bill reaches Rs. 2000, you can continue using data absolutely. free, though at a reduced speed of 20Kbps. Since maximum data bill is capped, hence it shields you against a Bill Shock.

1. All airtel 3G USB modems are plug-n-play in nature & auto install the first time they are plugged into a laptop or PC. Pls refer to specification sheet of modems to check the Operating System that support these.
2. 3G will work on your existing 2G SIM Card. You will not be required to change your SIM Card.
3. If you are out of 3G coverage area then You will continue to access 2G/2.5G services in areas where 3G coverage is absent. Please ensure that your network setting on handset is on dual mode.

Choose from a variety of 3G plans and get set to enjoy a world of possibilities with airtel internet on
 

Update Your Samsung Galaxy ACE GT S5830i with Android 4.1.1 Jeally Bean

 
When it comes to custom ROMs firmware, the Galaxy Ace users can choose from a long list of updates, though they should be aware that not all the OS improvements are working properly. Also, not all the ROMs can be installed on both versions of the device, the S5830i and the S5830, therefore you must check the compatibility first. Anyway, today, I will teach you how to update the S5830i variant of the Galaxy Ace to Jelly Bean 4.1.1 OS and this by installing the Jellyblast custom ROM firmware.


How to Update Galaxy Ace S5830i with Jelly Bean 4.1.1 based Jellyblast Custom ROM Firmware

  1. Use the link from here and download the Jelly Bean update file.
  2. Save it on your computer.
  3. Connect the Ace with the PC (you need the USB cord for that).
  4. Take the downloaded file from step 1 and copy it to the phone’s SD card.
  5. Unplug the USB cable and turn off the handset.
  6. Enter in recovery mode.
  7. You can manage to do that by holding and pressing the Menu and Power buttons at the same time.
  8. One the recovery mode menu is being displayed, use it and choose the next options: “wipe data factory reset” and “wipe cache partition” (remember to backup the data before applying this step).
  9. Then, select “+++go back+++” and return to the main menu.
  10. From there, select “install zip from SD card” followed by “choose zip from SD card”.
  11. You can now select the downloaded file and flash the same on your Galaxy Ace.; we are almost done.
  12. Wait until the process is over (a couple of minutes) and in the end select “+++go back+++” and “reboot system now”.
  13. That’s all.
So, what do you think? It wasn’t that hard after all. In fact there are more pre requisites than actual steps, but this is the only way for safely updating the Samsung Galaxy Ace S5830i to Jelly Bean 4.1.2. All this was possible thanks to those of xda-developers who had provided the Jellyblast Custom ROM Firmware for us. Test the new software and use the comments are for sharing your impressions and conclusions with us and with other Android users.

 

Architecture of Wireless Sensor Networks


The concept of wireless sensor networks is based on a simple equation:

Sensing + CPU + Radio = Thousands of potential applications

As soon as people understand the capabilities of a wireless sensor network, hundreds of applications spring to mind. It seems like a straightforward combination of modern technology.


WSN OSI layers
Transport layer: The function of this layer is to provide reliability and congestion avoidance where a lot of protocols designed to provide this function are either applied on the upstream (user to sink, ex: ESRT, STCP and DSTN), or downstream (sink to user, ex: PSFQ and GARUDA). These protocols use different mechanisms for loss detection ((ACK, NACK, and Sequence number)) and loss recovery ((End to End or Hop by Hop)) [4, 5]. This layer is specifically needed when a system is organised to access other networks. Providing a reliable hop by hop is more energy efficient than end to end and that is one of the reason why TCP is not suitable for WSN. Usually the link from sink to node is considered
as downstream link for multicast transmission and UDP traffic because of the limited memory and overhead avoiding. On the other hand from User to sink is considered as upstream link for mono-cast transmission and TCP or UDP traffic [1].

Data link layer: Responsible for multiplexing data streams, data frame detection, MAC,
and error control, ensure reliability of point–point or point– multipoint. Errors or unreliability
comes from 
MAC layer: Responsible for Channel access policies, scheduling, buffer management and error control. In WSN we need a MAC protocol to consider energy efficiency, reliability, low access delay and high throughput as a major priorities 
Physical Layer : Can provide an interface to transmit a stream of bits over physical medium. Responsible for frequency selection, carrier frequency generation, signal detection, Modulation and data encryption. IEEE 802.15.4: proposed as standard for low rate personal area and WSN with low: cost, complexity, power consumption, range of communication to maximize battery life. Use
CSMA/CA, support star and peer to peer topology. There are many versions of IEEE 802.15.4.
Application layer: Responsible for traffic management and provide software for different
applications that translate the data in an understandable form or send queries to obtain certain
information. Sensor networks deployed in various applications in different fields, for example;
military, medical, environment, agriculture fields [1, 7].


 

Simulating Denial of Services Attack in Wireless Sensor Networks

Program
###########################################################################
# security.tcl
# auther : Ebin Ephrem
# http://servforu.blogspot.com
# mail2ebine@gmail.com

#Simulation settings - security

#IEEE 802.11 with Distributed co ordination function

#nominal bit rate 2 Mb/s

#radio range 100 meter

#random way-point model

#node speed  1 m/s - 15 m/s

#CBR 20 nodes

#source generate 512 bytes

#transmission rate 4 packets /sec

#area of simulation 1000m x 300 m

#number of nodes is 50

#total simulation time 500 sec

#AODV routing protocol used

#===================================
#     Simulation parameters setup
#===================================
Mac/802_11 set basicRate_ 2Mb              ;#Rate for Control Frames

set val(chan)   Channel/WirelessChannel    ;# channel type
set val(prop)   Propagation/TwoRayGround   ;# radio-propagation model
set val(netif)  Phy/WirelessPhy            ;# network interface type
set val(mac)    Mac/802_11                 ;# MAC type
set val(ifq)    Queue/DropTail/PriQueue    ;# interface queue type
set val(ll)     LL                         ;# link layer type
set val(ant)    Antenna/OmniAntenna        ;# antenna model
set val(ifqlen) 20                         ;# max packet in ifq
set val(nn)     50                         ;# number of mobilenodes
set val(rp)     AODV                       ;# routing protocol
set val(x)      1000                      ;# X dimension of topography
set val(y)      300                      ;# Y dimension of topography
set val(stop)   500.0                         ;# time of simulation end

#===================================
#        Initialization      
#===================================
#Create a ns simulator
set ns [new Simulator]

# define color index
$ns color 0 red
$ns color 1 blue
$ns color 2 chocolate
$ns color 3 red
$ns color 4 brown
$ns color 5 tan
$ns color 6 gold
$ns color 7 black


#Setup topography object
set topo       [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)

#Open the NS trace file
set tracefile [open dos.tr w]
$ns trace-all $tracefile

#Open the NAM trace file
set namfile [open dos.nam w]
$ns namtrace-all $namfile
$ns namtrace-all-wireless $namfile $val(x) $val(y)
set chan [new $val(chan)];#Create wireless channel

#===================================
#     Mobile node parameter setup
#===================================
$ns node-config -adhocRouting  $val(rp) \
                -llType        $val(ll) \
                -macType       $val(mac) \
                -ifqType       $val(ifq) \
                -ifqLen        $val(ifqlen) \
                -antType       $val(ant) \
                -propType      $val(prop) \
                -phyType       $val(netif) \
                -channel       $chan \
                -topoInstance  $topo \
                -agentTrace    ON \
                -routerTrace   ON \
                -macTrace      ON \
                -movementTrace ON

#===================================
#        Nodes Definition      
#===================================
#Create 50 nodes
set n0 [$ns node]
$n0 set X_ 815
$n0 set Y_ 300
$n0 set Z_ 0.0
$ns initial_node_pos $n0 20
set n1 [$ns node]
$n1 set X_ 904
$n1 set Y_ 234
$n1 set Z_ 0.0
$ns initial_node_pos $n1 20
set n2 [$ns node]
$n2 set X_ 122
$n2 set Y_ 397
$n2 set Z_ 0.0
$ns initial_node_pos $n2 20
set n3 [$ns node]
$n3 set X_ 110
$n3 set Y_ 266
$n3 set Z_ 0.0
$ns initial_node_pos $n3 20
set n4 [$ns node]
$n4 set X_ 225
$n4 set Y_ 50
$n4 set Z_ 0.0
$ns initial_node_pos $n4 20
set n5 [$ns node]
$n5 set X_ 670
$n5 set Y_ 102
$n5 set Z_ 0.0
$ns initial_node_pos $n5 20
set n6 [$ns node]
$n6 set X_ 713
$n6 set Y_ 245
$n6 set Z_ 0.0
$ns initial_node_pos $n6 20
set n7 [$ns node]
$n7 set X_ 727
$n7 set Y_ 71
$n7 set Z_ 0.0
$ns initial_node_pos $n7 20
set n8 [$ns node]
$n8 set X_ 963
$n8 set Y_ 8
$n8 set Z_ 0.0
$ns initial_node_pos $n8 20
set n9 [$ns node]
$n9 set X_ 510
$n9 set Y_ 295
$n9 set Z_ 0.0
$ns initial_node_pos $n9 20
set n10 [$ns node]
$n10 set X_ 770
$n10 set Y_ 211
$n10 set Z_ 0.0
$ns initial_node_pos $n10 20
set n11 [$ns node]
$n11 set X_ 692
$n11 set Y_ 230
$n11 set Z_ 0.0
$ns initial_node_pos $n11 20
set n12 [$ns node]
$n12 set X_ 987
$n12 set Y_ 264
$n12 set Z_ 0.0
$ns initial_node_pos $n12 20
set n13 [$ns node]
$n13 set X_ 483
$n13 set Y_ 16
$n13 set Z_ 0.0
$ns initial_node_pos $n13 20
set n14 [$ns node]
$n14 set X_ 526
$n14 set Y_ 38
$n14 set Z_ 0.0
$ns initial_node_pos $n14 20
set n15 [$ns node]
$n15 set X_ 433
$n15 set Y_ 121
$n15 set Z_ 0.0
$ns initial_node_pos $n15 20
set n16 [$ns node]
$n16 set X_ 141
$n16 set Y_ 30
$n16 set Z_ 0.0
$ns initial_node_pos $n16 20
set n17 [$ns node]
$n17 set X_ 124
$n17 set Y_ 86
$n17 set Z_ 0.0
$ns initial_node_pos $n17 20
set n18 [$ns node]
$n18 set X_ 182
$n18 set Y_ 261
$n18 set Z_ 0.0
$ns initial_node_pos $n18 20
set n19 [$ns node]
$n19 set X_ 149
$n19 set Y_ 282
$n19 set Z_ 0.0
$ns initial_node_pos $n19 20
set n20 [$ns node]
$n20 set X_ 319
$n20 set Y_ 46
$n20 set Z_ 0.0
$ns initial_node_pos $n20 20
set n21 [$ns node]
$n21 set X_ 394
$n21 set Y_ 279
$n21 set Z_ 0.0
$ns initial_node_pos $n21 20
set n22 [$ns node]
$n22 set X_ 440
$n22 set Y_ 372
$n22 set Z_ 0.0
$ns initial_node_pos $n22 20
set n23 [$ns node]
$n23 set X_ 124
$n23 set Y_ 238
$n23 set Z_ 0.0
$ns initial_node_pos $n23 20
set n24 [$ns node]
$n24 set X_ 902
$n24 set Y_ 287
$n24 set Z_ 0.0
$ns initial_node_pos $n24 20
set n25 [$ns node]
$n25 set X_ 970
$n25 set Y_ 76
$n25 set Z_ 0.0
$ns initial_node_pos $n25 20
set n26 [$ns node]
$n26 set X_ 71
$n26 set Y_ 51
$n26 set Z_ 0.0
$ns initial_node_pos $n26 20
set n27 [$ns node]
$n27 set X_ 507
$n27 set Y_ 30
$n27 set Z_ 0.0
$ns initial_node_pos $n27 20
set n28 [$ns node]
$n28 set X_ 866
$n28 set Y_ 34
$n28 set Z_ 0.0
$ns initial_node_pos $n28 20
set n29 [$ns node]
$n29 set X_ 173
$n29 set Y_ 44
$n29 set Z_ 0.0
$ns initial_node_pos $n29 20
set n30 [$ns node]
$n30 set X_ 334
$n30 set Y_ 02
$n30 set Z_ 0.0
$ns initial_node_pos $n30 20
set n31 [$ns node]
$n31 set X_ 645
$n31 set Y_ 270
$n31 set Z_ 0.0
$ns initial_node_pos $n31 20
set n32 [$ns node]
$n32 set X_ 824
$n32 set Y_ 300
$n32 set Z_ 0.0
$ns initial_node_pos $n32 20
set n33 [$ns node]
$n33 set X_ 963
$n33 set Y_ 46
$n33 set Z_ 0.0
$ns initial_node_pos $n33 20
set n34 [$ns node]
$n34 set X_ 389
$n34 set Y_ 3
$n34 set Z_ 0.0
$ns initial_node_pos $n34 20
set n35 [$ns node]
$n35 set X_ 145
$n35 set Y_ 48
$n35 set Z_ 0.0
$ns initial_node_pos $n35 20
set n36 [$ns node]
$n36 set X_ 110
$n36 set Y_ 53
$n36 set Z_ 0.0
$ns initial_node_pos $n36 20
set n37 [$ns node]
$n37 set X_ 121
$n37 set Y_ 51
$n37 set Z_ 0.0
$ns initial_node_pos $n37 20
set n38 [$ns node]
$n38 set X_ 788
$n38 set Y_ 44
$n38 set Z_ 0.0
$ns initial_node_pos $n38 20
set n39 [$ns node]
$n39 set X_ 797
$n39 set Y_ 02
$n39 set Z_ 0.0
$ns initial_node_pos $n39 20
set n40 [$ns node]
$n40 set X_ 1472
$n40 set Y_  15
$n40 set Z_ 0.0
$ns initial_node_pos $n40 20
set n41 [$ns node]
$n41 set X_ 526
$n41 set Y_  90
$n41 set Z_ 0.0
$ns initial_node_pos $n41 20
set n42 [$ns node]
$n42 set X_ 103
$n42 set Y_ 77
$n42 set Z_ 0.0
$ns initial_node_pos $n42 20
set n43 [$ns node]
$n43 set X_ 123
$n43 set Y_ 86
$n43 set Z_ 0.0
$ns initial_node_pos $n43 20
set n44 [$ns node]
$n44 set X_ 123
$n44 set Y_ -34
$n44 set Z_ 0.0
$ns initial_node_pos $n44 20
set n45 [$ns node]
$n45 set X_ 343
$n45 set Y_ -166
$n45 set Z_ 0.0
$ns initial_node_pos $n45 20
set n46 [$ns node]
$n46 set X_ 905
$n46 set Y_ -214
$n46 set Z_ 0.0
$ns initial_node_pos $n46 20
set n47 [$ns node]
$n47 set X_ 880
$n47 set Y_ -47
$n47 set Z_ 0.0
$ns initial_node_pos $n47 20
set n48 [$ns node]
$n48 set X_ 423
$n48 set Y_ -44
$n48 set Z_ 0.0
$ns initial_node_pos $n48 20
set n49 [$ns node]
$n49 set X_ 154
$n49 set Y_ -114
$n49 set Z_ 0.0
$ns initial_node_pos $n49 20

#===================================
#        Generate movement        
#===================================


$ns at 1 " $n0 setdest 350 10 5 "
$ns at 1 " $n45 setdest 450 200 5 "
$ns at 4 " $n1 setdest 10 30 10 "
$ns at 20 " $n2 setdest 150 50 7 "
$ns at 10 " $n3 setdest 867 33 7 "
$ns at 10 " $n7 setdest 45 40 15 "
$ns at 87 " $n8 setdest 816 30 4 "

$ns at 107 " $n48 setdest 100 30 4 "

$ns at 87 " $n8 setdest 901 200 6 "
$ns at 300 " $n35 setdest 826 30 9 "  
$ns at 40 " $n39 setdest 150 150 7 "
$ns at 200 " $n25 setdest 450 175 7 "
$ns at 260 " $n32 setdest 950 60 7 "
$ns at 120 " $n29 setdest 150 250 7 "
$ns at 20 " $n12 setdest 999 250 7 "
$ns at 20 " $n42 setdest 150  245 7 "
$ns at 87 " $n21 setdest 924 112 6 "
$ns at 87 " $n10 setdest 659 12 6 "
$ns at 87 " $n18 setdest 109 020 6 "
$ns at 300 " $n35 setdest 268 30 9 "  
$ns at 40 " $n9 setdest 150 150 7 "
$ns at 200 " $n34 setdest 450 75 7 "
$ns at 260 " $n36 setdest 950 65 7 "

$ns at 120 " $n11 setdest 120 250 7 "
$ns at 20 " $n15 setdest 100 100 7 "
$ns at 20 " $n15 setdest 150  135 7 "



   
#===================================
#        Agents Definition      
#===================================




set tcp [new Agent/TCP/Newreno]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $n15 $tcp
$ns attach-agent $n34 $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 3.0 "$ftp start"


set tcp [new Agent/TCP/Newreno]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $n0 $tcp
$ns attach-agent $n1 $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 5.0 "$ftp start"

set tcp [new Agent/TCP/Newreno]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $n4 $tcp
$ns attach-agent $n10 $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 50.0 "$ftp start"

set tcp [new Agent/TCP/Newreno]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $n40 $tcp
$ns attach-agent $n12 $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 55.0 "$ftp start"

# In ns TCP connection will be green
$tcp set fid_ 1

# To establish FTP application  tcp connection above
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ftp set type_ FTP

# Establish a UDP connection
set udp [new Agent/UDP]
$ns attach-agent $n1 $udp
set null [new Agent/Null]
$ns attach-agent $n4 $null
$ns connect $udp $null

# Udp nam in connection red
$udp set fid_ 2

#===================================
#        Applications Definition      
#===================================
# CBR application created on top of UDP connections
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp
$cbr set type_ CBR
$cbr set packet_size_ 1000
$cbr set rate_ 1mb
$cbr set random_ false


#===================================
#        Termination      
#===================================
#Define a 'finish' procedure
proc finish {} {
    global ns tracefile namfile
    $ns flush-trace
    close $tracefile
    close $namfile
    exec nam dos.nam &
    exit 0
}
for {set i 0} {$i < $val(nn) } { incr i } {
    $ns at $val(stop) "\$n$i reset"
}
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "finish"
$ns at $val(stop) "puts \"done\" ; $ns halt"
$ns run
 

Tcl and OTcl Tutorial for NS2 - Program to find Factorial



 Fractorial Computation: tcl script to obtain the value of 10! = 10 * 9 * ... * 1.

  1. get factorial.tcl and run the script;
  2. write a function to compute 2^x, test your answer.
Execute the script as:

$ tclsh lab1a.tcl
or
$ ns lab1a.tcl



################################################################################


#filename : factorial.tcl
# define function to compute Factorial X!
proc Factorial {x} {
    # define variable
    set result 1
   
    # for loop
    for {set i 1} {$i <= $x} {incr i} {
set result [expr $result * $i]
    }
   
    # return computation result
    return $result
}


#############################################################################


# define function to compute 2^x
proc 2pow {x} {
    # define variable
    set result 1
   
    # for loop
    for {set i 1} {$i <= $x} {incr i} {
# fill in here
    }
   
    # return computation result
    return $result
}
# make function call
set result [Factorial 10]

# output result
puts "$result"

# make function call
set result [2pow 10]

# output result
puts "$result"
 
 
Support : Ebin EPhrem | Ebin Ephrem | #Gabbarism
Copyright © 2011. Services | Embedded Support | Reviews | Virtual Technologys - All Rights Reserved
Template Created by ebinephrem.com Published by Ebin Ephrem
Proudly powered by Blogger