the compression of iot operational data time series in

95
The Compression of IoT operational data time series in vehicle embedded systems RENZHI XING KTH ROYAL INSTITUTE OF TECHNOLOGY Electrical Engineering and Computer Science DEGREE PROJECT IN COMPUTER SCIENCE AND COMPUTER ENGINEERING, SECOND CYCLE STOCKHOLM, SWEDEN 2018

Upload: others

Post on 05-Jan-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Compression of IoT operational data time series in

The Compression of IoT operational data time series in vehicle embedded systems

RENZHI XING

KTH ROYAL INSTITUTE OF TECHNOLOGY E l e c t r i c a l E n g i n e e r i n g a n d C o m p u t e r S c i e n c e

DEGREE PROJECT IN COMPUTER SCIENCE AND COMPUTER ENGINEERING, SECOND CYCLE STOCKHOLM, SWEDEN 2018

Page 2: The Compression of IoT operational data time series in

The Compression of IoT operational data time series in vehicle embedded systems

Renzhi Xing

2018-11-12

Master’s Thesis

Examiner Gerald Q. Maguire Jr.

Industrial adviser Jakob Palmheden (Scania AB)

KTH Royal Institute of Technology School of Electrical Engineering and Computer Science (EECS) Department of Communication Systems SE-100 44 Stockholm, Sweden

Page 3: The Compression of IoT operational data time series in

Abstract | i

Abstract

This thesis examines compression algorithms for time series operational data which are collected from the Controller Area Network (CAN) bus in an automotive Internet of Things (IoT) setting.

The purpose of a compression algorithm is to decrease the size of a set of time series data (such as vehicle speed, wheel speed, etc.) so that the data to be transmitted from the vehicle is small size, thus decreasing the cost of transmission while providing potentially better offboard data analysis.

The project helped improve the quality of data collected by the data analysts and reduced the cost of data transmission. Since the time series data compression mostly concerns data storage and transmission, the difficulties in this project were where to locate the combination of data compression and transmission, within the limited performance of the onboard embedded systems. These embedded systems have limited resources (concerning hardware and software resources). Hence the efficiency of the compression algorithm becomes very important. Additionally, there is a tradeoff between the compression ratio and real-time performance. Moreover, the error rate introduced by the compression algorithm must be smaller than an expected value.

The compression algorithm contains two phases: (1) an online lossy compression algorithm - piecewise approximation to shrink the total number of data samples while maintaining a guaranteed precision and (2) a lossless compression algorithm – Delta-XOR encoding to compress the output of the lossy algorithm. The algorithm was tested with four typical time series data samples from real CAN logs with different functions and properties. The similarities and differences between these logs are discussed. These differences helped to determine the algorithms that should be used. After the experiments which helped to compare different algorithms and check their performances, a simulation is implemented based on the experiment results. The results of this simulation show that the combined compression algorithm can meet the need of certain compression ratio by controlling the error bound. Finally, the possibility of improving the compression algorithm in the future is discussed.

Keywords

Data compression, Data transmission, Time series data, IoT, CAN, Vehicle connectivity

Page 4: The Compression of IoT operational data time series in
Page 5: The Compression of IoT operational data time series in

Sammanfattning | iii

Sammanfattning

Denna avhandling undersöker komprimeringsalgoritmer för driftdata från tidsserier som samlas in från ett fordons CAN-buss i ett sammanhang rörande Internet of Things (IoT) speciellt tillämpat för bilindustrin.

Syftet med en kompressionsalgoritm är att minska storleken på en uppsättning tidsseriedata (som tex fordonshastighet, hjulhastighet etc.) så att data som ska överföras från fordonet har liten storlek och därmed sänker kostnaden för överföring samtidigt som det möjliggör bättre dataanalys utanför fordonet.

Projektet bidrog till att förbättra kvaliteten på data som samlats in av dataanalytiker och minskade kostnaderna för dataöverföring. Eftersom tidsseriekomprimeringen huvudsakligen handlar om datalagring och överföring var svårigheterna i det här projektet att lokalisera kombinationen av datakomprimering och överföring inom den begränsade prestandan hos de inbyggda systemen. Dessa inbyggda system har begränsade resurser (både avseende hårdvaru- och programvaruresurser). Därför blir effektiviteten hos kompressionsalgoritmen mycket viktig. Dessutom är det en kompromiss mellan kompressionsförhållandet och realtidsprestanda. Dessutom måste felfrekvensen som införs av kompressionsalgoritmen vara mindre än ett givet gränsvärde.

Komprimeringsalgoritmen i denna avhandling benämns kombinerad kompression, och innehåller två faser: (1) en online-algoritm med dataförluster, för att krympa det totala antalet data-samples samtidigt som det garanterade felet kan hållas under en begränsad nivå och (2) en dataförlustfri kompressionsalgoritm som komprimerar utsignalen från den första algoritmen. Algoritmen testades med fyra typiska tidsseriedataxempel från reella CAN-loggar med olika funktioner och egenskaper. Likheterna och skillnaderna mellan dessa olika typer diskuteras. Dessa skillnader hjälpte till att bestämma vilken algoritm som ska väljas i båda faser. Efter experimenten som jämför prestandan för olika algoritmer, implementeras en simulering baserad på experimentresultaten. Resultaten av denna simulering visar att den kombinerade kompressionsalgoritmen kan möta behovet av ett visst kompressionsförhållande genom att styra mot den bundna felgränsen. Slutligen diskuteras möjligheten att förbättra kompressionsalgoritmen i framtiden.

Nyckelord

Datakomprimering, Dataöverföring, Tidsseriedata, IoT, CAN, Uppkopplade fordon

Page 6: The Compression of IoT operational data time series in
Page 7: The Compression of IoT operational data time series in

Acknowledgments | v

Acknowledgments

I would first like to thank my supervisor Jakob Palmheden for always kindly helping me in his humourous way so that I could overcome the difficulties I’ve encounterd during my thesis. I also appreciate all the people in Scania that have supported me in every aspect.

I would also like to thank Professor Gerald Q. Maguire Jr. from KTH for giving so much guidance and insight on my thesis. Many thanks to Somasundaram Vadivelu as my thesis opponent for his valuable comments on this thesis.

Finally, special thanks to my parents and my boyfriend for continuously encouraging me throughout years of my study. Without you I could not have finished this accomplishment. Thank you for your constant love.

Stockholm, November 2018 Renzhi Xing

Page 8: The Compression of IoT operational data time series in
Page 9: The Compression of IoT operational data time series in

Table of contents | vii

Table of contents

Abstract ....................................................................................... i Keywords ................................................................................................. i

Sammanfattning ....................................................................... iii Nyckelord ............................................................................................... iii

Acknowledgments ..................................................................... v Table of contents ..................................................................... vii List of Figures ........................................................................... xi List of Tables .......................................................................... xiii List of acronyms and abbreviations ...................................... xv 1 Introduction .......................................................................... 1

1.1 Background .................................................................................. 1 1.2 Problem ........................................................................................ 2 1.3 Purpose ........................................................................................ 3 1.4 Goals ............................................................................................ 3 1.5 Research Methodology ............................................................... 4 1.6 Delimitations ................................................................................ 4 1.7 Structure of the thesis ................................................................ 5

2 Background .......................................................................... 7 2.1 Automotive IoT ............................................................................ 7

2.1.1 Fleet management and Automotive IoT ............................ 7 2.1.2 Operational time series data ............................................. 8

2.2 HW and SW structure of the IoT platform .................................. 9 2.2.1 HW structure of a CAN network ........................................ 9 2.2.2 The SW structure on RTC-C300 ..................................... 10

2.3 Compression Algorithms .......................................................... 11 2.3.1 Lossless Algorithms ........................................................ 11 2.3.2 Lossy Algorithms ............................................................. 12

2.4 Related work .............................................................................. 13 2.4.1 Lossless compression of time series data ...................... 13 2.4.2 Lossy compression of time series data ........................... 14

2.5 Summary .................................................................................... 15 3 Onboard Time Series Data Analysis ................................ 19

3.1 Research Process ..................................................................... 19 3.2 Analysis of Data Samples ......................................................... 20

3.2.1 Similarities in CAN signal samples .................................. 24 3.2.2 Differences in CAN signal samples ................................. 24

4 Lossy Compression Algorithm Research ....................... 25 4.1 Algorithm Comparison and Selection ..................................... 25

4.1.1 Quantization .................................................................... 25 4.1.2 Orthogonal Transformations ........................................... 25

Page 10: The Compression of IoT operational data time series in

viii | Table of contents

4.1.3 Piecewise Approximations .............................................. 26 4.1.4 Conclusion ...................................................................... 26

4.2 Experimental design ................................................................. 27 4.2.1 Test environment ............................................................ 28 4.2.2 Experiment input ............................................................. 28 4.2.3 Experiment measurements ............................................. 28

4.3 Reliability and validity ............................................................... 29 4.4 Algorithm Test Results & Analysis .......................................... 29

4.4.1 Runtime Performances ................................................... 29 4.4.2 Comparison of compression ratios.................................. 32 4.4.3 Reconstruction Performance .......................................... 36

4.5 Conclusion ................................................................................. 37 4.5.1 Evaluation of the four types of data inputs ...................... 37 4.5.2 Evaluation of compression algorithms ............................ 37

5 Lossless and Combined Compression Algorithms Research ............................................................................. 41

5.1 Algorithm Selection and Design .............................................. 41 5.1.1 Delta and XOR encoding ................................................ 41 5.1.2 The LZ4 and Snappy ...................................................... 43

5.2 Experimental Design ................................................................. 44 5.2.1 Test Environment ............................................................ 45 5.2.2 Experiment input ............................................................. 45 5.2.3 Experimental output ........................................................ 45

5.3 Algorithm Test Results & Analysis .......................................... 45 5.3.1 Overall performance ....................................................... 46 5.3.2 Individual Performance ................................................... 47

5.4 Conclusion ................................................................................. 48 6 Implementation .................................................................. 49

6.1 Software design ......................................................................... 49 6.1.1 Selection of algorithms .................................................... 49 6.1.2 Selection of the error bound parameter .......................... 49 6.1.3 Software structure ........................................................... 50

6.2 Implementation Results ............................................................ 51 7 Conclusions and Future work .......................................... 53

7.1 Conclusions ............................................................................... 53 7.2 Limitations ................................................................................. 53

7.2.1 Time limitation ................................................................. 53 7.2.2 Performance limitation .................................................... 54

7.3 Future work ................................................................................ 54 7.3.1 Implement with other SW applications on C300 ECU ..... 54 7.3.2 Other lossy algorithms .................................................... 54 7.3.3 Decoding ......................................................................... 54 7.3.4 Preprocessing of time series data ................................... 54 7.3.5 Real-time system design ................................................. 55

Page 11: The Compression of IoT operational data time series in

Table of contents | ix

7.4 Reflections ................................................................................. 55 References ............................................................................... 57 Appendix A: C++ implementation of PMC-MR ...................... 59 Appendix B: C++ implementation of Swing filter ................. 61 Appendix C: Error bound test results of Mixed-PLA ........... 69

Page 12: The Compression of IoT operational data time series in
Page 13: The Compression of IoT operational data time series in

List of Figures | xi

List of Figures

Figure 1-1 Structure of a vehicular IoT system communicating with the vehicle manufacturer’s computer system ............................ 1

Figure 1-2 An example of current operational data showing speeds binned into intervals of speed in km/h over two months ......... 2

Figure 2-1 Network Structure of Scania Fleet Management IoT ............... 7 Figure 2-2 Example of raw time series data, in this case, vehicle speed .... 9 Figure 2-3 Simplified CAN network related to RTC-C300 ....................... 10 Figure 2-4 Basic concept of combing compression algorithms ................ 16 Figure 2-5 Summary of Data Compression Algorithms ........................... 17 Figure 3-1 Research Process ..................................................................... 19 Figure 3-2 Example of a CAN log ............................................................. 20 Figure 3-3 CAN-based time series data ..................................................... 22 Figure 4-1 Runtime results from Fuel Rate test ...................................... 30 Figure 4-2 Runtime results from Engine Speed test ................................ 30 Figure 4-3 Runtime results from Vehicle Speed test ................................ 31 Figure 4-4 Runtime results from Odometer test ...................................... 31 Figure 4-5 Compression Ratio from Fuel Rate test .................................. 33 Figure 4-6 Compression Ratio from Engine Speed test ............................ 33 Figure 4-7 Compression Ratio from Vehicle Speed test ........................... 34 Figure 4-8 Compression Ratio from Odometer test ................................. 34 Figure 4-9 Radar charts of different compression methods .................... 38 Figure 5-1 Compression ratio of PMC-MR and combined

compression in Fuel Rate testing ............................................46 Figure 5-2 Total Space saved (compression ratio) by lossless

algorithm ..................................................................................46 Figure 5-3 Compression ratio of delta-of-delta encoding ......................... 47 Figure 5-4 Compression ratio of XOR encoding ...................................... 48 Figure 6-1 Software structure of the simulation ...................................... 50

Page 14: The Compression of IoT operational data time series in
Page 15: The Compression of IoT operational data time series in

List of Tables | xiii

List of Tables

Table 3-1 Data sample analysis ............................................................... 23 Table 4-1 Comparison of three lossy compression methods .................. 27 Table 4-2 Curve Fitting Parameters ......................................................... 36 Table 5-1 Example of Delta-of-delta values ............................................ 42 Table 5-2 The encoding of delta-of-delta................................................. 42 Table 5-3 The encoding of XOR coding ................................................... 43 Table 5-4 Test results of combined compression with LZ4 and

Snappy ......................................................................................44 Table 6-1 Results of Simulation ............................................................... 51

Page 16: The Compression of IoT operational data time series in
Page 17: The Compression of IoT operational data time series in

List of acronyms and abbreviations | xv

List of acronyms and abbreviations

3G 3rd Generation 4G 4th Generation CAN Controller Area Network DCT Discrete Cosine Transform DFT Discrete Fourier Transform DTCO Digital Tachograph ECU Electronic Control Unit ICT Information and Communication Technology ID identification IoT Internet of Things HEX hexadecimal HW hardware PCA Piecewise Constant Approximation PLA Piecewise Linear Approximation PMC-MR Poor Man’s Compression - MidRange PoC Product of Concept PPA Piecewise Polynomial Approximation RTC Road Traffic Communicator SW software XOR exclusive or

Page 18: The Compression of IoT operational data time series in
Page 19: The Compression of IoT operational data time series in

1

TmaT

spa

1

Winoaatrwo

(Endtrc

1 Introd

This Mastemanufacturand evaluatThings (IoT

This firpecific pro

and goals o

.1 Back

Within Scancludes fle

operationalas engine sanalysis anransmitted

wireless neoverview of

Figure 1

HoweveECUs) in t

network, thdata) cannransmitted

collected b

duction

er’s thesis rer locatedte a solutioT) system.

rst chapteroblem that f this thesi

kground

