cos 109 monday december 7 housekeeping –lab 8 and assignment 9 are posted –final exam –...

45
COS 109 Monday December 7 Housekeeping Lab 8 and Assignment 9 are posted Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam A review session will be held on January 14 (time and location TBA) Reading assignment for next Monday (also posted on course home page) https://static.newamerica.org/attachments/3421-riding- the-wave/Riding%20the %20Wave_Final_and_Teaching_Note.d71b398fa011446ca2739f5 b0737dcfb.pdf Today’s class Wireless from radio to wifi to cellphones Data compression and error correction

Upload: brent-york

Post on 29-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

COS 109 Monday December 7

• Housekeeping– Lab 8 and Assignment 9 are posted– Final exam – January 18 (Monday) at 7:30PM

In class, 3 hour exam

– A review session will be held on January 14 (time and location TBA)– Reading assignment for next Monday (also posted on course home

page)https://static.newamerica.org/attachments/3421-riding-the-

wave/Riding%20the%20Wave_Final_and_Teaching_Note.d71b398fa011446ca2739f5b0737dcfb.pdf

• Today’s class– Wireless from radio to wifi to cellphones– Data compression and error correction

Page 2: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Sound waves and frequencies• Sound can be

represented by a graph showing intensity plotted versus time

• The graph is composed of components that appear regular (i.e. work at certain frequencies)

• We can speak of the graph as being composed of its amplitudes (heights) at various frequencies.

• We have Jean-Baptiste Joseph Fourier (1768—1830) to thank for this

Page 3: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Very simple view of what comes forward

• A radio process consists of a transmitter and a receptor

• Transmitter broadcasts signals at a certain frequency (or perhaps many frequencies)

• Receptor is set to receive signals at a fixed frequency

• Signals decay over distance (based on their frequency)

• Underlying societal issue– Who owns a frequency in a (geographic) area?

• Definition– Frequencies are measured in cycles per second (called Hertz (Hz))

e.g. tune your radio to 770 KHz (an AM station) or 101.5 MHZ (an FM station) or broadcast; Wifi may be at 5GHz; my cellphone uses 850MHz and 1900MHz

Page 4: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

How does a radio work?

• Transmitter/receiver• Tuned on a frequency• Picks up that frequency and uses the amplitude to decode 1’s

and 0’s from amplitude

• How a radio works– How sound is made and transmitted (old time view)– How sound is transmitted

• "modulate" the wave to impose information on it– amplitude (AM): change the power level– frequency (FM): change the frequency around nominal value– digital: on/off

• received signal strength varies directly with power level• received signal strength dies off with square of distance• higher frequencies go shorter distances

Page 5: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

On to WiFi

• A Wifi device involves two key components– Antennae to receive signals as radio waves– A port in the back to wire into the Internet (or LAN)

Page 6: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

The wireless part

• Convert 0’s and 1’s into waves and transmit at frequency (2.4 or 5 GHz)

• Work according to standards– Standards are defined by IEEE (Institute of Electrical and Electronic

Engineers)

• Transmit by various coding systems– orthogonal frequency-division multiplexing (OFDM)– complementary code keying (CCK) modulation

• The 802.11 standards

Page 7: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

The 802.11 standards

• 802.11a (1997) transmits at 5 GHz and can move up to 54 megabits of data per second. It uses OFDM to greatly reduce interference.

• 802.11b (1999) is the slowest and least expensive standard. For a while, its cost made it popular, but now it's becoming less common as faster standards become less expensive. 802.11b transmits in the 2.4 GHz frequency band of the radio spectrum. It can handle up to 11 megabits of data per second, and it uses CCK to improve speeds.

• 802.11g (2003) transmits at 2.4 GHz like 802.11b, but it's a lot faster -- it can handle up to 54 megabits of data per second. 802.11g is faster because it uses the same OFDM coding as 802.11a.

• 802.11n (2009) is the newest standard that is widely available. This standard significantly improves speed and range. For instance, although 802.11g theoretically moves 54 megabits of data per second, it only achieves real-world speeds of about 24 megabits of data per second because of network congestion. 802.11n, however, reportedly can achieve speeds as high as 140 megabits per second.

• 802.11ac came in 2013 to extend 802.11n. Channels are wider and will yield higher bandwidth. Vendors are now building devices in this range.

Page 8: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Another view of wireless technology

Page 9: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

A simple view of cell phones

Base stations (== cellular towers)

Public telephone network

Switch

Cell phones

Switch

• all phones are part of the public switched telephone network

• a cell phone is connected by radio instead of wires

• moves long distances, at high speed, appears out of nowhere

• shares a very limited radio frequency spectrum with others

• operates with low power because it uses batteries

• this makes life complicated

Page 10: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Cells (a very idealized picture)

• divide geographical area into cells (notionally hexagonal)

• each cell has an antenna, handles all cell phones in its area

• available radio spectrum is divided into channels – two channels for one conversation, one for each direction– competing carriers operate on different frequencies

• each cell gets 1/7 of the channels– adjacent cells can't use the same channels

because of interference– non-adjacent cells can re-use channels

