320 likes | 433 Views
This work explores novel data compression algorithms tailored for energy-constrained sensor networks in delay-tolerant environments. It introduces an adaptation of the LZ77 compression approach (S-LZW) specifically designed for sensor nodes, alongside a mini-cache variant (S-LZW-MC). The algorithms focus on efficient data compression without sacrificing energy, presenting experimental results that highlight significant improvements in compression ratios and computing times when processing outdoor and indoor sensor data. The study addresses unique challenges faced by resource-constrained devices, offering robust solutions with broad applicability.
E N D
Data Compression Algorithms for Energy-Constrained Devices in Delay Tolerant Networks Christopher M. Sadler and Margaret Martonosi In: Proc. of the 4th ACM Conference on Embedded Networked Sensor Systems (SenSys), 2006. Reporter: 王滋農
1. Motivation • Previous algorithms of compressing acquired data in sensor systems - application-specific algorithms - off-the-shelf algorithms → Not for resource-constrained sensor nodes • Standard compression algorithms are aimed at saving storage not energy
2. Outline • LZW compression • LZW for Sensor Nodes (S-LZW) • S-LZW with Mini-Cache (S-LZW-MC)
3.1 LZW introduction (1/4) • The LZW Compression Algorithm is a dictionary-based algorithm, which always tries to output short codes for strings that are already present in it's dictionary • LZW compression uses a code table, with 4096 (12 bits) as a common choice for the number of table entries • Codes 0-255 (ASCII code 8 bits) in the code table are always assigned to represent single bytes from the input file • When encoding begins the code table contains only the first 256 entries, with the remainder of the table being blanks • Compression is achieved by using codes 256 through 4095 to represent sequences of bytes • As the encoding continues, LZW identifies repeated sequences in the data, and adds them to the code table
3.1 LZW algorithm (2/4) Initialize table with single character strings P = first input character Codeword = 256 WHILE not end of input stream C = next input character IF P + C is in the string table P = P + C ELSE output the code for P add P + C to the string table Codeword++ P = C END IF END WHILE output code for P
3.1 LZW example (3/4) • Compressing the string: BABAABAAA
3.1 LZW example (4/4) • Uncompressed String: aaabbbbbbaabaaba Number of bits = Total number of characters * 8 = 16 * 8 = 128 bits • Compressed string (codewords): <97><256><98><258><259><257><261> Number of bits = Total Number of codewords * 12 = 7 * 12 = 84 bits
Outline • LZW compression • LZW for Sensor Nodes(S-LZW) • S-LZW with Mini-Cache (S-LZW-MC)
3.2 S-LZW introduction (1/5) • Never deliver 100% of data to others - dictionary size - data size
3.2 S-LZW algorithm (2/5) • Dictionary size - Experimented with 512, 768, 1024 & Unlimited. - Block sizes of 1, 2, 4 & 10 Flash pages. • S‐LZW uses 512 entry dictionary and 4 pages or less
3.2 S-LZW algorithm (4/5) • Data Size – Evaluated 1, 2 & 4 flash page sizes. – Compressed either 2 pages in one block or two individual one‐page blocks. – Also, 4 pages in either one block or two individual two page blocks. – Compression ratio benefits while using a block of 2 pages. SS, GDI, ZNet & Calgeo improvements – 25.5%, 12.9%, 4.6%, 3.3%. – Compute times benefit while using a block of 2 pages. SS, GDI, ZNet & Calgeo improvements – 24.5%, 1.7%, 5.3%, 1.1% • S‐LZW compresses data in block of 528 Bytes (2 Pages) → SS (SensorScope): indoor environmental monitoring → ZNet (ZebraNet): a combination GPS data and debugging data → GDI (Great Duck Island):Habitat and environmental monitoring data → Calgeo (Calgary Corpus): seismic data
… … … 3.2 S-LZW algorithm (5/5) SENSOR DATA – N BYTES GENERATED OVER TIME … 528 B Block (2 Flash Pages) 528 B Block (2 Flash Pages) 528 B Block (2 Flash Pages) … COMP. ALGORITHM COMP. ALGORITHM COMP. ALGORITHM … Compressed Data Compressed Data Compressed Data …
Outline • LZW compression • LZW for Sensor Nodes(S-LZW) • S-LZW with Mini-Cache (S-LZW-MC)
3.3 S-LZW-MC introduction (1/3) • A variant of S-LZW • Data acquiring over short intervals
Flow chart of S-LZW-MC 3.3 S-LZW-MC flow chart (2/3)
3.3 S-LZW-MC example (3/3) • Hit => Saves multiple bits: (Log2N)+1 Bit • Miss => Costs just 1 extra escape bit: (9+1)
4. Novelty • Proposing novel approaches tailored to the unique trade-offs and constraints of sensors
5. Strength • An efficient and lossless data compression algorithms on the source node • The compression algorithms are suitable for static and mobile sensor network and applicable to a wide range of applications
6. Weakness • This paper doesn’t clearly describe how to solve the problem when the dictionary fills • Not the optimum compression ratio
What happens when the dictionary gets too large (i.e., when all the 4096 locations have been used)? • Here are some options usually implemented: • Simply forget about adding any more entries and use the table as is. • Throw the dictionary away when it reaches a certain size. • Throw the dictionary away when it is no longer effective at compression. • Clear entries 256-4095 and start building the dictionary again. • Some clever schemes rebuild a string table from the last N input characters.
LZW Decompression • The LZW decompressor creates the same string table during decompression. • It starts with the first 256 table entries initialized to single characters. • The string table is updated for each character in the input stream, except the first one. • Decoding achieved by reading codes and translating them through the code table being built.
LZW Decompression Algorithm 1 Initialize table with single character strings 2 OLD = first input code 3 output translation of OLD 4 WHILE not end of input stream 5 NEW = next input code 6 IF NEW is not in the string table 7 S = translation of OLD 8 S = S + C 9 ELSE 10 S = translation of NEW 11 output S 12 C = first character of S 13 OLD + C to the string table 14 OLD = NEW 15 END WHILE
Example 2: LZW Decompression 1 Example 2: Use LZW to decompress the output sequence of Example 1: <66><65><256><257><65><260>.
Example 2: LZW Decompression Step 1 <66><65><256><257><65><260> Old = 65 S = A New = 66 C = A
Example 2: LZW Decompression Step 2 <66><65><256><257><65><260> Old = 256 S = BA New = 256 C = B
Example 2: LZW Decompression Step 3 <66><65><256><257><65><260> Old = 257 S = AB New = 257 C = A
Example 2: LZW Decompression Step 4 <66><65><256><257><65><260> Old = 65 S = A New = 65 C = A
Example 2: LZW Decompression Step 5 <66><65><256><257><65><260> Old = 260 S = AA New = 260 C = A