ania, the eet managel onboard speed, coolnd informd to a remetwork (suf this conce

1-1 Struc

er, due to tthe vehicle

he completnot be stod, but rathey the rem

project wd in Söderton for trans

r describesthis thesis

is project, a

vehicle Ioement and data (i.e., lant tempe

mation colote server

uch as a wept.

cture of a vehic

the limitede and the he set of onored or trer only stat

mote server

was conducrtälje, Swedsmitting ti

s the overs addressesand the str

oT platformvehicle codata withi

erature, anllection b(i.e., a ser

wide area

vehicularcle manuf

d amount ohigh cost

nboard operansmittedtistical datr is only

cted at Scaden. The gme series d

rall backgrs, the contructure of t

m is consnnectivityin the vehi

nd atmosphby the vehrver not lo

cellular n

r IoT systeacturer’s

of memoryof sending

erational dad. Today,ta is storedaggregated

ania AB, agoal of thidata from

round behext of the pthe thesis.

stantly evo[1]. In suchicle) includheric presshicle’s maocated withnetwork).

em commucomputer

y in the eleg data overata (i.e., th

the raw d and transd data. An

a commeris project ia vehicle’s

hind the pproblem, t

olving, buch an IoT ndes sensorsure. For fanufacturethin the veFigure 1-1

unicating r system

ectronic cor a wide ahe original

sensor dsmitted. Thn example

Introduction |

cial vehiclis to defin

s Internet o

project, ththe purpos

ut currentlnetwork, thr data, suchfurther dater, data iehicle) via1 shows a

with the

ontrol unitrea cellulatime serie

data is nohus the dat, shown i

1

le ne of

he se

ly he

h ta is a n

ts ar es ot ta n

Page 20: The Compression of IoT operational data time series in

2

Fsxhred

ma(eaFthruim

1

Csnhpdddpp

* th

| Introduction

Figure 1-2,creenshot

x-axis reprhours haveepresents

driven - spe

Figure 1-2

If the ramaintaininganalysts atespecially

analyses oFurthermorhe onboarunning in mproving t

.2 Prob

Currently, wervers in m

network. Uhas a high products, tdata, hencedata analysdata collectperformancproposing a

Scania Fleet hat is not ope

, shows a of the Scaesents diff

e been spetwo mont

ecifically th

2 An exa

aw time seg sufficient the vehi

concerninf this datre, offload

rd ECUs anthese ECU

the vehicle

blem

wide area wmost cases

Unfortunatecost when

the data tre it has limsis that canted and trace of the a compress

Managemen

en to public.

histogramania Fleet Mferent rangent operatths of opehe vehicle’s

ample of cinto inte

eries data nt precision

cle manufng temporata and th

ding this dand reduce Us, hence

e operators

wireless das uses a 3ely, such nn a huge aransmitted

mited size an be applieansmitted data tran

sion algorit

nt Portal (op

m of the cManagemeges of speting in theerational is speed.

current opervals of s

could be en) and tranfacturer wal informahus help ata analysithe develreducing

s’ user expe

ata transm3rd Generatnetworks oamount ofd from onband low reed to this dis necessa

nsfer. Thisthm for tim

erationalana

current opent Portal

eed, and the correspoinformatio

erational dpeed in km

efficiently nsmitted towould haveation); hento improvis is expecopment efthe cost o

erience.

mission fromtion (3G) ooffer limitef data is trboard to oesolution. Udata. Thereary; hence s thesis prme series d

alysis.scania.

perational website*. I

he y-axis ronding speon about h

data showm/h over t

compresseo the offboe access tnce they cve the vected to lighfforts requof software

m the onboor 4th Gened data ratransmittedoffboard isUnfortunatefore, incrthere is a

roject adddata.

com) is an in

data, in tIn the histrepresents eed rangeshow the v

wing speedtwo month

ed in the Eoard serverto more icould perfehicle’s pehten the wuired for the maintena

oard ECU neration (4ates, and thd. In Scanis stored as

ately, this rreasing thea need to imdresses th

nternal platfo

this case,togram, thhow man

s. The datvehicle wa

ds binnedhs

ECU (whilr, then datinformatioform betteerformance

workload ohe softwarance, whil

to offboar4G) cellulaheir servicia’s currens statisticarestricts the amount omprove this need b

orm in Scani

a he ny ta as

d

le ta n

er e. n

re le

d ar ce nt al

he of he by

ia

Page 21: The Compression of IoT operational data time series in

Introduction | 3

The project requires relevant knowledge from several fields including data compression, time series data analysis, embedded software systems, and software modeling & development. Such relevant background knowledge will be presented in Chapter 2.

The project seeks to answer the following question: Which compression algorithm should be applied to compress time series data with the best performance, and how to achieve it with the ECUs in vehicle systems? If no reasonable solution is found, then find the reason behind this and suggest potential improvements.

1.3 Purpose

The purpose of the thesis is to prove that an appropriate data compression algorithm exists and that this algorithm can be realized on the embedded systems (specifically ECUs) in vehicles. Alternatively, if no solution exists, then changes to the requirements will be suggested that could enable a solution. This project concerns the transmission of either the raw or filtered time series data. The expectation is that transferring more data with better quality is beneficial to both data analysts and software developers.

The purpose of the project is to give Scania a viable solution that would provide higher resolution data from onboard systems to their offboard server. The availability of this data is expected to lead to better data analytics and improvement in Scania’s IoT platform.

1.4 Goals

The goal of this project is to design, implement, and evaluate a solution for an efficient transfer of time series data. This goal has been divided into the following three subgoals:

1) A report with an analysis of whether a compression algorithm appropriate for the time series data produced by Scania’s IoT vehicle platform exists.

2) If a reasonable compression algorithm exists, then experimental tests should be made on the target embedded environment (i.e., realize the algorithm as embedded software). If the tests are unable to be implemented on the target control unit, then alternative methods should be considered to reach the same goal. The test results and analysis should also be included in the report.

3) Submission of the final thesis and final presentations delivered at both KTH Royal Institute of Technology and Scania.

Page 22: The Compression of IoT operational data time series in

4 | Introduction

1.5 Research Methodology

Quantitative research was conducted on the raw data, which is the object of the compression. This research is expected to help learn the inherent patterns in the data sets, which can be exploited to improve the compression algorithm. Additionally, evaluation of the results should be done in quantitative assessment from multiple aspects, which include:

1) compression ratio,

2) transmitted data resolution,

3) data quality after reconstruction,

4) encoding and decoding speed (time complexity), and

5) applicability.

Since compression of time series data was a new conception to the author, qualitative research was required to understand the background for such compression, the evolution of data compression algorithms for such data, and personal opinions of other individuals about compressing such data. It is also important to analyze what and how data matters in relevant works. Background information about compression of time series data will be given in Chapter 2, especially in Section 2.4.

1.6 Delimitations

The project focuses on a solution for the general case of time series data. The differences between data from different sources will be discussed for different scenarios in Section 3.2. However, solutions that work well only with some specific types of data but not with other data will not be explored further in this thesis project.

The project will mainly focus on the onboard side, where the ECUs execute the compression algorithm and transmit the data; instead of the offboard side, where the compressed data is received and decompressed. In other words, offboard performance and potential factors that may affect decompression performance will not be deeply discussed in this report. This limitation was introduced both to better focus this work and because the amount of computing that is available for the offboard process is only constrained by economics.

The feasibility of realizing the proposed solution on the current ECU will be discussed, including testing on the development environment (i.e., a Linux system on a virtual machine) and if possible release as a real software product. However, due to the complexity and variety of embedded systems, the analysis of efficiency and other aspects will be limited to the current version of a specific ECU.

Page 23: The Compression of IoT operational data time series in

Introduction | 5

The project assumes:

• The transmission protocol is unknown and will be decided by Scania. Hence the compression algorithm will be evaluated based upon reducing the data size when stored in memory.

• All the time series data will be in 2 dimensions – time and value.

• All data values constitute meaningful information. Thus removal of noise from the raw data is not considered.

• A cost analysis will not be included.

1.7 Structure of the thesis

Chapter 1 presents relevant background information about IoT, vehicle fleet management, data compression, and discusses related work. Chapter 2 should help readers understanding the background necessary to read the rest of the thesis.

Chapter 3 presents the methodology and method used to collect sample data and perform analysis of this data. The aim is an evaluation of the research results.

Chapters 4 and 5 introduce the selection of algorithms, experiments, analysis, and conclusions regarding both lossy and lossless compression algorithms.

Chapter 6 discusses the testing and implementation of the selected algorithms, introduces the software algorithms, the system’s structure, and module functions.

Chapter 7 analyses the results, gives an explanation of the results and discusses the reliability and validity of the results, and states the conclusions of the project, discusses its limitations, offers reflections, and suggests future work.

Page 24: The Compression of IoT operational data time series in
Page 25: The Compression of IoT operational data time series in

2

Tda

2

Tinthinsinp

2

Fmo

cbA

si

2 Backg

This chaptedata comprand related

2.1 Auto

The concepncluding vhat can benterfaces wensors, ann areas, s

project focu

2.1.1 Fle

Fleet manmanagemenof Scania’s f

Fig

There aconnected wbraking conArea Netwo

CAN buignals amo

ground

er provideression. Add work on t

omotive Io

pt of IoT vehicles, elee connectewith the p

nd actuatoruch as sm

uses on veh

eet manage

nagement nt, vehicle fleet mana

ure 2-1 N

are roughlywith sensontrol unit, ork (CAN)

us is a comong ECUs

es basic badditionally,ime series

oT

mostly cectrical aped via netphysical wors. The momart homehicle mana

ment and A

includes tracking, v

agement sy

Network S

y 20 ECU ors and actu

etc. Todaybus.

mmunicatioand other

ackground, this chaptdata comp

concerns tppliances, etworks, comorld. Typi

ost commoes, remoteagement.

Automotive I

functionsvehicle dia

ystem is sh

Structure o

systems ouators. Thy, all of th

on protocolr devices. I

d informatiter describpression in

the networetc. The wommunicatcal examp

on and proe health, a

IoT

such asagnostics, eown in Fig

of Scania

onboard ahese ECUs

ese ECUs

l widely usIn a CAN n

ion about bes the objen various fi

rk connecord “thingse with oth

ples includmising IoT

and vehicl

s driver etc. An ovegure 2-1.

Fleet Man

a vehicle, winclude thcommunic

sed in vehinetwork, al

automotivective of coields.

ctivity of s” refers toher compo

de embeddT applicatile manage

managemerview of th

nagement

which inclhe engine ccate over a

icles. CAN ll the node

Background |

ve IoT anompression

electronicso any entitonents, anded devicesions appea

ement. Thi

ent, speehe structur

IoT

ludes ECUontrol unit

a Controlle

broadcastes (devices

7

d n

s, ty d s, ar is

d re

Us t,

er

ts s)

Page 26: The Compression of IoT operational data time series in

8 | Background

have a unique identification (ID), which also encodes their priority level, with the numerically smallest ID assigned to the most critical node. When multiple nodes attempt to transmit at the same time, the node with the highest priority will access the CAN bus, while the others wait. This property gives CAN excellent real-time performance.

In a Scania vehicle, there is a Road Traffic Communicator (RTC) ECU that sends aggregated operational data from various sources via a mobile network (such as a wide area cellular telecommunications network).

2.1.2 Operational time series data

The operational data from onboard is currently available offboard in two formats: CAN-based and Diagnose-based. The CAN-based data is sent by the RTC via a mobile network, while the diagnose-based data is stored internally. The diagnose-based data can be either data from CAN signals or internal variables stored in ECU systems. In this thesis, the CAN-based operational data is the source of the time series data that will be compressed and communicated.

Today, to implement and improve Scania’s IoT infrastructure, operational data is needed by data analysts. However, in the current situation, the majority of the data processing occurs onboard, with only statistical data sent to an offboard server. This approach to data analysis makes the processing of data difficult and reduces the resolution in time and values for data analysis. It is desirable to deliver raw data directly from onboard systems to the offboard server, so that data analysts have the data that they want, and to reduce the resources consumed by doing the statistical processing and storage onboard. However, the aggregate amount of raw data can be very large. Hence processing and storage can require a lot of resources. Furthermore, the amount of data makes its transmission through a 3G network expensive and time-consuming.

Sources of data can be sensors, tachograph, radar, etc. The format of most of this raw data is as a time series data containing timestamps and values (as a two-dimensional array). Timestamps are represented as integer numbers, while values are mostly float-point numbers, whose properties depend on the source of data.

Figure 2-2 shows an example of the raw data in the form of a sampled analog signal, in this case, the measurement of the vehicle’s speed.

Page 27: The Compression of IoT operational data time series in

tie

2

Sstp

2

FTcCcBd

Figure 2

Howeveime inform

example wa

2.2 HW

Since the thtructure o

platform.

2.2.1 HW

Figure 2-3 sThe C300 coordinatorCAN-basedconnected wBluetooth (different m

2-2 Exam

er, when opmation is as shown in

and SW s

hesis is basof the har

W structure o

shows the is connec

r (COO) thd time serwith wirele(indicated

methods to c

mple of raw

perational discarded

n Figure 1-

tructure o

sed on a prrdware (H

of a CAN ne

simplified cted to a Ghat coordinries data)ess commuas BT in t

communic

w time se

data is prod. An exam-2.

of the IoT p

roduct thatHW) and s

etwork

d network sGPS modunates signon other

unication mthe figure)

cate with th

ries data,

ocessed in mple of th

platform

t is in use, software (

surroundinule, digital

nals from oCAN bus

modules, su). These cohe offboard

in this cas

the onboahe aggrega

it is essen(SW) com

ng a RTC El tachograother ECUses. Additiuch as Wi-

ommunicatd server.

se, vehicl

ard ECUs, ated opera

ntial to knomprising Sc

