Friday, 2 August 2019

Set different energy levels to wireless nodes

You can set different initial energy to each wireless node separately. Your TCL script example is below.

set opt(initialenergy) 1000 ; # Initial energy in Joules

# Define Mobile Node Configurations
$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) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace ON \
-movementTrace ON \
-energyModel $opt(energymodel) \
-idlePower 1.0 \
-rxPower 1.0 \
-txPower 1.0 \
-sleepPower 0.001 \
-transitionPower 0.2 \
-transitionTime 0.005 \
-initialEnergy $opt(initialenergy)

....
....
set node_(0) [$ns node] # This will be generate node with initial energy 1000 Joules

$ns node-config -initialEnergy 500
set node_(1) [$ns node]


$ns node-config -initialEnergy 20
set node_(2) [$ns node]

$ns node-config -initialEnergy 30
set node_(3) [$ns node]

$ns node-config -initialEnergy 100
set node_(4) [$ns node]

...


You can find an example of 5 Nodes with different energy levels / AODV Routing Protocol in NS 2.35 below.
# wireless-qeaodv.tcl
# 5 Nodes with different energy levels / AODV Routing Protocol Example

# ======================================================================
# Define Values
# ======================================================================
set val(chan) Channel/WirelessChannel ;
set val(prop) Propagation/TwoRayGround ;
set val(ant) Antenna/OmniAntenna ;
set val(ll) LL ;
set val(ifq) Queue/DropTail/PriQueue ;
set val(ifqlen) 50 ;
set val(netif) Phy/WirelessPhy ;
set val(mac) Mac/802_11 ;
set val(rp) AODV ;
set val(nn) 5 ;
set opt(energymodel) EnergyModel ;
set opt(initialenergy) 1000 ; # Initial energy in Joules
set opt(lm) "off" ;# log movement
set opt(logenergy) "on" ;# log energy every 150 seconds

set val(x) 500 ;
set val(y) 500 ;
set val(stop) 60;
set filename $val(rp)_$val(nn)_$val(x)_$val(y);
set ns [new Simulator]

# open trace file
set tracefd [open $filename.tr w]
$ns trace-all $tracefd

#Open the nam trace file
set namtrace [open $filename.nam w]
$ns namtrace-all-wireless $namtrace $val(x) $val(y)


set WirelessNewTrace_ ON
#set AgentTrace ON
#set RouterTrace OFF
#set MacTrace ON

# ------------------------------------------------------------------------------
# Ağ topolojisi tanımı
# ------------------------------------------------------------------------------
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)

# General Operations Director (GOD)
create-god $val(nn)

# nn miktarınca düğüm [$val(nn)] oluştur ve kanala ilişkilendir.
set chan_1 [new $val(chan)]


# düğümleri konfigure et
$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) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace ON \
-movementTrace ON \
-energyModel $opt(energymodel) \
-idlePower 1.0 \
-rxPower 1.0 \
-txPower 1.0 \
-sleepPower 0.001 \
-transitionPower 0.2 \
-transitionTime 0.005 \
-initialEnergy $opt(initialenergy)

#for {set i 0} {$i < $val(nn) } { incr i } {
# set node_($i) [$ns node]
# $node_($i) random-motion 0 ;# disable random motion
#}

# Set initialEnergy values for Nodes
$ns node-config -initialEnergy 500
set node_(0) [$ns node]
$node_(0) color blue
$node_(0) shape box
$node_(0) label "Source"

# Set initial_node_pos
$node_(0) set X_ 40.0
$node_(0) set Y_ 280.0


$ns node-config -initialEnergy 500
set node_(1) [$ns node]

$ns node-config -initialEnergy 20
set node_(2) [$ns node]

$ns node-config -initialEnergy 20
set node_(3) [$ns node]

$ns node-config -initialEnergy 100
set node_(4) [$ns node]


# $node color [color] ;# sets color of node
# $node shape [shape] ;# sets shape of node
# $node label [label] ;# sets label on node
# $node label-color [lcolor] ;# sets color of label
# $node label-at [ldirection] ;# sets position of label
# $node add-mark [name] [color] [shape] ;# adds a mark to node
# $node delete-mark [name] ;# deletes mark from node