from www.howstuffworks.com

Page 11: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Not in myback yard!

Page 12: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session
Page 13: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Camouflage

Page 14: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Camouflage

Page 15: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Camouflage

Page 16: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Meanwhile, in the southwest…

Page 17: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Can you hear me?

Page 18: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Sent on behalf of Jay Dominick, Vice President for Information Technology and Chief Information Officer

Dear Colleague,

OIT is currently working with Verizon to supplement the cellular wireless signal in and around the E-Quad. As part of that process, Verizon has established a Cellular transmitter on the roof of the J Wing of the E-Quad. The equipment being used will transmit in licensed frequency bands (746Mhz - 787Mhz, 835Mhz - 894Mhz and 1710Mhz - 2120Mhz) at between 10 and 40 Watts.

Page 19: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

How it works

• when a phone is turned on, it broadcasts its ID (“registration”)– nearest base station notices, validates with home system

registration uses encryption for fraud prevention

– phone keeps broadcasting enough to keep in touch

• when the phone is called, the home system knows where it is– home system contacts base(s) where phone is– bases broadcast to where phone was last seen (“paging”)

• phones talk to base with strongest signal– base and phone communicate over 2 agreed-upon channels (up, down)– phones continuously adjust power level to signal strength at base

uses less battery, creates less interference for other phones

• phones move from base to base and from system to system– base initiates handoff when signal gets weak– phone picked up by base with strongest signal– elaborate protocols at all levels

Page 20: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

How it works, continued

• multiple frequency bands (different in different parts of the

world) – divided into channels (frequency multiplexing)

digital phones multiplex several calls on one channel (GSM)or spread calls out over the whole spectrum (CDMA)

– phones usually support multiple bands

• channels carry both voice and control information (including data)

– digital speech is highly compressed (~1 bit/speech sample)– elaborate coding & error correction for speech & control

information– power turned off when nothing is being sent

• phones store user info on removable flash memory card– SIM (Subscriber Information Module)– may be able to replace card to use in a different environment

• most of the world uses GSM– in USA, AT&T & T-Mobile use GSM; Verizon & Sprint use CDMA

Page 21: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Radio waves – how are frequencies used

• Might be different channels to offset frequencies• Device is set up to receive the frequency like a radio

– WCBS – 660KHz– WPRB – 103.3MHz– My home landline – 900MHz– iPhone6 –

850,900,1800, 1900,2100 MHz for Cellular802.11n (2.4GHz and 5 GHz for wifi)

– WNBC-TV67.25 MHz (video signal)71.75 MHz (audio signal)

• Frequency enables decoding

Page 22: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Sample frequencies

• AM radio - 535 kilohertz to 1.7 megahertz • Short wave radio - bands from 5.9 megahertz to 26.1 megahertz • Citizens band (CB) radio - 26.96 megahertz to 27.41 megahertz • Television stations - 54 to 88 megahertz for channels 2 through 6 • FM radio - 88 megahertz to 108 megahertz • Television stations - 174 to 220 megahertz for channels 7 through 13

• Wireless devices in the house– Garage door openers, alarm systems, etc. - Around 40 megahertz – Baby monitors: 49 megahertz – Radio controlled airplanes: Around 72 megahertz, which is different from... – Radio controlled cars: Around 75 megahertz – New cordless phones operate at DECT 6.0 (1.9 GHz)– Bluetooth: between 2.402 and 2.480 gigahertz– My slide advancing remote ~ 30 PHz (30 million GHz) (on infrared spectrum)

• Other frequencies– Wildlife tracking collars: 215 to 220 megahertz – MIR space station: 145 megahertz and 437 megahertz – Air traffic control radar: 960 to 1,215 megahertz – Global Positioning System: 1,227 and 1,575 megahertz – Deep space radio communications: 2290 megahertz to 2300 megahertz– Ezpass – 915 megahertz

Page 23: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

The full spectrum

From http://electronics.howstuffworks.com/radio-spectrum.htm

Page 24: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

RF spectrum

Page 25: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session
Page 26: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session
Page 27: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Selling frequency

• see an auction• Looking at a particular auction• Seeing the results

Page 28: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session
Page 29: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Technology meets politics again

• should texting while driving be illegal (and enforced)?– how about just talking on a phone while driving?

• where determines where cell phone towers are permitted?– property rights versus eminent domain

• should cell phone jammers be legalized?– in theatres, trains, etc.

• location tracking and surveillance– FCC mandates that cell phone can be locatable within 125 meter

radius– should real-time location info be available to law enforcement, etc.?– how should this evolve as GPS becomes universally available?– who can have access to what cell phone records under what

circumstances?

• if you use your cell phone to make a call or use wifi on your phone to Skype, what is the difference?

Page 30: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

GPS (Global Positioning System)

• 31 satellites, each broadcasting time & its location– altitude ~ 20 km, frequency ~ 1575 MHz– at least 6 are visible at any time

• receiver calculates its position using distances to 3 or more satellites– distances computed by careful measurement of time– accuracy typically within 15 m for civilian systems– additional inputs or use of encrypted info reduces this to < 1 m