ECU called aph (DTCOUs (the sou

ionally, th-Fi, GSM/3tion modu

Background |

e speed

most of thational dat

ow the basicania’s IoT

RTC-C300O), and thurces of thhe C300 i3G/4G, an

ules provid

| 9

he ta

ic T

0. he he is d

de

Page 28: The Compression of IoT operational data time series in

10

2

Tti6d(fpp

vwore

Tth

0 | Background

2.2.2 The

The currentime or eve

6. At every data by a nefor speed,

packaged aportal).

This datvehicle andweb portal.other ECUsemote serv

StudyinThus, at thehe followin

• Wha

• How

Figure 2-3

e SW struct

t version oent trigger.update, thew value (ftemperatu

and sent to

ta can be ud driver for. The procs. In other ver.

g the datae beginninng question

at is the int

w is the data

3 Simplif

ture on RTC

of C300 sof. The detai

he softwarefor data suure, and po the Scan

used to pror security pessing of twords, the

a flow witng of the thns:

teresting CA

a sent to th

fied CAN

C-C300

ftware storils of the de updates tuch as fuel pressure mnia Fleet M

ovide an apurposes, bthis data de RTC-C30

thin the chesis proje

CAN-based

he web por

network re

res most dadifferent trthe data eitconsumpti

measuremenManagemen

application based upo

does not oc00 mainly c

current sofect, a case

data?

rtal (i.e., wh

elated to R

ata as a siniggers are ther simplyion) or by nts). After nt Portal (S

that monin relevantccur on thcollects dat

ftware appstudy was

hat protoc

RTC-C300

ngle value, describedy by replacupdating athe updat

Scania’s in

itors the stt data sent he C300 buta and sen

plication iconducted

col is used)

0

updated b in Chaptecing the ola histogramte, data arnternal web

tatus of thto Scania’

ut rather ids data to

s essentiad to answe

?

by er d

m re b

he ’s n a

al. er

Page 29: The Compression of IoT operational data time series in

Background | 11

The case study was based on documentation, interviews, and code reviews. This case study revealed that the data send over the wireless interface was sent in a packet which includes positioning data, the total gas used, total distance, etc. This data packet is sent either upon a time scheduled trigger (which can be set by a report setting sent from the offboard server) or event triggers (such as change of driver, change of ignition conditions, harsh braking, etc.).

The data is managed either in the form of a single current value, e.g., odometer or in the form of a histogram; for example, the engine speed or vehicle speed. The histogram is transformed into a string, showing how the buckets and the values in the buckets are managed. The size of the histogram is equivalent to only a few data points. For every data point, the timestamp is a 32-bit integer, while the value is a 64-bit double-precision floating-point number. Thus each data point is 96 bits of raw information.

In the latest version of the C300 SW, up to 85 different signals are sent. Of which the most interesting data are those accumulated data, such as total fuel consumption, maximum vehicle speed, and maximum engine speed. In total, 23 triggers are set for sending these messages. All of the data is managed by using Google Protocol Buffers [2], which provides great flexibility regarding varying the size of the transmitted data.

2.3 Compression Algorithms

Compression algorithms for data can be classified into two types: lossless compression and lossy compression. It is easy to understand from the name that lossless compression involves no data loss, while lossy compression results in some loss of data. However, the maximum compression ratio* that lossless compression can achieve is limited.

2.3.1 Lossless Algorithms

Lossless algorithms are widely used in scenarios such as text file compression, image compression and numeral data storage when full reconstruction is more important than the compression ratio. Popular lossless compressions include Huffman Compression, LZ4, and arithmetic coding [3].

In all of the lossless algorithms, the idea is to extract a pattern from the data, giving greater compression to the most frequently appearing patterns, so that the total size shrinks while no information is lost. As a result, the original data can be fully reconstructed.

* In the thesis, we mainly consider space saving, hence the compression ratio = (original data size – compressed data size)/original data size. The reason for adopting this definition will be explained in Section 4.2.

Page 30: The Compression of IoT operational data time series in

12 | Background

In textual compression, the algorithms compute the frequencies of different strings of characters. However, when the compressed object is numerical time series data, the variety of data values makes it difficult to use a textual compression algorithm. In this situation, a more popular compression method called data difference is used. For example, in a technique called delta encoding, the first data value is kept while the differences between the following neighboring data samples are encoded, instead of encoding their original values. Another algorithm based on delta encoding is called delta-of-delta encoding. This algorithm is used in Facebook’s time series database called Gorilla [4]. In a blog [5], Peter Zaitsev and Vadim Tkachenko evaluated various lossless database compression methods, including LZ4, Snappy (a fast compressor developed by Google [6] which is promising for an application in a portable product), and Zstandard (a real-time compression algorithm from Facebook [7], with a good compression speed and relatively higher compression ratio).

Although lossless algorithms promise full reconstruction, their compression ratios are limited; typically below 70%. Unfortunately, this limited compression ratio is a severe drawback in the context of the vehicle data that this thesis is concerned with.

2.3.2 Lossy Algorithms

In lossy algorithms, the reconstructed data loses information compared with the original data. As a result, after application of a lossy compression algorithm, the original data cannot be reconstructed from the compressed data. However, this does not mean reconstructed data are of low quality. A good lossy algorithm retains the essential information while dropping the relatively useless information, for example, noise. Many noise filters can also be applied as lossy algorithms since they reduce the total amount of data while keeping or even increasing data quality by reducing the noise.

In a lossy algorithm, there are two critical concepts: scalar quantization and vector quantization. Quantization refers to the generation of subsets of a large data set. Thus multiple data points map to the same subset, thus reducing the number of distinct points in the data space. Scalar quantization maps data into different value regions. For example, abandoning the lower bit of an 8-bit integer reduces the resolution; but reduces the amount of data by 1/8 (i.e., 12.5% space saved). In the case of time series data, scalar quantization usually results in the loss of time resolution.

In contrast, vector quantization maps multidimensional data into datasets with lower dimension(s). In this case, data correlated in multiple dimensions can be highly compressed. When no significant correlation between the two dimensions of time and value exists, then scalar quantization works better than vector quantization when compressing time series data. However, quantization needs

Page 31: The Compression of IoT operational data time series in

Background | 13

information prior to executing the algorithm. Thus a quantization scheme suitable for one data source might be unsuitable for another data source.

Transform coding is another popular class of lossy compression algorithms. This class includes discrete cosine transform (DCT), discrete Fourier transform (DFT), and wavelet transformations. The idea is to transform the data into a domain where it is easier to compress. Transform algorithms usually work with time-based data, giving a set of coefficients as output. Unfortunately, both DCT and DFT assume that the signal to be compressed is an infinite periodic function. Thus they are unsuitable for time series data that varies at different time intervals. In contrast, DCT and DFT are widely employed in image coding. An alternative algorithm is the wavelet transform. Wavelet transforms are commonly applied in the real world; for example, they are utilized in the image viewing plugin in Microsoft’s Internet Explorer and Fuji digital cameras [3]. In addition to playing an important role in signal filtering, Chebyshev filtering is also a popular algorithm to apply to time series data to achieve compression.

Piecewise approximation is also a popular time series compression method. This method breaks time series data into segments and then approximates the time segment in a form that can shrink the size of the encoding for this segment, thus implementing compression. Piecewise approximation can be classified into piecewise constant approximation (PCA), piecewise linear approximation (PLA), and piecewise polynomial approximation (PPA). This classification is based on the algorithm used when a time series segment is approximated. The common problems that piecewise approximations encounter are the trade-off between accuracy and compression ratio [8].

2.4 Related work

For time series data compression, many existing works can be found regarding each of the different methods and their application in different areas. Some example applications and the performance of different algorithms will be discussed in the following subsections.

2.4.1 Lossless compression of time series data

There are many (both lossless and lossy) algorithms for the compression of time series data. When compressing data for storage in a real-time database, lossless algorithms are preferred because of the requirement that full reconstruction is more important than a high compression ratio. Differential encoding is used in several time series databases, such as Gorilla [4]. In this case, an XOR algorithm and delta-of-delta encoding are applied to the 64-bit floating-point values and 32-bit timestamp integers respectively. This compression algorithm enables compress of 16 bytes into 1.37 bytes, thus offering a compression ratio of ~91%.

Page 32: The Compression of IoT operational data time series in

14 | Background

An online article by Julien Danjou compared a time-series database called Gnocchi [9] with LZ4 and XOR compression from Gorilla. The result was that XOR has a better compression performance, but a higher computation cost; while LZ4 is faster for compression and decompression, but results in a lower compression ratio.

A time series database call Akumili introduced a compression technique for time-series data called middle-out compression [10p. 1], and the source code is available in [11]. The algorithm uses XOR as the main method of compression, but improves execution time performance by dividing the data series into multiple blocks and processes the data from different time offsets by using single instruction multiple data (SIMD) instructions. This compression only works on values without timestamps. Eugene Lazin, the author of Akumili, compared the algorithm with Gorilla’s compression. While Gorilla offers a slightly better compression ratio for floating-point numbers, Akumili performs significantly better in the case of fixed decimal numbers, achieving a compression ratio of 69.7%, compared to Gorilla’s 45.7%. Additionally, middle-out compression promises high speed, a highly desirable attribute for a database. The compression performance of Gorilla in his paper shows a huge difference from the results from the earlier article about Gorilla [4], due to unknown reasons.

Peter Zaitsev and Vadim Tkachenko [5] evaluated common lossless database compression algorithms regarding compression speed, compression ratio, and other relevant factors. They recommend LZ4 and Snappy because of their fast compress/decompress speed and decent compression ratio, both of which are essential when deploying a compression algorithm in an embedded system.

Although lossless compression might seem unsuitable in our case because of its low compression ratio, this form of compression is interesting for data stored either in the offboard server or onboard storage when sufficient space is available. In both cases, the resulting data offers higher temporal and value (space) resolution in comparison with data following a lossy compression algorithm.

2.4.2 Lossy compression of time series data

Lossy compression is commonly applied for time series data compression. Piecewise approximation, Fourier transforms, Chebyshev polynomials, and wavelet transform algorithms have all found a broad range of applications in compression. Among these, piecewise approximation is the most popular approach.

A time-series data compression algorithm based on Chebyshev polynomials has been put forward for use in data transmission from spacecraft to Earth stations [12]. Compared with lossless compression, this approach can efficiently compress data streams by more than 50%. Moreover, this algorithm’s performance is determined by the data buffer’s size, the threshold to restrain specific coefficients, and the number of quantization bits. The original Chebyshev compression algorithm requires a fixed data block size, which limits its applications

Page 33: The Compression of IoT operational data time series in

Background | 15

in real practice; hence in [13], a lossy compression algorithm is introduced with an optimization of the Chebyshev algorithm that can be applied with dynamically selected block sizes.

As noted above piecewise approximation is widely used in time series data compression. Piecewise approximation seems to be the most promising algorithm for time series, due to its real-time property. The basic idea of piecewise approximation is to break a data series into several segments, then use an approximation to transform a segment into a smaller size. A well-known PCA algorithm is Poor Man’s Compression (PMC) [14], which outputs a constant value for every segment within a given error bound defined as the limit of the absolute value the difference between the original data and the approximation [15]. PMC can be classified into either calculating the mean value, referred to as poor man’s compression – mean (PMC-mean) or the median value, referred to as poor man’s compression – midrange (PMC-MR). In [16], PCA is applied with a resolution guarantee. This same paper states that when the signal includes frequent fluctuations and dramatic transitions, PCA performs better than PLA.

Two PLA methods with filtering functions (swing filter and slide filter) are introduced in [17]. They both utilize a given maximum error bound. A slide filter has a better compression ratio than a swing filter, but with greater space complexity and time complexity. In [18], an algorithm based on PLA with a guarantee of maximum error called mixed-PLA is introduced, and proven to have better performance than swing filter, swing filter, and cont-PLA (see [19]). The mixed-PLA algorithm turned out to have the best compression ratio among these four algorithms.

In more complicated cases, research on the time series data compression has been applied to a smart grid application [20] using piecewise polynomial regression of higher orders. This same paper also discussed that Fourier transform or wavelet transform has no guaranteed compression ratio, and thus the paper introduced a dynamic algorithm that selects the best of piecewise constant, linear, and polynomial algorithm’s output for every segment.

2.5 Summary

This chapter introduced basic information about automotive IoT. The target system’s communication is based on CAN signals and the current version of Scania’s applications. A case study of Scania’s application has been done, in which Google protocol buffers are used as the protocol when sending data to the offboard server, which can send a data stream with a flexible size.

The comparison between lossless and lossy algorithms can be summarized as follows:

Page 34: The Compression of IoT operational data time series in

16 | Background

• The compression ratio of a lossless algorithm is limited, while a lossy algorithm can have a high compression ratio. Unfortunately, the cost of a higher compression ratio is usually a higher data loss rate.

• Lossless algorithms generally are used in text compression, where a single loss of information matters a lot. In contrast, for time series data, a lossless algorithm is often applied to time series data. For example, lossy compression is popular in the cases of audio, image, and numeral data compression, especially in real-time data transmission scenarios.

Since lossless compression and lossy compression are suitable for different situations, it is possible to combine the two kinds of algorithms without disturbing each other, e.g., using a lossy compression algorithm as a filter, to greatly decrease the amount of data, followed by applying lossless compression to further decrease the amount of data that needs to be transmitted. Figure 2-4 shows the basic concept of implementing such a series of compressions.

Valu

e

Time

Valu

e

Time

LossyCompression

LosslessCompressionVa

lue

Time

Valu

e

Time

010010011101010010011110010010011111010010100000

...

Uncompressed Time Series Data Compressed Time Series Data

Compressed Data String

Figure 2-4 Basic concept of combing compression algorithms

Figure 2-5 summarizes the relationships between the different data compression algorithms and compares them.

Page 35: The Compression of IoT operational data time series in

Background | 1

Figu

re 2

-5

Sum

mar

y of

Dat

a C

ompr

essi

on A

lgor

ithm

s

17

Page 36: The Compression of IoT operational data time series in
Page 37: The Compression of IoT operational data time series in

Onboard Time Series Data Analysis | 19

3 Onboard Time Series Data Analysis

The purpose of this chapter is to provide an overview of the research process utilized in this thesis project. The chapter also gives an analysis of the onboard time series data, helping to provide a better understanding of the properties of the CAN-based data.

3.1 Research Process

Figure 3-1 shows the steps conducted to carry out this research.

Information gathering

(Qualitative research)

Clear goals and requirements

Algorithmsearch & selection

Input data analysis

ExperimentsResultAnalysis

Evaluation and potential

improvements

Figure 3-1 Research Process

The first step was information gathering regarding data compression and vehicle IoT. This first step gave an overview of the project’s background. Next, the goals and requirements of the project were determined. More specifically, an analysis of a sample of time series data as input to the compression algorithm was carried out. The results of this analysis helped in the selection of appropriate algorithms. Following this, experiments were designed, carried out, and the results examined. As potential improvements existed, the research continued with iterative studies of the candidate compression algorithms, as shown in Figure 3-1.

Page 38: The Compression of IoT operational data time series in

20

3

Arath

es

va

cthMc

0 | Onboard Time

3.2 Ana

An initial sandom vehhis data in

An examexperimentegment wi

Among values fromalgorithms.

Fuel RatEngine SVehicle SOdomete

There arcollected frhey are of

Managemencooperation

e Series Data Ana

lysis of Da

set of datahicle. Thes this degre

mple of a Cts, raw dataith a durati

the huge m four dat. These fou

te Speed Speed er

re many reom a test df interest int Protocon with an

lysis

ata Sampl

a samplesse samplesee project w

CAN-based a in numerion of over

Figure 3

amount ota sourcesur sources w

The fuel vEngine rotThe speedDistance t

easons to sdrive at Scin the vehol. Third, external co

les

s were obts are actuawas approv

signal log ral format r 5000 seco

3-2 Exam

of CAN mewere incl

were:

volume contation spee

d of the vehtraveled by

select thesecania, whichicle indust

Scania haompany to

tained fromal operationved by Scan

is shown iis retrieveonds.

mple of a C

essages in uded in th

nsumed by ed in revolhicle in kiloy a vehicle i

e data fromch promisetry and arad a prooo achieve t

m Scania nal CAN lonia.

in Figure 3d from the

CAN log

the CAN he analysis

an engine utions per

ometer/houin kilomete

m the CAN d relevancre includedof of concethe same g

for a test og data. Th

3-2. For the CAN log f

log, timess of the co

in Liter/hr minute (Rur ers

log. First, ce of the dad in the Sept (PoC) goal as in

drive of he usage o

e algorithmfrom a tim

stamps anompressio

our RPM)

they are alata. SecondScania Flee

project ithis thesis

a of

m me

d n

ll d, et n s.

Page 39: The Compression of IoT operational data time series in

Onboard Time Series Data Analysis | 21

Hence it is good to use them so that Scania can compare the results of this thesis project with the PoC project*.

Plots of these time series samples are shown in Figure 3-3. From the figure, it is easy to see that all the data refer to a drive with two stages: from the start to about the 18th second, the vehicle is not moving, shown in the zero values of vehicle speed and the constant odometer value; after that, the vehicle started to move with a varying speed.

Properties of the four types of data samples are summarized in Table 3-1. Information such as unit, resolution, and data type are collected from the general CAN bus settings, while amount, maximum and minimum values are collected from this specific CAN log. From the table and figure, it is obvious that the four types of data samples differ in many aspects, as will be discussed in Sections 3.2.1 and 3.2.2. The comparison between these data samples is good for testing how the performance of compression algorithms varies between the different data sources.

* In keeping with Scania’s privacy policy, further information about this PoC project will not be presented in this thesis.

Page 40: The Compression of IoT operational data time series in

22 | Onboard Time Series Data Analysis

(a) Fuel rate (b) Engine Speed

(c) Vehicle Speed (d) Odometer

Figure 3-3 CAN-based time series data

0

20

40

60

80

100

0.00

7.13

14.2

621

.38

28.5

135

.64

42.7

749

.90

57.0

364

.15

71.2

878

.41

85.5

4Fuea

l Rat

e (L

iter/

hour

)

Time(min)

0

500

1000

1500

2000

0.00

6.66

13.3

219

.97

26.6

333

.29

39.9

546

.60

53.2

659

.92

66.5

873

.24

79.8

986

.55

RPM

Time(min)

0

20

40

60

80

100

0.00

6.19

12.3

718

.56

24.7

530

.93

37.1

243

.31

49.4

955

.68

61.8

768

.05

74.2

480

.43

86.6

1

Spee

d(km

/h)

Time(min)

23840

23860

23880

23900

23920

23940

0.00

7.05

14.1

021

.15

28.2

035

.25

42.3

049

.35

56.4

063

.45

70.5

077

.55

84.6

0

Kilo

met

er

Time(min)

Page 41: The Compression of IoT operational data time series in

Onboard Time Series Data Analysis | 23

Table 3-1 Data sample analysis

Data Amount of Data Points

Max Min Mean Range Resolution Unit

Time Interval

Data Type Mean (ms)

Max Min

(ms) (ms)

Fuel Rate 55601 88.6 0 12.863 88.6 0.05 liter/hour 99.998 266 33 Double

Engine Speed 279627 1744.3 132 1016.6 1612.3 0.125 RPM 19.9996 191 4 Double

Vehicle Speed 55675 90.977 0 55.44 90.977 ~0.0039 km/h 99.998 247 32 Double

Odometer 5497 23932 23847 23880 85 0.005 km 999.9731 1025 975 Double

Page 42: The Compression of IoT operational data time series in

Onboard Time Series Data Analysis | 24

3.2.1 Similarities in CAN signal samples

From the four examples of different types of data, it is easy to conclude that they all have the following properties:

• The value of time-series data is all numeric (64-bit floating point data), i.e., none of these values are text or characters. The timestamps of data samples are all presented as 32-bit integers. The compression algorithm will always have such data as input.

• Data are not strictly periodic. However, ignoring small changes in the time intervals, the CAN data are always be broadcasted on the CAN bus with fix periods.

• All time-series data values are 1-dimensional values, i.e., there is a single value for each timestamp.

These properties help in the selection of the compression algorithms that applied specifically for a certain type of data, which is discussed in later chapters.

3.2.2 Differences in CAN signal samples

There are differences between these different types of data that can affect the performance of different compression algorithms:

• Sampling frequencies differ between the data sources. The sampling period of each of these four sources are fixed and cannot be adjusted.

• Signals are not evenly spaced on the CAN bus, because although sensor data are sampled periodically, the transmission time on the CAN bus is affected by the CAN signaling; for example, the priorities of the different source ECUs.

• Signals differ in minimum value, maximum value, and value range.

• Fluctuations with time vary between the different data sources. Fuel rate and Engine Speed signals are the noisiest signals, while the odometer signal is smooth and always monotonically increasing.

In the following chapters, different experiments will be performed with these four different types of data samples, to test the applicability of the compression methods and to understand how different types of data samples will affect the compression performance.

Page 43: The Compression of IoT operational data time series in

Lossy Compression Algorithm Research | 25

4 Lossy Compression Algorithm Research

As discussed in Section 2.3, lossless compression does not provide a high compression ratio for the type of time series data that we are concerned with, while lossy compression easily reaches a high compression ratio. Thus, lossy compression was initially considered to compress the raw time series data. Since lossy compression encompasses a broad range of methods, in this chapter, the selection of lossy compression algorithms and their design, results, and analysis of the experiments comparing several selected algorithms will be presented.

4.1 Algorithm Comparison and Selection

According to the literature study in Section 2.3, common time series data compression using lossy compression algorithms fall into three main categories: quantization, orthogonal transformations, and piecewise approximations. This section separately discusses these three categories, whether they are suitable for the time series data that we are concerned with, and the reasons behind this suitability or lack thereof. The definition of each category can be found in Section 2.3.

4.1.1 Quantization

Due to the lack of correlation between time and value in time series data, the quantization of time series signals will focus on scalar quantization rather than vector quantization.

Scalar quantization is easy to realize in software, and its compression performance regarding compression ratio and reconstructive quality is also controllable. By adjusting the discrete grids, the introduced error can be controlled within a specific range. Another advantage of quantization is that, since the values of data points have been relocated into different preset sets, all the sets can be represented in the form of codewords with minimal size by using one of many encoding methods, for example, Huffman encoding. However, for every data source, the quantization resolution needs to be determined and provided as a preset configuration to the compression algorithm that is to be used.

As for the timestamps, time information can either be entirely kept or flexibly resampled to a lower frequency. To achieve a high compression ratio, the better way is to lower the sampling frequency. However, this does not suit the purpose of this thesis: to preserve the time information as much as possible. Also, when lowering the sampling frequency, the error introduced in values cannot be controlled within a specific range.

4.1.2 Orthogonal Transformations

Transform transformations compress data by transforming and abandoning unneeded components. The advantage of orthogonal transformations is that it

Page 44: The Compression of IoT operational data time series in

26 | Lossy Compression Algorithm Research

could also be used as a filter to improve the raw data quality, mostly by smoothing it.

However, in transformation compression, a strictly periodic property is needed for the use of DFT and DCT. Unfortunately, this is not applicable in the current scenario, as was stated earlier in Section 3.2 (since the time series data are not periodic). In wavelet compression, it is hard to bound the amount of data loss. These two types of limitations are the biggest drawbacks of orthogonal transformations.

4.1.3 Piecewise Approximations

Most of the piecewise approximation methods work online. For every update (i.e., when a new data point arrives), the algorithm checks if the current approximation can meet the requirement of remaining within a given error bound. If not, the algorithm will store the current approximation and start a new segment for a new approximation. This means the update of the compression can be terminated at any time.

Different piecewise approximations can be made of a given set of data with varying methods of approximation and the required error bound. The output of piecewise approximation maintain the same form as the input. Thus it is also time series data but now a series of coefficients for the piecewise approximation, rather than the data values. If the compression is using linear approximations, the outputs can be still the time series data points which indicate the starting point and end point of each linear approximation. This provides the possibility to combine piecewise approximations with other time series database compression methods to further improve the compression.

4.1.4 Conclusion

Table 4-1 summarizes the previous discussions. This table lists both the requirements and the compression methods, with “ ” indicating that the method can meet the requirements of this project, while “” indicates that it cannot.

Page 45: The Compression of IoT operational data time series in

Lossy Compression Algorithm Research | 27

Table 4-1 Comparison of three lossy compression methods

High and

controllable

compression

ratio

Real-time

update

Maximum

error control

Data

sampled in

varying

periods

Easy data

personalization

with different

value range

Transform

coding

Quantization

Piecewise

approximation

Piecewise approximation best suits the project’s needs. Thus, the final choice of the compression method is piecewise approximation. In this method, the compression performance is usually determined by a given error bound which also restricts the introduced error. According to the literature study in Section 2.3.2, for most of the piecewise approximation algorithms, the reconstructed data quality is quite similar given the same error bound. For these reasons, in the rest of the thesis we consider PCA and PLA. Moreover, given that the onboard ECUs have limited memory, we consider three candidate algorithms: PMC-MR, swing filter, and mixed-PLA.

4.2 Experimental design

The algorithms were tested in an environment which facilitated simulations and calculations, to compare the different algorithms. The following subsections describe this test environment and the experiments.

The purpose of these experiments was mainly the following:

a) To see the performance of the different compression methods,