$node_(1) set X_ 420.0
$node_(1) set Y_ 280.0
$node_(1) color "red"
$node_(1) label "Destination"

$node_(2) set X_ 220.0
$node_(2) set Y_ 380.0
$node_(2) color "green"

$node_(3) set X_ 360.0
$node_(3) set Y_ 280.0
$node_(3) color "green"

$node_(4) set X_ 220.0
$node_(4) set Y_ 180.0
$node_(4) color "green"


for {set i 0} {$i < $val(nn) } { incr i } {
$ns initial_node_pos $node_($i) 30;
}


set udp [new Agent/UDP]
$ns attach-agent $node_(0) $udp
set null [new Agent/Null]
$ns attach-agent $node_(1) $null
$ns connect $udp $null
$udp set fid_ 1

set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp
$cbr set type_ CBR
$cbr set packetSize_ 48; # 48 byte 384bit
$cbr set rate_ 64000; # 0.064Mb || 64kb || 64000bit || bits per second
# interval_=0.0060000000000000001 || bit per second || 384/64000
# Packets in one second = 64000/384= 166,6packet

$cbr set random_ false


$ns at 10.0 "$cbr start"


for {set i 0} {$i < $val(nn) } { incr i } {
$ns at $val(stop) "$node_($i) reset";
}

$ns at 60.0 "$cbr stop"
# ------------------------------------------------------------------------------
# nam ve simulation end
# ------------------------------------------------------------------------------
# $ns at 15 "$node_(0) print_rtable"
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
#$ns at $val(stop) "$awk -f _packet.awk AODV_5_500_500.tr"
$ns at 70 "stop"
$ns at 70 "puts "end simulation" ; $ns halt"


proc stop {} {
global ns tracefd namtrace filename
$ns flush-trace
close $tracefd
close $namtrace
exec nam $filename.nam; #Execute nam on the trace file
exec awk -f _packet.awk $filename.tr
}

$ns run

K.KAMARAJ life history

19 Main points about K.Kamaraj
    K Kamaraj 1976 stamp of India.jpg
  1. Kamraj was born on July 15, 1903, in a family of traders at Virudunagar. district of state Tamil Nadu
  2. His real name was Kamakshi Kumaraswamy Nadar but was affectionately shortened to Raja by his mother, Sivakami Ammal.
  3. His father, Kumaraswamy Nader, was a coconut merchant.
  4. Kamaraj was enrolled at the local elementary school, the Nayanar Vidyalaya but was later shifted to the high school Kshatriya Vidyalaya.
  5. His father died within a year of Kamaraj’s enrollment in school. 
  6. Kamaraj’s mother sold all jewelery except her earrings and deposited the money with a local merchant and cared for the entire family on the monthly interest that the money earned.
  7. Kamaraj was not a good student in school and dropped out when he was in the sixth grade. 
  8. When he entered mainstream public life he felt handicapped and realized the importance of a good education.
  9. He educated himself during his periods of imprisonment and even learned English from his co-worker. 
  10. Kamaraj joined as an apprentice in his maternal uncle Karuppiah’s cloth shop after dropping out of school. 
  11. He was the “3rd chief minister” of the state Madras.
  12.  He strived hard to improve the status of needy and downtrodden people.
  13.  In 1976, he was honoured with “Bharat Ratna”, India's highest civilian award after his death.
  14.  He was the initiator for providing free education to backward class community children.
  15. He introduced a free mid-day meal scheme in schools.
  16. He was an active member of Congress party.  
  17. At age of 34, he won the election for the “first time” winning a seat in Sattur assembly in 1937.  
  18. He was imprisoned for 2 years for his active participation in “Salt Satyagraha” movement.
  19. Mahatma Gandhi and Jawaharlal Nehru were his sources of inspiration.


Image result for life history of kamarajarKumaraswamy Kamaraj was a powerful Indian politician, activist and statesman who played an important role in pre and post-Independent politics. Born in a moderate middle-class family, Kamaraj’s tryst with politics began early. His increasing interest in the country’s political system finally culminated when he became a full time worker of the Congress during India’s struggle for independence. Kamaraj’s humble beginning did not deter him as he persistently worked to contribute actively to the Congress’ struggle to overthrow the foreign rule. From being merely a campaigner, he rose to become a legislator in the Madras Presidency. The high point in his career came when he became the Chief Minister of Madras. Under his administration, Madras propelled forward and prospered. The education rate which was merely 7% rose to the magnanimous 37% with opening of new schools and education reforms. Irrigation and industry flourished making Madras one of the leaders of industrialization. Interestingly, Kamaraj continued to contribute even after his premiership, as President of the Indian National Congress. For his immense contribution, he was decorated with country’s highest civilian award, Bharat Ratna, posthumously.