Page 31: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session
Page 32: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session
Page 33: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Web site of the day

• The useless web

Page 34: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Compression; Error detection & correction

• compression: squeeze out redundancy– to use less memory or use less network bandwidth – encode the same information in fewer bits

• some bits carry no information• some bits can be computed or inferred from others• some bits don't matter to the recipient and can be dropped entirely

• error detection & correction: add redundancy– to detect and fix up loss or damage– add carefully defined, systematic redundancy– with enough of the right redundancy,

can detect damaged bits can correct errors

Page 35: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Compressing English text

• letters do not occur equally often• encode frequent letters with fewer bits, less frequent

things with more bits (trades complexity against space)– e.g., Morse code, Huffman code, ...

• run-length encoding– encode runs of identical things with a count– e.g., World Wide Web Consortium => WWWC => W3C

• words do not occur equally often• encode whole words, not just letters

– e.g., abbreviations for frequent words

Page 36: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Letter frequencies in King James bible (4.1M chars)

SP

E

T

H AO

NI S

R DL

F U MW Y G C B P V K J Z X Q

0

100000

200000

300000

400000

500000

600000

700000

800000

SP E T H A O N I S R D L F U M W Y G C B P V K J Z X Q

Page 37: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Word frequencies (790K words)

the

and

of

to that inheshalluntofor i his a lordtheybe is himnotthem it w ith all thouthyw asgodw hichmy mesaidbut ye theirhavew illtheefromas are

0

10000

20000

30000

40000

50000

60000

70000

the of th

at he unto i a

they is no

t it all

thy

god

my

said ye

have th

ee as

Page 38: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Zipf's Law (adapted from Wikipedia)

• frequency of any word is inversely proportional to its position in the frequency table– empirically, the most frequent word will occur approximately

twice as often as the second most frequent word, which occurs twice as often as the fourth most frequent word, etc.

the

and

of

to that inhe shalluntofor i his a lordtheybe is him notthem it w ith all thouthyw asgodw hichmy mesaidbut ye theirhavew illtheefromas are

0

10000

20000

30000

40000

50000

60000

70000

the of th

at he unto i a

they is no

t it all

thy

god

my

said ye

have th

ee as

Page 39: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

Lempel-Ziv coding; adaptive compression algorithms• build a dictionary of recently occurring data• replace subsequent occurrences by (shorter) reference to

the dictionary entry• dictionary adapts as more input is seen

– compression adapts to properties of particular input– algorithm is independent of nature of input

• dictionary is included in the compressed data

• Lempel-Ziv is the basis of PKZip, Winzip, gzip, GIF– compresses Bible from 4.1 MB to 1.2 MB (typical for text)

• Lempel-Ziv is a lossless compression scheme– compression followed by decompression reproduces the input exactly

• lossy compression: may do better if can discard some information– commonly used for pictures, sounds, movies

Page 40: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

JPEG (Joint Photographic Experts Group) picture compression

• a lossy compression scheme, based on how our eyes work

• digitize picture into pixels• discard some color information (use fewer distinct

colors)– eye is less sensitive to color variation than brightness

• discard some fine detail– decompressed image is not quite as sharp as original

• discard some fine gradations of color and brightness

• use Huffman code, run-length encoding, etc., to compress resulting stream of numeric values

• compression is usually 10:1 to 20:1 for pictures• used in web pages, digital cameras, ...

Page 41: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session
Page 42: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session
Page 43: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

JPEG images

• (16"x14") 1800 bytes: (87"x118") 360K Bytes:

Page 44: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

MPEG (Moving Picture Experts Group) movie compression

• MPEG-2: lossy compression scheme, based on human perceptions

• uses JPEG for individual frames (spatial redundancy)• adds compression of temporal redundancy

– look at image in blocks– if a block hasn't changed, just transmit that fact, not the content– if a block has moved, transmit amount of motion– motion prediction (encode expected differences plus correction)– separate moving parts from static background– ...

• used in DVD, high-definition TV, digital camcorders, video games

• rate is 3-15 Mbps depending on size, frame rate– 15 Mbps ~ 2 MB/sec or 120 MB/min ~ 100x worse than MP3– 3 Mbps ~ 25 MB/min; cf DVD 25 MB/min ~ 3000 MB for 2 hours– regular TV is ~ 15 Mbps, HDTV ~ 60-80 Mbps

Page 45: COS 109 Monday December 7 Housekeeping –Lab 8 and Assignment 9 are posted –Final exam – January 18 (Monday) at 7:30PM In class, 3 hour exam –A review session

MP3 (MPEG Audio Layer-3) sound compression

• movies have sound as well as motion; this is the audio part

• 3 levels, with increasing compression, increasing complexity

• based on "perceptual noise shaping": use characteristics of the human ear to compress

better:– human ear can't hear some sounds (e.g., very high frequencies)– human ear hears some sounds better than others– louder sounds mask softer sounds

• break sound into different frequency bands• encode each band separately• encode 2 stereo channels as 1 plus difference• gives about 10:1 compression over CD-quality audio

– 1 MB/minute instead of 10 MB/minute– can trade quality against compression