b) To compare the performances of three different compression methods,

c) To examine the relationship between the given error bounds and performances, and

d) To see if different data types affect the compression performance.

Page 46: The Compression of IoT operational data time series in

28 | Lossy Compression Algorithm Research

4.2.1 Test environment

Testing of the algorithms was done on a computer running a 64-bit Microsoft Windows 10 operating system with 16 GB RAM1. The processor is Intel Core i7-6700 @ 3.40GHz.

Since no open source code for these algorithms was available, the algorithms were programmed in C++ by the author. When implementing mixed-PLA in C++, Ge Luo, the first author of paper [18] provided the source code of algorithm that has been used in their experiments. The code to implement PMC-MR and Swing filter can be found in Appendices A and B.

4.2.2 Experiment input

The experiment tested samples of four types of data (as described in Section 3.2) with a varying maximum error bound from ranging 0.1% to 10% of the data’s actual range (within the set of data samples that were used for testing) range with a step size of 0.1%. The inputs are first read into memory and stored in a buffer. Subsequently, the data was read by the compression function, for every update only one data point is retrieved from the buffer. Once an update is computed, the next update was made immediately, until the end of the input array was reached.

4.2.3 Experiment measurements

The performance of a lossless compression algorithm is usually judged upon the following aspects: runtime of compression, space saved by compression algorithm (compression ratio), and usability. The usability refers to the ability of an algorithm to have good performances on different types of data. Lossy compression can be evaluated in these same terms and additionally reconstructive quality.

The output of the experiments will give the compression ratio, the runtime of each test, and the maximum error between the original data and the reconstructed data (i.e., following decompression). Overall the time series contains four types of events as shown in Table 3-1.

In our test, the compression ratio is defined as:

Compression ratio = (data_sizeoriginal – data_sizecompressed) / data_sizeoriginal

This compression ratio is the percentage of space saved by the algorithm. There are multiple reasons to select this definition, instead of the other popular used definition used with many database compression methods, which is to calculate the ratio between the original data size and the compressed size. First, Scania does not have an existing transmission size without compression. Second, it is easier to see

1 As we are only concerned with the compression ratio and the relative comparison of the runtime between algorithms, details of the processor (such clock speed) are not relevant. Moreover, these testing was not done on the target ECU platform.

Page 47: The Compression of IoT operational data time series in

Lossy Compression Algorithm Research | 29

the absolute size reduction through the space saved, with also helps to calculate the economic cost reduction of the data transmission via GSM/3G/4G. Third, a Scania PoC project tried a data compression service provided by an external provider, and the existing analysis in this PoC project uses the definition that we have used. This enables Scania to easily compare the results of this project with their PoC project.

In the PoC project, Scania suggested that a compression ratio that can reach 90%, or even over 95% would be acceptable.

4.3 Reliability and validity

To ensure the experiments give exactly the type of results we want, the data collection validity needs to be discussed.

First, the validity can be guaranteed by strictly controling variables. In this experiment, the varying error bound is the independent variable, while the dependent variables are the compression ratio, runtime, and compressed data quality. Apart from these variables, the content and length of the input data series should always be the same in the same group of experiments. Similarly, when the input data source becomes the dependent variable, the error bound should be fixed.

Another critical requirement to guarantee validity is that the algorithms are correctly programmed. To ensure this, the output from the algorithm is compared with the performance in the original article. The results of testing will be visualized by plots to highlight that the results follow the trend of the input series.

The reliability of the experiments can be guaranteed by testing the algorithms with different data inputs, to ensure that the function works with different types of inputs.

4.4 Algorithm Test Results & Analysis

Results are gathered for the three algorithms, four different types of data sources, and different error bounds. The discussion in this section will be structured into comparisons between the algorithms for the different types of data.

4.4.1 Runtime Performances

Figure 4-1 to Figure 4-4 show runtime as a function of increasing error bound for fuel rate, engine speed, vehicle speed, and odometer data sources (respectively).

Runtime is defined as the average time spent on a single data point. It is calculated by measuring the runtime of processing the whole data series and dividing the total runtime by the number of data points. Note in this testing the time series data is not simulated as a CAN signal according to the timestamps of the values. Instead the algorithms process a single data point and immediately read the next data point. Thus, the runtime here exactly reflects only time is needed for the algorithm to run on the sequence of data values.

Page 48: The Compression of IoT operational data time series in

30 | Lossy Compression Algorithm Research

Figure 4-1 Runtime results from Fuel Rate test

Figure 4-2 Runtime results from Engine Speed test

y = 0.001x + 2.3623R² = 0.0696

y = -1.0813x + 405.55R² = 0.8753

y = 0.2308x + 98.812R² = 0.5886

0

50

100

150

200

250

300

350

400

450

0.1%

0.4%

0.7%

1.0%

1.3%

1.6%

1.9%

2.2%

2.5%

2.8%

3.1%

3.4%

3.7%

4.0%

4.3%

4.6%

4.9%

5.2%

5.5%

5.8%

6.1%

6.4%

6.7%

7.0%

7.3%

7.6%

7.9%

8.2%

8.5%

8.8%

9.1%

9.4%

9.7%

10.0

%

Runt

ime(

us)

error bound

PMC-MR swing filter mixed-PLA

Linear (PMC-MR) Linear (swing filter) Linear (mixed-PLA)

y = -0.00008x + 2.2023R² = 0.0096

y = 242.98x-0.235

R² = 0.8402

y = 0.0203x + 90.269R² = 0.0346

0

50

100

150

200

250

300

350

400

0.1%

0.4%

0.7%

1.0%

1.3%

1.6%

1.9%

2.2%

2.5%

2.8%

3.1%

3.4%

3.7%

4.0%

4.3%

4.6%

4.9%

5.2%

5.5%

5.8%

6.1%

6.4%

6.7%

7.0%

7.3%

7.6%

7.9%

8.2%

8.5%

8.8%

9.1%

9.4%

9.7%

10.0

%

Runt

ime

(us)

Error Bound

PMC-MR swing filter mixed-PLA

Linear (PMC-MR) Power (swing filter) Linear (mixed-PLA)

Page 49: The Compression of IoT operational data time series in

Lossy Compression Algorithm Research | 31

Figure 4-3 Runtime results from Vehicle Speed test

Figure 4-4 Runtime results from Odometer test

y = 0.0005x + 2.3514R² = 0.2843

y = -1.2109x + 350.3R² = 0.8559

y = -0.0413x + 106.78R² = 0.1058

0

50

100

150

200

250

300

350

400

450

0.1%

0.4%

0.7%

1.0%

1.3%

1.6%

1.9%

2.2%

2.5%

2.8%

3.1%

3.4%

3.7%

4.0%

4.3%

4.6%

4.9%

5.2%

5.5%

5.8%

6.1%

6.4%

6.7%

7.0%

7.3%

7.6%

7.9%

8.2%

8.5%

8.8%

9.1%

9.4%

9.7%

10.0

%

Runt

ime

(us)

Error bound

PMC-MR swing filter mixed-PLA

Linear (PMC-MR) Linear (swing filter) Linear (mixed-PLA)

y = -0.004x + 2.6438R² = 0.1929

y = -0.1652x + 270.29R² = 0.0416

y = 0.3929x + 98.362R² = 0.3674

0

50

100

150

200

250

300

350

0.1%

0.4%

0.7%

1.0%

1.3%

1.6%

1.9%

2.2%

2.5%

2.8%

3.1%

3.4%

3.7%

4.0%

4.3%

4.6%

4.9%

5.2%

5.5%

5.8%

6.1%

6.4%

6.7%

7.0%

7.3%

7.6%

7.9%

8.2%

8.5%

8.8%

9.1%

9.4%

9.7%

10.0

%

Runt

ime

(us)

Error bound

PMC-MR swing filter mixed-PLA

Linear (PMC-MR) Linear (swing filter) Linear (mixed-PLA)

Page 50: The Compression of IoT operational data time series in

32 | Lossy Compression Algorithm Research

Figure 4-1 to Figure 4-4 showed the average runtime results as points with curve fits for each compression method. The curve fitting functions and their R-squared values can also be found in the figures. The curve fitting functions help to examine the relationship between error bound and runtime. However, a low R-squared value does not indicate a poor curve fit [21]. Moreover, the R-squared values will not affect the overall analysis, since the most interesting information that we want to get for PMC-MR and mixed-PLA is the mean value since they are not affected by the error bound.

From Figure 4-1, it is easy to see that the runtime of PMC-MR is always the shortest and remains constant with a mean value of around 2 µs (microseconds). The runtime of mixed-PLA changes very little with changes in the error bound, but the average runtime is around 90 to 100 µs. The fitting curve of the swing filter is influenced by the error bound, since it has a negative slope, which means with increasing error bound, the runtime decreases. The tests with vehicle speed in Figure 4-3 show similar performance for each of the algorithms. The results indicate that PMC-MR has the lowest time complexity, while mixed-PLA is slower, and swing filter takes more time and need also take error bound into consideration.

However, in Figure 4-2, the test with Engine Speed, the relation between error bound and runtime exhibits a power relation instead of a linear function. The strange phenomenon currently has no reasonable explanation. An assumption is that Engine speed data has an extremely large value range compared to other data (see Table 3-1). Confirmation of this assumption will be part of future work.

What is more, in the odometer test result in Figure 4-4, visible fluctuations occurred both with the two PLA methods, but both show a roughly linear trend. Different from the other test results, the runtime of swing filter increases after the error bound reaches 4.3%. I have not found a reason for the strange behavior that is observed. However, this does not affect the fact that: runtime (PMC-MR) > runtime(mixed-PLA) > runtime(swing filter).

4.4.2 Comparison of compression ratios

Figure 4-5 to Figure 4-8 show how the compression ratio changes as a function of the increasing error bound. The definition of compression ratio and the reason for using it were introduced in Section 4.2.3 on page 28.

Page 51: The Compression of IoT operational data time series in

Lossy Compression Algorithm Research | 33

Figure 4-5 Compression Ratio from Fuel Rate test

Figure 4-6 Compression Ratio from Engine Speed test