Childhood & Early Life

Kumaraswami Kamaraj was born on July 15, 1903 at Virudhunagar, Tamil Nadu to Kumaraswamy and Sivakamiv Ammaiar. His father was a merchant. He had a younger sister Nagammal.
In 1907, Kamaraj enrolled at a traditional school. The following year, he enrolled at the Yenadhi Narayana Vidhya Salai but after a year of studies he shifted to Virudupatti High School.
Tragedy struck young Kamaraj when he was merely six. His father died and his mother was forced to support her family. To help his mother, Kamaraj dropped out of school in 1914 to support his family.

Image result for life history of kamarajarCareer
Kamaraj started his career doing odd jobs. He worked at his uncle’s provision shop. It was during this time that Kamaraj developed interest in politics. He was an avid newspaper reader and kept himself updated with the current events. He soon became involved with the political processions and public meetings and acquainted himself with the Indian Home Rule Movement.
The 1919 Jallianwala Bagh Massacre was a turning point in Kamaraj’s life. The killing of innocent people instigated a rage of fury and vehemence in Kamaraj who decided to work actively in India’s struggle for freedom and bring an end to British Raj.
Kamaraj’s growing interest in politics was not supported by his family who sent him to Thiruvananthapuram where his second uncle stayed. However, Kamaraj’s passion for politics could not be curtailed in Thiruvananthapuram as well. He participated in the Vaikom Satyagraha led by George Joseph of the Congress, against the atrocities of the higher caste Hindus on the Harijans. Kamaraj met Mahatma Gandhi, India’s face of freedom struggle, at the Madurai’s Congress meet. He was inspired by the latter’s simplicity and non-violence movement.
Image result for life history of kamarajarHis political activities in Thiruvananthapuram annoyed his family to the point that he was called back. Though the elders in the family persuaded Kamaraj to stop getting involved in country’s politics, it was without much result. They even tried to marry him off but Kamaraj resolutely disagreed.
In 1920, he joined Congress as a full time worker. He actively worked as political campaigner, organizing public meetings and carrying the Congress propaganda.
Early in his career as a political activist, he participated in many events as a part of the Non-Violent Movement including the Nagpur Flag Satyagraha, Sword Satyagraha, Neil Statue Satyagraha and so on. After joining the Congress, he participated in almost all agitations and demonstrations against the British rule.
In 1930, Kamaraj participated in the Rajagopalachari-led Salt Satyagraha Movement in Vedaranyam. He was sentenced for two years. However, his term of imprisonment was cut short following the Gandhi-Irwin Pact that led to his release in 1931.

In 1932, despite ban on public meetings and procession in Madras, he led processions and demonstrations which subsequently led to his arrest and one year imprisonment. In 1933, Kamaraj was yet again charged with involvement in the Virudhunagar bomb case. However, he was acquitted after not being found guilty.
Image result for life history of kamarajar
In 1936, Kamaraj’s guru Satyamurti was elected President of the Provincial Congress. The latter appointed Kamaraj as the General Secretary. Four years later, the duo swapped positions strengthening the party base through their leadership skills.
In 1942, he attended the All India Congress Meet in Bombay where Gandhi’s Quit India Movement bore its roots. He spread the propaganda material to Trichy, Tanjore, Ranipet and Madurai and for the same was arrested and imprisoned for three years. During his term in jail, he read and self-educated himself
After India’s independence in 1947 he was elected a member of the Working Committee of the Congress. He was also a member of the Constituent Assembly that drafted the constitution. In 1951 he contested and won a seat in the elections to the first Lok Sabha.
In 1954, he was elected as the Chief Minister of the Madras State. He reluctantly took up the post and nominated his co-contestants C. Subramaniam and M. Bhakthavatsalam in his cabinet. Kamaraj’s motto as Chief Minister was to work for the welfare of the people.
Image result for life history of kamarajarUnder Kamaraj, Madras made immense progress in education and trade. New schools were opened and education was made free and compulsory for all up to 11th Standard. Every village had a primary school and every Panchayat a high school. He even introduced the concept of Mid-Day Meal Scheme for lakhs of poor and deprived children. To eradicate caste, creed and class differences, he introduced school uniform. Such was the progress under his administration that the education rate augmented from merely 7% to 37%.
Education was the primary focus of Kamaraj’s Government but he did not overlook other sectors. In fact, he came up with major irrigation schemes that led to the building of dams and canals. Farmers were given facilities and subsidized loans. He also administered the setting up of major industries under his governance such as Neyveli Lignite Corporation, BHEL, Manali Oil Refinery, Hindustan raw photo film factory, surgical instruments factory, a railway coach factory and so on. Industries such as paper, sugar, chemicals and cement were also established during this period.