50%55%60%65%70%75%80%85%90%95%

100%

0.1% 1.0% 1.9% 2.8% 3.7% 4.6% 5.5% 6.4% 7.3% 8.2% 9.1% 10.0%

pmc-mr swing filter mixed-PLA

Power (pmc-mr) Power (swing filter) Power (mixed-PLA)

50%

55%

60%

65%

70%

75%

80%

85%

90%

95%

100%

0.1% 1.0% 1.9% 2.8% 3.7% 4.6% 5.5% 6.4% 7.3% 8.2% 9.1% 10.0%

pmc-mr swing filter mixed-PLA

Power (pmc-mr) Power (swing filter) Power (mixed-PLA)

Page 52: The Compression of IoT operational data time series in

34 | Lossy Compression Algorithm Research

Figure 4-7 Compression Ratio from Vehicle Speed test

Figure 4-8 Compression Ratio from Odometer test

From the four figures, we can see that the compression ratios increase when the error bound increases, i.e., the limitation is lower. In most of the cases, all three algorithms reach high compression ratios (above 90%) when the error bound is larger than 1%, especially for the odometer test, when even with 0.1% error bound the compression ratios are larger than 90%. In contrast, the increase in the compression ratio is relatively slow in the Fuel Rate test, as the fuel rate data

80%

82%

84%

86%

88%

90%

92%

94%

96%

98%

100%

0.1% 1.0% 1.9% 2.8% 3.7% 4.6% 5.5% 6.4% 7.3% 8.2% 9.1% 10.0%

pmc-mr swing filter mixed-PLA

Power (pmc-mr) Power (swing filter) Power (mixed-PLA)

90%

91%

92%

93%

94%

95%

96%

97%

98%

99%

100%

0.1% 1.0% 1.9% 2.8% 3.7% 4.6% 5.5% 6.4% 7.3% 8.2% 9.1% 10.0%

pmc-mr swing filter mixed-PLA

Power (pmc-mr) Power (swing filter) Power (mixed-PLA)

Page 53: The Compression of IoT operational data time series in

Lossy Compression Algorithm Research | 35

includes many ripples without any apparent patterns, thus limiting the compression.

In all of the test results, the mixed-PLA always has the highest compression ratio, especially when the error bound is smaller than 1%. The main reason behind this is that mixed-PLA combines disjoint and joint segments (the end point of one segment can also be the start point of next segment), and this can significantly reduce the number of data points.

PMC-MR and swing filter have similar compression ratios in a test of fuel rate, engine speed, and vehicle speed. However, in the odometer test, PMC-MR has the worst compression ratio when compared to other tests. This is because the odometer data is always increasing smoothly, nearly linearly, and under such a circumstance it is easy to know that the linear approximations always work better than a constant approximation in getting a higher compression ratio.

Apply the Curve Fitting app in MATLAB; it turns out that the pattern of how compression ratio changes with increasing error bound can be best fitted by a power function in the form of 𝑦 = 𝑎 ∙ 𝑥 + 𝑐

In which, x and y represent the error bound and the compression ratio (respectively). The fitting functions are all presented in Table 4-2.

Page 54: The Compression of IoT operational data time series in

36 | Lossy Compression Algorithm Research

Table 4-2 Curve Fitting Parameters

Data Algorithms a b c R-squared

Fuel rate PMC-MR -0.007107 -0.6071 1.027 0.9949

Fuel rate Swing filter

-0.01343 -0.4416 1.023 0.9998

Fuel rate Mixed-PLA -0.004772 -0.4528 1.009 0.9997

RPM PMC-MR -1.985e-05 -1.353 0.995 0.9991

RPM Swing filter

-6.7e-05 -1.28 1.001 0.9914

RPM Mixed-PLA -2.573e-06 -1.613 0.9995 0.9961

Speed PMC-MR -0.0004442 -0.885 1.003 0.9989

Speed Swing filter

-0.0008105 -0.7529 1.001 0.9998

Speed Mixed-PLA -0.0002805 -0.7572 1.001 0.9997

Odometer PMC-MR -0.0001039 -0.9726 1 0.9999

Odometer Swing filter

-0.0002053 -0.5612 1 0.9853

Odometer Mixed-PLA -4.937e-05 -0.6177 0.9998 0.9709

Since the compression ratio always increases with an increase in error bound, there is an open choice of the error bound to reach an optimal compression ratio. For the simplest implementation, in which every data source uses the same 10% error bound all of the algorithms reach a compression ratio around or above 90%. However, if a specific desired compression ratio is desired, we can deduce the nearest error bound from the fitted function. The high R-squared values indicate the curve fitting is pretty accurate. Moreover, it will either be the desired accuracy or the cost of the data transfer that will determine the actual choice of the error bound. As Scania did not provide any cost information for their current data transfer, the choice of error bound will not be further discussed in this thesis.

4.4.3 Reconstruction Performance

The reconstruction performance is measured by first interpolating values in the compressed data segments with the original timestamps from the raw data series, and then detecting the maximum error introduced between the reconstructed data and the original raw data with the same timestamp.

Both PMC-MR and swing filter strictly meet their stated error bound. However, mixed-PLA is not strictly under the given error bound. Instead, the error introduced in controlled around the given error bound, which means it can be either larger or smaller than the allowed error. The test results show mixed-PLA

Page 55: The Compression of IoT operational data time series in

Lossy Compression Algorithm Research | 37

fails to control the maximum error within some error bounds. The complete test results are shown in Appendix C, in which the tests results falling outside the error bound are marked with a yellow background color. However, this only happens in fuel rate and engine speed tests. The reason behind this is assumed to be that fuel rate and engine speed data are all noisy and with sharp fluctuations, thus it is hard for mixed-PLA to generate a convex hull which the algorithm is based on. A potential solution is to always detect the error bound while the algorithm is running and to log the output that exceeds the maximum error bound so that these data points would not be considred valid data.

4.5 Conclusion

The experiments showed both the performance of the three lossy compression algorithms and how different types of data affect their performance, to answer the questions from Section 4.2.

4.5.1 Evaluation of the four types of data inputs

From all of the above, we can conclude that, with different data input, compression performance differs. More specifically:

• For input data that can be fitted into linear functions in a large time range (such as odometer data), PLAs can compress the data to a smaller size than PCA. However, the runtime of PLAs will increase because of the buffer size and amount of calculation increase.

• For a data series strongly fluctuating without a clear pattern, such as the fuel rate data, all compression algorithms’ compression ratio decrease. This is because the three piecewise approximation methods are controlled by the error bound, thus need to follow every fluctuation.

4.5.2 Evaluation of compression algorithms

In Figure 4-9, four radar charts are used to evaluate the four compression methods: PMC-MR, swing filter, mixed-PLA, and the current statistical compression method Scania is using – histogram, as was mentioned in Section 2.2.2.

The histogram has a poor performance in reconstructed quality, which is one of the most crucial criteria in this thesis. From the radar charts, it is easy to see that compared to the current histogram method, the three compression methods all have a relatively balanced properties.

Page 56: The Compression of IoT operational data time series in

38 | Lossy Compression Algorithm Research

Figure 4-9 Radar charts of different compression methods

Moreover, the conclusions regarding the three compression algorithms are:

• PMC-MR is the fastest method. It can reach a good compression ratio, especially when the signal contains a small amount of noise. When the input has a linear trend instead of a constant one, the performance of PMC-MR is affected to some extent. The disadvantage of PMC-MR is that similar to quantization, PMC-MR lowers resolutions of signals and cannot give a smooth output unless data values remain the same for a long period.

• The swing filter has overall good performance. It is unaffected by different types of data and always achieves a high compression ratio. The drawback is that swing filter is the most time-consuming method among the three compression methods. However, this is probably because the coding of the algorithm is not efficient enough, potentially this could be improved in the future.

• For mixed-PLA, it is obvious that it has a higher compression ratio, and a relatively good speed compared to the other linear approximation method (i.e., swing filter). However, the quality of compressed data cannot be ensured, when the signal is noisy and has many ripples, hence

compressionratio

speed

quality ofcompressed

generality

PMC-MR

compressionratio

speed

quality ofcompressed

generality

swing filter

compressionratio

speed

quality ofcompressed

generality

mixed-PLA

compressionratio

speed

quality ofcompressed

generality

histogram

Page 57: The Compression of IoT operational data time series in

Lossy Compression Algorithm Research | 39

mixed-PLA is unable to ensure the introduced error remains under control.

• In all cases, it was possible to achieve an acceptable compression ratio. However, using piecewise approximations, the time series data is only compressed with respect to the number of data points. The compression can be further improved by applying a lossless compression algorithm to the output of the lossy compression.

Page 58: The Compression of IoT operational data time series in
Page 59: The Compression of IoT operational data time series in

Lossless and Combined Compression Algorithms Research | 41

5 Lossless and Combined Compression Algorithms Research

While piecewise approximation compression gives an output in the original time series form, it is important to note that in onboard applications, time series data are stored as binary strings in memory; hence they can be further compressed by lossless algorithms. To achieve a better compression ratio or better data quality with a high compression ratio, in this chapter we try to apply lossless compression to the output from the lossy algorithm and analyze how it improves the performance.

5.1 Algorithm Selection and Design

In Section 2.4.1, several interesting time-series database compression methods were discussed. Two categories of methods were shown to be suitable for time-series data, these are discussed in the following two subsections.

5.1.1 Delta and XOR encoding

The delta-of-delta encoding, a derivative of delta encoding, and XOR (as used in Gorilla) combines delta-of-delta coding and XOR coding (respectively working on the integer timestamps and double-type values). Similar approaches are applied in the Akumuli database. In the following subsections, this method is referred to as Delta-XOR.

The main idea of delta encoding is to find the differences between every pair of neighbor data points. The idea of delta-of-delta encoding is to calculate the differences between the results of delta encoding. Since the time series data are sampled at high frequencies, their delta-of-delta values are always small. Hence the meaningful bits are either equal to or smaller than our data storage size unit, in our case, 32-bits, as mentioned in Section 2.1.2. This property helps the encoding work better.

Table 5-1 shows an example of delta-of-delta encoding. The timestamps are from a part of the fuel rate data sample. The resulting delta-of-delta values can be stored in a smaller number of bits, especially when the sampling frequency is fixed.

Page 60: The Compression of IoT operational data time series in

42 | Lossless and Combined Compression Algorithms Research

Table 5-1 Example of Delta-of-delta values

Timestamp value Delta Delta-of-delta

305943 - -

306042 99 -

306142 100 1

306243 101 1

306343 100 -1

306443 100 0

306542 99 -1

306642 100 1

306743 101 1

306842 99 -2

306942 100 1

In the Gorilla database, variable-length encoding is used to encode the delta-of-delta results based on their value. Variable-length encoding encodes different values into codewords based on their possibility of occurrence [22]. Table 5-2 lists exactly how the results are encoded.

Table 5-2 The encoding of delta-of-delta

value range codeword codeword

length

(bits)

value length

(bits)

total length

(bits)

space saving (compression

ratio)

[0] 0 1 0 1 96.88%

[-63,64] 10 2 7 9 71.88%

[-255,256] 110 3 9 12 62.50%

[-2047,2048] 1110 4 12 16 50.00%

others 1111 4 32 36 -12.50%

Page 61: The Compression of IoT operational data time series in

Lossless and Combined Compression Algorithms Research | 43

As for the XOR encoding of double-type values, an example is shown in Table 5-3. In the table, the float-point numbers, the results of XOR calculation and the results of XOR encoding are represented in hexadecimal (HEX) form.

Table 5-3 The encoding of XOR coding

value HEX value XOR result(HEX)

meaningful bits

XOR encoding (HEX) length

2.65 4005333333333333 - 64 4005333333333333 64

2.7 400599999999999a aaaaaaaaaaa9 48 1c30aaaaaaaaaaa9 61

2.7 400599999999999a 0 - 0 1

2.7 400599999999999a 0 - 0 1

2.75 4006000000000000 399999999999a 49 3763cccccccccccd 62

2.8 4006666666666666 666666666666 46 71bb33333333333 59

2.85 4006cccccccccccd aaaaaaaaaaab 48 1c30aaaaaaaaaaab 61

2.9 4007333333333333 1fffffffffffe 48 1bf0ffffffffffff 61

2.95 400799999999999a aaaaaaaaaaa9 48 1c30aaaaaaaaaaa9 61

3 4008000000000000 f99999999999a 51 d133f99999999999a 64

To conclude, delta encoding can be performed in real-time and is fast and flexible. However, there is also a risk that no compression is achieved, or that the result is a larger than the input data. This same situation can happen in all lossless algorithms. However, the fact that time series data is sampled in a high frequency, and the continuous change of values restricts the difference in such bitwise operations and hence decreases the chance of compression failure.

5.1.2 The LZ4 and Snappy

Additionally, there is another category of a compression method that compresses a large block of text strings, which can be applied after the lossy compression results, where we can print all the numeral variables as text strings. The method works best with compression of text files, but it is still interesting to apply to time-series data.

According to the comparison results from the blog by Peter Zaitsev and Vadim Tkachenko [5], we selected the following algorithms:

LZ4 the fastest method among all algorithms studied Snappy fast and slightly better compression ratio

To test whether it is possible to apply these two algorithms in our case, a small test was made. The results of this test are shown in Table 5-4.

Page 62: The Compression of IoT operational data time series in

44 | Lossless and Combined Compression Algorithms Research

Table 5-4 Test results of combined compression with LZ4 and Snappy

TestsSize

(bytes) Size (MB)

Compression ratio

(original)

Compression ratio (lossless

compression)

no lossy 998112 974.7188 - - no lossy +

LZ4 419300 409.4727 57.9907% 57.9907% no lossy

+Snappy 426190 416.2012 57.3004% 57.3004% PMC 22218 21.69727 97.7740% -

PMC + LZ4 13544 13.22656 98.6430% 39.0404% PMC + Snappy 13283 12.97168 98.6692% 40.2151% swing filter 25331 24.7373 97.4621% - swing filter

+LZ4 15755 15.38574 98.4215% 37.8035% swing filter

+ Snappy 15296 14.9375 98.4675% 39.6155% mixed-PLA 6336 6.1875 99.3652% -

mixed-PLA + lz4 5672 5.539063 99.4317% 10.4798%

mixed-PLA + Snappy 5441 5.313477 99.4549% 14.1256%

From the table, it is obvious that the compression ratio improves by following lossy compression with lossless compression. However, the compression methods cannot be updated for every single new coming data point, because they need a large amount of data to derive a pattern from and to compress the data at once, making it impossible for the algorithm to stop when there is an external trigger requesting the compression result. Thus LZ4 and Snappy were not considered further.

5.2 Experimental Design

The purpose of these experiments was to prove:

• When combined with lossy compression, lossless compression methods can improve the compression ratio instead of decreasing it.

• Lossless compression methods can keep a high compression ratio, while the error bound can be further decreased.

Page 63: The Compression of IoT operational data time series in

Lossless and Combined Compression Algorithms Research | 45

5.2.1 Test Environment

The test environment is basically the same as in Section 4.2.1, the source code used in the experiments were all implemented in C++ by the author, on a Windows 10 64-bit system, with 16 GB RAM and Intel Core i7-6700 CPU, which is the same as in lossy compression test as mentioned in Section 4.2.

5.2.2 Experiment input

The input was the same four sets of data as in the lossy compression experiments, but to improve the efficiency of the experiments, the error bound range was limited to between 0.01% and 0.15%, because after the 0.15% error bound, the compression ratio of lossy compression does not change rapidly, thus larger error bounds can be ignored.

To decrease the time required for the experiments and because the compression ratios of the three lossy algorithms do not greatly differ; only PMC-MR is applied as the lossy algorithm.

5.2.3 Experimental output

The experiment mainly measures the compression ratios, both with and without lossy algorithm, to answer the questions from the beginning of this section. Note that in this chapter, the compression ratio was defined as in Section 4.2.3.

5.3 Algorithm Test Results & Analysis

When analyzing the results of the experiment, we observe that both the performance of Delta-XOR combined compression and the individual performances of either delta-of-delta encoding or XOR encoding show interesting phenomenon.

From Figure 5-1 it is easy to see that our lossless method can increase the compression ratio in one of the tests (fuel rate testing). Also, from the lengths of the transparent blue boxes we can see that when the error bound increases, the differences between mixed compression and lossy compression shrinks, as the lossless compression ratio decreases. The reason behind this is that the more compressed the data is, the less pattern remains in the compressed results and hence the more difficult for the lossless compression to work.

Additionally, we can see that when the compression ratios are of a specific value, the mixed compression reduces the error bound. In other words, lossless compression helps the compressed data reach a better quality for a given compression ratio.

Page 64: The Compression of IoT operational data time series in

46 | Lossless and Combined Compression Algorithms Research

5.3.1 Overall performance

Figure 5-1 Compression ratio of PMC-MR and combined compression in Fuel Rate testing

The performance of the Delta-XOR encoding of other data sets also shows a similar trend, as shown in Figure 5-2.

Figure 5-2 Total Space saved (compression ratio) by lossless algorithm

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

0.0% 0.1% 0.2% 0.3% 0.4% 0.5% 0.6% 0.7% 0.8% 0.9% 1.0% 1.1% 1.2% 1.3% 1.4% 1.5%

Com

pres

sion

ratio

error bound

(lossy) compression ratios(combined)

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

0.0% 0.1% 0.2% 0.3% 0.4% 0.5% 0.6% 0.7% 0.8% 0.9% 1.0% 1.1% 1.2% 1.3% 1.4% 1.5%

Com

pres

sion

ratio

error bound

fuel rate rpm speed odometer

Page 65: The Compression of IoT operational data time series in

Lossless and Combined Compression Algorithms Research | 47

5.3.2 Individual Performance

In the results of delta-of-delta encoding (shown in Figure 5-3), the compression ratio is obviously decreasing with an increasing error bound. The compression ratios for the four types of data when applied to the raw data are nearly the same, but with the lossy compression introduced, the four data become different, leading to an ordered set of compression ratios: fuel rate > engine speed > vehicle speed > odometer. An assumption is that this is related to the compression ratio of lossy compression algorithm, which has exactly the opposite performance, i.e. fuel rate < engine speed < vehicle speed < odometer.

Figure 5-3 Compression ratio of delta-of-delta encoding

There is an interesting phenomenon that in the Engine speed test where XOR reaches a higher compression ratio, as shown in Figure 5-4. After analysis, the reason turns out to be that the engine speed data values are sampled with a resolution of 0.125, with this resolution; the double-type values are easier to compress. This is because of the binary form of double-precision floating-point variables.

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

0.0% 0.1% 0.2% 0.3% 0.4% 0.5% 0.6% 0.7% 0.8% 0.9% 1.0% 1.1% 1.2% 1.3% 1.4% 1.5%

Com

pres

sion

ratio

error bound

fuel rate rpm speed odometer

Page 66: The Compression of IoT operational data time series in

48 | Lossless and Combined Compression Algorithms Research

Figure 5-4 Compression ratio of XOR encoding

5.4 Conclusion

The results of these experiments prove that the lossless compression can be beneficially applied to the results from lossy compressions. Without lossy compression, the lossless compression using Delta-XOR encoding can compress data by a compression ratio over 50%.

However, when the lossless compression is combined with lossy compression, the compression ratio of lossless compression will be decreased compared with their initial compression ratio when compressing the raw data. Additionally, when the compression ratio of lossy compression is higher, the compression ratio of lossless compression is lower. Thus, when applied to the real case, because of this trade-off between lossy and lossless compression, it is suggested that lossless compression only is used when the lossy compression works under a strict error bound.

0.00%

10.00%

20.00%

30.00%

40.00%

50.00%

60.00%70.00%

80.00%

90.00%

100.00%

fuel rate rpm speed odometer

Page 67: The Compression of IoT operational data time series in

Implementation | 49

6 Implementation

After studying both lossy and lossless compression, the next step is to implement the algorithms with real-time data streams as input. Collecting a real CAN signal and testing on the C300 requires extra hardware (specifically a CANanalyzer) and software support, which consumes additional cost. Additionally, learning how to use the CANanalyzer would take a long time. For these reasons, an implementation of the algorithm was tested using a simpler method: simulating a CAN signal by creating a function in C++ to read the same CAN log file used in Chapter 4, and implement this in a simulated environment instead of on the C300.

6.1 Software design

Before starting the implementation, the selected algorithm for both lossy and lossless compression and the value of the parameter (in our case is the given error bound) is essential to be decided.

6.1.1 Selection of algorithms

PMC-MR was selected as the lossy compression algorithm because it is fast, provides a high compression ratio, and is easy to realize. Also, because it was used during the combined algorithm test we can check the reliability by comparing the results of the final implementation with the earlier implementation. In other words, the algorithm will be the same as that used in Chapter 5.

For the lossless algorithm, as discussed in Chapter 5, the best choice for a real-time implementation is Delta-XOR compression.

6.1.2 Selection of the error bound parameter

The curve fitting relates the error bound and compression ratio in lossy compression, hence it is easy to tell that the compression ratio can easily reach 95% with a slight increase in the error bound. After that, it becomes harder and harder to further increase the compression ratio. Thus, in the implementation, 95% was set as the desired compression ratio.

From the equation on page 35 and Table 4-2, we can calculate the error bounds of four different data inputs by the inverse function: 𝑥 = y − 𝑐𝑎

Where a, b, and c are coefficients, x represents the error bound in percent, y represents the compression ratio, which is 95%. From this equation, the error bound for fuel rate, engine speed, speed, and odometer are respectively 1.97%, 0.33%, 0.45%, and 0.17%. Then, with the help of lossless compression, the expected compression ratio should be above 95%.

Page 68: The Compression of IoT operational data time series in

50

6

TsS

6

ACaatibreitwst

0 | Implementatio

6.1.3 Sof

The softwaoftware sh

SW applica

6.1.3.1 The

As testing wCAN simulaa single sigand values ime via th

based on teads the tit was give

waits for thtream is si

on

ftware struc

re was deshould ensuations on th

Figur

e CAN signa

with a realator is used

gnal. The Cand stores

he simulatethe timestamestamp on, then ca

his time beimulated.

cture

signed to ere that the

he C300. T

e 6-1 So

al simulation

l CAN signd. This sim

CAN simulas them in aed CAN buamps. Befof both thealculates thefore sendi

easily chane compressThe overall

oftware str

n

nal would tmulator reaator first r

a vector in mus. The timfore sendine current dhe time ining the nex

nge the algsion algoritprocess is

ructure of

take too mads data froreads and smemory. T

ming of theng every d

data point anterval betwxt data poi

gorithm ththm is indeshown in F

f the simul

much time, om a file costores all tThen it sene sending data pointand the preween the tint. Thus, a

hat is usedependent oFigure 6-1

lation

in this expontaining othe signal t

nds one datof the dat

t, the CANevious datatwo data pa real-time

d. Thus, thof the othe.

periment,only data otimestampta point at ta stream iN simulatoa point thapoints, ane CAN dat

he er

a of ps

a is or at d

ta

Page 69: The Compression of IoT operational data time series in

Implementation | 51

6.1.3.2 Input buffer

After the CAN listener receives a new data point, it stores it in an input first in first out (FIFO) buffer to ensure that the reading of the CAN signal will not be influenced by the compression algorithm. In our case, the buffer is set to have a dynamic size, which means the buffer will increase its size when a new data point should be stored when it is full.

6.1.3.3 Trigger

The trigger, indicated by the red arrow in Figure 6-1, is simulated according to the triggers that Scania has in their current SW application, as mentioned in Section 2.2.2. Triggers can be externally generated when specific events happen to force the compression to stop; for example, ignition, harsh braking, and over speed. After the trigger signal arrives, the algorithm will immediately stop updating and send the current results of compression as output in the form of the data string and sent it to the data transmission SW.

6.2 Implementation Results

The implementation runs on a Linux Ubuntu system on a virtual machine on which Scania teams develop and test their SW. The results of the simulation are shown in Table 6-1. The combined compression algorithm meets the requirement of the 95% compression ratio set by Scania, and even reaches more than 95% after lossless compression.

Table 6-1 Results of Simulation

error bound

original data

amount

original size in

memory(KB)

the lossycompressed

data amount

lossy compressed

size (KB)

losslesslycompressed

size (KB)

lossy compression

ratio

combined compression

ratio

fuel rate 1.97% 55601 651.6 2488 29.2 22.3 95.53% 96.58%

engine speed 0.33% 279627 3276.9 11620 136.2 44.9 95.84% 98.63%

vehicle speed 0.45% 55675 652.4 2839 33.3 23.8 94.90% 96.35%

odometer 0.17% 5497 64.4 286 3.4 2.2 94.80% 96.52%

Comparing the original data size in memory and the final compressed size, it is easy to get a general view of how much size of data transmission has been reduced.

Page 70: The Compression of IoT operational data time series in
Page 71: The Compression of IoT operational data time series in

Conclusions and Future work | 53

7 Conclusions and Future work

In this chapter, the conclusions of this thesis are explained. Then, the limitations during the thesis and the future work can be done based on this thesis will be discussed, to help to improve the performance of the compression method.

7.1 Conclusions

This thesis introduces a combined compression method, which is the combination of lossy and lossless compression. In the combined compression, compression first reaches a high compression ratio and gives a compressed time series data stream as output. Then, lossless compression further improves the compression ratio and reduces the amount of data that will be transmitted via the cellular network. Lossy and lossless compression were both tested individually with the same time series data inputs.

For lossy compression, three types of piecewise approximations have been compared and discussed, the difference in performance due to different input data was also analyzed to find the reason behind this difference. Because of the three algorithms all had their own strengths, the conclusion for choosing lossy compression was open, and depending on different scenarios. Afterwards, when selecting an algorithm for lossless compression, Delta-XOR was tested and chosen as the most suitable lossless compression method.

Finally, the combined compression method is tested, which consist of lossy compression method PMC-MR and Delta-XOR lossless compression method. In the four tests with four different time series data as input, the combined compression method can easily reach a compression ratio over 95%. To reach this compression ratio, the maximum error needs to be calculated. In the four tests, even the largest error bound is smaller than 2%.

7.2 Limitations

Though the implemented SW can achieve the goal of the thesis project, it still has some limitations that were not solved in this thesis. The reasons these limitations are below.

7.2.1 Time limitation

The thesis project was limited by the time. The development of experiments, especially for lossy algorithms took a long time since there was no open-source code available.

Page 72: The Compression of IoT operational data time series in

54 | Conclusions and Future work

7.2.2 Performance limitation

The biggest performance limitation is the disadvantages of a piecewise algorithm. For example, although a piecewise algorithm keeps track of the original data stream, it still discards the detailed time information. Also, piecewise approximations are sensitive to outliers; if too many random outliers appear in the original data, they will destroy the quality of the compressed result.

7.3 Future work

This section describes plans and suggestions for future work that might follow the work described in this thesis.

7.3.1 Implement with other SW applications on C300 ECU

Due to time and HW resource limits, the research was not implemented on an actual C300. The current SW has only been tested as a single application. However, there are many other applications running on the RTC ECU. There is a possibility that other applications might conflict with the compression SW, e.g., reading the same input signals at the same time. Whether these applications can coexist or not remains to be studied.

7.3.2 Other lossy algorithms

Only piecewise approximation compression was implemented and tested. However, both quantization and orthogonal transformation (as discussed in Section 4.1) could also be applied. Further research could focus on these compression algorithms.

7.3.3 Decoding

Decoding on the offboard side was not discussed and was not implemented. Similar to encoding, decoding procedures for the different methods can be analyzed and evaluated by comparing their time and space complexity. Analysis of decoding performance remains for future work.

7.3.4 Preprocessing of time series data

As mentioned in the previous section, piecewise approximation is limited in several ways. For example, it is sensitive to every single rapid change in the data stream, which makes it easily affected by outliers. Thus, preprocessing of the time series data is essential. This can be achieved by adding a low pass filter or merely removing data points with unreasonable values. Additionally, data analysis should be done to figure out what values contain useless or erroneous information that should be ignored.

Page 73: The Compression of IoT operational data time series in

Conclusions and Future work | 55

7.3.5 Real-time system design

In this thesis, the experiments ran only with one data series as input each time. However, in reality, when multiple data streams all needed to be compressed at the same time, the resource requirements will be increased. Thus, a reasonable task scheduling policy should be introduced to prevent CPU overload.

7.4 Reflections

The compression algorithm provides better data analysis to Scania, thus enabling them to improve their current products. Thus, the user experience and safety (which is essential to vehicles) can be improved. The increase temporal resolution of data from all of the Scania vehicles that are in operation is expected to enable Scania to continuously improve their product’s quality. These improvements have economic benefits to the fleet operators and a positive social impact.

More efficient data transmission of certain diagnostic data will improve Scania’s maintenance service by enabling remote diagnostics when the vehicle has problems, avoiding the need to return the vehicle to Scania. Furthermore, the improvement in the operation of the vehicle can reduce the vehicle’s carbon emission.

Additionally, the compressed algorithm can reduce the amount of data that must be transmitted over the cellular network, which means a huge reduction in communication costs.

Page 74: The Compression of IoT operational data time series in
Page 75: The Compression of IoT operational data time series in

References | 57

References

[1] Scania Group, ‘Connectivity’, Scania Group. [Online]. Available: https://www.scania.com/group/en/connectivity/ [Accessed: 14-May-2018]

[2] ‘Protocol Buffers’, Google Developers. [Online]. Available: https://developers.google.com/protocol-buffers/. [Accessed: 27-Apr-2018]

[3] Guy E. Blelloch, ‘Introduction to data compression’, Comput. Sci. Dep. Carnegie Mellon Univ., 2001 [Online]. Available: https://www.cs.cmu.edu/~guyb/realworld/compression.pdf

[4] Tuomas Pelkonen, Scott Franklin, Justin Teller, Paul Cavallaro, Qi Huang, Justin Meza, and Kaushik Veeraraghavan, ‘Gorilla: A Fast, Scalable, In-memory Time Series Database’, Proc VLDB Endow, vol. 8, no. 12, pp. 1816–1827, Aug. 2015. DOI: 10.14778/2824032.2824078

[5] Peter Zaitsev and Vadim Tkachenko, ‘Evaluating Database Compression Methods: Update’, Percona Database Performance Blog. 13-Apr-2016 [Online]. Available: https://www.percona.com/blog/2016/04/13/evaluating-database-compression-methods-update/. [Accessed: 23-Apr-2018]

[6] Google, snappy: A fast compressor/decompressor. Google, 2018 [Online]. Available: https://github.com/google/snappy. [Accessed: 27-Apr-2018]

[7] ‘Zstandard - Real-time data compression algorithm’. [Online]. Available: http://facebook.github.io/zstd/. [Accessed: 27-Apr-2018]

[8] Chotirat Ann Ratanamahatana, Jessica Lin, Dimitrios Gunopulos, Eamonn Keogh, Michail Vlachos, and Gautam Das, ‘Mining Time Series Data’, in Data Mining and Knowledge Discovery Handbook, Springer, Boston, MA, 2009, pp. 1049–1077 [Online]. DOI: 10.1007/978-0-387-09823-4_56

[9] Julien Danjou, ‘Timeseries storage and data compression | Julien Danjou’. [Online]. Available: https://julien.danjou.info/blog/2016/gnocchi-carbonara-timeseries-compression. [Accessed: 01-Feb-2018]

[10] Eugene Lazin, ‘Time-series compression (part 1)’, Akumuli. [Online]. Available: http://akumuli.org/akumuli/2016/12/30/compression_part1/. [Accessed: 01-Feb-2018]

[11] Time-series database. Contribute to akumuli/Akumuli development by creating an account on GitHub. Akumuli.org, 2018 [Online]. Available: https://github.com/akumuli/Akumuli. [Accessed: 23-Sep-2018]