Image result for life history of kamarajarKamaraj’s excellence as a leader and administrator was evident from the fact that he remained the Chief Minister of the State for three consecutive terms, being re-elected in 1957 and later in 1962. Under his administration, Nehru claimed Madras to be the ‘best administered state in India’
In 1963, he resigned from his post of the Chief Minister to serve a greater purpose. Congress which was losing its vigour and shine needed a revamp of sorts. He came up with a plan which was called the ‘Kamaraj Plan’. He proposed that all senior Congress leaders should resign from their post and devote their energy towards revitalization of the Congress. It was mainly done to refrain the leaders from the temptation of power and instead re-commit them to party objectives and motto. The Plan was a major hit as a number of ministers like Lal Bahadur Shastri, Jagjivan Ram, Morarji Desai and S.K. Patil resigned from their posts.
In 1964, he was elected the President of the All India Congress. During his term as the President, he successfully steered the nation through the stormy years post Nehru’s death. He refused to take up Prime Ministerial office twice, giving it to Lal Bahadur Shastri and Indira Gandhi in 1964 and 1966 respectively.
During the 1969 split of Congress, Kamaraj became the leader of the Indian National Congress (Organisation) in Tamil Nadu. However, in 1971 the party failed miserably but he retained his position until his death in 1975.

Major Works
Image result for life history of kamarajarThough Kamaraj’s role in politics was significant all through, starting off as a political activist and later as the prominent leader of the Indian Independence Movement, his most important contribution came later in his career as the Chief Minister of Madras State. Under his governance, Madras became one of the best administered states of the country. He emphasized on educational reforms, introducing free compulsory education. He established new schools and introduced the concept of midday meal scheme under which lakhs of poor and deprived children were provided food. He also tried to get rid of caste and creed differences. Irrigation and industry also prospered and grew under his three-consecutive term governance.

Personal Life & Legacy
Image result for life history of kamarajarKamaraj breathed his last on October 2, 1975 in his sleep. He was 72 years of age.
Posthumously, Kamaraj was bestowed with the nation’s highest civilian honour, the Bharat Ratna in 1976.
He was proclaimed with the title of ‘Kalvi Thanthai’ or Father of Education in Tamil Nadu.
Chennai airport named its domestic terminal ‘Kamaraj Terminal’.
Several roads and streets across the country are named to honor Kamaraj’s contribution in Indian politics and governance such as Chennai's beach road which bears the name ‘Kamarajar Salai’. Bangalore's North Parade Road and Parliament road in New Delhi were renamed ‘K. Kamaraj Road’.
A university in Madurai was inaugurated under his name, Madurai Kamaraj University, honouring his educational policies as the CM of Madras.

Wednesday, 31 July 2019

IOT Questions and Answers – Proximity Sensor

1. Which sensor can detect nearby objects?
a) Proximity sensor
b) Humidity sensor
c) Touch sensor
d) Pressure sensor
Answer: a
Explanation: A proximity sensor is a sensor able to detect the presence of nearby objects without any physical contact. A proximity sensor often emits an electromagnetic field or a beam of electromagnetic radiation, and looks for a change in the return signal.

2. The monitoring of machines, gears and objects are achieved by which sensor?
a) Humidity sensor
b) Proximity sensor
c) Touch sensor
d) Pressure sensor