[12] S. Edward Hawkins and Edward Hugo Darlington, ‘Algorithm for Compressing Time-Series Data’, Jun. 2012 [Online]. Available: http://ntrs.nasa.gov/search.jsp?R=20120010460. [Accessed: 05-Feb-2018]

[13] A. Ukil, S. Bandyopadhyay, and A. Pal, ‘IoT Data Compression: Sensor-Agnostic Approach’, in 2015 Data Compression Conference, 2015, pp. 303–312. DOI: 10.1109/DCC.2015.66

[14] I. Lazaridis and S. Mehrotra, ‘Capturing sensor-generated time series with quality guarantees’, in Proceedings 19th International Conference on Data Engineering (Cat. No.03CH37405), 2003, pp. 429–440. DOI: 10.1109/ICDE.2003.1260811

[15] Lin McMullin, ‘Error Bounds’, Teaching Calculus. 22-Feb-2013 [Online]. Available: https://teachingcalculus.com/2013/02/22/error-bounds/. [Accessed: 26-Apr-2018]

[16] Rhys Goldstein, Michael Glueck, and Azam Khan, ‘Real-Time Compression of Time Series Building Performance Data’, in Proceedings of Building Simulation 2011, Sydney, 2011, pp. 1057–1064 [Online]. Available: https://www.autodeskresearch.com/sites/default/files/rtcompression.pdf

[17] Hazem Elmeleegy, Ahmed K. Elmagarmid, Emmanuel Cecchet, Walid G. Aref, and Willy Zwaenepoel, ‘Online Piece-wise Linear Approximation of Numerical Streams with Precision Guarantees’, Proc VLDB Endow, vol. 2, no. 1, pp. 145–156, Aug. 2009. DOI: 10.14778/1687627.1687645

Page 76: The Compression of IoT operational data time series in

58 | References

[18] G. Luo, K. Yi, S. W. Cheng, Z. Li, W. Fan, C. He, and Y. Mu, ‘Piecewise linear approximation of streaming time series data with max-error guarantees’, in 2015 IEEE 31st International Conference on Data Engineering, 2015, pp. 173–184. DOI: 10.1109/ICDE.2015.7113282

[19] S. Louis Hakimi and Edward F. Schmeichel, ‘Fitting polygonal functions to a set of points in the plane’, CVGIP Graph. Models Image Process., vol. 53, no. 2, pp. 132–136, 1991.

[20] Frank Eichinger, Pavel Efros, Stamatis Karnouskos, and Klemens Böhm, ‘A time-series compression technique and its application to the smart grid’, VLDB J., vol. 24, no. 2, pp. 193–218, Apr. 2015. DOI: 10.1007/s00778-014-0368-8

[21] Minitab Blog Editor, ‘Regression Analysis: How Do I Interpret R-squared and Assess the Goodness-of-Fit?’ [Online]. Available: http://blog.minitab.com/blog/adventures-in-statistics-2/regression-analysis-how-do-i-interpret-r-squared-and-assess-the-goodness-of-fit. [Accessed: 07-Oct-2018]

[22] ‘Basic Codes’, in Variable-length Codes for Data Compression, Springer, London, 2007, pp. 9–67 [Online]. DOI: 10.1007/978-1-84628-959-0_1

Page 77: The Compression of IoT operational data time series in

Appendix A: C++ implementation of PMC-MR | 59

Appendix A: C++ implementation of PMC-MR

// C++ code of PMC-MR implementation

void TimeSeriesCompression::compressionPmcMr()

{

unsigned int counter = 0;

unsigned long int counter_in = 1;

RAW_DATA data_old,data_new;

RAW_DATA result;

while(compression_buf.empty());

data_new = fetchNewData();

data_old = data_new;

float m = data_new.v;

float M = data_new.v;

while(1)

{

if( !compression_buf.empty() ){

data_old = data_new;

data_new = fetchNewData();

if( ( ( M > data_new.v )?M:data_new.v ) - ( ( m <

data_new.v )?m:data_new.v ) > (2 * COMPRESSION_ERR) )

{

result.timestamp = data_old.timestamp;

result.v = (M+m)/2;

pmc_mr_buf.push_back(result);

writeStructToFile(result);

writeStructToBinaryFile(result);

counter++;

m = data_new.v;

M = data_new.v;

}

else

{

m = ( m < data_new.v )?m:data_new.v;

M = ( M > data_new.v )?M:data_new.v;

Page 78: The Compression of IoT operational data time series in

60 | Appendix A: C++ implementation of PMC-MR

}

counter_in++;

}

else

{

if(can_signal.checkIfEnd()) break; //read trigger here

}

}

result.timestamp = data_new.timestamp;

result.v = (M+m)/2;

pmc_mr_buf.push_back(result);

writeStructToFile(result);

counter++;

std::cout<<"original size:"<<counter_in<<", the amount of output

is:"<<counter<<'\n';

std::cout<<"The compression ratio is:"<< ( counter_in - counter )*100

/counter_in<<"% \n";

real_time_compression_end = 1;

}

Page 79: The Compression of IoT operational data time series in

Appendix B: C++ implementation of Swing filter | 61

Appendix B: C++ implementation of Swing filter

// C++ code of swing filter implementation

void TimeSeriesCompression::compressionSwingFilter()

{

int buf_ptr = -1;

int counter_in = 1;

float temp1,temp2;

RAW_DATA data_new;

RAW_DATA temp;

float A_g,m,M,a_g,b_g;

LINEAR_FUN line_u,line_l;

bool new_interval = 0;

while(compression_buf.empty());

data_new = fetchNewData();

swing_res_buf.push_back(data_new);

writeStructToFile(data_new);

writeStructToBinaryFile(data_new);

data_new.show();

swing_tmp_buf.push_back(data_new);

buf_ptr++;

counter_in++;

while(compression_buf.empty());

data_new = fetchNewData();

swing_tmp_buf.push_back(data_new);

buf_ptr++;

counter_in++;

std::cout<<"set line_u and line_l!"<<std::endl;

line_u.a = ( swing_tmp_buf[buf_ptr].v + COMPRESSION_ERR -

swing_tmp_buf[buf_ptr - 1].v )

/ (swing_tmp_buf[buf_ptr].timestamp - swing_tmp_buf[buf_ptr-

1].timestamp );

line_u.b = ( swing_tmp_buf[buf_ptr - 1].v *

Page 80: The Compression of IoT operational data time series in

62 | Appendix B: C++ implementation of Swing filter

swing_tmp_buf[buf_ptr].timestamp

- swing_tmp_buf[buf_ptr - 1].timestamp * (

swing_tmp_buf[buf_ptr].v + COMPRESSION_ERR ) )

/ ( swing_tmp_buf[buf_ptr].timestamp - swing_tmp_buf[buf_ptr-

1].timestamp );

line_l.a = ( swing_tmp_buf[buf_ptr].v - COMPRESSION_ERR -

swing_tmp_buf[buf_ptr - 1].v )

/ ( swing_tmp_buf[buf_ptr].timestamp - swing_tmp_buf[buf_ptr -

1].timestamp );

line_l.b = ( swing_tmp_buf[buf_ptr - 1].v *

swing_tmp_buf[buf_ptr].timestamp

- swing_tmp_buf[buf_ptr - 1].timestamp * (

swing_tmp_buf[buf_ptr].v - COMPRESSION_ERR ) )

/ ( swing_tmp_buf[buf_ptr].timestamp - swing_tmp_buf[buf_ptr -

1].timestamp );

std::cout<<"swing filter loop begin!"<<std::endl;

while(1)

{

if( !compression_buf.empty() ){

std::cout<<".";

data_new = fetchNewData();

if ( new_interval )

{

std::cout<<"swing_tmp_buf[buf_ptr]:";

swing_tmp_buf[buf_ptr].show();

std::cout<<", swing_tmp_buf[buf_ptr - 1]:";

swing_tmp_buf[buf_ptr-1].show();

std::cout<<std::endl;

line_u.a = ( swing_tmp_buf[buf_ptr].v +

COMPRESSION_ERR - swing_tmp_buf[buf_ptr - 1].v )

/ (swing_tmp_buf[buf_ptr].timestamp -

swing_tmp_buf[buf_ptr-1].timestamp );

line_u.b = ( swing_tmp_buf[buf_ptr - 1].v *

Page 81: The Compression of IoT operational data time series in

Appendix B: C++ implementation of Swing filter | 63

swing_tmp_buf[buf_ptr].timestamp

- swing_tmp_buf[buf_ptr - 1].timestamp * (

swing_tmp_buf[buf_ptr].v + COMPRESSION_ERR ) )

/ ( swing_tmp_buf[buf_ptr].timestamp -

swing_tmp_buf[buf_ptr-1].timestamp );

line_l.a = ( swing_tmp_buf[buf_ptr].v -

COMPRESSION_ERR - swing_tmp_buf[buf_ptr - 1].v )

/ ( swing_tmp_buf[buf_ptr].timestamp -

swing_tmp_buf[buf_ptr - 1].timestamp );

line_l.b = ( swing_tmp_buf[buf_ptr - 1].v *

swing_tmp_buf[buf_ptr].timestamp

- swing_tmp_buf[buf_ptr - 1].timestamp * (

swing_tmp_buf[buf_ptr].v - COMPRESSION_ERR ) )

/ ( swing_tmp_buf[buf_ptr].timestamp -

swing_tmp_buf[buf_ptr - 1].timestamp );

new_interval = 0;

swing_tmp_buf.clear();

buf_ptr = -1;

swing_tmp_buf.push_back(swing_res_buf.back());

swing_tmp_buf.push_back(data_new);

buf_ptr = buf_ptr + 2;

continue;

}

swing_tmp_buf.push_back(data_new);

buf_ptr++;

counter_in++;

std::cout<<"line_u:"<<line_u.a<<" * x + "<<line_u.b<<";

line_l:"<<line_l.a<<" * x + "<<line_l.b<<"; ";

swing_tmp_buf[buf_ptr].show();

std::cout<<std::endl;

std::cout<<"up error:"<< line_u.a *

swing_tmp_buf[buf_ptr].timestamp + line_u.b - swing_tmp_buf[buf_ptr].v

<<", down error:"<<line_l.a *

swing_tmp_buf[buf_ptr].timestamp + line_l.b -

Page 82: The Compression of IoT operational data time series in

64 | Appendix B: C++ implementation of Swing filter

swing_tmp_buf[buf_ptr].v<<std::endl;

if( ( line_u.a * swing_tmp_buf[buf_ptr].timestamp +

line_u.b - swing_tmp_buf[buf_ptr].v < 0 ) ||

( line_l.a * swing_tmp_buf[buf_ptr].timestamp +

line_l.b - swing_tmp_buf[buf_ptr].v > 0 ) )

{

temp1 = 0;

temp2 = 0;

for( int i = 1; i < (swing_tmp_buf.size() - 1); i++

)

{

temp1 += ( swing_tmp_buf[i].v -

swing_res_buf.back().v ) *

( swing_tmp_buf[i].timestamp -

swing_res_buf.back().timestamp );

temp2 += ( swing_tmp_buf[i].timestamp -

swing_res_buf.back().timestamp ) *

( swing_tmp_buf[i].timestamp -

swing_res_buf.back().timestamp );

}

A_g = temp1 / temp2;

m = A_g < line_u.a ? A_g : line_u.a;

M = line_l.a > m ? line_l.a : m;

a_g = M;

b_g = swing_tmp_buf[0].v - a_g *

swing_res_buf.back().timestamp;

temp.timestamp = swing_tmp_buf[buf_ptr -

1].timestamp;

temp.v = a_g * temp.timestamp + b_g;

swing_res_buf.push_back(temp);

writeStructToFile(temp);

writeStructToBinaryFile(temp);

temp.show();

swing_res_buf.push_back(swing_tmp_buf[buf_ptr]);

writeStructToFile(swing_tmp_buf[buf_ptr]);

writeStructToBinaryFile(swing_tmp_buf[buf_ptr]);

swing_tmp_buf[buf_ptr].show();

new_interval = 1;

Page 83: The Compression of IoT operational data time series in

Appendix B: C++ implementation of Swing filter | 65

}

else

{

if( line_u.a * swing_tmp_buf[buf_ptr].timestamp +

line_u.b - swing_tmp_buf[buf_ptr].v > COMPRESSION_ERR )

{

//std::cout<<"swing_res_buf.back():";

//swing_res_buf.back().show();

line_u.a = ( swing_tmp_buf[buf_ptr].v +

COMPRESSION_ERR - swing_res_buf.back().v ) /

( swing_tmp_buf[buf_ptr].timestamp -

swing_res_buf.back().timestamp );

line_u.b = ( swing_res_buf.back().v *

swing_tmp_buf[buf_ptr].timestamp - swing_res_buf.back().timestamp *

( swing_tmp_buf[buf_ptr].v +

COMPRESSION_ERR ) ) /

( swing_tmp_buf[buf_ptr].timestamp -

swing_res_buf.back().timestamp );

std::cout<<"line_u updated:"<<line_u.a<<"*x +

"<<line_u.b<<std::endl;

}

if( line_l.a * swing_tmp_buf[buf_ptr].timestamp +

line_l.b - swing_tmp_buf[buf_ptr].v < (-COMPRESSION_ERR) )

{

line_l.a = ( swing_tmp_buf[buf_ptr].v -

COMPRESSION_ERR - swing_res_buf.back().v ) /

( swing_tmp_buf[buf_ptr].timestamp -

swing_res_buf.back().timestamp );

line_l.b = ( swing_res_buf.back().v *

swing_tmp_buf[buf_ptr].timestamp - swing_res_buf.back().timestamp *

( swing_tmp_buf[buf_ptr].v -

COMPRESSION_ERR ) ) /

( swing_tmp_buf[buf_ptr].timestamp -

swing_res_buf.back().timestamp );

std::cout<<"line_l updated:"<<line_l.a<<"*x +

"<<line_l.b<<std::endl;

}

}

}

Page 84: The Compression of IoT operational data time series in

66 | Appendix B: C++ implementation of Swing filter

else

{

if(can_signal.checkIfEnd()) break;

}

}

// add the final point

if ( !( (line_u.a * swing_tmp_buf[buf_ptr].timestamp + line_u.b -

swing_tmp_buf[buf_ptr].v < 0 ) ||

( line_l.a * swing_tmp_buf[buf_ptr].timestamp + line_l.b -

swing_tmp_buf[buf_ptr].v > 0 ) ) )

{

temp1 = 0;

temp2 = 0;

for( int i = 1; i < (swing_tmp_buf.size()) ; i++ )

{

temp1 += ( swing_tmp_buf[i].v - swing_res_buf.back().v )

*

( swing_tmp_buf[i].timestamp -

swing_res_buf.back().timestamp );

temp2 += ( swing_tmp_buf[i].timestamp -

swing_res_buf.back().timestamp ) *

( swing_tmp_buf[i].timestamp -

swing_res_buf.back().timestamp );

}

A_g = temp1/temp2;

m = A_g < line_u.a ? A_g : line_u.a;

M = line_l.a > m ? line_l.a : m;

a_g = M;

b_g = swing_tmp_buf[0].v - a_g *

swing_res_buf.back().timestamp;

temp.timestamp = swing_tmp_buf[buf_ptr].timestamp;

temp.v = a_g * temp.timestamp + b_g;

swing_res_buf.push_back(temp);

writeStructToFile(temp);

writeStructToBinaryFile(temp);

temp.show();

}

else{

swing_res_buf.push_back(swing_tmp_buf[buf_ptr]);

Page 85: The Compression of IoT operational data time series in

Appendix B: C++ implementation of Swing filter | 67

writeStructToFile(swing_tmp_buf[buf_ptr]);

swing_tmp_buf[buf_ptr].show();

}

std::cout<<"Swing filter ends! Total input: "<<counter_in<<", total

output: "<<swing_res_buf.size()<<std::endl;

std::cout<<"Compression ratio: "<< (counter_in -

swing_res_buf.size())/counter_in <<std::endl;

real_time_compression_end = 1;

}

Page 86: The Compression of IoT operational data time series in
Page 87: The Compression of IoT operational data time series in