Answer: b
Explanation: The monitoring of machines, gears and objects are achieved precisely by the IOT(INTERNET OF THINGS) wireless proximity sensors. They use in industries ranging from robotics to machine tools, from measuring instruments to assembly lines, from food sector to chemical industry, etc.

3. Which proximity sensor detects metal objects?
a) Capacitive Proximity Sensor
b) Magnetic Proximity Sensor
c) Ultrasonic Proximity Sensor
d) Inductive Proximity Sensor

Answer: d
Explanation: Different proximity sensor targets demand different sensors. The different types of proximity sensors are: Inductive, Capacitive, Ultrasonic, Photoelectric, Magnetic, etc.

4. Which proximity sensor indicates level?
a) Inductive Proximity Sensor
b) Capacitive Proximity Sensor
c) Magnetic Proximity Sensor
d) Ultrasonic Proximity Sensor

Answer: a
Explanation: Capacitive Proximity Sensor indicates level and the fill amount present in containers, behind covering. They are used to track all objects including non-metallic ones.

5. Which proximity sensors are used in automotive?
a) Inductive Proximity Sensor
b) Capacitive Proximity Sensor
c) Magnetic Proximity Sensor
d) Ultrasonic Proximity Sensor

Answer: d
Explanation: They are widely used in automotive such as parking sensors. Ultrasonic Proximity Sensors are used in automotive.

6. Which proximity sensor detects positioning of an object?
a) Inductive Proximity Sensor
b) Capacitive Proximity Sensor
c) Optical Proximity Sensor
d) Magnetic Proximity Sensor

Answer: c
Explanation: They recognize, for non-contact and precisely, the positioning of the object.

7. Are proximity sensors used in retail settings?
a) True
b) False

Answer: a
Explanation: A retailer can use a customer’s proximity to a product to send deals and coupons directly to their smart phone.

8. VCNL4100CT allows the proximity detection up to________
a) 2 meter
b) 1 meters
c) 0.5 meters
d) 1.5 meters

Answer: b
Explanation: VCNL4100CT expand the range of applications by introducing a high-power IR emitter that allows proximity detection up to one meter.

9. Which protocol is used by proximity sensor?
a) I2C
b) SPI
c) UART/USART
d) CAN

Answer: a
Explanation: Microcontroller communication is via standard I2C, where the host can set measurement parameters and request results. If desired, programmable threshold allow the VCNL4100 to interrupt the host once threshold values are crossed, thereby minimizing device polling.

10. Does proximity sensor have a temperature sensor in it?
a) True
b) False
Answer: a
Explanation: A buit-in temperature sensor is used by the signal processing circuitry to provide stable outputs across the temperature range -40 oC to +85oC.

11. Which device generates output signal when metal objects are either inside or entering into sensing area.
a) Capacitive Proximity
b) Magnetic Proximity
c) Inductive proximity
d) Parallel Proximity

Answer: a
Explanation: Device which generates output signal electrical signal when metal objects are either inside or entering into its sensing area from an direction.

12. ________ detects metals but along with it can also detect resins, liquids.
a) Inductive proximity
b) Capacitive Proximity
c) Magnetic Proximity
d) Parallel Proximity

Answer: b
Explanation: Capacitive Proximity can also detect metals but along with it can also detect resins, liquids, powders, etc. This sensor working can vary accordingly covering material, cable longness, noise sensitivity.
advertisement

13. _________ sensors have no electrical noise effect and it can work DC.
a) Inductive proximity
b) Capacitive Proximity
c) Magnetic Proximity
d) Parallel Proximity

Answer: c
Explanation: Magnetic proximity sensors have no electrical noise effect and it can work on DC, AC, AC/DC.

14. What is the sensing range for magnetic proximity sensors?
a) 120mm
b) 90mm
c) 150mm
d) 100mm

Answer: a
Explanation: Magnetic proximity sensors have no electrical noise effect and it can work on DC, AC, AC/DC. These types of sensors have highest sensing range upto 120mm.

15. What is the sensing range for capacitive proximity sensors?
a) 150mm
b) 25mm
c) 120mm
d) 100mm

Answer: c
Explanation: Capacitive Proximity can also detect metals but along with it can also detect resins, liquids, powders, etc. This sensor working can vary accordingly covering material, cable longness, noise sensitivity.Its maximum range of sensing is 25mm.