Appendix C: Error bound test results of Mixed-PLA | 69

Appendix C: Error bound test results of Mixed-PLA

Mixed-PLA error analysis in Fuel Rate

error bound (percentage) error bound (value) maximum error 0.1% 0.0886 1089.05 0.2% 0.1772 0.379806 0.3% 0.2658 0.467199 0.4% 0.3544 0.555506 0.5% 0.443 0.643568 0.6% 0.5316 0.732261 0.7% 0.6202 0.820454 0.8% 0.7088 0.909086 0.9% 0.7974 0.997717 1.0% 0.886 1.08567 1.1% 0.9746 1.17424 1.2% 1.0632 6716.25 1.3% 1.1518 7227.82 1.4% 1.2404 7739.38 1.5% 1.329 8250.95 1.6% 1.4176 8762.51 1.7% 1.5062 9274.07 1.8% 1.5948 9785.64 1.9% 1.6834 10297.2 2.0% 1.772 10808.8 2.1% 1.8606 11320.3 2.2% 1.9492 11831.9 2.3% 2.0378 12343.5 2.4% 2.1264 12855 2.5% 2.215 13366.6 2.6% 2.3036 13878.1 2.7% 2.3922 14389.7 2.8% 2.4808 3.00633 2.9% 2.5694 3.15506 3.0% 2.658 3.30379 3.1% 2.7466 3.45252 3.2% 2.8352 3.60125 3.3% 2.9238 3.74998 3.4% 3.0124 3.04926 3.5% 3.101 3.19801 3.6% 3.1896 3.34676 3.7% 3.2782 3.49551 3.8% 3.3668 3.64426 3.9% 3.4554 3.79301 4.0% 3.544 3.94176 4.1% 3.6326 3.64121 4.2% 3.7212 3.78998 4.3% 3.8098 3.93875 4.4% 3.8984 4.08752 4.5% 3.987 4.03707 4.6% 4.0756 4.18586 4.7% 4.1642 4.18548 4.8% 4.2528 4.33429 4.9% 4.3414 4.4831

Page 88: The Compression of IoT operational data time series in

70 | Appendix C: Error bound test results of Mixed-PLA

error bound (percentage) error bound (value) maximum error 5.0% 4.43 4.62912 5.1% 4.5186 4.7177 5.2% 4.6072 4.80629 5.3% 4.6958 4.89487 5.4% 4.7844 4.98345 5.5% 4.873 5.07204 5.6% 4.9616 5.16062 5.7% 5.0502 5.24921 5.8% 5.1388 5.33779 5.9% 5.2274 5.42638 6.0% 5.316 5.51496 6.1% 5.4046 5.60355 6.2% 5.4932 5.69213 6.3% 5.5818 5.78071 6.4% 5.6704 5.8693 6.5% 5.759 5.95788 6.6% 5.8476 6.04647 6.7% 5.9362 6.13505 6.8% 6.0248 6.22364 6.9% 6.1134 6.31222 7.0% 6.202 6.40081 7.1% 6.2906 6.48939 7.2% 6.3792 6.57797 7.3% 6.4678 6.66656 7.4% 6.5564 6.75514 7.5% 6.645 6.84373 7.6% 6.7336 6.93231 7.7% 6.8222 7.0209 7.8% 6.9108 7.10948 7.9% 6.9994 7.19806 8.0% 7.088 7.28665 8.1% 7.1766 7.37523 8.2% 7.2652 7.46382 8.3% 7.3538 7.5524 8.4% 7.4424 7.64099 8.5% 7.531 7.72957 8.6% 7.6196 7.81815 8.7% 7.7082 7.90674 8.8% 7.7968 7.99532 8.9% 7.8854 8.08391 9.0% 7.974 8.17249 9.1% 8.0626 8.26108 9.2% 8.1512 8.34966 9.3% 8.2398 8.43825 9.4% 8.3284 8.52683 9.5% 8.417 8.61541 9.6% 8.5056 8.704 9.7% 8.5942 8.79258 9.8% 8.6828 8.88117 9.9% 8.7714 8.96975 10.0% 8.86 9.05834

Page 89: The Compression of IoT operational data time series in

Appendix C: Error bound test results of Mixed-PLA | 71

Mixed-PLA error analysis in Engine Speed Testing

error bound (percentage) error bound (value) actual maximum error 0.1% 1.61225 2.80484 0.2% 3.2245 4.39486 0.3% 4.83675 6.0015 0.4% 6.449 7.61096 0.5% 8.06125 9.22211 0.6% 9.6735 10.8325 0.7% 11.2858 12.4435 0.8% 12.898 388633 0.9% 14.5102 435183 1.0% 16.1225 17.2798 1.1% 17.7347 18.8899 1.2% 19.347 20.5022 1.3% 20.9593 22.1139 1.4% 22.5715 23.7252 1.5% 24.1837 25.336 1.6% 25.796 26.95 1.7% 27.4082 28.56 1.8% 29.0205 30.1738 1.9% 30.6328 31.7833 2.0% 32.245 33.3968 2.1% 33.8573 35.0104 2.2% 35.4695 36.6192 2.3% 37.0817 38.2326 2.4% 38.694 39.8459 2.5% 40.3062 41.4536 2.6% 41.9185 43.0668 2.7% 43.5307 44.6799 2.8% 45.143 46.293 2.9% 46.7552 47.9062 3.0% 48.3675 1.41E+06 3.1% 49.9798 1.46E+06 3.2% 51.592 52.7383 3.3% 53.2043 54.3512 3.4% 54.8165 55.9641 3.5% 56.4288 57.577 3.6% 58.041 59.19 3.7% 59.6532 60.7941 3.8% 61.2655 62.4068 3.9% 62.8777 64.0195 4.0% 64.49 65.6321 4.1% 66.1022 67.2448 4.2% 67.7145 68.8575 4.3% 69.3268 70.4701 4.4% 70.939 72.0828 4.5% 72.5512 73.6955 4.6% 74.1635 75.3082 4.7% 75.7758 76.9208 4.8% 77.388 78.5335 4.9% 79.0002 80.1462 5.0% 80.6125 81.7589 5.1% 82.2248 83.3601 5.2% 83.837 84.9725

Page 90: The Compression of IoT operational data time series in

72 | Appendix C: Error bound test results of Mixed-PLA

error bound (percentage) error bound (value) actual maximum error 5.3% 85.4493 86.585 5.4% 87.0615 88.1974 5.5% 88.6737 89.8099 5.6% 90.286 91.4223 5.7% 91.8983 93.0348 5.8% 93.5105 94.6472 5.9% 95.1227 96.2597 6.0% 96.735 97.8721 6.1% 98.3473 99.4846 6.2% 99.9595 101.097 6.3% 101.572 102.709 6.4% 103.184 104.322 6.5% 104.796 105.934 6.6% 106.409 107.547 6.7% 108.021 109.159 6.8% 109.633 110.772 6.9% 111.245 112.384 7.0% 112.858 113.997 7.1% 114.47 115.609 7.2% 116.082 117.222 7.3% 117.694 118.834 7.4% 119.306 120.446 7.5% 120.919 122.059 7.6% 122.531 123.671 7.7% 124.143 125.267 7.8% 125.755 126.88 7.9% 127.368 128.492 8.0% 128.98 130.104 8.1% 130.592 131.716 8.2% 132.204 133.329 8.3% 133.817 134.941 8.4% 135.429 136.553 8.5% 137.041 138.165 8.6% 138.654 139.778 8.7% 140.266 141.39 8.8% 141.878 143.002 8.9% 143.49 144.614 9.0% 145.102 146.226 9.1% 146.715 147.839 9.2% 148.327 149.451 9.3% 149.939 151.063 9.4% 151.552 152.675 9.5% 153.164 154.288 9.6% 154.776 155.9 9.7% 156.388 157.512 9.8% 158 159.124 9.9% 159.613 160.737 10.0% 161.225 162.349

Page 91: The Compression of IoT operational data time series in

Appendix C: Error bound test results of Mixed-PLA | 73

Mixed-PLA error analysis in Vehicle Speed Testing

error bound (percentage) error bound (value) maximum error 0.1% 0.0909766 0.0909841 0.2% 0.181953 0.181968 0.3% 0.27293 0.272951 0.4% 0.363906 0.363934 0.5% 0.454883 0.454917 0.6% 0.545859 0.545899 0.7% 0.636836 0.636881 0.8% 0.727812 0.727863 0.9% 0.818789 0.818845 1.0% 0.909766 0.909826 1.1% 1.00074 1.00081 1.2% 1.09172 1.09179 1.3% 1.1827 1.18277 1.4% 1.27367 1.27375 1.5% 1.36465 1.36473 1.6% 1.45562 1.45571 1.7% 1.5466 1.54669 1.8% 1.63758 1.63767 1.9% 1.72855 1.72865 2.0% 1.81953 1.81963 2.1% 1.91051 1.91064 2.2% 2.00148 2.00163 2.3% 2.09246 2.09256 2.4% 2.18344 2.18354 2.5% 2.27441 2.27452 2.6% 2.36539 2.3655 2.7% 2.45637 2.45648 2.8% 2.54734 2.54746 2.9% 2.63832 2.63843 3.0% 2.7293 2.72941 3.1% 2.82027 2.82039 3.2% 2.91125 2.91137 3.3% 3.00223 3.00235 3.4% 3.0932 3.09333 3.5% 3.18418 3.18431 3.6% 3.27516 3.27529 3.7% 3.36613 3.36627 3.8% 3.45711 3.45724 3.9% 3.54809 3.54822 4.0% 3.63906 3.6392 4.1% 3.73004 3.73018 4.2% 3.82102 3.82116 4.3% 3.91199 3.91214 4.4% 4.00297 4.00312 4.5% 4.09395 4.0941 4.6% 4.18492 4.18508 4.7% 4.2759 4.27606 4.8% 4.36687 4.36703 4.9% 4.45785 4.45801 5.0% 4.54883 4.54899 5.1% 4.6398 4.63997 5.2% 4.73078 4.73095

Page 92: The Compression of IoT operational data time series in

74 | Appendix C: Error bound test results of Mixed-PLA

error bound (percentage) error bound (value) maximum error 5.3% 4.82176 4.82193 5.4% 4.91273 4.9129 5.5% 5.00371 5.00388 5.6% 5.09469 5.09486 5.7% 5.18566 5.18584 5.8% 5.27664 5.27681 5.9% 5.36762 5.36779 6.0% 5.45859 5.45877 6.1% 5.54957 5.54975 6.2% 5.64055 5.64072 6.3% 5.73152 5.7317 6.4% 5.8225 5.82268 6.5% 5.91348 5.91365 6.6% 6.00445 6.00463 6.7% 6.09543 6.0956 6.8% 6.18641 6.18658 6.9% 6.27738 6.27756 7.0% 6.36836 6.36853 7.1% 6.45934 6.45951 7.2% 6.55031 6.55049 7.3% 6.64129 6.64146 7.4% 6.73227 6.73244 7.5% 6.82324 6.82341 7.6% 6.91422 6.91439 7.7% 7.0052 7.00624 7.8% 7.09617 7.09653 7.9% 7.18715 7.18751 8.0% 7.27812 7.27892 8.1% 7.3691 7.37034 8.2% 7.46008 7.46033 8.3% 7.55105 7.55175 8.4% 7.64203 7.64319 8.5% 7.73301 7.73329 8.6% 7.82398 7.82473 8.7% 7.91496 7.91618 8.8% 8.00594 8.00636 8.9% 8.09691 8.09781 9.0% 8.18789 8.18929 9.1% 8.27887 8.27916 9.2% 8.36984 8.37064 9.3% 8.46082 8.46212 9.4% 8.5518 8.55261 9.5% 8.64277 8.64416 9.6% 8.73375 8.73408 9.7% 8.82473 8.82557 9.8% 8.9157 8.9162 9.9% 9.00668 9.00771 10.0% 9.09766 9.0987

Page 93: The Compression of IoT operational data time series in

Appendix C: Error bound test results of Mixed-PLA | 75

Mixed-PLA error analysis in Odometer Testing

error bound (percentage) error bound (value) maximum error 0.1% 0.08506 0.0852015 0.2% 0.17012 0.170381 0.3% 0.25518 0.255607 0.4% 0.34024 0.340528 0.5% 0.4253 0.425778 0.6% 0.51036 0.511086 0.7% 0.59542 0.596457 0.8% 0.68048 0.680651 0.9% 0.76554 0.765999 1.0% 0.8506 0.851488 1.1% 0.93566 0.937073 1.2% 1.02072 1.02089 1.3% 1.10578 1.10652 1.4% 1.19084 1.19228 1.5% 1.2759 1.27816 1.6% 1.36096 1.36167 1.7% 1.44602 1.44747 1.8% 1.53108 1.53299 1.9% 1.61614 1.61874 2.0% 1.7012 1.70155 2.1% 1.78626 1.78748 2.2% 1.87132 1.87411 2.3% 1.95638 1.95738 2.4% 2.04144 2.04487 2.5% 2.1265 2.12832 2.6% 2.21156 2.21282 2.7% 2.29662 2.29818 2.8% 2.38168 2.38489 2.9% 2.46674 2.46861 3.0% 2.5518 2.55343 3.1% 2.63686 2.63944 3.2% 2.72192 2.72272 3.3% 2.80698 2.80764 3.4% 2.89204 2.8926 3.5% 2.9771 2.97762 3.6% 3.06216 3.06269 3.7% 3.14722 3.14782 3.8% 3.23228 3.233 3.9% 3.31734 3.31825 4.0% 3.4024 3.40356 4.1% 3.48746 3.48895 4.2% 3.57252 3.57441 4.3% 3.65758 3.65994 4.4% 3.74264 3.74556 4.5% 3.8277 3.83127 4.6% 3.91276 3.91707 4.7% 3.99782 4.00184 4.8% 4.08288 4.08818 4.9% 4.16794 4.1748 5.0% 4.253 4.25452 5.1% 4.33806 4.34156 5.2% 4.42312 4.42889

Page 94: The Compression of IoT operational data time series in

76 | Appendix C: Error bound test results of Mixed-PLA

error bound (percentage) error bound (value) maximum error 5.3% 4.50818 4.50895 5.4% 4.59324 4.59672 5.5% 4.6783 4.68478 5.6% 4.76336 4.7646 5.7% 4.84842 4.85248 5.8% 4.93348 4.94065 5.9% 5.01854 5.02076 6.0% 5.1036 5.10938 6.1% 5.18866 5.18968 6.2% 5.27372 5.27876 6.3% 5.35878 5.35927 6.4% 5.44384 5.44879 6.5% 5.5289 5.52952 6.6% 5.61396 5.61454 6.7% 5.69902 5.69989 6.8% 5.78408 5.78564 6.9% 5.86914 5.87177 7.0% 5.9542 5.95825 7.1% 6.03926 6.04021 7.2% 6.12432 6.12796 7.3% 6.20938 6.21331 7.4% 6.29444 6.29883 7.5% 6.3795 6.38453 7.6% 6.46456 6.4649 7.7% 6.54962 6.55095 7.8% 6.63468 6.63732 7.9% 6.71974 6.72406 8.0% 6.8048 6.80518 8.1% 6.88986 6.8928 8.2% 6.97492 6.98113 8.3% 7.05998 7.06388 8.4% 7.14504 7.14753 8.5% 7.2301 7.23546 8.6% 7.31516 7.32201 8.7% 7.40022 7.40153 8.8% 7.48528 7.48838 8.9% 7.57034 7.5755 9.0% 7.6554 7.65551 9.1% 7.74046 7.743 9.2% 7.82552 7.83077 9.3% 7.91058 7.91102 9.4% 7.99564 7.99886 9.5% 8.0807 8.0836 9.6% 8.16576 8.16831 9.7% 8.25082 8.25301 9.8% 8.33588 8.33767 9.9% 8.42094 8.42234 10.0% 8.506 8.50697

Page 95: The Compression of IoT operational data time series in

TRITA-EECS-EX-2018:XX

www.kth.se